예제 #1
0
int ReadToken(TokenStream *pTok)
{
    char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
    char string_val[MAX_STRING_LEN + 1];
    int ltoken, len;
    char ch;

    ltoken = lReadByte(pTok);
    if (ltoken >= 0) {
        if (ltoken > 127)
            ltoken += 128;
        //ltoken = lExpandToken(ltoken);
        switch (ltoken) {
        case IDENT_SY:
        case TYPEIDENT_SY:
            len = 0;
            ch = lReadByte(pTok);
            while ((ch >= 'a' && ch <= 'z') ||
                     (ch >= 'A' && ch <= 'Z') ||
                     (ch >= '0' && ch <= '9') ||
                     ch == '_')
            {
                if (len < MAX_SYMBOL_NAME_LEN) {
                    symbol_name[len] = ch;
                    len++;
                    ch = lReadByte(pTok);
                }
            }
            symbol_name[len] = '\0';
            assert(ch == '\0');
            yylval.sc_ident = LookUpAddString(atable, symbol_name);
            return IDENT_SY;
            break;
        case STRCONST_SY:
            len = 0;
            while ((ch = lReadByte(pTok)) != 0)
                if (len < MAX_STRING_LEN)
                    string_val[len++] = ch;
            string_val[len] = 0;
            yylval.sc_ident = LookUpAddString(atable, string_val);
            break;
        case CFLOATCONST_SY:
        case FLOATCONST_SY:
        case FLOATHCONST_SY:
        case FLOATXCONST_SY:
            lRead4Bytes(pTok, (unsigned char *) &yylval.sc_fval);
            break;
        case INTCONST_SY:
            lRead4Bytes(pTok, (unsigned char *) &yylval.sc_int);
            break;
        case '(':
            yylval.sc_int = lReadByte(pTok);
            break;
        }
        return ltoken;
    }
    return EOF_SY;
} // ReadToken
예제 #2
0
파일: Pp.cpp 프로젝트: kseitz/glslang
// Handle #line
int TPpContext::CPPline(TPpToken* ppToken) 
{
    // "#line must have, after macro substitution, one of the following forms:
    // "#line line
    // "#line line source-string-number"

    int token = scanToken(ppToken);
    const TSourceLoc directiveLoc = ppToken->loc;
    if (token == '\n') {
        parseContext.ppError(ppToken->loc, "must by followed by an integral literal", "#line", "");
        return token;
    }

    int lineRes = 0; // Line number after macro expansion.
    int lineToken = 0;
    bool hasFile = false;
    int fileRes = 0; // Source file number after macro expansion.
    const char* sourceName = nullptr; // Optional source file name.
    bool lineErr = false;
    bool fileErr = false;
    token = eval(token, MIN_PRECEDENCE, false, lineRes, lineErr, ppToken);
    if (! lineErr) {
        lineToken = lineRes;
        if (token == '\n')
            ++lineRes;

        if (parseContext.lineDirectiveShouldSetNextLine())
            --lineRes;
        parseContext.setCurrentLine(lineRes);

        if (token != '\n') {
            if (token == PpAtomConstString) {
                parseContext.ppRequireExtensions(directiveLoc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based #line");
                // We need to save a copy of the string instead of pointing
                // to the name field of the token since the name field
                // will likely be overwritten by the next token scan.
                sourceName = GetAtomString(LookUpAddString(ppToken->name));
                parseContext.setCurrentSourceName(sourceName);
                hasFile = true;
                token = scanToken(ppToken);
            } else {
                token = eval(token, MIN_PRECEDENCE, false, fileRes, fileErr, ppToken);
                if (! fileErr) {
                    parseContext.setCurrentString(fileRes);
                    hasFile = true;
                }
            }
        }
    }
    if (!fileErr && !lineErr) {
        parseContext.notifyLineDirective(directiveLoc.line, lineToken, hasFile, fileRes, sourceName);
    }
    token = extraTokenCheck(PpAtomLine, ppToken, token);

    return token;
}
예제 #3
0
int SetInputFile(const char *fname)
{
    FileInputSrc *in = malloc(sizeof(FileInputSrc));
    memset(in, 0, sizeof(FileInputSrc));
    if (fname) {
        if (!Cg->options.Quiet)
            printf("%s\n", fname);
        in->base.name = LookUpAddString(atable, fname);
        in->fd = fopen(fname, "r");
        if (!in->fd) {
            printf(OPENSL_TAG ": cannot open input file \"%s\"\n", fname);
            free(in);
            return 0;
        }
    } else {
        in->fd = stdin;
        in->base.name = LookUpAddString(atable, "<stdin>");
    }
    in->base.line = 1;
    in->base.scan = byte_scan;
    in->base.getch = (int (*)(InputSrc *)) nextchar;
    in->base.ungetch = (void (*)(InputSrc *, int)) ungetchar;
    in->base.prev = Cg->currentInput;
    Cg->currentInput = &in->base;
#if 0 && !defined(_DEBUG)
    if (Cg->options.TraceScanner) {
        __int64 s,e;
        s = RDTSC();
        while (Cg->currentInput->scan(Cg->currentInput) > 0)
            /* empty statement */ ;
        e = RDTSC();
        printf("%d cycles\n", (int)(e-s));
        return 0;
    }
#endif
    return 1;
} // SetInputFile
예제 #4
0
파일: cpp.c 프로젝트: Ajunboys/mozilla-os2
void PredefineIntMacro(const char *name, int value) {
    SourceLoc location = {0, 0};
    Symbol *symbol = NULL;
    MacroSymbol macro = {0, NULL, NULL, 0, 0};
    yystypepp val = {0, 0.0, 0, {0}};
    int atom = 0;

    macro.body = NewTokenStream(name, macros->pool);
    val.sc_int = value;
    snprintf(val.symbol_name, MAX_SYMBOL_NAME_LEN+1, "%d", value);
    RecordToken(macro.body, CPP_INTCONSTANT, &val);
    atom = LookUpAddString(atable, name);
    symbol = AddSymbol(&location, macros, atom, MACRO_S);
    symbol->details.mac = macro;
}
예제 #5
0
파일: cpp.c 프로젝트: Ajunboys/mozilla-os2
int InitCPP(void)
{
    char        buffer[64], *t;
    const char  *f;

    // Add various atoms needed by the CPP line scanner:
    bindAtom = LookUpAddString(atable, "bind");
    constAtom = LookUpAddString(atable, "const");
    defaultAtom = LookUpAddString(atable, "default");
    defineAtom = LookUpAddString(atable, "define");
    definedAtom = LookUpAddString(atable, "defined");
    elifAtom = LookUpAddString(atable, "elif");
    elseAtom = LookUpAddString(atable, "else");
    endifAtom = LookUpAddString(atable, "endif");
    ifAtom = LookUpAddString(atable, "if");
    ifdefAtom = LookUpAddString(atable, "ifdef");
    ifndefAtom = LookUpAddString(atable, "ifndef");
    includeAtom = LookUpAddString(atable, "include");
    lineAtom = LookUpAddString(atable, "line");
    pragmaAtom = LookUpAddString(atable, "pragma");
    texunitAtom = LookUpAddString(atable, "texunit");
    undefAtom = LookUpAddString(atable, "undef");
	errorAtom = LookUpAddString(atable, "error");
    __LINE__Atom = LookUpAddString(atable, "__LINE__");
    __FILE__Atom = LookUpAddString(atable, "__FILE__");
	__VERSION__Atom = LookUpAddString(atable, "__VERSION__");
    versionAtom = LookUpAddString(atable, "version");
    extensionAtom = LookUpAddString(atable, "extension");
    macros = NewScopeInPool(mem_CreatePool(0, 0));
    strcpy(buffer, "PROFILE_");
    t = buffer + strlen(buffer);
    f = cpp->options.profileString;
    while ((isalnum(*f) || *f == '_') && t < buffer + sizeof(buffer) - 1)
        *t++ = toupper(*f++);
    *t = 0;

    PredefineIntMacro("GL_ES", 1);
    PredefineIntMacro("GL_FRAGMENT_PRECISION_HIGH", 1);

	return 1;
} // InitCPP
예제 #6
0
파일: scanner.c 프로젝트: Moondee/Artemis
static int byte_scan(InputSrc *in, yystypepp * yylvalpp)
{
    char string_val[MAX_STRING_LEN + 1];
    int alreadyComplained = 0;
    int len, ch, ii, ival = 0;

    for (;;) {
        yylvalpp->sc_int = 0;
        ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
 
        while (ch == ' ' || ch == '\t' || ch == '\r') {
            yylvalpp->sc_int = 1;
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
        }
        
        cpp->ltokenLoc.file = cpp->currentInput->name;
        cpp->ltokenLoc.line = cpp->currentInput->line;
        alreadyComplained = 0;
        len = 0;
        switch (ch) {
        default:
            return ch; // Single character token
        case EOF:
            return -1;
        case 'A': case 'B': case 'C': case 'D': case 'E':
        case 'F': case 'G': case 'H': case 'I': case 'J':
        case 'K': case 'L': case 'M': case 'N': case 'O':
        case 'P': case 'Q': case 'R': case 'S': case 'T':
        case 'U': case 'V': case 'W': case 'X': case 'Y':
        case 'Z': case '_':
        case 'a': case 'b': case 'c': case 'd': case 'e':
        case 'f': case 'g': case 'h': case 'i': case 'j':
        case 'k': case 'l': case 'm': case 'n': case 'o':
        case 'p': case 'q': case 'r': case 's': case 't':
        case 'u': case 'v': case 'w': case 'x': case 'y':
        case 'z':            
            do {
                APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            } while ((ch >= 'a' && ch <= 'z') ||
                     (ch >= 'A' && ch <= 'Z') ||
                     (ch >= '0' && ch <= '9') ||
                     ch == '_');
            assert(len <= MAX_SYMBOL_NAME_LEN);
            yylvalpp->symbol_name[len] = '\0';
            cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
            yylvalpp->sc_ident = LookUpAddString(atable, yylvalpp->symbol_name);
            return CPP_IDENTIFIER;
            break;
        case '0':
            APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == 'x' || ch == 'X') {  // hexadecimal integer constants
                APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
                if ((ch >= '0' && ch <= '9') ||
                    (ch >= 'A' && ch <= 'F') ||
                    (ch >= 'a' && ch <= 'f'))
                {
                    ival = 0;
                    do {
                        if ((ival <= 0x0fffffff) && (len < MAX_SYMBOL_NAME_LEN)) {
                            yylvalpp->symbol_name[len++] = ch;
                            if (ch >= '0' && ch <= '9') {
                                ii = ch - '0';
                            } else if (ch >= 'A' && ch <= 'F') {
                                ii = ch - 'A' + 10;
                            } else {
                                ii = ch - 'a' + 10;
                            }
                            ival = (ival << 4) | ii;
                        } else if (!alreadyComplained) {
                            CPPErrorToInfoLog("HEX CONSTANT OVERFLOW");
                            alreadyComplained = 1;
                        }
                        ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
                    } while ((ch >= '0' && ch <= '9') ||
                             (ch >= 'A' && ch <= 'F') ||
                             (ch >= 'a' && ch <= 'f'));
                } else {
                    CPPErrorToInfoLog("HEX CONSTANT INVALID");
                }
                assert(len <= MAX_SYMBOL_NAME_LEN);
                yylvalpp->symbol_name[len] = '\0';
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                yylvalpp->sc_int = ival;
                return CPP_INTCONSTANT;
            } else if (ch >= '0' && ch <= '7') { // octal integer constants
                ival = 0;
                do {
                    if ((ival <= 0x1fffffff) && (len < MAX_SYMBOL_NAME_LEN)) {
                        yylvalpp->symbol_name[len++] = ch;
                        ii = ch - '0';
                        ival = (ival << 3) | ii;
                    } else if (!alreadyComplained) {
                        CPPErrorToInfoLog("OCT CONSTANT OVERFLOW");
                        alreadyComplained = 1;
                    }
                    ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
                } while (ch >= '0' && ch <= '7');
                if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E') 
                     return lFloatConst(ch, len, yylvalpp);
                assert(len <= MAX_SYMBOL_NAME_LEN);
                yylvalpp->symbol_name[len] = '\0';
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                yylvalpp->sc_int = ival;
                return CPP_INTCONSTANT;
            } else {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                ch = '0';
            }
            // Fall through...
        case '1': case '2': case '3': case '4':
        case '5': case '6': case '7': case '8': case '9':
            do {
                APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            } while (ch >= '0' && ch <= '9');
            if (ch == '.' || ch == 'e' || ch == 'E') {
                return lFloatConst(ch, len, yylvalpp);
            } else {
                assert(len <= MAX_SYMBOL_NAME_LEN);
                yylvalpp->symbol_name[len] = '\0';
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                ival = 0;
                for (ii = 0; ii < len; ii++) {
                    ch = yylvalpp->symbol_name[ii] - '0';
                    ival = ival*10 + ch;
                    if ((ival > 214748364) || (ival == 214748364 && ch >= 8)) {
                        CPPErrorToInfoLog("INTEGER CONSTANT OVERFLOW");
                        break;
                    }
                }
                yylvalpp->sc_int = ival;
                if(ival==0)
                   strcpy(yylvalpp->symbol_name,"0");
                return CPP_INTCONSTANT;
            }
            break;
        case '-':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '-') {
                return CPP_DEC_OP;
            } else if (ch == '=') {
                return CPP_SUB_ASSIGN;
            } else {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                return '-';
            }
        case '+':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '+') {
                return CPP_INC_OP;
            } else if (ch == '=') {
                return CPP_ADD_ASSIGN;
            } else {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                return '+';
            }
        case '*':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '=') {
                return CPP_MUL_ASSIGN;
            } else {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                return '*';
            }
        case '%':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '=') {
                return CPP_MOD_ASSIGN;
            } else if (ch == '>'){
                return CPP_RIGHT_BRACE;
            } else {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                return '%';
            }
        case ':':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '>') {
                return CPP_RIGHT_BRACKET;
            } else {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                return ':';
            }
        case '^':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '^') {
                return CPP_XOR_OP;
            } else {
                if (ch == '=')
                    return CPP_XOR_ASSIGN;
                else{
                  cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                  return '^';
                }
            }
        
        case '=':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '=') {
                return CPP_EQ_OP;
            } else {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                return '=';
            }
        case '!':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '=') {
                return CPP_NE_OP;
            } else {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                return '!';
            }
        case '|':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '|') {
                return CPP_OR_OP;
            } else {
                if (ch == '=')
                    return CPP_OR_ASSIGN;
                else{
                  cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                  return '|';
                }
            }
        case '&':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '&') {
                return CPP_AND_OP;
            } else {
                if (ch == '=')
                    return CPP_AND_ASSIGN;
                else{
                  cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                  return '&';
                }
            }
        case '<':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '<') {
                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
                if(ch == '=')
                    return CPP_LEFT_ASSIGN;
                else{
                    cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                    return CPP_LEFT_OP;
                }
            } else {
                if (ch == '=') {
                    return CPP_LE_OP;
                } else {
                    if (ch == '%')
                        return CPP_LEFT_BRACE;
                    else if (ch == ':')
                        return CPP_LEFT_BRACKET;
                    else{
                        cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                        return '<';
                    }
                }
            }
        case '>':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '>') {
                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
                if(ch == '=')
                    return CPP_RIGHT_ASSIGN;
                else{
                    cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                    return CPP_RIGHT_OP;
                }
            } else {
                if (ch == '=') {
                    return CPP_GE_OP;
                } else {
                    cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                    return '>';
                }
            }
        case '.':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch >= '0' && ch <= '9') {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                return lFloatConst('.', 0, yylvalpp);
            } else {
                if (ch == '.') {
                    return -1; // Special EOF hack
                } else {
                    cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                    return '.';
                }
            }
        case '/':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            if (ch == '/') {
                do {
                    ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
                } while (ch != '\n' && ch != EOF);
                if (ch == EOF)
                    return -1;
                return '\n';
            } else if (ch == '*') {
                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
                do {
                    while (ch != '*') {
                        if (ch == EOF) {
                            CPPErrorToInfoLog("EOF IN COMMENT");
                            return -1;
                        }
                        ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
                    }
                    ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
                    if (ch == EOF) {
                        CPPErrorToInfoLog("EOF IN COMMENT");
                        return -1;
                    }
                } while (ch != '/');
                // Go try it again...
            } else if (ch == '=') {
                return CPP_DIV_ASSIGN;
            } else {
                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
                return '/';
            }
            break;
        case '"':
            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            while (ch != '"' && ch != '\n' && ch != EOF) {
                if (ch == '\\') {
                    CPPErrorToInfoLog("The line continuation character (\\) is not part of the OpenGL ES Shading Language");
                    return -1;
                }
                APPEND_CHAR_S(ch, string_val, len, MAX_STRING_LEN);
                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
            };
            assert(len <= MAX_STRING_LEN);
            string_val[len] = '\0';
            if (ch == '"') {
                yylvalpp->sc_ident = LookUpAddString(atable, string_val);
                return CPP_STRCONSTANT;
            } else {
                CPPErrorToInfoLog("EOL IN STRING");
                return ERROR_SY;
            }
            break;
        }
    }
} // byte_scan
예제 #7
0
/*
* Read the next token from a token stream (not the source stream, but stream used to hold a tokenized macro).
*/
int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
{
    char* tokenText = ppToken->name;
    int ltoken, len;
    int ch;

    ltoken = lReadByte(pTok);
    ppToken->loc = parseContext.getCurrentLoc();
    if (ltoken > 127)
        ltoken += 128;
    switch (ltoken) {
    case '#':        
        if (lReadByte(pTok) == '#') {
            parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
            parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
            parseContext.error(ppToken->loc, "token pasting not implemented (internal error)", "##", "");
            //return PpAtomPaste;
            return ReadToken(pTok, ppToken);
        } else
            lUnreadByte(pTok);
        break;
    case PpAtomConstString:
    case PpAtomIdentifier:
    case PpAtomConstFloat:
    case PpAtomConstDouble:
    case PpAtomConstInt:
    case PpAtomConstUint:
        len = 0;
        ch = lReadByte(pTok);
        while (ch != 0) {
            if (len < MaxTokenLength) {
                tokenText[len] = (char)ch;
                len++;
                ch = lReadByte(pTok);
            } else {
                parseContext.error(ppToken->loc, "token too long", "", "");
                break;
            }
        }
        tokenText[len] = 0;

        switch (ltoken) {
        case PpAtomIdentifier:
            ppToken->atom = LookUpAddString(tokenText);
            break;
        case PpAtomConstString:
            break;
        case PpAtomConstFloat:
        case PpAtomConstDouble:
            strcpy(ppToken->name, tokenText);
            ppToken->dval = atof(ppToken->name);
            break;
        case PpAtomConstInt:
        case PpAtomConstUint:
            strcpy(ppToken->name, tokenText);
            if (len > 0 && tokenText[0] == '0') {
                if (len > 1 && (tokenText[1] == 'x' || tokenText[1] == 'X'))
                    ppToken->ival = strtol(ppToken->name, 0, 16);
                else
                    ppToken->ival = strtol(ppToken->name, 0, 8);
            } else
                ppToken->ival = atoi(ppToken->name);
            break;
        }
    }

    return ltoken;
}
예제 #8
0
int InitCPP(void)
{
    // Add various atoms needed by the CPP line scanner:
    bindAtom = LookUpAddString(atable, "bind");
    constAtom = LookUpAddString(atable, "const");
    defaultAtom = LookUpAddString(atable, "default");
    defineAtom = LookUpAddString(atable, "define");
    definedAtom = LookUpAddString(atable, "defined");
    elifAtom = LookUpAddString(atable, "elif");
    elseAtom = LookUpAddString(atable, "else");
    endifAtom = LookUpAddString(atable, "endif");
    ifAtom = LookUpAddString(atable, "if");
    ifdefAtom = LookUpAddString(atable, "ifdef");
    ifndefAtom = LookUpAddString(atable, "ifndef");
    includeAtom = LookUpAddString(atable, "include");
    lineAtom = LookUpAddString(atable, "line");
    pragmaAtom = LookUpAddString(atable, "pragma");
    texunitAtom = LookUpAddString(atable, "texunit");
    undefAtom = LookUpAddString(atable, "undef");
    errorAtom = LookUpAddString(atable, "error");
    __LINE__Atom = LookUpAddString(atable, "__LINE__");
    __FILE__Atom = LookUpAddString(atable, "__FILE__");
    __VERSION__Atom = LookUpAddString(atable, "__VERSION__");
    versionAtom = LookUpAddString(atable, "version");
    macros = NewScopeInPool(mem_CreatePool(0, 0));
    return 1;
} // InitCPP
예제 #9
0
int ReadToken(TokenStream *pTok, yystypepp * yylvalpp)
{
    char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
    char string_val[MAX_STRING_LEN + 1];
    int ltoken, len;
    char ch;

    ltoken = lReadByte(pTok);
    if (ltoken >= 0) {
        if (ltoken > 127)
            ltoken += 128;
        switch (ltoken) {
        case CPP_IDENTIFIER:
        case CPP_TYPEIDENTIFIER:
            len = 0;
            ch = lReadByte(pTok);
            while ((ch >= 'a' && ch <= 'z') ||
                     (ch >= 'A' && ch <= 'Z') ||
                     (ch >= '0' && ch <= '9') ||
                     ch == '_')
            {
                if (len < MAX_SYMBOL_NAME_LEN) {
                    symbol_name[len++] = ch;
                    ch = lReadByte(pTok);
                }
            }
            symbol_name[len] = '\0';
            assert(ch == '\0');
            yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);
            return CPP_IDENTIFIER;
            break;
        case CPP_STRCONSTANT:
            len = 0;
            while ((ch = lReadByte(pTok)) != 0)
                if (len < MAX_STRING_LEN)
                    string_val[len++] = ch;
            string_val[len] = '\0';
            yylvalpp->sc_ident = LookUpAddString(atable, string_val);
            break;
        case CPP_FLOATCONSTANT:
            len = 0;
            ch = lReadByte(pTok);
            while ((ch >= '0' && ch <= '9')||(ch=='e'||ch=='E'||ch=='.')||(ch=='+'||ch=='-'))
            {
                if (len < MAX_SYMBOL_NAME_LEN) {
                    symbol_name[len++] = ch;
                    ch = lReadByte(pTok);
                }
            }
            symbol_name[len] = '\0';
            assert(ch == '\0');
            strcpy(yylvalpp->symbol_name,symbol_name);
            yylvalpp->sc_fval=(float)atof_dot(yylvalpp->symbol_name);
            break;
        case CPP_INTCONSTANT:
            len = 0;
            ch = lReadByte(pTok);
            while ((ch >= '0' && ch <= '9'))
            {
                if (len < MAX_SYMBOL_NAME_LEN) {
                    symbol_name[len++] = ch;
                    ch = lReadByte(pTok);
                }
            }
            symbol_name[len] = '\0';
            assert(ch == '\0');
            strcpy(yylvalpp->symbol_name,symbol_name);
            yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
            break;
        case '(':
            yylvalpp->sc_int = lReadByte(pTok);
            break;
        }
        return ltoken;
    }
    return EOF_SY;
} // ReadToken
예제 #10
0
static int lex(InputSrc* in, yystypepp* yylvalpp)
{
    InputSrcLexer* src = ((InputSrcLexer *)in);

    pp::Token token;
    int ret = src->lexer->lex(&token);
    switch (ret)
    {
    case 0:  // EOF
        delete src->lexer;
        free(src);
        cpp->currentInput = 0;
        ret = EOF;
        break;
    case pp::Token::IDENTIFIER:
        if (CopySymbolName(token.value, yylvalpp))
        {
            yylvalpp->sc_ident = LookUpAddString(atable, token.value.c_str());
        }
        ret = CPP_IDENTIFIER;
        break;
    case pp::Token::CONST_INT:
        if (CopySymbolName(token.value, yylvalpp))
        {
            yylvalpp->sc_int = atoi(token.value.c_str());
        }
        ret = CPP_INTCONSTANT;
        break;
    case pp::Token::CONST_FLOAT:
        CopySymbolName(token.value, yylvalpp);
        ret = CPP_FLOATCONSTANT;
        break;
    case pp::Token::OP_INC:
        ret = CPP_INC_OP;
        break;
    case pp::Token::OP_DEC:
        ret = CPP_DEC_OP;
        break;
    case pp::Token::OP_RIGHT:
        ret = CPP_RIGHT_OP;
        break;
    case pp::Token::OP_LE:
        ret = CPP_LE_OP;
        break;
    case pp::Token::OP_GE:
        ret = CPP_GE_OP;
        break;
    case pp::Token::OP_EQ:
        ret = CPP_EQ_OP;
        break;
    case pp::Token::OP_NE:
        ret = CPP_NE_OP;
        break;
    case pp::Token::OP_AND:
        ret = CPP_AND_OP;
        break;
    case pp::Token::OP_XOR:
        ret = CPP_XOR_OP;
        break;
    case pp::Token::OP_OR:
        ret = CPP_OR_OP;
        break;
    case pp::Token::OP_ADD_ASSIGN:
        ret = CPP_ADD_ASSIGN;
        break;
    case pp::Token::OP_SUB_ASSIGN:
        ret = CPP_SUB_ASSIGN;
        break;
    case pp::Token::OP_MUL_ASSIGN:
        ret = CPP_MUL_ASSIGN;
        break;
    case pp::Token::OP_DIV_ASSIGN:
        ret = CPP_DIV_ASSIGN;
        break;
    case pp::Token::OP_MOD_ASSIGN:
        ret = CPP_MOD_ASSIGN;
        break;
    case pp::Token::OP_LEFT_ASSIGN:
        ret = CPP_LEFT_ASSIGN;
        break;
    case pp::Token::OP_RIGHT_ASSIGN:
        ret = CPP_RIGHT_ASSIGN;
        break;
    case pp::Token::OP_AND_ASSIGN:
        ret = CPP_AND_ASSIGN;
        break;
    case pp::Token::OP_XOR_ASSIGN:
        ret = CPP_XOR_ASSIGN;
        break;
    case pp::Token::OP_OR_ASSIGN:
        ret = CPP_OR_ASSIGN;
        break;
    default:
        break;
    }
    SetLineNumber(token.location.line);
    SetStringNumber(token.location.string);
    return ret;
}
예제 #11
0
/*
* Read the next token from a token stream (not the source stream, but stream used to hold a tokenized macro).
*/
int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
{
    char* tokenText = ppToken->name;
    int ltoken, len;
    int ch;

    ltoken = lReadByte(pTok);
    ppToken->loc = parseContext.getCurrentLoc();
    if (ltoken > 127)
        ltoken += 128;
    switch (ltoken) {
    case '#':
        // Check for ##, unless the current # is the last character
        if (pTok->current < pTok->data.size()) {
            if (lReadByte(pTok) == '#') {
                parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
                parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
                parseContext.error(ppToken->loc, "token pasting not implemented (internal error)", "##", "");
                //return PpAtomPaste;
                return ReadToken(pTok, ppToken);
            } else
                lUnreadByte(pTok);
        }
        break;
    case PpAtomConstString:
    case PpAtomIdentifier:
    case PpAtomConstFloat:
    case PpAtomConstDouble:
#ifdef AMD_EXTENSIONS
    case PpAtomConstFloat16:
#endif
    case PpAtomConstInt:
    case PpAtomConstUint:
    case PpAtomConstInt64:
    case PpAtomConstUint64:
        len = 0;
        ch = lReadByte(pTok);
        while (ch != 0 && ch != EndOfInput) {
            if (len < MaxTokenLength) {
                tokenText[len] = (char)ch;
                len++;
                ch = lReadByte(pTok);
            } else {
                parseContext.error(ppToken->loc, "token too long", "", "");
                break;
            }
        }
        tokenText[len] = 0;

        switch (ltoken) {
        case PpAtomIdentifier:
            ppToken->atom = LookUpAddString(tokenText);
            break;
        case PpAtomConstString:
            break;
        case PpAtomConstFloat:
        case PpAtomConstDouble:
#ifdef AMD_EXTENSIONS
        case PpAtomConstFloat16:
#endif
            ppToken->dval = atof(ppToken->name);
            break;
        case PpAtomConstInt:
            if (len > 0 && tokenText[0] == '0') {
                if (len > 1 && (tokenText[1] == 'x' || tokenText[1] == 'X'))
                    ppToken->ival = (int)strtol(ppToken->name, 0, 16);
                else
                    ppToken->ival = (int)strtol(ppToken->name, 0, 8);
            } else
                ppToken->ival = atoi(ppToken->name);
            break;
        case PpAtomConstUint:
            if (len > 0 && tokenText[0] == '0') {
                if (len > 1 && (tokenText[1] == 'x' || tokenText[1] == 'X'))
                    ppToken->ival = (int)strtoul(ppToken->name, 0, 16);
                else
                    ppToken->ival = (int)strtoul(ppToken->name, 0, 8);
            } else
                ppToken->ival = (int)strtoul(ppToken->name, 0, 10);
            break;
        case PpAtomConstInt64:
            if (len > 0 && tokenText[0] == '0') {
                if (len > 1 && (tokenText[1] == 'x' || tokenText[1] == 'X'))
                    ppToken->i64val = strtoll(ppToken->name, nullptr, 16);
                else
                    ppToken->i64val = strtoll(ppToken->name, nullptr, 8);
            } else
                ppToken->i64val = atoll(ppToken->name);
            break;
        case PpAtomConstUint64:
            if (len > 0 && tokenText[0] == '0') {
                if (len > 1 && (tokenText[1] == 'x' || tokenText[1] == 'X'))
                    ppToken->i64val = (long long)strtoull(ppToken->name, nullptr, 16);
                else
                    ppToken->i64val = (long long)strtoull(ppToken->name, nullptr, 8);
            } else
                ppToken->i64val = (long long)strtoull(ppToken->name, 0, 10);
            break;
        }
    }

    return ltoken;
}
예제 #12
0
파일: PpTokens.cpp 프로젝트: TimNN/glslang
/*
* Read the next token from a token stream (not the source stream, but stream used to hold a tokenized macro).
*/
int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
{
    char tokenText[TPpToken::maxTokenLength + 1];
    int ltoken, len;
    int ch;

    ltoken = lReadByte(pTok);
    ppToken->loc = parseContext.getCurrentLoc();
    if (ltoken > 127)
        ltoken += 128;
    switch (ltoken) {
    case '#':        
        if (lReadByte(pTok) == '#') {
            parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
            parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
            parseContext.error(ppToken->loc, "token pasting not implemented (internal error)", "##", "");
            //return CPP_TOKEN_PASTE;
            return ReadToken(pTok, ppToken);
        } else
            lUnreadByte(pTok);
        break;
    case CPP_STRCONSTANT:
    case CPP_IDENTIFIER:
    case CPP_FLOATCONSTANT:
    case CPP_DOUBLECONSTANT:
    case CPP_INTCONSTANT:
    case CPP_UINTCONSTANT:
        len = 0;
        ch = lReadByte(pTok);
        while (ch != 0) {
            if (len < TPpToken::maxTokenLength) {
                tokenText[len] = ch;
                len++;
                ch = lReadByte(pTok);
            } else {
                parseContext.error(ppToken->loc, "token too long", "", "");
                break;
            }
        }
        tokenText[len] = 0;

        switch (ltoken) {
        case CPP_IDENTIFIER:
        case CPP_STRCONSTANT:
            ppToken->atom = LookUpAddString(tokenText);
            break;
        case CPP_FLOATCONSTANT:
        case CPP_DOUBLECONSTANT:
            strcpy(ppToken->name, tokenText);
            ppToken->dval = atof(ppToken->name);
            break;
        case CPP_INTCONSTANT:
        case CPP_UINTCONSTANT:
            strcpy(ppToken->name, tokenText);
            if (len > 0 && tokenText[0] == '0') {
                if (len > 1 && (tokenText[1] == 'x' || tokenText[1] == 'X'))
                    ppToken->ival = strtol(ppToken->name, 0, 16);
                else
                    ppToken->ival = strtol(ppToken->name, 0, 8);
            } else
                ppToken->ival = atoi(ppToken->name);
            break;
        }
    }

    return ltoken;
}
예제 #13
0
int InitSymbolTable(CgStruct *Cg)
{
    SourceLoc dummyLoc = { 0, 0 };
    int ii, name;

    // Create the super-global scope and add predefined types and symbols:

    PushScope(NewScopeInPool(mem_CreatePool(0, 0)));
    UndefinedType = NewType(TYPE_BASE_UNDEFINED_TYPE | TYPE_CATEGORY_SCALAR, 0);
    CFloatType = NewType(TYPE_BASE_CFLOAT | TYPE_CATEGORY_SCALAR | TYPE_QUALIFIER_CONST, 1);
    CIntType = NewType(TYPE_BASE_CINT | TYPE_CATEGORY_SCALAR | TYPE_QUALIFIER_CONST, 1);
    VoidType = NewType(TYPE_BASE_VOID | TYPE_CATEGORY_SCALAR | TYPE_MISC_VOID, 0);
    FloatType = NewType(TYPE_BASE_FLOAT | TYPE_CATEGORY_SCALAR, 1);
    IntType = NewType(TYPE_BASE_INT | TYPE_CATEGORY_SCALAR, 1);
    BooleanType = NewType(TYPE_BASE_BOOLEAN | TYPE_CATEGORY_SCALAR, 1);

    CFloat1Type = NewPackedArrayType(CFloatType, 1, TYPE_QUALIFIER_CONST);
    CFloat2Type = NewPackedArrayType(CFloatType, 2, TYPE_QUALIFIER_CONST);
    CFloat3Type = NewPackedArrayType(CFloatType, 3, TYPE_QUALIFIER_CONST);
    CFloat4Type = NewPackedArrayType(CFloatType, 4, TYPE_QUALIFIER_CONST);
    CInt1Type = NewPackedArrayType(CIntType, 1, TYPE_QUALIFIER_CONST);
    CInt2Type = NewPackedArrayType(CIntType, 2, TYPE_QUALIFIER_CONST);
    CInt3Type = NewPackedArrayType(CIntType, 3, TYPE_QUALIFIER_CONST);
    CInt4Type = NewPackedArrayType(CIntType, 4, TYPE_QUALIFIER_CONST);
    Float1Type = NewPackedArrayType(FloatType, 1, 0);
    Float2Type = NewPackedArrayType(FloatType, 2, 0);
    Float3Type = NewPackedArrayType(FloatType, 3, 0);
    Float4Type = NewPackedArrayType(FloatType, 4, 0);
    Int1Type = NewPackedArrayType(IntType, 1, 0);
    Int2Type = NewPackedArrayType(IntType, 2, 0);
    Int3Type = NewPackedArrayType(IntType, 3, 0);
    Int4Type = NewPackedArrayType(IntType, 4, 0);
    Boolean1Type = NewPackedArrayType(BooleanType, 1, 0);
    Boolean2Type = NewPackedArrayType(BooleanType, 2, 0);
    Boolean3Type = NewPackedArrayType(BooleanType, 3, 0);
    Boolean4Type = NewPackedArrayType(BooleanType, 4, 0);

    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cfloat"), CFloatType, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cint"), CIntType, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, VOID_SY, VoidType, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, FLOAT_SY, FloatType, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, INT_SY, IntType, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, BOOLEAN_SY, BooleanType, TYPEDEF_S);

    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cfloat1"), CFloat1Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cfloat2"), CFloat2Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cfloat3"), CFloat3Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cfloat4"), CFloat4Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cint1"), CInt1Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cint2"), CInt2Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cint3"), CInt3Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "cint4"), CInt4Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "float1"), Float1Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "float2"), Float2Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "float3"), Float3Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "float4"), Float4Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "int1"), Int1Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "int2"), Int2Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "int3"), Int3Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "int4"), Int4Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "bool1"), Boolean1Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "bool2"), Boolean2Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "bool3"), Boolean3Type, TYPEDEF_S);
    AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "bool4"), Boolean4Type, TYPEDEF_S);

    FalseSymb = AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "false"), BooleanType, CONSTANT_S);
    TrueSymb = AddSymbol(&dummyLoc, CurrentScope, LookUpAddString(atable, "true"), BooleanType, CONSTANT_S);
    FalseSymb->details.con.value = 0;
    TrueSymb->details.con.value = 1;

    SetScalarTypeName(TYPE_BASE_NO_TYPE, LookUpAddString(atable, "***no-base-type***"), UndefinedType);
    SetScalarTypeName(TYPE_BASE_UNDEFINED_TYPE, LookUpAddString(atable, "***undefined-base-type***"), UndefinedType);
    SetScalarTypeName(TYPE_BASE_CFLOAT, LookUpAddString(atable, "cfloat"), CFloatType);
    SetScalarTypeName(TYPE_BASE_CINT, LookUpAddString(atable, "cint"), CIntType);
    SetScalarTypeName(TYPE_BASE_VOID, LookUpAddString(atable, "void"), VoidType);
    SetScalarTypeName(TYPE_BASE_FLOAT, LookUpAddString(atable, "float"), FloatType);
    SetScalarTypeName(TYPE_BASE_INT, LookUpAddString(atable, "int"), IntType);
    SetScalarTypeName(TYPE_BASE_BOOLEAN, LookUpAddString(atable, "bool"), BooleanType);

    name = LookUpAddString(atable, "***unknown-profile-base-type***");
    for (ii = TYPE_BASE_FIRST_USER; ii <= TYPE_BASE_LAST_USER; ii++)
        SetScalarTypeName(ii, name, UndefinedType);

    // Add profile specific symbols and types:

    Cg->theHAL->RegisterNames(Cg->theHAL);
    AddAtom(atable, "<*** end hal specific atoms ***>");

    // Initialize misc. other globals:

    CurrentDeclTypeSpecs.basetype = UndefinedType;
    CurrentDeclTypeSpecs.IsDerived = 0;
    CurrentDeclTypeSpecs.type = *UndefinedType;

    return 1;
} // InitSymbolTable
예제 #14
0
파일: tokens.c 프로젝트: Bewolf2/Tiny2D
int ReadToken(TokenStream *pTok, yystypepp * yylvalpp)
{
    char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
    char string_val[MAX_STRING_LEN + 1];
    int ltoken, len;
    char ch;
    int base, accum;
    char ch_val;

    ltoken = lReadByte(pTok);
    if (ltoken >= 0) {
        if (ltoken > 127)
            ltoken += 128;
        switch (ltoken) {
        case CPP_IDENTIFIER:
        case CPP_TYPEIDENTIFIER:
            len = 0;
            ch = lReadByte(pTok);
            while ((ch >= 'a' && ch <= 'z') ||
                     (ch >= 'A' && ch <= 'Z') ||
                     (ch >= '0' && ch <= '9') ||
                     ch == '_')
            {
                if (len < MAX_SYMBOL_NAME_LEN) {
                    symbol_name[len++] = ch;
                    ch = lReadByte(pTok);
                }
            }
            symbol_name[len] = '\0';
            assert(ch == '\0');
            yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);
            return CPP_IDENTIFIER;
            break;
        case CPP_STRCONSTANT:
            len = 0;
            while ((ch = lReadByte(pTok)) != 0)
                if (len < MAX_STRING_LEN)
                    string_val[len++] = ch;
            string_val[len] = '\0';
            yylvalpp->sc_ident = LookUpAddString(atable, string_val);
            break;
        case CPP_FLOATCONSTANT:
            len = 0;
            ch = lReadByte(pTok);
            while ((ch >= '0' && ch <= '9')||(ch=='e'||ch=='E'||ch=='.')||(ch=='+'||ch=='-'))
            {
                if (len < MAX_SYMBOL_NAME_LEN) {
                    symbol_name[len++] = ch;
                    ch = lReadByte(pTok);
                }
            }
            symbol_name[len] = '\0';
            assert(ch == '\0');
            strcpy(yylvalpp->symbol_name,symbol_name);
            yylvalpp->sc_fval=(float)atof_dot(yylvalpp->symbol_name);
            break;
        case CPP_INTCONSTANT:
            len = 0;
	    accum = 0;
            ch = lReadByte(pTok);
            if (ch == '0') {
                symbol_name[len++] = ch;
                ch = lReadByte(pTok);
                if (ch == 'x' || ch == 'X') {
                    symbol_name[len++] = ch;
                    base = 16;
                    ch = lReadByte(pTok);
                } else {
                    base = 8;
                }
            } else {
                base = 10;
            }

            while (len < MAX_SYMBOL_NAME_LEN)
            {
                ch_val = -1;
                if (isdigit(ch))
                    ch_val = ch - '0';
                else if (isxdigit(ch))
                    ch_val = tolower(ch) - 'a' + 10;

                if (ch_val < 0 || ch_val >= base)
                    break;

                symbol_name[len++] = ch;
                accum = accum * base + ch_val;
                ch = lReadByte(pTok);
            }
            symbol_name[len] = '\0';
            assert(ch == '\0');
            strcpy(yylvalpp->symbol_name, symbol_name);
            yylvalpp->sc_int = accum;
            break;
        case '(':
            yylvalpp->sc_int = lReadByte(pTok);
            break;
        }
        return ltoken;
    }
    return EOF_SY;
} // ReadToken