Changeset 135 for trunk/src/engine.c


Ignore:
Timestamp:
May 6, 2008, 11:53:48 AM (11 years ago)
Author:
lindanl
Message:

SymbolTable? class and end tag checking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/engine.c

    r134 r135  
    637637       
    638638        int name_start = AbsPos();
    639        
    640         int endNameID = Parse_Name();  /* Name delimiter: WS, "/" or ">" */
    641         if (nameID != endNameID)
     639        ScanTo(NameFollow);
     640        int lgth = AbsPos()-name_start;
     641        char * end_elem_name = (char *)GetCodeUnitPtr(name_start);
     642        char * start_elem_name = model_info->symbol_table->Get_UTF8_name(nameID);
     643       
     644        for(int i=0; i<lgth; i++) {
     645                if (start_elem_name[i] != end_elem_name[i])
    642646                        WF_Error(wfErr_GIMatch);
    643                        
     647        }
     648        if (start_elem_name[lgth] != '\0') WF_Error(wfErr_GIMatch);
    644649        if (AtChar<C,'>'>(cur())) {
    645650                Advance(1);
     
    18401845        Advance(2); /* Skip "</". */
    18411846       
     1847       
    18421848        int nameID = Parse_Name(); 
    18431849        int elemID = model_info->GlobalElementTable[nameID];
     
    21712177        ScanTo(NameFollow);
    21722178        int lgth = AbsPos()-name_pos;
    2173         char * s = copy_string(GetCodeUnitPtr(name_pos),lgth);
    2174         int nameID = model_info->GlobalNameTable[s];
    2175         if(nameID == 0){
    2176                 if (entity_Info->version == XML_1_1){
    2177                         if (!is_XML11_UTF8_Name(GetCodeUnitPtr(name_pos),lgth)) Syntax_Error(NT_Name);
    2178                 }
    2179                 else if (!is_XML10_UTF8_Name(GetCodeUnitPtr(name_pos),lgth)) Syntax_Error(NT_Name);
    2180                 model_info->GlobalNameTable[s]=++(model_info->globalNameCount);
    2181                 nameID = model_info->globalNameCount;
    2182         }
    2183         return nameID;
     2179        if (entity_Info->version == XML_1_1){
     2180                return model_info->symbol_table->UTF8_Lookup_or_Insert_XML11_Name((char *)GetCodeUnitPtr(name_pos),lgth);
     2181        }
     2182        else
     2183                return model_info->symbol_table->UTF8_Lookup_or_Insert_XML10_Name((char *)GetCodeUnitPtr(name_pos),lgth);
    21842184}
    21852185
Note: See TracChangeset for help on using the changeset viewer.