Annotation of parser3/src/main/compile.y, revision 1.154
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.154 ! parser 9: static char *RCSId="$Id: compile.y,v 1.153 2001/07/25 12:18:23 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.152 parser 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_class;
1.19 paf 251: name_without_curly_rdive_read: name_without_curly_rdive_code {
1.25 paf 252: $$=N(POOL);
1.22 paf 253: Array *diving_code=$1;
1.120 paf 254: const String *first_name=LA2S(diving_code);
1.85 paf 255: if(first_name && *first_name==SELF_ELEMENT_NAME) {
1.54 paf 256: O($$, OP_WITH_SELF); /* stack: starting context */
1.22 paf 257: P($$, diving_code,
258: /* skip over... */
259: diving_code->size()>2?3/*OP_+string+get_element*/:2/*OP_+string*/);
260: } else {
1.54 paf 261: O($$, OP_WITH_READ); /* stack: starting context */
1.22 paf 262: P($$, diving_code);
263: }
264: /* diving code; stack: current context */
1.1 paf 265: };
1.154 ! parser 266: name_without_curly_rdive_class: class_prefix_get name_without_curly_rdive_code { $$=$1; P($$, $2) };
1.19 paf 267: name_without_curly_rdive_code: name_advance2 | name_path name_advance2 { $$=$1; P($$, $2) };
1.1 paf 268:
269: /* put */
270:
1.81 paf 271: put: '$' name_expr_wdive construct {
1.20 paf 272: $$=$2; /* stack: context,name */
1.52 paf 273: P($$, $3); /* stack: context,name,constructor_value */
1.20 paf 274: };
1.44 paf 275: name_expr_wdive:
276: name_expr_wdive_write
277: | name_expr_wdive_class;
1.28 paf 278: name_expr_wdive_write: name_expr_dive_code {
1.44 paf 279: $$=N(POOL);
1.23 paf 280: Array *diving_code=$1;
1.120 paf 281: const String *first_name=LA2S(diving_code);
1.85 paf 282: if(first_name && *first_name==SELF_ELEMENT_NAME) {
1.54 paf 283: O($$, OP_WITH_SELF); /* stack: starting context */
1.23 paf 284: P($$, diving_code,
285: /* skip over... */
286: diving_code->size()>2?3/*OP_+string+get_element*/:2/*OP_+string*/);
287: } else {
1.54 paf 288: O($$, OP_WITH_WRITE); /* stack: starting context */
1.23 paf 289: P($$, diving_code);
290: }
291: /* diving code; stack: current context */
1.20 paf 292: };
1.154 ! parser 293: name_expr_wdive_class: class_prefix_get name_expr_dive_code { $$=$1; P($$, $2) };
1.20 paf 294:
1.149 parser 295: construct:
296: construct_square |
297: construct_round |
298: construct_curly
299: ;
300: construct_square: '[' any_constructor_code_value ']' {
301: // stack: context, name
302: $$=$2; // stack: context, name, value
1.81 paf 303: O($$, OP_CONSTRUCT_VALUE); /* value=pop; name=pop; context=pop; construct(context,name,value) */
304: }
305: ;
1.149 parser 306: construct_round: '(' expr_value ')' {
307: // stack: context, name
308: $$=$2; // stack: context, name, value
1.81 paf 309: O($$, OP_CONSTRUCT_EXPR); /* value=pop; name=pop; context=pop; construct(context,name,value) */
310: }
1.52 paf 311: ;
1.149 parser 312: construct_curly: '{' maybe_codes '}' {
313: // stack: context, name
314: $$=N(POOL);
315: CCA($$, $2); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */
316: };
317:
1.55 paf 318: any_constructor_code_value:
1.151 parser 319: empty_string_value /* optimized $var[] case */
1.52 paf 320: | STRING /* optimized $var[STRING] case */
1.55 paf 321: | constructor_code_value /* $var[something complex] */
1.1 paf 322: ;
1.55 paf 323: constructor_code_value: constructor_code {
1.25 paf 324: $$=N(POOL);
1.54 paf 325: O($$, OP_CREATE_EWPOOL); /* stack: empty write context */
1.69 paf 326: P($$, $1); /* some code that writes to that context */
1.54 paf 327: O($$, OP_REDUCE_EWPOOL); /* context=pop; stack: context.value() */
1.1 paf 328: };
1.55 paf 329: constructor_code: codes__excluding_sole_str_literal;
1.27 paf 330: codes__excluding_sole_str_literal: action | code codes { $$=$1; P($$, $2) };
331:
1.1 paf 332: /* call */
333:
1.66 paf 334: call: call_value {
335: $$=$1; /* stack: value */
1.102 paf 336: O($$, OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */
1.66 paf 337: };
1.154 ! parser 338: call_value: '^' { PC.object_constructor_allowed=true }
! 339: call_name { PC.object_constructor_allowed=false }
! 340: store_params EON { /* ^field.$method{vasya} */
! 341: $$=$3; /* with_xxx,diving code; stack: context,method_junction */
1.54 paf 342: O($$, OP_GET_METHOD_FRAME); /* stack: context,method_frame */
1.123 paf 343:
1.154 ! parser 344: YYSTYPE params_code=$5;
1.140 parser 345: if(params_code->size()==3) // probably [] case. [OP_VALUE + Void + STORE_PARAM]
1.123 paf 346: if(Value *value=LA2V(params_code)) // it is OP_VALUE + value?
1.140 parser 347: if(!value->is_defined()) // value is VVoid?
1.123 paf 348: params_code=0; // ^zzz[] case. don't append lone empty param.
349: if(params_code)
350: P($$, params_code); // filling method_frame.store_params
1.154 ! parser 351: O($$,
! 352: PC.object_constructing?(PC.object_constructing=false),OP_CALL_CONSTRUCTOR:
! 353: OP_CALL_METHOD); // method_frame=pop; ncontext=pop; call(ncontext,method_frame) stack: value
1.1 paf 354: };
355:
1.43 paf 356: call_name: name_without_curly_rdive;
1.38 paf 357:
1.9 paf 358: store_params: store_param | store_params store_param { $$=$1; P($$, $2) };
1.69 paf 359: store_param:
360: store_square_param
361: | store_round_param
362: | store_curly_param
1.31 paf 363: ;
1.123 paf 364: store_square_param: '[' store_code_param_parts ']' {$$=$2};
1.69 paf 365: store_round_param: '(' store_expr_param_parts ')' {$$=$2};
1.94 paf 366: store_curly_param: '{' store_curly_param_parts '}' {$$=$2};
1.69 paf 367: store_code_param_parts:
368: store_code_param_part
369: | store_code_param_parts ';' store_code_param_part { $$=$1; P($$, $3) }
370: ;
371: store_expr_param_parts:
372: store_expr_param_part
373: | store_expr_param_parts ';' store_expr_param_part { $$=$1; P($$, $3) }
374: ;
1.94 paf 375: store_curly_param_parts:
376: store_curly_param_part
377: | store_curly_param_parts ';' store_curly_param_part { $$=$1; P($$, $3) }
378: ;
1.120 paf 379: store_code_param_part: code_param_value {
1.32 paf 380: $$=$1;
1.54 paf 381: O($$, OP_STORE_PARAM);
1.120 paf 382: };
1.69 paf 383: store_expr_param_part: write_expr_value {
384: $$=N(POOL);
1.103 paf 385: PEA($$, $1);
1.69 paf 386: };
1.94 paf 387: store_curly_param_part: maybe_codes {
388: $$=N(POOL);
389: PCA($$, $1);
390: };
1.120 paf 391: code_param_value:
1.151 parser 392: empty_void_value /* optimized [;...] case */
1.120 paf 393: | STRING /* optimized [STRING] case */
394: | constructor_code_value /* [something complex] */
395: ;
1.90 paf 396: write_expr_value: expr_value {
1.69 paf 397: $$=$1;
1.102 paf 398: O($$, OP_WRITE_EXPR_RESULT);
1.69 paf 399: };
1.1 paf 400:
401: /* name */
402:
1.20 paf 403: name_expr_dive_code: name_expr_value | name_path name_expr_value { $$=$1; P($$, $2) };
1.1 paf 404:
1.9 paf 405: name_path: name_step | name_path name_step { $$=$1; P($$, $2) };
1.1 paf 406: name_step: name_advance1 '.';
407: name_advance1: name_expr_value {
408: /* stack: context */
409: $$=$1; /* stack: context,name */
1.54 paf 410: O($$, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.1 paf 411: };
412: name_advance2: name_expr_value {
413: /* stack: context */
414: $$=$1; /* stack: context,name */
1.54 paf 415: O($$, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.1 paf 416: }
1.4 paf 417: | STRING BOGUS
1.1 paf 418: ;
419: name_expr_value:
1.4 paf 420: STRING /* subname_is_const */
1.1 paf 421: | name_expr_subvar_value /* $subname_is_var_value */
422: | name_expr_with_subvar_value /* xxx$part_of_subname_is_var_value[$...] */
423: ;
424: name_expr_subvar_value: '$' subvar_ref_name_rdive {
425: $$=$2;
1.54 paf 426: O($$, OP_GET_ELEMENT);
1.1 paf 427: };
1.4 paf 428: name_expr_with_subvar_value: STRING subvar_get_writes {
1.25 paf 429: $$=N(POOL);
1.54 paf 430: O($$, OP_CREATE_EWPOOL);
1.9 paf 431: P($$, $1);
1.102 paf 432: O($$, OP_WRITE_VALUE);
1.9 paf 433: P($$, $2);
1.54 paf 434: O($$, OP_REDUCE_EWPOOL);
1.1 paf 435: };
1.154 ! parser 436: subvar_ref_name_rdive: STRING {
1.25 paf 437: $$=N(POOL);
1.54 paf 438: O($$, OP_WITH_READ);
1.9 paf 439: P($$, $1);
1.1 paf 440: };
1.9 paf 441: subvar_get_writes: subvar__get_write | subvar_get_writes subvar__get_write { $$=$1; P($$, $2) };
1.1 paf 442: subvar__get_write: '$' subvar_ref_name_rdive {
443: $$=$2;
1.54 paf 444: O($$, OP_GET_ELEMENT__WRITE);
1.42 paf 445: };
446:
1.154 ! parser 447: class_prefix_get: class_prefix {
1.72 paf 448: $$=$1; // stack: class name string
449: O($$, OP_GET_CLASS);
1.154 ! parser 450: };
! 451: class_prefix:
! 452: class_static_prefix
! 453: | class_constructor_prefix
! 454: ;
! 455: class_static_prefix: STRING ':';
! 456: class_constructor_prefix: STRING ':' ':' {
! 457: $$=$1;
! 458: if(!PC.object_constructor_allowed) {
! 459: strcpy(PC.error, ":: not allowed here");
! 460: YYERROR;
! 461: }
! 462: PC.object_constructing=true;
1.1 paf 463: };
464:
1.53 paf 465:
1.56 paf 466: /* expr */
1.53 paf 467:
1.81 paf 468: expr_value: expr {
469: if(($$=$1)->size()==2) // only one string literal in there?
1.62 paf 470: change_string_literal_to_double_literal($$); // make that string literal Double
471: };
1.56 paf 472: expr:
1.62 paf 473: STRING
1.64 paf 474: | get_value
1.66 paf 475: | call_value
1.64 paf 476: | '"' string_inside_quotes_value '"' { $$ = $2; }
1.145 parser 477: | '\'' string_inside_quotes_value '\'' { $$ = $2; }
1.60 paf 478: | '(' expr ')' { $$ = $2; }
479: /* stack: operand // stack: @operand */
480: | '-' expr %prec NEG { $$=$2; O($$, OP_NEG) }
1.68 paf 481: | '~' expr { $$=$2; O($$, OP_INV) }
482: | '!' expr { $$=$2; O($$, OP_NOT) }
483: | "def" expr { $$=$2; O($$, OP_DEF) }
484: | "in" expr { $$=$2; O($$, OP_IN) }
485: | "-f" expr { $$=$2; O($$, OP_FEXISTS) }
1.127 paf 486: | "-d" expr { $$=$2; O($$, OP_DEXISTS) }
1.60 paf 487: /* stack: a,b // stack: a@b */
488: | expr '-' expr { $$=$1; P($$, $3); O($$, OP_SUB) }
489: | expr '+' expr { $$=$1; P($$, $3); O($$, OP_ADD) }
490: | expr '*' expr { $$=$1; P($$, $3); O($$, OP_MUL) }
491: | expr '/' expr { $$=$1; P($$, $3); O($$, OP_DIV) }
492: | expr '%' expr { $$=$1; P($$, $3); O($$, OP_MOD) }
493: | expr '&' expr { $$=$1; P($$, $3); O($$, OP_BIN_AND) }
494: | expr '|' expr { $$=$1; P($$, $3); O($$, OP_BIN_OR) }
495: | expr '#' expr { $$=$1; P($$, $3); O($$, OP_BIN_XOR) }
496: | expr "&&" expr { $$=$1; P($$, $3); O($$, OP_LOG_AND) }
497: | expr "||" expr { $$=$1; P($$, $3); O($$, OP_LOG_OR) }
498: | expr "##" expr { $$=$1; P($$, $3); O($$, OP_LOG_XOR) }
499: | expr '<' expr { $$=$1; P($$, $3); O($$, OP_NUM_LT) }
500: | expr '>' expr { $$=$1; P($$, $3); O($$, OP_NUM_GT) }
501: | expr "<=" expr { $$=$1; P($$, $3); O($$, OP_NUM_LE) }
502: | expr ">=" expr { $$=$1; P($$, $3); O($$, OP_NUM_GE) }
503: | expr "==" expr { $$=$1; P($$, $3); O($$, OP_NUM_EQ) }
504: | expr "!=" expr { $$=$1; P($$, $3); O($$, OP_NUM_NE) }
1.61 paf 505: | expr "lt" expr { $$=$1; P($$, $3); O($$, OP_STR_LT) }
506: | expr "gt" expr { $$=$1; P($$, $3); O($$, OP_STR_GT) }
507: | expr "le" expr { $$=$1; P($$, $3); O($$, OP_STR_LE) }
508: | expr "ge" expr { $$=$1; P($$, $3); O($$, OP_STR_GE) }
509: | expr "eq" expr { $$=$1; P($$, $3); O($$, OP_STR_EQ) }
510: | expr "ne" expr { $$=$1; P($$, $3); O($$, OP_STR_NE) }
1.95 paf 511: | expr "is" expr { $$=$1; P($$, $3); O($$, OP_IS) }
1.56 paf 512: ;
1.55 paf 513:
1.65 paf 514: string_inside_quotes_value: maybe_codes {
1.64 paf 515: $$=N(POOL);
516: O($$, OP_CREATE_SWPOOL); /* stack: empty write context */
1.69 paf 517: P($$, $1); /* some code that writes to that context */
1.64 paf 518: O($$, OP_REDUCE_SWPOOL); /* context=pop; stack: context.get_string() */
1.53 paf 519: };
1.1 paf 520:
1.27 paf 521: /* basics */
1.1 paf 522:
1.81 paf 523: write_string: STRING {
1.102 paf 524: // optimized from OP_STRING+OP_WRITE_VALUE to OP_STRING__WRITE
1.84 paf 525: change_string_literal_to_write_string_literal($$=$1)
1.54 paf 526: };
527:
1.151 parser 528: empty_void_value: /* empty */ { $$=VL(NEW VVoid(POOL)) };
529: empty_string_value: /* empty */ { $$=VL(NEW VString(POOL)) };
1.25 paf 530: empty: /* empty */ { $$=N(POOL) };
1.1 paf 531:
532: %%
1.105 paf 533: #endif
1.1 paf 534:
535: /*
536: 000$111(2222)00
537: 000$111{3333}00
1.9 paf 538: $,^: push,=0
1.1 paf 539: 1:( { break=pop
540: 2:( ) pop
541: 3:{ } pop
542:
543: 000^111(2222)4444{33333}4000
1.9 paf 544: $,^: push,=0
1.1 paf 545: 1:( { break=pop
546: 2:( )=4
547: 3:{ }=4
548: 4:[^({]=pop
549: */
550:
1.110 paf 551: static int yylex(YYSTYPE *lvalp, void *pc) {
1.114 paf 552: #define lexical_brackets_nestage PC.brackets_nestages[PC.sp]
1.48 paf 553: #define RC {result=c; goto break2; }
1.1 paf 554:
555: register int c;
556: int result;
557:
1.114 paf 558: if(PC.pending_state) {
559: result=PC.pending_state;
560: PC.pending_state=0;
1.1 paf 561: return result;
562: }
563:
1.114 paf 564: const char *begin=PC.source;
1.91 paf 565: const char *end;
1.114 paf 566: int begin_line=PC.line;
1.67 paf 567: int skip_analized=0;
1.50 paf 568: while(true) {
1.114 paf 569: c=*(end=(PC.source++));
1.1 paf 570:
1.4 paf 571: if(c=='\n') {
1.114 paf 572: PC.line++;
573: PC.col=0;
1.10 paf 574: } else
1.114 paf 575: PC.col++;
1.73 paf 576:
1.119 paf 577: if(c=='^' && PC.ls!=LS_COMMENT && PC.ls!=LS_DEF_COMMENT)
1.114 paf 578: switch(*PC.source) {
1.126 paf 579: // escaping: ^^ & co
1.48 paf 580: case '^': case '$': case ';':
1.126 paf 581: case '(': case ')':
1.48 paf 582: case '[': case ']':
583: case '{': case '}':
1.114 paf 584: case '"':
1.40 paf 585: if(end!=begin) {
586: // append piece till ^
1.121 paf 587: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1.40 paf 588: }
1.63 paf 589: // reset piece 'begin' position & line
1.114 paf 590: begin=PC.source; // ^
591: begin_line=PC.line;
1.40 paf 592: // skip over ^ and _
1.114 paf 593: PC.source++; PC.col++;
1.40 paf 594: // skip analysis = forced literal
1.1 paf 595: continue;
1.114 paf 596:
597: // converting ^#HH into char(hex(HH))
598: case '#':
599: if(end!=begin) {
600: // append piece till ^
1.121 paf 601: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1.114 paf 602: }
603: // #HH ?
604: if(PC.source[0]=='#' && PC.source[1] && PC.source[2]) {
605: char *hex=(char *)POOL.malloc(1);
606: hex[0]=
607: hex_value[(unsigned char)PC.source[1]]*0x10+
608: hex_value[(unsigned char)PC.source[2]];
609: if(hex[0]==0) {
610: result=BAD_HEX_LITERAL;
611: goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
612: }
613: // append char(hex(HH))
1.121 paf 614: PC.string->APPEND_CLEAN(hex, 1, PC.file, begin_line);
1.114 paf 615: // skip over ^#HH
616: PC.source+=3;
617: PC.col+=3;
618: // reset piece 'begin' position & line
619: begin=PC.source; // ^
620: begin_line=PC.line;
621: continue;
622: }
623: break;
1.1 paf 624: }
1.113 paf 625: // #comment start skipping
1.114 paf 626: if(c=='#' && PC.col==1) {
1.112 paf 627: if(end!=begin) {
628: // append piece till #
1.121 paf 629: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1.112 paf 630: }
631: // fall into COMMENT lexical state [wait for \n]
632: push_LS(PC, LS_COMMENT);
633: }
1.114 paf 634: switch(PC.ls) {
1.10 paf 635:
636: // USER'S = NOT OURS
1.1 paf 637: case LS_USER:
1.153 parser 638: if(PC.trim_bof)
639: switch(c) {
640: case '\n': case ' ': case '\t':
1.152 parser 641: begin=PC.source;
642: begin_line=PC.line;
643: continue; // skip it
1.153 parser 644: default:
645: PC.trim_bof=false;
1.152 parser 646: }
1.48 paf 647: switch(c) {
648: case '$':
1.10 paf 649: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 650: RC;
651: case '^':
652: push_LS(PC, LS_METHOD_NAME);
653: RC;
654: case '@':
1.114 paf 655: if(PC.col==0+1) {
1.48 paf 656: push_LS(PC, LS_DEF_NAME);
657: RC;
658: }
659: break;
1.112 paf 660: }
661: break;
662:
663: // #COMMENT
664: case LS_COMMENT:
665: if(c=='\n') {
666: // skip comment
1.114 paf 667: begin=PC.source;
668: begin_line=PC.line;
1.112 paf 669:
670: pop_LS(PC);
671: continue;
1.1 paf 672: }
1.48 paf 673: break;
674:
675: // STRING IN EXPRESSION
1.145 parser 676: case LS_EXPRESSION_STRING_QUOTED:
677: case LS_EXPRESSION_STRING_APOSTROFED:
1.48 paf 678: switch(c) {
679: case '"':
1.145 parser 680: case '\'':
681: if(
682: PC.ls == LS_EXPRESSION_STRING_QUOTED && c=='"' ||
683: PC.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') {
684: pop_LS(PC); //"abc". | 'abc'.
685: RC;
686: }
687: break;
1.48 paf 688: case '$':
689: push_LS(PC, LS_VAR_NAME_SIMPLE);
690: RC;
691: case '^':
1.10 paf 692: push_LS(PC, LS_METHOD_NAME);
1.48 paf 693: RC;
1.10 paf 694: }
695: break;
696:
697: // METHOD DEFINITION
698: case LS_DEF_NAME:
1.48 paf 699: switch(c) {
700: case '[':
1.114 paf 701: PC.ls=LS_DEF_PARAMS;
1.48 paf 702: RC;
703: case '\n':
1.114 paf 704: PC.ls=LS_DEF_SPECIAL_BODY;
1.48 paf 705: RC;
1.10 paf 706: }
707: break;
1.48 paf 708:
1.10 paf 709: case LS_DEF_PARAMS:
1.48 paf 710: switch(c) {
711: case ';':
712: RC;
713: case ']':
1.114 paf 714: PC.ls=*PC.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1.48 paf 715: RC;
1.49 paf 716: case '\n': // wrong. bailing out
1.10 paf 717: pop_LS(PC);
1.48 paf 718: RC;
1.10 paf 719: }
720: break;
1.48 paf 721:
1.10 paf 722: case LS_DEF_LOCALS:
1.48 paf 723: switch(c) {
724: case '[':
725: case ';':
726: RC;
727: case ']':
1.114 paf 728: PC.ls=LS_DEF_COMMENT;
1.48 paf 729: RC;
730: case '\n': // wrong. bailing out
1.10 paf 731: pop_LS(PC);
1.48 paf 732: RC;
1.10 paf 733: }
734: break;
1.48 paf 735:
1.10 paf 736: case LS_DEF_COMMENT:
737: if(c=='\n') {
738: pop_LS(PC);
1.48 paf 739: RC;
1.37 paf 740: }
741: break;
742:
1.48 paf 743: case LS_DEF_SPECIAL_BODY:
1.147 parser 744: // @todo in case
745: // ################
746: // @next-method
747: // we are here with c=='@'
748: // which is wrong, and need action
1.37 paf 749: if(c=='\n') {
1.114 paf 750: switch(*PC.source) {
1.48 paf 751: case '@': case 0: // end of special_code
1.37 paf 752: pop_LS(PC);
1.48 paf 753: break;
754: }
755: RC;
756: }
757: break;
758:
759: // (EXPRESSION)
1.69 paf 760: case LS_VAR_ROUND:
761: case LS_METHOD_ROUND:
1.48 paf 762: switch(c) {
763: case ')':
764: if(--lexical_brackets_nestage==0)
1.114 paf 765: if(PC.ls==LS_METHOD_ROUND) // method round param ended
766: PC.ls=LS_METHOD_AFTER; // look for method end
767: else // PC.ls==LS_VAR_ROUND // variable constructor ended
1.69 paf 768: pop_LS(PC); // return to normal life
1.48 paf 769: RC;
770: case '$':
1.69 paf 771: push_LS(PC, LS_EXPRESSION_VAR_NAME);
1.48 paf 772: RC;
773: case '^':
774: push_LS(PC, LS_METHOD_NAME);
775: RC;
776: case '(':
777: lexical_brackets_nestage++;
778: RC;
1.67 paf 779: case '-':
1.127 paf 780: switch(*PC.source) {
781: case 'f': // -f
1.67 paf 782: skip_analized=1;
783: result=FEXISTS;
1.127 paf 784: goto break2;
785: case 'd': // -d
786: skip_analized=1;
787: result=DEXISTS;
788: goto break2;
789: default:
1.67 paf 790: result=c;
1.127 paf 791: goto break2;
792: }
1.67 paf 793: goto break2;
794: case '+': case '*': case '/': case '%':
1.58 paf 795: case '~':
1.48 paf 796: case ';':
797: RC;
1.59 paf 798: case '&': case '|': case '#':
1.114 paf 799: if(*PC.source==c) { // && ||
1.59 paf 800: result=c=='#'?LXOR:c=='&'?LAND:LOR;
1.67 paf 801: skip_analized=1;
1.58 paf 802: } else
803: result=c;
804: goto break2;
805: case '<': case '>': case '=': case '!':
1.114 paf 806: if(*PC.source=='=') { // <= >= == !=
1.67 paf 807: skip_analized=1;
1.58 paf 808: switch(c) {
809: case '<': result=NLE; break;
810: case '>': result=NGE; break;
811: case '=': result=NEQ; break;
812: case '!': result=NNE; break;
813: }
814: } else
815: result=c;
816: goto break2;
1.48 paf 817: case '"':
1.145 parser 818: push_LS(PC, LS_EXPRESSION_STRING_QUOTED);
819: RC;
820: case '\'':
821: push_LS(PC, LS_EXPRESSION_STRING_APOSTROFED);
1.48 paf 822: RC;
1.50 paf 823: case 'l': case 'g': case 'e': case 'n':
1.51 paf 824: if(end==begin) // right after whitespace
1.117 paf 825: if(isspace(PC.source[1])) {
826: switch(*PC.source) {
827: // case '?': // ok [and bad cases, yacc would bark at them]
828: case 't': // lt gt [et nt]
829: result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
830: skip_analized=1;
831: goto break2;
832: case 'e': // le ge ne [ee]
833: result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
834: skip_analized=1;
835: goto break2;
836: case 'q': // eq [lq gq nq]
837: result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
838: skip_analized=1;
839: goto break2;
840: }
1.67 paf 841: }
842: break;
843: case 'i':
844: if(end==begin) // right after whitespace
1.117 paf 845: if(isspace(PC.source[1])) {
846: switch(PC.source[0]) {
847: case 'n': // in
1.95 paf 848: skip_analized=1;
849: result=IN;
850: goto break2;
1.117 paf 851: case 's': // is
1.95 paf 852: skip_analized=1;
853: result=IS;
854: goto break2;
855: }
1.67 paf 856: }
857: break;
858: case 'd':
859: if(end==begin) // right after whitespace
1.114 paf 860: if(PC.source[0]=='e' && PC.source[1]=='f') { // def
1.67 paf 861: skip_analized=2;
862: result=DEF;
1.58 paf 863: goto break2;
1.50 paf 864: }
1.48 paf 865: break;
866: case ' ': case '\t': case '\n':
1.63 paf 867: if(end!=begin) { // there were a string after previous operator?
868: result=0; // return that string
869: goto break2;
1.48 paf 870: }
1.63 paf 871: // that's a leading|traling space or after-operator-space
872: // ignoring it
873: // reset piece 'begin' position & line
1.114 paf 874: begin=PC.source; // after whitespace char
875: begin_line=PC.line;
1.48 paf 876: continue;
1.1 paf 877: }
878: break;
879:
1.10 paf 880: // VARIABLE GET/PUT/WITH
1.1 paf 881: case LS_VAR_NAME_SIMPLE:
1.69 paf 882: case LS_EXPRESSION_VAR_NAME:
1.142 parser 883: case LS_VAR_NAME_NO_COLON:
1.114 paf 884: if(PC.ls==LS_EXPRESSION_VAR_NAME) {
1.56 paf 885: // name in expr ends also before binary operators
1.48 paf 886: switch(c) {
1.92 paf 887: case '-':
1.48 paf 888: pop_LS(PC);
1.114 paf 889: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
1.48 paf 890: result=EON;
891: goto break2;
892: }
893: }
1.142 parser 894: if(PC.ls==LS_VAR_NAME_NO_COLON) {
895: // name already has ':', stop before next
896: switch(c) {
897: case ':':
898: pop_LS(PC);
899: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
900: result=EON;
901: goto break2;
902: }
903: }
1.48 paf 904: switch(c) {
905: case 0:
906: case ' ': case '\t': case '\n':
907: case ';':
1.126 paf 908: case ']': case '}': case ')':
909: case '"': case '\'':
1.139 parser 910: case '<': case '>': // these stand for HTML brackets AND expression binary ops
1.92 paf 911: case '+': case '*': case '/': case '%':
912: case '&': case '|':
913: case '=': case '!':
1.99 paf 914: // common delimiters
1.126 paf 915: case ',':
1.139 parser 916: // before call
917: case '^':
1.1 paf 918: pop_LS(PC);
1.114 paf 919: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
1.13 paf 920: result=EON;
1.1 paf 921: goto break2;
1.48 paf 922: case '[':
1.114 paf 923: PC.ls=LS_VAR_SQUARE;
1.1 paf 924: lexical_brackets_nestage=1;
1.48 paf 925: RC;
926: case '{':
927: if(begin==end) { // ${name}, no need of EON, switching LS
1.114 paf 928: PC.ls=LS_VAR_NAME_CURLY;
1.48 paf 929: } else {
1.114 paf 930: PC.ls=LS_VAR_CURLY;
1.48 paf 931: lexical_brackets_nestage=1;
932: }
1.69 paf 933:
1.48 paf 934: RC;
935: case '(':
1.114 paf 936: PC.ls=LS_VAR_ROUND;
1.1 paf 937: lexical_brackets_nestage=1;
1.48 paf 938: RC;
939: case '.': // name part delim
940: case '$': // name part subvar
941: case ':': // ':name' or 'class:name'
1.142 parser 942: PC.ls=LS_VAR_NAME_NO_COLON; // stop before next ':'
1.48 paf 943: RC;
1.1 paf 944: }
945: break;
1.48 paf 946:
1.1 paf 947: case LS_VAR_NAME_CURLY:
1.48 paf 948: switch(c) {
949: case '}': // ${name} finished, restoring LS
1.1 paf 950: pop_LS(PC);
1.48 paf 951: RC;
952: case '.': // name part delim
953: case '$': // name part subvar
954: case ':': // ':name' or 'class:name'
955: RC;
1.1 paf 956: }
957: break;
1.48 paf 958:
959: case LS_VAR_SQUARE:
960: switch(c) {
961: case '$':
1.10 paf 962: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 963: RC;
964: case '^':
1.10 paf 965: push_LS(PC, LS_METHOD_NAME);
1.48 paf 966: RC;
967: case ']':
1.1 paf 968: if(--lexical_brackets_nestage==0) {
969: pop_LS(PC);
1.48 paf 970: RC;
1.1 paf 971: }
1.48 paf 972: break;
973: case ';': // operator_or_fmt;value delim
974: RC;
975: case '[':
976: lexical_brackets_nestage++;
977: break;
1.1 paf 978: }
979: break;
1.48 paf 980:
1.1 paf 981: case LS_VAR_CURLY:
1.48 paf 982: switch(c) {
983: case '$':
1.10 paf 984: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 985: RC;
986: case '^':
1.10 paf 987: push_LS(PC, LS_METHOD_NAME);
1.48 paf 988: RC;
989: case '}':
1.1 paf 990: if(--lexical_brackets_nestage==0) {
991: pop_LS(PC);
1.48 paf 992: RC;
1.1 paf 993: }
1.48 paf 994: break;
995: case '{':
1.1 paf 996: lexical_brackets_nestage++;
1.48 paf 997: break;
998: }
1.1 paf 999: break;
1000:
1.10 paf 1001: // METHOD CALL
1.1 paf 1002: case LS_METHOD_NAME:
1.48 paf 1003: switch(c) {
1004: case '[':
1.114 paf 1005: PC.ls=LS_METHOD_SQUARE;
1.1 paf 1006: lexical_brackets_nestage=1;
1.48 paf 1007: RC;
1008: case '{':
1.114 paf 1009: PC.ls=LS_METHOD_CURLY;
1.1 paf 1010: lexical_brackets_nestage=1;
1.48 paf 1011: RC;
1.69 paf 1012: case '(':
1.114 paf 1013: PC.ls=LS_METHOD_ROUND;
1.69 paf 1014: lexical_brackets_nestage=1;
1015: RC;
1.48 paf 1016: case '.': // name part delim
1017: case '$': // name part subvar
1018: case ':': // ':name' or 'class:name'
1019: RC;
1.1 paf 1020: }
1021: break;
1.48 paf 1022:
1023: case LS_METHOD_SQUARE:
1024: switch(c) {
1025: case '$':
1.10 paf 1026: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 1027: RC;
1028: case '^':
1.10 paf 1029: push_LS(PC, LS_METHOD_NAME);
1.48 paf 1030: RC;
1031: case ';': // param delim
1032: RC;
1033: case ']':
1.1 paf 1034: if(--lexical_brackets_nestage==0) {
1.114 paf 1035: PC.ls=LS_METHOD_AFTER;
1.48 paf 1036: RC;
1.1 paf 1037: }
1.48 paf 1038: break;
1039: case '[':
1.1 paf 1040: lexical_brackets_nestage++;
1.48 paf 1041: break;
1042: }
1.1 paf 1043: break;
1.48 paf 1044:
1.1 paf 1045: case LS_METHOD_CURLY:
1.48 paf 1046: switch(c) {
1047: case '$':
1.10 paf 1048: push_LS(PC, LS_VAR_NAME_SIMPLE);
1.48 paf 1049: RC;
1050: case '^':
1.10 paf 1051: push_LS(PC, LS_METHOD_NAME);
1.94 paf 1052: RC;
1053: case ';': // param delim
1.48 paf 1054: RC;
1055: case '}':
1.1 paf 1056: if(--lexical_brackets_nestage==0) {
1.114 paf 1057: PC.ls=LS_METHOD_AFTER;
1.48 paf 1058: RC;
1.1 paf 1059: }
1.48 paf 1060: break;
1061: case '{':
1.1 paf 1062: lexical_brackets_nestage++;
1.48 paf 1063: break;
1064: }
1.1 paf 1065: break;
1.48 paf 1066:
1.1 paf 1067: case LS_METHOD_AFTER:
1.69 paf 1068: if(c=='[') {/* ][ }[ )[ */
1.114 paf 1069: PC.ls=LS_METHOD_SQUARE;
1.1 paf 1070: lexical_brackets_nestage=1;
1.48 paf 1071: RC;
1.1 paf 1072: }
1.69 paf 1073: if(c=='{') {/* ]{ }{ ){ */
1.114 paf 1074: PC.ls=LS_METHOD_CURLY;
1.69 paf 1075: lexical_brackets_nestage=1;
1076: RC;
1077: }
1078: if(c=='(') {/* ]( }( )( */
1.114 paf 1079: PC.ls=LS_METHOD_ROUND;
1.1 paf 1080: lexical_brackets_nestage=1;
1.48 paf 1081: RC;
1.1 paf 1082: }
1083: pop_LS(PC);
1.114 paf 1084: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
1.13 paf 1085: result=EON;
1.1 paf 1086: goto break2;
1087: }
1.9 paf 1088: if(c==0) {
1.1 paf 1089: result=-1;
1090: break;
1091: }
1092: }
1093:
1094: break2:
1.59 paf 1095: if(end!=begin) { // there is last piece?
1096: if((c=='@' || c==0) && end[-1]=='\n') { // we are before LS_DEF_NAME or EOF?
1097: // strip last \n
1.10 paf 1098: end--;
1.137 parser 1099: if(end!=begin && end[-1]=='\n') // allow one empty line before LS_DEF_NAME
1100: end--;
1.59 paf 1101: }
1.133 parser 1102: if(end!=begin && PC.ls!=LS_COMMENT) { // last piece still alive and not comment?
1.59 paf 1103: // append it
1.121 paf 1104: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line/*, start_col*/);
1.30 paf 1105: }
1.59 paf 1106: }
1.114 paf 1107: if(PC.string->size()) { // something accumulated?
1.17 paf 1108: // create STRING value: array of OP_VALUE+vstring
1.114 paf 1109: *lvalp=VL(NEW VString(*PC.string));
1.10 paf 1110: // new pieces storage
1.114 paf 1111: PC.string=NEW String(POOL);
1.58 paf 1112: // make current result be pending for next call, return STRING for now
1.114 paf 1113: PC.pending_state=result; result=STRING;
1.58 paf 1114: }
1.67 paf 1115: if(skip_analized) {
1.114 paf 1116: PC.source+=skip_analized; PC.col+=skip_analized;
1.1 paf 1117: }
1.58 paf 1118: return result;
1.1 paf 1119: }
1120:
1.110 paf 1121: static int real_yyerror(parse_control *pc, char *s) { // Called by yyparse on error
1.114 paf 1122: strncpy(PC.error, s, MAX_STRING);
1.1 paf 1123: return 1;
1.110 paf 1124: }
1.1 paf 1125:
1.110 paf 1126: static void yyprint(FILE *file, int type, YYSTYPE value) {
1127: if(type==STRING)
1.120 paf 1128: fprintf(file, " \"%s\"", LA2S(value)->cstr());
1.110 paf 1129: }
E-mail: