Changeset 2204 for proto/parabix2


Ignore:
Timestamp:
Jun 4, 2012, 12:18:37 PM (7 years ago)
Author:
cameron
Message:

Update prototype for new pablo.assert_0 feature

Location:
proto/parabix2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/pablo_template.cpp

    r2201 r2204  
    2222#include <ErrorTracker.h>
    2323#include <XMLTestSuiteError.h>
     24
     25// Define the mappings for pablo.assert_0(strm, errkind) statements which
     26// compile to the the form assert_0_error(errkind, strm)
     27#define assert_0_error(errkind, errstrm) error_tracker.NoteError(errkind, errstrm);
    2428
    2529#ifdef BUFFER_PROFILING
  • proto/parabix2/parabix2_pablo.py

    r2050 r2204  
    222222        lex.Hex = (temp62 | temp65);
    223223        lex_error = x00_x1F &~ lex.WS
    224         if pablo.inFile(lex_error):
    225                 error_tracker.NoteError("Error: illegal character", lex_error)
     224        pablo.assert_0(pablo.inFile(lex_error), "Error: illegal character")
    226225               
    227226       
     
    304303                        u8_FFFE_FFFF = (EF_BF_pending & (u8.xBE | u8.xBF))
    305304                u8mismatch = u8anyscope ^ u8.suffix
    306                 u8_error |= u8mismatch | u8_FFFE_FFFF
    307                 if u8_error:
    308                         error_tracker.NoteError("UTF-8 error found", (u8_error))
     305                pablo.assert_0(u8_error | u8mismatch | u8_FFFE_FFFF, "UTF-8 error found")
    309306                       
    310307       
     
    360357                        PI_name_end = pablo.ScanThru(PI_Cursor, lex.NameScan)
    361358                        PI_error = PI_Cursor & PI_name_end
    362                         PI_error |= pablo.Advance(PI_name_end & ~ lex.WS) & ~ PI_closer
    363                         if PI_error:
    364                                 error_tracker.NoteError("Error in PI syntax", PI_name_end)
     359                        PI_noWS = PI_name_end & ~ lex.WS
     360                        PI_error |= PI_noWS &~ lex.QMark | pablo.Advance(PI_noWS) &~ PI_closer
     361                        pablo.assert_0(PI_error, "Error in PI syntax")
    365362                        ctCDPI_Callouts.PI_name_ends |= PI_name_end
    366363                        PI_Cursor = pablo.ScanTo(PI_name_end, PI_closer)
     
    384381                        Ct_Cursor = pablo.Advance(pablo.Advance(Ct_Cursor))
    385382                        Ct_Cursor = pablo.Advance(pablo.ScanTo(Ct_Cursor, DoubleHyphen))
    386                         Ct_error |= Ct_Cursor & ~ lex.RAngle   
     383                        pablo.assert_0(Ct_error | Ct_Cursor & ~ lex.RAngle, "Error in comment syntax")
    387384                        ctCDPI_Callouts.Ct_ends |= Ct_Cursor
    388385                        CtCDPI_ends |= Ct_Cursor
    389                         if Ct_error:
    390                                 error_tracker.NoteError("Error in comment syntax", Ct_error)
    391386
    392387                # Common processing
     
    396391#               ctCDPI_mask |= (CtCDPI_ends - CtCDPI_starts) | CtCDPI_ends
    397392                # If any of the Comment, CDATA or PI markups are unterminated, it is an error.
    398                 ctCDPI_error = pablo.atEOF(ctCDPI_mask)
    399        
    400                 if ctCDPI_error:
    401                         error_tracker.NoteError("Error in comment, CDATA or processing instruction syntax", ctCDPI_error)
     393                pablo.assert_0(pablo.atEOF(ctCDPI_mask), "Error in comment, CDATA or processing instruction syntax")
    402394               
    403395        check_streams.misc_mask = (lex.WS | lex.LAngle | (pablo.Advance(ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends)  -(ctCDPI_Callouts.Ct_starts | ctCDPI_Callouts.PI_starts)) | CtCDPI_starts) & EOF_mask
     
    498490                EndTagEnds = pablo.ScanThru(EndTagEnds, lex.WS)
    499491        ParseError |= EndTagEnds & ~lex.RAngle
    500         if ParseError:
    501                 error_tracker.NoteError("Tag parsing error found", (ParseError))
     492        pablo.assert_0(ParseError, "Tag parsing error found")
    502493               
    503494               
     
    534525                ref_ends = ref_Callouts.GenRef_ends | ref_Callouts.DecRef_ends | ref_Callouts.HexRef_ends
    535526                ref_error3 = ref_ends &~ lex.Semicolon
    536                 ref_error = ref_error1 | ref_error2 | ref_error3
    537                 if ref_error:
    538                         error_tracker.NoteError("Reference error found", (ref_error))
     527                pablo.assert_0(ref_error1 | ref_error2 | ref_error3, "Reference error found")
    539528                       
    540529
     
    560549        colon2_err = pablo.ScanThru(local_part_start, lex.NameScan &~ lex.Colon) & lex.Colon
    561550        ncname_err = ncname_stream & lex.Colon
    562         namespace_error = void_prefix_err | local_part_err | colon2_err | ncname_err
    563         if namespace_error:
    564                 error_tracker.NoteError("error found", namespace_error)
     551        pablo.assert_0(void_prefix_err | local_part_err | colon2_err | ncname_err, "name syntax error")
    565552               
    566553                       
     
    569556   
    570557def Do_check_streams(marker, tag_Callouts, check_streams):
    571         CD_end_error = marker.CD_closer & ~tag_Callouts.AttVal_spans
    572         if CD_end_error:
    573                 error_tracker.NoteError("Error: ]]> in text", CD_end_error)
     558        pablo.assert_0(marker.CD_closer & ~tag_Callouts.AttVal_spans, "Error: ]]> in text")
    574559        check_streams.tag_marks = tag_Callouts.EmptyTag_marks | tag_Callouts.ElemName_starts | tag_Callouts.EndTag_marks | tag_Callouts.AttName_starts
    575560        check_streams.name_follows = tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends
Note: See TracChangeset for help on using the changeset viewer.