1: /* 2: ** TOKENS.Y -- operator and keyword tables 3: ** 4: ** Defines: 5: ** Optab -- operator table 6: ** Kwrdtab -- keyword tables 7: ** Kwrdnum -- number of keywords (for binary search in getkey()) 8: ** Tokens -- so lexical routines can know about yacc tokens 9: ** 10: ** Requires: 11: ** Kwrdtab must be in alphabetical order!!! 12: ** 13: ** Version: 14: ** @(#)tokens.y 8.2 3/2/85 15: */ 16: 17: 18: struct optab Kwrdtab [] = 19: { 20: "abs", FOP, 0, 21: "all", ALL, 0, 22: "and", LBOP, 0, 23: "any", AOP, 0, 24: "append", APPEND, 0, 25: "ascii", FOP, 0, 26: "at", AT, 0, 27: "atan", FOP, 0, 28: "auto", ALLOC, opAUTO, 29: "avg", AOP, 0, 30: "avgu", AOP, 0, 31: "by", BY, 0, 32: "char", TYPE, opSTRING, 33: "concat", FBOP, 0, 34: "copy", COPY, 0, 35: "cos", FOP, 0, 36: "count", AOP, 0, 37: "countu", AOP, 0, 38: "create", CREATE, 0, 39: "define", DEFINE, 0, 40: "delete", DELETE, 0, 41: "delim", DELIM, 0, 42: "destroy", DESTROY, 0, 43: "double", TYPE, opDOUBLE, 44: "exit", EXIT, 0, 45: "extern", ALLOC, opEXTERN, 46: "float", TYPE, opFLOAT, 47: "float4", FOP, 4, 48: "float8", FOP, 8, 49: "from", FROM, 0, 50: "gamma", FOP, 0, 51: "help", HELP, 0, 52: "in", IN, 0, 53: "index", INDEX, 0, 54: "ingres", INGRES, 0, 55: "int", TYPE, opINT, 56: "int1", FOP, 1, 57: "int2", FOP, 2, 58: "int4", FOP, 4, 59: "integrity", INTEGRITY, 0, 60: "into", INTO, 0, 61: "is", IS, 0, 62: "log", FOP, 0, 63: "long", TYPE, opLONG, 64: "max", AOP, 0, 65: "min", AOP, 0, 66: "mod", FBOP, 0, 67: "modify", MODIFY, 0, 68: "not", LUOP, 0, 69: "of", OF, 0, 70: "on", ON, 0, 71: "onto", ONTO, 0, 72: "or", LBOP, 0, 73: "param", PARAM, 0, 74: "permit", PERMIT, 0, 75: "print", PRINT, 0, 76: "rand", FOP, 0, 77: "range", RANGE, 0, 78: "register", ALLOC, opREGISTER, 79: "replace", REPLACE, 0, 80: "retrieve", RETRIEVE, 0, 81: "save", SAVE, 0, 82: "short", TYPE, opSHORT, 83: "sin", FOP, 0, 84: "sqrt", FOP, 0, 85: "static", ALLOC, opSTATIC, 86: "struct", STRUCT, opSTRUCT, 87: "sum", AOP, 0, 88: "sumu", AOP, 0, 89: "to", TO, 0, 90: "unique", UNIQUE, 0, 91: "until", UNTIL, 0, 92: "unuse", UNUSE, 0, 93: "use", USE, 0, 94: "view", VIEW, 0, 95: "where", WHERE, 0, 96: }; 97: 98: /* This decalaration must be here as getkey references it, 99: ** and it must contain the number of elements in the 100: ** Kwrdtab, which is only known here 101: */ 102: 103: int Kwrdnum = sizeof Kwrdtab / sizeof Kwrdtab [0]; 104: 105: struct optab Optab [] = 106: { 107: /* PUNCTUATION */ 108: ",", COMMA, 0, 109: "(", LPAREN, 0, 110: ".", PERIOD, 0, 111: ")", RPAREN, 0, 112: "\"", QUOTE, 0, 113: "/*", BGNCMNT, 0, 114: "*/", ENDCMNT, 0, 115: "#", NONREF, 0, 116: ":", COLON, 0, 117: "$", DOLLAR, 0, 118: "%", PCT, 0, 119: 120: /* C LANUAGE PUNCTUATION */ 121: "{", LBRACE, 0, 122: "}", RBRACE, 0, 123: "[", LBRKT, 0, 124: "]", RBRKT, 0, 125: ";", SEMICOL, 0, 126: "->", POINTER, 0, 127: 128: /* UNARY ARITHMETIC OPERATORS */ 129: "+", UOP, 0, 130: "-", UOP, 0, 131: 132: /* BINARY ARITHMETIC OPERATORS */ 133: "*", BOP, 0, 134: "/", BOP, 0, 135: "**", BOP, 0, 136: "+", UAOP, 0, 137: "-", UAOP, 0, 138: 139: /* BOUNDS OPERATORS */ 140: ">", BDOP, 0, 141: ">=", BDOP, 0, 142: "<", BDOP, 0, 143: "<=", BDOP, 0, 144: 145: /* EQUALITY OPERATORS */ 146: "!=", EOP, 0, 147: "=", IS, 0, 148: 0 149: }; 150: 151: 152: struct special Tokens = 153: { 154: NAME, 155: SCONST, 156: I2CONST, 157: I4CONST, 158: F8CONST, 159: QUOTE, 160: BGNCMNT, 161: ENDCMNT, 162: C_CODE, 163: STRUCT_VAR, 164: };