Annotation of parser3/src/main/compile.y, revision 1.151
1.105 paf 1: /** @file
1.106 paf 2: Parser: compiler(lexical parser and grammar).
3:
1.87 paf 4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.106 paf 5:
1.89 paf 6: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.88 paf 7: */
1.144 parser 8: %{
1.151 ! parser 9: static char *RCSId="$Id: compile.y,v 1.150 2001/07/25 10:12:13 parser Exp $";
1.88 paf 10:
1.106 paf 11: /**
12: @todo parser4:
13: - cache compiled code from request to request. to do that...
14: -#: make method definitions, @CLASS, @BASE, @USE instructions,
1.88 paf 15: which would be executed afterwards, and actions
16: now performed at compile time would be delayed to run time.
1.106 paf 17: -#: make cache expiration on time and on disk-change of class source
18: -#: in apache use subpools for compiled class storage
19: -#: in iis make up specialized Pool object for that
1.24 paf 20: */
21:
1.90 paf 22: #define YYSTYPE Array/*<Operation>*/ *
1.9 paf 23: #define YYPARSE_PARAM pc
24: #define YYLEX_PARAM pc
25: #define YYDEBUG 1
1.106 paf 26: #define YYERROR_VERBOSE 1
1.9 paf 27: #define yyerror(msg) real_yyerror((parse_control *)pc, msg)
28: #define YYPRINT(file, type, value) yyprint(file, type, value)
1.1 paf 29:
30: #include "compile_tools.h"
1.8 paf 31: #include "pa_value.h"
1.12 paf 32: #include "pa_request.h"
1.39 paf 33: #include "pa_vobject.h"
1.52 paf 34: #include "pa_vdouble.h"
1.98 paf 35: #include "pa_globals.h"
1.141 parser 36: #include "pa_vvoid.h"
1.39 paf 37:
1.85 paf 38: #define SELF_ELEMENT_NAME "self"
1.97 paf 39: #define USE_CONTROL_METHOD_NAME "USE"
1.1 paf 40:
1.125 paf 41: static int real_yyerror(parse_control *pc, char *s);
1.9 paf 42: static void yyprint(FILE *file, int type, YYSTYPE value);
1.125 paf 43: static int yylex(YYSTYPE *lvalp, void *pc);
1.1 paf 44:
45:
1.8 paf 46: // local convinient inplace typecast & var
1.114 paf 47: #define PC (*(parse_control *)pc)
48: #define POOL (*PC.pool)
1.25 paf 49: #undef NEW
50: #define NEW new(POOL)
1.107 paf 51: #ifndef DOXYGEN
1.1 paf 52: %}
53:
54: %pure_parser
55:
1.13 paf 56: %token EON
1.4 paf 57: %token STRING
1.1 paf 58: %token BOGUS
1.55 paf 59:
1.58 paf 60: %token BAD_STRING_COMPARISON_OPERATOR
1.114 paf 61: %token BAD_HEX_LITERAL
1.58 paf 62:
1.59 paf 63: %token LAND "&&"
1.58 paf 64: %token LOR "||"
1.59 paf 65: %token LXOR "##"
1.58 paf 66:
67: %token NLE "<="
68: %token NGE ">="
69: %token NEQ "=="
70: %token NNE "!="
71:
72: %token SLT "lt"
73: %token SGT "gt"
74: %token SLE "le"
75: %token SGE "ge"
76: %token SEQ "eq"
77: %token SNE "ne"
78:
1.67 paf 79: %token DEF "def"
80: %token IN "in"
81: %token FEXISTS "-f"
1.127 paf 82: %token DEXISTS "-d"
1.95 paf 83: %token IS "is"
1.67 paf 84:
1.57 paf 85: /* logical */
1.131 paf 86: %left "##"
1.57 paf 87: %left "||"
88: %left "&&"
1.131 paf 89: %left '<' '>' "<=" ">=" "lt" "gt" "le" "ge"
90: %left "==" "!=" "eq" "ne"
91: %left "is" "def" "in" "-f" "-d"
1.68 paf 92: %left '!'
1.57 paf 93:
94: /* bitwise */
1.59 paf 95: %left '#'
1.131 paf 96: %left '|'
97: %left '&'
1.68 paf 98: %left '~'
1.57 paf 99:
1.56 paf 100: /* numerical */
1.55 paf 101: %left '-' '+'
1.57 paf 102: %left '*' '/' '%'
1.56 paf 103: %left NEG /* negation: unary - */
1.1 paf 104:
105: %%
1.88 paf 106: all:
1.10 paf 107: one_big_piece {
1.75 paf 108: Method& method=*NEW Method(POOL,
1.85 paf 109: *main_method_name,
1.122 paf 110: Method::CT_ANY,
1.81 paf 111: 0, 0, /*min, max numbered_params_count*/
1.75 paf 112: 0/*param_names*/, 0/*local_names*/,
113: $1/*parser_code*/, 0/*native_code*/);
1.114 paf 114: PC.cclass->add_method(*main_method_name, method);
1.10 paf 115: }
116: | methods;
117:
118: methods: method | methods method;
119: one_big_piece: maybe_codes;
120:
1.34 paf 121: method: control_method | code_method;
122:
123: control_method: '@' STRING '\n'
1.132 paf 124: maybe_control_strings {
1.120 paf 125: const String& command=*LA2S($2);
1.34 paf 126: YYSTYPE strings_code=$4;
1.37 paf 127: if(strings_code->size()<1*2) {
1.114 paf 128: strcpy(PC.error, "@");
129: strcat(PC.error, command.cstr());
130: strcat(PC.error, " is empty");
1.37 paf 131: YYERROR;
132: }
1.74 paf 133: if(command==CLASS_NAME) {
1.146 parser 134: if(PC.cclass->base()) { // already changed from default?
1.114 paf 135: strcpy(PC.error, "class already have a name '");
136: strncat(PC.error, PC.cclass->name().cstr(), 100);
137: strcat(PC.error, "'");
1.73 paf 138: YYERROR;
139: }
140: if(strings_code->size()==1*2) {
141: // new class' name
1.120 paf 142: const String *name=LA2S(strings_code);
1.73 paf 143: // creating the class
1.114 paf 144: PC.cclass=NEW VClass(POOL);
145: PC.cclass->set_name(*name);
1.73 paf 146: // append to request's classes
1.114 paf 147: PC.request->classes().put(*name, PC.cclass);
1.73 paf 148: } else {
1.114 paf 149: strcpy(PC.error, "@"CLASS_NAME" must contain sole name");
1.34 paf 150: YYERROR;
151: }
1.130 paf 152: } else if(command==USE_CONTROL_METHOD_NAME) {
153: for(int i=0; i<strings_code->size(); i+=2)
154: PC.request->use_file(
155: PC.request->absolute(*LA2S(strings_code, i)));
156: } else if(command==BASE_NAME) {
1.146 parser 157: if(PC.cclass->base()) { // already changed from default?
1.130 paf 158: strcpy(PC.error, "class already have a base '");
159: strncat(PC.error, PC.cclass->base()->name().cstr(), 100);
160: strcat(PC.error, "'");
161: YYERROR;
162: }
163: if(strings_code->size()==1*2) {
164: const String& base_name=*LA2S(strings_code);
165: VClass *base=static_cast<VClass *>(
166: PC.request->classes().get(base_name));
167: if(!base) {
168: strcpy(PC.error, base_name.cstr());
169: strcat(PC.error, ": undefined class in @"BASE_NAME);
1.73 paf 170: YYERROR;
171: }
1.130 paf 172: // @CLASS == @BASE sanity check
173: if(PC.cclass==base) {
174: strcpy(PC.error, "@"CLASS_NAME" equals @"BASE_NAME);
1.45 paf 175: YYERROR;
1.34 paf 176: }
1.130 paf 177: PC.cclass->set_base(*base);
1.34 paf 178: } else {
1.130 paf 179: strcpy(PC.error, "@"BASE_NAME" must contain sole name");
1.34 paf 180: YYERROR;
181: }
1.130 paf 182: } else {
183: strcpy(PC.error, "'");
184: strncat(PC.error, command.cstr(), MAX_STRING/2);
185: strcat(PC.error, "' invalid special name. valid names are "
186: "'"CLASS_NAME"', '"USE_CONTROL_METHOD_NAME"' and '"BASE_NAME"'");
187: YYERROR;
1.34 paf 188: }
189: };
1.132 paf 190: maybe_control_strings: empty | control_strings;
1.37 paf 191: control_strings: control_string | control_strings control_string { $$=$1; P($$, $2) };
192: control_string: maybe_string '\n';
193: maybe_string: empty | STRING;
1.34 paf 194:
195: code_method: '@' STRING bracketed_maybe_strings maybe_bracketed_strings maybe_comment '\n'
1.10 paf 196: maybe_codes {
1.120 paf 197: const String *name=LA2S($2);
1.10 paf 198:
199: YYSTYPE params_names_code=$3;
1.75 paf 200: Array *params_names=0;
201: if(int size=params_names_code->size()) {
202: params_names=NEW Array(POOL);
203: for(int i=0; i<size; i+=2)
1.120 paf 204: *params_names+=LA2S(params_names_code, i);
1.75 paf 205: }
1.10 paf 206:
207: YYSTYPE locals_names_code=$4;
1.75 paf 208: Array *locals_names=0;
209: if(int size=locals_names_code->size()) {
210: locals_names=NEW Array(POOL);
211: for(int i=0; i<size; i+=2)
1.120 paf 212: *locals_names+=LA2S(locals_names_code, i);
1.75 paf 213: }
1.10 paf 214:
1.76 paf 215: Method& method=*NEW Method(POOL,
216: *name,
1.122 paf 217: Method::CT_ANY,
1.81 paf 218: 0, 0/*min,max numbered_params_count*/,
1.76 paf 219: params_names, locals_names,
220: $7, 0);
1.114 paf 221: PC.cclass->add_method(*name, method);
1.8 paf 222: };
1.10 paf 223:
224: maybe_bracketed_strings: empty | bracketed_maybe_strings;
225: bracketed_maybe_strings: '[' maybe_strings ']' {$$=$2};
226: maybe_strings: empty | strings;
227: strings: STRING | strings ';' STRING { $$=$1; P($$, $3) };
228:
229: maybe_comment: empty | STRING;
1.1 paf 230:
231: /* codes */
232:
1.10 paf 233: maybe_codes: empty | codes;
234:
1.90 paf 235: codes: code | codes code { $$=$1; P($$, $2) };
1.81 paf 236: code: write_string | action;
1.149 parser 237: action: get | put | call;
1.1 paf 238:
239: /* get */
240:
1.64 paf 241: get: get_value {
242: $$=$1; /* stack: resulting value */
1.102 paf 243: O($$, OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */
1.1 paf 244: };
1.64 paf 245: get_value: '$' get_name_value { $$=$2 }
246: get_name_value: name_without_curly_rdive EON | name_in_curly_rdive;
1.1 paf 247: name_in_curly_rdive: '{' name_without_curly_rdive '}' { $$=$2 };
1.44 paf 248: name_without_curly_rdive:
249: name_without_curly_rdive_read
250: | name_without_curly_rdive_root
251: | name_without_curly_rdive_class;
1.19 paf 252: name_without_curly_rdive_read: name_without_curly_rdive_code {
1.25 paf 253: $$=N(POOL);
1.22 paf 254: Array *diving_code=$1;
1.120 paf 255: const String *first_name=LA2S(diving_code);
1.85 paf 256: if(first_name && *first_name==SELF_ELEMENT_NAME) {
1.54 paf 257: O($$, OP_WITH_SELF); /* stack: starting context */
1.22 paf 258: P($$, diving_code,
259: /* skip over... */
260: diving_code->size()>2?3/*OP_+string+get_element*/:2/*OP_+string*/);
261: } else {
1.54 paf 262: O($$, OP_WITH_READ); /* stack: starting context */
1.22 paf 263: P($$, diving_code);
264: }
265: /* diving code; stack: current context */
1.1 paf 266: };
1.19 paf 267: name_without_curly_rdive_root: ':' name_without_curly_rdive_code {
1.25 paf 268: $$=N(POOL);
1.54 paf 269: O($$, OP_WITH_ROOT); /* stack: starting context */
1.19 paf 270: P($$, $2); /* diving code; stack: current context */
271: };
1.44 paf 272: name_without_curly_rdive_class: class_prefix name_without_curly_rdive_code { $$=$1; P($$, $2) };
1.19 paf 273: name_without_curly_rdive_code: name_advance2 | name_path name_advance2 { $$=$1; P($$, $2) };
1.1 paf 274:
275: /* put */
276:
1.81 paf 277: put: '$' name_expr_wdive construct {
1.20 paf 278: $$=$2; /* stack: context,name */
1.52 paf 279: P($$, $3); /* stack: context,name,constructor_value */
1.20 paf 280: };
1.44 paf 281: name_expr_wdive:
282: name_expr_wdive_write
283: | name_expr_wdive_root
284: | name_expr_wdive_class;
1.28 paf 285: name_expr_wdive_write: name_expr_dive_code {
1.44 paf 286: $$=N(POOL);
1.23 paf 287: Array *diving_code=$1;
1.120 paf 288: const String *first_name=LA2S(diving_code);
1.85 paf 289: if(first_name && *first_name==SELF_ELEMENT_NAME) {
1.54 paf 290: O($$, OP_WITH_SELF); /* stack: starting context */
1.23 paf 291: P($$, diving_code,
292: /* skip over... */
293: diving_code->size()>2?3/*OP_+string+get_element*/:2/*OP_+string*/);
294: } else {
1.54 paf 295: O($$, OP_WITH_WRITE); /* stack: starting context */
1.23 paf 296: P($$, diving_code);
297: }
298: /* diving code; stack: current context */
1.20 paf 299: };
1.28 paf 300: name_expr_wdive_root: ':' name_expr_dive_code {
1.25 paf 301: $$=N(POOL);
1.54 paf 302: O($$, OP_WITH_ROOT); /* stack: starting context */
1.9 paf 303: P($$, $2); /* diving code; stack: context,name */
1.1 paf 304: };
1.44 paf 305: name_expr_wdive_class: class_prefix name_expr_dive_code { $$=$1; P($$, $2) };
1.20 paf 306:
1.149 parser 307: construct:
308: construct_square |
309: construct_round |
310: construct_curly
311: ;
312: construct_square: '[' any_constructor_code_value ']' {
313: // stack: context, name
314: $$=$2; // stack: context, name, value
1.81 paf 315: O($$, OP_CONSTRUCT_VALUE); /* value=pop; name=pop; context=pop; construct(context,name,value) */
316: }
317: ;
1.149 parser 318: construct_round: '(' expr_value ')' {
319: // stack: context, name
320: $$=$2; // stack: context, name, value
1.81 paf 321: O($$, OP_CONSTRUCT_EXPR); /* value=pop; name=pop; context=pop; construct(context,name,value) */
322: }
1.52 paf 323: ;
1.149 parser 324: construct_curly: '{' maybe_codes '}' {
325: // stack: context, name
326: $$=N(POOL);
327: CCA($$, $2); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */
328: };
329:
1.55 paf 330: any_constructor_code_value:
1.151 ! parser 331: empty_string_value /* optimized $var[] case */
1.52 paf 332: | STRING /* optimized $var[STRING] case */
1.55 paf 333: | constructor_code_value /* $var[something complex] */
1.1 paf 334: ;
1.55 paf 335: constructor_code_value: constructor_code {
1.25 paf 336: $$=N(POOL);
1.54 paf 337: O($$, OP_CREATE_EWPOOL); /* stack: empty write context */
1.69 paf 338: P($$, $1); /* some code that writes to that context */
1.54 paf 339: O($$, OP_REDUCE_EWPOOL); /* context=pop; stack: context.value() */
1.1 paf 340: };
1.55 paf 341: constructor_code: codes__excluding_sole_str_literal;
1.27 paf 342: codes__excluding_sole_str_literal: action | code codes { $$=$1; P($$, $2) };
343:
1.1 paf 344: /* call */
345:
1.66 paf 346: call: call_value {
347: $$=$1; /* stack: value */
1.102 paf 348: O($$, OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */
1.66 paf 349: };
350: call_value: '^' call_name store_params EON { /* ^field.$method{vasya} */
1.42 paf 351: $$=$2; /* with_xxx,diving code; stack: context,method_junction */
1.54 paf 352: O($$, OP_GET_METHOD_FRAME); /* stack: context,method_frame */
1.123 paf 353:
354: YYSTYPE params_code=$3;
1.140 parser 355: if(params_code->size()==3) // probably [] case. [OP_VALUE + Void + STORE_PARAM]
1.123 paf 356: if(Value *value=LA2V(params_code)) // it is OP_VALUE + value?
1.140 parser 357: if(!value->is_defined()) // value is VVoid?
1.123 paf 358: params_code=0; // ^zzz[] case. don't append lone empty param.
359: if(params_code)
360: P($$, params_code); // filling method_frame.store_params
361: O($$, OP_CALL); // method_frame=pop; ncontext=pop; call(ncontext,method_frame) stack: value
1.1 paf 362: };
363:
1.43 paf 364: call_name: name_without_curly_rdive;
1.38 paf 365:
1.9 paf 366: store_params: store_param | store_params store_param { $$=$1; P($$, $2) };
1.69 paf 367: store_param:
368: store_square_param
369: | store_round_param
370: | store_curly_param
1.31 paf 371: ;
1.123 paf 372: store_square_param: '[' store_code_param_parts ']' {$$=$2};
1.69 paf 373: store_round_param: '(' store_expr_param_parts ')' {$$=$2};
1.94 paf 374: store_curly_param: '{' store_curly_param_parts '}' {$$=$2};
1.69 paf 375: store_code_param_parts:
376: store_code_param_part
377: | store_code_param_parts ';' store_code_param_part { $$=$1; P($$, $3) }
378: ;
379: store_expr_param_parts:
380: store_expr_param_part
381: | store_expr_param_parts ';' store_expr_param_part { $$=$1; P($$, $3) }
382: ;
1.94 paf 383: store_curly_param_parts:
384: store_curly_param_part
385: | store_curly_param_parts ';' store_curly_param_part { $$=$1; P($$, $3) }
386: ;
1.120 paf 387: store_code_param_part: code_param_value {
1.32 paf 388: $$=$1;
1.54 paf 389: O($$, OP_STORE_PARAM);
1.120 paf 390: };
1.69 paf 391: store_expr_param_part: write_expr_value {
392: $$=N(POOL);
1.103 paf 393: PEA($$, $1);
1.69 paf 394: };
1.94 paf 395: store_curly_param_part: maybe_codes {
396: $$=N(POOL);
397: PCA($$, $1);
398: };
1.120 paf 399: code_param_value:
1.151 ! parser 400: empty_void_value /* optimized [;...] case */
1.120 paf 401: | STRING /* optimized [STRING] case */
402: | constructor_code_value /* [something complex] */
403: ;
1.90 paf 404: write_expr_value: expr_value {
1.69 paf 405: $$=$1;
1.102 paf 406: O($$, OP_WRITE_EXPR_RESULT);
1.69 paf 407: };
1.1 paf 408:
409: /* name */
410:
1.20 paf 411: name_expr_dive_code: name_expr_value | name_path name_expr_value { $$=$1; P($$, $2) };
1.1 paf 412:
1.9 paf 413: name_path: name_step | name_path name_step { $$=$1; P($$, $2) };
1.1 paf 414: name_step: name_advance1 '.';
415: name_advance1: name_expr_value {
416: /* stack: context */
417: $$=$1; /* stack: context,name */
1.54 paf 418: O($$, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.1 paf 419: };
420: name_advance2: name_expr_value {
421: /* stack: context */
422: $$=$1; /* stack: context,name */
1.54 paf 423: O($$, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.1 paf 424: }
1.4 paf 425: | STRING BOGUS
1.1 paf 426: ;
427: name_expr_value:
1.4 paf 428: STRING /* subname_is_const */
1.1 paf 429: | name_expr_subvar_value /* $subname_is_var_value */
430: | name_expr_with_subvar_value /* xxx$part_of_subname_is_var_value[$...] */
431: ;
432: name_expr_subvar_value: '$' subvar_ref_name_rdive {
433: $$=$2;
1.54 paf 434: O($$, OP_GET_ELEMENT);
1.1 paf 435: };
1.4 paf 436: name_expr_with_subvar_value: STRING subvar_get_writes {
1.25 paf 437: $$=N(POOL);
1.54 paf 438: O($$, OP_CREATE_EWPOOL);
1.9 paf 439: P($$, $1);
1.102 paf 440: O($$, OP_WRITE_VALUE);
1.9 paf 441: P($$, $2);
1.54 paf 442: O($$, OP_REDUCE_EWPOOL);
1.1 paf 443: };
1.18 paf 444: subvar_ref_name_rdive: subvar_ref_name_rdive_read | subvar_ref_name_rdive_root;
445: subvar_ref_name_rdive_read: STRING {
1.25 paf 446: $$=N(POOL);
1.54 paf 447: O($$, OP_WITH_READ);
1.9 paf 448: P($$, $1);
1.1 paf 449: };
1.18 paf 450: subvar_ref_name_rdive_root: ':' STRING {
1.25 paf 451: $$=N(POOL);
1.54 paf 452: O($$, OP_WITH_ROOT);
1.18 paf 453: P($$, $2);
454: };
1.9 paf 455: subvar_get_writes: subvar__get_write | subvar_get_writes subvar__get_write { $$=$1; P($$, $2) };
1.1 paf 456: subvar__get_write: '$' subvar_ref_name_rdive {
457: $$=$2;
1.54 paf 458: O($$, OP_GET_ELEMENT__WRITE);
1.42 paf 459: };
460:
1.44 paf 461: class_prefix: STRING ':' {
1.72 paf 462: $$=$1; // stack: class name string
463: O($$, OP_GET_CLASS);
1.1 paf 464: };
465:
1.53 paf 466:
1.56 paf 467: /* expr */
1.53 paf 468:
1.81 paf 469: expr_value: expr {
470: if(($$=$1)->size()==2) // only one string literal in there?
1.62 paf 471: change_string_literal_to_double_literal($$); // make that string literal Double
472: };
1.56 paf 473: expr:
1.62 paf 474: STRING
1.64 paf 475: | get_value
1.66 paf 476: | call_value
1.64 paf 477: | '"' string_inside_quotes_value '"' { $$ = $2; }
1.145 parser 478: | '\'' string_inside_quotes_value '\'' { $$ = $2; }
1.60 paf 479: | '(' expr ')' { $$ = $2; }
480: /* stack: operand // stack: @operand */
481: | '-' expr %prec NEG { $$=$2; O($$, OP_NEG) }
1.68 paf 482: | '~' expr { $$=$2; O($$, OP_INV) }
483: | '!' expr { $$=$2; O($$, OP_NOT) }
484: | "def" expr { $$=$2; O($$, OP_DEF) }
485: | "in" expr { $$=$2; O($$, OP_IN) }
486: | "-f" expr { $$=$2; O($$, OP_FEXISTS) }
1.127 paf 487: | "-d" expr { $$=$2; O($$, OP_DEXISTS) }
1.60 paf 488: /* stack: a,b // stack: a@b */
489: | expr '-' expr { $$=$1; P($$, $3); O($$, OP_SUB) }
490: | expr '+' expr { $$=$1; P($$, $3); O($$, OP_ADD) }
491: | expr '*' expr { $$=$1; P($$, $3); O($$, OP_MUL) }
492: | expr '/' expr { $$=$1; P($$, $3); O($$, OP_DIV) }
493: | expr '%' expr { $$=$1; P($$, $3); O($$, OP_MOD) }
494: | expr '&' expr { $$=$1; P($$, $3); O($$, OP_BIN_AND) }
495: | expr '|' expr { $$=$1; P($$, $3); O($$, OP_BIN_OR) }
496: | expr '#' expr { $$=$1; P($$, $3); O($$, OP_BIN_XOR) }
497: | expr "&&" expr { $$=$1; P($$, $3); O($$, OP_LOG_AND) }
498: | expr "||" expr { $$=$1; P($$, $3); O($$, OP_LOG_OR) }
499: | expr "##" expr { $$=$1; P($$, $3); O($$, OP_LOG_XOR) }
500: | expr '<' expr { $$=$1; P($$, $3); O($$, OP_NUM_LT) }
501: | expr '>' expr { $$=$1; P($$, $3); O($$, OP_NUM_GT) }
502: | expr "<=" expr { $$=$1; P($$, $3); O($$, OP_NUM_LE) }
503: | expr ">=" expr { $$=$1; P($$, $3); O($$, OP_NUM_GE) }
504: | expr "==" expr { $$=$1; P($$, $3); O($$, OP_NUM_EQ) }
505: | expr "!=" expr { $$=$1; P($$, $3); O($$, OP_NUM_NE) }
1.61 paf 506: | expr "lt" expr { $$=$1; P($$, $3); O($$, OP_STR_LT) }
507: | expr "gt" expr { $$=$1; P($$, $3); O($$, OP_STR_GT) }
508: | expr "le" expr { $$=$1; P($$, $3); O($$, OP_STR_LE) }
509: | expr "ge" expr { $$=$1; P($$, $3); O($$, OP_STR_GE) }
510: | expr "eq" expr { $$=$1; P($$, $3); O($$, OP_STR_EQ) }
511: | expr "ne" expr { $$=$1; P($$, $3); O($$, OP_STR_NE) }
1.95 paf 512: | expr "is" expr { $$=$1; P($$, $3); O($$, OP_IS) }
1.56 paf 513: ;
1.55 paf 514:
1.65 paf 515: string_inside_quotes_value: maybe_codes {
1.64 paf 516: $$=N(POOL);
517: O($$, OP_CREATE_SWPOOL); /* stack: empty write context */
1.69 paf 518: P($$, $1); /* some code that writes to that context */
1.64 paf 519: O($$, OP_REDUCE_SWPOOL); /* context=pop; stack: context.get_string() */
1.53 paf 520: };
1.1 paf 521:
1.27 paf 522: /* basics */
1.1 paf 523:
1.81 paf 524: write_string: STRING {
1.102 paf 525: // optimized from OP_STRING+OP_WRITE_VALUE to OP_STRING__WRITE
1.84 paf 526: change_string_literal_to_write_string_literal($$=$1)
1.54 paf 527: };
528:
1.151 ! parser 529: empty_void_value: /* empty */ { $$=VL(NEW VVoid(POOL)) };
! 530: empty_string_value: /* empty */ { $$=VL(NEW VString(POOL)) };
1.25 paf 531: empty: /* empty */ { $$=N(POOL) };
1.1 paf 532:
533: %%
1.105 paf 534: #endif
1.1 paf 535:
536: /*
537: 000$111(2222)00
538: 000$111{3333}00
1.9 paf 539: $,^: push,=0
1.1 paf 540: 1:( { break=pop
541: 2:( ) pop
542: 3:{ } pop
543:
544: 000^111(2222)4444{33333}4000
1.9 paf 545: $,^: push,=0
1.1 paf 546: 1:( { break=pop
547: 2:( )=4
548: 3:{ }=4
549: 4:[^({]=pop
550: */
551:
1.110 paf 552: static int yylex(YYSTYPE *lvalp, void *pc) {
1.114 paf 553: #define lexical_brackets_nestage PC.brackets_nestages[PC.sp]
1.48 paf 554: #define RC {result=c; goto break2; }
1.1 paf 555:
556: register int c;
557: int result;
558:
1.114 paf 559: if(PC.pending_state) {
560: result=PC.pending_state;
561: PC.pending_state=0;
1.1 paf 562: return result;
563: }
564:
1.114 paf 565: const char *begin=PC.source;
1.91 paf 566: const char *end;
1.114 paf 567: int begin_line=PC.line;
1.67 paf 568: int skip_analized=0;
1.50 paf 569: while(true) {
1.114 paf 570: c=*(end=(PC.source++));
1.1 paf 571:
1.4 paf 572: if(c=='\n') {
1.114 paf 573: PC.line++;
574: PC.col=0;
1.10 paf 575: } else
1.114 paf 576: PC.col++;
1.73 paf 577:
1.119 paf 578: if(c=='^' && PC.ls!=LS_COMMENT && PC.ls!=LS_DEF_COMMENT)
1.114 paf 579: switch(*PC.source) {
1.126 paf 580: // escaping: ^^ & co
1.48 paf 581: case '^': case '$': case ';':
1.126 paf 582: case '(': case ')':
1.48 paf 583: case '[': case ']':
584: case '{': case '}':
1.114 paf 585: case '"':
1.40 paf 586: if(end!=begin) {
587: // append piece till ^
1.121 paf 588: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1.40 paf 589: }
1.63 paf 590: // reset piece 'begin' position & line
1.114 paf 591: begin=PC.source; // ^
592: begin_line=PC.line;
1.40 paf 593: // skip over ^ and _
1.114 paf 594: PC.source++; PC.col++;
1.40 paf 595: // skip analysis = forced literal
1.1 paf 596: continue;
1.114 paf 597:
598: // converting ^#HH into char(hex(HH))
599: case '#':
600: if(end!=begin) {
601: // append piece till ^
1.121 paf 602: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1.114 paf 603: }
604: // #HH ?
605: if(PC.source[0]=='#' && PC.source[1] && PC.source[2]) {
606: char *hex=(char *)POOL.malloc(1);
607: hex[0]=
608: hex_value[(unsigned char)PC.source[1]]*0x10+
609: hex_value[(unsigned char)PC.source[2]];
610: if(hex[0]==0) {
611: result=BAD_HEX_LITERAL;
612: goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
613: }
614: // append char(hex(HH))
1.121 paf 615: PC.string->APPEND_CLEAN(hex, 1, PC.file, begin_line);
1.114 paf 616: // skip over ^#HH
617: PC.source+=3;
618: PC.col+=3;
619: // reset piece 'begin' position & line
620: begin=PC.source; // ^
621: begin_line=PC.line;
622: continue;
623: }
624: break;
1.1 paf 625: }
1.113 paf 626: // #comment start skipping
1.114 paf 627: if(c=='#' && PC.col==1) {
1.112 paf 628: if(end!=begin) {
629: // append piece till #
1.121 paf 630: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1.112 paf 631: }
632: // fall into COMMENT lexical state [wait for \n]
633: push_LS(PC, LS_COMMENT);
634: }
1.114 paf 635: switch(PC.ls) {
1.10 paf 636:
637: // USER'S = NOT OURS
1.1 paf 638: case LS_USER:
1.48 paf 639: switch(c) {
640: case '$':
1.10 paf 641: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 642: RC;
643: case '^':
644: push_LS(PC, LS_METHOD_NAME);
645: RC;
646: case '@':
1.114 paf 647: if(PC.col==0+1) {
1.48 paf 648: push_LS(PC, LS_DEF_NAME);
649: RC;
650: }
651: break;
1.112 paf 652: }
653: break;
654:
655: // #COMMENT
656: case LS_COMMENT:
657: if(c=='\n') {
658: // skip comment
1.114 paf 659: begin=PC.source;
660: begin_line=PC.line;
1.112 paf 661:
662: pop_LS(PC);
663: continue;
1.1 paf 664: }
1.48 paf 665: break;
666:
667: // STRING IN EXPRESSION
1.145 parser 668: case LS_EXPRESSION_STRING_QUOTED:
669: case LS_EXPRESSION_STRING_APOSTROFED:
1.48 paf 670: switch(c) {
671: case '"':
1.145 parser 672: case '\'':
673: if(
674: PC.ls == LS_EXPRESSION_STRING_QUOTED && c=='"' ||
675: PC.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') {
676: pop_LS(PC); //"abc". | 'abc'.
677: RC;
678: }
679: break;
1.48 paf 680: case '$':
681: push_LS(PC, LS_VAR_NAME_SIMPLE);
682: RC;
683: case '^':
1.10 paf 684: push_LS(PC, LS_METHOD_NAME);
1.48 paf 685: RC;
1.10 paf 686: }
687: break;
688:
689: // METHOD DEFINITION
690: case LS_DEF_NAME:
1.48 paf 691: switch(c) {
692: case '[':
1.114 paf 693: PC.ls=LS_DEF_PARAMS;
1.48 paf 694: RC;
695: case '\n':
1.114 paf 696: PC.ls=LS_DEF_SPECIAL_BODY;
1.48 paf 697: RC;
1.10 paf 698: }
699: break;
1.48 paf 700:
1.10 paf 701: case LS_DEF_PARAMS:
1.48 paf 702: switch(c) {
703: case ';':
704: RC;
705: case ']':
1.114 paf 706: PC.ls=*PC.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1.48 paf 707: RC;
1.49 paf 708: case '\n': // wrong. bailing out
1.10 paf 709: pop_LS(PC);
1.48 paf 710: RC;
1.10 paf 711: }
712: break;
1.48 paf 713:
1.10 paf 714: case LS_DEF_LOCALS:
1.48 paf 715: switch(c) {
716: case '[':
717: case ';':
718: RC;
719: case ']':
1.114 paf 720: PC.ls=LS_DEF_COMMENT;
1.48 paf 721: RC;
722: case '\n': // wrong. bailing out
1.10 paf 723: pop_LS(PC);
1.48 paf 724: RC;
1.10 paf 725: }
726: break;
1.48 paf 727:
1.10 paf 728: case LS_DEF_COMMENT:
729: if(c=='\n') {
730: pop_LS(PC);
1.48 paf 731: RC;
1.37 paf 732: }
733: break;
734:
1.48 paf 735: case LS_DEF_SPECIAL_BODY:
1.147 parser 736: // @todo in case
737: // ################
738: // @next-method
739: // we are here with c=='@'
740: // which is wrong, and need action
1.37 paf 741: if(c=='\n') {
1.114 paf 742: switch(*PC.source) {
1.48 paf 743: case '@': case 0: // end of special_code
1.37 paf 744: pop_LS(PC);
1.48 paf 745: break;
746: }
747: RC;
748: }
749: break;
750:
751: // (EXPRESSION)
1.69 paf 752: case LS_VAR_ROUND:
753: case LS_METHOD_ROUND:
1.48 paf 754: switch(c) {
755: case ')':
756: if(--lexical_brackets_nestage==0)
1.114 paf 757: if(PC.ls==LS_METHOD_ROUND) // method round param ended
758: PC.ls=LS_METHOD_AFTER; // look for method end
759: else // PC.ls==LS_VAR_ROUND // variable constructor ended
1.69 paf 760: pop_LS(PC); // return to normal life
1.48 paf 761: RC;
762: case '$':
1.69 paf 763: push_LS(PC, LS_EXPRESSION_VAR_NAME);
1.48 paf 764: RC;
765: case '^':
766: push_LS(PC, LS_METHOD_NAME);
767: RC;
768: case '(':
769: lexical_brackets_nestage++;
770: RC;
1.67 paf 771: case '-':
1.127 paf 772: switch(*PC.source) {
773: case 'f': // -f
1.67 paf 774: skip_analized=1;
775: result=FEXISTS;
1.127 paf 776: goto break2;
777: case 'd': // -d
778: skip_analized=1;
779: result=DEXISTS;
780: goto break2;
781: default:
1.67 paf 782: result=c;
1.127 paf 783: goto break2;
784: }
1.67 paf 785: goto break2;
786: case '+': case '*': case '/': case '%':
1.58 paf 787: case '~':
1.48 paf 788: case ';':
789: RC;
1.59 paf 790: case '&': case '|': case '#':
1.114 paf 791: if(*PC.source==c) { // && ||
1.59 paf 792: result=c=='#'?LXOR:c=='&'?LAND:LOR;
1.67 paf 793: skip_analized=1;
1.58 paf 794: } else
795: result=c;
796: goto break2;
797: case '<': case '>': case '=': case '!':
1.114 paf 798: if(*PC.source=='=') { // <= >= == !=
1.67 paf 799: skip_analized=1;
1.58 paf 800: switch(c) {
801: case '<': result=NLE; break;
802: case '>': result=NGE; break;
803: case '=': result=NEQ; break;
804: case '!': result=NNE; break;
805: }
806: } else
807: result=c;
808: goto break2;
1.48 paf 809: case '"':
1.145 parser 810: push_LS(PC, LS_EXPRESSION_STRING_QUOTED);
811: RC;
812: case '\'':
813: push_LS(PC, LS_EXPRESSION_STRING_APOSTROFED);
1.48 paf 814: RC;
1.50 paf 815: case 'l': case 'g': case 'e': case 'n':
1.51 paf 816: if(end==begin) // right after whitespace
1.117 paf 817: if(isspace(PC.source[1])) {
818: switch(*PC.source) {
819: // case '?': // ok [and bad cases, yacc would bark at them]
820: case 't': // lt gt [et nt]
821: result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
822: skip_analized=1;
823: goto break2;
824: case 'e': // le ge ne [ee]
825: result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
826: skip_analized=1;
827: goto break2;
828: case 'q': // eq [lq gq nq]
829: result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
830: skip_analized=1;
831: goto break2;
832: }
1.67 paf 833: }
834: break;
835: case 'i':
836: if(end==begin) // right after whitespace
1.117 paf 837: if(isspace(PC.source[1])) {
838: switch(PC.source[0]) {
839: case 'n': // in
1.95 paf 840: skip_analized=1;
841: result=IN;
842: goto break2;
1.117 paf 843: case 's': // is
1.95 paf 844: skip_analized=1;
845: result=IS;
846: goto break2;
847: }
1.67 paf 848: }
849: break;
850: case 'd':
851: if(end==begin) // right after whitespace
1.114 paf 852: if(PC.source[0]=='e' && PC.source[1]=='f') { // def
1.67 paf 853: skip_analized=2;
854: result=DEF;
1.58 paf 855: goto break2;
1.50 paf 856: }
1.48 paf 857: break;
858: case ' ': case '\t': case '\n':
1.63 paf 859: if(end!=begin) { // there were a string after previous operator?
860: result=0; // return that string
861: goto break2;
1.48 paf 862: }
1.63 paf 863: // that's a leading|traling space or after-operator-space
864: // ignoring it
865: // reset piece 'begin' position & line
1.114 paf 866: begin=PC.source; // after whitespace char
867: begin_line=PC.line;
1.48 paf 868: continue;
1.1 paf 869: }
870: break;
871:
1.10 paf 872: // VARIABLE GET/PUT/WITH
1.1 paf 873: case LS_VAR_NAME_SIMPLE:
1.69 paf 874: case LS_EXPRESSION_VAR_NAME:
1.142 parser 875: case LS_VAR_NAME_NO_COLON:
1.114 paf 876: if(PC.ls==LS_EXPRESSION_VAR_NAME) {
1.56 paf 877: // name in expr ends also before binary operators
1.48 paf 878: switch(c) {
1.92 paf 879: case '-':
1.48 paf 880: pop_LS(PC);
1.114 paf 881: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
1.48 paf 882: result=EON;
883: goto break2;
884: }
885: }
1.142 parser 886: if(PC.ls==LS_VAR_NAME_NO_COLON) {
887: // name already has ':', stop before next
888: switch(c) {
889: case ':':
890: pop_LS(PC);
891: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
892: result=EON;
893: goto break2;
894: }
895: }
1.48 paf 896: switch(c) {
897: case 0:
898: case ' ': case '\t': case '\n':
899: case ';':
1.126 paf 900: case ']': case '}': case ')':
901: case '"': case '\'':
1.139 parser 902: case '<': case '>': // these stand for HTML brackets AND expression binary ops
1.92 paf 903: case '+': case '*': case '/': case '%':
904: case '&': case '|':
905: case '=': case '!':
1.99 paf 906: // common delimiters
1.126 paf 907: case ',':
1.139 parser 908: // before call
909: case '^':
1.1 paf 910: pop_LS(PC);
1.114 paf 911: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
1.13 paf 912: result=EON;
1.1 paf 913: goto break2;
1.48 paf 914: case '[':
1.114 paf 915: PC.ls=LS_VAR_SQUARE;
1.1 paf 916: lexical_brackets_nestage=1;
1.48 paf 917: RC;
918: case '{':
919: if(begin==end) { // ${name}, no need of EON, switching LS
1.114 paf 920: PC.ls=LS_VAR_NAME_CURLY;
1.48 paf 921: } else {
1.114 paf 922: PC.ls=LS_VAR_CURLY;
1.48 paf 923: lexical_brackets_nestage=1;
924: }
1.69 paf 925:
1.48 paf 926: RC;
927: case '(':
1.114 paf 928: PC.ls=LS_VAR_ROUND;
1.1 paf 929: lexical_brackets_nestage=1;
1.48 paf 930: RC;
931: case '.': // name part delim
932: case '$': // name part subvar
933: case ':': // ':name' or 'class:name'
1.142 parser 934: PC.ls=LS_VAR_NAME_NO_COLON; // stop before next ':'
1.48 paf 935: RC;
1.1 paf 936: }
937: break;
1.48 paf 938:
1.1 paf 939: case LS_VAR_NAME_CURLY:
1.48 paf 940: switch(c) {
941: case '}': // ${name} finished, restoring LS
1.1 paf 942: pop_LS(PC);
1.48 paf 943: RC;
944: case '.': // name part delim
945: case '$': // name part subvar
946: case ':': // ':name' or 'class:name'
947: RC;
1.1 paf 948: }
949: break;
1.48 paf 950:
951: case LS_VAR_SQUARE:
952: switch(c) {
953: case '$':
1.10 paf 954: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 955: RC;
956: case '^':
1.10 paf 957: push_LS(PC, LS_METHOD_NAME);
1.48 paf 958: RC;
959: case ']':
1.1 paf 960: if(--lexical_brackets_nestage==0) {
961: pop_LS(PC);
1.48 paf 962: RC;
1.1 paf 963: }
1.48 paf 964: break;
965: case ';': // operator_or_fmt;value delim
966: RC;
967: case '[':
968: lexical_brackets_nestage++;
969: break;
1.1 paf 970: }
971: break;
1.48 paf 972:
1.1 paf 973: case LS_VAR_CURLY:
1.48 paf 974: switch(c) {
975: case '$':
1.10 paf 976: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 977: RC;
978: case '^':
1.10 paf 979: push_LS(PC, LS_METHOD_NAME);
1.48 paf 980: RC;
981: case '}':
1.1 paf 982: if(--lexical_brackets_nestage==0) {
983: pop_LS(PC);
1.48 paf 984: RC;
1.1 paf 985: }
1.48 paf 986: break;
987: case '{':
1.1 paf 988: lexical_brackets_nestage++;
1.48 paf 989: break;
990: }
1.1 paf 991: break;
992:
1.10 paf 993: // METHOD CALL
1.1 paf 994: case LS_METHOD_NAME:
1.48 paf 995: switch(c) {
996: case '[':
1.114 paf 997: PC.ls=LS_METHOD_SQUARE;
1.1 paf 998: lexical_brackets_nestage=1;
1.48 paf 999: RC;
1000: case '{':
1.114 paf 1001: PC.ls=LS_METHOD_CURLY;
1.1 paf 1002: lexical_brackets_nestage=1;
1.48 paf 1003: RC;
1.69 paf 1004: case '(':
1.114 paf 1005: PC.ls=LS_METHOD_ROUND;
1.69 paf 1006: lexical_brackets_nestage=1;
1007: RC;
1.48 paf 1008: case '.': // name part delim
1009: case '$': // name part subvar
1010: case ':': // ':name' or 'class:name'
1011: RC;
1.1 paf 1012: }
1013: break;
1.48 paf 1014:
1015: case LS_METHOD_SQUARE:
1016: switch(c) {
1017: case '$':
1.10 paf 1018: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 1019: RC;
1020: case '^':
1.10 paf 1021: push_LS(PC, LS_METHOD_NAME);
1.48 paf 1022: RC;
1023: case ';': // param delim
1024: RC;
1025: case ']':
1.1 paf 1026: if(--lexical_brackets_nestage==0) {
1.114 paf 1027: PC.ls=LS_METHOD_AFTER;
1.48 paf 1028: RC;
1.1 paf 1029: }
1.48 paf 1030: break;
1031: case '[':
1.1 paf 1032: lexical_brackets_nestage++;
1.48 paf 1033: break;
1034: }
1.1 paf 1035: break;
1.48 paf 1036:
1.1 paf 1037: case LS_METHOD_CURLY:
1.48 paf 1038: switch(c) {
1039: case '$':
1.10 paf 1040: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 1041: RC;
1042: case '^':
1.10 paf 1043: push_LS(PC, LS_METHOD_NAME);
1.94 paf 1044: RC;
1045: case ';': // param delim
1.48 paf 1046: RC;
1047: case '}':
1.1 paf 1048: if(--lexical_brackets_nestage==0) {
1.114 paf 1049: PC.ls=LS_METHOD_AFTER;
1.48 paf 1050: RC;
1.1 paf 1051: }
1.48 paf 1052: break;
1053: case '{':
1.1 paf 1054: lexical_brackets_nestage++;
1.48 paf 1055: break;
1056: }
1.1 paf 1057: break;
1.48 paf 1058:
1.1 paf 1059: case LS_METHOD_AFTER:
1.69 paf 1060: if(c=='[') {/* ][ }[ )[ */
1.114 paf 1061: PC.ls=LS_METHOD_SQUARE;
1.1 paf 1062: lexical_brackets_nestage=1;
1.48 paf 1063: RC;
1.1 paf 1064: }
1.69 paf 1065: if(c=='{') {/* ]{ }{ ){ */
1.114 paf 1066: PC.ls=LS_METHOD_CURLY;
1.69 paf 1067: lexical_brackets_nestage=1;
1068: RC;
1069: }
1070: if(c=='(') {/* ]( }( )( */
1.114 paf 1071: PC.ls=LS_METHOD_ROUND;
1.1 paf 1072: lexical_brackets_nestage=1;
1.48 paf 1073: RC;
1.1 paf 1074: }
1075: pop_LS(PC);
1.114 paf 1076: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
1.13 paf 1077: result=EON;
1.1 paf 1078: goto break2;
1079: }
1.9 paf 1080: if(c==0) {
1.1 paf 1081: result=-1;
1082: break;
1083: }
1084: }
1085:
1086: break2:
1.59 paf 1087: if(end!=begin) { // there is last piece?
1088: if((c=='@' || c==0) && end[-1]=='\n') { // we are before LS_DEF_NAME or EOF?
1089: // strip last \n
1.10 paf 1090: end--;
1.137 parser 1091: if(end!=begin && end[-1]=='\n') // allow one empty line before LS_DEF_NAME
1092: end--;
1.59 paf 1093: }
1.133 parser 1094: if(end!=begin && PC.ls!=LS_COMMENT) { // last piece still alive and not comment?
1.59 paf 1095: // append it
1.121 paf 1096: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line/*, start_col*/);
1.30 paf 1097: }
1.59 paf 1098: }
1.114 paf 1099: if(PC.string->size()) { // something accumulated?
1.17 paf 1100: // create STRING value: array of OP_VALUE+vstring
1.114 paf 1101: *lvalp=VL(NEW VString(*PC.string));
1.10 paf 1102: // new pieces storage
1.114 paf 1103: PC.string=NEW String(POOL);
1.58 paf 1104: // make current result be pending for next call, return STRING for now
1.114 paf 1105: PC.pending_state=result; result=STRING;
1.58 paf 1106: }
1.67 paf 1107: if(skip_analized) {
1.114 paf 1108: PC.source+=skip_analized; PC.col+=skip_analized;
1.1 paf 1109: }
1.58 paf 1110: return result;
1.1 paf 1111: }
1112:
1.110 paf 1113: static int real_yyerror(parse_control *pc, char *s) { // Called by yyparse on error
1.114 paf 1114: strncpy(PC.error, s, MAX_STRING);
1.1 paf 1115: return 1;
1.110 paf 1116: }
1.1 paf 1117:
1.110 paf 1118: static void yyprint(FILE *file, int type, YYSTYPE value) {
1119: if(type==STRING)
1.120 paf 1120: fprintf(file, " \"%s\"", LA2S(value)->cstr());
1.110 paf 1121: }
E-mail: