📄 flex.1
字号:
4383(highest)S(precedence)454 4703 A5188(at)S2760 V1080(the)S1228(top)S1381(to)S1484(lowest)S1772(at)S1870(the)S2018(bottom.)S2377(Those)S(grouped)329 2648 A3002(together)S3357(have)S3572(equal)S(precedence.)479 3815 A2928 V1080(Some)S1334(notes)S1571(on)S1696(patterns:)S3096 V1080(-)S1440(Negated)S1813(character)S2221(classes)S10 I2539(match)S2823(newlines)S10 R3213(unless)S3502("\\n")S3700(\(or)S3856(an)S3989(equivalent)S4446(escape)S4753(sequence\))S5194(is)S3216 V1440(one)S1610(of)S1719(the)S1867(characters)S(explicitly)380 2302 A2707(present)S3023(in)S3126(the)S3274(negated)S3612(character)S4008(class)S4229(\(e.g.,)S4458("[\303A-Z\\n]"\).)S3384 V1080(-)S1440(A)S1544(rule)S1732(can)S1903(have)S2124(at)S2228(most)S2454(one)S2631(instance)S2993(of)S(trailing)291 3109 A3432(context)S3760(\(the)S3949('/')S4077(operator)S4445(or)S4561(the)S4716('$')S4866(operator\).)S3504 V1440(The)S1626(start)S(condition,)404 1828 A('\303',)127 2260 A2415(and)S2588("<<EOF>>")S3117(patterns)S3464(can)S3632(only)S3838(occur)S4090(at)S4191(the)S4342(beginning)S4771(of)S4883(a)S4956(pattern,)S3624 V1440(and,)S1642(as)S1758(well)S1964(as)S2080(with)S2291('/')S2419(and)S2596('$',)S(cannot)268 2772 A3073(be)S(grouped)329 3201 A3563(inside)S3836(parentheses.)S4389(The)S4579(following)S5003(are)S5160(all)S3744 V(illegal:)280 1440 A3984 V1540(foo/bar$)S4104 V1540(foo|\(bar$\))S4224 V1540(foo|\303bar)S4344 V1540(<sc1>foo<sc2>bar)S4632 V9 R720(S)S722(SU)S774(UM)S842(MM)S924(MA)S1006(AR)S1074(RY)S1136(Y)S1242(O)S1244(OF)S1312(F)S1402(S)S1404(SP)S1456(PE)S1508(EC)S1566(CI)S1628(IA)S1661(AL)S1729(L)S1825(A)S1827(AC)S1895(CT)S1957(TI)S2015(IO)S2048(ON)S2116(NS)S2184(S)S4752 V10 R1080(In)S(addition)329 1189 A1543(to)S1646(arbitrary)S2019(C)S2111(code,)S2351(the)S2499(following)S2915(can)S3080(appear)S3374(in)S3477(actions:)S4920 V1080(-)S10 B1440(ECHO)S10 R1761(copies)S2043(yytext)S2319(to)S2422(the)S2570(scanner's)S2976(output.)S5088 V1080(-)S10 B1440(BEGIN)S10 R1789(followed)S2172(by)S2297(the)S2445(name)S2688(of)S2797(a)S2867(start)S(condition)379 3067 A(places)252 3472 A3750(the)S3899(scanner)S4233(in)S4337(the)S(corresponding)575 4486 A5087(start)S5208 V(condition.)404 1440 A5376 V1080(-)S10 B1440(REJECT)S10 R1865(directs)S2162(the)S2313(scanner)S2649(to)S(proceed)319 2755 A3103(on)S3232(to)S3339(the)S("second)320 3491 A3840(best")S4072(rule)S4258(which)S4533(matched)S4903(the)S(input)206 5055 A5496 V1440(\(or)S1586(a)S1658(pre\256x)S1920(of)S2031(the)S(input\).)265 2181 A10 B2498(yytext)S10 R2788(and)S10 B2960(yyleng)S10 R3266(are)S3417(set)S3556(up)S3683(appropriately.)S4297(Note)S4520(that)S10 B4698(REJECT)S10 R5122(is)S5216(a)S5616 V1440(particularly)S1956(expensive)S2409(feature)S2742(in)S2872(terms)S3148(scanner)S3508(performance;)S4098(if)S4212(it)S4320(is)S4439(used)S4675(in)S10 I4805(any)S10 R5002(of)S5138(the)S5736 V1440(scanner's)S1862(actions)S2188(it)S(will)157 2285 A2483(slow)S2714(down)S10 I2977(all)S10 R3123(of)S3247(the)S3410(scanner's)S3831(matching.)S4295(Furthermore,)S10 B4864(REJECT)S5856 V10 R(cannot)268 1440 A1733(be)S1853(used)S2062(with)S2266(the)S10 I2414(-f)S10 R2501(or)S10 I2610(-F)S10 R2731(options.)S6024 V1440(Note)S1669(also)S1865(that)S2050(unlike)S2335(the)S2492(other)S2733(special)S3047(actions,)S10 B3391(REJECT)S10 R3822(is)S3923(a)S10 I4002(branch;)S10 R4354(code)S4578(immediately)S5115(fol-)S6144 V1440(lowing)S1744(it)S1825(in)S1928(the)S2076(action)S(will)157 2347 A10 I2529(not)S10 R2682(be)S2802(executed.)S6312 V1080(-)S10 B1440(yymore\(\))S10 R1858(tells)S2052(the)S2202(scanner)S2537(that)S2715(the)S2865(next)S3065(time)S3271(it)S3354(matches)S3711(a)S3783(rule,)S3992(the)S(corresponding)575 4142 A4744(token)S(should)267 4994 A6432 V1440(be)S10 I(appended)390 1560 A10 R1975(onto)S2178(the)S2326(current)S2637(value)S2880(of)S10 B2989(yytext)S10 R3277(rather)S3538(than)S3736(replacing)S4136(it.)S6600 V1080(-)S10 B1440(yyless\(n\))S10 R1851(returns)S2167(all)S2305(but)S2470(the)S2630(\256rst)S10 I2824(n)S10 R2911(characters)S3358(of)S3479(the)S3639(current)S3962(token)S4222(back)S4449(to)S4564(the)S(input)206 4724 A4967(stream,)S6720 V1440(where)S1720(they)S(will)157 1926 A2116(be)S2243(rescanned)S2678(when)S2928(the)S3083(scanner)S(looks)217 3423 A3672(for)S3822(the)S3977(next)S4182(match.)S10 B4510(yytext)S10 R4805(and)S10 B4982(yyleng)S6840 V10 R1440(are)S1589(adjusted)S1949(appropriately)S2511(\(e.g.,)S10 B2740(yyleng)S10 R(will)157 3044 A3226(now)S3424(be)S3544(equal)S3787(to)S10 I3890(n)S10 R3965(\).)S7008 V1080(-)S10 B(unput\(c\))371 1440 A10 R1860(puts)S2076(the)S2248(character)S10 I2669(c)S10 R2764(back)S3004(onto)S3232(the)S(input)206 3405 A3661(stream.)S4030(It)S(will)157 4142 A4349(be)S4494(the)S4667(next)S4890(character)S7128 V1440(scanned.)S7296 V1080(-)S10 B(input\(\))298 1440 A10 R1770(reads)S2016(the)S2172(next)S2378(character)S2782(from)S3011(the)S(input)206 3167 A3406(stream)S3708(\(this)S3920(routine)S4238(is)S4338(called)S10 B(yyinput\(\))398 4612 A10 R5043(if)S5138(the)S7416 V1440(scanner)S1773(is)S1865(compiled)S2264(using)S10 B2506(C++\).)S7903 V10 R720(September)S1176(13,)S(1996)200 1326 A2681(\()S2723(26)S2848(May)S(1990)200 3057 A3265(\))S4990(Page)S5211(4)S8143 VEP%%Page: 5 5BP/slant 0 def/height 0 def480 V10 R720(FLEX)S981(\()S1023(1)S1081(\))S2756(Version)S3100(2.3)S4866(FLEX)S5127(\()S5169(1)S5227(\))S960 V1080(-)S10 B1440(yyterminate\(\))S10 R2056(can)S2223(be)S2346(used)S2558(in)S2664(lieu)S2843(of)S2955(a)S3028(return)S3297(statement)S3711(in)S3817(an)S3940(action.)S4264(It)S4354(terminates)S4802(the)S4953(scanner)S1080 V1440(and)S1610(returns)S1915(a)S1985(0)S2060(to)S2163(the)S2311(scanner's)S2717(caller,)S2992(indicating)S3419("all)S(done".)261 3586 A1248 V1440(By)S1584(default,)S10 B1916(yyterminate\(\))S10 R2532(is)S2626(also)S2815(called)S3084(when)S3330(an)S(end-of-file)432 3453 A3913(is)S(encountered.)517 4008 A4578(It)S4668(is)S4763(a)S4836(macro)S5116(and)S1368 V1440(may)S1638(be)S1758(redefined.)S1536 V1080(-)S10 B1440(YY_NEW_FILE)S10 R2186(is)S2278(an)S2398(action)S2669(available)S3058(only)S3261(in)S3365(<<EOF>>)S3810(rules.)S4082(It)S4170(means)S4453("Okay,)S4763(I've)S4952(set)S5090(up)S5216(a)S1656 V1440(new)S(input)206 1633 A1864(\256le,)S2043(continue)S2414(scanning".)S1824 V1080(-)S10 B(yy_create_buffer\()768 1440 A2270(\256le,)S2486(size)S2705(\))S10 R2801(takes)S3070(a)S10 I3177(FILE)S10 R3453(pointer)S3800(and)S4008(an)S4166(integer)S10 I4509(size.)S10 R4748(It)S4873(returns)S5216(a)S1944 V1440(YY_BUFFER_STATE)S2413(handle)S2712(to)S2820(a)S2895(new)S(input)206 3093 A3329(buffer)S3606(large)S(enough)295 3838 A4163(to)S(accomodate)481 4271 A10 I4782(size)S10 R4963(charac-)S2064 V1440(ters)S1611(and)S1781(associated)S2220(with)S2424(the)S2572(given)S2820(\256le.)S3024(When)S3289(in)S(doubt,)253 3392 A3670(use)S10 B3829(YY_BUF_SIZE)S10 R4531(for)S4674(the)S4822(size.)S2232 V1080(-)S10 B(yy_switch_to_buffer\()913 1440 A2399(new_buffer)S2939(\))S10 R3019(switches)S3412(the)S3581(scanner's)S4008(processing)S4484(to)S4608(scan)S4834(for)S4999(tokens)S2352 V1440(from)S1661(the)S1809(given)S2057(buffer,)S2354(which)S2625(must)S2845(be)S2965(a)S3035(YY_BUFFER_STATE.)S2520 V1080(-)S10 B(yy_delete_buffer\()757 1440 A2222(buffer)S2517(\))S10 R2576(deletes)S2881(the)S3029(given)S3277(buffer.)S2688 V9 R720(V)S722(VA)S790(AL)S858(LU)S916(UE)S984(ES)S1042(S)S1132(A)S1134(AV)S1202(VA)S1270(AI)S1338(IL)S1371(LA)S1429(AB)S1497(BL)S1559(LE)S1617(E)S1713(T)S1715(TO)S1773(O)S1879(T)S1881(TH)S1939(HE)S2007(E)S2103(U)S2105(US)S2173(SE)S2225(ER)S2283(R)S2808 V10 R1080(-)S10 B1440(char)S(*yytext)313 1661 A10 R1999(holds)S2241(the)S2389(text)S2565(of)S2674(the)S2822(current)S3133(token.)S3431(It)S3518(may)S3716(not)S3869(be)S3989(modi\256ed.)S2976 V1080(-)S10 B1440(int)S1583(yyleng)S10 R1887(holds)S2129(the)S2277(length)S2553(of)S2662(the)S2810(current)S3121(token.)S3419(It)S3506(may)S3704(not)S3857(be)S3977(modi\256ed.)S3144 V1080(-)S10 B1440(FILE)S(*yyin)234 1701 A10 R1961(is)S2054(the)S2203(\256le)S2358(which)S2630(by)S2757(default)S10 I3064(\257ex)S10 R3231(reads)S3471(from.)S3744(It)S3833(may)S4033(be)S4155(rede\256ned)S4557(but)S4712(doing)S4967(so)S5083(only)S3264 V1440(makes)S1731(sense)S1983(before)S2275(scanning)S2666(begins.)S3012(Changing)S3436(it)S3526(in)S3638(the)S3795(middle)S4108(of)S4226(scanning)S(will)157 4617 A4808(have)S5032(unex-)S3384 V1440(pected)S1729(results)S2018(since)S10 I2251(\257ex)S10 R2417(buffers)S2730(its)S(input.)231 2852 A3135(Once)S3375(scanning)S3759(terminates)S(because)319 4206 A4552(an)S4674(end-of-\256le)S5127(has)S3504 V1440(been)S1655(seen,)S10 B1884(void)S2093(yyrestart\()S2544(FILE)S2804(*new_\256le)S3232(\))S10 R3291(may)S3489(be)S3609(called)S3875(to)S3978(point)S10 I4209(yyin)S10 R4402(at)S4500(the)S4648(new)S(input)206 4841 A5072(\256le.)S3672 V1080(-)S10 B1440(FILE)S(*yyout)290 1700 A10 R2015(is)S2107(the)S2255(\256le)S2409(to)S2512(which)S10 B2783(ECHO)S10 R3104(actions)S3414(are)S(done.)220 3563 A3833(It)S3920(can)S4085(be)S4205(reassigned)S4655(by)S4780(the)S4928(user.)S3840 V1080(-)S10 B(YY_CURRENT_BUFFER)1149 1440 A10 R2614(returns)S2919(a)S10 B2989(YY_BUFFER_STATE)S10 R3994(handle)S4287(to)S4390(the)S4538(current)S4849(buffer.)S4008 V9 R720(M)S722(MA)S804(AC)S872(CR)S934(RO)S996(OS)S1064(S)S1154(T)S1156(TH)S1214(HE)S1282(E)S1378(U)S1380(US)S1448(SE)S1500(ER)S1558(R)S1658(C)S1660(CA)S1722(AN)S1790(N)S1896(R)S1898(RE)S1960(ED)S2018(DE)S2086(EF)S2144(FI)S2196(IN)S2229(NE)S2297(E)S4128 V10 R1080(-)S10 B1440(YY_DECL)S10 R1942(controls)S2293(how)S2493(the)S2643(scanning)S3027(routine)S3339(is)S3433(declared.)S3852(By)S3996(default,)S4328(it)S4411(is)S4505("int)S4679(yylex\(\)",)S5063(or,)S5199(if)S4248 V1440(prototypes)S1890(are)S2040(being)S2289(used,)S2524("int)S2697(yylex\(void\)".)S3283(This)S(de\256nition)385 3488 A3899(may)S4098(be)S4219(changed)S4580(by)S4705(rede\256ning)S5138(the)S4368 V1440("YY_DECL")S2015(macro.)S2350(Note)S2579(that)S2763(if)S(you)150 2858 A3041(give)S3247(arguments)S3700(to)S3812(the)S3969(scanning)S4360(routine)S4679(using)S4930(a)S5009(K&R-)S4488 V(style/non-prototyped)837 1440 A2305(function)S2667(declaration,)S(you)150 3167 A3344(must)S3566(terminate)S3974(the)S(de\256nition)385 4124 A4536(with)S4742(a)S4814(semi-colon)S4608 V1440(\(;\).)S4776 V1080(-)S1440(The)S1628(nature)S1911(of)S2026(how)S2231(the)S2386(scanner)S2726(gets)S2920(its)S(input)206 3047 A3285(can)S3457(be)S3584(controlled)S4024(by)S4156(rede\256ning)S4596(the)S10 B4751(YY_INPUT)S4896 V10 R1440(macro.)S1772(YY_INPUT's)S(calling)274 2369 A2673(sequence)S3072(is)S3169("YY_INPUT\(buf,result,max_size\)".)S4681(Its)S4812(action)S5087(is)S5183(to)S5016 V(place)213 1440 A1689(up)S1825(to)S10 I1939(max_size)S10 R2344(characters)S2791(in)S2906(the)S3066(character)S3474(array)S10 I3719(buf)S10 R3884(and)S4066(return)S4344(in)S4459(the)S4619(integer)S4936(variable)S5136 V10 I1440(result)S10 R1699(either)S1959(the)S2112(number)S2449(of)S2563(characters)S3003(read)S3206(or)S3319(the)S3471(constant)S3835(YY_NULL)S4330(\(0)S4443(on)S4572(Unix)S4802(systems\))S5183(to)S5256 V1440(indicate)S1794(EOF.)S2071(The)S2264(default)S2580(YY_INPUT)S3110(reads)S3359(from)S3591(the)S3750(global)S4037(\256le-pointer)S4521("yyin".)S4867(A)S4976(sample)S5376 V(rede\256nition)464 1440 A1929(of)S2038(YY_INPUT)S2557(\(in)S2694(the)S(de\256nitions)424 2842 A3291(section)S3601(of)S3710(the)S(input)206 3858 A4089(\256le\):)S5616 V1540(%{)S5736 V(#undef)279 1540 A1844(YY_INPUT)S5856 V1540(#de\256ne)S1861(YY_INPUT\(buf,result,max_size\))S3236(\\)S5976 V1640({)S1713(\\)S6096 V1640(int)S1771(c)S1841(=)S(getchar\(\);)393 1923 A2341(\\)S6216 V1640(result)S1889(=)S1971(\(c)S2075(==)S2214(EOF\))S2464(?)S2534(YY_NULL)S3025(:)S3078(\(buf[0])S3389(=)S3471(c,)S3566(1\);)S3703(\\)S6336 V1640(})S6456 V1540(%})S6744 V1080(-)S1440(When)S1726(the)S1895(scanner)S(receives)331 2249 A2626(an)S2767(end-of-\256le)S3239(indication)S3687(from)S3929(YY_INPUT,)S4494(it)S4597(then)S4817(checks)S5138(the)S6864 V10 B1440(yywrap\(\))S10 R1865(function.)S2283(If)S10 B2384(yywrap\(\))S10 R2809(returns)S3122(false)S3346(\(zero\),)S3646(then)S3852(it)S3941(is)S4041(assumed)S4420(that)S4604(the)S4760(function)S5127(has)S
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -