Commit f8263c0e authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

sweet parser work

parent fe504483
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -351,6 +351,20 @@ int DSNLEXER::NeedSYMBOLorNUMBER() throw( IO_ERROR )
}


int DSNLEXER::NeedNUMBER( const char* aExpectation ) throw( IO_ERROR )
{
    int tok = NextTok();
    if( tok != DSN_NUMBER )
    {
        wxString    errText;

        errText.Printf( _("need a NUMBER for '%s'"), wxString::FromUTF8( aExpectation ).GetData() );
        THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
    }
    return tok;
}


/**
 * Function isspace
 * strips the upper bits of the int to ensure the value passed to ::isspace() is
+9 −0
Original line number Diff line number Diff line
@@ -292,6 +292,15 @@ public:
     */
    int NeedSYMBOLorNUMBER() throw( IO_ERROR );

    /**
     * Function NeedNUMBER
     * calls NextTok() and then verifies that the token read is type DSN_NUMBER.
     * If not, and IO_ERROR is thrown using text from aExpectation.
     * @return int - the actual token read in.
     * @throw IO_ERROR, if the next token does not satisfy the above test
     */
    int NeedNUMBER( const char* aExpectation ) throw( IO_ERROR );

    /**
     * Function CurTok
     * returns whatever NextTok() returned the last time it was called.
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ add_library( sweet SHARED
    sch_lpid.cpp
    sch_dir_lib_source.cpp
    sch_part.cpp
    sch_sweet_parser.cpp
    sweet_keywords.cpp
    ${PROJECT_SOURCE_DIR}/common/richio.cpp
    ${PROJECT_SOURCE_DIR}/common/dsnlexer.cpp
+26.7 KiB

File added.

No diff preview for this file type.

+3 −3
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
#include <sch_lib.h>
#include <sch_lpid.h>
#include <sch_part.h>
#include <sweet_lexer.h>
#include <sch_sweet_parser.h>
#include <sch_lib_table.h>


@@ -253,9 +253,9 @@ PART* LIB::LookupPart( const LPID& aLPID, LIB_TABLE* aLibTable ) throw( IO_ERROR
#endif

        // @todo consider changing ReadPart to return a "source"
        SWEET_LEXER sw( part->body, wxString::FromUTF8( aLPID.Format().c_str() ) );
        SWEET_PARSER sp( part->body, wxString::FromUTF8( aLPID.Format().c_str() ) );

        part->Parse( &sw, aLibTable );
        part->Parse( &sp, aLibTable );
    }

    return part;
Loading