1*0a6a1f1dSLionel Sambuc /* $NetBSD: options.c,v 1.3 2014/10/30 18:44:05 christos Exp $ */ 2357f1050SThomas Veerman 3357f1050SThomas Veerman /* flex - tool to generate fast lexical analyzers */ 4357f1050SThomas Veerman 5357f1050SThomas Veerman /* Copyright (c) 1990 The Regents of the University of California. */ 6357f1050SThomas Veerman /* All rights reserved. */ 7357f1050SThomas Veerman 8357f1050SThomas Veerman /* This code is derived from software contributed to Berkeley by */ 9357f1050SThomas Veerman /* Vern Paxson. */ 10357f1050SThomas Veerman 11357f1050SThomas Veerman /* The United States Government has rights in this work pursuant */ 12357f1050SThomas Veerman /* to contract no. DE-AC03-76SF00098 between the United States */ 13357f1050SThomas Veerman /* Department of Energy and the University of California. */ 14357f1050SThomas Veerman 15357f1050SThomas Veerman /* This file is part of flex. */ 16357f1050SThomas Veerman 17357f1050SThomas Veerman /* Redistribution and use in source and binary forms, with or without */ 18357f1050SThomas Veerman /* modification, are permitted provided that the following conditions */ 19357f1050SThomas Veerman /* are met: */ 20357f1050SThomas Veerman 21357f1050SThomas Veerman /* 1. Redistributions of source code must retain the above copyright */ 22357f1050SThomas Veerman /* notice, this list of conditions and the following disclaimer. */ 23357f1050SThomas Veerman /* 2. Redistributions in binary form must reproduce the above copyright */ 24357f1050SThomas Veerman /* notice, this list of conditions and the following disclaimer in the */ 25357f1050SThomas Veerman /* documentation and/or other materials provided with the distribution. */ 26357f1050SThomas Veerman 27357f1050SThomas Veerman /* Neither the name of the University nor the names of its contributors */ 28357f1050SThomas Veerman /* may be used to endorse or promote products derived from this software */ 29357f1050SThomas Veerman /* without specific prior written permission. */ 30357f1050SThomas Veerman 31357f1050SThomas Veerman /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ 32357f1050SThomas Veerman /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ 33357f1050SThomas Veerman /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ 34357f1050SThomas Veerman /* PURPOSE. */ 35*0a6a1f1dSLionel Sambuc #include "flexdef.h" 36*0a6a1f1dSLionel Sambuc __RCSID("$NetBSD: options.c,v 1.3 2014/10/30 18:44:05 christos Exp $"); 37357f1050SThomas Veerman 38357f1050SThomas Veerman #include "options.h" 39357f1050SThomas Veerman 40357f1050SThomas Veerman /* Be sure to synchronize these options with those defined in "options.h", 41357f1050SThomas Veerman * the giant switch() statement in "main.c", and the %option processing in 42357f1050SThomas Veerman * "scan.l". 43357f1050SThomas Veerman */ 44357f1050SThomas Veerman 45357f1050SThomas Veerman 46357f1050SThomas Veerman /* The command-line options, passed to scanopt_init() */ 47357f1050SThomas Veerman optspec_t flexopts[] = { 48357f1050SThomas Veerman 49357f1050SThomas Veerman {"-7", OPT_7BIT, 0} 50357f1050SThomas Veerman , 51357f1050SThomas Veerman {"--7bit", OPT_7BIT, 0} 52357f1050SThomas Veerman , /* Generate 7-bit scanner. */ 53357f1050SThomas Veerman {"-8", OPT_8BIT, 0} 54357f1050SThomas Veerman , 55357f1050SThomas Veerman {"--8bit", OPT_8BIT, 0} 56357f1050SThomas Veerman , /* Generate 8-bit scanner. */ 57357f1050SThomas Veerman {"--align", OPT_ALIGN, 0} 58357f1050SThomas Veerman , /* Trade off larger tables for better memory alignment. */ 59357f1050SThomas Veerman {"--noalign", OPT_NO_ALIGN, 0} 60357f1050SThomas Veerman , 61357f1050SThomas Veerman {"--always-interactive", OPT_ALWAYS_INTERACTIVE, 0} 62357f1050SThomas Veerman , 63357f1050SThomas Veerman {"--array", OPT_ARRAY, 0} 64357f1050SThomas Veerman , 65357f1050SThomas Veerman {"-b", OPT_BACKUP, 0} 66357f1050SThomas Veerman , 67357f1050SThomas Veerman {"--backup", OPT_BACKUP, 0} 68357f1050SThomas Veerman , /* Generate backing-up information to lex.backup. */ 69357f1050SThomas Veerman {"-B", OPT_BATCH, 0} 70357f1050SThomas Veerman , 71357f1050SThomas Veerman {"--batch", OPT_BATCH, 0} 72357f1050SThomas Veerman , /* Generate batch scanner (opposite of -I). */ 73357f1050SThomas Veerman {"--bison-bridge", OPT_BISON_BRIDGE, 0} 74357f1050SThomas Veerman , /* Scanner to be called by a bison pure parser. */ 75357f1050SThomas Veerman {"--bison-locations", OPT_BISON_BRIDGE_LOCATIONS, 0} 76357f1050SThomas Veerman , /* Scanner to be called by a bison pure parser. */ 77357f1050SThomas Veerman {"-i", OPT_CASE_INSENSITIVE, 0} 78357f1050SThomas Veerman , 79357f1050SThomas Veerman {"--case-insensitive", OPT_CASE_INSENSITIVE, 0} 80357f1050SThomas Veerman , /* Generate case-insensitive scanner. */ 81357f1050SThomas Veerman 82357f1050SThomas Veerman {"-C[aefFmr]", OPT_COMPRESSION, 83357f1050SThomas Veerman "Specify degree of table compression (default is -Cem)"}, 84357f1050SThomas Veerman {"-+", OPT_CPLUSPLUS, 0} 85357f1050SThomas Veerman , 86357f1050SThomas Veerman {"--c++", OPT_CPLUSPLUS, 0} 87357f1050SThomas Veerman , /* Generate C++ scanner class. */ 88357f1050SThomas Veerman {"-d", OPT_DEBUG, 0} 89357f1050SThomas Veerman , 90357f1050SThomas Veerman {"--debug", OPT_DEBUG, 0} 91357f1050SThomas Veerman , /* Turn on debug mode in generated scanner. */ 92357f1050SThomas Veerman {"--nodebug", OPT_NO_DEBUG, 0} 93357f1050SThomas Veerman , 94357f1050SThomas Veerman {"-s", OPT_NO_DEFAULT, 0} 95357f1050SThomas Veerman , 96357f1050SThomas Veerman {"--nodefault", OPT_NO_DEFAULT, 0} 97357f1050SThomas Veerman , /* Suppress default rule to ECHO unmatched text. */ 98357f1050SThomas Veerman {"--default", OPT_DEFAULT, 0} 99357f1050SThomas Veerman , 100357f1050SThomas Veerman {"-c", OPT_DONOTHING, 0} 101357f1050SThomas Veerman , /* For POSIX lex compatibility. */ 102357f1050SThomas Veerman {"-n", OPT_DONOTHING, 0} 103357f1050SThomas Veerman , /* For POSIX lex compatibility. */ 104357f1050SThomas Veerman {"--ecs", OPT_ECS, 0} 105357f1050SThomas Veerman , /* Construct equivalence classes. */ 106357f1050SThomas Veerman {"--noecs", OPT_NO_ECS, 0} 107357f1050SThomas Veerman , 108357f1050SThomas Veerman {"-F", OPT_FAST, 0} 109357f1050SThomas Veerman , 110357f1050SThomas Veerman {"--fast", OPT_FAST, 0} 111357f1050SThomas Veerman , /* Same as -CFr. */ 112357f1050SThomas Veerman {"-f", OPT_FULL, 0} 113357f1050SThomas Veerman , 114357f1050SThomas Veerman {"--full", OPT_FULL, 0} 115357f1050SThomas Veerman , /* Same as -Cfr. */ 116357f1050SThomas Veerman {"--header-file[=FILE]", OPT_HEADER_FILE, 0} 117357f1050SThomas Veerman , 118357f1050SThomas Veerman {"-?", OPT_HELP, 0} 119357f1050SThomas Veerman , 120357f1050SThomas Veerman {"-h", OPT_HELP, 0} 121357f1050SThomas Veerman , 122357f1050SThomas Veerman {"--help", OPT_HELP, 0} 123357f1050SThomas Veerman , /* Produce this help message. */ 124357f1050SThomas Veerman {"-I", OPT_INTERACTIVE, 0} 125357f1050SThomas Veerman , 126357f1050SThomas Veerman {"--interactive", OPT_INTERACTIVE, 0} 127357f1050SThomas Veerman , /* Generate interactive scanner (opposite of -B). */ 128357f1050SThomas Veerman {"-l", OPT_LEX_COMPAT, 0} 129357f1050SThomas Veerman , 130357f1050SThomas Veerman {"--lex-compat", OPT_LEX_COMPAT, 0} 131357f1050SThomas Veerman , /* Maximal compatibility with original lex. */ 132357f1050SThomas Veerman {"-X", OPT_POSIX_COMPAT, 0} 133357f1050SThomas Veerman , 134357f1050SThomas Veerman {"--posix-compat", OPT_POSIX_COMPAT, 0} 135357f1050SThomas Veerman , /* Maximal compatibility with POSIX lex. */ 136357f1050SThomas Veerman {"--preproc=NUM", OPT_PREPROC_LEVEL, 0} 137357f1050SThomas Veerman , 138357f1050SThomas Veerman {"-L", OPT_NO_LINE, 0} 139357f1050SThomas Veerman , /* Suppress #line directives in scanner. */ 140357f1050SThomas Veerman {"--noline", OPT_NO_LINE, 0} 141357f1050SThomas Veerman , /* Suppress #line directives in scanner. */ 142357f1050SThomas Veerman {"--main", OPT_MAIN, 0} 143357f1050SThomas Veerman , /* use built-in main() function. */ 144357f1050SThomas Veerman {"--nomain", OPT_NO_MAIN, 0} 145357f1050SThomas Veerman , 146357f1050SThomas Veerman {"--meta-ecs", OPT_META_ECS, 0} 147357f1050SThomas Veerman , /* Construct meta-equivalence classes. */ 148357f1050SThomas Veerman {"--nometa-ecs", OPT_NO_META_ECS, 0} 149357f1050SThomas Veerman , 150357f1050SThomas Veerman {"--never-interactive", OPT_NEVER_INTERACTIVE, 0} 151357f1050SThomas Veerman , 152357f1050SThomas Veerman {"-o FILE", OPT_OUTFILE, 0} 153357f1050SThomas Veerman , 154357f1050SThomas Veerman {"--outfile=FILE", OPT_OUTFILE, 0} 155357f1050SThomas Veerman , /* Write to FILE (default is lex.yy.c) */ 156357f1050SThomas Veerman {"-p", OPT_PERF_REPORT, 0} 157357f1050SThomas Veerman , 158357f1050SThomas Veerman {"--perf-report", OPT_PERF_REPORT, 0} 159357f1050SThomas Veerman , /* Generate performance report to stderr. */ 160357f1050SThomas Veerman {"--pointer", OPT_POINTER, 0} 161357f1050SThomas Veerman , 162357f1050SThomas Veerman {"-P PREFIX", OPT_PREFIX, 0} 163357f1050SThomas Veerman , 164357f1050SThomas Veerman {"--prefix=PREFIX", OPT_PREFIX, 0} 165357f1050SThomas Veerman , /* Use PREFIX (default is yy) */ 166357f1050SThomas Veerman {"-Dmacro", OPT_PREPROCDEFINE, 0} 167357f1050SThomas Veerman , /* Define a preprocessor symbol. */ 168357f1050SThomas Veerman {"--read", OPT_READ, 0} 169357f1050SThomas Veerman , /* Use read(2) instead of stdio. */ 170357f1050SThomas Veerman {"-R", OPT_REENTRANT, 0} 171357f1050SThomas Veerman , 172357f1050SThomas Veerman {"--reentrant", OPT_REENTRANT, 0} 173357f1050SThomas Veerman , /* Generate a reentrant C scanner. */ 174357f1050SThomas Veerman {"--noreentrant", OPT_NO_REENTRANT, 0} 175357f1050SThomas Veerman , 176357f1050SThomas Veerman {"--reject", OPT_REJECT, 0} 177357f1050SThomas Veerman , 178357f1050SThomas Veerman {"--noreject", OPT_NO_REJECT, 0} 179357f1050SThomas Veerman , 180357f1050SThomas Veerman {"-S FILE", OPT_SKEL, 0} 181357f1050SThomas Veerman , 182357f1050SThomas Veerman {"--skel=FILE", OPT_SKEL, 0} 183357f1050SThomas Veerman , /* Use skeleton from FILE */ 184357f1050SThomas Veerman {"--stack", OPT_STACK, 0} 185357f1050SThomas Veerman , 186357f1050SThomas Veerman {"--stdinit", OPT_STDINIT, 0} 187357f1050SThomas Veerman , 188357f1050SThomas Veerman {"--nostdinit", OPT_NO_STDINIT, 0} 189357f1050SThomas Veerman , 190357f1050SThomas Veerman {"-t", OPT_STDOUT, 0} 191357f1050SThomas Veerman , 192357f1050SThomas Veerman {"--stdout", OPT_STDOUT, 0} 193357f1050SThomas Veerman , /* Write generated scanner to stdout. */ 194357f1050SThomas Veerman {"-T", OPT_TRACE, 0} 195357f1050SThomas Veerman , 196357f1050SThomas Veerman {"--trace", OPT_TRACE, 0} 197357f1050SThomas Veerman , /* Flex should run in trace mode. */ 198357f1050SThomas Veerman {"--tables-file[=FILE]", OPT_TABLES_FILE, 0} 199357f1050SThomas Veerman , /* Save tables to FILE */ 200357f1050SThomas Veerman {"--tables-verify", OPT_TABLES_VERIFY, 0} 201357f1050SThomas Veerman , /* Tables integrity check */ 202357f1050SThomas Veerman {"--nounistd", OPT_NO_UNISTD_H, 0} 203357f1050SThomas Veerman , /* Do not include unistd.h */ 204357f1050SThomas Veerman {"-v", OPT_VERBOSE, 0} 205357f1050SThomas Veerman , 206357f1050SThomas Veerman {"--verbose", OPT_VERBOSE, 0} 207357f1050SThomas Veerman , /* Write summary of scanner statistics to stdout. */ 208357f1050SThomas Veerman {"-V", OPT_VERSION, 0} 209357f1050SThomas Veerman , 210357f1050SThomas Veerman {"--version", OPT_VERSION, 0} 211357f1050SThomas Veerman , /* Report flex version. */ 212357f1050SThomas Veerman {"--warn", OPT_WARN, 0} 213357f1050SThomas Veerman , 214357f1050SThomas Veerman {"-w", OPT_NO_WARN, 0} 215357f1050SThomas Veerman , 216357f1050SThomas Veerman {"--nowarn", OPT_NO_WARN, 0} 217357f1050SThomas Veerman , /* Suppress warning messages. */ 218357f1050SThomas Veerman {"--noansi-definitions", OPT_NO_ANSI_FUNC_DEFS, 0} 219357f1050SThomas Veerman , 220357f1050SThomas Veerman {"--noansi-prototypes", OPT_NO_ANSI_FUNC_PROTOS, 0} 221357f1050SThomas Veerman , 222357f1050SThomas Veerman {"--yyclass=NAME", OPT_YYCLASS, 0} 223357f1050SThomas Veerman , 224357f1050SThomas Veerman {"--yylineno", OPT_YYLINENO, 0} 225357f1050SThomas Veerman , 226357f1050SThomas Veerman {"--noyylineno", OPT_NO_YYLINENO, 0} 227357f1050SThomas Veerman , 228357f1050SThomas Veerman 229357f1050SThomas Veerman {"--yymore", OPT_YYMORE, 0} 230357f1050SThomas Veerman , 231357f1050SThomas Veerman {"--noyymore", OPT_NO_YYMORE, 0} 232357f1050SThomas Veerman , 233357f1050SThomas Veerman {"--noyywrap", OPT_NO_YYWRAP, 0} 234357f1050SThomas Veerman , 235357f1050SThomas Veerman {"--yywrap", OPT_YYWRAP, 0} 236357f1050SThomas Veerman , 237357f1050SThomas Veerman 238357f1050SThomas Veerman {"--nounput", OPT_NO_UNPUT, 0} 239357f1050SThomas Veerman , 240357f1050SThomas Veerman {"--noyy_push_state", OPT_NO_YY_PUSH_STATE, 0} 241357f1050SThomas Veerman , 242357f1050SThomas Veerman {"--noyy_pop_state", OPT_NO_YY_POP_STATE, 0} 243357f1050SThomas Veerman , 244357f1050SThomas Veerman {"--noyy_top_state", OPT_NO_YY_TOP_STATE, 0} 245357f1050SThomas Veerman , 246357f1050SThomas Veerman {"--noyy_scan_buffer", OPT_NO_YY_SCAN_BUFFER, 0} 247357f1050SThomas Veerman , 248357f1050SThomas Veerman {"--noyy_scan_bytes", OPT_NO_YY_SCAN_BYTES, 0} 249357f1050SThomas Veerman , 250357f1050SThomas Veerman {"--noyy_scan_string", OPT_NO_YY_SCAN_STRING, 0} 251357f1050SThomas Veerman , 252357f1050SThomas Veerman {"--noyyget_extra", OPT_NO_YYGET_EXTRA, 0} 253357f1050SThomas Veerman , 254357f1050SThomas Veerman {"--noyyset_extra", OPT_NO_YYSET_EXTRA, 0} 255357f1050SThomas Veerman , 256357f1050SThomas Veerman {"--noyyget_leng", OPT_NO_YYGET_LENG, 0} 257357f1050SThomas Veerman , 258357f1050SThomas Veerman {"--noyyget_text", OPT_NO_YYGET_TEXT, 0} 259357f1050SThomas Veerman , 260357f1050SThomas Veerman {"--noyyget_lineno", OPT_NO_YYGET_LINENO, 0} 261357f1050SThomas Veerman , 262357f1050SThomas Veerman {"--noyyset_lineno", OPT_NO_YYSET_LINENO, 0} 263357f1050SThomas Veerman , 264357f1050SThomas Veerman {"--noyyget_in", OPT_NO_YYGET_IN, 0} 265357f1050SThomas Veerman , 266357f1050SThomas Veerman {"--noyyset_in", OPT_NO_YYSET_IN, 0} 267357f1050SThomas Veerman , 268357f1050SThomas Veerman {"--noyyget_out", OPT_NO_YYGET_OUT, 0} 269357f1050SThomas Veerman , 270357f1050SThomas Veerman {"--noyyset_out", OPT_NO_YYSET_OUT, 0} 271357f1050SThomas Veerman , 272357f1050SThomas Veerman {"--noyyget_lval", OPT_NO_YYGET_LVAL, 0} 273357f1050SThomas Veerman , 274357f1050SThomas Veerman {"--noyyset_lval", OPT_NO_YYSET_LVAL, 0} 275357f1050SThomas Veerman , 276357f1050SThomas Veerman {"--noyyget_lloc", OPT_NO_YYGET_LLOC, 0} 277357f1050SThomas Veerman , 278357f1050SThomas Veerman {"--noyyset_lloc", OPT_NO_YYSET_LLOC, 0} 279357f1050SThomas Veerman , 280357f1050SThomas Veerman 281357f1050SThomas Veerman {0, 0, 0} /* required final NULL entry. */ 282357f1050SThomas Veerman }; 283357f1050SThomas Veerman 284357f1050SThomas Veerman /* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */ 285