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

1.1       paf         1: /*
1.4     ! paf         2:   $Id: pa_wcontext.C,v 1.3 2001/02/25 13:23:02 paf Exp $
1.1       paf         3: */
                      4: 
                      5: #include "pa_wcontext.h"
                      6: #include "pa_exception.h"
                      7: 
1.4     ! paf         8: // appends a fstring to result
1.1       paf         9: void WContext::write(String *astring) {
                     10:        if(!astring)
                     11:                return;
                     12:        
1.4     ! paf        13:        fstring+=*astring;
1.1       paf        14: }
                     15: 
1.4     ! paf        16: // if value is VString writes fstring,
1.1       paf        17: // else writes Value; raises an error if already
                     18: void WContext::write(Value *avalue) {
                     19:        if(!avalue)
                     20:                return;
                     21:        
1.4     ! paf        22:        String *fstring=avalue->get_string();
        !            23:        if(fstring)
        !            24:                write(fstring);
1.1       paf        25:        else
                     26:                if(fvalue) // already have value?
1.2       paf        27:                        THROW(0,0,  // must not construct twice
1.3       paf        28:                        &fvalue->name(),
1.1       paf        29:                        "value already assigned, use constructor to reassign it");
                     30:                else
                     31:                        fvalue=avalue;
                     32: }
                     33: 

E-mail: