1 /* 2 * 3 * Glenn Fowler 4 * AT&T Research 5 * 6 * @(#)pp.tab (AT&T Labs Research) 2006-05-09 7 * 8 * C preprocessor tables and states 9 * 10 * + marks extensions to the standard 11 * 12 */ 13 14 static struct ppkeyword directives[] = 15 { 16 "define", DEFINE, 17 "elif", ELIF, 18 "else", ELSE, 19 "endif", ENDIF, 20 "+endmac", ENDMAC, 21 "error", ERROR, 22 "if", IF, 23 "ifdef", IFDEF, 24 "ifndef", IFNDEF, 25 "include", INCLUDE, 26 "+let", LET, 27 "line", LINE, 28 "+macdef", MACDEF, 29 "pragma", PRAGMA, 30 "+rename", RENAME, 31 "undef", UNDEF, 32 "+warning", WARNING, 33 0, 0 34 }; 35 36 static struct ppkeyword options[] = 37 { 38 "allmultiple", X_ALLMULTIPLE, 39 "allpossible", X_ALLPOSSIBLE, 40 "builtin", X_BUILTIN, 41 "catliteral", X_CATLITERAL, 42 "cdir", X_CDIR, 43 "checkpoint", X_CHECKPOINT, 44 "chop", X_CHOP, 45 "compatibility", X_COMPATIBILITY, 46 "debug", X_DEBUG, 47 "elseif", X_ELSEIF, 48 "externalize", X_EXTERNALIZE, 49 "final", X_FINAL, 50 "hide", X_HIDE, 51 "headerexpand", X_HEADEREXPAND, 52 "headerexpandall", X_HEADEREXPANDALL, 53 "hosted", X_HOSTED, 54 "hostedtransition", X_HOSTEDTRANSITION, 55 "hostdir", X_HOSTDIR, 56 "id", X_ID, 57 "ignore", X_IGNORE, 58 "include", X_INCLUDE, 59 "initial", X_INITIAL, 60 "keyargs", X_KEYARGS, 61 "line", X_LINE, 62 "linebase", X_LINEBASE, 63 "linefile", X_LINEFILE, 64 "lineid", X_LINEID, 65 "linetype", X_LINETYPE, 66 "macref", X_MACREF, 67 "map", X_MAP, 68 "mapinclude", X_MAPINCLUDE, 69 "modern", X_MODERN, 70 "multiple", X_MULTIPLE, 71 "native", X_NATIVE, 72 "note", X_NOTE, 73 "opspace", X_OPSPACE, 74 "passthrough", X_PASSTHROUGH, 75 "pedantic", X_PEDANTIC, 76 "pluscomment", X_PLUSCOMMENT, 77 "plusplus", X_PLUSPLUS, 78 "plussplice", X_PLUSSPLICE, 79 "pragmaflags", X_PRAGMAFLAGS, 80 "pragmaexpand", X_PRAGMAEXPAND, 81 "predefined", X_PREDEFINED, 82 "prefix", X_PREFIX, 83 "preserve", X_PRESERVE, 84 "proto", X_PROTO, 85 "prototyped", X_PROTOTYPED, 86 "quote", X_QUOTE, 87 "readonly", X_READONLY, 88 "reguard", X_REGUARD, 89 "reserved", X_RESERVED, 90 "spaceout", X_SPACEOUT, 91 "splicecat", X_SPLICECAT, 92 "splicespace", X_SPLICESPACE, 93 "standard", X_STANDARD, 94 "statement", X_STATEMENT, 95 "strict", X_STRICT, 96 "stringspan", X_STRINGSPAN, 97 "stringsplit", X_STRINGSPLIT, 98 "system_header", X_SYSTEM_HEADER, 99 "test", X_TEST, 100 "text", X_TEXT, 101 "transition", X_TRANSITION, 102 "truncate", X_TRUNCATE, 103 "vendor", X_VENDOR, 104 "version", X_VERSION, 105 "warn", X_WARN, 106 "zeof", X_ZEOF, 107 0, 0 108 }; 109 110 static struct ppkeyword predicates[] = 111 { 112 "defined", X_DEFINED, 113 "+exists", X_EXISTS, 114 "+included", X_INCLUDED, 115 "+match", X_MATCH, 116 "+noticed", X_NOTICED, 117 "+option", X_OPTION, 118 "sizeof", X_SIZEOF, 119 "+strcmp", X_STRCMP, 120 0, 0 121 }; 122 123 static struct ppkeyword readonlys[] = 124 { 125 "defined", R_DEFINED, 126 0, 0 127 }; 128 129 static struct ppkeyword variables[] = 130 { 131 "_Pragma", V__PRAGMA, 132 "+ARGC", V_ARGC, 133 "+BASE", V_BASE, 134 "DATE", V_DATE, 135 "FILE", V_FILE, 136 "+FUNCTION", V_FUNCTION, 137 "LINE", V_LINE, 138 "+PATH", V_PATH, 139 "+SOURCE", V_SOURCE, 140 "-STDC", V_STDC, 141 "TIME", V_TIME, 142 "+VERSION", V_VERSION, 143 "-default", V_DEFAULT, 144 "-directive", V_DIRECTIVE, 145 "-empty", V_EMPTY, 146 "-getenv", V_GETENV, 147 "-getmac", V_GETMAC, 148 "-getopt", V_GETOPT, 149 "-getprd", V_GETPRD, 150 "-iterate", V_ITERATE, 151 0, 0 152 }; 153