Diffstat (limited to 'library/backend/vcc_yacc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | library/backend/vcc_yacc.cpp | 169 |
1 files changed, 100 insertions, 69 deletions
diff --git a/library/backend/vcc_yacc.cpp b/library/backend/vcc_yacc.cpp index cb24631..19a108f 100644 --- a/library/backend/vcc_yacc.cpp +++ b/library/backend/vcc_yacc.cpp | |||
@@ -1,610 +1,636 @@ | |||
1 | #ifndef lint | 1 | #ifndef lint |
2 | static char yysccsid[] = "@(#)yaccpar1.9 (Berkeley) 02/21/93"; | 2 | /*static char yysccsid[] = "from: @(#)yaccpar1.9 (Berkeley) 02/21/93";*/ |
3 | static char yyrcsid[] = "$Id$"; | ||
3 | #endif | 4 | #endif |
4 | #define YYBYACC 1 | 5 | #define YYBYACC 1 |
5 | #define YYMAJOR 1 | 6 | #define YYMAJOR 1 |
6 | #define YYMINOR 9 | 7 | #define YYMINOR 9 |
7 | #define yyclearin (yychar=(-1)) | 8 | #define yyclearin (yychar=(-1)) |
8 | #define yyerrok (yyerrflag=0) | 9 | #define yyerrok (yyerrflag=0) |
9 | #define YYRECOVERING (yyerrflag!=0) | 10 | #define YYRECOVERING (yyerrflag!=0) |
10 | #define YYPREFIX "yy" | 11 | #define yyparse vccparse |
11 | #line 1 "vcc.y" | 12 | #define yylex vcclex |
13 | #define yyerror vccerror | ||
14 | #define yychar vccchar | ||
15 | #define yyval vccval | ||
16 | #define yylval vcclval | ||
17 | #define yydebug vccdebug | ||
18 | #define yynerrs vccnerrs | ||
19 | #define yyerrflag vccerrflag | ||
20 | #define yyss vccss | ||
21 | #define yyssp vccssp | ||
22 | #define yyvs vccvs | ||
23 | #define yyvsp vccvsp | ||
24 | #define yylhs vcclhs | ||
25 | #define yylen vcclen | ||
26 | #define yydefred vccdefred | ||
27 | #define yydgoto vccdgoto | ||
28 | #define yysindex vccsindex | ||
29 | #define yyrindex vccrindex | ||
30 | #define yygindex vccgindex | ||
31 | #define yytable vcctable | ||
32 | #define yycheck vcccheck | ||
33 | #define yyname vccname | ||
34 | #define yyrule vccrule | ||
35 | #define YYPREFIX "vcc" | ||
36 | #line 1 "backend/vcc.y" | ||
12 | 37 | ||
13 | 38 | ||
14 | /*************************************************************************** | 39 | /*************************************************************************** |
15 | (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International | 40 | (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International |
16 | Business Machines Corporation and Siemens Rolm Communications Inc. | 41 | Business Machines Corporation and Siemens Rolm Communications Inc. |
17 | 42 | ||
18 | For purposes of this license notice, the term Licensors shall mean, | 43 | For purposes of this license notice, the term Licensors shall mean, |
19 | collectively, Apple Computer, Inc., AT&T Corp., International | 44 | collectively, Apple Computer, Inc., AT&T Corp., International |
20 | Business Machines Corporation and Siemens Rolm Communications Inc. | 45 | Business Machines Corporation and Siemens Rolm Communications Inc. |
21 | The term Licensor shall mean any of the Licensors. | 46 | The term Licensor shall mean any of the Licensors. |
22 | 47 | ||
23 | Subject to acceptance of the following conditions, permission is hereby | 48 | Subject to acceptance of the following conditions, permission is hereby |
24 | granted by Licensors without the need for written agreement and without | 49 | granted by Licensors without the need for written agreement and without |
25 | license or royalty fees, to use, copy, modify and distribute this | 50 | license or royalty fees, to use, copy, modify and distribute this |
26 | software for any purpose. | 51 | software for any purpose. |
27 | 52 | ||
28 | The above copyright notice and the following four paragraphs must be | 53 | The above copyright notice and the following four paragraphs must be |
29 | reproduced in all copies of this software and any software including | 54 | reproduced in all copies of this software and any software including |
30 | this software. | 55 | this software. |
31 | 56 | ||
32 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE | 57 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE |
33 | ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR | 58 | ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR |
34 | MODIFICATIONS. | 59 | MODIFICATIONS. |
35 | 60 | ||
36 | IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, | 61 | IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, |
37 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT | 62 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT |
38 | OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 63 | OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
39 | DAMAGE. | 64 | DAMAGE. |
40 | 65 | ||
41 | EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, | 66 | EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, |
42 | INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE | 67 | INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE |
43 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 68 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
44 | PURPOSE. | 69 | PURPOSE. |
45 | 70 | ||
46 | The software is provided with RESTRICTED RIGHTS. Use, duplication, or | 71 | The software is provided with RESTRICTED RIGHTS. Use, duplication, or |
47 | disclosure by the government are subject to restrictions set forth in | 72 | disclosure by the government are subject to restrictions set forth in |
48 | DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | 73 | DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. |
49 | 74 | ||
50 | ***************************************************************************/ | 75 | ***************************************************************************/ |
51 | 76 | ||
52 | /* | 77 | /* |
53 | * src: vcc.c | 78 | * src: vcc.c |
54 | * doc: Parser for vCard and vCalendar. Note that this code is | 79 | * doc: Parser for vCard and vCalendar. Note that this code is |
55 | * generated by a yacc parser generator. Generally it should not | 80 | * generated by a yacc parser generator. Generally it should not |
56 | * be edited by hand. The real source is vcc.y. The #line directives | 81 | * be edited by hand. The real source is vcc.y. The #line directives |
57 | * can be commented out here to make it easier to trace through | 82 | * can be commented out here to make it easier to trace through |
58 | * in a debugger. However, if a bug is found it should | 83 | * in a debugger. However, if a bug is found it should |
59 | * be fixed in vcc.y and this file regenerated. | 84 | * be fixed in vcc.y and this file regenerated. |
60 | */ | 85 | */ |
61 | 86 | ||
62 | 87 | ||
63 | /* debugging utilities */ | 88 | /* debugging utilities */ |
64 | #if __DEBUG | 89 | #if __DEBUG |
65 | #define DBG_(x) printf x | 90 | #define DBG_(x) printf x |
66 | #else | 91 | #else |
67 | #define DBG_(x) | 92 | #define DBG_(x) |
68 | #endif | 93 | #endif |
69 | 94 | ||
70 | /**** External Functions ****/ | 95 | /**** External Functions ****/ |
71 | 96 | ||
72 | /* assign local name to parser variables and functions so that | 97 | /* assign local name to parser variables and functions so that |
73 | we can use more than one yacc based parser. | 98 | we can use more than one yacc based parser. |
74 | */ | 99 | */ |
75 | 100 | ||
101 | #if 0 | ||
76 | #define yyparse mime_parse | 102 | #define yyparse mime_parse |
77 | #define yylex mime_lex | 103 | #define yylex mime_lex |
78 | #define yyerror mime_error | 104 | #define yyerror mime_error |
79 | #define yychar mime_char | 105 | #define yychar mime_char |
80 | /* #define p_yyval p_mime_val */ | 106 | /* #define p_yyval p_mime_val */ |
81 | #undef yyval | 107 | #undef yyval |
82 | #define yyval mime_yyval | 108 | #define yyval mime_yyval |
83 | /* #define p_yylval p_mime_lval */ | 109 | /* #define p_yylval p_mime_lval */ |
84 | #undef yylval | 110 | #undef yylval |
85 | #define yylval mime_yylval | 111 | #define yylval mime_yylval |
86 | #define yydebug mime_debug | 112 | #define yydebug mime_debug |
87 | #define yynerrs mime_nerrs | 113 | #define yynerrs mime_nerrs |
88 | #define yyerrflag mime_errflag | 114 | #define yyerrflag mime_errflag |
89 | #define yyss mime_ss | 115 | #define yyss mime_ss |
90 | #define yyssp mime_ssp | 116 | #define yyssp mime_ssp |
91 | #define yyvs mime_vs | 117 | #define yyvs mime_vs |
92 | #define yyvsp mime_vsp | 118 | #define yyvsp mime_vsp |
93 | #define yylhs mime_lhs | 119 | #define yylhs mime_lhs |
94 | #define yylen mime_len | 120 | #define yylen mime_len |
95 | #define yydefred mime_defred | 121 | #define yydefred mime_defred |
96 | #define yydgoto mime_dgoto | 122 | #define yydgoto mime_dgoto |
97 | #define yysindex mime_sindex | 123 | #define yysindex mime_sindex |
98 | #define yyrindex mime_rindex | 124 | #define yyrindex mime_rindex |
99 | #define yygindex mime_gindex | 125 | #define yygindex mime_gindex |
100 | #define yytable mime_table | 126 | #define yytable mime_table |
101 | #define yycheck mime_check | 127 | #define yycheck mime_check |
102 | #define yyname mime_name | 128 | #define yyname mime_name |
103 | #define yyrule mime_rule | 129 | #define yyrule mime_rule |
104 | #ifdef YYPREFIX | 130 | #ifdef YYPREFIX |
105 | #undef YYPREFIX | 131 | #undef YYPREFIX |
106 | #endif | 132 | #endif |
107 | #define YYPREFIX "mime_" | 133 | #define YYPREFIX "mime_" |
134 | #endif | ||
108 | 135 | ||
109 | 136 | ||
110 | #ifndef _NO_LINE_FOLDING | 137 | #ifndef _NO_LINE_FOLDING |
111 | #define _SUPPORT_LINE_FOLDING 1 | 138 | #define _SUPPORT_LINE_FOLDING 1 |
112 | #endif | 139 | #endif |
113 | 140 | ||
114 | /* undef below if compile with MFC */ | 141 | /* undef below if compile with MFC */ |
115 | /* #define INCLUDEMFC 1 */ | 142 | /* #define INCLUDEMFC 1 */ |
116 | 143 | ||
117 | #if defined(WIN32) || defined(_WIN32) | 144 | #if defined(WIN32) || defined(_WIN32) |
118 | #ifdef INCLUDEMFC | 145 | #ifdef INCLUDEMFC |
119 | #include <afx.h> | 146 | #include <afx.h> |
120 | #endif | 147 | #endif |
121 | #endif | 148 | #endif |
122 | 149 | ||
123 | #include <string.h> | 150 | #include <string.h> |
124 | #ifndef __MWERKS__ | 151 | #ifndef __MWERKS__ |
125 | #include <stdlib.h> | 152 | #include <stdlib.h> |
126 | #endif | 153 | #endif |
127 | #include <stdio.h> | 154 | #include <stdio.h> |
128 | #include <stdlib.h> | 155 | #include <stdlib.h> |
129 | #include <ctype.h> | 156 | #include <ctype.h> |
130 | 157 | ||
131 | #ifdef PALMTOPCENTER | 158 | /*#ifdef PALMTOPCENTER */ |
132 | #include <qpe/vobject_p.h> | 159 | /*#include <qpe/vobject_p.h> */ |
133 | #include <qpe/qfiledirect_p.h> | 160 | /*#else */ |
134 | #else | ||
135 | #include "vobject_p.h" | 161 | #include "vobject_p.h" |
136 | #include "qfiledirect_p.h" | 162 | /*#endif */ |
137 | #endif | ||
138 | 163 | ||
139 | /**** Types, Constants ****/ | 164 | /**** Types, Constants ****/ |
140 | 165 | ||
141 | #define YYDEBUG 0/* 1 to compile in some debugging code */ | 166 | #define YYDEBUG 0/* 1 to compile in some debugging code */ |
142 | #define MAXTOKEN 256/* maximum token (line) length */ | 167 | #define MAXTOKEN 256/* maximum token (line) length */ |
143 | #define YYSTACKSIZE 100/* ~unref ? | 168 | #define YYSTACKSIZE 100/* ~unref ? */ |
144 | */ | ||
145 | #define MAXLEVEL 10/* max # of nested objects parseable */ | 169 | #define MAXLEVEL 10/* max # of nested objects parseable */ |
146 | /* (includes outermost) */ | 170 | /* (includes outermost) */ |
147 | 171 | ||
148 | 172 | ||
149 | /**** Global Variables ****/ | 173 | /**** Global Variables ****/ |
150 | int mime_lineNum, mime_numErrors; /* yyerror() can use these */ | 174 | int mime_lineNum, mime_numErrors; /* yyerror() can use these */ |
151 | static VObject* vObjList; | 175 | static VObject* vObjList; |
152 | static VObject *curProp; | 176 | static VObject *curProp; |
153 | static VObject *curObj; | 177 | static VObject *curObj; |
154 | static VObject* ObjStack[MAXLEVEL]; | 178 | static VObject* ObjStack[MAXLEVEL]; |
155 | static int ObjStackTop; | 179 | static int ObjStackTop; |
156 | 180 | ||
157 | 181 | ||
158 | /* A helpful utility for the rest of the app. */ | 182 | /* A helpful utility for the rest of the app. */ |
159 | #if __CPLUSPLUS__ | 183 | #if __CPLUSPLUS__ |
160 | extern "C" { | 184 | extern "C" { |
161 | #endif | 185 | #endif |
162 | 186 | ||
163 | extern void yyerror(char *s); | 187 | extern void yyerror(char *s); |
164 | 188 | ||
165 | #if __CPLUSPLUS__ | 189 | #if __CPLUSPLUS__ |
166 | }; | 190 | }; |
167 | #endif | 191 | #endif |
168 | 192 | ||
169 | int yyparse(); | 193 | int yyparse(); |
170 | 194 | ||
171 | enum LexMode { | 195 | enum LexMode { |
172 | L_NORMAL, | 196 | L_NORMAL, |
173 | L_VCARD, | 197 | L_VCARD, |
174 | L_VCAL, | 198 | L_VCAL, |
175 | L_VEVENT, | 199 | L_VEVENT, |
176 | L_VTODO, | 200 | L_VTODO, |
177 | L_VALUES, | 201 | L_VALUES, |
178 | L_BASE64, | 202 | L_BASE64, |
179 | L_QUOTED_PRINTABLE | 203 | L_QUOTED_PRINTABLE |
180 | }; | 204 | }; |
181 | 205 | ||
182 | /**** Private Forward Declarations ****/ | 206 | /**** Private Forward Declarations ****/ |
183 | static int pushVObject(const char *prop); | 207 | static int pushVObject(const char *prop); |
184 | static VObject* popVObject(); | 208 | static VObject* popVObject(); |
185 | static void lexPopMode(int top); | 209 | static void lexPopMode(int top); |
186 | static int lexWithinMode(enum LexMode mode); | 210 | static int lexWithinMode(enum LexMode mode); |
187 | static void lexPushMode(enum LexMode mode); | 211 | static void lexPushMode(enum LexMode mode); |
188 | static void enterProps(const char *s); | 212 | static void enterProps(const char *s); |
189 | static void enterAttr(const char *s1, const char *s2); | 213 | static void enterAttr(const char *s1, const char *s2); |
190 | static void enterValues(const char *value); | 214 | static void enterValues(const char *value); |
215 | #define mime_error yyerror | ||
216 | void mime_error(char *s); | ||
191 | void mime_error_(char *s); | 217 | void mime_error_(char *s); |
192 | 218 | ||
193 | #line 185 "vcc.y" | 219 | #line 189 "backend/vcc.y" |
194 | typedef union { | 220 | typedef union { |
195 | char *str; | 221 | char *str; |
196 | VObject *vobj; | 222 | VObject *vobj; |
197 | } YYSTYPE; | 223 | } YYSTYPE; |
198 | #line 196 "y.tab.c" | 224 | #line 225 "y.tab.c" |
199 | #define EQ 257 | 225 | #define EQ 257 |
200 | #define COLON 258 | 226 | #define COLON 258 |
201 | #define DOT 259 | 227 | #define DOT 259 |
202 | #define SEMICOLON 260 | 228 | #define SEMICOLON 260 |
203 | #define SPACE 261 | 229 | #define SPACE 261 |
204 | #define HTAB 262 | 230 | #define HTAB 262 |
205 | #define LINESEP 263 | 231 | #define LINESEP 263 |
206 | #define NEWLINE 264 | 232 | #define NEWLINE 264 |
207 | #define BEGIN_VCARD 265 | 233 | #define BEGIN_VCARD 265 |
208 | #define END_VCARD 266 | 234 | #define END_VCARD 266 |
209 | #define BEGIN_VCAL 267 | 235 | #define BEGIN_VCAL 267 |
210 | #define END_VCAL 268 | 236 | #define END_VCAL 268 |
211 | #define BEGIN_VEVENT 269 | 237 | #define BEGIN_VEVENT 269 |
212 | #define END_VEVENT 270 | 238 | #define END_VEVENT 270 |
213 | #define BEGIN_VTODO 271 | 239 | #define BEGIN_VTODO 271 |
214 | #define END_VTODO 272 | 240 | #define END_VTODO 272 |
215 | #define ID 273 | 241 | #define ID 273 |
216 | #define STRING 274 | 242 | #define STRING 274 |
217 | #define YYERRCODE 256 | 243 | #define YYERRCODE 256 |
218 | short yylhs[] = { -1, | 244 | short vcclhs[] = { -1, |
219 | 0, 6, 6, 5, 5, 8, 3, 9, 3, 7, | 245 | 0, 6, 6, 5, 5, 8, 3, 9, 3, 7, |
220 | 7, 13, 10, 10, 15, 11, 11, 14, 14, 16, | 246 | 7, 13, 10, 10, 15, 11, 11, 14, 14, 16, |
221 | 17, 17, 1, 18, 12, 12, 2, 2, 20, 4, | 247 | 17, 17, 1, 18, 12, 12, 2, 2, 20, 4, |
222 | 21, 4, 19, 19, 22, 22, 22, 25, 23, 26, | 248 | 21, 4, 19, 19, 22, 22, 22, 25, 23, 26, |
223 | 23, 27, 24, 28, 24, | 249 | 23, 27, 24, 28, 24, |
224 | }; | 250 | }; |
225 | short yylen[] = { 2, | 251 | short vcclen[] = { 2, |
226 | 1, 2, 1, 1, 1, 0, 4, 0, 3, 2, | 252 | 1, 2, 1, 1, 1, 0, 4, 0, 3, 2, |
227 | 1, 0, 5, 1, 0, 3, 1, 2, 1, 2, | 253 | 1, 0, 5, 1, 0, 3, 1, 2, 1, 2, |
228 | 1, 3, 1, 0, 4, 1, 1, 0, 0, 4, | 254 | 1, 3, 1, 0, 4, 1, 1, 0, 0, 4, |
229 | 0, 3, 2, 1, 1, 1, 1, 0, 4, 0, | 255 | 0, 3, 2, 1, 1, 1, 1, 0, 4, 0, |
230 | 3, 0, 4, 0, 3, | 256 | 3, 0, 4, 0, 3, |
231 | }; | 257 | }; |
232 | short yydefred[] = { 0, | 258 | short vccdefred[] = { 0, |
233 | 0, 0, 0, 4, 5, 3, 0, 0, 0, 0, | 259 | 0, 0, 0, 4, 5, 3, 0, 0, 0, 0, |
234 | 0, 2, 14, 23, 0, 0, 11, 0, 9, 0, | 260 | 0, 2, 14, 23, 0, 0, 11, 0, 9, 0, |
235 | 0, 0, 0, 34, 35, 36, 32, 0, 7, 10, | 261 | 0, 0, 0, 34, 35, 36, 32, 0, 7, 10, |
236 | 12, 0, 0, 0, 0, 30, 33, 0, 0, 19, | 262 | 12, 0, 0, 0, 0, 30, 33, 0, 0, 19, |
237 | 0, 0, 41, 0, 45, 0, 20, 18, 27, 0, | 263 | 0, 0, 41, 0, 45, 0, 20, 18, 27, 0, |
238 | 0, 39, 43, 0, 24, 13, 22, 0, 25, | 264 | 0, 39, 43, 0, 24, 13, 22, 0, 25, |
239 | }; | 265 | }; |
240 | short yydgoto[] = { 3, | 266 | short vccdgoto[] = { 3, |
241 | 15, 50, 4, 5, 6, 7, 22, 8, 9, 17, | 267 | 15, 50, 4, 5, 6, 7, 22, 8, 9, 17, |
242 | 18, 51, 41, 39, 28, 40, 47, 58, 23, 10, | 268 | 18, 51, 41, 39, 28, 40, 47, 58, 23, 10, |
243 | 11, 24, 25, 26, 32, 33, 34, 35, | 269 | 11, 24, 25, 26, 32, 33, 34, 35, |
244 | }; | 270 | }; |
245 | short yysindex[] = { -262, | 271 | short vccsindex[] = { -262, |
246 | 0, 0, 0, 0, 0, 0, -262, -252, -219, -249, | 272 | 0, 0, 0, 0, 0, 0, -262, -252, -219, -249, |
247 | -256, 0, 0, 0, 0, -227, 0, -242, 0, 0, | 273 | -256, 0, 0, 0, 0, -227, 0, -242, 0, 0, |
248 | 0, -252, -254, 0, 0, 0, 0, -208, 0, 0, | 274 | 0, -252, -254, 0, 0, 0, 0, -208, 0, 0, |
249 | 0, -252, -228, -252, -213, 0, 0, -212, -208, 0, | 275 | 0, -252, -228, -252, -213, 0, 0, -212, -208, 0, |
250 | -214, -233, 0, -224, 0, -195, 0, 0, 0, -197, | 276 | -214, -233, 0, -224, 0, -195, 0, 0, 0, -197, |
251 | -199, 0, 0, -212, 0, 0, 0, -214, 0, | 277 | -199, 0, 0, -212, 0, 0, 0, -214, 0, |
252 | }; | 278 | }; |
253 | short yyrindex[] = { 0, | 279 | short vccrindex[] = { 0, |
254 | -222, -238, 0, 0, 0, 0, 65, 0, 0, 0, | 280 | -222, -238, 0, 0, 0, 0, 65, 0, 0, 0, |
255 | 0, 0, 0, 0, -215, 0, 0, 0, 0, -220, | 281 | 0, 0, 0, 0, -215, 0, 0, 0, 0, -220, |
256 | -218, -260, 0, 0, 0, 0, 0, 0, 0, 0, | 282 | -218, -260, 0, 0, 0, 0, 0, 0, 0, 0, |
257 | 0, 0, 0, 0, 0, 0, 0, 0, -192, 0, | 283 | 0, 0, 0, 0, 0, 0, 0, 0, -192, 0, |
258 | -250, 0, 0, 0, 0, -202, 0, 0, 0, -196, | 284 | -250, 0, 0, 0, 0, -202, 0, 0, 0, -196, |
259 | 0, 0, 0, 0, 0, 0, 0, -250, 0, | 285 | 0, 0, 0, 0, 0, 0, 0, -250, 0, |
260 | }; | 286 | }; |
261 | short yygindex[] = { 0, | 287 | short vccgindex[] = { 0, |
262 | 3, 0, 0, 0, 61, 0, -7, 0, 0, -16, | 288 | 3, 0, 0, 0, 61, 0, -7, 0, 0, -16, |
263 | 0, 11, 0, 0, 0, 31, 0, 0, 0, 0, | 289 | 0, 11, 0, 0, 0, 31, 0, 0, 0, 0, |
264 | 0, 48, 0, 0, 0, 0, 0, 0, | 290 | 0, 48, 0, 0, 0, 0, 0, 0, |
265 | }; | 291 | }; |
266 | #define YYTABLESIZE 71 | 292 | #define YYTABLESIZE 71 |
267 | short yytable[] = { 30, | 293 | short vcctable[] = { 30, |
268 | 16, 13, 1, 13, 2, 30, 13, 37, 37, 28, | 294 | 16, 13, 1, 13, 2, 30, 13, 37, 37, 28, |
269 | 37, 27, 28, 36, 20, 31, 21, 29, 14, 20, | 295 | 37, 27, 28, 36, 20, 31, 21, 29, 14, 20, |
270 | 14, 21, 13, 14, 42, 30, 44, 30, 13, 31, | 296 | 14, 21, 13, 14, 42, 30, 44, 30, 13, 31, |
271 | 29, 13, 29, 6, 29, 38, 52, 42, 29, 14, | 297 | 29, 13, 29, 6, 29, 38, 52, 42, 29, 14, |
272 | 46, 43, 17, 8, 15, 14, 19, 53, 14, 40, | 298 | 46, 43, 17, 8, 15, 14, 19, 53, 14, 40, |
273 | 6, 38, 38, 44, 42, 21, 57, 21, 45, 49, | 299 | 6, 38, 38, 44, 42, 21, 57, 21, 45, 49, |
274 | 14, 54, 55, 56, 1, 16, 26, 12, 59, 48, | 300 | 14, 54, 55, 56, 1, 16, 26, 12, 59, 48, |
275 | 37, | 301 | 37, |
276 | }; | 302 | }; |
277 | short yycheck[] = { 16, | 303 | short vcccheck[] = { 16, |
278 | 8, 256, 265, 256, 267, 22, 256, 268, 269, 260, | 304 | 8, 256, 265, 256, 267, 22, 256, 268, 269, 260, |
279 | 271, 268, 263, 268, 269, 258, 271, 256, 273, 269, | 305 | 271, 268, 263, 268, 269, 258, 271, 256, 273, 269, |
280 | 273, 271, 256, 273, 32, 42, 34, 44, 256, 268, | 306 | 273, 271, 256, 273, 32, 42, 34, 44, 256, 268, |
281 | 269, 256, 271, 256, 273, 256, 270, 256, 266, 273, | 307 | 269, 256, 271, 256, 273, 256, 270, 256, 266, 273, |
282 | 38, 270, 258, 266, 260, 273, 266, 272, 273, 270, | 308 | 38, 270, 258, 266, 260, 273, 266, 272, 273, 270, |
283 | 273, 260, 273, 272, 273, 258, 54, 260, 272, 274, | 309 | 273, 260, 273, 272, 273, 258, 54, 260, 272, 274, |
284 | 273, 257, 260, 263, 0, 258, 263, 7, 58, 39, | 310 | 273, 257, 260, 263, 0, 258, 263, 7, 58, 39, |
285 | 23, | 311 | 23, |
286 | }; | 312 | }; |
287 | #define YYFINAL 3 | 313 | #define YYFINAL 3 |
288 | #ifndef YYDEBUG | 314 | #ifndef YYDEBUG |
289 | #define YYDEBUG 0 | 315 | #define YYDEBUG 0 |
290 | #endif | 316 | #endif |
291 | #define YYMAXTOKEN 274 | 317 | #define YYMAXTOKEN 274 |
292 | #if YYDEBUG | 318 | #if YYDEBUG |
293 | char *yyname[] = { | 319 | char *vccname[] = { |
294 | "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 320 | "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
295 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 321 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
296 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 322 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
297 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 323 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
298 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 324 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
299 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 325 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
300 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"EQ","COLON","DOT","SEMICOLON", | 326 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"EQ","COLON","DOT","SEMICOLON", |
301 | "SPACE","HTAB","LINESEP","NEWLINE","BEGIN_VCARD","END_VCARD","BEGIN_VCAL", | 327 | "SPACE","HTAB","LINESEP","NEWLINE","BEGIN_VCARD","END_VCARD","BEGIN_VCAL", |
302 | "END_VCAL","BEGIN_VEVENT","END_VEVENT","BEGIN_VTODO","END_VTODO","ID","STRING", | 328 | "END_VCAL","BEGIN_VEVENT","END_VEVENT","BEGIN_VTODO","END_VTODO","ID","STRING", |
303 | }; | 329 | }; |
304 | char *yyrule[] = { | 330 | char *vccrule[] = { |
305 | "$accept : mime", | 331 | "$accept : mime", |
306 | "mime : vobjects", | 332 | "mime : vobjects", |
307 | "vobjects : vobjects vobject", | 333 | "vobjects : vobjects vobject", |
308 | "vobjects : vobject", | 334 | "vobjects : vobject", |
309 | "vobject : vcard", | 335 | "vobject : vcard", |
310 | "vobject : vcal", | 336 | "vobject : vcal", |
311 | "$$1 :", | 337 | "$$1 :", |
312 | "vcard : BEGIN_VCARD $$1 items END_VCARD", | 338 | "vcard : BEGIN_VCARD $$1 items END_VCARD", |
313 | "$$2 :", | 339 | "$$2 :", |
314 | "vcard : BEGIN_VCARD $$2 END_VCARD", | 340 | "vcard : BEGIN_VCARD $$2 END_VCARD", |
315 | "items : items item", | 341 | "items : items item", |
316 | "items : item", | 342 | "items : item", |
317 | "$$3 :", | 343 | "$$3 :", |
318 | "item : prop COLON $$3 values LINESEP", | 344 | "item : prop COLON $$3 values LINESEP", |
319 | "item : error", | 345 | "item : error", |
320 | "$$4 :", | 346 | "$$4 :", |
321 | "prop : name $$4 attr_params", | 347 | "prop : name $$4 attr_params", |
322 | "prop : name", | 348 | "prop : name", |
323 | "attr_params : attr_params attr_param", | 349 | "attr_params : attr_params attr_param", |
324 | "attr_params : attr_param", | 350 | "attr_params : attr_param", |
325 | "attr_param : SEMICOLON attr", | 351 | "attr_param : SEMICOLON attr", |
326 | "attr : name", | 352 | "attr : name", |
327 | "attr : name EQ name", | 353 | "attr : name EQ name", |
328 | "name : ID", | 354 | "name : ID", |
329 | "$$5 :", | 355 | "$$5 :", |
330 | "values : value SEMICOLON $$5 values", | 356 | "values : value SEMICOLON $$5 values", |
331 | "values : value", | 357 | "values : value", |
332 | "value : STRING", | 358 | "value : STRING", |
333 | "value :", | 359 | "value :", |
334 | "$$6 :", | 360 | "$$6 :", |
335 | "vcal : BEGIN_VCAL $$6 calitems END_VCAL", | 361 | "vcal : BEGIN_VCAL $$6 calitems END_VCAL", |
336 | "$$7 :", | 362 | "$$7 :", |
337 | "vcal : BEGIN_VCAL $$7 END_VCAL", | 363 | "vcal : BEGIN_VCAL $$7 END_VCAL", |
338 | "calitems : calitems calitem", | 364 | "calitems : calitems calitem", |
339 | "calitems : calitem", | 365 | "calitems : calitem", |
340 | "calitem : eventitem", | 366 | "calitem : eventitem", |
341 | "calitem : todoitem", | 367 | "calitem : todoitem", |
342 | "calitem : items", | 368 | "calitem : items", |
343 | "$$8 :", | 369 | "$$8 :", |
344 | "eventitem : BEGIN_VEVENT $$8 items END_VEVENT", | 370 | "eventitem : BEGIN_VEVENT $$8 items END_VEVENT", |
345 | "$$9 :", | 371 | "$$9 :", |
346 | "eventitem : BEGIN_VEVENT $$9 END_VEVENT", | 372 | "eventitem : BEGIN_VEVENT $$9 END_VEVENT", |
347 | "$$10 :", | 373 | "$$10 :", |
348 | "todoitem : BEGIN_VTODO $$10 items END_VTODO", | 374 | "todoitem : BEGIN_VTODO $$10 items END_VTODO", |
349 | "$$11 :", | 375 | "$$11 :", |
350 | "todoitem : BEGIN_VTODO $$11 END_VTODO", | 376 | "todoitem : BEGIN_VTODO $$11 END_VTODO", |
351 | }; | 377 | }; |
352 | #endif | 378 | #endif |
353 | #ifdef YYSTACKSIZE | 379 | #ifdef YYSTACKSIZE |
354 | #undef YYMAXDEPTH | 380 | #undef YYMAXDEPTH |
355 | #define YYMAXDEPTH YYSTACKSIZE | 381 | #define YYMAXDEPTH YYSTACKSIZE |
356 | #else | 382 | #else |
357 | #ifdef YYMAXDEPTH | 383 | #ifdef YYMAXDEPTH |
358 | #define YYSTACKSIZE YYMAXDEPTH | 384 | #define YYSTACKSIZE YYMAXDEPTH |
359 | #else | 385 | #else |
360 | #define YYSTACKSIZE 500 | 386 | #define YYSTACKSIZE 500 |
361 | #define YYMAXDEPTH 500 | 387 | #define YYMAXDEPTH 500 |
362 | #endif | 388 | #endif |
363 | #endif | 389 | #endif |
364 | int yydebug; | 390 | int yydebug; |
365 | int yynerrs; | 391 | int yynerrs; |
366 | int yyerrflag; | 392 | int yyerrflag; |
367 | int yychar; | 393 | int yychar; |
368 | short *yyssp; | 394 | short *yyssp; |
369 | YYSTYPE *yyvsp; | 395 | YYSTYPE *yyvsp; |
370 | YYSTYPE yyval; | 396 | YYSTYPE yyval; |
371 | YYSTYPE yylval; | 397 | YYSTYPE yylval; |
372 | short yyss[YYSTACKSIZE]; | 398 | short yyss[YYSTACKSIZE]; |
373 | YYSTYPE yyvs[YYSTACKSIZE]; | 399 | YYSTYPE yyvs[YYSTACKSIZE]; |
374 | #define yystacksize YYSTACKSIZE | 400 | #define yystacksize YYSTACKSIZE |
375 | #line 378 "vcc.y" | 401 | #line 382 "backend/vcc.y" |
376 | 402 | ||
377 | /*------------------------------------*/ | 403 | /*------------------------------------*/ |
378 | static int pushVObject(const char *prop) | 404 | static int pushVObject(const char *prop) |
379 | { | 405 | { |
380 | VObject *newObj; | 406 | VObject *newObj; |
381 | if (ObjStackTop == MAXLEVEL) | 407 | if (ObjStackTop == MAXLEVEL) |
382 | return FALSE; | 408 | return FALSE; |
383 | 409 | ||
384 | ObjStack[++ObjStackTop] = curObj; | 410 | ObjStack[++ObjStackTop] = curObj; |
385 | 411 | ||
386 | if (curObj) { | 412 | if (curObj) { |
387 | newObj = addProp(curObj,prop); | 413 | newObj = addProp(curObj,prop); |
388 | curObj = newObj; | 414 | curObj = newObj; |
389 | } | 415 | } |
390 | else | 416 | else |
391 | curObj = newVObject(prop); | 417 | curObj = newVObject(prop); |
392 | 418 | ||
393 | return TRUE; | 419 | return TRUE; |
394 | } | 420 | } |
395 | 421 | ||
396 | 422 | ||
397 | /*---------------------------------------*/ | 423 | /*---------------------------------------*/ |
398 | /* This pops the recently built vCard off the stack and returns it. */ | 424 | /* This pops the recently built vCard off the stack and returns it. */ |
399 | static VObject* popVObject() | 425 | static VObject* popVObject() |
400 | { | 426 | { |
401 | VObject *oldObj; | 427 | VObject *oldObj; |
402 | if (ObjStackTop < 0) { | 428 | if (ObjStackTop < 0) { |
403 | yyerror("pop on empty Object Stack\n"); | 429 | yyerror("pop on empty Object Stack\n"); |
404 | return 0; | 430 | return 0; |
405 | } | 431 | } |
406 | oldObj = curObj; | 432 | oldObj = curObj; |
407 | curObj = ObjStack[ObjStackTop--]; | 433 | curObj = ObjStack[ObjStackTop--]; |
408 | 434 | ||
409 | return oldObj; | 435 | return oldObj; |
410 | } | 436 | } |
411 | 437 | ||
412 | 438 | ||
413 | static void enterValues(const char *value) | 439 | static void enterValues(const char *value) |
414 | { | 440 | { |
415 | if (fieldedProp && *fieldedProp) { | 441 | if (fieldedProp && *fieldedProp) { |
416 | if (value) { | 442 | if (value) { |
417 | addPropValue(curProp,*fieldedProp,value); | 443 | addPropValue(curProp,*fieldedProp,value); |
418 | } | 444 | } |
419 | /* else this field is empty, advance to next field */ | 445 | /* else this field is empty, advance to next field */ |
420 | fieldedProp++; | 446 | fieldedProp++; |
421 | } | 447 | } |
422 | else { | 448 | else { |
423 | if (value) { | 449 | if (value) { |
424 | setVObjectStringZValue_(curProp,strdup( value )); | 450 | setVObjectStringZValue_(curProp,strdup( value )); |
425 | } | 451 | } |
426 | } | 452 | } |
427 | deleteStr(value); | 453 | deleteStr(value); |
428 | } | 454 | } |
429 | 455 | ||
430 | static void enterProps(const char *s) | 456 | static void enterProps(const char *s) |
431 | { | 457 | { |
432 | curProp = addGroup(curObj,s); | 458 | curProp = addGroup(curObj,s); |
433 | deleteStr(s); | 459 | deleteStr(s); |
434 | } | 460 | } |
435 | 461 | ||
436 | static void enterAttr(const char *s1, const char *s2) | 462 | static void enterAttr(const char *s1, const char *s2) |
437 | { | 463 | { |
438 | const char *p1, *p2; | 464 | const char *p1, *p2; |
439 | p1 = lookupProp_(s1); | 465 | p1 = lookupProp_(s1); |
440 | if (s2) { | 466 | if (s2) { |
441 | VObject *a; | 467 | VObject *a; |
442 | p2 = lookupProp_(s2); | 468 | p2 = lookupProp_(s2); |
443 | a = addProp(curProp,p1); | 469 | a = addProp(curProp,p1); |
444 | setVObjectStringZValue(a,p2); | 470 | setVObjectStringZValue(a,p2); |
445 | } | 471 | } |
446 | else | 472 | else |
447 | addProp(curProp,p1); | 473 | addProp(curProp,p1); |
448 | if (qstricmp(p1,VCBase64Prop) == 0 || (s2 && qstricmp(p2,VCBase64Prop)==0)) | 474 | if (qstricmp(p1,VCBase64Prop) == 0 || (s2 && qstricmp(p2,VCBase64Prop)==0)) |
449 | lexPushMode(L_BASE64); | 475 | lexPushMode(L_BASE64); |
450 | else if (qstricmp(p1,VCQuotedPrintableProp) == 0 | 476 | else if (qstricmp(p1,VCQuotedPrintableProp) == 0 |
451 | || (s2 && qstricmp(p2,VCQuotedPrintableProp)==0)) | 477 | || (s2 && qstricmp(p2,VCQuotedPrintableProp)==0)) |
452 | lexPushMode(L_QUOTED_PRINTABLE); | 478 | lexPushMode(L_QUOTED_PRINTABLE); |
453 | deleteStr(s1); deleteStr(s2); | 479 | deleteStr(s1); deleteStr(s2); |
454 | } | 480 | } |
455 | 481 | ||
456 | 482 | ||
457 | #define MAX_LEX_LOOKAHEAD_0 32 | 483 | #define MAX_LEX_LOOKAHEAD_0 32 |
458 | #define MAX_LEX_LOOKAHEAD 64 | 484 | #define MAX_LEX_LOOKAHEAD 64 |
459 | #define MAX_LEX_MODE_STACK_SIZE 10 | 485 | #define MAX_LEX_MODE_STACK_SIZE 10 |
460 | #define LEXMODE() (lexBuf.lexModeStack[lexBuf.lexModeStackTop]) | 486 | #define LEXMODE() (lexBuf.lexModeStack[lexBuf.lexModeStackTop]) |
461 | 487 | ||
462 | struct LexBuf { | 488 | struct LexBuf { |
463 | /* input */ | 489 | /* input */ |
464 | #ifdef INCLUDEMFC | 490 | #ifdef INCLUDEMFC |
465 | CFile *inputFile; | 491 | CFile *inputFile; |
466 | #else | 492 | #else |
467 | FILE *inputFile; | 493 | FILE *inputFile; |
468 | #endif | 494 | #endif |
469 | char *inputString; | 495 | char *inputString; |
470 | unsigned long curPos; | 496 | unsigned long curPos; |
471 | unsigned long inputLen; | 497 | unsigned long inputLen; |
472 | /* lookahead buffer */ | 498 | /* lookahead buffer */ |
473 | /* -- lookahead buffer is short instead of char so that EOF | 499 | /* -- lookahead buffer is short instead of char so that EOF |
474 | / can be represented correctly. | 500 | / can be represented correctly. |
475 | */ | 501 | */ |
476 | unsigned long len; | 502 | unsigned long len; |
477 | short buf[MAX_LEX_LOOKAHEAD]; | 503 | short buf[MAX_LEX_LOOKAHEAD]; |
478 | unsigned long getPtr; | 504 | unsigned long getPtr; |
479 | /* context stack */ | 505 | /* context stack */ |
480 | unsigned long lexModeStackTop; | 506 | unsigned long lexModeStackTop; |
481 | enum LexMode lexModeStack[MAX_LEX_MODE_STACK_SIZE]; | 507 | enum LexMode lexModeStack[MAX_LEX_MODE_STACK_SIZE]; |
482 | /* token buffer */ | 508 | /* token buffer */ |
483 | unsigned long maxToken; | 509 | unsigned long maxToken; |
484 | char *strs; | 510 | char *strs; |
485 | unsigned long strsLen; | 511 | unsigned long strsLen; |
486 | } lexBuf; | 512 | } lexBuf; |
487 | 513 | ||
488 | static void lexPushMode(enum LexMode mode) | 514 | static void lexPushMode(enum LexMode mode) |
489 | { | 515 | { |
490 | if (lexBuf.lexModeStackTop == (MAX_LEX_MODE_STACK_SIZE-1)) | 516 | if (lexBuf.lexModeStackTop == (MAX_LEX_MODE_STACK_SIZE-1)) |
491 | yyerror("lexical context stack overflow"); | 517 | yyerror("lexical context stack overflow"); |
492 | else { | 518 | else { |
493 | lexBuf.lexModeStack[++lexBuf.lexModeStackTop] = mode; | 519 | lexBuf.lexModeStack[++lexBuf.lexModeStackTop] = mode; |
494 | } | 520 | } |
495 | } | 521 | } |
496 | 522 | ||
497 | static void lexPopMode(int top) | 523 | static void lexPopMode(int top) |
498 | { | 524 | { |
499 | /* special case of pop for ease of error recovery -- this | 525 | /* special case of pop for ease of error recovery -- this |
500 | version will never underflow */ | 526 | version will never underflow */ |
501 | if (top) | 527 | if (top) |
502 | lexBuf.lexModeStackTop = 0; | 528 | lexBuf.lexModeStackTop = 0; |
503 | else | 529 | else |
504 | if (lexBuf.lexModeStackTop > 0) lexBuf.lexModeStackTop--; | 530 | if (lexBuf.lexModeStackTop > 0) lexBuf.lexModeStackTop--; |
505 | } | 531 | } |
506 | 532 | ||
507 | static int lexWithinMode(enum LexMode mode) { | 533 | static int lexWithinMode(enum LexMode mode) { |
508 | unsigned long i; | 534 | unsigned long i; |
509 | for (i=0;i<lexBuf.lexModeStackTop;i++) | 535 | for (i=0;i<lexBuf.lexModeStackTop;i++) |
510 | if (mode == lexBuf.lexModeStack[i]) return 1; | 536 | if (mode == lexBuf.lexModeStack[i]) return 1; |
511 | return 0; | 537 | return 0; |
512 | } | 538 | } |
513 | 539 | ||
514 | static char lexGetc_() | 540 | static int lexGetc_() |
515 | { | 541 | { |
516 | /* get next char from input, no buffering. */ | 542 | /* get next char from input, no buffering. */ |
517 | if (lexBuf.curPos == lexBuf.inputLen) | 543 | if (lexBuf.curPos == lexBuf.inputLen) |
518 | return EOF; | 544 | return EOF; |
519 | else if (lexBuf.inputString) | 545 | else if (lexBuf.inputString) |
520 | return *(lexBuf.inputString + lexBuf.curPos++); | 546 | return *(lexBuf.inputString + lexBuf.curPos++); |
521 | else { | 547 | else { |
522 | #ifdef INCLUDEMFC | 548 | #ifdef INCLUDEMFC |
523 | char result; | 549 | char result; |
524 | return lexBuf.inputFile->Read(&result, 1) == 1 ? result : EOF; | 550 | return lexBuf.inputFile->Read(&result, 1) == 1 ? result : EOF; |
525 | #else | 551 | #else |
526 | return fgetc(lexBuf.inputFile); | 552 | return fgetc(lexBuf.inputFile); |
527 | #endif | 553 | #endif |
528 | } | 554 | } |
529 | } | 555 | } |
530 | 556 | ||
531 | static int lexGeta() | 557 | static int lexGeta() |
532 | { | 558 | { |
533 | ++lexBuf.len; | 559 | ++lexBuf.len; |
534 | return (lexBuf.buf[lexBuf.getPtr] = lexGetc_()); | 560 | return (lexBuf.buf[lexBuf.getPtr] = lexGetc_()); |
535 | } | 561 | } |
536 | 562 | ||
537 | static int lexGeta_(int i) | 563 | static int lexGeta_(int i) |
538 | { | 564 | { |
539 | ++lexBuf.len; | 565 | ++lexBuf.len; |
540 | return (lexBuf.buf[(lexBuf.getPtr+i)%MAX_LEX_LOOKAHEAD] = lexGetc_()); | 566 | return (lexBuf.buf[(lexBuf.getPtr+i)%MAX_LEX_LOOKAHEAD] = lexGetc_()); |
541 | } | 567 | } |
542 | 568 | ||
543 | static void lexSkipLookahead() { | 569 | static void lexSkipLookahead() { |
544 | if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) { | 570 | if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) { |
545 | /* don't skip EOF. */ | 571 | /* don't skip EOF. */ |
546 | lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD; | 572 | lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD; |
547 | lexBuf.len--; | 573 | lexBuf.len--; |
548 | } | 574 | } |
549 | } | 575 | } |
550 | 576 | ||
551 | static int lexLookahead() { | 577 | static int lexLookahead() { |
552 | int c = (lexBuf.len)? | 578 | int c = (lexBuf.len)? |
553 | lexBuf.buf[lexBuf.getPtr]: | 579 | lexBuf.buf[lexBuf.getPtr]: |
554 | lexGeta(); | 580 | lexGeta(); |
555 | /* do the \r\n -> \n or \r -> \n translation here */ | 581 | /* do the \r\n -> \n or \r -> \n translation here */ |
556 | if (c == '\r') { | 582 | if (c == '\r') { |
557 | int a = (lexBuf.len>1)? | 583 | int a = (lexBuf.len>1)? |
558 | lexBuf.buf[(lexBuf.getPtr+1)%MAX_LEX_LOOKAHEAD]: | 584 | lexBuf.buf[(lexBuf.getPtr+1)%MAX_LEX_LOOKAHEAD]: |
559 | lexGeta_(1); | 585 | lexGeta_(1); |
560 | if (a == '\n') { | 586 | if (a == '\n') { |
561 | lexSkipLookahead(); | 587 | lexSkipLookahead(); |
562 | } | 588 | } |
563 | lexBuf.buf[lexBuf.getPtr] = c = '\n'; | 589 | lexBuf.buf[lexBuf.getPtr] = c = '\n'; |
564 | } | 590 | } |
565 | else if (c == '\n') { | 591 | else if (c == '\n') { |
566 | int a = (lexBuf.len>1)? | 592 | int a = (lexBuf.len>1)? |
567 | lexBuf.buf[lexBuf.getPtr+1]: | 593 | lexBuf.buf[lexBuf.getPtr+1]: |
568 | lexGeta_(1); | 594 | lexGeta_(1); |
569 | if (a == '\r') { | 595 | if (a == '\r') { |
570 | lexSkipLookahead(); | 596 | lexSkipLookahead(); |
571 | } | 597 | } |
572 | lexBuf.buf[lexBuf.getPtr] = '\n'; | 598 | lexBuf.buf[lexBuf.getPtr] = '\n'; |
573 | } | 599 | } |
574 | return c; | 600 | return c; |
575 | } | 601 | } |
576 | 602 | ||
577 | static int lexGetc() { | 603 | static int lexGetc() { |
578 | int c = lexLookahead(); | 604 | int c = lexLookahead(); |
579 | if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) { | 605 | if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) { |
580 | /* EOF will remain in lookahead buffer */ | 606 | /* EOF will remain in lookahead buffer */ |
581 | lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD; | 607 | lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD; |
582 | lexBuf.len--; | 608 | lexBuf.len--; |
583 | } | 609 | } |
584 | return c; | 610 | return c; |
585 | } | 611 | } |
586 | 612 | ||
587 | static void lexSkipLookaheadWord() { | 613 | static void lexSkipLookaheadWord() { |
588 | if (lexBuf.strsLen <= lexBuf.len) { | 614 | if (lexBuf.strsLen <= lexBuf.len) { |
589 | lexBuf.len -= lexBuf.strsLen; | 615 | lexBuf.len -= lexBuf.strsLen; |
590 | lexBuf.getPtr = (lexBuf.getPtr + lexBuf.strsLen) % MAX_LEX_LOOKAHEAD; | 616 | lexBuf.getPtr = (lexBuf.getPtr + lexBuf.strsLen) % MAX_LEX_LOOKAHEAD; |
591 | } | 617 | } |
592 | } | 618 | } |
593 | 619 | ||
594 | static void lexClearToken() | 620 | static void lexClearToken() |
595 | { | 621 | { |
596 | lexBuf.strsLen = 0; | 622 | lexBuf.strsLen = 0; |
597 | } | 623 | } |
598 | 624 | ||
599 | static void lexAppendc(int c) | 625 | static void lexAppendc(int c) |
600 | { | 626 | { |
601 | lexBuf.strs[lexBuf.strsLen] = c; | 627 | lexBuf.strs[lexBuf.strsLen] = c; |
602 | /* append up to zero termination */ | 628 | /* append up to zero termination */ |
603 | if (c == 0) return; | 629 | if (c == 0) return; |
604 | lexBuf.strsLen++; | 630 | lexBuf.strsLen++; |
605 | if (lexBuf.strsLen > lexBuf.maxToken) { | 631 | if (lexBuf.strsLen > lexBuf.maxToken) { |
606 | /* double the token string size */ | 632 | /* double the token string size */ |
607 | lexBuf.maxToken <<= 1; | 633 | lexBuf.maxToken <<= 1; |
608 | lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken); | 634 | lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken); |
609 | } | 635 | } |
610 | } | 636 | } |
@@ -832,714 +858,719 @@ static char * lexGetDataFromBase64() | |||
832 | else if (c == '+') | 858 | else if (c == '+') |
833 | b = 62; | 859 | b = 62; |
834 | else if (c == '/') | 860 | else if (c == '/') |
835 | b = 63; | 861 | b = 63; |
836 | else if (c == '=') { | 862 | else if (c == '=') { |
837 | b = 0; | 863 | b = 0; |
838 | pad++; | 864 | pad++; |
839 | } else if ((c == ' ') || (c == '\t')) { | 865 | } else if ((c == ' ') || (c == '\t')) { |
840 | continue; | 866 | continue; |
841 | } else { /* error condition */ | 867 | } else { /* error condition */ |
842 | if (bytes) free(bytes); | 868 | if (bytes) free(bytes); |
843 | else if (oldBytes) free(oldBytes); | 869 | else if (oldBytes) free(oldBytes); |
844 | // error recovery: skip until 2 adjacent newlines. | 870 | // error recovery: skip until 2 adjacent newlines. |
845 | DBG_(("db: invalid character 0x%x '%c'\n", c,c)); | 871 | DBG_(("db: invalid character 0x%x '%c'\n", c,c)); |
846 | if (c != EOF) { | 872 | if (c != EOF) { |
847 | c = lexGetc(); | 873 | c = lexGetc(); |
848 | while (c != EOF) { | 874 | while (c != EOF) { |
849 | if (c == '\n' && lexLookahead() == '\n') { | 875 | if (c == '\n' && lexLookahead() == '\n') { |
850 | ++mime_lineNum; | 876 | ++mime_lineNum; |
851 | break; | 877 | break; |
852 | } | 878 | } |
853 | c = lexGetc(); | 879 | c = lexGetc(); |
854 | } | 880 | } |
855 | } | 881 | } |
856 | return NULL; | 882 | return NULL; |
857 | } | 883 | } |
858 | trip = (trip << 6) | b; | 884 | trip = (trip << 6) | b; |
859 | if (++quadIx == 4) { | 885 | if (++quadIx == 4) { |
860 | unsigned char outBytes[3]; | 886 | unsigned char outBytes[3]; |
861 | int numOut; | 887 | int numOut; |
862 | int i; | 888 | int i; |
863 | for (i = 0; i < 3; i++) { | 889 | for (i = 0; i < 3; i++) { |
864 | outBytes[2-i] = (unsigned char)(trip & 0xFF); | 890 | outBytes[2-i] = (unsigned char)(trip & 0xFF); |
865 | trip >>= 8; | 891 | trip >>= 8; |
866 | } | 892 | } |
867 | numOut = 3 - pad; | 893 | numOut = 3 - pad; |
868 | if (bytesLen + numOut > bytesMax) { | 894 | if (bytesLen + numOut > bytesMax) { |
869 | if (!bytes) { | 895 | if (!bytes) { |
870 | bytesMax = 1024; | 896 | bytesMax = 1024; |
871 | bytes = (unsigned char*)malloc((size_t)bytesMax); | 897 | bytes = (unsigned char*)malloc((size_t)bytesMax); |
872 | } | 898 | } |
873 | else { | 899 | else { |
874 | bytesMax <<= 2; | 900 | bytesMax <<= 2; |
875 | oldBytes = bytes; | 901 | oldBytes = bytes; |
876 | bytes = (unsigned char*)realloc(bytes,(size_t)bytesMax); | 902 | bytes = (unsigned char*)realloc(bytes,(size_t)bytesMax); |
877 | } | 903 | } |
878 | if (bytes == 0) { | 904 | if (bytes == 0) { |
879 | mime_error("out of memory while processing BASE64 data\n"); | 905 | mime_error("out of memory while processing BASE64 data\n"); |
880 | } | 906 | } |
881 | } | 907 | } |
882 | if (bytes) { | 908 | if (bytes) { |
883 | memcpy(bytes + bytesLen, outBytes, numOut); | 909 | memcpy(bytes + bytesLen, outBytes, numOut); |
884 | bytesLen += numOut; | 910 | bytesLen += numOut; |
885 | } | 911 | } |
886 | trip = 0; | 912 | trip = 0; |
887 | quadIx = 0; | 913 | quadIx = 0; |
888 | } | 914 | } |
889 | } | 915 | } |
890 | } /* while */ | 916 | } /* while */ |
891 | DBG_(("db: bytesLen = %d\n", bytesLen)); | 917 | DBG_(("db: bytesLen = %d\n", bytesLen)); |
892 | /* kludge: all this won't be necessary if we have tree form | 918 | /* kludge: all this won't be necessary if we have tree form |
893 | representation */ | 919 | representation */ |
894 | if (bytes) { | 920 | if (bytes) { |
895 | setValueWithSize(curProp,bytes,(unsigned int)bytesLen); | 921 | setValueWithSize(curProp,bytes,(unsigned int)bytesLen); |
896 | free(bytes); | 922 | free(bytes); |
897 | } | 923 | } |
898 | else if (oldBytes) { | 924 | else if (oldBytes) { |
899 | setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen); | 925 | setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen); |
900 | free(oldBytes); | 926 | free(oldBytes); |
901 | } | 927 | } |
902 | return 0; | 928 | return 0; |
903 | } | 929 | } |
904 | 930 | ||
905 | static int match_begin_end_name(int end) { | 931 | static int match_begin_end_name(int end) { |
906 | int token; | 932 | int token; |
907 | lexSkipWhite(); | 933 | lexSkipWhite(); |
908 | if (lexLookahead() != ':') return ID; | 934 | if (lexLookahead() != ':') return ID; |
909 | lexSkipLookahead(); | 935 | lexSkipLookahead(); |
910 | lexSkipWhite(); | 936 | lexSkipWhite(); |
911 | token = match_begin_name(end); | 937 | token = match_begin_name(end); |
912 | if (token == ID) { | 938 | if (token == ID) { |
913 | lexPushLookaheadc(':'); | 939 | lexPushLookaheadc(':'); |
914 | DBG_(("db: ID '%s'\n", yylval.str)); | 940 | DBG_(("db: ID '%s'\n", yylval.str)); |
915 | return ID; | 941 | return ID; |
916 | } | 942 | } |
917 | else if (token != 0) { | 943 | else if (token != 0) { |
918 | lexSkipLookaheadWord(); | 944 | lexSkipLookaheadWord(); |
919 | deleteStr(yylval.str); | 945 | deleteStr(yylval.str); |
920 | DBG_(("db: begin/end %d\n", token)); | 946 | DBG_(("db: begin/end %d\n", token)); |
921 | return token; | 947 | return token; |
922 | } | 948 | } |
923 | return 0; | 949 | return 0; |
924 | } | 950 | } |
925 | 951 | ||
926 | static char* lexGetQuotedPrintable() | 952 | static char* lexGetQuotedPrintable() |
927 | { | 953 | { |
928 | char cur; | 954 | int cur; |
929 | 955 | ||
930 | lexClearToken(); | 956 | lexClearToken(); |
931 | do { | 957 | do { |
932 | cur = lexGetc(); | 958 | cur = lexGetc(); |
933 | switch (cur) { | 959 | switch (cur) { |
934 | case '=': { | 960 | case '=': { |
935 | int c = 0; | 961 | int c = 0; |
936 | int next[2]; | 962 | int next[2]; |
937 | int i; | 963 | int i; |
938 | for (i = 0; i < 2; i++) { | 964 | for (i = 0; i < 2; i++) { |
939 | next[i] = lexGetc(); | 965 | next[i] = lexGetc(); |
940 | if (next[i] >= '0' && next[i] <= '9') | 966 | if (next[i] >= '0' && next[i] <= '9') |
941 | c = c * 16 + next[i] - '0'; | 967 | c = c * 16 + next[i] - '0'; |
942 | else if (next[i] >= 'A' && next[i] <= 'F') | 968 | else if (next[i] >= 'A' && next[i] <= 'F') |
943 | c = c * 16 + next[i] - 'A' + 10; | 969 | c = c * 16 + next[i] - 'A' + 10; |
944 | else | 970 | else |
945 | break; | 971 | break; |
946 | } | 972 | } |
947 | if (i == 0) { | 973 | if (i == 0) { |
948 | /* single '=' follow by LINESEP is continuation sign? */ | 974 | /* single '=' follow by LINESEP is continuation sign? */ |
949 | if (next[0] == '\n') { | 975 | if (next[0] == '\n') { |
950 | ++mime_lineNum; | 976 | ++mime_lineNum; |
951 | } | 977 | } |
952 | else { | 978 | else { |
953 | lexPushLookaheadc('='); | 979 | lexPushLookaheadc('='); |
954 | goto EndString; | 980 | goto EndString; |
955 | } | 981 | } |
956 | } | 982 | } |
957 | else if (i == 1) { | 983 | else if (i == 1) { |
958 | lexPushLookaheadc(next[1]); | 984 | lexPushLookaheadc(next[1]); |
959 | lexPushLookaheadc(next[0]); | 985 | lexPushLookaheadc(next[0]); |
960 | lexAppendc('='); | 986 | lexAppendc('='); |
961 | } else { | 987 | } else { |
962 | lexAppendc(c); | 988 | lexAppendc(c); |
963 | } | 989 | } |
964 | break; | 990 | break; |
965 | } /* '=' */ | 991 | } /* '=' */ |
966 | case '\n': { | 992 | case '\n': { |
967 | lexPushLookaheadc('\n'); | 993 | lexPushLookaheadc('\n'); |
968 | goto EndString; | 994 | goto EndString; |
969 | } | 995 | } |
970 | case (char)EOF: | 996 | case (int)EOF: |
971 | break; | 997 | break; |
972 | default: | 998 | default: |
973 | lexAppendc(cur); | 999 | lexAppendc(cur); |
974 | break; | 1000 | break; |
975 | } /* switch */ | 1001 | } /* switch */ |
976 | } while (cur != (char)EOF); | 1002 | } while (cur != (int)EOF); |
977 | 1003 | ||
978 | EndString: | 1004 | EndString: |
979 | lexAppendc(0); | 1005 | lexAppendc(0); |
980 | return lexStr(); | 1006 | return lexStr(); |
981 | } /* LexQuotedPrintable */ | 1007 | } /* LexQuotedPrintable */ |
982 | 1008 | ||
983 | static int yylex() { | 1009 | static int yylex() { |
984 | 1010 | ||
985 | int lexmode = LEXMODE(); | 1011 | int lexmode = LEXMODE(); |
986 | if (lexmode == L_VALUES) { | 1012 | if (lexmode == L_VALUES) { |
987 | int c = lexGetc(); | 1013 | int c = lexGetc(); |
988 | if (c == ';') { | 1014 | if (c == ';') { |
989 | DBG_(("db: SEMICOLON\n")); | 1015 | DBG_(("db: SEMICOLON\n")); |
990 | lexPushLookaheadc(c); | 1016 | lexPushLookaheadc(c); |
991 | handleMoreRFC822LineBreak(c); | 1017 | handleMoreRFC822LineBreak(c); |
992 | lexSkipLookahead(); | 1018 | lexSkipLookahead(); |
993 | return SEMICOLON; | 1019 | return SEMICOLON; |
994 | } | 1020 | } |
995 | else if (strchr("\n",c)) { | 1021 | else if (strchr("\n",c)) { |
996 | ++mime_lineNum; | 1022 | ++mime_lineNum; |
997 | /* consume all line separator(s) adjacent to each other */ | 1023 | /* consume all line separator(s) adjacent to each other */ |
998 | c = lexLookahead(); | 1024 | c = lexLookahead(); |
999 | while (strchr("\n",c)) { | 1025 | while (strchr("\n",c)) { |
1000 | lexSkipLookahead(); | 1026 | lexSkipLookahead(); |
1001 | c = lexLookahead(); | 1027 | c = lexLookahead(); |
1002 | ++mime_lineNum; | 1028 | ++mime_lineNum; |
1003 | } | 1029 | } |
1004 | DBG_(("db: LINESEP\n")); | 1030 | DBG_(("db: LINESEP\n")); |
1005 | return LINESEP; | 1031 | return LINESEP; |
1006 | } | 1032 | } |
1007 | else { | 1033 | else { |
1008 | char *p = 0; | 1034 | char *p = 0; |
1009 | lexPushLookaheadc(c); | 1035 | lexPushLookaheadc(c); |
1010 | if (lexWithinMode(L_BASE64)) { | 1036 | if (lexWithinMode(L_BASE64)) { |
1011 | /* get each char and convert to bin on the fly... */ | 1037 | /* get each char and convert to bin on the fly... */ |
1012 | p = lexGetDataFromBase64(); | 1038 | p = lexGetDataFromBase64(); |
1013 | yylval.str = p; | 1039 | yylval.str = p; |
1014 | return STRING; | 1040 | return STRING; |
1015 | } | 1041 | } |
1016 | else if (lexWithinMode(L_QUOTED_PRINTABLE)) { | 1042 | else if (lexWithinMode(L_QUOTED_PRINTABLE)) { |
1017 | p = lexGetQuotedPrintable(); | 1043 | p = lexGetQuotedPrintable(); |
1018 | } | 1044 | } |
1019 | else { | 1045 | else { |
1020 | #ifdef _SUPPORT_LINE_FOLDING | 1046 | #ifdef _SUPPORT_LINE_FOLDING |
1021 | p = lexGet1Value(); | 1047 | p = lexGet1Value(); |
1022 | #else | 1048 | #else |
1023 | p = lexGetStrUntil(";\n"); | 1049 | p = lexGetStrUntil(";\n"); |
1024 | #endif | 1050 | #endif |
1025 | } | 1051 | } |
1026 | if (p) { | 1052 | if (p) { |
1027 | DBG_(("db: STRING: '%s'\n", p)); | 1053 | DBG_(("db: STRING: '%s'\n", p)); |
1028 | yylval.str = p; | 1054 | yylval.str = p; |
1029 | return STRING; | 1055 | return STRING; |
1030 | } | 1056 | } |
1031 | else return 0; | 1057 | else return 0; |
1032 | } | 1058 | } |
1033 | } | 1059 | } |
1034 | else { | 1060 | else { |
1035 | /* normal mode */ | 1061 | /* normal mode */ |
1036 | while (1) { | 1062 | while (1) { |
1037 | int c = lexGetc(); | 1063 | int c = lexGetc(); |
1038 | switch(c) { | 1064 | switch(c) { |
1039 | case ':': { | 1065 | case ':': { |
1040 | /* consume all line separator(s) adjacent to each other */ | 1066 | /* consume all line separator(s) adjacent to each other */ |
1041 | /* ignoring linesep immediately after colon. */ | 1067 | /* ignoring linesep immediately after colon. */ |
1042 | c = lexLookahead(); | 1068 | c = lexLookahead(); |
1043 | while (strchr("\n",c)) { | 1069 | while (strchr("\n",c)) { |
1044 | lexSkipLookahead(); | 1070 | lexSkipLookahead(); |
1045 | c = lexLookahead(); | 1071 | c = lexLookahead(); |
1046 | ++mime_lineNum; | 1072 | ++mime_lineNum; |
1047 | } | 1073 | } |
1048 | DBG_(("db: COLON\n")); | 1074 | DBG_(("db: COLON\n")); |
1049 | return COLON; | 1075 | return COLON; |
1050 | } | 1076 | } |
1051 | case ';': | 1077 | case ';': |
1052 | DBG_(("db: SEMICOLON\n")); | 1078 | DBG_(("db: SEMICOLON\n")); |
1053 | return SEMICOLON; | 1079 | return SEMICOLON; |
1054 | case '=': | 1080 | case '=': |
1055 | DBG_(("db: EQ\n")); | 1081 | DBG_(("db: EQ\n")); |
1056 | return EQ; | 1082 | return EQ; |
1057 | /* ignore whitespace in this mode */ | 1083 | /* ignore whitespace in this mode */ |
1058 | case '\t': | 1084 | case '\t': |
1059 | case ' ': continue; | 1085 | case ' ': continue; |
1060 | case '\n': { | 1086 | case '\n': { |
1061 | ++mime_lineNum; | 1087 | ++mime_lineNum; |
1062 | continue; | 1088 | continue; |
1063 | } | 1089 | } |
1064 | case EOF: return 0; | 1090 | case EOF: return 0; |
1065 | break; | 1091 | break; |
1066 | default: { | 1092 | default: { |
1067 | lexPushLookaheadc(c); | 1093 | lexPushLookaheadc(c); |
1068 | if (isalnum(c)) { | 1094 | if (isalnum(c)) { |
1069 | char *t = lexGetWord(); | 1095 | char *t = lexGetWord(); |
1070 | yylval.str = t; | 1096 | yylval.str = t; |
1071 | if (!qstricmp(t, "begin")) { | 1097 | if (!qstricmp(t, "begin")) { |
1072 | return match_begin_end_name(0); | 1098 | return match_begin_end_name(0); |
1073 | } | 1099 | } |
1074 | else if (!qstricmp(t,"end")) { | 1100 | else if (!qstricmp(t,"end")) { |
1075 | return match_begin_end_name(1); | 1101 | return match_begin_end_name(1); |
1076 | } | 1102 | } |
1077 | else { | 1103 | else { |
1078 | DBG_(("db: ID '%s'\n", t)); | 1104 | DBG_(("db: ID '%s'\n", t)); |
1079 | return ID; | 1105 | return ID; |
1080 | } | 1106 | } |
1081 | } | 1107 | } |
1082 | else { | 1108 | else { |
1083 | /* unknow token */ | 1109 | /* unknow token */ |
1084 | return 0; | 1110 | return 0; |
1085 | } | 1111 | } |
1086 | break; | 1112 | break; |
1087 | } | 1113 | } |
1088 | } | 1114 | } |
1089 | } | 1115 | } |
1090 | } | 1116 | } |
1091 | return 0; | 1117 | return 0; |
1092 | } | 1118 | } |
1093 | 1119 | ||
1094 | 1120 | ||
1095 | /***************************************************************************/ | 1121 | /***************************************************************************/ |
1096 | /*** Public Functions ****/ | 1122 | /*** Public Functions ****/ |
1097 | /***************************************************************************/ | 1123 | /***************************************************************************/ |
1098 | 1124 | ||
1099 | static VObject* Parse_MIMEHelper() | 1125 | static VObject* Parse_MIMEHelper() |
1100 | { | 1126 | { |
1101 | ObjStackTop = -1; | 1127 | ObjStackTop = -1; |
1102 | mime_numErrors = 0; | 1128 | mime_numErrors = 0; |
1103 | mime_lineNum = 1; | 1129 | mime_lineNum = 1; |
1104 | vObjList = 0; | 1130 | vObjList = 0; |
1105 | curObj = 0; | 1131 | curObj = 0; |
1106 | 1132 | ||
1107 | if (yyparse() != 0) | 1133 | if (yyparse() != 0) |
1108 | return 0; | 1134 | return 0; |
1109 | 1135 | ||
1110 | finiLex(); | 1136 | finiLex(); |
1111 | return vObjList; | 1137 | return vObjList; |
1112 | } | 1138 | } |
1113 | 1139 | ||
1114 | /*--------------------------------------------*/ | 1140 | /*--------------------------------------------*/ |
1115 | DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len) | 1141 | DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len) |
1116 | { | 1142 | { |
1117 | initLex(input, len, 0); | 1143 | initLex(input, len, 0); |
1118 | return Parse_MIMEHelper(); | 1144 | return Parse_MIMEHelper(); |
1119 | } | 1145 | } |
1120 | 1146 | ||
1121 | 1147 | ||
1122 | #if INCLUDEMFC | 1148 | #if INCLUDEMFC |
1123 | 1149 | ||
1124 | DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file) | 1150 | DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file) |
1125 | { | 1151 | { |
1126 | unsigned long startPos; | 1152 | unsigned long startPos; |
1127 | VObject *result; | 1153 | VObject *result; |
1128 | 1154 | ||
1129 | initLex(0,-1,file); | 1155 | initLex(0,-1,file); |
1130 | startPos = file->GetPosition(); | 1156 | startPos = file->GetPosition(); |
1131 | if (!(result = Parse_MIMEHelper())) | 1157 | if (!(result = Parse_MIMEHelper())) |
1132 | file->Seek(startPos, CFile::begin); | 1158 | file->Seek(startPos, CFile::begin); |
1133 | return result; | 1159 | return result; |
1134 | } | 1160 | } |
1135 | 1161 | ||
1136 | #else | 1162 | #else |
1137 | 1163 | ||
1138 | VObject* Parse_MIME_FromFile(FILE *file) | 1164 | VObject* Parse_MIME_FromFile(FILE *file) |
1139 | { | 1165 | { |
1140 | VObject *result; | 1166 | VObject *result; |
1141 | long startPos; | 1167 | long startPos; |
1142 | 1168 | ||
1143 | initLex(0,(unsigned long)-1,file); | 1169 | initLex(0,(unsigned long)-1,file); |
1144 | startPos = ftell(file); | 1170 | startPos = ftell(file); |
1145 | if (!(result = Parse_MIMEHelper())) { | 1171 | if (!(result = Parse_MIMEHelper())) { |
1146 | fseek(file,startPos,SEEK_SET); | 1172 | fseek(file,startPos,SEEK_SET); |
1147 | } | 1173 | } |
1148 | return result; | 1174 | return result; |
1149 | } | 1175 | } |
1150 | 1176 | ||
1151 | DLLEXPORT(VObject*) Parse_MIME_FromFileName(char *fname) | 1177 | DLLEXPORT(VObject*) Parse_MIME_FromFileName(char *fname) |
1152 | { | 1178 | { |
1153 | QFileDirect f( fname ); | 1179 | FILE *fp = fopen(fname,"r"); |
1154 | if ( !f.open( IO_ReadOnly ) ) { | 1180 | if (fp) { |
1155 | qWarning("Unable to open mime for reading %s", fname); | 1181 | VObject* o = Parse_MIME_FromFile(fp); |
1156 | return 0; | 1182 | fclose(fp); |
1183 | return o; | ||
1184 | } | ||
1185 | else { | ||
1186 | char msg[80]; | ||
1187 | sprintf(msg, "can't open file '%s' for reading\n", fname); | ||
1188 | mime_error_(msg); | ||
1189 | return 0; | ||
1157 | } | 1190 | } |
1158 | |||
1159 | return Parse_MIME_FromFile( f.directHandle() ); | ||
1160 | } | 1191 | } |
1161 | 1192 | ||
1162 | #endif | 1193 | #endif |
1163 | 1194 | ||
1164 | /*-------------------------------------*/ | 1195 | /*-------------------------------------*/ |
1165 | 1196 | ||
1166 | static MimeErrorHandler mimeErrorHandler; | 1197 | static MimeErrorHandler mimeErrorHandler; |
1167 | 1198 | ||
1168 | DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler me) | 1199 | DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler me) |
1169 | { | 1200 | { |
1170 | mimeErrorHandler = me; | 1201 | mimeErrorHandler = me; |
1171 | } | 1202 | } |
1172 | 1203 | ||
1173 | void mime_error(char *s) | 1204 | void mime_error(char *s) |
1174 | { | 1205 | { |
1175 | char msg[256]; | 1206 | char msg[256]; |
1176 | if (mimeErrorHandler) { | 1207 | if (mimeErrorHandler) { |
1177 | sprintf(msg,"%s at line %d", s, mime_lineNum); | 1208 | sprintf(msg,"%s at line %d", s, mime_lineNum); |
1178 | mimeErrorHandler(msg); | 1209 | mimeErrorHandler(msg); |
1179 | } | 1210 | } |
1180 | } | 1211 | } |
1181 | 1212 | ||
1182 | void mime_error_(char *s) | 1213 | void mime_error_(char *s) |
1183 | { | 1214 | { |
1184 | if (mimeErrorHandler) { | 1215 | if (mimeErrorHandler) { |
1185 | mimeErrorHandler(s); | 1216 | mimeErrorHandler(s); |
1186 | } | 1217 | } |
1187 | } | 1218 | } |
1188 | 1219 | ||
1189 | #line 1192 "y.tab.c" | 1220 | #line 1221 "y.tab.c" |
1190 | #define YYABORT goto yyabort | 1221 | #define YYABORT goto yyabort |
1191 | #define YYREJECT goto yyabort | 1222 | #define YYREJECT goto yyabort |
1192 | #define YYACCEPT goto yyaccept | 1223 | #define YYACCEPT goto yyaccept |
1193 | #define YYERROR goto yyerrlab | 1224 | #define YYERROR goto yyerrlab |
1194 | int | 1225 | int |
1226 | #if defined(__STDC__) | ||
1227 | yyparse(void) | ||
1228 | #else | ||
1195 | yyparse() | 1229 | yyparse() |
1230 | #endif | ||
1196 | { | 1231 | { |
1197 | register int yym, yyn, yystate; | 1232 | register int yym, yyn, yystate; |
1198 | #if YYDEBUG | 1233 | #if YYDEBUG |
1199 | register char *yys; | 1234 | register char *yys; |
1200 | extern char *getenv(); | 1235 | extern char *getenv(); |
1201 | 1236 | ||
1202 | if (yys = getenv("YYDEBUG")) | 1237 | if (yys = getenv("YYDEBUG")) |
1203 | { | 1238 | { |
1204 | yyn = *yys; | 1239 | yyn = *yys; |
1205 | if (yyn >= '0' && yyn <= '9') | 1240 | if (yyn >= '0' && yyn <= '9') |
1206 | yydebug = yyn - '0'; | 1241 | yydebug = yyn - '0'; |
1207 | } | 1242 | } |
1208 | #endif | 1243 | #endif |
1209 | 1244 | ||
1210 | yynerrs = 0; | 1245 | yynerrs = 0; |
1211 | yyerrflag = 0; | 1246 | yyerrflag = 0; |
1212 | yychar = (-1); | 1247 | yychar = (-1); |
1213 | 1248 | ||
1214 | yyssp = yyss; | 1249 | yyssp = yyss; |
1215 | yyvsp = yyvs; | 1250 | yyvsp = yyvs; |
1216 | *yyssp = yystate = 0; | 1251 | *yyssp = yystate = 0; |
1217 | 1252 | ||
1218 | yyloop: | 1253 | yyloop: |
1219 | if (yyn = yydefred[yystate]) goto yyreduce; | 1254 | if ((yyn = yydefred[yystate]) != 0) goto yyreduce; |
1220 | if (yychar < 0) | 1255 | if (yychar < 0) |
1221 | { | 1256 | { |
1222 | if ((yychar = yylex()) < 0) yychar = 0; | 1257 | if ((yychar = yylex()) < 0) yychar = 0; |
1223 | #if YYDEBUG | 1258 | #if YYDEBUG |
1224 | if (yydebug) | 1259 | if (yydebug) |
1225 | { | 1260 | { |
1226 | yys = 0; | 1261 | yys = 0; |
1227 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; | 1262 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
1228 | if (!yys) yys = "illegal-symbol"; | 1263 | if (!yys) yys = "illegal-symbol"; |
1229 | printf("%sdebug: state %d, reading %d (%s)\n", | 1264 | printf("%sdebug: state %d, reading %d (%s)\n", |
1230 | YYPREFIX, yystate, yychar, yys); | 1265 | YYPREFIX, yystate, yychar, yys); |
1231 | } | 1266 | } |
1232 | #endif | 1267 | #endif |
1233 | } | 1268 | } |
1234 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && | 1269 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && |
1235 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) | 1270 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
1236 | { | 1271 | { |
1237 | #if YYDEBUG | 1272 | #if YYDEBUG |
1238 | if (yydebug) | 1273 | if (yydebug) |
1239 | printf("%sdebug: state %d, shifting to state %d\n", | 1274 | printf("%sdebug: state %d, shifting to state %d\n", |
1240 | YYPREFIX, yystate, yytable[yyn]); | 1275 | YYPREFIX, yystate, yytable[yyn]); |
1241 | #endif | 1276 | #endif |
1242 | if (yyssp >= yyss + yystacksize - 1) | 1277 | if (yyssp >= yyss + yystacksize - 1) |
1243 | { | 1278 | { |
1244 | goto yyoverflow; | 1279 | goto yyoverflow; |
1245 | } | 1280 | } |
1246 | *++yyssp = yystate = yytable[yyn]; | 1281 | *++yyssp = yystate = yytable[yyn]; |
1247 | *++yyvsp = yylval; | 1282 | *++yyvsp = yylval; |
1248 | yychar = (-1); | 1283 | yychar = (-1); |
1249 | if (yyerrflag > 0) --yyerrflag; | 1284 | if (yyerrflag > 0) --yyerrflag; |
1250 | goto yyloop; | 1285 | goto yyloop; |
1251 | } | 1286 | } |
1252 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && | 1287 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && |
1253 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) | 1288 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
1254 | { | 1289 | { |
1255 | yyn = yytable[yyn]; | 1290 | yyn = yytable[yyn]; |
1256 | goto yyreduce; | 1291 | goto yyreduce; |
1257 | } | 1292 | } |
1258 | if (yyerrflag) goto yyinrecovery; | 1293 | if (yyerrflag) goto yyinrecovery; |
1259 | #ifdef lint | ||
1260 | goto yynewerror; | ||
1261 | #endif | ||
1262 | yynewerror: | ||
1263 | yyerror("syntax error"); | 1294 | yyerror("syntax error"); |
1264 | #ifdef lint | 1295 | #ifdef lint |
1265 | goto yyerrlab; | 1296 | goto yyerrlab; |
1266 | #endif | 1297 | #endif |
1267 | yyerrlab: | 1298 | yyerrlab: |
1268 | ++yynerrs; | 1299 | ++yynerrs; |
1269 | yyinrecovery: | 1300 | yyinrecovery: |
1270 | if (yyerrflag < 3) | 1301 | if (yyerrflag < 3) |
1271 | { | 1302 | { |
1272 | yyerrflag = 3; | 1303 | yyerrflag = 3; |
1273 | for (;;) | 1304 | for (;;) |
1274 | { | 1305 | { |
1275 | if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && | 1306 | if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && |
1276 | yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) | 1307 | yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) |
1277 | { | 1308 | { |
1278 | #if YYDEBUG | 1309 | #if YYDEBUG |
1279 | if (yydebug) | 1310 | if (yydebug) |
1280 | printf("%sdebug: state %d, error recovery shifting\ | 1311 | printf("%sdebug: state %d, error recovery shifting\ |
1281 | to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); | 1312 | to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); |
1282 | #endif | 1313 | #endif |
1283 | if (yyssp >= yyss + yystacksize - 1) | 1314 | if (yyssp >= yyss + yystacksize - 1) |
1284 | { | 1315 | { |
1285 | goto yyoverflow; | 1316 | goto yyoverflow; |
1286 | } | 1317 | } |
1287 | *++yyssp = yystate = yytable[yyn]; | 1318 | *++yyssp = yystate = yytable[yyn]; |
1288 | *++yyvsp = yylval; | 1319 | *++yyvsp = yylval; |
1289 | goto yyloop; | 1320 | goto yyloop; |
1290 | } | 1321 | } |
1291 | else | 1322 | else |
1292 | { | 1323 | { |
1293 | #if YYDEBUG | 1324 | #if YYDEBUG |
1294 | if (yydebug) | 1325 | if (yydebug) |
1295 | printf("%sdebug: error recovery discarding state %d\n", | 1326 | printf("%sdebug: error recovery discarding state %d\n", |
1296 | YYPREFIX, *yyssp); | 1327 | YYPREFIX, *yyssp); |
1297 | #endif | 1328 | #endif |
1298 | if (yyssp <= yyss) goto yyabort; | 1329 | if (yyssp <= yyss) goto yyabort; |
1299 | --yyssp; | 1330 | --yyssp; |
1300 | --yyvsp; | 1331 | --yyvsp; |
1301 | } | 1332 | } |
1302 | } | 1333 | } |
1303 | } | 1334 | } |
1304 | else | 1335 | else |
1305 | { | 1336 | { |
1306 | if (yychar == 0) goto yyabort; | 1337 | if (yychar == 0) goto yyabort; |
1307 | #if YYDEBUG | 1338 | #if YYDEBUG |
1308 | if (yydebug) | 1339 | if (yydebug) |
1309 | { | 1340 | { |
1310 | yys = 0; | 1341 | yys = 0; |
1311 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; | 1342 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
1312 | if (!yys) yys = "illegal-symbol"; | 1343 | if (!yys) yys = "illegal-symbol"; |
1313 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", | 1344 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", |
1314 | YYPREFIX, yystate, yychar, yys); | 1345 | YYPREFIX, yystate, yychar, yys); |
1315 | } | 1346 | } |
1316 | #endif | 1347 | #endif |
1317 | yychar = (-1); | 1348 | yychar = (-1); |
1318 | goto yyloop; | 1349 | goto yyloop; |
1319 | } | 1350 | } |
1320 | yyreduce: | 1351 | yyreduce: |
1321 | #if YYDEBUG | 1352 | #if YYDEBUG |
1322 | if (yydebug) | 1353 | if (yydebug) |
1323 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", | 1354 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", |
1324 | YYPREFIX, yystate, yyn, yyrule[yyn]); | 1355 | YYPREFIX, yystate, yyn, yyrule[yyn]); |
1325 | #endif | 1356 | #endif |
1326 | yym = yylen[yyn]; | 1357 | yym = yylen[yyn]; |
1327 | yyval = yyvsp[1-yym]; | 1358 | yyval = yyvsp[1-yym]; |
1328 | switch (yyn) | 1359 | switch (yyn) |
1329 | { | 1360 | { |
1330 | case 2: | 1361 | case 2: |
1331 | #line 217 "vcc.y" | 1362 | #line 221 "backend/vcc.y" |
1332 | { addList(&vObjList, yyvsp[0].vobj); curObj = 0; } | 1363 | { addList(&vObjList, yyvsp[0].vobj); curObj = 0; } |
1333 | break; | 1364 | break; |
1334 | case 3: | 1365 | case 3: |
1335 | #line 219 "vcc.y" | 1366 | #line 223 "backend/vcc.y" |
1336 | { addList(&vObjList, yyvsp[0].vobj); curObj = 0; } | 1367 | { addList(&vObjList, yyvsp[0].vobj); curObj = 0; } |
1337 | break; | 1368 | break; |
1338 | case 6: | 1369 | case 6: |
1339 | #line 228 "vcc.y" | 1370 | #line 232 "backend/vcc.y" |
1340 | { | 1371 | { |
1341 | lexPushMode(L_VCARD); | 1372 | lexPushMode(L_VCARD); |
1342 | if (!pushVObject(VCCardProp)) YYERROR; | 1373 | if (!pushVObject(VCCardProp)) YYERROR; |
1343 | } | 1374 | } |
1344 | break; | 1375 | break; |
1345 | case 7: | 1376 | case 7: |
1346 | #line 233 "vcc.y" | 1377 | #line 237 "backend/vcc.y" |
1347 | { | 1378 | { |
1348 | lexPopMode(0); | 1379 | lexPopMode(0); |
1349 | yyval.vobj = popVObject(); | 1380 | yyval.vobj = popVObject(); |
1350 | } | 1381 | } |
1351 | break; | 1382 | break; |
1352 | case 8: | 1383 | case 8: |
1353 | #line 238 "vcc.y" | 1384 | #line 242 "backend/vcc.y" |
1354 | { | 1385 | { |
1355 | lexPushMode(L_VCARD); | 1386 | lexPushMode(L_VCARD); |
1356 | if (!pushVObject(VCCardProp)) YYERROR; | 1387 | if (!pushVObject(VCCardProp)) YYERROR; |
1357 | } | 1388 | } |
1358 | break; | 1389 | break; |
1359 | case 9: | 1390 | case 9: |
1360 | #line 243 "vcc.y" | 1391 | #line 247 "backend/vcc.y" |
1361 | { | 1392 | { |
1362 | lexPopMode(0); | 1393 | lexPopMode(0); |
1363 | yyval.vobj = popVObject(); | 1394 | yyval.vobj = popVObject(); |
1364 | } | 1395 | } |
1365 | break; | 1396 | break; |
1366 | case 12: | 1397 | case 12: |
1367 | #line 254 "vcc.y" | 1398 | #line 258 "backend/vcc.y" |
1368 | { | 1399 | { |
1369 | lexPushMode(L_VALUES); | 1400 | lexPushMode(L_VALUES); |
1370 | } | 1401 | } |
1371 | break; | 1402 | break; |
1372 | case 13: | 1403 | case 13: |
1373 | #line 258 "vcc.y" | 1404 | #line 262 "backend/vcc.y" |
1374 | { | 1405 | { |
1375 | if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE)) | 1406 | if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE)) |
1376 | lexPopMode(0); | 1407 | lexPopMode(0); |
1377 | lexPopMode(0); | 1408 | lexPopMode(0); |
1378 | } | 1409 | } |
1379 | break; | 1410 | break; |
1380 | case 15: | 1411 | case 15: |
1381 | #line 267 "vcc.y" | 1412 | #line 271 "backend/vcc.y" |
1382 | { | 1413 | { |
1383 | enterProps(yyvsp[0].str); | 1414 | enterProps(yyvsp[0].str); |
1384 | } | 1415 | } |
1385 | break; | 1416 | break; |
1386 | case 17: | 1417 | case 17: |
1387 | #line 272 "vcc.y" | 1418 | #line 276 "backend/vcc.y" |
1388 | { | 1419 | { |
1389 | enterProps(yyvsp[0].str); | 1420 | enterProps(yyvsp[0].str); |
1390 | } | 1421 | } |
1391 | break; | 1422 | break; |
1392 | case 21: | 1423 | case 21: |
1393 | #line 285 "vcc.y" | 1424 | #line 289 "backend/vcc.y" |
1394 | { | 1425 | { |
1395 | enterAttr(yyvsp[0].str,0); | 1426 | enterAttr(yyvsp[0].str,0); |
1396 | } | 1427 | } |
1397 | break; | 1428 | break; |
1398 | case 22: | 1429 | case 22: |
1399 | #line 289 "vcc.y" | 1430 | #line 293 "backend/vcc.y" |
1400 | { | 1431 | { |
1401 | enterAttr(yyvsp[-2].str,yyvsp[0].str); | 1432 | enterAttr(yyvsp[-2].str,yyvsp[0].str); |
1402 | 1433 | ||
1403 | } | 1434 | } |
1404 | break; | 1435 | break; |
1405 | case 24: | 1436 | case 24: |
1406 | #line 298 "vcc.y" | 1437 | #line 302 "backend/vcc.y" |
1407 | { enterValues(yyvsp[-1].str); } | 1438 | { enterValues(yyvsp[-1].str); } |
1408 | break; | 1439 | break; |
1409 | case 26: | 1440 | case 26: |
1410 | #line 300 "vcc.y" | 1441 | #line 304 "backend/vcc.y" |
1411 | { enterValues(yyvsp[0].str); } | 1442 | { enterValues(yyvsp[0].str); } |
1412 | break; | 1443 | break; |
1413 | case 28: | 1444 | case 28: |
1414 | #line 305 "vcc.y" | 1445 | #line 309 "backend/vcc.y" |
1415 | { yyval.str = 0; } | 1446 | { yyval.str = 0; } |
1416 | break; | 1447 | break; |
1417 | case 29: | 1448 | case 29: |
1418 | #line 310 "vcc.y" | 1449 | #line 314 "backend/vcc.y" |
1419 | { if (!pushVObject(VCCalProp)) YYERROR; } | 1450 | { if (!pushVObject(VCCalProp)) YYERROR; } |
1420 | break; | 1451 | break; |
1421 | case 30: | 1452 | case 30: |
1422 | #line 313 "vcc.y" | 1453 | #line 317 "backend/vcc.y" |
1423 | { yyval.vobj = popVObject(); } | 1454 | { yyval.vobj = popVObject(); } |
1424 | break; | 1455 | break; |
1425 | case 31: | 1456 | case 31: |
1426 | #line 315 "vcc.y" | 1457 | #line 319 "backend/vcc.y" |
1427 | { if (!pushVObject(VCCalProp)) YYERROR; } | 1458 | { if (!pushVObject(VCCalProp)) YYERROR; } |
1428 | break; | 1459 | break; |
1429 | case 32: | 1460 | case 32: |
1430 | #line 317 "vcc.y" | 1461 | #line 321 "backend/vcc.y" |
1431 | { yyval.vobj = popVObject(); } | 1462 | { yyval.vobj = popVObject(); } |
1432 | break; | 1463 | break; |
1433 | case 38: | 1464 | case 38: |
1434 | #line 332 "vcc.y" | 1465 | #line 336 "backend/vcc.y" |
1435 | { | 1466 | { |
1436 | lexPushMode(L_VEVENT); | 1467 | lexPushMode(L_VEVENT); |
1437 | if (!pushVObject(VCEventProp)) YYERROR; | 1468 | if (!pushVObject(VCEventProp)) YYERROR; |
1438 | } | 1469 | } |
1439 | break; | 1470 | break; |
1440 | case 39: | 1471 | case 39: |
1441 | #line 338 "vcc.y" | 1472 | #line 342 "backend/vcc.y" |
1442 | { | 1473 | { |
1443 | lexPopMode(0); | 1474 | lexPopMode(0); |
1444 | popVObject(); | 1475 | popVObject(); |
1445 | } | 1476 | } |
1446 | break; | 1477 | break; |
1447 | case 40: | 1478 | case 40: |
1448 | #line 343 "vcc.y" | 1479 | #line 347 "backend/vcc.y" |
1449 | { | 1480 | { |
1450 | lexPushMode(L_VEVENT); | 1481 | lexPushMode(L_VEVENT); |
1451 | if (!pushVObject(VCEventProp)) YYERROR; | 1482 | if (!pushVObject(VCEventProp)) YYERROR; |
1452 | } | 1483 | } |
1453 | break; | 1484 | break; |
1454 | case 41: | 1485 | case 41: |
1455 | #line 348 "vcc.y" | 1486 | #line 352 "backend/vcc.y" |
1456 | { | 1487 | { |
1457 | lexPopMode(0); | 1488 | lexPopMode(0); |
1458 | popVObject(); | 1489 | popVObject(); |
1459 | } | 1490 | } |
1460 | break; | 1491 | break; |
1461 | case 42: | 1492 | case 42: |
1462 | #line 356 "vcc.y" | 1493 | #line 360 "backend/vcc.y" |
1463 | { | 1494 | { |
1464 | lexPushMode(L_VTODO); | 1495 | lexPushMode(L_VTODO); |
1465 | if (!pushVObject(VCTodoProp)) YYERROR; | 1496 | if (!pushVObject(VCTodoProp)) YYERROR; |
1466 | } | 1497 | } |
1467 | break; | 1498 | break; |
1468 | case 43: | 1499 | case 43: |
1469 | #line 362 "vcc.y" | 1500 | #line 366 "backend/vcc.y" |
1470 | { | 1501 | { |
1471 | lexPopMode(0); | 1502 | lexPopMode(0); |
1472 | popVObject(); | 1503 | popVObject(); |
1473 | } | 1504 | } |
1474 | break; | 1505 | break; |
1475 | case 44: | 1506 | case 44: |
1476 | #line 367 "vcc.y" | 1507 | #line 371 "backend/vcc.y" |
1477 | { | 1508 | { |
1478 | lexPushMode(L_VTODO); | 1509 | lexPushMode(L_VTODO); |
1479 | if (!pushVObject(VCTodoProp)) YYERROR; | 1510 | if (!pushVObject(VCTodoProp)) YYERROR; |
1480 | } | 1511 | } |
1481 | break; | 1512 | break; |
1482 | case 45: | 1513 | case 45: |
1483 | #line 372 "vcc.y" | 1514 | #line 376 "backend/vcc.y" |
1484 | { | 1515 | { |
1485 | lexPopMode(0); | 1516 | lexPopMode(0); |
1486 | popVObject(); | 1517 | popVObject(); |
1487 | } | 1518 | } |
1488 | break; | 1519 | break; |
1489 | #line 1492 "y.tab.c" | 1520 | #line 1521 "y.tab.c" |
1490 | } | 1521 | } |
1491 | yyssp -= yym; | 1522 | yyssp -= yym; |
1492 | yystate = *yyssp; | 1523 | yystate = *yyssp; |
1493 | yyvsp -= yym; | 1524 | yyvsp -= yym; |
1494 | yym = yylhs[yyn]; | 1525 | yym = yylhs[yyn]; |
1495 | if (yystate == 0 && yym == 0) | 1526 | if (yystate == 0 && yym == 0) |
1496 | { | 1527 | { |
1497 | #if YYDEBUG | 1528 | #if YYDEBUG |
1498 | if (yydebug) | 1529 | if (yydebug) |
1499 | printf("%sdebug: after reduction, shifting from state 0 to\ | 1530 | printf("%sdebug: after reduction, shifting from state 0 to\ |
1500 | state %d\n", YYPREFIX, YYFINAL); | 1531 | state %d\n", YYPREFIX, YYFINAL); |
1501 | #endif | 1532 | #endif |
1502 | yystate = YYFINAL; | 1533 | yystate = YYFINAL; |
1503 | *++yyssp = YYFINAL; | 1534 | *++yyssp = YYFINAL; |
1504 | *++yyvsp = yyval; | 1535 | *++yyvsp = yyval; |
1505 | if (yychar < 0) | 1536 | if (yychar < 0) |
1506 | { | 1537 | { |
1507 | if ((yychar = yylex()) < 0) yychar = 0; | 1538 | if ((yychar = yylex()) < 0) yychar = 0; |
1508 | #if YYDEBUG | 1539 | #if YYDEBUG |
1509 | if (yydebug) | 1540 | if (yydebug) |
1510 | { | 1541 | { |
1511 | yys = 0; | 1542 | yys = 0; |
1512 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; | 1543 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
1513 | if (!yys) yys = "illegal-symbol"; | 1544 | if (!yys) yys = "illegal-symbol"; |
1514 | printf("%sdebug: state %d, reading %d (%s)\n", | 1545 | printf("%sdebug: state %d, reading %d (%s)\n", |
1515 | YYPREFIX, YYFINAL, yychar, yys); | 1546 | YYPREFIX, YYFINAL, yychar, yys); |
1516 | } | 1547 | } |
1517 | #endif | 1548 | #endif |
1518 | } | 1549 | } |
1519 | if (yychar == 0) goto yyaccept; | 1550 | if (yychar == 0) goto yyaccept; |
1520 | goto yyloop; | 1551 | goto yyloop; |
1521 | } | 1552 | } |
1522 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && | 1553 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && |
1523 | yyn <= YYTABLESIZE && yycheck[yyn] == yystate) | 1554 | yyn <= YYTABLESIZE && yycheck[yyn] == yystate) |
1524 | yystate = yytable[yyn]; | 1555 | yystate = yytable[yyn]; |
1525 | else | 1556 | else |
1526 | yystate = yydgoto[yym]; | 1557 | yystate = yydgoto[yym]; |
1527 | #if YYDEBUG | 1558 | #if YYDEBUG |
1528 | if (yydebug) | 1559 | if (yydebug) |
1529 | printf("%sdebug: after reduction, shifting from state %d \ | 1560 | printf("%sdebug: after reduction, shifting from state %d \ |
1530 | to state %d\n", YYPREFIX, *yyssp, yystate); | 1561 | to state %d\n", YYPREFIX, *yyssp, yystate); |
1531 | #endif | 1562 | #endif |
1532 | if (yyssp >= yyss + yystacksize - 1) | 1563 | if (yyssp >= yyss + yystacksize - 1) |
1533 | { | 1564 | { |
1534 | goto yyoverflow; | 1565 | goto yyoverflow; |
1535 | } | 1566 | } |
1536 | *++yyssp = yystate; | 1567 | *++yyssp = yystate; |
1537 | *++yyvsp = yyval; | 1568 | *++yyvsp = yyval; |
1538 | goto yyloop; | 1569 | goto yyloop; |
1539 | yyoverflow: | 1570 | yyoverflow: |
1540 | yyerror("yacc stack overflow"); | 1571 | yyerror("yacc stack overflow"); |
1541 | yyabort: | 1572 | yyabort: |
1542 | return (1); | 1573 | return (1); |
1543 | yyaccept: | 1574 | yyaccept: |
1544 | return (0); | 1575 | return (0); |
1545 | } | 1576 | } |