Ignore:
Timestamp:
Dec 19, 2010, 6:26:34 AM (8 years ago)
Author:
cameron
Message:

Unify line/column reporting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/parabix2.py

    r681 r844  
    2626
    2727import sys
     28
     29
     30#
     31#
     32#  Prolog/DTD Processing
     33
     34#  Comments, PIs, DTD
     35#
     36#  REX Shallow Parsing
     37#    * DocTypeSPE = '<!DOCTYPE' DocTypeCE?
     38#    * DocTypeCE = DT_IdentSE S? ('[' DT_ItemSE* ']' S?)? '>'?
     39#    * QuoteSE = '"' [^"]* '"' | "'" [^']* "'"
     40#    * DT_IdentSE = S Name (S (Name | QuoteSE))*
     41#    * DocTypeItem ::= MarkupDeclaration | PI | Comment | PEReference | S
     42#    *  MarkupDeclaration ::= '<!' DeclType DeclBody '>'
     43#    * DeclType ::= 'ELEMENT' | 'ATTLIST' | 'ENTITY' | 'NOTATION'
     44#    * PEReference ::= '%' Name ';'
     45#    * MarkupDeclCE = ([^]"'><]+ | QuoteSE)* '>'
     46#
     47
     48# Parse from <! in parallel?  - but < allowed in entity value system literal
     49
     50
     51       
     52        Prolog_Cursor_0 = 1
     53        Prolog_Cursor_1 = ScanTo(Prolog_Cursor_0, LAngleFollow)
     54        Prolog_Cursor = Prolog_Cursor & (lex.CtCD_start | lex.PI_start)
     55        While Prolog_Cursor:
     56                PI_2 = Prolog_Cursor & lex.PI_start
     57                CD_Ct_3 = bitutil.Advance(Prolog_Cursor & ~PI_Cursor)
     58                # Comment parsing
     59                Comment_3 = CD_Ct_3 & lex.Hyphen
     60                DocType_3 = CD_Ct_3 & ~ lex.Hyphen
     61                Ct_starts |= Comment_3
     62                Comment_4 = bitutil.Advance(Ct_3)
     63                Comment_errors |= Comment_4 & ~ lex.Hyphen
     64                Comment_5 = bitutil.Advance(Comment_Cursor)
     65                Comment_end_scan |= Comment_Cursor
     66                Comment_close = bitutil.Advance(bitutil.ScanThru(Comment_5, Comment_end_scan))
     67                Ct_ends |= Ct_close
     68                # PI parsing
     69                PI_3 = bitutil.Advance(PI_Cursor)
     70                PI_namestarts |= PI_3
     71                PI_name_end = bitutil.ScanThru(PI_3, lex.NameScan)
     72                PI_name_ends |= PI_name_end
     73                PI_close = bitutil.ScanThru(PI_name_end, PI_end_scan)
     74                PI_ends |= PI_close
     75               
     76        # DOCTYPE parsing
     77        DocType_10 = bitutil.ScanTo(DocType_3, lex.WS)
     78
     79
     80
     81
     82                Prolog_Cursor = bitutil.ScanTo(bitutil.Advance(Ct_ends, Ct_starts)
     83
     84       
     85
     86
     87
     88
     89
     90
     91
     92
    2893
    2994
Note: See TracChangeset for help on using the changeset viewer.