⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flexdoc.1

📁 早期freebsd实现
💻 1
📖 第 1 页 / 共 5 页
字号:
.TP.B \-bGenerate backing-up information to.I lex.backup.This is a list of scanner states which require backing upand the input characters on which they do so.  By adding rules onecan remove backing-up states.  If all backing-up statesare eliminated and.B \-Cfor.B \-CFis used, the generated scanner will run faster (see the.B \-pflag).  Only users who wish to squeeze every last cycle out of theirscanners need worry about this option.  (See the section on PerformanceConsiderations below.).TP.B \-cis a do-nothing, deprecated option included for POSIX compliance..IP.B NOTE:in previous releases of.I lex.B \-cspecified table-compression options.  This functionality isnow given by the.B \-Cflag.  To ease the the impact of this change, when.I lexencounters.B \-c,it currently issues a warning message and assumes that.B \-Cwas desired instead.  In the future this "promotion" of.B \-cto.B \-Cwill go away in the name of full POSIX compliance (unlessthe POSIX meaning is removed first)..TP.B \-dmakes the generated scanner run in.I debugmode.  Whenever a pattern is recognized and the global.B yy_flex_debugis non-zero (which is the default),the scanner will write to.I stderra line of the form:.nf    --accepting rule at line 53 ("the matched text").fiThe line number refers to the location of the rule in the filedefining the scanner (i.e., the file that was fed to lex).  Messagesare also generated when the scanner backs up, accepts thedefault rule, reaches the end of its input buffer (or encountersa NUL; at this point, the two look the same as far as the scanner's concerned),or reaches an end-of-file..TP.B \-fspecifies.I fast scanner.No table compression is done and stdio is bypassed.The result is large but fast.  This option is equivalent to.B \-Cfr(see below)..TP.B \-hgenerates a "help" summary of.I lex'soptions to.I stderr and then exits..TP.B \-iinstructs.I lexto generate a.I case-insensitivescanner.  The case of letters given in the.I lexinput patterns willbe ignored, and tokens in the input will be matched regardless of case.  Thematched text given in.I yytextwill have the preserved case (i.e., it will not be folded)..TP.B \-lturns on maximum compatibility with the original AT&T.I leximplementation.  Note that this does not mean.I fullcompatibility.  Use of this option costs a considerable amount ofperformance, and it cannot be used with the.B -f, -F, -Cf,or.B -CFoptions.  For details on the compatibilities it provides, see the section"Incompatibilities With AT&T Lex And POSIX" below..TP.B \-nis another do-nothing, deprecated option included only forPOSIX compliance..TP.B \-pgenerates a performance report to stderr.  The reportconsists of comments regarding features of the.I lexinput file which will cause a serious loss of performance in the resultingscanner.  If you give the flag twice, you will also get comments regardingfeatures that lead to minor performance losses..IPNote that the use of.B REJECTand variable trailing context (see the Bugs section in lex(1))entails a substantial performance penalty; use of.I yymore(),the.B ^operator,and the.B \-Iflag entail minor performance penalties..TP.B \-scauses the.I default rule(that unmatched scanner input is echoed to.I stdout)to be suppressed.  If the scanner encounters input that does notmatch any of its rules, it aborts with an error.  This option isuseful for finding holes in a scanner's rule set..TP.B \-tinstructs.I lexto write the scanner it generates to standard output insteadof.B lex.yy.c..TP.B \-vspecifies that.I lexshould write to.I stderra summary of statistics regarding the scanner it generates.Most of the statistics are meaningless to the casual.I lexuser, but the first line identifies the version of.I lex(same as reported by.B \-V),and the next line the flags used when generating the scanner, includingthose that are on by default..TP.B \-wsuppresses warning messages..TP.B \-Binstructs.I lexto generate a.I batchscanner, the opposite of.I interactivescanners generated by.B \-I(see below).  In general, you use.B \-Bwhen you are.I certainthat your scanner will never be used interactively, and you want tosqueeze a.I littlemore performance out of it.  If your goal is instead to squeeze out a.I lotmore performance, you should  be using the.B \-Cfor.B \-CFoptions (discussed below), which turn on.B \-Bautomatically anyway..TP.B \-Fspecifies that the.ulfastscanner table representation should be used (and stdiobypassed).  This representation isabout as fast as the full table representation.B (-f),and for some sets of patterns will be considerably smaller (and forothers, larger).  In general, if the pattern set contains both "keywords"and a catch-all, "identifier" rule, such as in the set:.nf    "case"    return TOK_CASE;    "switch"  return TOK_SWITCH;    ...    "default" return TOK_DEFAULT;    [a-z]+    return TOK_ID;.fithen you're better off using the full table representation.  If onlythe "identifier" rule is present and you then use a hash table or some suchto detect the keywords, you're better off using.B -F..IPThis option is equivalent to.B \-CFr(see below)..TP.B \-Iinstructs.I lexto generate an.I interactivescanner.  An interactive scanner is one that only looks ahead to decidewhat token has been matched if it absolutely must.  It turns out thatalways looking one extra character ahead, even if the scanner has alreadyseen enough text to disambiguate the current token, is a bit faster thanonly looking ahead when necessary.  But scanners that always look aheadgive dreadful interactive performance; for example, when a user typesa newline, it is not recognized as a newline token until they enter.I anothertoken, which often means typing in another whole line..IP.I lexscanners default to.I interactiveunless you use the.B \-Cfor.B \-CFtable-compression options (see below).  That's because if you're lookingfor high-performance you should be using one of these options, so if youdidn't,.I lexassumes you'd rather trade off a bit of run-time performance for intuitiveinteractive behavior.  Note also that you.I cannotuse.B \-Iin conjunction with.B \-Cfor.B \-CF.Thus, this option is not really needed; it is on by default for all thosecases in which it is allowed..IPYou can force a scanner to.I notbe interactive by using.B \-B(see above)..TP.B \-Linstructs.I lexnot to generate.B #linedirectives.  Without this option,.I lexpeppers the generated scannerwith #line directives so error messages in the actions will be correctlylocated with respect to the original.I lexinput file, and not tothe fairly meaningless line numbers of.B lex.yy.c.(Unfortunately.I lexdoes not presently generate the necessary directivesto "retarget" the line numbers for those parts of.B lex.yy.cwhich it generated.  So if there is an error in the generated code,a meaningless line number is reported.).TP.B \-Tmakes.I lexrun in.I tracemode.  It will generate a lot of messages to.I stderrconcerningthe form of the input and the resultant non-deterministic and deterministicfinite automata.  This option is mostly for use in maintaining.I lex..TP.B \-Vprints the version number to.I stderrand exits..TP.B \-7instructs.I lexto generate a 7-bit scanner, i.e., one which can only recognized 7-bitcharacters in its input.  The advantage of using.B \-7is that the scanner's tables can be up to half the size of those generatedusing the.B \-8option (see below).  The disadvantage is that such scanners often hangor crash if their input contains an 8-bit character..IPNote, however, that unless you generate your scanner using the.B \-Cfor.B \-CFtable compression options, use of.B \-7will save only a small amount of table space, and make your scannerconsiderably less portable..I lex'sdefault behavior is to generate an 8-bit scanner unless you use the.B \-Cfor.B \-CF,in which case.I lexdefaults to generating 7-bit scanners unless your site was alwaysconfigured to generate 8-bit scanners (as will often be the casewith non-USA sites).  You can tell whether lex generated a 7-bitor an 8-bit scanner by inspecting the flag summary in the.B \-voutput as described above..IPNote that if you use.B \-Cfeor.B \-CFe(those table compression options, but also using equivalence classes asdiscussed see below), lex still defaults to generating an 8-bitscanner, since usually with these compression options full 8-bit tablesare not much more expensive than 7-bit tables..TP.B \-8instructs.I lexto generate an 8-bit scanner, i.e., one which can recognize 8-bitcharacters.  This flag is only needed for scanners generated using.B \-Cfor.B \-CF,as otherwise lex defaults to generating an 8-bit scanner anyway..IPSee the discussion of.B \-7above for lex's default behavior and the tradeoffs between 7-bitand 8-bit scanners..TP .B \-C[aefFmr]controls the degree of table compression and, more generally, trade-offsbetween small scanners and fast scanners..IP.B \-Ca("align") instructs lex to trade off larger tables in thegenerated scanner for faster performance because the elements ofthe tables are better aligned for memory access and computation.  On someRISC architectures, fetching and manipulating longwords is more efficientthan with smaller-sized datums such as shortwords.  This option candouble the size of the tables used by your scanner..IP.B \-Cedirects.I lexto construct.I equivalence classes,i.e., sets of characterswhich have identical lexical properties (for example, if the onlyappearance of digits in the.I lexinput is in the character class"[0-9]" then the digits '0', '1', ..., '9' will all be putin the same equivalence class).  Equivalence classes usually givedramatic reductions in the final table/object file sizes (typicallya factor of 2-5) and are pretty cheap performance-wise (one arraylook-up per character scanned)..IP.B \-Cfspecifies that the.I fullscanner tables should be generated -.I lexshould not compress thetables by taking advantages of similar transition functions fordifferent states..IP.B \-CFspecifies that the alternate fast scanner representation (describedabove under the.B \-Fflag)should be used..IP.B \-Cmdirects.I lexto construct.I meta-equivalence classes,which are sets of equivalence classes (or characters, if equivalenceclasses are not being used) that are commonly used together.  Meta-equivalenceclasses are often a big win when using compressed tables, but theyhave a moderate performance impact (one or two "if" tests and onearray look-up per character scanned)..IP.B \-Crcauses the generated scanner to.I bypassuse of the standard I/O library (stdio) for input.  Instead of calling.B fread()or.B getc(),the scanner will use the.B read()system call, resulting in a performance gain which varies from systemto system, but in general is probably negligible unless you are also using.B \-Cfor.B \-CF.Using.B \-Crcan cause strange behavior if, for example, you read from.I yyinusing stdio prior to calling the scanner (because the scanner will misswhatever text your previous reads left in the stdio input buffer)..IP.B \-Crhas no effect if you define.B YY_INPUT(see The Generated Scanner above)..IPA lone.B \-Cspecifies that the scanner tables should be compressed but neitherequivalence classes nor meta-equivalence classes should be used..IPThe options.B \-Cfor.B \-CFand.B \-Cmdo not make sense together - there is no opportunity for meta-equivalenceclasses if the table is not being compressed.  Otherwise the optionsmay be freely mixed, and are cumulative..IPThe default setting is.B \-Cem,which specifies that.I lexshould generate equivalence classesand meta-equivalence classes.  This setting provides the highestdegree of table compression.  You can trade offfaster-executing scanners at the cost of larger tables withthe following generally being true:.nf    slowest & smallest          -Cem          -Cm          -Ce          -C          -C{f,F}e          -C{f,F}          -C{f,F}a    fastest & largest.fiNote that scanners with the smallest tables are usually generated andcompiled the quickest, soduring development you will usually want to use the default, maximalcompression..IP.B \-Cfeis often a good compromise between speed and size for productionscanners..TP.B \-Pprefixchanges the default.I "yy"prefix used by.I lexfor all globally-visible variable and function names to instead be.I prefix.For example,.B \-Pfoochanges the name of.B yytextto.B footext.It also changes the name of the default output file from.B lex.yy.cto

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -