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