1 %option nounput never-interactive
5 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
6 * Copyright (c) 1999-2007 by Hiroyuki Yamamoto & The Claws Mail Team
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "quote_fmt_lex.h"
24 #include "quote_fmt_parse.h"
28 %option prefix="quote_fmt"
29 %option outfile="lex.yy.c"
37 int quote_fmt_firsttime = 1;
45 * this lex script used to use characters also in use
46 * by strftime() (which we want to use for custom
47 * time formats in replies and templates). to circumvent
48 * this we have to play a little bit with states.
50 * these are the characters we also want to use in the
53 * %a %A %b %B %c %C %d %H %I %j %m %M %p %S %w %x %y %Y %Z
55 * you can use these characters too, but don't forget to
56 * prepend them with the <S_NORMAL> state.
58 * also there is also work around for resetting the state
59 * (firsttime variable). this assumes that yylex() will
60 * always return to S_NORMAL after quote fmt parsing is
66 if (quote_fmt_firsttime) {
68 quote_fmt_firsttime = 0;
72 <S_NORMAL>"%X" /* cursor pos */ return SET_CURSOR_POS;
73 <S_NORMAL>"%c" /* cc */ return SHOW_CC;
74 <S_NORMAL>"%d" /* date */ return SHOW_DATE;
75 <S_NORMAL>"%D" /* date */ { BEGIN S_DATE; return SHOW_DATE_EXPR; }
76 <S_NORMAL>"%f" /* from */ return SHOW_FROM;
77 <S_NORMAL>"%F" /* first name */ return SHOW_FIRST_NAME;
78 <S_NORMAL>"%i" /* message-id */ return SHOW_MESSAGEID;
79 <S_NORMAL>"%I" /* initial of sender */ return SHOW_SENDER_INITIAL;
80 <S_NORMAL>"%m" /* message with no signature */ return SHOW_MESSAGE_NO_SIGNATURE;
81 <S_NORMAL>"%M" /* message */ return SHOW_MESSAGE;
82 <S_NORMAL>"%n" /* newsgroups */ return SHOW_NEWSGROUPS;
83 <S_NORMAL>"%N" /* full name */ return SHOW_FULLNAME;
84 <S_NORMAL>"%L" /* last name */ return SHOW_LAST_NAME;
85 <S_NORMAL>"%r" /* references */ return SHOW_REFERENCES;
86 <S_NORMAL>"%s" /* subject */ return SHOW_SUBJECT;
87 <S_NORMAL>"%t" /* to */ return SHOW_TO;
88 <S_NORMAL>"%Q" /* quoted message */ return SHOW_QUOTED_MESSAGE;
89 <S_NORMAL>"%q" /* quoted message with no signature */ return SHOW_QUOTED_MESSAGE_NO_SIGNATURE;
90 <S_NORMAL>"%af" /* full name in compose account */ return SHOW_ACCOUNT_FULL_NAME;
91 <S_NORMAL>"%am" /* mail address in compose account */ return SHOW_ACCOUNT_MAIL_ADDRESS;
92 <S_NORMAL>"%an" /* compose account name itself */ return SHOW_ACCOUNT_NAME;
93 <S_NORMAL>"%ao" /* organization in compose account */ return SHOW_ACCOUNT_ORGANIZATION;
94 "\\\%" /* % */ return SHOW_PERCENT;
95 "\\\\" /* \ */ return SHOW_BACKSLASH;
96 "\\t"|"\t" /* tab */ return SHOW_TAB;
97 "\\n"|"\n" /* return */ return SHOW_EOL;
98 "\\?" /* ? */ return SHOW_QUESTION_MARK;
99 "\\!" return SHOW_EXCLAMATION_MARK;
100 "\\|" return SHOW_PIPE;
101 "\\{" return SHOW_OPARENT;
102 "\\}" return SHOW_CPARENT;
103 "?d" /* query date */ return QUERY_DATE;
104 "?f" /* query from */ return QUERY_FROM;
105 "?N"|"?F"|"?L"|"?I" /* query from name */ return QUERY_FULLNAME;
106 "?s" /* query subject */ return QUERY_SUBJECT;
107 "?t" /* query to */ return QUERY_TO;
108 "?c" /* query cc */ return QUERY_CC;
109 "?n" /* query newsgroups */ return QUERY_NEWSGROUPS;
110 "?i" /* query message-id */ return QUERY_MESSAGEID;
111 "?r" /* query references */ return QUERY_REFERENCES;
112 "?af" /* query full name in compose account */ return QUERY_ACCOUNT_FULL_NAME;
113 "?ao" /* query organization in compose account */ return QUERY_ACCOUNT_ORGANIZATION;
114 "|f" /* insert file */ return INSERT_FILE;
115 "|p" /* insert program output */ return INSERT_PROGRAMOUTPUT;
116 "|i" /* insert user input */ return INSERT_USERINPUT;
117 "!d" /* query date */ return QUERY_NOT_DATE;
118 "!f" /* query from */ return QUERY_NOT_FROM;
119 "!N"|"!F"|"!L"|"!I" /* query not(from name) */ return QUERY_NOT_FULLNAME;
120 "!s" /* query not(subject) */ return QUERY_NOT_SUBJECT;
121 "!t" /* query not(to) */ return QUERY_NOT_TO;
122 "!c" /* query not(cc) */ return QUERY_NOT_CC;
123 "!n" /* query not(newsgroups) */ return QUERY_NOT_NEWSGROUPS;
124 "!i" /* query not(message-id) */ return QUERY_NOT_MESSAGEID;
125 "!r" /* query not(references) */ return QUERY_NOT_REFERENCES;
126 "!af" /* query not(full name in compose account) */ return QUERY_NOT_ACCOUNT_FULL_NAME;
127 "!ao" /* query not(organization in compose account) */ return QUERY_NOT_ACCOUNT_ORGANIZATION;
128 <S_DATE>"{" return OPARENT;
129 <S_DATE>"}" { BEGIN S_NORMAL; return CPARENT; }
130 <S_NORMAL>"{" return OPARENT;
131 <S_NORMAL>"}" return CPARENT;
132 . { yylval.chr = yytext[0]; return CHARACTER; }