| 1 | /* flex - tool to generate fast lexical analyzers */
|
|---|
| 2 |
|
|---|
| 3 | /* Copyright (c) 1990 The Regents of the University of California. */
|
|---|
| 4 | /* All rights reserved. */
|
|---|
| 5 |
|
|---|
| 6 | /* This code is derived from software contributed to Berkeley by */
|
|---|
| 7 | /* Vern Paxson. */
|
|---|
| 8 |
|
|---|
| 9 | /* The United States Government has rights in this work pursuant */
|
|---|
| 10 | /* to contract no. DE-AC03-76SF00098 between the United States */
|
|---|
| 11 | /* Department of Energy and the University of California. */
|
|---|
| 12 |
|
|---|
| 13 | /* This file is part of flex. */
|
|---|
| 14 |
|
|---|
| 15 | /* Redistribution and use in source and binary forms, with or without */
|
|---|
| 16 | /* modification, are permitted provided that the following conditions */
|
|---|
| 17 | /* are met: */
|
|---|
| 18 |
|
|---|
| 19 | /* 1. Redistributions of source code must retain the above copyright */
|
|---|
| 20 | /* notice, this list of conditions and the following disclaimer. */
|
|---|
| 21 | /* 2. Redistributions in binary form must reproduce the above copyright */
|
|---|
| 22 | /* notice, this list of conditions and the following disclaimer in the */
|
|---|
| 23 | /* documentation and/or other materials provided with the distribution. */
|
|---|
| 24 |
|
|---|
| 25 | /* Neither the name of the University nor the names of its contributors */
|
|---|
| 26 | /* may be used to endorse or promote products derived from this software */
|
|---|
| 27 | /* without specific prior written permission. */
|
|---|
| 28 |
|
|---|
| 29 | /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
|
|---|
| 30 | /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
|
|---|
| 31 | /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
|
|---|
| 32 | /* PURPOSE. */
|
|---|
| 33 | |
|---|
| 34 |
|
|---|
| 35 | #include "options.h"
|
|---|
| 36 |
|
|---|
| 37 | /* Be sure to synchronize these options with those defined in "options.h",
|
|---|
| 38 | * the giant switch() statement in "main.c", and the %option processing in
|
|---|
| 39 | * "scan.l".
|
|---|
| 40 | */
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 | /* The command-line options, passed to scanopt_init() */
|
|---|
| 44 | optspec_t flexopts[] = {
|
|---|
| 45 |
|
|---|
| 46 | {"-7", OPT_7BIT, 0}
|
|---|
| 47 | ,
|
|---|
| 48 | {"--7bit", OPT_7BIT, 0}
|
|---|
| 49 | , /* Generate 7-bit scanner. */
|
|---|
| 50 | {"-8", OPT_8BIT, 0}
|
|---|
| 51 | ,
|
|---|
| 52 | {"--8bit", OPT_8BIT, 0}
|
|---|
| 53 | , /* Generate 8-bit scanner. */
|
|---|
| 54 | {"--align", OPT_ALIGN, 0}
|
|---|
| 55 | , /* Trade off larger tables for better memory alignment. */
|
|---|
| 56 | {"--noalign", OPT_NO_ALIGN, 0}
|
|---|
| 57 | ,
|
|---|
| 58 | {"--always-interactive", OPT_ALWAYS_INTERACTIVE, 0}
|
|---|
| 59 | ,
|
|---|
| 60 | {"--array", OPT_ARRAY, 0}
|
|---|
| 61 | ,
|
|---|
| 62 | {"-b", OPT_BACKUP, 0}
|
|---|
| 63 | ,
|
|---|
| 64 | {"--backup", OPT_BACKUP, 0}
|
|---|
| 65 | , /* Generate backing-up information to lex.backup. */
|
|---|
| 66 | {"-B", OPT_BATCH, 0}
|
|---|
| 67 | ,
|
|---|
| 68 | {"--batch", OPT_BATCH, 0}
|
|---|
| 69 | , /* Generate batch scanner (opposite of -I). */
|
|---|
| 70 | {"--bison-bridge", OPT_BISON_BRIDGE, 0}
|
|---|
| 71 | , /* Scanner to be called by a bison pure parser. */
|
|---|
| 72 | {"--bison-locations", OPT_BISON_BRIDGE_LOCATIONS, 0}
|
|---|
| 73 | , /* Scanner to be called by a bison pure parser. */
|
|---|
| 74 | {"-i", OPT_CASE_INSENSITIVE, 0}
|
|---|
| 75 | ,
|
|---|
| 76 | {"--case-insensitive", OPT_CASE_INSENSITIVE, 0}
|
|---|
| 77 | , /* Generate case-insensitive scanner. */
|
|---|
| 78 |
|
|---|
| 79 | {"-C[aefFmr]", OPT_COMPRESSION,
|
|---|
| 80 | "Specify degree of table compression (default is -Cem)"},
|
|---|
| 81 | {"-+", OPT_CPLUSPLUS, 0}
|
|---|
| 82 | ,
|
|---|
| 83 | {"--c++", OPT_CPLUSPLUS, 0}
|
|---|
| 84 | , /* Generate C++ scanner class. */
|
|---|
| 85 | {"-d", OPT_DEBUG, 0}
|
|---|
| 86 | ,
|
|---|
| 87 | {"--debug", OPT_DEBUG, 0}
|
|---|
| 88 | , /* Turn on debug mode in generated scanner. */
|
|---|
| 89 | {"--nodebug", OPT_NO_DEBUG, 0}
|
|---|
| 90 | ,
|
|---|
| 91 | {"-s", OPT_NO_DEFAULT, 0}
|
|---|
| 92 | ,
|
|---|
| 93 | {"--nodefault", OPT_NO_DEFAULT, 0}
|
|---|
| 94 | , /* Suppress default rule to ECHO unmatched text. */
|
|---|
| 95 | {"--default", OPT_DEFAULT, 0}
|
|---|
| 96 | ,
|
|---|
| 97 | {"-c", OPT_DONOTHING, 0}
|
|---|
| 98 | , /* For POSIX lex compatibility. */
|
|---|
| 99 | {"-n", OPT_DONOTHING, 0}
|
|---|
| 100 | , /* For POSIX lex compatibility. */
|
|---|
| 101 | {"--ecs", OPT_ECS, 0}
|
|---|
| 102 | , /* Construct equivalence classes. */
|
|---|
| 103 | {"--noecs", OPT_NO_ECS, 0}
|
|---|
| 104 | ,
|
|---|
| 105 | {"-F", OPT_FAST, 0}
|
|---|
| 106 | ,
|
|---|
| 107 | {"--fast", OPT_FAST, 0}
|
|---|
| 108 | , /* Same as -CFr. */
|
|---|
| 109 | {"-f", OPT_FULL, 0}
|
|---|
| 110 | ,
|
|---|
| 111 | {"--full", OPT_FULL, 0}
|
|---|
| 112 | , /* Same as -Cfr. */
|
|---|
| 113 | {"--header-file[=FILE]", OPT_HEADER_FILE, 0}
|
|---|
| 114 | ,
|
|---|
| 115 | {"-?", OPT_HELP, 0}
|
|---|
| 116 | ,
|
|---|
| 117 | {"-h", OPT_HELP, 0}
|
|---|
| 118 | ,
|
|---|
| 119 | {"--help", OPT_HELP, 0}
|
|---|
| 120 | , /* Produce this help message. */
|
|---|
| 121 | {"-I", OPT_INTERACTIVE, 0}
|
|---|
| 122 | ,
|
|---|
| 123 | {"--interactive", OPT_INTERACTIVE, 0}
|
|---|
| 124 | , /* Generate interactive scanner (opposite of -B). */
|
|---|
| 125 | {"-l", OPT_LEX_COMPAT, 0}
|
|---|
| 126 | ,
|
|---|
| 127 | {"--lex-compat", OPT_LEX_COMPAT, 0}
|
|---|
| 128 | , /* Maximal compatibility with original lex. */
|
|---|
| 129 | {"-X", OPT_POSIX_COMPAT, 0}
|
|---|
| 130 | ,
|
|---|
| 131 | {"--posix-compat", OPT_POSIX_COMPAT, 0}
|
|---|
| 132 | , /* Maximal compatibility with POSIX lex. */
|
|---|
| 133 | {"--preproc=NUM", OPT_PREPROC_LEVEL, 0}
|
|---|
| 134 | ,
|
|---|
| 135 | {"-L", OPT_NO_LINE, 0}
|
|---|
| 136 | , /* Suppress #line directives in scanner. */
|
|---|
| 137 | {"--noline", OPT_NO_LINE, 0}
|
|---|
| 138 | , /* Suppress #line directives in scanner. */
|
|---|
| 139 | {"--main", OPT_MAIN, 0}
|
|---|
| 140 | , /* use built-in main() function. */
|
|---|
| 141 | {"--nomain", OPT_NO_MAIN, 0}
|
|---|
| 142 | ,
|
|---|
| 143 | {"--meta-ecs", OPT_META_ECS, 0}
|
|---|
| 144 | , /* Construct meta-equivalence classes. */
|
|---|
| 145 | {"--nometa-ecs", OPT_NO_META_ECS, 0}
|
|---|
| 146 | ,
|
|---|
| 147 | {"--never-interactive", OPT_NEVER_INTERACTIVE, 0}
|
|---|
| 148 | ,
|
|---|
| 149 | {"-o FILE", OPT_OUTFILE, 0}
|
|---|
| 150 | ,
|
|---|
| 151 | {"--outfile=FILE", OPT_OUTFILE, 0}
|
|---|
| 152 | , /* Write to FILE (default is lex.yy.c) */
|
|---|
| 153 | {"-p", OPT_PERF_REPORT, 0}
|
|---|
| 154 | ,
|
|---|
| 155 | {"--perf-report", OPT_PERF_REPORT, 0}
|
|---|
| 156 | , /* Generate performance report to stderr. */
|
|---|
| 157 | {"--pointer", OPT_POINTER, 0}
|
|---|
| 158 | ,
|
|---|
| 159 | {"-P PREFIX", OPT_PREFIX, 0}
|
|---|
| 160 | ,
|
|---|
| 161 | {"--prefix=PREFIX", OPT_PREFIX, 0}
|
|---|
| 162 | , /* Use PREFIX (default is yy) */
|
|---|
| 163 | {"-Dmacro", OPT_PREPROCDEFINE, 0}
|
|---|
| 164 | , /* Define a preprocessor symbol. */
|
|---|
| 165 | {"--read", OPT_READ, 0}
|
|---|
| 166 | , /* Use read(2) instead of stdio. */
|
|---|
| 167 | {"-R", OPT_REENTRANT, 0}
|
|---|
| 168 | ,
|
|---|
| 169 | {"--reentrant", OPT_REENTRANT, 0}
|
|---|
| 170 | , /* Generate a reentrant C scanner. */
|
|---|
| 171 | {"--noreentrant", OPT_NO_REENTRANT, 0}
|
|---|
| 172 | ,
|
|---|
| 173 | {"--reject", OPT_REJECT, 0}
|
|---|
| 174 | ,
|
|---|
| 175 | {"--noreject", OPT_NO_REJECT, 0}
|
|---|
| 176 | ,
|
|---|
| 177 | {"-S FILE", OPT_SKEL, 0}
|
|---|
| 178 | ,
|
|---|
| 179 | {"--skel=FILE", OPT_SKEL, 0}
|
|---|
| 180 | , /* Use skeleton from FILE */
|
|---|
| 181 | {"--stack", OPT_STACK, 0}
|
|---|
| 182 | ,
|
|---|
| 183 | {"--stdinit", OPT_STDINIT, 0}
|
|---|
| 184 | ,
|
|---|
| 185 | {"--nostdinit", OPT_NO_STDINIT, 0}
|
|---|
| 186 | ,
|
|---|
| 187 | {"-t", OPT_STDOUT, 0}
|
|---|
| 188 | ,
|
|---|
| 189 | {"--stdout", OPT_STDOUT, 0}
|
|---|
| 190 | , /* Write generated scanner to stdout. */
|
|---|
| 191 | {"-T", OPT_TRACE, 0}
|
|---|
| 192 | ,
|
|---|
| 193 | {"--trace", OPT_TRACE, 0}
|
|---|
| 194 | , /* Flex should run in trace mode. */
|
|---|
| 195 | {"--tables-file[=FILE]", OPT_TABLES_FILE, 0}
|
|---|
| 196 | , /* Save tables to FILE */
|
|---|
| 197 | {"--tables-verify", OPT_TABLES_VERIFY, 0}
|
|---|
| 198 | , /* Tables integrity check */
|
|---|
| 199 | {"--nounistd", OPT_NO_UNISTD_H, 0}
|
|---|
| 200 | , /* Do not include unistd.h */
|
|---|
| 201 | {"-v", OPT_VERBOSE, 0}
|
|---|
| 202 | ,
|
|---|
| 203 | {"--verbose", OPT_VERBOSE, 0}
|
|---|
| 204 | , /* Write summary of scanner statistics to stdout. */
|
|---|
| 205 | {"-V", OPT_VERSION, 0}
|
|---|
| 206 | ,
|
|---|
| 207 | {"--version", OPT_VERSION, 0}
|
|---|
| 208 | , /* Report flex version. */
|
|---|
| 209 | {"--warn", OPT_WARN, 0}
|
|---|
| 210 | ,
|
|---|
| 211 | {"-w", OPT_NO_WARN, 0}
|
|---|
| 212 | ,
|
|---|
| 213 | {"--nowarn", OPT_NO_WARN, 0}
|
|---|
| 214 | , /* Suppress warning messages. */
|
|---|
| 215 | {"--noansi-definitions", OPT_NO_ANSI_FUNC_DEFS, 0}
|
|---|
| 216 | ,
|
|---|
| 217 | {"--noansi-prototypes", OPT_NO_ANSI_FUNC_PROTOS, 0}
|
|---|
| 218 | ,
|
|---|
| 219 | {"--yyclass=NAME", OPT_YYCLASS, 0}
|
|---|
| 220 | ,
|
|---|
| 221 | {"--yylineno", OPT_YYLINENO, 0}
|
|---|
| 222 | ,
|
|---|
| 223 | {"--noyylineno", OPT_NO_YYLINENO, 0}
|
|---|
| 224 | ,
|
|---|
| 225 |
|
|---|
| 226 | {"--yymore", OPT_YYMORE, 0}
|
|---|
| 227 | ,
|
|---|
| 228 | {"--noyymore", OPT_NO_YYMORE, 0}
|
|---|
| 229 | ,
|
|---|
| 230 | {"--noyywrap", OPT_NO_YYWRAP, 0}
|
|---|
| 231 | ,
|
|---|
| 232 | {"--yywrap", OPT_YYWRAP, 0}
|
|---|
| 233 | ,
|
|---|
| 234 |
|
|---|
| 235 | {"--nounput", OPT_NO_UNPUT, 0}
|
|---|
| 236 | ,
|
|---|
| 237 | {"--noyy_push_state", OPT_NO_YY_PUSH_STATE, 0}
|
|---|
| 238 | ,
|
|---|
| 239 | {"--noyy_pop_state", OPT_NO_YY_POP_STATE, 0}
|
|---|
| 240 | ,
|
|---|
| 241 | {"--noyy_top_state", OPT_NO_YY_TOP_STATE, 0}
|
|---|
| 242 | ,
|
|---|
| 243 | {"--noyy_scan_buffer", OPT_NO_YY_SCAN_BUFFER, 0}
|
|---|
| 244 | ,
|
|---|
| 245 | {"--noyy_scan_bytes", OPT_NO_YY_SCAN_BYTES, 0}
|
|---|
| 246 | ,
|
|---|
| 247 | {"--noyy_scan_string", OPT_NO_YY_SCAN_STRING, 0}
|
|---|
| 248 | ,
|
|---|
| 249 | {"--noyyget_extra", OPT_NO_YYGET_EXTRA, 0}
|
|---|
| 250 | ,
|
|---|
| 251 | {"--noyyset_extra", OPT_NO_YYSET_EXTRA, 0}
|
|---|
| 252 | ,
|
|---|
| 253 | {"--noyyget_leng", OPT_NO_YYGET_LENG, 0}
|
|---|
| 254 | ,
|
|---|
| 255 | {"--noyyget_text", OPT_NO_YYGET_TEXT, 0}
|
|---|
| 256 | ,
|
|---|
| 257 | {"--noyyget_lineno", OPT_NO_YYGET_LINENO, 0}
|
|---|
| 258 | ,
|
|---|
| 259 | {"--noyyset_lineno", OPT_NO_YYSET_LINENO, 0}
|
|---|
| 260 | ,
|
|---|
| 261 | {"--noyyget_in", OPT_NO_YYGET_IN, 0}
|
|---|
| 262 | ,
|
|---|
| 263 | {"--noyyset_in", OPT_NO_YYSET_IN, 0}
|
|---|
| 264 | ,
|
|---|
| 265 | {"--noyyget_out", OPT_NO_YYGET_OUT, 0}
|
|---|
| 266 | ,
|
|---|
| 267 | {"--noyyset_out", OPT_NO_YYSET_OUT, 0}
|
|---|
| 268 | ,
|
|---|
| 269 | {"--noyyget_lval", OPT_NO_YYGET_LVAL, 0}
|
|---|
| 270 | ,
|
|---|
| 271 | {"--noyyset_lval", OPT_NO_YYSET_LVAL, 0}
|
|---|
| 272 | ,
|
|---|
| 273 | {"--noyyget_lloc", OPT_NO_YYGET_LLOC, 0}
|
|---|
| 274 | ,
|
|---|
| 275 | {"--noyyset_lloc", OPT_NO_YYSET_LLOC, 0}
|
|---|
| 276 | ,
|
|---|
| 277 |
|
|---|
| 278 | {0, 0, 0} /* required final NULL entry. */
|
|---|
| 279 | };
|
|---|
| 280 |
|
|---|
| 281 | /* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */
|
|---|