Esempio n. 1
0
Scanner::Scanner()
:
EOFCHAR('\x7F'),
CR((char) 13),
LF((char) 10),
bufferLength(),
bufferPtr(),
ftoken(CodeTypes::tEmptyToken),
yylineno(),
timeWord1("time"),
timeWord2("Time"),
timeWord3("TIME"),
FromQueue(true),
IgnoreNewLines(true),
fch('\0'),
tokenDouble(),
tokenInteger(),
tokenScalar(), // Used to retrieve int or double
tokenString(),
pStream(NULL),
previousToken(CodeTypes::tEmptyToken),
currentToken(CodeTypes::tEmptyToken)
{
    FCharTable.resize(255);
    buffer.resize(255);
    initScanner();
}
void findRecordInSchema(RM_TableData *rel, RM_ScanHandle *scan, Expr *cond) {
	expressionSearch *recSearch = NULL;
	scan->rel = rel;
	recSearch = initSearchRecord();
	initScanner(rel, recSearch, cond);
	scan->mgmtData = (void *) recSearch;
}
Esempio n. 3
0
// Initializes the data, gets the first instruction, and gets
// first token
void secondPass(FILE* infile, FILE* outfile, FILE* bfile){
    binfile = bfile;
    outputBuffer[16] = 0;
    initScanner(infile, outfile);
    spAddress = DEFAULT_START_ADDRESS;
    spNotDone = nextInstruction();
    spToken = nextToken();
    program();
}
Esempio n. 4
0
int main(int argc, char**argv)
{

    /****************************** Inicializace ******************************/

    exceptions_init();
    if(argc!=2) {
        fprintf( stderr, "Chybny zpusob volani interpretru!\nPouziti: %s program.ifj\n\n", argv[0] );
        exit( 99 );
    }

    FILE* f=fopen(argv[1],"r");
    if(f==NULL) {
        fprintf( stderr, "Program k interpretaci (%s) se nepodarilo otevrit!\n\n", argv[1] );
        exit( 99 );
    }

    Scanner s;
    SyntaxContext syntaxcontext;
    Function mainFunction;

    int exitVal = 0;

    try {
        try {

            initScanner(&s,f);
            initDefaultSyntaxContext(&syntaxcontext);

            /***************************** Překlad do AST *****************************/
            parseProgram(&s, &syntaxcontext, &mainFunction);
        }
        catch {
            on(ScannerError, e) {
                scannerErrorPrint(*e);
                fclose( f );
                exitVal = 1;
                rethrow();
            }
            on(SyntaxError, e) {
                syntaxErrorPrint(*e);
                fclose( f );
                exitVal = 2;
                rethrow();
            }
            on(UnexpectedToken, e) {
                UnexpectedTokenPrint(*e);
                fclose( f );
                exitVal = 2;
                rethrow();
            }
TokenScanner::TokenScanner(const std::string& str) {
    initScanner();
    setInput(str);
}
TokenScanner::TokenScanner(std::istream& infile) {
    initScanner();
    setInput(infile);
}
TokenScanner::TokenScanner() {
    initScanner();
    setInput("");
}
Esempio n. 8
0
HceParse::HceParse()
{
    _itab = 0;
    initScanner();
}