From 0c70a330b3df1acd8be1fe191a45c57907f98ccf Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Mon, 15 Jan 1990 12:03:05 +0000 Subject: [PATCH] ING_DB --- WEGA/contrib/ingres/dbs/src/amx_cc/tables.y | 190 ++++++++++++++++++++ WEGA/contrib/ingres/dbs/src/eql/tokens.y | 169 +++++++++++++++++ WEGA/contrib/ingres/dbs/src/parser/tables.y | 149 +++++++++++++++ 3 files changed, 508 insertions(+) create mode 100644 WEGA/contrib/ingres/dbs/src/amx_cc/tables.y create mode 100644 WEGA/contrib/ingres/dbs/src/eql/tokens.y create mode 100644 WEGA/contrib/ingres/dbs/src/parser/tables.y diff --git a/WEGA/contrib/ingres/dbs/src/amx_cc/tables.y b/WEGA/contrib/ingres/dbs/src/amx_cc/tables.y new file mode 100644 index 0000000..3ccd92d --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/amx_cc/tables.y @@ -0,0 +1,190 @@ +/* +** SCANNER KEYWORD AND OPERATOR TABLES +** +** Keywords, Tokens, and Opcode tuples are included +** in this file the keyword table MUST be in sorted +** order. The operator table does not need to be +** sorted. +*/ + +OPTAB Keyword[] = +{ +/* term token opcode +** -------------------------------------- */ +# ifdef PAGE_LOCKING + "abort", ABORT, 0, +# endif + "and", COMMA, 0, + "append", APPEND, 0, + "auto", ALLOC, opAUTO, + "break", GOTO, 1, + "char", TYPE, opSTRING, + "close", CLOSE, 0, + "closedb", EXIT, 0, + "commit", COMMIT, 0, + "continue", GOTO, 0, + "daba", DBS, M_EXCL, +# ifdef PAGE_LOCKING + "deadlock", DEADLK, 0, +# endif + "delete", DELETE, 0, + "double", TYPE, opDOUBLE, + "endretrieve", GOTO, 1, + "exclusive", DBS, M_EXCL, +# ifdef AMX_SC + "export", EXPORT, 0, +# endif + "extern", ALLOC, opEXTERN, +# ifndef EBCDIC + "f4", TYPE, +# ifdef NO_F4 + opDOUBLE, +# else + opFLT, +# endif + "f8", TYPE, opDOUBLE, +# endif + "float", TYPE, +# ifdef NO_F4 + opDOUBLE, +# else + opFLT, +# endif +# ifdef EBCDIC + "f4", TYPE, +# ifdef NO_F4 + opDOUBLE, +# else + opFLT, +# endif + "f8", TYPE, opDOUBLE, +# endif + "get", GET, 0, + "group", USER, 1, +# ifndef EBCDIC + "i1", TYPE, opINT, + "i2", TYPE, opINT, + "i4", TYPE, opLONG, +# endif +# ifdef PAGE_LOCKING + "if", IF, 0, +# endif +# ifdef AMX_SC + "import", IMPORT, 0, +# endif + "ing_db", DBS, M_EXCL, + "insert", INSERT, 0, + "int", TYPE, +# ifdef BIT_32 + opLONG, +# else + opINT, +# endif +# ifdef EBCDIC + "i1", TYPE, opINT, + "i2", TYPE, opINT, + "i4", TYPE, opLONG, +# endif +# ifdef PAGE_LOCKING + "level", LEVEL, 0, +# endif + "long", TYPE, opLONG, +# ifdef PAGE_LOCKING + "maxlocks", MAXLK, 0, +# endif + "nextretrieve", GOTO, 0, + "nolock", DBS, 0, + "open", OPEN, 0, + "over", OVER, 0, +# ifdef PAGE_LOCKING + "page", RL_PG, M_REL, +# endif + "permit", PERMIT, 0, + "print", PRINT, 0, +# ifdef PAGE_LOCKING + "readlock", READLK, 0, +# endif + "replace", REPLACE, 0, + "retrieve", SCAN, 0, + "scan", SCAN, 0, + "shared", DBS, M_SHARE, + "short", TYPE, opINT, + "static", ALLOC, opSTATIC, +# ifdef PAGE_LOCKING + "table", RL_PG, 0, +# endif + "tid", TYPE, opLONG, +# ifdef PAGE_LOCKING + "timeout", TIMEOUT, 0, +# endif + "tuplecount", COUNT, 0, + "tuplelength", LENGTH, 0, + "use", USE, 0, + "user", USER, 0, +# ifdef PAGE_LOCKING + "with", WITH, 0, +# endif +/* -------------------------------------- */ +}; +int Keyent = sizeof Keyword / sizeof Keyword[0]; + +OPTAB Optab[] = +{ +/* PUNCTUATION +** -------------------------------------- +** term token opcode +** -------------------------------------- */ + "(", LPAREN, 0, + ")", RPAREN, 0, + "{", LBRACE, 0, + "}", RBRACE, 0, + "[", LBRKT, 0, + "]", RBRKT, 0, + "\/\*", BGNCMNT, 0, + "\*\/", ENDCMNT, 0, + "\"", SCONST, 0, + "$", DOM, 0, + "+", PLUS, 0, + "-", MINUS, 0, + ",", COMMA, 0, + ";", SEMICOL, 0, + "*", STAR, 0, +/* -------------------------------------- +** +** BOUNDS OPERATORS +** -------------------------------------- +** term token opcode +** -------------------------------------- */ + ">", BDOP, AP_GT, + ">=", BDOP, AP_GT | AP_GE, + "<", BDOP, AP_LT, + "<=", BDOP, AP_LT | AP_LE, +/* -------------------------------------- +** +** EQUALITY OPERATORS +** -------------------------------------- +** term token opcode +** -------------------------------------- */ + "=", IS, AP_EQ, + "==", IS, AP_EQ, + "<>", BDOP, AP_NE, + "!=", BDOP, AP_NE, +/* -------------------------------------- */ + (char *) 0 +}; + +/* +** Tokens +** A structur initialized here to contain the YACC +** generated tokens for the indicated terminal symbols. +*/ +struct special Tokens = +{ + /* name = */ NAME, + /* sconst = */ SCONST, + /* bgncmnt = */ BGNCMNT, + /* endcmnt = */ ENDCMNT, + /* iconst = */ ICONST, + /* lconst = */ LCONST, + /* rconst = */ RCONST +}; diff --git a/WEGA/contrib/ingres/dbs/src/eql/tokens.y b/WEGA/contrib/ingres/dbs/src/eql/tokens.y new file mode 100644 index 0000000..3af131a --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/eql/tokens.y @@ -0,0 +1,169 @@ +/* +** TOKENS.Y -- operator and keyword tables +** +** Defines: +** Optab -- operator table +** Kwrdtab -- keyword tables +** Kwrdnum -- number of keywords (for binary search in getkey()) +** Tokens -- so lexical routines can know about yacc tokens +*/ + +struct optab Kwrdtab[] = +{ + "all", ALL, 0, + "and", LBOP, 0, + "any", AOP, 0, + "append", APPEND, 0, + "ascii", FOP, 0, + "at", AT, 0, + "atan", FOP, 0, + "auto", ALLOC, opAUTO, + "avg", AOP, 0, + "avgu", AOP, 0, + "by", BY, 0, + "char", TYPE, opSTRING, + "concat", FBOP, 0, + "copy", COPY, 0, + "cos", FOP, 0, + "count", AOP, 0, + "countu", AOP, 0, + "create", CREATE, 0, + "daba", DBS, 0, + "define", DEFINE, 0, + "delete", DELETE, 0, + "destroy", DESTROY, 0, + "double", TYPE, opDOUBLE, + "exit", EXIT, 0, + "extern", ALLOC, opEXTERN, + "float", TYPE, +# ifdef NO_F4 + opDOUBLE, +# else + opFLT, +# endif + "float4", FOP, +# ifdef NO_F4 + sizeof (double), +# else + sizeof (float), +# endif + "float8", FOP, sizeof (double), + "from", FROM, 0, + "gamma", FOP, 0, + "help", HELP, 0, + "in", IN, 0, + "index", INDEX, 0, + "ing_db", DBS, 0, +# ifdef BIT_32 + "int", TYPE, opLONG, +# else + "int", TYPE, opINT, +# endif +# ifndef EBCDIC + "int1", FOP, sizeof (char), + "int2", FOP, sizeof (short), + "int4", FOP, sizeof (long), +# endif + "integrity", INTEGRITY, 0, + "into", INTO, 0, +# ifdef EBCDIC + "int1", FOP, sizeof (char), + "int2", FOP, sizeof (short), + "int4", FOP, sizeof (long), +# endif + "is", IS, 0, + "log", FOP, 0, + "long", TYPE, opLONG, + "max", AOP, 0, + "min", AOP, 0, + "mod", FBOP, 0, + "modify", MODIFY, 0, + "not", LUOP, 0, + "of", OF, 0, + "on", ON, 0, + "or", LBOP, 0, + "param", PARAM, 0, + "permit", PERMIT, 0, + "print", PRINT, 0, + "rand", FOP, 0, + "range", RANGE, 0, + "register", ALLOC, opREGISTER, + "replace", REPLACE, 0, + "retrieve", RETRIEVE, 0, + "save", SAVE, 0, + "short", TYPE, opINT, + "sin", FOP, 0, + "sqrt", FOP, 0, + "static", ALLOC, opSTATIC, + "struct", STRUCT, opSTRUCT, + "sum", AOP, 0, + "sumu", AOP, 0, + "to", TO, 0, + "unique", UNIQUE, 0, + "until", UNTIL, 0, + "view", VIEW, 0, + "where", WHERE, 0, +}; + +/* This decalaration must be here as getkey references it, +** and it must contain the number of elements in the +** Kwrdtab, which is only known here +*/ + +int Kwrdnum = sizeof Kwrdtab / sizeof Kwrdtab[0]; + +struct optab Optab[] = +{ + /* PUNCTUATION */ + ",", COMMA, 0, + "(", LPAREN, 0, + ".", PERIOD, 0, + ")", RPAREN, 0, + "\"", QUOTE, 0, + "\/\*", BGNCMNT, 0, + "\*\/", ENDCMNT, 0, + "#", NONREF, 0, + ":", COLON, 0, + + /* C LANUAGE PUNCTUATION */ + "{", LBRACE, 0, + "}", RBRACE, 0, + "[", LBRKT, 0, + "]", RBRKT, 0, + ";", SEMICOL, 0, + "->", POINTER, 0, + + /* UNARY ARITHMETIC OPERATORS */ + "+", UOP, 0, + "-", UOP, 0, + + /* BINARY ARITHMETIC OPERATORS */ + "*", BOP, 0, + "/", BOP, 0, + "**", BOP, 0, + + /* BOUNDS OPERATORS */ + ">", BDOP, 0, + ">=", BDOP, 0, + "<", BDOP, 0, + "<=", BDOP, 0, + + /* EQUALITY OPERATORS */ + "!=", EOP, 0, + "=", IS, 0, + (char *) 0 +}; + +struct special Tokens = +{ + NAME, + SCONST, + I2CONST, + I4CONST, + F8CONST, + QUOTE, + BGNCMNT, + ENDCMNT, + C_CODE, + STRUCT_VAR, +}; diff --git a/WEGA/contrib/ingres/dbs/src/parser/tables.y b/WEGA/contrib/ingres/dbs/src/parser/tables.y new file mode 100644 index 0000000..090fd3a --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/parser/tables.y @@ -0,0 +1,149 @@ +/* +** SCANNER KEYWORD TABLES +** +** Keywords, tokens, and opcode tuples are included in this file +** The keyword table MUST be in sorted order. +** The operator table does not need to be sorted +*/ +struct optab Keyword[] = +{ + "abs", FOP, (short) opABS, + "all", ALL, 0, + "and", LBOP, AND, + "any", AGOP, (short) opANY, + "append", APPEND, GOVAL, + "ascii", FOP, (short) opASCII, + "at", AT, 0, + "atan", FOP, (short) opATAN, + "avg", AGOP, (short) opAVG, + "avgu", AGOP, (short) opAVGU, + "by", BY, (short) opEQ, + "concat", FBOP, (short) opCONCAT, + "copy", COPY, GOVAL, + "cos", FOP, (short) opCOS, + "count", AGOP, (short) opCNT, + "countu", AGOP, (short) opCNTU, + "create", CREATE, GOVAL, + "define", DEFINE, GOVAL, + "delete", DELETE, GOVAL, + "destroy", DESTROY, GOVAL, +# ifdef DISTRIB + "distribute", DISTRIBUTE, 0, + "distributed", DISTRD, 0, +# endif + "exp", FOP, (short) opEXP, + "float4", FOP, +# ifndef NO_F4 + (short) opFLT4, +# else + opFLT8, +# endif + "float8", FOP, (short) opFLT8, + "from", FROM, 0, + "help", HELP, GOVAL, + "in", IN, 0, + "index", INDEX, GOVAL, +# ifndef EBCDIC + "int1", FOP, (short) opINT1, + "int2", FOP, (short) opINT2, + "int4", FOP, (short) opINT4, +# endif + "integrity", INTEGRITY, 0, + "into", INTO, 0, +# ifdef EBCDIC + "int1", FOP, opINT1, + "int2", FOP, opINT2, + "int4", FOP, opINT4, +# endif + "is", IS, (short) opEQ, + "log", FOP, (short) opLOG, + "max", AGOP, (short) opMAX, + "min", AGOP, (short) opMIN, + "mod", FBOP, (short) opMOD, + "modify", MODIFY, GOVAL, + "not", LUOP, (short) opNOT, + "of", OF, 0, + "on", ON, 0, + "or", LBOP, OR, + "permit", PERMIT, 0, + "print", PRINT, GOVAL, + "range", RANGE, GOVAL, + "replace", REPLACE, GOVAL, + "retrieve", RETRIEVE, GOVAL, + "save", SAVE, GOVAL, + "sin", FOP, (short) opSIN, + "sqrt", FOP, (short) opSQRT, + "sum", AGOP, (short) opSUM, + "sumu", AGOP, (short) opSUMU, + "to", TO, 0, + "unique", UNIQUE, 0, + "until", UNTIL, 0, + "view", VIEW, 0, + "where", WHERE, 0, +}; +int Keyent = sizeof Keyword / sizeof Keyword[0]; + +struct optab Optab[] = +{ + /* PUNCTUATION */ + ",", COMMA, 0, + "(", LPAREN, 0, + ".", PERIOD, 0, + ")", RPAREN, 0, + "\"", SCONST, 0, + "\/\*", BGNCMNT, 0, + "\*\/", ENDCMNT, 0, + ":", COLON, 0, + + /* UNARY ARITHMETIC OPERATORS */ + "+", UAOP, (short) opADD, + "-", UAOP, (short) opSUB, + + /* BINARY ARITHMETIC OPERATORS */ + "*", BAOP, (short) opMUL, + "/", BAOP, (short) opDIV, + "**", BAOPH, (short) opPOW, + + /* BOUNDS OPERATORS */ + ">", BDOP, (short) opGT, + ">=", BDOP, (short) opGE, + "<", BDOP, (short) opLT, + "<=", BDOP, (short) opLE, + + /* EQUALITY OPERATORS */ + "!=", EOP, (short) opNE, + "=", IS, (short) opEQ, + (char *) 0 +}; + +/* constant operators table for lookup */ +struct constop Coptab[] = +{ + "dba", (short) opDBA, CHAR, 2, + "usercode", (short) opUSERCODE, CHAR, 2, + (char *) 0, 0, 0, 0, + "date", (short) opDATE, '?', '?', + "time", (short) opDATE, '?', '?', + (char *) 0, 0, 0, 0 +}; + + +/* +** Tokens +** a structure initialized here to contain the +** yacc generated tokens for the indicated +** terminal symbols. +*/ +struct special Tokens = +{ + SCONST, + BGNCMNT, + ENDCMNT, + I2CONST, + I4CONST, +# ifndef NO_F4 + F4CONST, +# endif + F8CONST, + NAME +};