/* records */ static void parseKeywords (tokenInfo * const token, boolean local) { switch (token->keyword) { case KEYWORD_END: fileSkipToCharacter (';'); break; case KEYWORD_CONSTANT: parseConstant (local); break; case KEYWORD_TYPE: parseTypes (token); break; case KEYWORD_SUBTYPE: parseTypes (token); break; case KEYWORD_ENTITY: parseModule (token); break; case KEYWORD_COMPONENT: parseModule (token); break; case KEYWORD_FUNCTION: parseSubProgram (token); break; case KEYWORD_PROCEDURE: parseSubProgram (token); break; case KEYWORD_PACKAGE: parsePackage (token); break; default: break; } }
static void parseBlock (tokenInfo *const token, const boolean local) { int depth = 1; while (depth > 0) { readToken (token); switch (token->keyword) { default: if (isType (token, TOKEN_IDENTIFIER)) { if (local) makeSqlTag (token, SQLTAG_LOCAL_VARIABLE); else makeSqlTag (token, SQLTAG_VARIABLE); } break; case KEYWORD_cursor: parseSimple (token, SQLTAG_CURSOR); break; case KEYWORD_function: parseSubProgram (token); break; case KEYWORD_procedure: parseSubProgram (token); break; case KEYWORD_subtype: parseSimple (token, SQLTAG_SUBTYPE); break; case KEYWORD_trigger: parseSimple (token, SQLTAG_TRIGGER); break; case KEYWORD_type: parseType (token); break; case KEYWORD_end: --depth; break; case KEYWORD_begin: { while (depth > 0) { switch (token->keyword) { case KEYWORD_if: case KEYWORD_loop: ++depth; readToken (token); break; case KEYWORD_end: --depth; findToken (token, TOKEN_SEMICOLON); break; default: readToken (token); break; } } break; } } findToken (token, TOKEN_SEMICOLON); } }
static void parseSqlFile (tokenInfo *const token) { do { readToken (token); switch (token->keyword) { case KEYWORD_cursor: parseSimple (token, SQLTAG_CURSOR); break; case KEYWORD_declare: parseBlock (token, FALSE); break; case KEYWORD_function: parseSubProgram (token); break; case KEYWORD_package: parsePackage (token); break; case KEYWORD_procedure: parseSubProgram (token); break; case KEYWORD_subtype: parseSimple (token, SQLTAG_SUBTYPE); break; case KEYWORD_table: parseTable (token); break; case KEYWORD_trigger: parseSimple (token, SQLTAG_TRIGGER); break; case KEYWORD_type: parseType (token); break; default: break; } } while (! isKeyword (token, KEYWORD_end)); }