Annotation of parser3/src/main/compile_tools.C, revision 1.4

1.1       paf         1: /*
1.4     ! paf         2:   $Id: compile_tools.C,v 1.3 2001/02/21 06:21:19 paf Exp $
1.1       paf         3: */
                      4: 
                      5: #include "compile_tools.h"
                      6: #include "pa_string.h"
                      7: #include "pa_array.h"
                      8: #include "pa_exception.h"
                      9: 
1.3       paf        10: Array *L(String *string) {
1.1       paf        11:        // empty ops array
1.4     ! paf        12:        Array *result=N(string->pool());
1.1       paf        13: 
                     14:        // append OP_STRING
1.3       paf        15:        Operation op; op.code=OP_STRING;
                     16:        *result+=reinterpret_cast<Array::Item *>(op.cast);
1.1       paf        17: 
                     18:        // append 'string'
1.3       paf        19:        *result+=string;
1.1       paf        20: 
                     21:        return result;
                     22: }
                     23: 
1.3       paf        24: const String *LA2S(Array *literal_string_array) {
                     25:        return static_cast<const String *>(literal_string_array->get(1));
1.1       paf        26: }
                     27: 
                     28: 
                     29: void push_LS(struct parse_control *pc) {
                     30:        if(pc->sp<MAX_LEXICAL_STATES) {
                     31:                pc->stack[pc->sp++]=pc->ls;  pc->ls=LS_VAR_NAME_SIMPLE;
                     32:        } else
                     33:                (static_cast<Pool *>(pc->pool))->exception().raise(0, 0, 0, 
                     34:                        "push_LS: stack overflow");
                     35: }
                     36: void pop_LS(struct parse_control *pc) {
                     37:        if(--pc->sp>=0)
                     38:                pc->ls=pc->stack[pc->sp];
                     39:        else
                     40:                (static_cast<Pool *>(pc->pool))->exception().raise(0, 0, 0, 
                     41:                        "push_LS: stack underflow");
                     42: }

E-mail: