|
|
| version 1.102, 2001/03/16 09:26:43 | version 1.107, 2001/03/21 14:06:45 |
|---|---|
| Line 1 | Line 1 |
| /* | /** @file |
| Parser | Parser: compiler(lexical parser and grammar). |
| Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) | Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) |
| $Id$ | $Id$ |
| */ | */ |
| /* | /** |
| TODO.parser4: | @todo parser4: |
| cache compiled code from request to request. to do that... | - cache compiled code from request to request. to do that... |
| 1: make method definitions, @CLASS, @BASE, @USE instructions, | -#: make method definitions, @CLASS, @BASE, @USE instructions, |
| which would be executed afterwards, and actions | which would be executed afterwards, and actions |
| now performed at compile time would be delayed to run time. | now performed at compile time would be delayed to run time. |
| 2: make cache expiration on time and on disk-change of class source | -#: make cache expiration on time and on disk-change of class source |
| 3: in apache use subpools for compiled class storage | -#: in apache use subpools for compiled class storage |
| 4: in iis make up specialized Pool object for that | -#: in iis make up specialized Pool object for that |
| */ | */ |
| %{ | %{ |
| Line 22 | Line 24 |
| #define YYPARSE_PARAM pc | #define YYPARSE_PARAM pc |
| #define YYLEX_PARAM pc | #define YYLEX_PARAM pc |
| #define YYDEBUG 1 | #define YYDEBUG 1 |
| #define YYERROR_VERBOSE | #define YYERROR_VERBOSE 1 |
| #define yyerror(msg) real_yyerror((parse_control *)pc, msg) | #define yyerror(msg) real_yyerror((parse_control *)pc, msg) |
| #define YYPRINT(file, type, value) yyprint(file, type, value) | #define YYPRINT(file, type, value) yyprint(file, type, value) |
| Line 50 int yylex(YYSTYPE *lvalp, void *pc); | Line 52 int yylex(YYSTYPE *lvalp, void *pc); |
| #define POOL *PC->pool | #define POOL *PC->pool |
| #undef NEW | #undef NEW |
| #define NEW new(POOL) | #define NEW new(POOL) |
| #ifndef DOXYGEN | |
| %} | %} |
| %pure_parser | %pure_parser |
| Line 130 control_method: '@' STRING '\n' | Line 133 control_method: '@' STRING '\n' |
| YYERROR; | YYERROR; |
| } | } |
| if(command==CLASS_NAME) { | if(command==CLASS_NAME) { |
| if(PC->cclass!=&PC->request->root_class) { // already changed from default? | if(PC->cclass!=&PC->request->ROOT) { // already changed from default? |
| strcpy(PC->error, "class already have a name '"); | strcpy(PC->error, "class already have a name '"); |
| strncat(PC->error, PC->cclass->name().cstr(), 100); | strncat(PC->error, PC->cclass->name().cstr(), 100); |
| strcat(PC->error, "'"); | strcat(PC->error, "'"); |
| Line 143 control_method: '@' STRING '\n' | Line 146 control_method: '@' STRING '\n' |
| PC->cclass=NEW VClass(POOL); | PC->cclass=NEW VClass(POOL); |
| PC->cclass->set_name(*name); | PC->cclass->set_name(*name); |
| // defaulting base. may change with @BASE | // defaulting base. may change with @BASE |
| PC->cclass->set_base(PC->request->root_class); | PC->cclass->set_base(PC->request->ROOT); |
| // append to request's classes | // append to request's classes |
| PC->request->classes().put(*name, PC->cclass); | PC->request->classes().put(*name, PC->cclass); |
| } else { | } else { |
| Line 158 control_method: '@' STRING '\n' | Line 161 control_method: '@' STRING '\n' |
| PC->request->use_file(file.cstr()); | PC->request->use_file(file.cstr()); |
| } | } |
| } else if(command==BASE_NAME) { | } else if(command==BASE_NAME) { |
| if(PC->cclass->base()!=&PC->request->root_class) { // already changed from default? | if(PC->cclass->base()!=&PC->request->ROOT) { // already changed from default? |
| strcpy(PC->error, "class already have a base '"); | strcpy(PC->error, "class already have a base '"); |
| strncat(PC->error, PC->cclass->base()->name().cstr(), 100); | strncat(PC->error, PC->cclass->base()->name().cstr(), 100); |
| strcat(PC->error, "'"); | strcat(PC->error, "'"); |
| Line 377 store_code_param_part: | Line 380 store_code_param_part: |
| ; | ; |
| store_expr_param_part: write_expr_value { | store_expr_param_part: write_expr_value { |
| $$=N(POOL); | $$=N(POOL); |
| PCA($$, $1); | PEA($$, $1); |
| }; | }; |
| store_curly_param_part: maybe_codes { | store_curly_param_part: maybe_codes { |
| $$=N(POOL); | $$=N(POOL); |
| Line 520 empty_string_value: /* empty */ { $$=VL( | Line 523 empty_string_value: /* empty */ { $$=VL( |
| empty: /* empty */ { $$=N(POOL) }; | empty: /* empty */ { $$=N(POOL) }; |
| %% | %% |
| #endif | |
| /* | /* |
| 000$111(2222)00 | 000$111(2222)00 |