Changeset 219 for trunk/src


Ignore:
Timestamp:
Nov 14, 2008, 3:04:09 PM (10 years ago)
Author:
cameron
Message:

Content model notes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/contentmodel.h

    r108 r219  
    1616
    1717typedef hash_map<int, int> symbol_set_t;
     18
     19/* 
     20  Content Models describe the expected structure of content between
     21  the start and end tags of an XML element.   The following data
     22  declarations represent content model information derived from
     23  the XML DTD.   Content models from XML Schemas or other specifications
     24  are not described here.
     25
     26  The content models are declared using !ELEMENT declarations.
     27  http://www.w3.org/TR/xml/#NT-elementdecl
     28  [45] elementdecl ::= '<!ELEMENT' S  Name  S  contentspec  S? '>'
     29  [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children
     30
     31*/
    1832
    1933enum ContentModel_t {
     
    4155};
    4256
     57/*
     58  Class Content_RE is used for content models described using regular
     59  expressions in the DTD.
     60
     61  [47] children ::=  (choice | seq) ('?' | '*' | '+')?
     62  [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
     63  [49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'
     64  [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'
     65
     66*/
     67
    4368class Content_RE{
    4469public:
     
    4671        symbol_set_t first_map;
    4772        symbol_set_t follow_map;
     73        /* Set_IDs recursively sets sequential numeric identifiers for each Name in a content model. */
    4874        virtual int Set_IDs(int base_ID) = 0;
     75        /* Build the map of the symbols that may occur first for this content_RE. */
    4976        virtual void Set_First_Map() = 0;
     77        /* Build the map of the symbols that may follow this content_RE. */
    5078        virtual void Set_Follow_Map(symbol_set_t * transition_map) = 0;
    5179};
    5280
     81/* Models constructed according to the [50] seq production. 
     82   subCMs are the models for each cp in '(' S? cp ( S? ',' S? cp )* S? ')' */
    5383class CRE_Seq : public Content_RE {
    5484public:
     
    6191};
    6292
     93/* Models constructed according to the [49] choice production.
     94   subCMs are the models for each cp in '(' S? cp ( S? '|' S? cp )+ S? ')' */
    6395class CRE_Choice : public Content_RE {
    6496public:
     
    71103};
    72104
     105/* Models constructed when '*' (Star), '+' (Plus) or '?' (Opt) is used.
     106   subCM is the model for the Name, choice or seq in
     107   (Name | choice | seq) ('?' | '*' | '+')   */
    73108class CRE_Star : public Content_RE {
    74109public:
Note: See TracChangeset for help on using the changeset viewer.