home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume14 / flex / part03 < prev    next >
SHell self-extracting ARchive  |  1988-05-02  |  48.8 KB

view JSON data     |     view as text     |     open on a Mac     |     open on a PC

This file was processed as: SHell self-extracting ARchive (archive/shar).

You can browse this item here: part03

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news or mail, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/rfc822 default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 53 75 62 6a 65 63 74 3a | 20 20 76 31 34 69 30 38 |Subject:| v14i08|
|00000010| 31 3a 20 20 46 6c 65 78 | 2c 20 61 20 6c 65 78 20 |1: Flex|, a lex |
|00000020| 72 65 70 6c 61 63 65 6d | 65 6e 74 2c 20 50 61 72 |replacem|ent, Par|
|00000030| 74 30 33 2f 30 35 0a 4e | 65 77 73 67 72 6f 75 70 |t03/05.N|ewsgroup|
|00000040| 73 3a 20 63 6f 6d 70 2e | 73 6f 75 72 63 65 73 2e |s: comp.|sources.|
|00000050| 75 6e 69 78 0a 53 65 6e | 64 65 72 3a 20 73 6f 75 |unix.Sen|der: sou|
|00000060| 72 63 65 73 0a 41 70 70 | 72 6f 76 65 64 3a 20 72 |rces.App|roved: r|
|00000070| 73 61 6c 7a 40 75 75 6e | 65 74 2e 55 55 2e 4e 45 |salz@uun|et.UU.NE|
|00000080| 54 0a 0a 53 75 62 6d 69 | 74 74 65 64 2d 62 79 3a |T..Submi|tted-by:|
|00000090| 20 56 65 72 6e 20 50 61 | 78 73 6f 6e 20 3c 76 65 | Vern Pa|xson <ve|
|000000a0| 72 6e 40 6c 62 6c 2d 63 | 73 61 6d 2e 61 72 70 61 |rn@lbl-c|sam.arpa|
|000000b0| 3e 0a 50 6f 73 74 69 6e | 67 2d 6e 75 6d 62 65 72 |>.Postin|g-number|
|000000c0| 3a 20 56 6f 6c 75 6d 65 | 20 31 34 2c 20 49 73 73 |: Volume| 14, Iss|
|000000d0| 75 65 20 38 31 0a 41 72 | 63 68 69 76 65 2d 6e 61 |ue 81.Ar|chive-na|
|000000e0| 6d 65 3a 20 66 6c 65 78 | 2f 70 61 72 74 30 33 0a |me: flex|/part03.|
|000000f0| 0a 23 21 20 2f 62 69 6e | 2f 73 68 0a 23 20 54 68 |.#! /bin|/sh.# Th|
|00000100| 69 73 20 69 73 20 61 20 | 73 68 65 6c 6c 20 61 72 |is is a |shell ar|
|00000110| 63 68 69 76 65 2e 20 20 | 52 65 6d 6f 76 65 20 61 |chive. |Remove a|
|00000120| 6e 79 74 68 69 6e 67 20 | 62 65 66 6f 72 65 20 74 |nything |before t|
|00000130| 68 69 73 20 6c 69 6e 65 | 2c 20 74 68 65 6e 20 75 |his line|, then u|
|00000140| 6e 70 61 63 6b 0a 23 20 | 69 74 20 62 79 20 73 61 |npack.# |it by sa|
|00000150| 76 69 6e 67 20 69 74 20 | 69 6e 74 6f 20 61 20 66 |ving it |into a f|
|00000160| 69 6c 65 20 61 6e 64 20 | 74 79 70 69 6e 67 20 22 |ile and |typing "|
|00000170| 73 68 20 66 69 6c 65 22 | 2e 20 20 54 6f 20 6f 76 |sh file"|. To ov|
|00000180| 65 72 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |erwrite |existing|
|00000190| 0a 23 20 66 69 6c 65 73 | 2c 20 74 79 70 65 20 22 |.# files|, type "|
|000001a0| 73 68 20 66 69 6c 65 20 | 2d 63 22 2e 20 20 59 6f |sh file |-c". Yo|
|000001b0| 75 20 63 61 6e 20 61 6c | 73 6f 20 66 65 65 64 20 |u can al|so feed |
|000001c0| 74 68 69 73 20 61 73 20 | 73 74 61 6e 64 61 72 64 |this as |standard|
|000001d0| 20 69 6e 70 75 74 20 76 | 69 61 0a 23 20 75 6e 73 | input v|ia.# uns|
|000001e0| 68 61 72 2c 20 6f 72 20 | 62 79 20 74 79 70 69 6e |har, or |by typin|
|000001f0| 67 20 22 73 68 20 3c 66 | 69 6c 65 22 2c 20 65 2e |g "sh <f|ile", e.|
|00000200| 67 2e 2e 20 20 49 66 20 | 74 68 69 73 20 61 72 63 |g.. If |this arc|
|00000210| 68 69 76 65 20 69 73 20 | 63 6f 6d 70 6c 65 74 65 |hive is |complete|
|00000220| 2c 20 79 6f 75 0a 23 20 | 77 69 6c 6c 20 73 65 65 |, you.# |will see|
|00000230| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 6d | the fol|lowing m|
|00000240| 65 73 73 61 67 65 20 61 | 74 20 74 68 65 20 65 6e |essage a|t the en|
|00000250| 64 3a 0a 23 09 09 22 45 | 6e 64 20 6f 66 20 61 72 |d:.#.."E|nd of ar|
|00000260| 63 68 69 76 65 20 33 20 | 28 6f 66 20 35 29 2e 22 |chive 3 |(of 5)."|
|00000270| 0a 23 20 43 6f 6e 74 65 | 6e 74 73 3a 20 20 66 6c |.# Conte|nts: fl|
|00000280| 65 78 2e 31 20 66 6c 65 | 78 64 65 66 2e 68 20 6e |ex.1 fle|xdef.h n|
|00000290| 66 61 2e 63 0a 23 20 57 | 72 61 70 70 65 64 20 62 |fa.c.# W|rapped b|
|000002a0| 79 20 72 73 61 6c 7a 40 | 66 69 67 2e 62 62 6e 2e |y rsalz@|fig.bbn.|
|000002b0| 63 6f 6d 20 6f 6e 20 54 | 75 65 20 4d 61 79 20 20 |com on T|ue May |
|000002c0| 33 20 31 37 3a 33 31 3a | 33 30 20 31 39 38 38 0a |3 17:31:|30 1988.|
|000002d0| 50 41 54 48 3d 2f 62 69 | 6e 3a 2f 75 73 72 2f 62 |PATH=/bi|n:/usr/b|
|000002e0| 69 6e 3a 2f 75 73 72 2f | 75 63 62 20 3b 20 65 78 |in:/usr/|ucb ; ex|
|000002f0| 70 6f 72 74 20 50 41 54 | 48 0a 69 66 20 74 65 73 |port PAT|H.if tes|
|00000300| 74 20 2d 66 20 27 66 6c | 65 78 2e 31 27 20 2d 61 |t -f 'fl|ex.1' -a|
|00000310| 20 22 24 7b 31 7d 22 20 | 21 3d 20 22 2d 63 22 20 | "${1}" |!= "-c" |
|00000320| 3b 20 74 68 65 6e 20 0a | 20 20 65 63 68 6f 20 73 |; then .| echo s|
|00000330| 68 61 72 3a 20 57 69 6c | 6c 20 6e 6f 74 20 63 6c |har: Wil|l not cl|
|00000340| 6f 62 62 65 72 20 65 78 | 69 73 74 69 6e 67 20 66 |obber ex|isting f|
|00000350| 69 6c 65 20 5c 22 27 66 | 6c 65 78 2e 31 27 5c 22 |ile \"'f|lex.1'\"|
|00000360| 0a 65 6c 73 65 0a 65 63 | 68 6f 20 73 68 61 72 3a |.else.ec|ho shar:|
|00000370| 20 45 78 74 72 61 63 74 | 69 6e 67 20 5c 22 27 66 | Extract|ing \"'f|
|00000380| 6c 65 78 2e 31 27 5c 22 | 20 5c 28 31 35 35 35 38 |lex.1'\"| \(15558|
|00000390| 20 63 68 61 72 61 63 74 | 65 72 73 5c 29 0a 73 65 | charact|ers\).se|
|000003a0| 64 20 22 73 2f 5e 58 2f | 2f 22 20 3e 27 66 6c 65 |d "s/^X/|/" >'fle|
|000003b0| 78 2e 31 27 20 3c 3c 27 | 45 4e 44 5f 4f 46 5f 46 |x.1' <<'|END_OF_F|
|000003c0| 49 4c 45 27 0a 58 2e 54 | 48 20 46 4c 45 58 20 31 |ILE'.X.T|H FLEX 1|
|000003d0| 20 22 31 33 20 4d 61 79 | 20 31 39 38 37 22 0a 58 | "13 May| 1987".X|
|000003e0| 2e 53 48 20 4e 41 4d 45 | 0a 66 6c 65 78 20 2d 20 |.SH NAME|.flex - |
|000003f0| 66 61 73 74 20 6c 65 78 | 69 63 61 6c 20 61 6e 61 |fast lex|ical ana|
|00000400| 6c 79 7a 65 72 20 67 65 | 6e 65 72 61 74 6f 72 0a |lyzer ge|nerator.|
|00000410| 58 2e 53 48 20 53 59 4e | 4f 50 53 49 53 0a 58 2e |X.SH SYN|OPSIS.X.|
|00000420| 42 20 66 6c 65 78 0a 58 | 5b 0a 58 2e 42 20 2d 64 |B flex.X|[.X.B -d|
|00000430| 66 69 72 73 74 76 46 49 | 4c 54 20 2d 63 5b 65 66 |firstvFI|LT -c[ef|
|00000440| 6d 46 5d 20 2d 53 73 6b | 65 6c 65 74 6f 6e 5f 66 |mF] -Ssk|eleton_f|
|00000450| 69 6c 65 0a 58 5d 20 5b | 20 0a 58 2e 49 20 66 69 |ile.X] [| .X.I fi|
|00000460| 6c 65 6e 61 6d 65 0a 58 | 5d 0a 58 2e 53 48 20 44 |lename.X|].X.SH D|
|00000470| 45 53 43 52 49 50 54 49 | 4f 4e 0a 58 2e 49 20 66 |ESCRIPTI|ON.X.I f|
|00000480| 6c 65 78 0a 69 73 20 61 | 20 72 65 77 72 69 74 65 |lex.is a| rewrite|
|00000490| 20 6f 66 0a 58 2e 49 20 | 6c 65 78 0a 69 6e 74 65 | of.X.I |lex.inte|
|000004a0| 6e 64 65 64 20 74 6f 20 | 72 69 67 68 74 20 73 6f |nded to |right so|
|000004b0| 6d 65 20 6f 66 20 74 68 | 61 74 20 74 6f 6f 6c 27 |me of th|at tool'|
|000004c0| 73 20 64 65 66 69 63 69 | 65 6e 63 69 65 73 3a 20 |s defici|encies: |
|000004d0| 69 6e 20 70 61 72 74 69 | 63 75 6c 61 72 2c 0a 58 |in parti|cular,.X|
|000004e0| 2e 49 20 66 6c 65 78 0a | 67 65 6e 65 72 61 74 65 |.I flex.|generate|
|000004f0| 73 20 6c 65 78 69 63 61 | 6c 20 61 6e 61 6c 79 7a |s lexica|l analyz|
|00000500| 65 72 73 20 6d 75 63 68 | 20 66 61 73 74 65 72 2c |ers much| faster,|
|00000510| 20 61 6e 64 20 74 68 65 | 20 61 6e 61 6c 79 7a 65 | and the| analyze|
|00000520| 72 73 20 75 73 65 0a 73 | 6d 61 6c 6c 65 72 20 74 |rs use.s|maller t|
|00000530| 61 62 6c 65 73 20 61 6e | 64 20 72 75 6e 20 66 61 |ables an|d run fa|
|00000540| 73 74 65 72 2e 0a 58 2e | 53 48 20 4f 50 54 49 4f |ster..X.|SH OPTIO|
|00000550| 4e 53 0a 49 6e 20 61 64 | 64 69 74 69 6f 6e 20 74 |NS.In ad|dition t|
|00000560| 6f 20 6c 65 78 27 73 0a | 58 2e 42 20 2d 74 0a 66 |o lex's.|X.B -t.f|
|00000570| 6c 61 67 2c 20 66 6c 65 | 78 20 68 61 73 20 74 68 |lag, fle|x has th|
|00000580| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 6f 70 74 69 |e follow|ing opti|
|00000590| 6f 6e 73 3a 0a 58 2e 54 | 50 0a 58 2e 42 20 2d 64 |ons:.X.T|P.X.B -d|
|000005a0| 0a 6d 61 6b 65 73 20 74 | 68 65 20 67 65 6e 65 72 |.makes t|he gener|
|000005b0| 61 74 65 64 20 73 63 61 | 6e 6e 65 72 20 72 75 6e |ated sca|nner run|
|000005c0| 20 69 6e 0a 58 2e 49 20 | 64 65 62 75 67 0a 6d 6f | in.X.I |debug.mo|
|000005d0| 64 65 2e 20 20 57 68 65 | 6e 65 76 65 72 20 61 20 |de. Whe|never a |
|000005e0| 70 61 74 74 65 72 6e 20 | 69 73 20 72 65 63 6f 67 |pattern |is recog|
|000005f0| 6e 69 7a 65 64 20 74 68 | 65 20 73 63 61 6e 6e 65 |nized th|e scanne|
|00000600| 72 20 77 69 6c 6c 0a 77 | 72 69 74 65 20 74 6f 0a |r will.w|rite to.|
|00000610| 58 2e 49 20 73 74 64 65 | 72 72 0a 61 20 6c 69 6e |X.I stde|rr.a lin|
|00000620| 65 20 6f 66 20 74 68 65 | 20 66 6f 72 6d 3a 0a 58 |e of the| form:.X|
|00000630| 2e 6e 66 0a 58 0a 58 20 | 20 20 20 2d 2d 61 63 63 |.nf.X.X | --acc|
|00000640| 65 70 74 69 6e 67 20 72 | 75 6c 65 20 23 6e 0a 58 |epting r|ule #n.X|
|00000650| 0a 58 2e 66 69 0a 52 75 | 6c 65 73 20 61 72 65 20 |.X.fi.Ru|les are |
|00000660| 6e 75 6d 62 65 72 65 64 | 20 73 65 71 75 65 6e 74 |numbered| sequent|
|00000670| 69 61 6c 6c 79 20 77 69 | 74 68 20 74 68 65 20 66 |ially wi|th the f|
|00000680| 69 72 73 74 20 6f 6e 65 | 20 62 65 69 6e 67 20 31 |irst one| being 1|
|00000690| 2e 0a 58 2e 54 50 0a 58 | 2e 42 20 2d 66 0a 68 61 |..X.TP.X|.B -f.ha|
|000006a0| 73 20 74 68 65 20 73 61 | 6d 65 20 65 66 66 65 63 |s the sa|me effec|
|000006b0| 74 20 61 73 20 6c 65 78 | 27 73 20 2d 66 20 66 6c |t as lex|'s -f fl|
|000006c0| 61 67 20 28 64 6f 20 6e | 6f 74 20 63 6f 6d 70 72 |ag (do n|ot compr|
|000006d0| 65 73 73 20 74 68 65 20 | 73 63 61 6e 6e 65 72 0a |ess the |scanner.|
|000006e0| 74 61 62 6c 65 73 29 3b | 20 74 68 65 20 6d 6e 65 |tables);| the mne|
|000006f0| 6d 6f 6e 69 63 20 63 68 | 61 6e 67 65 73 20 66 72 |monic ch|anges fr|
|00000700| 6f 6d 0a 58 2e 49 20 66 | 61 73 74 20 63 6f 6d 70 |om.X.I f|ast comp|
|00000710| 69 6c 61 74 69 6f 6e 0a | 74 6f 20 28 74 61 6b 65 |ilation.|to (take|
|00000720| 20 79 6f 75 72 20 70 69 | 63 6b 29 0a 58 2e 49 20 | your pi|ck).X.I |
|00000730| 66 75 6c 6c 20 74 61 62 | 6c 65 0a 6f 72 0a 58 2e |full tab|le.or.X.|
|00000740| 49 20 66 61 73 74 20 73 | 63 61 6e 6e 65 72 2e 0a |I fast s|canner..|
|00000750| 54 68 65 20 61 63 74 75 | 61 6c 20 63 6f 6d 70 69 |The actu|al compi|
|00000760| 6c 61 74 69 6f 6e 20 74 | 61 6b 65 73 0a 58 2e 49 |lation t|akes.X.I|
|00000770| 20 6c 6f 6e 67 65 72 2c | 0a 73 69 6e 63 65 20 66 | longer,|.since f|
|00000780| 6c 65 78 20 69 73 20 49 | 2f 4f 20 62 6f 75 6e 64 |lex is I|/O bound|
|00000790| 20 77 72 69 74 69 6e 67 | 20 6f 75 74 20 74 68 65 | writing| out the|
|000007a0| 20 62 69 67 20 74 61 62 | 6c 65 2e 0a 58 2e 49 50 | big tab|le..X.IP|
|000007b0| 0a 54 68 69 73 20 6f 70 | 74 69 6f 6e 20 69 73 20 |.This op|tion is |
|000007c0| 65 71 75 69 76 61 6c 65 | 6e 74 20 74 6f 0a 58 2e |equivale|nt to.X.|
|000007d0| 42 20 2d 63 66 0a 58 28 | 73 65 65 20 62 65 6c 6f |B -cf.X(|see belo|
|000007e0| 77 29 2e 0a 58 2e 54 50 | 0a 58 2e 42 20 2d 69 0a |w)..X.TP|.X.B -i.|
|000007f0| 69 6e 73 74 72 75 63 74 | 73 20 66 6c 65 78 20 74 |instruct|s flex t|
|00000800| 6f 20 67 65 6e 65 72 61 | 74 65 20 61 0a 58 2e 49 |o genera|te a.X.I|
|00000810| 20 63 61 73 65 2d 69 6e | 73 65 6e 73 69 74 69 76 | case-in|sensitiv|
|00000820| 65 0a 73 63 61 6e 6e 65 | 72 2e 20 20 54 68 65 20 |e.scanne|r. The |
|00000830| 63 61 73 65 20 6f 66 20 | 6c 65 74 74 65 72 73 20 |case of |letters |
|00000840| 67 69 76 65 6e 20 69 6e | 20 74 68 65 20 66 6c 65 |given in| the fle|
|00000850| 78 20 69 6e 70 75 74 20 | 70 61 74 74 65 72 6e 73 |x input |patterns|
|00000860| 20 77 69 6c 6c 0a 62 65 | 20 69 67 6e 6f 72 65 64 | will.be| ignored|
|00000870| 2c 20 61 6e 64 20 74 68 | 65 20 72 75 6c 65 73 20 |, and th|e rules |
|00000880| 77 69 6c 6c 20 62 65 20 | 6d 61 74 63 68 65 64 20 |will be |matched |
|00000890| 72 65 67 61 72 64 6c 65 | 73 73 20 6f 66 20 63 61 |regardle|ss of ca|
|000008a0| 73 65 2e 20 20 54 68 65 | 0a 6d 61 74 63 68 65 64 |se. The|.matched|
|000008b0| 20 74 65 78 74 20 67 69 | 76 65 6e 20 69 6e 0a 58 | text gi|ven in.X|
|000008c0| 2e 49 20 79 79 74 65 78 | 74 0a 77 69 6c 6c 20 68 |.I yytex|t.will h|
|000008d0| 61 76 65 20 74 68 65 20 | 70 72 65 73 65 72 76 65 |ave the |preserve|
|000008e0| 64 20 63 61 73 65 20 28 | 69 2e 65 2e 2c 20 69 74 |d case (|i.e., it|
|000008f0| 20 77 69 6c 6c 20 6e 6f | 74 20 62 65 20 66 6f 6c | will no|t be fol|
|00000900| 64 65 64 29 2e 0a 58 2e | 54 50 0a 58 2e 42 20 2d |ded)..X.|TP.X.B -|
|00000910| 72 0a 73 70 65 63 69 66 | 69 65 73 20 74 68 61 74 |r.specif|ies that|
|00000920| 20 74 68 65 20 73 63 61 | 6e 6e 65 72 20 75 73 65 | the sca|nner use|
|00000930| 73 20 74 68 65 0a 58 2e | 42 20 52 45 4a 45 43 54 |s the.X.|B REJECT|
|00000940| 0a 61 63 74 69 6f 6e 2e | 0a 58 2e 54 50 0a 58 2e |.action.|.X.TP.X.|
|00000950| 42 20 2d 73 0a 63 61 75 | 73 65 73 20 74 68 65 0a |B -s.cau|ses the.|
|00000960| 58 2e 49 20 64 65 66 61 | 75 6c 74 20 72 75 6c 65 |X.I defa|ult rule|
|00000970| 0a 58 28 74 68 61 74 20 | 75 6e 6d 61 74 63 68 65 |.X(that |unmatche|
|00000980| 64 20 73 63 61 6e 6e 65 | 72 20 69 6e 70 75 74 20 |d scanne|r input |
|00000990| 69 73 20 65 63 68 6f 65 | 64 20 74 6f 0a 58 2e 49 |is echoe|d to.X.I|
|000009a0| 20 73 74 64 6f 75 74 29 | 0a 74 6f 20 62 65 20 73 | stdout)|.to be s|
|000009b0| 75 70 70 72 65 73 73 65 | 64 2e 20 20 49 66 20 74 |uppresse|d. If t|
|000009c0| 68 65 20 73 63 61 6e 6e | 65 72 20 65 6e 63 6f 75 |he scann|er encou|
|000009d0| 6e 74 65 72 73 20 69 6e | 70 75 74 20 74 68 61 74 |nters in|put that|
|000009e0| 20 64 6f 65 73 20 6e 6f | 74 0a 6d 61 74 63 68 20 | does no|t.match |
|000009f0| 61 6e 79 20 6f 66 20 69 | 74 73 20 72 75 6c 65 73 |any of i|ts rules|
|00000a00| 2c 20 69 74 20 61 62 6f | 72 74 73 20 77 69 74 68 |, it abo|rts with|
|00000a10| 20 61 6e 20 65 72 72 6f | 72 2e 20 20 54 68 69 73 | an erro|r. This|
|00000a20| 20 6f 70 74 69 6f 6e 20 | 69 73 0a 75 73 65 66 75 | option |is.usefu|
|00000a30| 6c 20 66 6f 72 20 66 69 | 6e 64 69 6e 67 20 68 6f |l for fi|nding ho|
|00000a40| 6c 65 73 20 69 6e 20 61 | 20 73 63 61 6e 6e 65 72 |les in a| scanner|
|00000a50| 27 73 20 72 75 6c 65 20 | 73 65 74 2e 0a 58 2e 54 |'s rule |set..X.T|
|00000a60| 50 0a 58 2e 42 20 2d 76 | 0a 68 61 73 20 74 68 65 |P.X.B -v|.has the|
|00000a70| 20 73 61 6d 65 20 6d 65 | 61 6e 69 6e 67 20 61 73 | same me|aning as|
|00000a80| 20 66 6f 72 20 6c 65 78 | 20 28 70 72 69 6e 74 20 | for lex| (print |
|00000a90| 74 6f 0a 58 2e 49 20 73 | 74 64 65 72 72 0a 61 20 |to.X.I s|tderr.a |
|00000aa0| 73 75 6d 6d 61 72 79 20 | 6f 66 20 73 74 61 74 69 |summary |of stati|
|00000ab0| 73 74 69 63 73 20 6f 66 | 20 74 68 65 20 67 65 6e |stics of| the gen|
|00000ac0| 65 72 61 74 65 64 20 73 | 63 61 6e 6e 65 72 29 2e |erated s|canner).|
|00000ad0| 20 20 4d 61 6e 79 20 6d | 6f 72 65 20 73 74 61 74 | Many m|ore stat|
|00000ae0| 69 73 74 69 63 73 0a 61 | 72 65 20 70 72 69 6e 74 |istics.a|re print|
|00000af0| 65 64 2c 20 74 68 6f 75 | 67 68 2c 20 61 6e 64 20 |ed, thou|gh, and |
|00000b00| 74 68 65 20 73 75 6d 6d | 61 72 79 20 73 70 61 6e |the summ|ary span|
|00000b10| 73 20 73 65 76 65 72 61 | 6c 20 6c 69 6e 65 73 2e |s severa|l lines.|
|00000b20| 20 20 4d 6f 73 74 0a 6f | 66 20 74 68 65 20 73 74 | Most.o|f the st|
|00000b30| 61 74 69 73 74 69 63 73 | 20 61 72 65 20 6d 65 61 |atistics| are mea|
|00000b40| 6e 69 6e 67 6c 65 73 73 | 20 74 6f 20 74 68 65 20 |ningless| to the |
|00000b50| 63 61 73 75 61 6c 20 66 | 6c 65 78 20 75 73 65 72 |casual f|lex user|
|00000b60| 2e 0a 58 2e 54 50 0a 58 | 2e 42 20 2d 46 0a 73 70 |..X.TP.X|.B -F.sp|
|00000b70| 65 63 69 66 69 65 73 20 | 74 68 61 74 20 74 68 65 |ecifies |that the|
|00000b80| 0a 58 2e 75 6c 0a 66 61 | 73 74 0a 73 63 61 6e 6e |.X.ul.fa|st.scann|
|00000b90| 65 72 20 74 61 62 6c 65 | 20 72 65 70 72 65 73 65 |er table| represe|
|00000ba0| 6e 74 61 74 69 6f 6e 20 | 73 68 6f 75 6c 64 20 62 |ntation |should b|
|00000bb0| 65 20 75 73 65 64 2e 20 | 20 54 68 69 73 20 72 65 |e used. | This re|
|00000bc0| 70 72 65 73 65 6e 74 61 | 74 69 6f 6e 20 69 73 0a |presenta|tion is.|
|00000bd0| 61 62 6f 75 74 20 61 73 | 20 66 61 73 74 20 61 73 |about as| fast as|
|00000be0| 20 74 68 65 20 66 75 6c | 6c 20 74 61 62 6c 65 20 | the ful|l table |
|00000bf0| 72 65 70 72 65 73 65 6e | 74 61 74 69 6f 6e 0a 58 |represen|tation.X|
|00000c00| 2e 75 6c 0a 58 28 2d 66 | 29 2c 0a 61 6e 64 20 66 |.ul.X(-f|),.and f|
|00000c10| 6f 72 20 73 6f 6d 65 20 | 73 65 74 73 20 6f 66 20 |or some |sets of |
|00000c20| 70 61 74 74 65 72 6e 73 | 20 77 69 6c 6c 20 62 65 |patterns| will be|
|00000c30| 20 63 6f 6e 73 69 64 65 | 72 61 62 6c 79 20 73 6d | conside|rably sm|
|00000c40| 61 6c 6c 65 72 20 28 61 | 6e 64 20 66 6f 72 0a 6f |aller (a|nd for.o|
|00000c50| 74 68 65 72 73 2c 20 6c | 61 72 67 65 72 29 2e 20 |thers, l|arger). |
|00000c60| 20 49 6e 20 67 65 6e 65 | 72 61 6c 2c 20 69 66 20 | In gene|ral, if |
|00000c70| 74 68 65 20 70 61 74 74 | 65 72 6e 20 73 65 74 20 |the patt|ern set |
|00000c80| 63 6f 6e 74 61 69 6e 73 | 20 62 6f 74 68 20 22 6b |contains| both "k|
|00000c90| 65 79 77 6f 72 64 73 22 | 0a 61 6e 64 20 61 20 63 |eywords"|.and a c|
|00000ca0| 61 74 63 68 2d 61 6c 6c | 2c 20 22 69 64 65 6e 74 |atch-all|, "ident|
|00000cb0| 69 66 69 65 72 22 20 72 | 75 6c 65 2c 20 73 75 63 |ifier" r|ule, suc|
|00000cc0| 68 20 61 73 20 69 6e 20 | 74 68 65 20 73 65 74 3a |h as in |the set:|
|00000cd0| 0a 58 2e 6e 66 0a 58 0a | 58 09 22 63 61 73 65 22 |.X.nf.X.|X."case"|
|00000ce0| 20 20 20 20 72 65 74 75 | 72 6e 20 28 20 54 4f 4b | retu|rn ( TOK|
|00000cf0| 5f 43 41 53 45 20 29 3b | 0a 58 09 22 73 77 69 74 |_CASE );|.X."swit|
|00000d00| 63 68 22 20 20 72 65 74 | 75 72 6e 20 28 20 54 4f |ch" ret|urn ( TO|
|00000d10| 4b 5f 53 57 49 54 43 48 | 20 29 3b 0a 58 09 2e 2e |K_SWITCH| );.X...|
|00000d20| 2e 0a 58 09 22 64 65 66 | 61 75 6c 74 22 20 72 65 |..X."def|ault" re|
|00000d30| 74 75 72 6e 20 28 20 54 | 4f 4b 5f 44 45 46 41 55 |turn ( T|OK_DEFAU|
|00000d40| 4c 54 20 29 3b 0a 58 09 | 5b 61 2d 7a 5d 2b 20 20 |LT );.X.|[a-z]+ |
|00000d50| 20 20 72 65 74 75 72 6e | 20 28 20 54 4f 4b 5f 49 | return| ( TOK_I|
|00000d60| 44 20 29 3b 0a 58 0a 58 | 2e 66 69 0a 74 68 65 6e |D );.X.X|.fi.then|
|00000d70| 20 79 6f 75 27 72 65 20 | 62 65 74 74 65 72 20 6f | you're |better o|
|00000d80| 66 66 20 75 73 69 6e 67 | 20 74 68 65 20 66 75 6c |ff using| the ful|
|00000d90| 6c 20 74 61 62 6c 65 20 | 72 65 70 72 65 73 65 6e |l table |represen|
|00000da0| 74 61 74 69 6f 6e 2e 20 | 20 49 66 20 6f 6e 6c 79 |tation. | If only|
|00000db0| 0a 74 68 65 20 22 69 64 | 65 6e 74 69 66 69 65 72 |.the "id|entifier|
|00000dc0| 22 20 72 75 6c 65 20 69 | 73 20 70 72 65 73 65 6e |" rule i|s presen|
|00000dd0| 74 20 61 6e 64 20 79 6f | 75 20 74 68 65 6e 20 75 |t and yo|u then u|
|00000de0| 73 65 20 61 20 68 61 73 | 68 20 74 61 62 6c 65 20 |se a has|h table |
|00000df0| 6f 72 20 73 6f 6d 65 20 | 73 75 63 68 0a 74 6f 20 |or some |such.to |
|00000e00| 64 65 74 65 63 74 20 74 | 68 65 20 6b 65 79 77 6f |detect t|he keywo|
|00000e10| 72 64 73 2c 20 79 6f 75 | 27 72 65 20 62 65 74 74 |rds, you|'re bett|
|00000e20| 65 72 20 6f 66 66 20 75 | 73 69 6e 67 0a 58 2e 75 |er off u|sing.X.u|
|00000e30| 6c 0a 58 2d 46 2e 0a 58 | 2e 49 50 0a 54 68 69 73 |l.X-F..X|.IP.This|
|00000e40| 20 6f 70 74 69 6f 6e 20 | 69 73 20 65 71 75 69 76 | option |is equiv|
|00000e50| 61 6c 65 6e 74 20 74 6f | 0a 58 2e 42 20 2d 63 46 |alent to|.X.B -cF|
|00000e60| 0a 58 28 73 65 65 20 62 | 65 6c 6f 77 29 2e 0a 58 |.X(see b|elow)..X|
|00000e70| 2e 54 50 0a 58 2e 42 20 | 2d 49 0a 69 6e 73 74 72 |.TP.X.B |-I.instr|
|00000e80| 75 63 74 73 20 66 6c 65 | 78 20 74 6f 20 67 65 6e |ucts fle|x to gen|
|00000e90| 65 72 61 74 65 20 61 6e | 0a 58 2e 49 20 69 6e 74 |erate an|.X.I int|
|00000ea0| 65 72 61 63 74 69 76 65 | 0a 73 63 61 6e 6e 65 72 |eractive|.scanner|
|00000eb0| 2e 20 20 4e 6f 72 6d 61 | 6c 6c 79 2c 20 73 63 61 |. Norma|lly, sca|
|00000ec0| 6e 6e 65 72 73 20 67 65 | 6e 65 72 61 74 65 64 20 |nners ge|nerated |
|00000ed0| 62 79 20 66 6c 65 78 20 | 61 6c 77 61 79 73 20 6c |by flex |always l|
|00000ee0| 6f 6f 6b 20 61 68 65 61 | 64 20 6f 6e 65 20 63 68 |ook ahea|d one ch|
|00000ef0| 61 72 61 63 74 65 72 0a | 62 65 66 6f 72 65 20 64 |aracter.|before d|
|00000f00| 65 63 69 64 69 6e 67 20 | 74 68 61 74 20 61 20 72 |eciding |that a r|
|00000f10| 75 6c 65 20 68 61 73 20 | 62 65 65 6e 20 6d 61 74 |ule has |been mat|
|00000f20| 63 68 65 64 2e 20 20 41 | 74 20 74 68 65 20 70 6f |ched. A|t the po|
|00000f30| 73 73 69 62 6c 65 20 63 | 6f 73 74 20 6f 66 20 73 |ssible c|ost of s|
|00000f40| 6f 6d 65 0a 73 63 61 6e | 6e 69 6e 67 20 6f 76 65 |ome.scan|ning ove|
|00000f50| 72 68 65 61 64 20 28 69 | 74 27 73 20 6e 6f 74 20 |rhead (i|t's not |
|00000f60| 63 6c 65 61 72 20 74 68 | 61 74 20 6d 6f 72 65 20 |clear th|at more |
|00000f70| 6f 76 65 72 68 65 61 64 | 20 69 73 20 69 6e 76 6f |overhead| is invo|
|00000f80| 6c 76 65 64 29 2c 20 66 | 6c 65 78 20 77 69 6c 6c |lved), f|lex will|
|00000f90| 0a 67 65 6e 65 72 61 74 | 65 20 61 20 73 63 61 6e |.generat|e a scan|
|00000fa0| 6e 65 72 20 77 68 69 63 | 68 20 6f 6e 6c 79 20 6c |ner whic|h only l|
|00000fb0| 6f 6f 6b 73 20 61 68 65 | 61 64 20 77 68 65 6e 20 |ooks ahe|ad when |
|00000fc0| 6e 65 65 64 65 64 2e 20 | 20 53 75 63 68 20 73 63 |needed. | Such sc|
|00000fd0| 61 6e 6e 65 72 73 20 61 | 72 65 0a 63 61 6c 6c 65 |anners a|re.calle|
|00000fe0| 64 0a 58 2e 49 20 69 6e | 74 65 72 61 63 74 69 76 |d.X.I in|teractiv|
|00000ff0| 65 0a 62 65 63 61 75 73 | 65 20 69 66 20 79 6f 75 |e.becaus|e if you|
|00001000| 20 77 61 6e 74 20 74 6f | 20 77 72 69 74 65 20 61 | want to| write a|
|00001010| 20 73 63 61 6e 6e 65 72 | 20 66 6f 72 20 61 6e 20 | scanner| for an |
|00001020| 69 6e 74 65 72 61 63 74 | 69 76 65 20 73 79 73 74 |interact|ive syst|
|00001030| 65 6d 20 73 75 63 68 0a | 61 73 20 61 20 63 6f 6d |em such.|as a com|
|00001040| 6d 61 6e 64 20 73 68 65 | 6c 6c 2c 20 79 6f 75 20 |mand she|ll, you |
|00001050| 77 69 6c 6c 20 70 72 6f | 62 61 62 6c 79 20 77 61 |will pro|bably wa|
|00001060| 6e 74 20 74 68 65 20 75 | 73 65 72 27 73 20 69 6e |nt the u|ser's in|
|00001070| 70 75 74 20 74 6f 20 62 | 65 20 74 65 72 6d 69 6e |put to b|e termin|
|00001080| 61 74 65 64 0a 77 69 74 | 68 20 61 20 6e 65 77 6c |ated.wit|h a newl|
|00001090| 69 6e 65 2c 20 61 6e 64 | 20 77 69 74 68 6f 75 74 |ine, and| without|
|000010a0| 0a 58 2e 42 20 2d 49 0a | 74 68 65 20 75 73 65 72 |.X.B -I.|the user|
|000010b0| 20 77 69 6c 6c 20 68 61 | 76 65 20 74 6f 20 74 79 | will ha|ve to ty|
|000010c0| 70 65 20 61 20 63 68 61 | 72 61 63 74 65 72 20 69 |pe a cha|racter i|
|000010d0| 6e 20 61 64 64 69 74 69 | 6f 6e 20 74 6f 20 74 68 |n additi|on to th|
|000010e0| 65 20 6e 65 77 6c 69 6e | 65 20 69 6e 20 6f 72 64 |e newlin|e in ord|
|000010f0| 65 72 0a 74 6f 20 68 61 | 76 65 20 74 68 65 20 6e |er.to ha|ve the n|
|00001100| 65 77 6c 69 6e 65 20 72 | 65 63 6f 67 6e 69 7a 65 |ewline r|ecognize|
|00001110| 64 2e 20 20 54 68 69 73 | 20 6c 65 61 64 73 20 74 |d. This| leads t|
|00001120| 6f 20 64 72 65 61 64 66 | 75 6c 20 69 6e 74 65 72 |o dreadf|ul inter|
|00001130| 61 63 74 69 76 65 20 70 | 65 72 66 6f 72 6d 61 6e |active p|erforman|
|00001140| 63 65 2e 0a 58 2e 49 50 | 0a 49 66 20 61 6c 6c 20 |ce..X.IP|.If all |
|00001150| 74 68 69 73 20 73 65 65 | 6d 73 20 74 6f 20 63 6f |this see|ms to co|
|00001160| 6e 66 75 73 69 6e 67 2c | 20 68 65 72 65 27 73 20 |nfusing,| here's |
|00001170| 74 68 65 20 67 65 6e 65 | 72 61 6c 20 72 75 6c 65 |the gene|ral rule|
|00001180| 3a 20 69 66 20 61 20 68 | 75 6d 61 6e 20 77 69 6c |: if a h|uman wil|
|00001190| 6c 0a 62 65 20 74 79 70 | 69 6e 67 20 69 6e 20 69 |l.be typ|ing in i|
|000011a0| 6e 70 75 74 20 74 6f 20 | 79 6f 75 72 20 73 63 61 |nput to |your sca|
|000011b0| 6e 6e 65 72 2c 20 75 73 | 65 0a 58 2e 42 20 2d 49 |nner, us|e.X.B -I|
|000011c0| 2c 0a 6f 74 68 65 72 77 | 69 73 65 20 64 6f 6e 27 |,.otherw|ise don'|
|000011d0| 74 3b 20 69 66 20 79 6f | 75 20 64 6f 6e 27 74 20 |t; if yo|u don't |
|000011e0| 63 61 72 65 20 61 62 6f | 75 74 20 68 6f 77 20 66 |care abo|ut how f|
|000011f0| 61 73 74 20 79 6f 75 72 | 20 73 63 61 6e 6e 65 72 |ast your| scanner|
|00001200| 73 20 72 75 6e 20 61 6e | 64 0a 64 6f 6e 27 74 20 |s run an|d.don't |
|00001210| 77 61 6e 74 20 74 6f 20 | 6d 61 6b 65 20 61 6e 79 |want to |make any|
|00001220| 20 61 73 73 75 6d 70 74 | 69 6f 6e 73 20 61 62 6f | assumpt|ions abo|
|00001230| 75 74 20 74 68 65 20 69 | 6e 70 75 74 20 74 6f 20 |ut the i|nput to |
|00001240| 79 6f 75 72 20 73 63 61 | 6e 6e 65 72 2c 0a 61 6c |your sca|nner,.al|
|00001250| 77 61 79 73 20 75 73 65 | 0a 58 2e 42 20 2d 49 2e |ways use|.X.B -I.|
|00001260| 0a 58 2e 49 50 0a 4e 6f | 74 65 2c 0a 58 2e 42 20 |.X.IP.No|te,.X.B |
|00001270| 2d 49 0a 63 61 6e 6e 6f | 74 20 62 65 20 75 73 65 |-I.canno|t be use|
|00001280| 64 20 69 6e 20 63 6f 6e | 6a 75 6e 63 74 69 6f 6e |d in con|junction|
|00001290| 20 77 69 74 68 0a 58 2e | 49 20 66 75 6c 6c 0a 6f | with.X.|I full.o|
|000012a0| 72 0a 58 2e 49 20 66 61 | 73 74 20 74 61 62 6c 65 |r.X.I fa|st table|
|000012b0| 73 2c 0a 69 2e 65 2e 2c | 20 74 68 65 0a 58 2e 42 |s,.i.e.,| the.X.B|
|000012c0| 20 2d 66 2c 20 2d 46 2c | 20 2d 63 66 2c 0a 6f 72 | -f, -F,| -cf,.or|
|000012d0| 0a 58 2e 42 20 2d 63 46 | 0a 66 6c 61 67 73 2e 0a |.X.B -cF|.flags..|
|000012e0| 58 2e 54 50 0a 58 2e 42 | 20 2d 4c 0a 69 6e 73 74 |X.TP.X.B| -L.inst|
|000012f0| 72 75 63 74 73 20 66 6c | 65 78 20 74 6f 20 6e 6f |ructs fl|ex to no|
|00001300| 74 20 67 65 6e 65 72 61 | 74 65 0a 58 2e 42 20 23 |t genera|te.X.B #|
|00001310| 6c 69 6e 65 0a 64 69 72 | 65 63 74 69 76 65 73 20 |line.dir|ectives |
|00001320| 28 73 65 65 20 62 65 6c | 6f 77 29 2e 0a 58 2e 54 |(see bel|ow)..X.T|
|00001330| 50 0a 58 2e 42 20 2d 54 | 0a 6d 61 6b 65 73 20 66 |P.X.B -T|.makes f|
|00001340| 6c 65 78 20 72 75 6e 20 | 69 6e 0a 58 2e 49 20 74 |lex run |in.X.I t|
|00001350| 72 61 63 65 0a 6d 6f 64 | 65 2e 20 20 49 74 20 77 |race.mod|e. It w|
|00001360| 69 6c 6c 20 67 65 6e 65 | 72 61 74 65 20 61 20 6c |ill gene|rate a l|
|00001370| 6f 74 20 6f 66 20 6d 65 | 73 73 61 67 65 73 20 74 |ot of me|ssages t|
|00001380| 6f 20 73 74 61 6e 64 61 | 72 64 20 6f 75 74 20 63 |o standa|rd out c|
|00001390| 6f 6e 63 65 72 6e 69 6e | 67 0a 74 68 65 20 66 6f |oncernin|g.the fo|
|000013a0| 72 6d 20 6f 66 20 74 68 | 65 20 69 6e 70 75 74 20 |rm of th|e input |
|000013b0| 61 6e 64 20 74 68 65 20 | 72 65 73 75 6c 74 61 6e |and the |resultan|
|000013c0| 74 20 6e 6f 6e 2d 64 65 | 74 65 72 6d 69 6e 69 73 |t non-de|terminis|
|000013d0| 74 69 63 20 61 6e 64 20 | 64 65 74 65 72 6d 69 6e |tic and |determin|
|000013e0| 69 73 74 69 63 0a 66 69 | 6e 69 74 65 20 61 75 74 |istic.fi|nite aut|
|000013f0| 6f 6d 61 74 6f 6e 73 2e | 20 20 54 68 69 73 20 6f |omatons.| This o|
|00001400| 70 74 69 6f 6e 20 69 73 | 20 6d 6f 73 74 6c 79 20 |ption is| mostly |
|00001410| 66 6f 72 20 75 73 65 20 | 69 6e 20 6d 61 69 6e 74 |for use |in maint|
|00001420| 61 69 6e 69 6e 67 20 66 | 6c 65 78 2e 0a 58 2e 54 |aining f|lex..X.T|
|00001430| 50 20 0a 58 2e 42 20 2d | 63 5b 65 66 6d 46 5d 0a |P .X.B -|c[efmF].|
|00001440| 63 6f 6e 74 72 6f 6c 73 | 20 74 68 65 20 64 65 67 |controls| the deg|
|00001450| 72 65 65 20 6f 66 20 74 | 61 62 6c 65 20 63 6f 6d |ree of t|able com|
|00001460| 70 72 65 73 73 69 6f 6e | 2e 0a 58 2e 42 20 2d 63 |pression|..X.B -c|
|00001470| 65 0a 64 69 72 65 63 74 | 73 20 66 6c 65 78 20 74 |e.direct|s flex t|
|00001480| 6f 20 63 6f 6e 73 74 72 | 75 63 74 0a 58 2e 49 20 |o constr|uct.X.I |
|00001490| 65 71 75 69 76 61 6c 65 | 6e 63 65 20 63 6c 61 73 |equivale|nce clas|
|000014a0| 73 65 73 2c 0a 69 2e 65 | 2e 2c 20 73 65 74 73 20 |ses,.i.e|., sets |
|000014b0| 6f 66 20 63 68 61 72 61 | 63 74 65 72 73 0a 77 68 |of chara|cters.wh|
|000014c0| 69 63 68 20 68 61 76 65 | 20 69 64 65 6e 74 69 63 |ich have| identic|
|000014d0| 61 6c 20 6c 65 78 69 63 | 61 6c 20 70 72 6f 70 65 |al lexic|al prope|
|000014e0| 72 74 69 65 73 20 28 66 | 6f 72 20 65 78 61 6d 70 |rties (f|or examp|
|000014f0| 6c 65 2c 20 69 66 20 74 | 68 65 20 6f 6e 6c 79 0a |le, if t|he only.|
|00001500| 61 70 70 65 61 72 61 6e | 63 65 20 6f 66 20 64 69 |appearan|ce of di|
|00001510| 67 69 74 73 20 69 6e 20 | 74 68 65 20 66 6c 65 78 |gits in |the flex|
|00001520| 20 69 6e 70 75 74 20 69 | 73 20 69 6e 20 74 68 65 | input i|s in the|
|00001530| 20 63 68 61 72 61 63 74 | 65 72 20 63 6c 61 73 73 | charact|er class|
|00001540| 0a 58 22 5b 30 2d 39 5d | 22 20 74 68 65 6e 20 74 |.X"[0-9]|" then t|
|00001550| 68 65 20 64 69 67 69 74 | 73 20 27 30 27 2c 20 27 |he digit|s '0', '|
|00001560| 31 27 2c 20 2e 2e 2e 2c | 20 27 39 27 20 77 69 6c |1', ...,| '9' wil|
|00001570| 6c 20 61 6c 6c 20 62 65 | 20 70 75 74 0a 69 6e 20 |l all be| put.in |
|00001580| 74 68 65 20 73 61 6d 65 | 20 65 71 75 69 76 61 6c |the same| equival|
|00001590| 65 6e 63 65 20 63 6c 61 | 73 73 29 2e 0a 58 2e 42 |ence cla|ss)..X.B|
|000015a0| 20 2d 63 66 0a 73 70 65 | 63 69 66 69 65 73 20 74 | -cf.spe|cifies t|
|000015b0| 68 61 74 20 74 68 65 0a | 58 2e 49 20 66 75 6c 6c |hat the.|X.I full|
|000015c0| 0a 73 63 61 6e 6e 65 72 | 20 74 61 62 6c 65 73 20 |.scanner| tables |
|000015d0| 73 68 6f 75 6c 64 20 62 | 65 20 67 65 6e 65 72 61 |should b|e genera|
|000015e0| 74 65 64 20 2d 20 66 6c | 65 78 20 73 68 6f 75 6c |ted - fl|ex shoul|
|000015f0| 64 20 6e 6f 74 20 63 6f | 6d 70 72 65 73 73 20 74 |d not co|mpress t|
|00001600| 68 65 0a 74 61 62 6c 65 | 73 20 62 79 20 74 61 6b |he.table|s by tak|
|00001610| 69 6e 67 20 61 64 76 61 | 6e 74 61 67 65 73 20 6f |ing adva|ntages o|
|00001620| 66 20 73 69 6d 69 6c 61 | 72 20 74 72 61 6e 73 69 |f simila|r transi|
|00001630| 74 69 6f 6e 20 66 75 6e | 63 74 69 6f 6e 73 20 66 |tion fun|ctions f|
|00001640| 6f 72 0a 64 69 66 66 65 | 72 65 6e 74 20 73 74 61 |or.diffe|rent sta|
|00001650| 74 65 73 2e 0a 58 2e 42 | 20 2d 63 46 0a 73 70 65 |tes..X.B| -cF.spe|
|00001660| 63 69 66 69 65 73 20 74 | 68 61 74 20 74 68 65 20 |cifies t|hat the |
|00001670| 61 6c 74 65 72 6e 61 74 | 65 20 66 61 73 74 20 73 |alternat|e fast s|
|00001680| 63 61 6e 6e 65 72 20 72 | 65 70 72 65 73 65 6e 74 |canner r|epresent|
|00001690| 61 74 69 6f 6e 20 28 64 | 65 73 63 72 69 62 65 64 |ation (d|escribed|
|000016a0| 0a 61 62 6f 76 65 20 75 | 6e 64 65 72 20 74 68 65 |.above u|nder the|
|000016b0| 0a 58 2e 42 20 2d 46 0a | 66 6c 61 67 29 0a 73 68 |.X.B -F.|flag).sh|
|000016c0| 6f 75 6c 64 20 62 65 20 | 75 73 65 64 2e 0a 58 2e |ould be |used..X.|
|000016d0| 42 20 2d 63 6d 0a 64 69 | 72 65 63 74 73 20 66 6c |B -cm.di|rects fl|
|000016e0| 65 78 20 74 6f 20 63 6f | 6e 73 74 72 75 63 74 0a |ex to co|nstruct.|
|000016f0| 58 2e 49 20 6d 65 74 61 | 2d 65 71 75 69 76 61 6c |X.I meta|-equival|
|00001700| 65 6e 63 65 20 63 6c 61 | 73 73 65 73 2c 0a 77 68 |ence cla|sses,.wh|
|00001710| 69 63 68 20 61 72 65 20 | 73 65 74 73 20 6f 66 20 |ich are |sets of |
|00001720| 65 71 75 69 76 61 6c 65 | 6e 63 65 20 63 6c 61 73 |equivale|nce clas|
|00001730| 73 65 73 20 28 6f 72 20 | 63 68 61 72 61 63 74 65 |ses (or |characte|
|00001740| 72 73 2c 20 69 66 20 65 | 71 75 69 76 61 6c 65 6e |rs, if e|quivalen|
|00001750| 63 65 0a 63 6c 61 73 73 | 65 73 20 61 72 65 20 6e |ce.class|es are n|
|00001760| 6f 74 20 62 65 69 6e 67 | 20 75 73 65 64 29 20 74 |ot being| used) t|
|00001770| 68 61 74 20 61 72 65 20 | 63 6f 6d 6d 6f 6e 6c 79 |hat are |commonly|
|00001780| 20 75 73 65 64 20 74 6f | 67 65 74 68 65 72 2e 0a | used to|gether..|
|00001790| 41 20 6c 6f 6e 65 0a 58 | 2e 42 20 2d 63 0a 73 70 |A lone.X|.B -c.sp|
|000017a0| 65 63 69 66 69 65 73 20 | 74 68 61 74 20 74 68 65 |ecifies |that the|
|000017b0| 20 73 63 61 6e 6e 65 72 | 20 74 61 62 6c 65 73 20 | scanner| tables |
|000017c0| 73 68 6f 75 6c 64 20 62 | 65 20 63 6f 6d 70 72 65 |should b|e compre|
|000017d0| 73 73 65 64 20 62 75 74 | 20 6e 65 69 74 68 65 72 |ssed but| neither|
|000017e0| 0a 65 71 75 69 76 61 6c | 65 6e 63 65 20 63 6c 61 |.equival|ence cla|
|000017f0| 73 73 65 73 20 6e 6f 72 | 20 6d 65 74 61 2d 65 71 |sses nor| meta-eq|
|00001800| 75 69 76 61 6c 65 6e 63 | 65 20 63 6c 61 73 73 65 |uivalenc|e classe|
|00001810| 73 20 73 68 6f 75 6c 64 | 20 62 65 20 75 73 65 64 |s should| be used|
|00001820| 2e 0a 58 2e 49 50 0a 54 | 68 65 20 6f 70 74 69 6f |..X.IP.T|he optio|
|00001830| 6e 73 0a 58 2e 42 20 2d | 63 66 0a 6f 72 0a 58 2e |ns.X.B -|cf.or.X.|
|00001840| 42 20 2d 63 46 0a 61 6e | 64 0a 58 2e 42 20 2d 63 |B -cF.an|d.X.B -c|
|00001850| 6d 0a 64 6f 20 6e 6f 74 | 20 6d 61 6b 65 20 73 65 |m.do not| make se|
|00001860| 6e 73 65 20 74 6f 67 65 | 74 68 65 72 20 2d 20 74 |nse toge|ther - t|
|00001870| 68 65 72 65 20 69 73 20 | 6e 6f 20 6f 70 70 6f 72 |here is |no oppor|
|00001880| 74 75 6e 69 74 79 20 66 | 6f 72 20 6d 65 74 61 2d |tunity f|or meta-|
|00001890| 65 71 75 69 76 61 6c 65 | 6e 63 65 0a 63 6c 61 73 |equivale|nce.clas|
|000018a0| 73 65 73 20 69 66 20 74 | 68 65 20 74 61 62 6c 65 |ses if t|he table|
|000018b0| 20 69 73 20 6e 6f 74 20 | 62 65 69 6e 67 20 63 6f | is not |being co|
|000018c0| 6d 70 72 65 73 73 65 64 | 2e 20 20 4f 74 68 65 72 |mpressed|. Other|
|000018d0| 77 69 73 65 20 74 68 65 | 20 6f 70 74 69 6f 6e 73 |wise the| options|
|000018e0| 0a 6d 61 79 20 62 65 20 | 66 72 65 65 6c 79 20 6d |.may be |freely m|
|000018f0| 69 78 65 64 2e 0a 58 2e | 49 50 0a 54 68 65 20 64 |ixed..X.|IP.The d|
|00001900| 65 66 61 75 6c 74 20 73 | 65 74 74 69 6e 67 20 69 |efault s|etting i|
|00001910| 73 0a 58 2e 42 20 2d 63 | 65 6d 0a 77 68 69 63 68 |s.X.B -c|em.which|
|00001920| 20 73 70 65 63 69 66 69 | 65 73 20 74 68 61 74 20 | specifi|es that |
|00001930| 66 6c 65 78 20 73 68 6f | 75 6c 64 20 67 65 6e 65 |flex sho|uld gene|
|00001940| 72 61 74 65 20 65 71 75 | 69 76 61 6c 65 6e 63 65 |rate equ|ivalence|
|00001950| 20 63 6c 61 73 73 65 73 | 0a 61 6e 64 20 6d 65 74 | classes|.and met|
|00001960| 61 2d 65 71 75 69 76 61 | 6c 65 6e 63 65 20 63 6c |a-equiva|lence cl|
|00001970| 61 73 73 65 73 2e 20 20 | 54 68 69 73 20 73 65 74 |asses. |This set|
|00001980| 74 69 6e 67 20 70 72 6f | 76 69 64 65 73 20 74 68 |ting pro|vides th|
|00001990| 65 20 68 69 67 68 65 73 | 74 0a 64 65 67 72 65 65 |e highes|t.degree|
|000019a0| 20 6f 66 20 74 61 62 6c | 65 20 63 6f 6d 70 72 65 | of tabl|e compre|
|000019b0| 73 73 69 6f 6e 2e 20 20 | 59 6f 75 20 63 61 6e 20 |ssion. |You can |
|000019c0| 74 72 61 64 65 20 6f 66 | 66 0a 66 61 73 74 65 72 |trade of|f.faster|
|000019d0| 2d 65 78 65 63 75 74 69 | 6e 67 20 73 63 61 6e 6e |-executi|ng scann|
|000019e0| 65 72 73 20 61 74 20 74 | 68 65 20 63 6f 73 74 20 |ers at t|he cost |
|000019f0| 6f 66 20 6c 61 72 67 65 | 72 20 74 61 62 6c 65 73 |of large|r tables|
|00001a00| 20 77 69 74 68 0a 74 68 | 65 20 66 6f 6c 6c 6f 77 | with.th|e follow|
|00001a10| 69 6e 67 20 67 65 6e 65 | 72 61 6c 6c 79 20 62 65 |ing gene|rally be|
|00001a20| 69 6e 67 20 74 72 75 65 | 3a 0a 58 2e 6e 66 0a 58 |ing true|:.X.nf.X|
|00001a30| 0a 58 20 20 20 20 73 6c | 6f 77 65 73 74 20 20 20 |.X sl|owest |
|00001a40| 20 20 20 20 20 20 20 20 | 20 73 6d 61 6c 6c 65 73 | | smalles|
|00001a50| 74 0a 58 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |t.X | |
|00001a60| 20 20 2d 63 65 6d 0a 58 | 20 20 20 20 20 20 20 20 | -cem.X| |
|00001a70| 20 20 20 20 20 20 20 2d | 63 65 0a 58 20 20 20 20 | -|ce.X |
|00001a80| 20 20 20 20 20 20 20 20 | 20 20 20 2d 63 6d 0a 58 | | -cm.X|
|00001a90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2d | | -|
|00001aa0| 63 0a 58 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |c.X | |
|00001ab0| 20 20 2d 63 7b 66 2c 46 | 7d 65 0a 58 20 20 20 20 | -c{f,F|}e.X |
|00001ac0| 20 20 20 20 20 20 20 20 | 20 20 20 2d 63 7b 66 2c | | -c{f,|
|00001ad0| 46 7d 0a 58 20 20 20 20 | 66 61 73 74 65 73 74 20 |F}.X |fastest |
|00001ae0| 20 20 20 20 20 20 20 20 | 20 20 20 6c 61 72 67 65 | | large|
|00001af0| 73 74 0a 58 0a 58 2e 66 | 69 0a 58 2e 54 50 0a 58 |st.X.X.f|i.X.TP.X|
|00001b00| 2e 42 20 2d 53 73 6b 65 | 6c 65 74 6f 6e 5f 66 69 |.B -Sske|leton_fi|
|00001b10| 6c 65 0a 6f 76 65 72 72 | 69 64 65 73 20 74 68 65 |le.overr|ides the|
|00001b20| 20 64 65 66 61 75 6c 74 | 20 73 6b 65 6c 65 74 6f | default| skeleto|
|00001b30| 6e 20 66 69 6c 65 20 66 | 72 6f 6d 20 77 68 69 63 |n file f|rom whic|
|00001b40| 68 20 66 6c 65 78 20 63 | 6f 6e 73 74 72 75 63 74 |h flex c|onstruct|
|00001b50| 73 0a 69 74 73 20 73 63 | 61 6e 6e 65 72 73 2e 20 |s.its sc|anners. |
|00001b60| 20 59 6f 75 27 6c 6c 20 | 6e 65 76 65 72 20 6e 65 | You'll |never ne|
|00001b70| 65 64 20 74 68 69 73 20 | 6f 70 74 69 6f 6e 20 75 |ed this |option u|
|00001b80| 6e 6c 65 73 73 20 79 6f | 75 20 61 72 65 20 64 6f |nless yo|u are do|
|00001b90| 69 6e 67 0a 66 6c 65 78 | 20 6d 61 69 6e 74 65 6e |ing.flex| mainten|
|00001ba0| 61 6e 63 65 20 6f 72 20 | 64 65 76 65 6c 6f 70 6d |ance or |developm|
|00001bb0| 65 6e 74 2e 0a 58 2e 53 | 48 20 49 4e 43 4f 4d 50 |ent..X.S|H INCOMP|
|00001bc0| 41 54 49 42 49 4c 49 54 | 49 45 53 20 57 49 54 48 |ATIBILIT|IES WITH|
|00001bd0| 20 4c 45 58 0a 58 2e 49 | 20 66 6c 65 78 0a 69 73 | LEX.X.I| flex.is|
|00001be0| 20 66 75 6c 6c 79 20 63 | 6f 6d 70 61 74 69 62 6c | fully c|ompatibl|
|00001bf0| 65 20 77 69 74 68 0a 58 | 2e 49 20 6c 65 78 0a 77 |e with.X|.I lex.w|
|00001c00| 69 74 68 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |ith the |followin|
|00001c10| 67 20 65 78 63 65 70 74 | 69 6f 6e 73 3a 0a 58 2e |g except|ions:.X.|
|00001c20| 49 50 20 2d 0a 54 68 65 | 72 65 20 69 73 20 6e 6f |IP -.The|re is no|
|00001c30| 20 72 75 6e 2d 74 69 6d | 65 20 6c 69 62 72 61 72 | run-tim|e librar|
|00001c40| 79 20 74 6f 20 6c 69 6e | 6b 20 77 69 74 68 2e 20 |y to lin|k with. |
|00001c50| 20 59 6f 75 20 6e 65 65 | 64 6e 27 74 0a 73 70 65 | You nee|dn't.spe|
|00001c60| 63 69 66 79 0a 58 2e 49 | 20 2d 6c 6c 0a 77 68 65 |cify.X.I| -ll.whe|
|00001c70| 6e 20 6c 69 6e 6b 69 6e | 67 2c 20 61 6e 64 20 79 |n linkin|g, and y|
|00001c80| 6f 75 20 6d 75 73 74 20 | 73 75 70 70 6c 79 20 61 |ou must |supply a|
|00001c90| 20 6d 61 69 6e 20 70 72 | 6f 67 72 61 6d 2e 20 20 | main pr|ogram. |
|00001ca0| 28 48 61 63 6b 65 72 27 | 73 20 6e 6f 74 65 3a 20 |(Hacker'|s note: |
|00001cb0| 73 69 6e 63 65 0a 74 68 | 65 20 6c 65 78 20 6c 69 |since.th|e lex li|
|00001cc0| 62 72 61 72 79 20 63 6f | 6e 74 61 69 6e 73 20 61 |brary co|ntains a|
|00001cd0| 20 6d 61 69 6e 28 29 20 | 77 68 69 63 68 20 73 69 | main() |which si|
|00001ce0| 6d 70 6c 79 20 63 61 6c | 6c 73 20 79 79 6c 65 78 |mply cal|ls yylex|
|00001cf0| 28 29 2c 20 79 6f 75 20 | 61 63 74 75 61 6c 6c 79 |(), you |actually|
|00001d00| 0a 58 2e 49 20 63 61 6e | 0a 62 65 20 6c 61 7a 79 |.X.I can|.be lazy|
|00001d10| 20 61 6e 64 20 6e 6f 74 | 20 73 75 70 70 6c 79 20 | and not| supply |
|00001d20| 79 6f 75 72 20 6f 77 6e | 20 6d 61 69 6e 20 70 72 |your own| main pr|
|00001d30| 6f 67 72 61 6d 20 61 6e | 64 20 6c 69 6e 6b 20 77 |ogram an|d link w|
|00001d40| 69 74 68 0a 58 2e 49 20 | 2d 6c 6c 2e 29 0a 58 2e |ith.X.I |-ll.).X.|
|00001d50| 49 50 20 2d 0a 6c 65 78 | 27 73 0a 58 2e 42 20 25 |IP -.lex|'s.X.B %|
|00001d60| 72 0a 58 28 52 61 74 66 | 6f 72 20 73 63 61 6e 6e |r.X(Ratf|or scann|
|00001d70| 65 72 73 29 20 61 6e 64 | 0a 58 2e 42 20 25 74 0a |ers) and|.X.B %t.|
|00001d80| 58 28 74 72 61 6e 73 6c | 61 74 69 6f 6e 20 74 61 |X(transl|ation ta|
|00001d90| 62 6c 65 29 20 6f 70 74 | 69 6f 6e 73 0a 61 72 65 |ble) opt|ions.are|
|00001da0| 20 6e 6f 74 20 73 75 70 | 70 6f 72 74 65 64 2e 0a | not sup|ported..|
|00001db0| 58 2e 49 50 20 2d 0a 54 | 68 65 20 64 6f 2d 6e 6f |X.IP -.T|he do-no|
|00001dc0| 74 68 69 6e 67 0a 58 2e | 75 6c 0a 58 2d 6e 0a 66 |thing.X.|ul.X-n.f|
|00001dd0| 6c 61 67 20 69 73 20 6e | 6f 74 20 73 75 70 70 6f |lag is n|ot suppo|
|00001de0| 72 74 65 64 2e 0a 58 2e | 49 50 20 2d 0a 57 68 65 |rted..X.|IP -.Whe|
|00001df0| 6e 20 64 65 66 69 6e 69 | 74 69 6f 6e 73 20 61 72 |n defini|tions ar|
|00001e00| 65 20 65 78 70 61 6e 64 | 65 64 2c 20 66 6c 65 78 |e expand|ed, flex|
|00001e10| 20 65 6e 63 6c 6f 73 65 | 73 20 74 68 65 6d 20 69 | enclose|s them i|
|00001e20| 6e 20 70 61 72 65 6e 74 | 68 65 73 65 73 2e 0a 57 |n parent|heses..W|
|00001e30| 69 74 68 20 6c 65 78 2c | 20 74 68 65 20 66 6f 6c |ith lex,| the fol|
|00001e40| 6c 6f 77 69 6e 67 0a 58 | 2e 6e 66 0a 58 0a 58 20 |lowing.X|.nf.X.X |
|00001e50| 20 20 20 4e 41 4d 45 20 | 20 20 20 5b 41 2d 5a 5d | NAME | [A-Z]|
|00001e60| 5b 41 2d 5a 30 2d 39 5d | 2a 0a 58 20 20 20 20 25 |[A-Z0-9]|*.X %|
|00001e70| 25 0a 58 20 20 20 20 66 | 6f 6f 7b 4e 41 4d 45 7d |%.X f|oo{NAME}|
|00001e80| 3f 20 20 20 20 20 20 70 | 72 69 6e 74 66 28 20 22 |? p|rintf( "|
|00001e90| 46 6f 75 6e 64 20 69 74 | 5c 5c 6e 22 20 29 3b 0a |Found it|\\n" );.|
|00001ea0| 58 20 20 20 20 25 25 0a | 58 0a 58 2e 66 69 0a 77 |X %%.|X.X.fi.w|
|00001eb0| 69 6c 6c 20 6e 6f 74 20 | 6d 61 74 63 68 20 74 68 |ill not |match th|
|00001ec0| 65 20 73 74 72 69 6e 67 | 20 22 66 6f 6f 22 20 62 |e string| "foo" b|
|00001ed0| 65 63 61 75 73 65 20 77 | 68 65 6e 20 74 68 65 20 |ecause w|hen the |
|00001ee0| 6d 61 63 72 6f 0a 69 73 | 20 65 78 70 61 6e 64 65 |macro.is| expande|
|00001ef0| 64 20 74 68 65 20 72 75 | 6c 65 20 69 73 20 65 71 |d the ru|le is eq|
|00001f00| 75 69 76 61 6c 65 6e 74 | 20 74 6f 20 22 66 6f 6f |uivalent| to "foo|
|00001f10| 5b 41 2d 5a 5d 5b 41 2d | 5a 30 2d 39 5d 2a 3f 22 |[A-Z][A-|Z0-9]*?"|
|00001f20| 0a 61 6e 64 20 74 68 65 | 20 70 72 65 63 65 64 65 |.and the| precede|
|00001f30| 6e 63 65 20 69 73 20 73 | 75 63 68 20 74 68 61 74 |nce is s|uch that|
|00001f40| 20 74 68 65 20 27 3f 27 | 20 69 73 20 61 73 73 6f | the '?'| is asso|
|00001f50| 63 69 61 74 65 64 20 77 | 69 74 68 0a 58 22 5b 41 |ciated w|ith.X"[A|
|00001f60| 2d 5a 30 2d 39 5d 2a 22 | 2e 20 20 57 69 74 68 20 |-Z0-9]*"|. With |
|00001f70| 66 6c 65 78 2c 20 74 68 | 65 20 72 75 6c 65 20 77 |flex, th|e rule w|
|00001f80| 69 6c 6c 20 62 65 20 65 | 78 70 61 6e 64 65 64 20 |ill be e|xpanded |
|00001f90| 74 6f 0a 58 22 66 6f 6f | 28 5b 41 2d 7a 5d 5b 41 |to.X"foo|([A-z][A|
|00001fa0| 2d 5a 30 2d 39 5d 2a 29 | 3f 22 20 61 6e 64 20 73 |-Z0-9]*)|?" and s|
|00001fb0| 6f 20 74 68 65 20 73 74 | 72 69 6e 67 20 22 66 6f |o the st|ring "fo|
|00001fc0| 6f 22 20 77 69 6c 6c 20 | 6d 61 74 63 68 2e 0a 58 |o" will |match..X|
|00001fd0| 2e 49 50 20 2d 0a 58 2e | 42 20 79 79 6d 6f 72 65 |.IP -.X.|B yymore|
|00001fe0| 28 29 0a 69 73 20 6e 6f | 74 20 73 75 70 70 6f 72 |().is no|t suppor|
|00001ff0| 74 65 64 2e 0a 58 2e 49 | 50 20 2d 0a 54 68 65 20 |ted..X.I|P -.The |
|00002000| 75 6e 64 6f 63 75 6d 65 | 6e 74 65 64 20 6c 65 78 |undocume|nted lex|
|00002010| 2d 73 63 61 6e 6e 65 72 | 20 69 6e 74 65 72 6e 61 |-scanner| interna|
|00002020| 6c 20 76 61 72 69 61 62 | 6c 65 0a 58 2e 42 20 79 |l variab|le.X.B y|
|00002030| 79 6c 69 6e 65 6e 6f 0a | 69 73 20 6e 6f 74 20 73 |ylineno.|is not s|
|00002040| 75 70 70 6f 72 74 65 64 | 2e 0a 58 2e 49 50 20 2d |upported|..X.IP -|
|00002050| 0a 49 66 20 79 6f 75 72 | 20 69 6e 70 75 74 20 75 |.If your| input u|
|00002060| 73 65 73 0a 58 2e 42 20 | 52 45 4a 45 43 54 2c 0a |ses.X.B |REJECT,.|
|00002070| 79 6f 75 20 6d 75 73 74 | 20 72 75 6e 20 66 6c 65 |you must| run fle|
|00002080| 78 20 77 69 74 68 20 74 | 68 65 0a 58 2e 42 20 2d |x with t|he.X.B -|
|00002090| 72 0a 66 6c 61 67 2e 20 | 20 49 66 20 79 6f 75 20 |r.flag. | If you |
|000020a0| 6c 65 61 76 65 20 6f 75 | 74 20 74 68 65 20 66 6c |leave ou|t the fl|
|000020b0| 61 67 2c 20 74 68 65 20 | 73 63 61 6e 6e 65 72 20 |ag, the |scanner |
|000020c0| 77 69 6c 6c 20 61 62 6f | 72 74 20 61 74 20 72 75 |will abo|rt at ru|
|000020d0| 6e 2d 74 69 6d 65 0a 77 | 69 74 68 20 61 20 6d 65 |n-time.w|ith a me|
|000020e0| 73 73 61 67 65 20 74 68 | 61 74 20 74 68 65 20 73 |ssage th|at the s|
|000020f0| 63 61 6e 6e 65 72 20 77 | 61 73 20 63 6f 6d 70 69 |canner w|as compi|
|00002100| 6c 65 64 20 77 69 74 68 | 6f 75 74 20 74 68 65 20 |led with|out the |
|00002110| 66 6c 61 67 20 62 65 69 | 6e 67 0a 73 70 65 63 69 |flag bei|ng.speci|
|00002120| 66 69 65 64 2e 0a 58 2e | 49 50 20 2d 0a 54 68 65 |fied..X.|IP -.The|
|00002130| 0a 58 2e 42 20 69 6e 70 | 75 74 28 29 0a 72 6f 75 |.X.B inp|ut().rou|
|00002140| 74 69 6e 65 20 69 73 20 | 6e 6f 74 20 72 65 64 65 |tine is |not rede|
|00002150| 66 69 6e 61 62 6c 65 2c | 20 74 68 6f 75 67 68 20 |finable,| though |
|00002160| 6d 61 79 20 62 65 20 63 | 61 6c 6c 65 64 20 74 6f |may be c|alled to|
|00002170| 20 72 65 61 64 20 63 68 | 61 72 61 63 74 65 72 73 | read ch|aracters|
|00002180| 0a 66 6f 6c 6c 6f 77 69 | 6e 67 20 77 68 61 74 65 |.followi|ng whate|
|00002190| 76 65 72 20 68 61 73 20 | 62 65 65 6e 20 6d 61 74 |ver has |been mat|
|000021a0| 63 68 65 64 20 62 79 20 | 61 20 72 75 6c 65 2e 20 |ched by |a rule. |
|000021b0| 20 49 66 0a 58 2e 42 20 | 69 6e 70 75 74 28 29 0a | If.X.B |input().|
|000021c0| 65 6e 63 6f 75 6e 74 65 | 72 73 20 61 6e 64 20 65 |encounte|rs and e|
|000021d0| 6e 64 2d 6f 66 2d 66 69 | 6c 65 20 74 68 65 20 6e |nd-of-fi|le the n|
|000021e0| 6f 72 6d 61 6c 0a 58 2e | 42 20 79 79 77 72 61 70 |ormal.X.|B yywrap|
|000021f0| 28 29 0a 70 72 6f 63 65 | 73 73 69 6e 67 20 69 73 |().proce|ssing is|
|00002200| 20 64 6f 6e 65 2e 20 20 | 41 20 60 60 72 65 61 6c | done. |A ``real|
|00002210| 27 27 20 65 6e 64 2d 6f | 66 2d 66 69 6c 65 20 69 |'' end-o|f-file i|
|00002220| 73 20 72 65 74 75 72 6e | 65 64 20 61 73 0a 58 2e |s return|ed as.X.|
|00002230| 49 20 45 4f 46 2e 0a 58 | 2e 49 50 0a 49 6e 70 75 |I EOF..X|.IP.Inpu|
|00002240| 74 20 63 61 6e 20 62 65 | 20 63 6f 6e 74 72 6f 6c |t can be| control|
|00002250| 6c 65 64 20 62 79 20 72 | 65 64 65 66 69 6e 69 6e |led by r|edefinin|
|00002260| 67 20 74 68 65 0a 58 2e | 42 20 59 59 5f 49 4e 50 |g the.X.|B YY_INP|
|00002270| 55 54 0a 6d 61 63 72 6f | 2e 0a 59 59 5f 49 4e 50 |UT.macro|..YY_INP|
|00002280| 55 54 27 73 20 63 61 6c | 6c 69 6e 67 20 73 65 71 |UT's cal|ling seq|
|00002290| 75 65 6e 63 65 20 69 73 | 20 22 59 59 5f 49 4e 50 |uence is| "YY_INP|
|000022a0| 55 54 28 62 75 66 2c 72 | 65 73 75 6c 74 2c 6d 61 |UT(buf,r|esult,ma|
|000022b0| 78 5f 73 69 7a 65 29 22 | 2e 20 20 49 74 73 0a 61 |x_size)"|. Its.a|
|000022c0| 63 74 69 6f 6e 20 69 73 | 20 74 6f 20 70 6c 61 63 |ction is| to plac|
|000022d0| 65 20 75 70 20 74 6f 20 | 6d 61 78 5f 73 69 7a 65 |e up to |max_size|
|000022e0| 20 63 68 61 72 61 63 74 | 65 72 73 20 69 6e 20 74 | charact|ers in t|
|000022f0| 68 65 20 63 68 61 72 61 | 63 74 65 72 20 62 75 66 |he chara|cter buf|
|00002300| 66 65 72 20 22 62 75 66 | 22 0a 61 6e 64 20 72 65 |fer "buf|".and re|
|00002310| 74 75 72 6e 20 69 6e 20 | 74 68 65 20 69 6e 74 65 |turn in |the inte|
|00002320| 67 65 72 20 76 61 72 69 | 61 62 6c 65 20 22 72 65 |ger vari|able "re|
|00002330| 73 75 6c 74 22 20 65 69 | 74 68 65 72 20 74 68 65 |sult" ei|ther the|
|00002340| 0a 6e 75 6d 62 65 72 20 | 6f 66 20 63 68 61 72 61 |.number |of chara|
|00002350| 63 74 65 72 73 20 72 65 | 61 64 20 6f 72 20 74 68 |cters re|ad or th|
|00002360| 65 20 63 6f 6e 73 74 61 | 6e 74 20 59 59 5f 4e 55 |e consta|nt YY_NU|
|00002370| 4c 4c 20 28 30 20 6f 6e | 20 55 6e 69 78 20 73 79 |LL (0 on| Unix sy|
|00002380| 73 74 65 6d 73 29 0a 73 | 79 73 74 65 6d 73 29 20 |stems).s|ystems) |
|00002390| 74 6f 20 69 6e 64 69 63 | 61 74 65 20 45 4f 46 2e |to indic|ate EOF.|
|000023a0| 20 20 54 68 65 20 64 65 | 66 61 75 6c 74 20 59 59 | The de|fault YY|
|000023b0| 5f 49 4e 50 55 54 20 72 | 65 61 64 73 20 66 72 6f |_INPUT r|eads fro|
|000023c0| 6d 20 74 68 65 0a 66 69 | 6c 65 2d 70 6f 69 6e 74 |m the.fi|le-point|
|000023d0| 65 72 20 22 79 79 69 6e | 22 20 28 77 68 69 63 68 |er "yyin|" (which|
|000023e0| 20 69 73 20 62 79 20 64 | 65 66 61 75 6c 74 0a 58 | is by d|efault.X|
|000023f0| 2e 49 20 73 74 64 69 6e | 29 2c 0a 73 6f 20 69 66 |.I stdin|),.so if|
|00002400| 20 79 6f 75 0a 6a 75 73 | 74 20 77 61 6e 74 20 74 | you.jus|t want t|
|00002410| 6f 20 63 68 61 6e 67 65 | 20 74 68 65 20 69 6e 70 |o change| the inp|
|00002420| 75 74 20 66 69 6c 65 2c | 20 79 6f 75 20 6e 65 65 |ut file,| you nee|
|00002430| 64 6e 27 74 20 72 65 64 | 65 66 69 6e 65 0a 59 59 |dn't red|efine.YY|
|00002440| 5f 49 4e 50 55 54 20 2d | 20 6a 75 73 74 20 70 6f |_INPUT -| just po|
|00002450| 69 6e 74 20 79 79 69 6e | 20 61 74 20 74 68 65 20 |int yyin| at the |
|00002460| 69 6e 70 75 74 20 66 69 | 6c 65 2e 0a 58 2e 49 50 |input fi|le..X.IP|
|00002470| 0a 41 20 73 61 6d 70 6c | 65 20 72 65 64 65 66 69 |.A sampl|e redefi|
|00002480| 6e 69 74 69 6f 6e 20 6f | 66 20 59 59 5f 49 4e 50 |nition o|f YY_INP|
|00002490| 55 54 20 28 69 6e 20 74 | 68 65 20 66 69 72 73 74 |UT (in t|he first|
|000024a0| 20 73 65 63 74 69 6f 6e | 20 6f 66 20 74 68 65 20 | section| of the |
|000024b0| 69 6e 70 75 74 0a 66 69 | 6c 65 29 3a 0a 58 2e 6e |input.fi|le):.X.n|
|000024c0| 66 0a 58 0a 58 20 20 20 | 20 25 7b 0a 58 20 20 20 |f.X.X | %{.X |
|000024d0| 20 23 75 6e 64 65 66 20 | 59 59 5f 49 4e 50 55 54 | #undef |YY_INPUT|
|000024e0| 0a 58 20 20 20 20 23 64 | 65 66 69 6e 65 20 59 59 |.X #d|efine YY|
|000024f0| 5f 49 4e 50 55 54 28 62 | 75 66 2c 72 65 73 75 6c |_INPUT(b|uf,resul|
|00002500| 74 2c 6d 61 78 5f 73 69 | 7a 65 29 20 5c 5c 0a 58 |t,max_si|ze) \\.X|
|00002510| 20 20 20 20 20 20 20 20 | 72 65 73 75 6c 74 20 3d | |result =|
|00002520| 20 28 62 75 66 5b 30 5d | 20 3d 20 67 65 74 63 68 | (buf[0]| = getch|
|00002530| 61 72 28 29 29 20 3d 3d | 20 45 4f 46 20 3f 20 59 |ar()) ==| EOF ? Y|
|00002540| 59 5f 4e 55 4c 4c 20 3a | 20 31 3b 0a 58 20 20 20 |Y_NULL :| 1;.X |
|00002550| 20 25 7d 0a 58 0a 58 2e | 66 69 0a 59 6f 75 20 61 | %}.X.X.|fi.You a|
|00002560| 6c 73 6f 20 63 61 6e 20 | 61 64 64 20 69 6e 20 74 |lso can |add in t|
|00002570| 68 69 6e 67 73 20 6c 69 | 6b 65 20 63 6f 75 6e 74 |hings li|ke count|
|00002580| 69 6e 67 20 6b 65 65 70 | 69 6e 67 20 74 72 61 63 |ing keep|ing trac|
|00002590| 6b 20 6f 66 20 74 68 65 | 0a 69 6e 70 75 74 20 6c |k of the|.input l|
|000025a0| 69 6e 65 20 6e 75 6d 62 | 65 72 20 74 68 69 73 20 |ine numb|er this |
|000025b0| 77 61 79 3b 20 62 75 74 | 20 64 6f 6e 27 74 20 65 |way; but| don't e|
|000025c0| 78 70 65 63 74 20 79 6f | 75 72 20 73 63 61 6e 6e |xpect yo|ur scann|
|000025d0| 65 72 20 74 6f 0a 67 6f | 20 76 65 72 79 20 66 61 |er to.go| very fa|
|000025e0| 73 74 2e 0a 58 2e 49 50 | 20 2d 0a 58 2e 42 20 6f |st..X.IP| -.X.B o|
|000025f0| 75 74 70 75 74 28 29 0a | 69 73 20 6e 6f 74 20 73 |utput().|is not s|
|00002600| 75 70 70 6f 72 74 65 64 | 2e 0a 4f 75 74 70 75 74 |upported|..Output|
|00002610| 20 66 72 6f 6d 20 74 68 | 65 20 45 43 48 4f 20 6d | from th|e ECHO m|
|00002620| 61 63 72 6f 20 69 73 20 | 64 6f 6e 65 20 74 6f 20 |acro is |done to |
|00002630| 74 68 65 20 66 69 6c 65 | 2d 70 6f 69 6e 74 65 72 |the file|-pointer|
|00002640| 0a 58 22 79 79 6f 75 74 | 22 20 28 64 65 66 61 75 |.X"yyout|" (defau|
|00002650| 6c 74 0a 58 2e 49 20 73 | 74 64 6f 75 74 29 2e 0a |lt.X.I s|tdout)..|
|00002660| 58 2e 49 50 20 2d 0a 54 | 72 61 69 6c 69 6e 67 20 |X.IP -.T|railing |
|00002670| 63 6f 6e 74 65 78 74 20 | 69 73 20 72 65 73 74 72 |context |is restr|
|00002680| 69 63 74 65 64 20 74 6f | 20 70 61 74 74 65 72 6e |icted to| pattern|
|00002690| 73 20 77 68 69 63 68 20 | 68 61 76 65 20 65 69 74 |s which |have eit|
|000026a0| 68 65 72 0a 61 20 66 69 | 78 65 64 2d 73 69 7a 65 |her.a fi|xed-size|
|000026b0| 64 20 6c 65 61 64 69 6e | 67 20 70 61 72 74 20 6f |d leadin|g part o|
|000026c0| 72 20 61 20 66 69 78 65 | 64 2d 73 69 7a 65 64 20 |r a fixe|d-sized |
|000026d0| 74 72 61 69 6c 69 6e 67 | 20 70 61 72 74 2e 0a 58 |trailing| part..X|
|000026e0| 46 6f 72 20 65 78 61 6d | 70 6c 65 2c 20 22 61 2a |For exam|ple, "a*|
|000026f0| 2f 62 22 20 61 6e 64 20 | 22 61 2f 62 2a 22 20 61 |/b" and |"a/b*" a|
|00002700| 72 65 20 6f 6b 61 79 2c | 20 62 75 74 20 6e 6f 74 |re okay,| but not|
|00002710| 20 22 61 2a 2f 62 2a 22 | 2e 0a 54 68 69 73 20 72 | "a*/b*"|..This r|
|00002720| 65 73 74 72 69 63 74 69 | 6f 6e 20 69 73 20 64 75 |estricti|on is du|
|00002730| 65 20 74 6f 20 61 20 62 | 75 67 20 69 6e 20 74 68 |e to a b|ug in th|
|00002740| 65 20 74 72 61 69 6c 69 | 6e 67 20 63 6f 6e 74 65 |e traili|ng conte|
|00002750| 78 74 0a 61 6c 67 6f 72 | 69 74 68 6d 20 67 69 76 |xt.algor|ithm giv|
|00002760| 65 6e 20 69 6e 0a 58 2e | 49 20 50 72 69 6e 63 69 |en in.X.|I Princi|
|00002770| 70 6c 65 73 20 6f 66 20 | 43 6f 6d 70 69 6c 65 72 |ples of |Compiler|
|00002780| 20 44 65 73 69 67 6e 0a | 58 28 61 6e 64 0a 58 2e | Design.|X(and.X.|
|00002790| 49 20 43 6f 6d 70 69 6c | 65 72 73 20 2d 20 50 72 |I Compil|ers - Pr|
|000027a0| 69 6e 63 69 70 6c 65 73 | 2c 20 54 65 63 68 6e 69 |inciples|, Techni|
|000027b0| 71 75 65 73 2c 20 61 6e | 64 20 54 6f 6f 6c 73 29 |ques, an|d Tools)|
|000027c0| 0a 77 68 69 63 68 20 63 | 61 6e 20 72 65 73 75 6c |.which c|an resul|
|000027d0| 74 20 69 6e 20 6d 69 73 | 6d 61 74 63 68 65 73 2e |t in mis|matches.|
|000027e0| 20 20 54 72 79 20 74 68 | 65 20 66 6f 6c 6c 6f 77 | Try th|e follow|
|000027f0| 69 6e 67 20 6c 65 78 20 | 70 72 6f 67 72 61 6d 0a |ing lex |program.|
|00002800| 58 2e 6e 66 0a 58 0a 58 | 20 20 20 20 25 25 0a 58 |X.nf.X.X| %%.X|
|00002810| 20 20 20 20 78 2b 2f 78 | 79 20 20 20 20 20 20 20 | x+/x|y |
|00002820| 20 20 20 20 70 72 69 6e | 74 66 28 20 22 49 20 66 | prin|tf( "I f|
|00002830| 6f 75 6e 64 20 5c 5c 22 | 25 73 5c 5c 22 5c 5c 6e |ound \\"|%s\\"\\n|
|00002840| 22 2c 20 79 79 74 65 78 | 74 20 29 3b 0a 58 0a 58 |", yytex|t );.X.X|
|00002850| 2e 66 69 0a 6f 6e 20 74 | 68 65 20 69 6e 70 75 74 |.fi.on t|he input|
|00002860| 20 22 78 78 79 22 2e 20 | 20 28 49 66 20 61 6e 79 | "xxy". | (If any|
|00002870| 6f 6e 65 20 6b 6e 6f 77 | 73 20 6f 66 20 61 20 66 |one know|s of a f|
|00002880| 61 73 74 20 61 6c 67 6f | 72 69 74 68 6d 20 66 6f |ast algo|rithm fo|
|00002890| 72 0a 66 69 6e 64 69 6e | 67 20 74 68 65 20 62 65 |r.findin|g the be|
|000028a0| 67 69 6e 6e 69 6e 67 20 | 6f 66 20 74 72 61 69 6c |ginning |of trail|
|000028b0| 69 6e 67 20 63 6f 6e 74 | 65 78 74 20 66 6f 72 20 |ing cont|ext for |
|000028c0| 61 6e 20 61 72 62 69 74 | 72 61 72 79 0a 70 61 69 |an arbit|rary.pai|
|000028d0| 72 20 6f 66 20 72 65 67 | 75 6c 61 72 20 65 78 70 |r of reg|ular exp|
|000028e0| 72 65 73 73 69 6f 6e 73 | 2c 20 70 6c 65 61 73 65 |ressions|, please|
|000028f0| 20 6c 65 74 20 6d 65 20 | 6b 6e 6f 77 21 29 0a 49 | let me |know!).I|
|00002900| 66 20 79 6f 75 20 6d 75 | 73 74 20 68 61 76 65 20 |f you mu|st have |
|00002910| 61 72 62 69 74 72 61 72 | 79 20 74 72 61 69 6c 69 |arbitrar|y traili|
|00002920| 6e 67 20 63 6f 6e 74 65 | 78 74 2c 20 79 6f 75 20 |ng conte|xt, you |
|00002930| 63 61 6e 20 75 73 65 0a | 58 2e 42 20 79 79 6c 65 |can use.|X.B yyle|
|00002940| 73 73 28 29 0a 74 6f 20 | 65 66 66 65 63 74 20 69 |ss().to |effect i|
|00002950| 74 2e 0a 58 2e 49 50 20 | 2d 0a 66 6c 65 78 20 72 |t..X.IP |-.flex r|
|00002960| 65 61 64 73 20 6f 6e 6c | 79 20 6f 6e 65 20 69 6e |eads onl|y one in|
|00002970| 70 75 74 20 66 69 6c 65 | 2c 20 77 68 69 6c 65 20 |put file|, while |
|00002980| 6c 65 78 27 73 20 69 6e | 70 75 74 20 69 73 20 6d |lex's in|put is m|
|00002990| 61 64 65 0a 75 70 20 6f | 66 20 74 68 65 20 63 6f |ade.up o|f the co|
|000029a0| 6e 63 61 74 65 6e 61 74 | 69 6f 6e 20 6f 66 20 69 |ncatenat|ion of i|
|000029b0| 74 73 20 69 6e 70 75 74 | 20 66 69 6c 65 73 2e 0a |ts input| files..|
|000029c0| 58 2e 53 48 20 45 4e 48 | 41 4e 43 45 4d 45 4e 54 |X.SH ENH|ANCEMENT|
|000029d0| 53 0a 58 2e 49 50 20 2d | 0a 58 2e 49 20 45 78 63 |S.X.IP -|.X.I Exc|
|000029e0| 6c 75 73 69 76 65 20 73 | 74 61 72 74 2d 63 6f 6e |lusive s|tart-con|
|000029f0| 64 69 74 69 6f 6e 73 0a | 63 61 6e 20 62 65 20 64 |ditions.|can be d|
|00002a00| 65 63 6c 61 72 65 64 20 | 62 79 20 75 73 69 6e 67 |eclared |by using|
|00002a10| 0a 58 2e 42 20 25 78 0a | 69 6e 73 74 65 61 64 20 |.X.B %x.|instead |
|00002a20| 6f 66 0a 58 2e 42 20 25 | 73 2e 0a 54 68 65 73 65 |of.X.B %|s..These|
|00002a30| 20 73 74 61 72 74 2d 63 | 6f 6e 64 69 74 69 6f 6e | start-c|ondition|
|00002a40| 73 20 68 61 76 65 20 74 | 68 65 20 70 72 6f 70 65 |s have t|he prope|
|00002a50| 72 74 79 20 74 68 61 74 | 20 77 68 65 6e 20 74 68 |rty that| when th|
|00002a60| 65 79 20 61 72 65 20 61 | 63 74 69 76 65 2c 0a 58 |ey are a|ctive,.X|
|00002a70| 2e 49 20 6e 6f 20 6f 74 | 68 65 72 20 72 75 6c 65 |.I no ot|her rule|
|00002a80| 73 20 61 72 65 20 61 63 | 74 69 76 65 2e 0a 54 68 |s are ac|tive..Th|
|00002a90| 75 73 20 61 20 73 65 74 | 20 6f 66 20 72 75 6c 65 |us a set| of rule|
|00002aa0| 73 20 67 6f 76 65 72 6e | 65 64 20 62 79 20 74 68 |s govern|ed by th|
|00002ab0| 65 20 73 61 6d 65 20 65 | 78 63 6c 75 73 69 76 65 |e same e|xclusive|
|00002ac0| 20 73 74 61 72 74 20 63 | 6f 6e 64 69 74 69 6f 6e | start c|ondition|
|00002ad0| 0a 64 65 73 63 72 69 62 | 65 20 61 20 73 63 61 6e |.describ|e a scan|
|00002ae0| 6e 65 72 20 77 68 69 63 | 68 20 69 73 20 69 6e 64 |ner whic|h is ind|
|00002af0| 65 70 65 6e 64 65 6e 74 | 20 6f 66 20 61 6e 79 20 |ependent| of any |
|00002b00| 6f 66 20 74 68 65 20 6f | 74 68 65 72 20 72 75 6c |of the o|ther rul|
|00002b10| 65 73 20 69 6e 0a 74 68 | 65 20 66 6c 65 78 20 69 |es in.th|e flex i|
|00002b20| 6e 70 75 74 2e 20 20 54 | 68 69 73 20 66 65 61 74 |nput. T|his feat|
|00002b30| 75 72 65 20 6d 61 6b 65 | 73 20 69 74 20 65 61 73 |ure make|s it eas|
|00002b40| 79 20 74 6f 20 73 70 65 | 63 69 66 79 20 22 6d 69 |y to spe|cify "mi|
|00002b50| 6e 69 2d 73 63 61 6e 6e | 65 72 73 22 0a 77 68 69 |ni-scann|ers".whi|
|00002b60| 63 68 20 73 63 61 6e 20 | 70 6f 72 74 69 6f 6e 73 |ch scan |portions|
|00002b70| 20 6f 66 20 74 68 65 20 | 69 6e 70 75 74 20 74 68 | of the |input th|
|00002b80| 61 74 20 61 72 65 20 73 | 79 6e 74 61 63 74 69 63 |at are s|yntactic|
|00002b90| 61 6c 6c 79 20 64 69 66 | 66 65 72 65 6e 74 0a 66 |ally dif|ferent.f|
|00002ba0| 72 6f 6d 20 74 68 65 20 | 72 65 73 74 20 28 65 2e |rom the |rest (e.|
|00002bb0| 67 2e 2c 20 63 6f 6d 6d | 65 6e 74 73 29 2e 0a 58 |g., comm|ents)..X|
|00002bc0| 2e 49 50 20 2d 0a 66 6c | 65 78 20 64 79 6e 61 6d |.IP -.fl|ex dynam|
|00002bd0| 69 63 61 6c 6c 79 20 72 | 65 73 69 7a 65 73 20 69 |ically r|esizes i|
|00002be0| 74 73 20 69 6e 74 65 72 | 6e 61 6c 20 74 61 62 6c |ts inter|nal tabl|
|00002bf0| 65 73 2c 20 73 6f 20 64 | 69 72 65 63 74 69 76 65 |es, so d|irective|
|00002c00| 73 20 6c 69 6b 65 20 22 | 25 61 20 33 30 30 30 22 |s like "|%a 3000"|
|00002c10| 0a 61 72 65 20 6e 6f 74 | 20 6e 65 65 64 65 64 20 |.are not| needed |
|00002c20| 77 68 65 6e 20 73 70 65 | 63 69 66 79 69 6e 67 20 |when spe|cifying |
|00002c30| 6c 61 72 67 65 20 73 63 | 61 6e 6e 65 72 73 2e 0a |large sc|anners..|
|00002c40| 58 2e 49 50 20 2d 0a 54 | 68 65 20 73 63 61 6e 6e |X.IP -.T|he scann|
|00002c50| 69 6e 67 20 72 6f 75 74 | 69 6e 65 20 67 65 6e 65 |ing rout|ine gene|
|00002c60| 72 61 74 65 64 20 62 79 | 20 66 6c 65 78 20 69 73 |rated by| flex is|
|00002c70| 20 64 65 63 6c 61 72 65 | 64 20 75 73 69 6e 67 20 | declare|d using |
|00002c80| 74 68 65 20 6d 61 63 72 | 6f 0a 58 2e 42 20 59 59 |the macr|o.X.B YY|
|00002c90| 5f 44 45 43 4c 2e 0a 42 | 79 20 72 65 64 65 66 69 |_DECL..B|y redefi|
|00002ca0| 6e 69 6e 67 20 74 68 69 | 73 20 6d 61 63 72 6f 20 |ning thi|s macro |
|00002cb0| 79 6f 75 20 63 61 6e 20 | 63 68 61 6e 67 65 20 74 |you can |change t|
|00002cc0| 68 65 20 72 6f 75 74 69 | 6e 65 27 73 20 6e 61 6d |he routi|ne's nam|
|00002cd0| 65 20 61 6e 64 0a 69 74 | 73 20 63 61 6c 6c 69 6e |e and.it|s callin|
|00002ce0| 67 20 73 65 71 75 65 6e | 63 65 2e 20 20 46 6f 72 |g sequen|ce. For|
|00002cf0| 20 65 78 61 6d 70 6c 65 | 2c 20 79 6f 75 20 63 6f | example|, you co|
|00002d00| 75 6c 64 20 75 73 65 3a | 0a 58 2e 6e 66 0a 58 0a |uld use:|.X.nf.X.|
|00002d10| 58 20 20 20 20 23 75 6e | 64 65 66 20 59 59 5f 44 |X #un|def YY_D|
|00002d20| 45 43 4c 0a 58 20 20 20 | 20 23 64 65 66 69 6e 65 |ECL.X | #define|
|00002d30| 20 59 59 5f 44 45 43 4c | 20 66 6c 6f 61 74 20 6c | YY_DECL| float l|
|00002d40| 65 78 73 63 61 6e 28 20 | 61 2c 20 62 20 29 20 66 |exscan( |a, b ) f|
|00002d50| 6c 6f 61 74 20 61 2c 20 | 62 3b 0a 58 0a 58 2e 66 |loat a, |b;.X.X.f|
|00002d60| 69 0a 74 6f 20 67 69 76 | 65 20 69 74 20 74 68 65 |i.to giv|e it the|
|00002d70| 20 6e 61 6d 65 0a 58 2e | 49 20 6c 65 78 73 63 61 | name.X.|I lexsca|
|00002d80| 6e 2c 0a 72 65 74 75 72 | 6e 69 6e 67 20 61 20 66 |n,.retur|ning a f|
|00002d90| 6c 6f 61 74 2c 20 61 6e | 64 20 74 61 6b 69 6e 67 |loat, an|d taking|
|00002da0| 20 74 77 6f 20 66 6c 6f | 61 74 73 20 61 73 20 61 | two flo|ats as a|
|00002db0| 72 67 75 6d 65 6e 74 73 | 2e 0a 58 2e 49 50 20 2d |rguments|..X.IP -|
|00002dc0| 0a 66 6c 65 78 20 67 65 | 6e 65 72 61 74 65 73 0a |.flex ge|nerates.|
|00002dd0| 58 2e 42 20 23 6c 69 6e | 65 0a 64 69 72 65 63 74 |X.B #lin|e.direct|
|00002de0| 69 76 65 73 20 6d 61 70 | 70 69 6e 67 20 6c 69 6e |ives map|ping lin|
|00002df0| 65 73 20 69 6e 20 74 68 | 65 20 6f 75 74 70 75 74 |es in th|e output|
|00002e00| 20 74 6f 0a 74 68 65 69 | 72 20 6f 72 69 67 69 6e | to.thei|r origin|
|00002e10| 20 69 6e 20 74 68 65 20 | 69 6e 70 75 74 20 66 69 | in the |input fi|
|00002e20| 6c 65 2e 0a 58 2e 49 50 | 20 2d 0a 59 6f 75 20 63 |le..X.IP| -.You c|
|00002e30| 61 6e 20 70 75 74 20 6d | 75 6c 74 69 70 6c 65 20 |an put m|ultiple |
|00002e40| 61 63 74 69 6f 6e 73 20 | 6f 6e 20 74 68 65 20 73 |actions |on the s|
|00002e50| 61 6d 65 20 6c 69 6e 65 | 2c 20 73 65 70 61 72 61 |ame line|, separa|
|00002e60| 74 65 64 20 77 69 74 68 | 0a 73 65 6d 69 2d 63 6f |ted with|.semi-co|
|00002e70| 6c 6f 6e 73 2e 20 20 57 | 69 74 68 20 6c 65 78 2c |lons. W|ith lex,|
|00002e80| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 0a 58 | the fol|lowing.X|
|00002e90| 2e 6e 66 0a 58 0a 58 20 | 20 20 20 66 6f 6f 20 20 |.nf.X.X | foo |
|00002ea0| 20 20 68 61 6e 64 6c 65 | 5f 66 6f 6f 28 29 3b 20 | handle|_foo(); |
|00002eb0| 72 65 74 75 72 6e 20 31 | 3b 0a 58 0a 58 2e 66 69 |return 1|;.X.X.fi|
|00002ec0| 0a 69 73 20 74 72 75 6e | 63 61 74 65 64 20 74 6f |.is trun|cated to|
|00002ed0| 0a 58 2e 6e 66 0a 58 0a | 58 20 20 20 20 66 6f 6f |.X.nf.X.|X foo|
|00002ee0| 20 20 20 20 68 61 6e 64 | 6c 65 5f 66 6f 6f 28 29 | hand|le_foo()|
|00002ef0| 3b 0a 58 0a 58 2e 66 69 | 0a 66 6c 65 78 20 64 6f |;.X.X.fi|.flex do|
|00002f00| 65 73 20 6e 6f 74 20 74 | 72 75 6e 63 61 74 65 20 |es not t|runcate |
|00002f10| 74 68 65 20 61 63 74 69 | 6f 6e 2e 20 20 41 63 74 |the acti|on. Act|
|00002f20| 69 6f 6e 73 20 74 68 61 | 74 20 61 72 65 20 6e 6f |ions tha|t are no|
|00002f30| 74 20 65 6e 63 6c 6f 73 | 65 64 20 69 6e 0a 62 72 |t enclos|ed in.br|
|00002f40| 61 63 65 73 20 61 72 65 | 20 74 65 72 6d 69 6e 61 |aces are| termina|
|00002f50| 74 65 64 20 61 74 20 74 | 68 65 20 65 6e 64 20 6f |ted at t|he end o|
|00002f60| 66 20 74 68 65 20 6c 69 | 6e 65 2e 0a 58 2e 49 50 |f the li|ne..X.IP|
|00002f70| 20 2d 0a 41 63 74 69 6f | 6e 73 20 63 61 6e 20 62 | -.Actio|ns can b|
|00002f80| 65 20 62 65 67 75 6e 20 | 77 69 74 68 0a 58 2e 42 |e begun |with.X.B|
|00002f90| 20 25 7b 0a 61 6e 64 20 | 74 65 72 6d 69 6e 61 74 | %{.and |terminat|
|00002fa0| 65 64 20 77 69 74 68 0a | 58 2e 42 20 25 7d 2e 0a |ed with.|X.B %}..|
|00002fb0| 49 6e 20 74 68 69 73 20 | 63 61 73 65 2c 20 66 6c |In this |case, fl|
|00002fc0| 65 78 20 64 6f 65 73 20 | 6e 6f 74 20 63 6f 75 6e |ex does |not coun|
|00002fd0| 74 20 62 72 61 63 65 73 | 20 74 6f 20 66 69 67 75 |t braces| to figu|
|00002fe0| 72 65 20 6f 75 74 20 77 | 68 65 72 65 20 74 68 65 |re out w|here the|
|00002ff0| 0a 61 63 74 69 6f 6e 20 | 65 6e 64 73 20 2d 20 61 |.action |ends - a|
|00003000| 63 74 69 6f 6e 73 20 61 | 72 65 20 74 65 72 6d 69 |ctions a|re termi|
|00003010| 6e 61 74 65 64 20 62 79 | 20 74 68 65 20 63 6c 6f |nated by| the clo|
|00003020| 73 69 6e 67 0a 58 2e 42 | 20 25 7d 2e 0a 54 68 69 |sing.X.B| %}..Thi|
|00003030| 73 20 66 65 61 74 75 72 | 65 20 69 73 20 75 73 65 |s featur|e is use|
|00003040| 66 75 6c 20 77 68 65 6e | 20 74 68 65 20 65 6e 63 |ful when| the enc|
|00003050| 6c 6f 73 65 64 20 61 63 | 74 69 6f 6e 20 68 61 73 |losed ac|tion has|
|00003060| 20 65 78 74 72 61 6e 65 | 6f 75 73 0a 62 72 61 63 | extrane|ous.brac|
|00003070| 65 73 20 69 6e 20 69 74 | 20 28 75 73 75 61 6c 6c |es in it| (usuall|
|00003080| 79 20 69 6e 20 63 6f 6d | 6d 65 6e 74 73 20 6f 72 |y in com|ments or|
|00003090| 20 69 6e 73 69 64 65 20 | 69 6e 61 63 74 69 76 65 | inside |inactive|
|000030a0| 20 23 69 66 64 65 66 27 | 73 29 0a 74 68 61 74 20 | #ifdef'|s).that |
|000030b0| 74 68 72 6f 77 20 6f 66 | 66 20 74 68 65 20 62 72 |throw of|f the br|
|000030c0| 61 63 65 2d 63 6f 75 6e | 74 2e 0a 58 2e 49 50 20 |ace-coun|t..X.IP |
|000030d0| 2d 0a 41 6c 6c 20 6f 66 | 20 74 68 65 20 73 63 61 |-.All of| the sca|
|000030e0| 6e 6e 65 72 20 61 63 74 | 69 6f 6e 73 20 28 65 2e |nner act|ions (e.|
|000030f0| 67 2e 2c 0a 58 2e 42 20 | 45 43 48 4f 2c 20 79 79 |g.,.X.B |ECHO, yy|
|00003100| 77 72 61 70 20 2e 2e 2e | 29 0a 65 78 63 65 70 74 |wrap ...|).except|
|00003110| 20 74 68 65 0a 58 2e 42 | 20 75 6e 70 75 74 28 29 | the.X.B| unput()|
|00003120| 0a 61 6e 64 0a 58 2e 42 | 20 69 6e 70 75 74 28 29 |.and.X.B| input()|
|00003130| 0a 72 6f 75 74 69 6e 65 | 73 2c 0a 61 72 65 20 77 |.routine|s,.are w|
|00003140| 72 69 74 74 65 6e 20 61 | 73 20 6d 61 63 72 6f 73 |ritten a|s macros|
|00003150| 2c 20 73 6f 20 74 68 65 | 79 20 63 61 6e 20 62 65 |, so the|y can be|
|00003160| 20 72 65 64 65 66 69 6e | 65 64 20 69 66 20 6e 65 | redefin|ed if ne|
|00003170| 63 65 73 73 61 72 79 0a | 77 69 74 68 6f 75 74 20 |cessary.|without |
|00003180| 72 65 71 75 69 72 69 6e | 67 20 61 20 73 65 70 61 |requirin|g a sepa|
|00003190| 72 61 74 65 20 6c 69 62 | 72 61 72 79 20 74 6f 20 |rate lib|rary to |
|000031a0| 6c 69 6e 6b 20 74 6f 2e | 0a 58 2e 53 48 20 46 49 |link to.|.X.SH FI|
|000031b0| 4c 45 53 0a 58 2e 54 50 | 0a 58 2e 49 20 66 6c 65 |LES.X.TP|.X.I fle|
|000031c0| 78 2e 73 6b 65 6c 0a 73 | 6b 65 6c 65 74 6f 6e 20 |x.skel.s|keleton |
|000031d0| 73 63 61 6e 6e 65 72 0a | 58 2e 54 50 0a 58 2e 49 |scanner.|X.TP.X.I|
|000031e0| 20 66 6c 65 78 2e 66 61 | 73 74 73 6b 65 6c 0a 73 | flex.fa|stskel.s|
|000031f0| 6b 65 6c 65 74 6f 6e 20 | 73 63 61 6e 6e 65 72 20 |keleton |scanner |
|00003200| 66 6f 72 20 2d 66 20 61 | 6e 64 20 2d 46 0a 58 2e |for -f a|nd -F.X.|
|00003210| 54 50 0a 58 2e 49 20 66 | 6c 65 78 73 6b 65 6c 63 |TP.X.I f|lexskelc|
|00003220| 6f 6d 2e 68 0a 63 6f 6d | 6d 6f 6e 20 64 65 66 69 |om.h.com|mon defi|
|00003230| 6e 69 74 69 6f 6e 73 20 | 66 6f 72 20 73 6b 65 6c |nitions |for skel|
|00003240| 65 74 6f 6e 20 66 69 6c | 65 73 0a 58 2e 54 50 0a |eton fil|es.X.TP.|
|00003250| 58 2e 49 20 66 6c 65 78 | 73 6b 65 6c 64 65 66 2e |X.I flex|skeldef.|
|00003260| 68 0a 64 65 66 69 6e 69 | 74 69 6f 6e 73 20 66 6f |h.defini|tions fo|
|00003270| 72 20 63 6f 6d 70 72 65 | 73 73 65 64 20 73 6b 65 |r compre|ssed ske|
|00003280| 6c 65 74 6f 6e 20 66 69 | 6c 65 0a 58 2e 54 50 0a |leton fi|le.X.TP.|
|00003290| 58 2e 49 20 66 61 73 74 | 73 6b 65 6c 64 65 66 2e |X.I fast|skeldef.|
|000032a0| 68 0a 64 65 66 69 6e 69 | 74 69 6f 6e 73 20 66 6f |h.defini|tions fo|
|000032b0| 72 20 2d 66 2c 20 2d 46 | 20 73 6b 65 6c 65 74 6f |r -f, -F| skeleto|
|000032c0| 6e 20 66 69 6c 65 0a 58 | 2e 53 48 20 22 53 45 45 |n file.X|.SH "SEE|
|000032d0| 20 41 4c 53 4f 22 0a 58 | 2e 4c 50 0a 6c 65 78 28 | ALSO".X|.LP.lex(|
|000032e0| 31 29 0a 58 2e 4c 50 0a | 4d 2e 20 45 2e 20 4c 65 |1).X.LP.|M. E. Le|
|000032f0| 73 6b 20 61 6e 64 20 45 | 2e 20 53 63 68 6d 69 64 |sk and E|. Schmid|
|00003300| 74 2c 0a 58 2e 49 20 4c | 45 58 20 2d 20 4c 65 78 |t,.X.I L|EX - Lex|
|00003310| 69 63 61 6c 20 41 6e 61 | 6c 79 7a 65 72 20 47 65 |ical Ana|lyzer Ge|
|00003320| 6e 65 72 61 74 6f 72 0a | 58 2e 53 48 20 41 55 54 |nerator.|X.SH AUT|
|00003330| 48 4f 52 0a 56 65 72 6e | 20 50 61 78 73 6f 6e 2c |HOR.Vern| Paxson,|
|00003340| 20 77 69 74 68 20 74 68 | 65 20 68 65 6c 70 20 6f | with th|e help o|
|00003350| 66 20 6d 61 6e 79 20 69 | 64 65 61 73 20 61 6e 64 |f many i|deas and|
|00003360| 20 6d 75 63 68 20 69 6e | 73 70 69 72 61 74 69 6f | much in|spiratio|
|00003370| 6e 20 66 72 6f 6d 0a 56 | 61 6e 20 4a 61 63 6f 62 |n from.V|an Jacob|
|00003380| 73 6f 6e 2e 20 20 4f 72 | 69 67 69 6e 61 6c 20 76 |son. Or|iginal v|
|00003390| 65 72 73 69 6f 6e 20 62 | 79 20 4a 65 66 20 50 6f |ersion b|y Jef Po|
|000033a0| 73 6b 61 6e 7a 65 72 2e | 20 20 46 61 73 74 20 74 |skanzer.| Fast t|
|000033b0| 61 62 6c 65 0a 72 65 70 | 72 65 73 65 6e 74 61 74 |able.rep|resentat|
|000033c0| 69 6f 6e 20 69 73 20 61 | 20 70 61 72 74 69 61 6c |ion is a| partial|
|000033d0| 20 69 6d 70 6c 65 6d 65 | 6e 74 61 74 69 6f 6e 20 | impleme|ntation |
|000033e0| 6f 66 20 61 20 64 65 73 | 69 67 6e 20 64 6f 6e 65 |of a des|ign done|
|000033f0| 20 62 79 20 56 61 6e 0a | 4a 61 63 6f 62 73 6f 6e | by Van.|Jacobson|
|00003400| 2e 20 20 54 68 65 20 69 | 6d 70 6c 65 6d 65 6e 74 |. The i|mplement|
|00003410| 61 74 69 6f 6e 20 77 61 | 73 20 64 6f 6e 65 20 62 |ation wa|s done b|
|00003420| 79 20 4b 65 76 69 6e 20 | 47 6f 6e 67 20 61 6e 64 |y Kevin |Gong and|
|00003430| 20 56 65 72 6e 20 50 61 | 78 73 6f 6e 2e 0a 58 2e | Vern Pa|xson..X.|
|00003440| 4c 50 0a 54 68 61 6e 6b | 73 20 74 6f 20 74 68 65 |LP.Thank|s to the|
|00003450| 20 6d 61 6e 79 20 66 6c | 65 78 20 62 65 74 61 2d | many fl|ex beta-|
|00003460| 74 65 73 74 65 72 73 2c | 20 65 73 70 65 63 69 61 |testers,| especia|
|00003470| 6c 6c 79 20 43 61 73 65 | 79 20 4c 65 65 64 6f 6d |lly Case|y Leedom|
|00003480| 2c 0a 4e 69 63 6b 20 43 | 68 72 69 73 74 6f 70 68 |,.Nick C|hristoph|
|00003490| 65 72 2c 20 43 68 72 69 | 73 20 46 61 79 6c 6f 72 |er, Chri|s Faylor|
|000034a0| 2c 20 45 72 69 63 20 47 | 6f 6c 64 6d 61 6e 2c 20 |, Eric G|oldman, |
|000034b0| 43 72 61 69 67 20 4c 65 | 72 65 73 2c 20 4d 6f 68 |Craig Le|res, Moh|
|000034c0| 61 6d 65 64 20 65 6c 20 | 4c 6f 7a 79 2c 0a 45 73 |amed el |Lozy,.Es|
|000034d0| 6d 6f 6e 64 20 50 69 74 | 74 2c 20 4a 65 66 20 50 |mond Pit|t, Jef P|
|000034e0| 6f 73 6b 61 6e 7a 65 72 | 2c 20 61 6e 64 20 44 61 |oskanzer|, and Da|
|000034f0| 76 65 20 54 61 6c 6c 6d | 61 6e 2e 20 20 54 68 61 |ve Tallm|an. Tha|
|00003500| 6e 6b 73 20 74 6f 20 4a | 6f 68 6e 20 47 69 6c 6d |nks to J|ohn Gilm|
|00003510| 6f 72 65 2c 0a 42 6f 62 | 20 4d 75 6c 63 61 68 79 |ore,.Bob| Mulcahy|
|00003520| 2c 0a 52 69 63 68 20 53 | 61 6c 7a 2c 20 61 6e 64 |,.Rich S|alz, and|
|00003530| 20 52 69 63 68 61 72 64 | 20 53 74 61 6c 6c 6d 61 | Richard| Stallma|
|00003540| 6e 20 66 6f 72 20 68 65 | 6c 70 20 77 69 74 68 20 |n for he|lp with |
|00003550| 76 61 72 69 6f 75 73 20 | 64 69 73 74 72 69 62 75 |various |distribu|
|00003560| 74 69 6f 6e 20 68 65 61 | 64 61 63 68 65 73 2e 0a |tion hea|daches..|
|00003570| 58 2e 4c 50 0a 53 65 6e | 64 20 63 6f 6d 6d 65 6e |X.LP.Sen|d commen|
|00003580| 74 73 20 74 6f 3a 0a 58 | 2e 6e 66 0a 58 0a 58 20 |ts to:.X|.nf.X.X |
|00003590| 20 20 20 20 56 65 72 6e | 20 50 61 78 73 6f 6e 0a | Vern| Paxson.|
|000035a0| 58 20 20 20 20 20 52 65 | 61 6c 20 54 69 6d 65 20 |X Re|al Time |
|000035b0| 53 79 73 74 65 6d 73 0a | 58 20 20 20 20 20 42 6c |Systems.|X Bl|
|000035c0| 64 67 2e 20 34 36 41 0a | 58 20 20 20 20 20 4c 61 |dg. 46A.|X La|
|000035d0| 77 72 65 6e 63 65 20 42 | 65 72 6b 65 6c 65 79 20 |wrence B|erkeley |
|000035e0| 4c 61 62 6f 72 61 74 6f | 72 79 0a 58 20 20 20 20 |Laborato|ry.X |
|000035f0| 20 31 20 43 79 63 6c 6f | 74 72 6f 6e 20 52 64 2e | 1 Cyclo|tron Rd.|
|00003600| 0a 58 20 20 20 20 20 42 | 65 72 6b 65 6c 65 79 2c |.X B|erkeley,|
|00003610| 20 43 41 20 39 34 37 32 | 30 0a 58 0a 58 20 20 20 | CA 9472|0.X.X |
|00003620| 20 20 28 34 31 35 29 20 | 34 38 36 2d 36 34 31 31 | (415) |486-6411|
|00003630| 0a 58 0a 58 20 20 20 20 | 20 76 65 72 6e 40 6c 62 |.X.X | vern@lb|
|00003640| 6c 2d 7b 63 73 61 6d 2c | 72 74 73 67 7d 2e 61 72 |l-{csam,|rtsg}.ar|
|00003650| 70 61 0a 58 20 20 20 20 | 20 75 63 62 76 61 78 21 |pa.X | ucbvax!|
|00003660| 6c 62 6c 2d 63 73 61 6d | 2e 61 72 70 61 21 76 65 |lbl-csam|.arpa!ve|
|00003670| 72 6e 0a 58 0a 58 2e 66 | 69 0a 58 2e 53 48 20 44 |rn.X.X.f|i.X.SH D|
|00003680| 49 41 47 4e 4f 53 54 49 | 43 53 0a 58 2e 4c 50 0a |IAGNOSTI|CS.X.LP.|
|00003690| 58 2e 49 20 66 6c 65 78 | 20 73 63 61 6e 6e 65 72 |X.I flex| scanner|
|000036a0| 20 6a 61 6d 6d 65 64 20 | 2d 0a 61 20 73 63 61 6e | jammed |-.a scan|
|000036b0| 6e 65 72 20 63 6f 6d 70 | 69 6c 65 64 20 77 69 74 |ner comp|iled wit|
|000036c0| 68 0a 58 2e 42 20 2d 73 | 0a 68 61 73 20 65 6e 63 |h.X.B -s|.has enc|
|000036d0| 6f 75 6e 74 65 72 65 64 | 20 61 6e 20 69 6e 70 75 |ountered| an inpu|
|000036e0| 74 20 73 74 72 69 6e 67 | 20 77 68 69 63 68 20 77 |t string| which w|
|000036f0| 61 73 6e 27 74 20 6d 61 | 74 63 68 65 64 20 62 79 |asn't ma|tched by|
|00003700| 0a 61 6e 79 20 6f 66 20 | 69 74 73 20 72 75 6c 65 |.any of |its rule|
|00003710| 73 2e 0a 58 2e 4c 50 0a | 58 2e 49 20 66 6c 65 78 |s..X.LP.|X.I flex|
|00003720| 20 69 6e 70 75 74 20 62 | 75 66 66 65 72 20 6f 76 | input b|uffer ov|
|00003730| 65 72 66 6c 6f 77 65 64 | 20 2d 0a 61 20 73 63 61 |erflowed| -.a sca|
|00003740| 6e 6e 65 72 20 72 75 6c | 65 20 6d 61 74 63 68 65 |nner rul|e matche|
|00003750| 64 20 61 20 73 74 72 69 | 6e 67 20 6c 6f 6e 67 20 |d a stri|ng long |
|00003760| 65 6e 6f 75 67 68 20 74 | 6f 20 6f 76 65 72 66 6c |enough t|o overfl|
|00003770| 6f 77 20 74 68 65 0a 73 | 63 61 6e 6e 65 72 27 73 |ow the.s|canner's|
|00003780| 20 69 6e 74 65 72 6e 61 | 6c 20 69 6e 70 75 74 20 | interna|l input |
|00003790| 62 75 66 66 65 72 20 28 | 61 73 20 6c 61 72 67 65 |buffer (|as large|
|000037a0| 20 61 73 0a 58 2e 42 20 | 42 55 46 53 49 5a 0a 69 | as.X.B |BUFSIZ.i|
|000037b0| 6e 20 22 2f 75 73 72 2f | 69 6e 63 6c 75 64 65 2f |n "/usr/|include/|
|000037c0| 73 74 64 69 6f 2e 68 22 | 29 2e 20 20 59 6f 75 20 |stdio.h"|). You |
|000037d0| 63 61 6e 20 65 64 69 74 | 0a 58 2e 49 20 66 6c 65 |can edit|.X.I fle|
|000037e0| 78 73 6b 65 6c 63 6f 6d | 2e 68 0a 61 6e 64 20 69 |xskelcom|.h.and i|
|000037f0| 6e 63 72 65 61 73 65 0a | 58 2e 42 20 59 59 5f 42 |ncrease.|X.B YY_B|
|00003800| 55 46 5f 53 49 5a 45 0a | 61 6e 64 0a 58 2e 42 20 |UF_SIZE.|and.X.B |
|00003810| 59 59 5f 4d 41 58 5f 4c | 49 4e 45 0a 74 6f 20 69 |YY_MAX_L|INE.to i|
|00003820| 6e 63 72 65 61 73 65 20 | 74 68 69 73 20 6c 69 6d |ncrease |this lim|
|00003830| 69 74 2e 0a 58 2e 4c 50 | 0a 58 2e 49 20 52 45 4a |it..X.LP|.X.I REJ|
|00003840| 45 43 54 20 75 73 65 64 | 20 61 6e 64 20 73 63 61 |ECT used| and sca|
|00003850| 6e 6e 65 72 20 77 61 73 | 0a 58 2e 49 20 6e 6f 74 |nner was|.X.I not|
|00003860| 20 67 65 6e 65 72 61 74 | 65 64 20 75 73 69 6e 67 | generat|ed using|
|00003870| 20 2d 72 20 2d 0a 6a 75 | 73 74 20 6c 69 6b 65 20 | -r -.ju|st like |
|00003880| 69 74 20 73 6f 75 6e 64 | 73 2e 20 20 59 6f 75 72 |it sound|s. Your|
|00003890| 20 73 63 61 6e 6e 65 72 | 20 75 73 65 73 0a 58 2e | scanner| uses.X.|
|000038a0| 42 20 52 45 4a 45 43 54 | 2e 0a 59 6f 75 20 6d 75 |B REJECT|..You mu|
|000038b0| 73 74 20 72 75 6e 20 66 | 6c 65 78 20 6f 6e 20 74 |st run f|lex on t|
|000038c0| 68 65 20 73 63 61 6e 6e | 65 72 20 64 65 73 63 72 |he scann|er descr|
|000038d0| 69 70 74 69 6f 6e 20 75 | 73 69 6e 67 20 74 68 65 |iption u|sing the|
|000038e0| 0a 58 2e 42 20 2d 72 0a | 66 6c 61 67 2e 0a 58 2e |.X.B -r.|flag..X.|
|000038f0| 4c 50 0a 58 2e 49 20 6f | 6c 64 2d 73 74 79 6c 65 |LP.X.I o|ld-style|
|00003900| 20 6c 65 78 20 63 6f 6d | 6d 61 6e 64 20 69 67 6e | lex com|mand ign|
|00003910| 6f 72 65 64 20 2d 0a 74 | 68 65 20 66 6c 65 78 20 |ored -.t|he flex |
|00003920| 69 6e 70 75 74 20 63 6f | 6e 74 61 69 6e 73 20 61 |input co|ntains a|
|00003930| 20 6c 65 78 20 63 6f 6d | 6d 61 6e 64 20 28 65 2e | lex com|mand (e.|
|00003940| 67 2e 2c 20 22 25 6e 20 | 31 30 30 30 22 29 20 77 |g., "%n |1000") w|
|00003950| 68 69 63 68 0a 69 73 20 | 62 65 69 6e 67 20 69 67 |hich.is |being ig|
|00003960| 6e 6f 72 65 64 2e 0a 58 | 2e 53 48 20 42 55 47 53 |nored..X|.SH BUGS|
|00003970| 0a 58 2e 4c 50 0a 55 73 | 65 20 6f 66 20 75 6e 70 |.X.LP.Us|e of unp|
|00003980| 75 74 28 29 20 6f 72 20 | 69 6e 70 75 74 28 29 20 |ut() or |input() |
|00003990| 74 72 61 73 68 65 73 20 | 74 68 65 20 63 75 72 72 |trashes |the curr|
|000039a0| 65 6e 74 20 79 79 74 65 | 78 74 20 61 6e 64 20 79 |ent yyte|xt and y|
|000039b0| 79 6c 65 6e 67 2e 0a 58 | 2e 4c 50 0a 55 73 65 20 |yleng..X|.LP.Use |
|000039c0| 6f 66 20 75 6e 70 75 74 | 28 29 20 74 6f 20 70 75 |of unput|() to pu|
|000039d0| 73 68 20 62 61 63 6b 20 | 6d 6f 72 65 20 74 65 78 |sh back |more tex|
|000039e0| 74 20 74 68 61 6e 20 77 | 61 73 20 6d 61 74 63 68 |t than w|as match|
|000039f0| 65 64 20 63 61 6e 0a 72 | 65 73 75 6c 74 20 69 6e |ed can.r|esult in|
|00003a00| 20 74 68 65 20 70 75 73 | 68 65 64 2d 62 61 63 6b | the pus|hed-back|
|00003a10| 20 74 65 78 74 20 6d 61 | 74 63 68 69 6e 67 20 61 | text ma|tching a|
|00003a20| 20 62 65 67 69 6e 6e 69 | 6e 67 2d 6f 66 2d 6c 69 | beginni|ng-of-li|
|00003a30| 6e 65 20 28 27 5e 27 29 | 0a 72 75 6c 65 20 65 76 |ne ('^')|.rule ev|
|00003a40| 65 6e 20 74 68 6f 75 67 | 68 20 69 74 20 64 69 64 |en thoug|h it did|
|00003a50| 6e 27 74 20 63 6f 6d 65 | 20 61 74 20 74 68 65 20 |n't come| at the |
|00003a60| 62 65 67 69 6e 6e 69 6e | 67 20 6f 66 20 74 68 65 |beginnin|g of the|
|00003a70| 20 6c 69 6e 65 2e 0a 58 | 2e 4c 50 0a 4e 75 6c 6c | line..X|.LP.Null|
|00003a80| 73 20 61 72 65 20 6e 6f | 74 20 61 6c 6c 6f 77 65 |s are no|t allowe|
|00003a90| 64 20 69 6e 20 66 6c 65 | 78 20 69 6e 70 75 74 73 |d in fle|x inputs|
|00003aa0| 20 6f 72 20 69 6e 20 74 | 68 65 20 69 6e 70 75 74 | or in t|he input|
|00003ab0| 73 20 74 6f 0a 73 63 61 | 6e 6e 65 72 73 20 67 65 |s to.sca|nners ge|
|00003ac0| 6e 65 72 61 74 65 64 20 | 62 79 20 66 6c 65 78 2e |nerated |by flex.|
|00003ad0| 20 20 54 68 65 69 72 20 | 70 72 65 73 65 6e 63 65 | Their |presence|
|00003ae0| 20 67 65 6e 65 72 61 74 | 65 73 20 66 61 74 61 6c | generat|es fatal|
|00003af0| 0a 65 72 72 6f 72 73 2e | 0a 58 2e 4c 50 0a 44 6f |.errors.|.X.LP.Do|
|00003b00| 20 6e 6f 74 20 6d 69 78 | 20 74 72 61 69 6c 69 6e | not mix| trailin|
|00003b10| 67 20 63 6f 6e 74 65 78 | 74 20 77 69 74 68 20 74 |g contex|t with t|
|00003b20| 68 65 20 27 7c 27 20 6f | 70 65 72 61 74 6f 72 20 |he '|' o|perator |
|00003b30| 75 73 65 64 20 74 6f 0a | 73 70 65 63 69 66 79 20 |used to.|specify |
|00003b40| 74 68 61 74 20 6d 75 6c | 74 69 70 6c 65 20 72 75 |that mul|tiple ru|
|00003b50| 6c 65 73 20 75 73 65 20 | 74 68 65 20 73 61 6d 65 |les use |the same|
|00003b60| 20 61 63 74 69 6f 6e 2e | 20 20 54 68 61 74 20 69 | action.| That i|
|00003b70| 73 2c 0a 61 76 6f 69 64 | 20 63 6f 6e 73 74 72 75 |s,.avoid| constru|
|00003b80| 63 74 73 20 6c 69 6b 65 | 3a 0a 58 2e 6e 66 0a 58 |cts like|:.X.nf.X|
|00003b90| 0a 58 20 20 20 20 20 20 | 20 20 66 6f 6f 2f 62 61 |.X | foo/ba|
|00003ba0| 72 20 20 20 20 20 20 7c | 0a 58 20 20 20 20 20 20 |r ||.X |
|00003bb0| 20 20 62 6c 65 74 63 68 | 20 20 20 20 20 20 20 7c | bletch| ||
|00003bc0| 0a 58 20 20 20 20 20 20 | 20 20 62 75 67 70 72 6f |.X | bugpro|
|00003bd0| 6e 65 20 20 20 20 20 7b | 20 2e 2e 2e 20 7d 0a 58 |ne {| ... }.X|
|00003be0| 0a 58 2e 66 69 0a 54 68 | 65 79 20 63 61 6e 20 72 |.X.fi.Th|ey can r|
|00003bf0| 65 73 75 6c 74 20 69 6e | 20 73 75 62 74 6c 65 20 |esult in| subtle |
|00003c00| 6d 69 73 6d 61 74 63 68 | 65 73 2e 20 20 54 68 69 |mismatch|es. Thi|
|00003c10| 73 20 69 73 20 61 63 74 | 75 61 6c 6c 79 20 6e 6f |s is act|ually no|
|00003c20| 74 0a 61 20 70 72 6f 62 | 6c 65 6d 20 69 66 20 74 |t.a prob|lem if t|
|00003c30| 68 65 72 65 20 69 73 20 | 6f 6e 6c 79 20 6f 6e 65 |here is |only one|
|00003c40| 20 72 75 6c 65 0a 75 73 | 69 6e 67 20 74 72 61 69 | rule.us|ing trai|
|00003c50| 6c 69 6e 67 20 63 6f 6e | 74 65 78 74 20 61 6e 64 |ling con|text and|
|00003c60| 20 69 74 20 69 73 20 74 | 68 65 20 66 69 72 73 74 | it is t|he first|
|00003c70| 20 69 6e 20 74 68 65 20 | 6c 69 73 74 20 28 73 6f | in the |list (so|
|00003c80| 20 74 68 65 0a 61 62 6f | 76 65 20 65 78 61 6d 70 | the.abo|ve examp|
|00003c90| 6c 65 20 77 69 6c 6c 20 | 61 63 74 75 61 6c 6c 79 |le will |actually|
|00003ca0| 20 77 6f 72 6b 20 6f 6b | 61 79 29 2e 20 20 54 68 | work ok|ay). Th|
|00003cb0| 65 0a 70 72 6f 62 6c 65 | 6d 20 69 73 20 64 75 65 |e.proble|m is due|
|00003cc0| 20 74 6f 20 66 61 6c 6c | 2d 74 68 72 6f 75 67 68 | to fall|-through|
|00003cd0| 20 69 6e 20 74 68 65 20 | 61 63 74 69 6f 6e 20 73 | in the |action s|
|00003ce0| 77 69 74 63 68 20 73 74 | 61 74 65 6d 65 6e 74 2c |witch st|atement,|
|00003cf0| 0a 63 61 75 73 69 6e 67 | 20 6e 6f 6e 2d 74 72 61 |.causing| non-tra|
|00003d00| 69 6c 69 6e 67 2d 63 6f | 6e 74 65 78 74 20 72 75 |iling-co|ntext ru|
|00003d10| 6c 65 73 20 74 6f 20 65 | 78 65 63 75 74 65 20 74 |les to e|xecute t|
|00003d20| 68 65 0a 74 72 61 69 6c | 69 6e 67 2d 63 6f 6e 74 |he.trail|ing-cont|
|00003d30| 65 78 74 20 63 6f 64 65 | 20 6f 66 20 74 68 65 69 |ext code| of thei|
|00003d40| 72 20 66 65 6c 6c 6f 77 | 20 72 75 6c 65 73 2e 20 |r fellow| rules. |
|00003d50| 20 54 68 69 73 20 73 68 | 6f 75 6c 64 0a 62 65 20 | This sh|ould.be |
|00003d60| 66 69 78 65 64 2c 20 61 | 73 20 69 74 27 73 20 61 |fixed, a|s it's a|
|00003d70| 20 6e 61 73 74 79 20 62 | 75 67 20 61 6e 64 20 6e | nasty b|ug and n|
|00003d80| 6f 74 20 6f 62 76 69 6f | 75 73 2e 20 20 54 68 65 |ot obvio|us. The|
|00003d90| 20 70 72 6f 70 65 72 20 | 66 69 78 20 69 73 0a 66 | proper |fix is.f|
|00003da0| 6f 72 20 66 6c 65 78 20 | 74 6f 20 73 70 69 74 20 |or flex |to spit |
|00003db0| 6f 75 74 20 61 20 46 4c | 45 58 5f 54 52 41 49 4c |out a FL|EX_TRAIL|
|00003dc0| 49 4e 47 5f 43 4f 4e 54 | 45 58 54 5f 55 53 45 44 |ING_CONT|EXT_USED|
|00003dd0| 20 23 64 65 66 69 6e 65 | 20 61 6e 64 20 74 68 65 | #define| and the|
|00003de0| 6e 0a 68 61 76 65 20 74 | 68 65 20 62 61 63 6b 75 |n.have t|he backu|
|00003df0| 70 20 6c 6f 67 69 63 20 | 69 6e 20 61 20 73 65 70 |p logic |in a sep|
|00003e00| 61 72 61 74 65 20 74 61 | 62 6c 65 20 77 68 69 63 |arate ta|ble whic|
|00003e10| 68 20 69 73 20 63 6f 6e | 73 75 6c 74 65 64 20 66 |h is con|sulted f|
|00003e20| 6f 72 0a 65 61 63 68 20 | 72 75 6c 65 2d 6d 61 74 |or.each |rule-mat|
|00003e30| 63 68 2c 20 72 61 74 68 | 65 72 20 74 68 61 6e 20 |ch, rath|er than |
|00003e40| 61 73 20 70 61 72 74 20 | 6f 66 20 74 68 65 20 72 |as part |of the r|
|00003e50| 75 6c 65 20 61 63 74 69 | 6f 6e 2e 20 20 54 68 65 |ule acti|on. The|
|00003e60| 0a 70 6c 61 63 65 20 74 | 6f 20 64 6f 20 74 68 65 |.place t|o do the|
|00003e70| 20 74 77 65 61 6b 69 6e | 67 20 69 73 20 69 6e 20 | tweakin|g is in |
|00003e80| 61 64 64 5f 61 63 63 65 | 70 74 28 29 20 2d 20 61 |add_acce|pt() - a|
|00003e90| 6e 79 20 6b 69 6e 64 20 | 73 6f 75 6c 20 77 61 6e |ny kind |soul wan|
|00003ea0| 74 0a 74 6f 20 62 65 20 | 61 20 68 65 72 6f 3f 0a |t.to be |a hero?.|
|00003eb0| 58 2e 4c 50 0a 54 68 65 | 20 70 61 74 74 65 72 6e |X.LP.The| pattern|
|00003ec0| 3a 0a 58 2e 6e 66 0a 58 | 0a 58 09 78 7b 33 7d 0a |:.X.nf.X|.X.x{3}.|
|00003ed0| 58 0a 58 2e 66 69 0a 69 | 73 20 63 6f 6e 73 69 64 |X.X.fi.i|s consid|
|00003ee0| 65 72 65 64 20 74 6f 20 | 62 65 20 76 61 72 69 61 |ered to |be varia|
|00003ef0| 62 6c 65 2d 6c 65 6e 67 | 74 68 20 66 6f 72 20 74 |ble-leng|th for t|
|00003f00| 68 65 20 70 75 72 70 6f | 73 65 73 20 6f 66 20 74 |he purpo|ses of t|
|00003f10| 72 61 69 6c 69 6e 67 0a | 63 6f 6e 74 65 78 74 2c |railing.|context,|
|00003f20| 20 65 76 65 6e 20 74 68 | 6f 75 67 68 20 69 74 20 | even th|ough it |
|00003f30| 68 61 73 20 61 20 63 6c | 65 61 72 20 66 69 78 65 |has a cl|ear fixe|
|00003f40| 64 20 6c 65 6e 67 74 68 | 2e 0a 58 2e 4c 50 0a 44 |d length|..X.LP.D|
|00003f50| 75 65 20 74 6f 20 62 6f | 74 68 20 62 75 66 66 65 |ue to bo|th buffe|
|00003f60| 72 69 6e 67 20 6f 66 20 | 69 6e 70 75 74 20 61 6e |ring of |input an|
|00003f70| 64 20 72 65 61 64 2d 61 | 68 65 61 64 2c 20 79 6f |d read-a|head, yo|
|00003f80| 75 20 63 61 6e 6e 6f 74 | 20 69 6e 74 65 72 6d 69 |u cannot| intermi|
|00003f90| 78 0a 63 61 6c 6c 73 20 | 74 6f 2c 20 66 6f 72 20 |x.calls |to, for |
|00003fa0| 65 78 61 6d 70 6c 65 2c | 0a 58 2e 42 20 67 65 74 |example,|.X.B get|
|00003fb0| 63 68 61 72 28 29 0a 77 | 69 74 68 20 66 6c 65 78 |char().w|ith flex|
|00003fc0| 20 72 75 6c 65 73 20 61 | 6e 64 20 65 78 70 65 63 | rules a|nd expec|
|00003fd0| 74 20 69 74 20 74 6f 20 | 77 6f 72 6b 2e 20 20 43 |t it to |work. C|
|00003fe0| 61 6c 6c 0a 58 2e 42 20 | 69 6e 70 75 74 28 29 0a |all.X.B |input().|
|00003ff0| 69 6e 73 74 65 61 64 2e | 0a 58 2e 4c 50 0a 54 68 |instead.|.X.LP.Th|
|00004000| 65 20 74 6f 74 61 6c 20 | 74 61 62 6c 65 20 65 6e |e total |table en|
|00004010| 74 72 69 65 73 20 6c 69 | 73 74 65 64 20 62 79 20 |tries li|sted by |
|00004020| 74 68 65 0a 58 2e 42 20 | 2d 76 0a 66 6c 61 67 20 |the.X.B |-v.flag |
|00004030| 65 78 63 6c 75 64 65 73 | 20 74 68 65 20 6e 75 6d |excludes| the num|
|00004040| 62 65 72 20 6f 66 20 74 | 61 62 6c 65 20 65 6e 74 |ber of t|able ent|
|00004050| 72 69 65 73 20 6e 65 65 | 64 65 64 20 74 6f 20 64 |ries nee|ded to d|
|00004060| 65 74 65 72 6d 69 6e 65 | 0a 77 68 61 74 20 72 75 |etermine|.what ru|
|00004070| 6c 65 20 68 61 73 20 62 | 65 65 6e 20 6d 61 74 63 |le has b|een matc|
|00004080| 68 65 64 2e 20 20 54 68 | 65 20 6e 75 6d 62 65 72 |hed. Th|e number|
|00004090| 20 6f 66 20 65 6e 74 72 | 69 65 73 20 69 73 20 65 | of entr|ies is e|
|000040a0| 71 75 61 6c 0a 74 6f 20 | 74 68 65 20 6e 75 6d 62 |qual.to |the numb|
|000040b0| 65 72 20 6f 66 20 44 46 | 41 20 73 74 61 74 65 73 |er of DF|A states|
|000040c0| 20 69 66 20 74 68 65 20 | 73 63 61 6e 6e 65 72 20 | if the |scanner |
|000040d0| 77 61 73 20 6e 6f 74 20 | 63 6f 6d 70 69 6c 65 64 |was not |compiled|
|000040e0| 0a 77 69 74 68 0a 58 2e | 42 20 2d 72 2c 0a 61 6e |.with.X.|B -r,.an|
|000040f0| 64 20 67 72 65 61 74 65 | 72 20 74 68 61 6e 20 74 |d greate|r than t|
|00004100| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 73 74 61 |he numbe|r of sta|
|00004110| 74 65 73 20 69 66 20 69 | 74 20 77 61 73 2e 0a 58 |tes if i|t was..X|
|00004120| 2e 4c 50 0a 54 68 65 20 | 73 63 61 6e 6e 65 72 20 |.LP.The |scanner |
|00004130| 72 75 6e 2d 74 69 6d 65 | 20 73 70 65 65 64 73 20 |run-time| speeds |
|00004140| 68 61 76 65 20 6e 6f 74 | 20 62 65 65 6e 20 6f 70 |have not| been op|
|00004150| 74 69 6d 69 7a 65 64 20 | 61 73 20 6d 75 63 68 0a |timized |as much.|
|00004160| 61 73 20 74 68 65 79 20 | 64 65 73 65 72 76 65 2e |as they |deserve.|
|00004170| 20 20 56 61 6e 20 4a 61 | 63 6f 62 73 6f 6e 27 73 | Van Ja|cobson's|
|00004180| 20 77 6f 72 6b 20 73 68 | 6f 77 73 20 74 68 61 74 | work sh|ows that|
|00004190| 20 74 68 65 20 63 61 6e | 20 67 6f 20 71 75 69 74 | the can| go quit|
|000041a0| 65 0a 61 20 62 69 74 20 | 66 61 73 74 65 72 20 73 |e.a bit |faster s|
|000041b0| 74 69 6c 6c 2e 0a 45 4e | 44 5f 4f 46 5f 46 49 4c |till..EN|D_OF_FIL|
|000041c0| 45 0a 69 66 20 74 65 73 | 74 20 31 35 35 35 38 20 |E.if tes|t 15558 |
|000041d0| 2d 6e 65 20 60 77 63 20 | 2d 63 20 3c 27 66 6c 65 |-ne `wc |-c <'fle|
|000041e0| 78 2e 31 27 60 3b 20 74 | 68 65 6e 0a 20 20 20 20 |x.1'`; t|hen. |
|000041f0| 65 63 68 6f 20 73 68 61 | 72 3a 20 5c 22 27 66 6c |echo sha|r: \"'fl|
|00004200| 65 78 2e 31 27 5c 22 20 | 75 6e 70 61 63 6b 65 64 |ex.1'\" |unpacked|
|00004210| 20 77 69 74 68 20 77 72 | 6f 6e 67 20 73 69 7a 65 | with wr|ong size|
|00004220| 21 0a 66 69 0a 23 20 65 | 6e 64 20 6f 66 20 27 66 |!.fi.# e|nd of 'f|
|00004230| 6c 65 78 2e 31 27 0a 66 | 69 0a 69 66 20 74 65 73 |lex.1'.f|i.if tes|
|00004240| 74 20 2d 66 20 27 66 6c | 65 78 64 65 66 2e 68 27 |t -f 'fl|exdef.h'|
|00004250| 20 2d 61 20 22 24 7b 31 | 7d 22 20 21 3d 20 22 2d | -a "${1|}" != "-|
|00004260| 63 22 20 3b 20 74 68 65 | 6e 20 0a 20 20 65 63 68 |c" ; the|n . ech|
|00004270| 6f 20 73 68 61 72 3a 20 | 57 69 6c 6c 20 6e 6f 74 |o shar: |Will not|
|00004280| 20 63 6c 6f 62 62 65 72 | 20 65 78 69 73 74 69 6e | clobber| existin|
|00004290| 67 20 66 69 6c 65 20 5c | 22 27 66 6c 65 78 64 65 |g file \|"'flexde|
|000042a0| 66 2e 68 27 5c 22 0a 65 | 6c 73 65 0a 65 63 68 6f |f.h'\".e|lse.echo|
|000042b0| 20 73 68 61 72 3a 20 45 | 78 74 72 61 63 74 69 6e | shar: E|xtractin|
|000042c0| 67 20 5c 22 27 66 6c 65 | 78 64 65 66 2e 68 27 5c |g \"'fle|xdef.h'\|
|000042d0| 22 20 5c 28 31 37 33 32 | 37 20 63 68 61 72 61 63 |" \(1732|7 charac|
|000042e0| 74 65 72 73 5c 29 0a 73 | 65 64 20 22 73 2f 5e 58 |ters\).s|ed "s/^X|
|000042f0| 2f 2f 22 20 3e 27 66 6c | 65 78 64 65 66 2e 68 27 |//" >'fl|exdef.h'|
|00004300| 20 3c 3c 27 45 4e 44 5f | 4f 46 5f 46 49 4c 45 27 | <<'END_|OF_FILE'|
|00004310| 0a 58 2f 2a 0a 58 20 2a | 20 20 44 65 66 69 6e 69 |.X/*.X *| Defini|
|00004320| 74 69 6f 6e 73 20 66 6f | 72 20 66 6c 65 78 2e 0a |tions fo|r flex..|
|00004330| 58 20 2a 0a 58 20 2a 20 | 6d 6f 64 69 66 69 63 61 |X *.X * |modifica|
|00004340| 74 69 6f 6e 20 68 69 73 | 74 6f 72 79 0a 58 20 2a |tion his|tory.X *|
|00004350| 20 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | -------|--------|
|00004360| 2d 2d 2d 2d 2d 0a 58 20 | 2a 20 30 32 62 20 6b 67 |-----.X |* 02b kg|
|00004370| 2c 20 76 70 20 20 20 33 | 30 73 65 70 38 37 20 20 |, vp 3|0sep87 |
|00004380| 2e 61 64 64 65 64 20 64 | 65 66 69 6e 69 74 69 6f |.added d|efinitio|
|00004390| 6e 73 20 66 6f 72 20 66 | 61 73 74 20 73 63 61 6e |ns for f|ast scan|
|000043a0| 6e 65 72 3b 20 6d 69 73 | 63 2e 20 63 6c 65 61 6e |ner; mis|c. clean|
|000043b0| 75 70 0a 58 20 2a 20 30 | 32 61 20 76 70 20 20 20 |up.X * 0|2a vp |
|000043c0| 20 20 20 20 32 37 6a 75 | 6e 38 36 20 20 2e 74 72 | 27ju|n86 .tr|
|000043d0| 61 6e 73 6c 61 74 65 64 | 20 69 6e 74 6f 20 43 2f |anslated| into C/|
|000043e0| 46 54 4c 0a 58 20 2a 2f | 0a 58 0a 58 2f 2a 0a 58 |FTL.X */|.X.X/*.X|
|000043f0| 20 2a 20 43 6f 70 79 72 | 69 67 68 74 20 28 63 29 | * Copyr|ight (c)|
|00004400| 20 31 39 38 37 2c 20 74 | 68 65 20 55 6e 69 76 65 | 1987, t|he Unive|
|00004410| 72 73 69 74 79 20 6f 66 | 20 43 61 6c 69 66 6f 72 |rsity of| Califor|
|00004420| 6e 69 61 0a 58 20 2a 20 | 0a 58 20 2a 20 54 68 65 |nia.X * |.X * The|
|00004430| 20 55 6e 69 74 65 64 20 | 53 74 61 74 65 73 20 47 | United |States G|
|00004440| 6f 76 65 72 6e 6d 65 6e | 74 20 68 61 73 20 72 69 |overnmen|t has ri|
|00004450| 67 68 74 73 20 69 6e 20 | 74 68 69 73 20 77 6f 72 |ghts in |this wor|
|00004460| 6b 20 70 75 72 73 75 61 | 6e 74 20 74 6f 0a 58 20 |k pursua|nt to.X |
|00004470| 2a 20 63 6f 6e 74 72 61 | 63 74 20 6e 6f 2e 20 44 |* contra|ct no. D|
|00004480| 45 2d 41 43 30 33 2d 37 | 36 53 46 30 30 30 39 38 |E-AC03-7|6SF00098|
|00004490| 20 62 65 74 77 65 65 6e | 20 74 68 65 20 55 6e 69 | between| the Uni|
|000044a0| 74 65 64 20 53 74 61 74 | 65 73 20 44 65 70 61 72 |ted Stat|es Depar|
|000044b0| 74 6d 65 6e 74 20 6f 66 | 0a 58 20 2a 20 45 6e 65 |tment of|.X * Ene|
|000044c0| 72 67 79 20 61 6e 64 20 | 74 68 65 20 55 6e 69 76 |rgy and |the Univ|
|000044d0| 65 72 73 69 74 79 20 6f | 66 20 43 61 6c 69 66 6f |ersity o|f Califo|
|000044e0| 72 6e 69 61 2e 0a 58 20 | 2a 20 0a 58 20 2a 20 54 |rnia..X |* .X * T|
|000044f0| 68 69 73 20 70 72 6f 67 | 72 61 6d 20 6d 61 79 20 |his prog|ram may |
|00004500| 62 65 20 72 65 64 69 73 | 74 72 69 62 75 74 65 64 |be redis|tributed|
|00004510| 2e 20 20 45 6e 68 61 6e | 63 65 6d 65 6e 74 73 20 |. Enhan|cements |
|00004520| 61 6e 64 20 64 65 72 69 | 76 61 74 69 76 65 20 77 |and deri|vative w|
|00004530| 6f 72 6b 73 0a 58 20 2a | 20 6d 61 79 20 62 65 20 |orks.X *| may be |
|00004540| 63 72 65 61 74 65 64 20 | 70 72 6f 76 69 64 65 64 |created |provided|
|00004550| 20 74 68 65 20 6e 65 77 | 20 77 6f 72 6b 73 2c 20 | the new| works, |
|00004560| 69 66 20 6d 61 64 65 20 | 61 76 61 69 6c 61 62 6c |if made |availabl|
|00004570| 65 20 74 6f 20 74 68 65 | 20 67 65 6e 65 72 61 6c |e to the| general|
|00004580| 0a 58 20 2a 20 70 75 62 | 6c 69 63 2c 20 61 72 65 |.X * pub|lic, are|
|00004590| 20 6d 61 64 65 20 61 76 | 61 69 6c 61 62 6c 65 20 | made av|ailable |
|000045a0| 66 6f 72 20 75 73 65 20 | 62 79 20 61 6e 79 6f 6e |for use |by anyon|
|000045b0| 65 2e 0a 58 20 2a 2f 0a | 58 0a 58 23 69 6e 63 6c |e..X */.|X.X#incl|
|000045c0| 75 64 65 20 3c 73 74 64 | 69 6f 2e 68 3e 0a 58 0a |ude <std|io.h>.X.|
|000045d0| 58 23 69 66 64 65 66 20 | 53 56 0a 58 23 69 6e 63 |X#ifdef |SV.X#inc|
|000045e0| 6c 75 64 65 20 3c 73 74 | 72 69 6e 67 2e 68 3e 0a |lude <st|ring.h>.|
|000045f0| 58 23 64 65 66 69 6e 65 | 20 62 7a 65 72 6f 28 73 |X#define| bzero(s|
|00004600| 2c 20 6e 29 20 6d 65 6d | 73 65 74 28 28 63 68 61 |, n) mem|set((cha|
|00004610| 72 20 2a 29 28 73 29 2c | 20 27 5c 30 30 30 27 2c |r *)(s),| '\000',|
|00004620| 20 28 75 6e 73 69 67 6e | 65 64 29 28 6e 29 29 0a | (unsign|ed)(n)).|
|00004630| 58 23 65 6c 73 65 0a 58 | 23 69 6e 63 6c 75 64 65 |X#else.X|#include|
|00004640| 20 3c 73 74 72 69 6e 67 | 73 2e 68 3e 0a 58 23 65 | <string|s.h>.X#e|
|00004650| 6e 64 69 66 0a 58 0a 63 | 68 61 72 20 2a 73 70 72 |ndif.X.c|har *spr|
|00004660| 69 6e 74 66 28 29 3b 20 | 2f 2a 20 6b 65 65 70 20 |intf(); |/* keep |
|00004670| 6c 69 6e 74 20 68 61 70 | 70 79 20 2a 2f 0a 58 0a |lint hap|py */.X.|
|00004680| 58 0a 58 2f 2a 20 6d 61 | 78 69 6d 75 6d 20 6c 69 |X.X/* ma|ximum li|
|00004690| 6e 65 20 6c 65 6e 67 74 | 68 20 77 65 27 6c 6c 20 |ne lengt|h we'll |
|000046a0| 68 61 76 65 20 74 6f 20 | 64 65 61 6c 20 77 69 74 |have to |deal wit|
|000046b0| 68 20 2a 2f 0a 58 23 64 | 65 66 69 6e 65 20 4d 41 |h */.X#d|efine MA|
|000046c0| 58 4c 49 4e 45 20 42 55 | 46 53 49 5a 0a 58 0a 58 |XLINE BU|FSIZ.X.X|
|000046d0| 2f 2a 20 6d 61 78 69 6d | 75 6d 20 73 69 7a 65 20 |/* maxim|um size |
|000046e0| 6f 66 20 66 69 6c 65 20 | 6e 61 6d 65 20 2a 2f 0a |of file |name */.|
|000046f0| 58 23 64 65 66 69 6e 65 | 20 46 49 4c 45 4e 41 4d |X#define| FILENAM|
|00004700| 45 53 49 5a 45 20 31 30 | 32 34 0a 58 0a 58 23 64 |ESIZE 10|24.X.X#d|
|00004710| 65 66 69 6e 65 20 6d 69 | 6e 28 78 2c 79 29 20 28 |efine mi|n(x,y) (|
|00004720| 78 20 3c 20 79 20 3f 20 | 78 20 3a 20 79 29 0a 58 |x < y ? |x : y).X|
|00004730| 23 64 65 66 69 6e 65 20 | 6d 61 78 28 78 2c 79 29 |#define |max(x,y)|
|00004740| 20 28 78 20 3e 20 79 20 | 3f 20 78 20 3a 20 79 29 | (x > y |? x : y)|
|00004750| 0a 58 0a 58 23 64 65 66 | 69 6e 65 20 74 72 75 65 |.X.X#def|ine true|
|00004760| 20 31 0a 58 23 64 65 66 | 69 6e 65 20 66 61 6c 73 | 1.X#def|ine fals|
|00004770| 65 20 30 0a 58 0a 58 0a | 58 23 69 66 6e 64 65 66 |e 0.X.X.|X#ifndef|
|00004780| 20 44 45 46 41 55 4c 54 | 5f 53 4b 45 4c 45 54 4f | DEFAULT|_SKELETO|
|00004790| 4e 5f 46 49 4c 45 0a 58 | 23 64 65 66 69 6e 65 20 |N_FILE.X|#define |
|000047a0| 44 45 46 41 55 4c 54 5f | 53 4b 45 4c 45 54 4f 4e |DEFAULT_|SKELETON|
|000047b0| 5f 46 49 4c 45 20 22 66 | 6c 65 78 2e 73 6b 65 6c |_FILE "f|lex.skel|
|000047c0| 22 0a 58 23 65 6e 64 69 | 66 0a 58 0a 58 23 69 66 |".X#endi|f.X.X#if|
|000047d0| 6e 64 65 66 20 46 41 53 | 54 5f 53 4b 45 4c 45 54 |ndef FAS|T_SKELET|
|000047e0| 4f 4e 5f 46 49 4c 45 0a | 58 23 64 65 66 69 6e 65 |ON_FILE.|X#define|
|000047f0| 20 46 41 53 54 5f 53 4b | 45 4c 45 54 4f 4e 5f 46 | FAST_SK|ELETON_F|
|00004800| 49 4c 45 20 22 66 6c 65 | 78 2e 66 61 73 74 73 6b |ILE "fle|x.fastsk|
|00004810| 65 6c 22 0a 58 23 65 6e | 64 69 66 0a 58 0a 58 2f |el".X#en|dif.X.X/|
|00004820| 2a 20 73 70 65 63 69 61 | 6c 20 6e 78 74 5b 5d 20 |* specia|l nxt[] |
|00004830| 61 63 74 69 6f 6e 20 6e | 75 6d 62 65 72 20 66 6f |action n|umber fo|
|00004840| 72 20 74 68 65 20 22 61 | 74 20 74 68 65 20 65 6e |r the "a|t the en|
|00004850| 64 20 6f 66 20 74 68 65 | 20 69 6e 70 75 74 20 62 |d of the| input b|
|00004860| 75 66 66 65 72 22 20 73 | 74 61 74 65 20 2a 2f 0a |uffer" s|tate */.|
|00004870| 58 2f 2a 20 6e 6f 74 65 | 3a 20 2d 31 20 69 73 20 |X/* note|: -1 is |
|00004880| 61 6c 72 65 61 64 79 20 | 74 61 6b 65 6e 20 62 79 |already |taken by|
|00004890| 20 59 59 5f 4e 45 57 5f | 46 49 4c 45 20 2a 2f 0a | YY_NEW_|FILE */.|
|000048a0| 58 23 64 65 66 69 6e 65 | 20 45 4e 44 5f 4f 46 5f |X#define| END_OF_|
|000048b0| 42 55 46 46 45 52 5f 41 | 43 54 49 4f 4e 20 2d 33 |BUFFER_A|CTION -3|
|000048c0| 0a 58 2f 2a 20 61 63 74 | 69 6f 6e 20 6e 75 6d 62 |.X/* act|ion numb|
|000048d0| 65 72 20 66 6f 72 20 64 | 65 66 61 75 6c 74 20 61 |er for d|efault a|
|000048e0| 63 74 69 6f 6e 20 66 6f | 72 20 66 61 73 74 20 73 |ction fo|r fast s|
|000048f0| 63 61 6e 6e 65 72 73 20 | 2a 2f 0a 58 23 64 65 66 |canners |*/.X#def|
|00004900| 69 6e 65 20 44 45 46 41 | 55 4c 54 5f 41 43 54 49 |ine DEFA|ULT_ACTI|
|00004910| 4f 4e 20 2d 32 0a 58 0a | 58 2f 2a 20 73 70 65 63 |ON -2.X.|X/* spec|
|00004920| 69 61 6c 20 63 68 6b 5b | 5d 20 76 61 6c 75 65 73 |ial chk[|] values|
|00004930| 20 6d 61 72 6b 69 6e 67 | 20 74 68 65 20 73 6c 6f | marking| the slo|
|00004940| 74 73 20 74 61 6b 69 6e | 67 20 62 79 20 65 6e 64 |ts takin|g by end|
|00004950| 2d 6f 66 2d 62 75 66 66 | 65 72 20 61 6e 64 20 61 |-of-buff|er and a|
|00004960| 63 74 69 6f 6e 0a 58 20 | 2a 20 6e 75 6d 62 65 72 |ction.X |* number|
|00004970| 73 0a 58 20 2a 2f 0a 58 | 23 64 65 66 69 6e 65 20 |s.X */.X|#define |
|00004980| 45 4f 42 5f 50 4f 53 49 | 54 49 4f 4e 20 2d 31 0a |EOB_POSI|TION -1.|
|00004990| 58 23 64 65 66 69 6e 65 | 20 41 43 54 49 4f 4e 5f |X#define| ACTION_|
|000049a0| 50 4f 53 49 54 49 4f 4e | 20 2d 32 0a 58 0a 58 2f |POSITION| -2.X.X/|
|000049b0| 2a 20 6e 75 6d 62 65 72 | 20 6f 66 20 64 61 74 61 |* number| of data|
|000049c0| 20 69 74 65 6d 73 20 70 | 65 72 20 6c 69 6e 65 20 | items p|er line |
|000049d0| 66 6f 72 20 2d 66 20 6f | 75 74 70 75 74 20 2a 2f |for -f o|utput */|
|000049e0| 0a 58 23 64 65 66 69 6e | 65 20 4e 55 4d 44 41 54 |.X#defin|e NUMDAT|
|000049f0| 41 49 54 45 4d 53 20 31 | 30 0a 58 0a 58 2f 2a 20 |AITEMS 1|0.X.X/* |
|00004a00| 6e 75 6d 62 65 72 20 6f | 66 20 6c 69 6e 65 73 20 |number o|f lines |
|00004a10| 6f 66 20 64 61 74 61 20 | 69 6e 20 2d 66 20 6f 75 |of data |in -f ou|
|00004a20| 74 70 75 74 20 62 65 66 | 6f 72 65 20 69 6e 73 65 |tput bef|ore inse|
|00004a30| 72 74 69 6e 67 20 61 20 | 62 6c 61 6e 6b 20 6c 69 |rting a |blank li|
|00004a40| 6e 65 20 66 6f 72 0a 58 | 20 2a 20 72 65 61 64 61 |ne for.X| * reada|
|00004a50| 62 69 6c 69 74 79 2e 0a | 58 20 2a 2f 0a 58 23 64 |bility..|X */.X#d|
|00004a60| 65 66 69 6e 65 20 4e 55 | 4d 44 41 54 41 4c 49 4e |efine NU|MDATALIN|
|00004a70| 45 53 20 31 30 0a 58 0a | 58 2f 2a 20 74 72 61 6e |ES 10.X.|X/* tran|
|00004a80| 73 69 74 69 6f 6e 5f 73 | 74 72 75 63 74 5f 6f 75 |sition_s|truct_ou|
|00004a90| 74 28 29 20 64 65 66 69 | 6e 69 74 69 6f 6e 73 20 |t() defi|nitions |
|00004aa0| 2a 2f 0a 58 23 64 65 66 | 69 6e 65 20 54 52 41 4e |*/.X#def|ine TRAN|
|00004ab0| 53 5f 53 54 52 55 43 54 | 5f 50 52 49 4e 54 5f 4c |S_STRUCT|_PRINT_L|
|00004ac0| 45 4e 47 54 48 20 31 35 | 0a 58 0a 58 2f 2a 20 72 |ENGTH 15|.X.X/* r|
|00004ad0| 65 74 75 72 6e 73 20 74 | 72 75 65 20 69 66 20 61 |eturns t|rue if a|
|00004ae0| 6e 20 6e 66 61 20 73 74 | 61 74 65 20 68 61 73 20 |n nfa st|ate has |
|00004af0| 61 6e 20 65 70 73 69 6c | 6f 6e 20 6f 75 74 2d 74 |an epsil|on out-t|
|00004b00| 72 61 6e 73 69 74 69 6f | 6e 20 73 6c 6f 74 0a 58 |ransitio|n slot.X|
|00004b10| 20 2a 20 74 68 61 74 20 | 63 61 6e 20 62 65 20 75 | * that |can be u|
|00004b20| 73 65 64 2e 20 20 54 68 | 69 73 20 64 65 66 69 6e |sed. Th|is defin|
|00004b30| 69 74 69 6f 6e 20 69 73 | 20 63 75 72 72 65 6e 74 |ition is| current|
|00004b40| 6c 79 20 6e 6f 74 20 75 | 73 65 64 2e 0a 58 20 2a |ly not u|sed..X *|
|00004b50| 2f 0a 58 23 64 65 66 69 | 6e 65 20 46 52 45 45 5f |/.X#defi|ne FREE_|
|00004b60| 45 50 53 49 4c 4f 4e 28 | 73 74 61 74 65 29 20 5c |EPSILON(|state) \|
|00004b70| 0a 58 09 28 74 72 61 6e | 73 63 68 61 72 5b 73 74 |.X.(tran|schar[st|
|00004b80| 61 74 65 5d 20 3d 3d 20 | 53 59 4d 5f 45 50 53 49 |ate] == |SYM_EPSI|
|00004b90| 4c 4f 4e 20 26 26 20 5c | 0a 58 09 20 74 72 61 6e |LON && \|.X. tran|
|00004ba0| 73 32 5b 73 74 61 74 65 | 5d 20 3d 3d 20 4e 4f 5f |s2[state|] == NO_|
|00004bb0| 54 52 41 4e 53 49 54 49 | 4f 4e 20 26 26 20 5c 0a |TRANSITI|ON && \.|
|00004bc0| 58 09 20 66 69 6e 61 6c | 73 74 5b 73 74 61 74 65 |X. final|st[state|
|00004bd0| 5d 20 21 3d 20 73 74 61 | 74 65 29 0a 58 0a 58 2f |] != sta|te).X.X/|
|00004be0| 2a 20 72 65 74 75 72 6e | 73 20 74 72 75 65 20 69 |* return|s true i|
|00004bf0| 66 20 61 6e 20 6e 66 61 | 20 73 74 61 74 65 20 68 |f an nfa| state h|
|00004c00| 61 73 20 61 6e 20 65 70 | 73 69 6c 6f 6e 20 6f 75 |as an ep|silon ou|
|00004c10| 74 2d 74 72 61 6e 73 69 | 74 69 6f 6e 20 63 68 61 |t-transi|tion cha|
|00004c20| 72 61 63 74 65 72 0a 58 | 20 2a 20 61 6e 64 20 62 |racter.X| * and b|
|00004c30| 6f 74 68 20 73 6c 6f 74 | 73 20 61 72 65 20 66 72 |oth slot|s are fr|
|00004c40| 65 65 0a 58 20 2a 2f 0a | 58 23 64 65 66 69 6e 65 |ee.X */.|X#define|
|00004c50| 20 53 55 50 45 52 5f 46 | 52 45 45 5f 45 50 53 49 | SUPER_F|REE_EPSI|
|00004c60| 4c 4f 4e 28 73 74 61 74 | 65 29 20 5c 0a 58 09 28 |LON(stat|e) \.X.(|
|00004c70| 74 72 61 6e 73 63 68 61 | 72 5b 73 74 61 74 65 5d |transcha|r[state]|
|00004c80| 20 3d 3d 20 53 59 4d 5f | 45 50 53 49 4c 4f 4e 20 | == SYM_|EPSILON |
|00004c90| 26 26 20 5c 0a 58 09 20 | 74 72 61 6e 73 31 5b 73 |&& \.X. |trans1[s|
|00004ca0| 74 61 74 65 5d 20 3d 3d | 20 4e 4f 5f 54 52 41 4e |tate] ==| NO_TRAN|
|00004cb0| 53 49 54 49 4f 4e 29 20 | 5c 0a 58 0a 58 2f 2a 20 |SITION) |\.X.X/* |
|00004cc0| 6d 61 78 69 6d 75 6d 20 | 6e 75 6d 62 65 72 20 6f |maximum |number o|
|00004cd0| 66 20 4e 46 41 20 73 74 | 61 74 65 73 20 74 68 61 |f NFA st|ates tha|
|00004ce0| 74 20 63 61 6e 20 63 6f | 6d 70 72 69 73 65 20 61 |t can co|mprise a|
|00004cf0| 20 44 46 41 20 73 74 61 | 74 65 2e 20 20 49 74 27 | DFA sta|te. It'|
|00004d00| 73 20 72 65 61 6c 0a 58 | 20 2a 20 62 69 67 20 62 |s real.X| * big b|
|00004d10| 65 63 61 75 73 65 20 69 | 66 20 74 68 65 72 65 27 |ecause i|f there'|
|00004d20| 73 20 61 20 6c 6f 74 20 | 6f 66 20 72 75 6c 65 73 |s a lot |of rules|
|00004d30| 2c 20 74 68 65 20 69 6e | 69 74 69 61 6c 20 73 74 |, the in|itial st|
|00004d40| 61 74 65 20 77 69 6c 6c | 20 68 61 76 65 20 61 0a |ate will| have a.|
|00004d50| 58 20 2a 20 68 75 67 65 | 20 65 70 73 69 6c 6f 6e |X * huge| epsilon|
|00004d60| 20 63 6c 6f 73 75 72 65 | 2e 0a 58 20 2a 2f 0a 58 | closure|..X */.X|
|00004d70| 23 64 65 66 69 6e 65 20 | 49 4e 49 54 49 41 4c 5f |#define |INITIAL_|
|00004d80| 4d 41 58 5f 44 46 41 5f | 53 49 5a 45 20 37 35 30 |MAX_DFA_|SIZE 750|
|00004d90| 0a 58 23 64 65 66 69 6e | 65 20 4d 41 58 5f 44 46 |.X#defin|e MAX_DF|
|00004da0| 41 5f 53 49 5a 45 5f 49 | 4e 43 52 45 4d 45 4e 54 |A_SIZE_I|NCREMENT|
|00004db0| 20 37 35 30 0a 58 0a 58 | 2f 2a 20 61 72 72 61 79 | 750.X.X|/* array|
|00004dc0| 20 6e 61 6d 65 73 20 74 | 6f 20 62 65 20 75 73 65 | names t|o be use|
|00004dd0| 64 20 69 6e 20 67 65 6e | 65 72 61 74 65 64 20 6d |d in gen|erated m|
|00004de0| 61 63 68 69 6e 65 2e 20 | 20 54 68 65 79 27 72 65 |achine. | They're|
|00004df0| 20 73 68 6f 72 74 20 62 | 65 63 61 75 73 65 0a 58 | short b|ecause.X|
|00004e00| 20 2a 20 77 65 20 77 72 | 69 74 65 20 6f 75 74 20 | * we wr|ite out |
|00004e10| 6f 6e 65 20 64 61 74 61 | 20 73 74 61 74 65 6d 65 |one data| stateme|
|00004e20| 6e 74 20 28 77 68 69 63 | 68 20 6e 61 6d 65 73 20 |nt (whic|h names |
|00004e30| 74 68 65 20 61 72 72 61 | 79 29 20 66 6f 72 20 65 |the arra|y) for e|
|00004e40| 61 63 68 20 65 6c 65 6d | 65 6e 74 0a 58 20 2a 20 |ach elem|ent.X * |
|00004e50| 69 6e 20 74 68 65 20 61 | 72 72 61 79 2e 0a 58 20 |in the a|rray..X |
|00004e60| 2a 2f 0a 58 0a 58 23 64 | 65 66 69 6e 65 20 41 4c |*/.X.X#d|efine AL|
|00004e70| 49 53 54 20 27 6c 27 09 | 2f 2a 20 70 6f 69 6e 74 |IST 'l'.|/* point|
|00004e80| 73 20 74 6f 20 6c 69 73 | 74 20 6f 66 20 72 75 6c |s to lis|t of rul|
|00004e90| 65 73 20 61 63 63 65 70 | 74 65 64 20 66 6f 72 20 |es accep|ted for |
|00004ea0| 61 20 73 74 61 74 65 20 | 2a 2f 0a 58 23 64 65 66 |a state |*/.X#def|
|00004eb0| 69 6e 65 20 41 43 43 45 | 50 54 20 27 61 27 09 2f |ine ACCE|PT 'a'./|
|00004ec0| 2a 20 6c 69 73 74 20 6f | 66 20 72 75 6c 65 73 20 |* list o|f rules |
|00004ed0| 61 63 63 65 70 74 65 64 | 20 66 6f 72 20 61 20 73 |accepted| for a s|
|00004ee0| 74 61 74 65 20 2a 2f 0a | 58 23 64 65 66 69 6e 65 |tate */.|X#define|
|00004ef0| 20 45 43 41 52 52 41 59 | 20 27 65 27 09 2f 2a 20 | ECARRAY| 'e'./* |
|00004f00| 6d 61 70 73 20 69 6e 70 | 75 74 20 63 68 61 72 61 |maps inp|ut chara|
|00004f10| 63 74 65 72 73 20 74 6f | 20 65 71 75 69 76 61 6c |cters to| equival|
|00004f20| 65 6e 63 65 20 63 6c 61 | 73 73 65 73 20 2a 2f 0a |ence cla|sses */.|
|00004f30| 58 23 64 65 66 69 6e 65 | 20 4d 41 54 43 48 41 52 |X#define| MATCHAR|
|00004f40| 52 41 59 20 27 6d 27 09 | 2f 2a 20 6d 61 70 73 20 |RAY 'm'.|/* maps |
|00004f50| 65 71 75 69 76 61 6c 65 | 6e 63 65 20 63 6c 61 73 |equivale|nce clas|
|00004f60| 73 65 73 20 74 6f 20 6d | 65 74 61 2d 65 71 75 69 |ses to m|eta-equi|
|00004f70| 76 61 6c 65 6e 63 65 20 | 63 6c 61 73 73 65 73 20 |valence |classes |
|00004f80| 2a 2f 0a 58 23 64 65 66 | 69 6e 65 20 42 41 53 45 |*/.X#def|ine BASE|
|00004f90| 41 52 52 41 59 20 27 62 | 27 09 2f 2a 20 22 62 61 |ARRAY 'b|'./* "ba|
|00004fa0| 73 65 22 20 61 72 72 61 | 79 20 2a 2f 0a 58 23 64 |se" arra|y */.X#d|
|00004fb0| 65 66 69 6e 65 20 44 45 | 46 41 52 52 41 59 20 27 |efine DE|FARRAY '|
|00004fc0| 64 27 09 2f 2a 20 22 64 | 65 66 61 75 6c 74 22 20 |d'./* "d|efault" |
|00004fd0| 61 72 72 61 79 20 2a 2f | 0a 58 23 64 65 66 69 6e |array */|.X#defin|
|00004fe0| 65 20 4e 45 58 54 41 52 | 52 41 59 20 27 6e 27 09 |e NEXTAR|RAY 'n'.|
|00004ff0| 2f 2a 20 22 6e 65 78 74 | 22 20 61 72 72 61 79 20 |/* "next|" array |
|00005000| 2a 2f 0a 58 23 64 65 66 | 69 6e 65 20 43 48 45 43 |*/.X#def|ine CHEC|
|00005010| 4b 41 52 52 41 59 20 27 | 63 27 09 2f 2a 20 22 63 |KARRAY '|c'./* "c|
|00005020| 68 65 63 6b 22 20 61 72 | 72 61 79 20 2a 2f 0a 58 |heck" ar|ray */.X|
|00005030| 0a 58 2f 2a 20 4e 49 4c | 20 6d 75 73 74 20 62 65 |.X/* NIL| must be|
|00005040| 20 30 2e 20 20 49 66 20 | 6e 6f 74 2c 20 69 74 73 | 0. If |not, its|
|00005050| 20 73 70 65 63 69 61 6c | 20 6d 65 61 6e 69 6e 67 | special| meaning|
|00005060| 20 77 68 65 6e 20 6d 61 | 6b 69 6e 67 20 65 71 75 | when ma|king equ|
|00005070| 69 76 61 6c 65 6e 63 65 | 20 63 6c 61 73 73 65 73 |ivalence| classes|
|00005080| 0a 58 20 2a 20 28 69 74 | 20 6d 61 72 6b 73 20 74 |.X * (it| marks t|
|00005090| 68 65 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 76 |he repre|sentativ|
|000050a0| 65 20 6f 66 20 61 20 67 | 69 76 65 6e 20 65 2e 63 |e of a g|iven e.c|
|000050b0| 2e 29 20 77 69 6c 6c 20 | 62 65 20 75 6e 69 64 65 |.) will |be unide|
|000050c0| 6e 74 69 66 69 61 62 6c | 65 0a 58 20 2a 2f 0a 58 |ntifiabl|e.X */.X|
|000050d0| 23 64 65 66 69 6e 65 20 | 4e 49 4c 20 30 0a 58 0a |#define |NIL 0.X.|
|000050e0| 58 23 64 65 66 69 6e 65 | 20 4a 41 4d 20 2d 31 09 |X#define| JAM -1.|
|000050f0| 2f 2a 20 74 6f 20 6d 61 | 72 6b 20 61 20 6d 69 73 |/* to ma|rk a mis|
|00005100| 73 69 6e 67 20 44 46 41 | 20 74 72 61 6e 73 69 74 |sing DFA| transit|
|00005110| 69 6f 6e 20 2a 2f 0a 58 | 23 64 65 66 69 6e 65 20 |ion */.X|#define |
|00005120| 4e 4f 5f 54 52 41 4e 53 | 49 54 49 4f 4e 20 4e 49 |NO_TRANS|ITION NI|
|00005130| 4c 0a 58 23 64 65 66 69 | 6e 65 20 55 4e 49 51 55 |L.X#defi|ne UNIQU|
|00005140| 45 20 2d 31 09 2f 2a 20 | 6d 61 72 6b 73 20 61 20 |E -1./* |marks a |
|00005150| 73 79 6d 62 6f 6c 20 61 | 73 20 61 6e 20 65 2e 63 |symbol a|s an e.c|
|00005160| 2e 20 72 65 70 72 65 73 | 65 6e 74 61 74 69 76 65 |. repres|entative|
|00005170| 20 2a 2f 0a 58 23 64 65 | 66 69 6e 65 20 49 4e 46 | */.X#de|fine INF|
|00005180| 49 4e 49 54 59 20 2d 31 | 09 2f 2a 20 66 6f 72 20 |INITY -1|./* for |
|00005190| 78 7b 35 2c 7d 20 63 6f | 6e 73 74 72 75 63 74 69 |x{5,} co|nstructi|
|000051a0| 6f 6e 73 20 2a 2f 0a 58 | 0a 58 2f 2a 20 73 69 7a |ons */.X|.X/* siz|
|000051b0| 65 20 6f 66 20 69 6e 70 | 75 74 20 61 6c 70 68 61 |e of inp|ut alpha|
|000051c0| 62 65 74 20 2d 20 73 68 | 6f 75 6c 64 20 62 65 20 |bet - sh|ould be |
|000051d0| 73 69 7a 65 20 6f 66 20 | 41 53 43 49 49 20 73 65 |size of |ASCII se|
|000051e0| 74 20 2a 2f 0a 58 23 64 | 65 66 69 6e 65 20 43 53 |t */.X#d|efine CS|
|000051f0| 49 5a 45 20 31 32 37 0a | 58 0a 58 23 64 65 66 69 |IZE 127.|X.X#defi|
|00005200| 6e 65 20 49 4e 49 54 49 | 41 4c 5f 4d 41 58 43 43 |ne INITI|AL_MAXCC|
|00005210| 4c 53 20 31 30 30 09 2f | 2a 20 6d 61 78 20 6e 75 |LS 100./|* max nu|
|00005220| 6d 62 65 72 20 6f 66 20 | 75 6e 69 71 75 65 20 63 |mber of |unique c|
|00005230| 68 61 72 61 63 74 65 72 | 20 63 6c 61 73 73 65 73 |haracter| classes|
|00005240| 20 2a 2f 0a 58 23 64 65 | 66 69 6e 65 20 4d 41 58 | */.X#de|fine MAX|
|00005250| 43 43 4c 53 5f 49 4e 43 | 52 45 4d 45 4e 54 20 31 |CCLS_INC|REMENT 1|
|00005260| 30 30 0a 58 0a 58 2f 2a | 20 73 69 7a 65 20 6f 66 |00.X.X/*| size of|
|00005270| 20 74 61 62 6c 65 20 68 | 6f 6c 64 69 6e 67 20 6d | table h|olding m|
|00005280| 65 6d 62 65 72 73 20 6f | 66 20 63 68 61 72 61 63 |embers o|f charac|
|00005290| 74 65 72 20 63 6c 61 73 | 73 65 73 20 2a 2f 0a 58 |ter clas|ses */.X|
|000052a0| 23 64 65 66 69 6e 65 20 | 49 4e 49 54 49 41 4c 5f |#define |INITIAL_|
|000052b0| 4d 41 58 5f 43 43 4c 5f | 54 42 4c 5f 53 49 5a 45 |MAX_CCL_|TBL_SIZE|
|000052c0| 20 35 30 30 0a 58 23 64 | 65 66 69 6e 65 20 4d 41 | 500.X#d|efine MA|
|000052d0| 58 5f 43 43 4c 5f 54 42 | 4c 5f 53 49 5a 45 5f 49 |X_CCL_TB|L_SIZE_I|
|000052e0| 4e 43 52 45 4d 45 4e 54 | 20 32 35 30 0a 58 0a 58 |NCREMENT| 250.X.X|
|000052f0| 23 64 65 66 69 6e 65 20 | 49 4e 49 54 49 41 4c 5f |#define |INITIAL_|
|00005300| 4d 4e 53 20 32 30 30 30 | 09 2f 2a 20 64 65 66 61 |MNS 2000|./* defa|
|00005310| 75 6c 74 20 6d 61 78 69 | 6d 75 6d 20 6e 75 6d 62 |ult maxi|mum numb|
|00005320| 65 72 20 6f 66 20 6e 66 | 61 20 73 74 61 74 65 73 |er of nf|a states|
|00005330| 20 2a 2f 0a 58 23 64 65 | 66 69 6e 65 20 4d 4e 53 | */.X#de|fine MNS|
|00005340| 5f 49 4e 43 52 45 4d 45 | 4e 54 20 31 30 30 30 09 |_INCREME|NT 1000.|
|00005350| 2f 2a 20 61 6d 6f 75 6e | 74 20 74 6f 20 62 75 6d |/* amoun|t to bum|
|00005360| 70 20 61 62 6f 76 65 20 | 62 79 20 69 66 20 69 74 |p above |by if it|
|00005370| 27 73 20 6e 6f 74 20 65 | 6e 6f 75 67 68 20 2a 2f |'s not e|nough */|
|00005380| 0a 58 0a 58 23 64 65 66 | 69 6e 65 20 49 4e 49 54 |.X.X#def|ine INIT|
|00005390| 49 41 4c 5f 4d 41 58 5f | 44 46 41 53 20 31 30 30 |IAL_MAX_|DFAS 100|
|000053a0| 30 09 2f 2a 20 64 65 66 | 61 75 6c 74 20 6d 61 78 |0./* def|ault max|
|000053b0| 69 6d 75 6d 20 6e 75 6d | 62 65 72 20 6f 66 20 64 |imum num|ber of d|
|000053c0| 66 61 20 73 74 61 74 65 | 73 20 2a 2f 0a 58 23 64 |fa state|s */.X#d|
|000053d0| 65 66 69 6e 65 20 4d 41 | 58 5f 44 46 41 53 5f 49 |efine MA|X_DFAS_I|
|000053e0| 4e 43 52 45 4d 45 4e 54 | 20 31 30 30 30 0a 58 0a |NCREMENT| 1000.X.|
|000053f0| 58 23 64 65 66 69 6e 65 | 20 4a 41 4d 53 54 41 54 |X#define| JAMSTAT|
|00005400| 45 20 2d 33 32 37 36 36 | 09 2f 2a 20 6d 61 72 6b |E -32766|./* mark|
|00005410| 73 20 61 20 72 65 66 65 | 72 65 6e 63 65 20 74 6f |s a refe|rence to|
|00005420| 20 74 68 65 20 73 74 61 | 74 65 20 74 68 61 74 20 | the sta|te that |
|00005430| 61 6c 77 61 79 73 20 6a | 61 6d 73 20 2a 2f 0a 58 |always j|ams */.X|
|00005440| 0a 58 2f 2a 20 65 6e 6f | 75 67 68 20 73 6f 20 74 |.X/* eno|ugh so t|
|00005450| 68 61 74 20 69 66 20 69 | 74 27 73 20 73 75 62 74 |hat if i|t's subt|
|00005460| 72 61 63 74 65 64 20 66 | 72 6f 6d 20 61 6e 20 4e |racted f|rom an N|
|00005470| 46 41 20 73 74 61 74 65 | 20 6e 75 6d 62 65 72 2c |FA state| number,|
|00005480| 20 74 68 65 20 72 65 73 | 75 6c 74 0a 58 20 2a 20 | the res|ult.X * |
|00005490| 69 73 20 67 75 61 72 61 | 6e 74 65 65 64 20 74 6f |is guara|nteed to|
|000054a0| 20 62 65 20 6e 65 67 61 | 74 69 76 65 0a 58 20 2a | be nega|tive.X *|
|000054b0| 2f 0a 58 23 64 65 66 69 | 6e 65 20 4d 41 52 4b 45 |/.X#defi|ne MARKE|
|000054c0| 52 5f 44 49 46 46 45 52 | 45 4e 43 45 20 33 32 30 |R_DIFFER|ENCE 320|
|000054d0| 30 30 0a 58 23 64 65 66 | 69 6e 65 20 4d 41 58 49 |00.X#def|ine MAXI|
|000054e0| 4d 55 4d 5f 4d 4e 53 20 | 33 31 39 39 39 0a 58 0a |MUM_MNS |31999.X.|
|000054f0| 58 2f 2a 20 6d 61 78 69 | 6d 75 6d 20 6e 75 6d 62 |X/* maxi|mum numb|
|00005500| 65 72 20 6f 66 20 6e 78 | 74 2f 63 68 6b 20 70 61 |er of nx|t/chk pa|
|00005510| 69 72 73 20 66 6f 72 20 | 6e 6f 6e 2d 74 65 6d 70 |irs for |non-temp|
|00005520| 6c 61 74 65 73 20 2a 2f | 0a 58 23 64 65 66 69 6e |lates */|.X#defin|
|00005530| 65 20 49 4e 49 54 49 41 | 4c 5f 4d 41 58 5f 58 50 |e INITIA|L_MAX_XP|
|00005540| 41 49 52 53 20 32 30 30 | 30 0a 58 23 64 65 66 69 |AIRS 200|0.X#defi|
|00005550| 6e 65 20 4d 41 58 5f 58 | 50 41 49 52 53 5f 49 4e |ne MAX_X|PAIRS_IN|
|00005560| 43 52 45 4d 45 4e 54 20 | 32 30 30 30 0a 58 0a 58 |CREMENT |2000.X.X|
|00005570| 2f 2a 20 6d 61 78 69 6d | 75 6d 20 6e 75 6d 62 65 |/* maxim|um numbe|
|00005580| 72 20 6f 66 20 6e 78 74 | 2f 63 68 6b 20 70 61 69 |r of nxt|/chk pai|
|00005590| 72 73 20 6e 65 65 64 65 | 64 20 66 6f 72 20 74 65 |rs neede|d for te|
|000055a0| 6d 70 6c 61 74 65 73 20 | 2a 2f 0a 58 23 64 65 66 |mplates |*/.X#def|
|000055b0| 69 6e 65 20 49 4e 49 54 | 49 41 4c 5f 4d 41 58 5f |ine INIT|IAL_MAX_|
|000055c0| 54 45 4d 50 4c 41 54 45 | 5f 58 50 41 49 52 53 20 |TEMPLATE|_XPAIRS |
|000055d0| 32 35 30 30 0a 58 23 64 | 65 66 69 6e 65 20 4d 41 |2500.X#d|efine MA|
|000055e0| 58 5f 54 45 4d 50 4c 41 | 54 45 5f 58 50 41 49 52 |X_TEMPLA|TE_XPAIR|
|000055f0| 53 5f 49 4e 43 52 45 4d | 45 4e 54 20 32 35 30 30 |S_INCREM|ENT 2500|
|00005600| 0a 58 0a 58 23 64 65 66 | 69 6e 65 20 53 59 4d 5f |.X.X#def|ine SYM_|
|00005610| 45 50 53 49 4c 4f 4e 20 | 30 09 2f 2a 20 74 6f 20 |EPSILON |0./* to |
|00005620| 6d 61 72 6b 20 74 72 61 | 6e 73 69 74 69 6f 6e 73 |mark tra|nsitions|
|00005630| 20 6f 6e 20 74 68 65 20 | 73 79 6d 62 6f 6c 20 65 | on the |symbol e|
|00005640| 70 73 69 6c 6f 6e 20 2a | 2f 0a 58 0a 58 23 64 65 |psilon *|/.X.X#de|
|00005650| 66 69 6e 65 20 49 4e 49 | 54 49 41 4c 5f 4d 41 58 |fine INI|TIAL_MAX|
|00005660| 5f 53 43 53 20 34 30 09 | 2f 2a 20 6d 61 78 69 6d |_SCS 40.|/* maxim|
|00005670| 75 6d 20 6e 75 6d 62 65 | 72 20 6f 66 20 73 74 61 |um numbe|r of sta|
|00005680| 72 74 20 63 6f 6e 64 69 | 74 69 6f 6e 73 20 2a 2f |rt condi|tions */|
|00005690| 0a 58 23 64 65 66 69 6e | 65 20 4d 41 58 5f 53 43 |.X#defin|e MAX_SC|
|000056a0| 53 5f 49 4e 43 52 45 4d | 45 4e 54 20 34 30 09 2f |S_INCREM|ENT 40./|
|000056b0| 2a 20 61 6d 6f 75 6e 74 | 20 74 6f 20 62 75 6d 70 |* amount| to bump|
|000056c0| 20 62 79 20 69 66 20 69 | 74 27 73 20 6e 6f 74 20 | by if i|t's not |
|000056d0| 65 6e 6f 75 67 68 20 2a | 2f 0a 58 0a 58 23 64 65 |enough *|/.X.X#de|
|000056e0| 66 69 6e 65 20 4f 4e 45 | 5f 53 54 41 43 4b 5f 53 |fine ONE|_STACK_S|
|000056f0| 49 5a 45 20 35 30 30 09 | 2f 2a 20 73 74 61 63 6b |IZE 500.|/* stack|
|00005700| 20 6f 66 20 73 74 61 74 | 65 73 20 77 69 74 68 20 | of stat|es with |
|00005710| 6f 6e 6c 79 20 6f 6e 65 | 20 6f 75 74 2d 74 72 61 |only one| out-tra|
|00005720| 6e 73 69 74 69 6f 6e 20 | 2a 2f 0a 58 23 64 65 66 |nsition |*/.X#def|
|00005730| 69 6e 65 20 53 41 4d 45 | 5f 54 52 41 4e 53 20 2d |ine SAME|_TRANS -|
|00005740| 31 09 2f 2a 20 74 72 61 | 6e 73 69 74 69 6f 6e 20 |1./* tra|nsition |
|00005750| 69 73 20 74 68 65 20 73 | 61 6d 65 20 61 73 20 22 |is the s|ame as "|
|00005760| 64 65 66 61 75 6c 74 22 | 20 65 6e 74 72 79 20 66 |default"| entry f|
|00005770| 6f 72 20 73 74 61 74 65 | 20 2a 2f 0a 58 0a 58 2f |or state| */.X.X/|
|00005780| 2a 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |* the fo|llowing |
|00005790| 70 65 72 63 65 6e 74 61 | 67 65 73 20 61 72 65 20 |percenta|ges are |
|000057a0| 75 73 65 64 20 74 6f 20 | 74 75 6e 65 20 74 61 62 |used to |tune tab|
|000057b0| 6c 65 20 63 6f 6d 70 72 | 65 73 73 69 6f 6e 3a 0a |le compr|ession:.|
|000057c0| 58 0a 58 20 2a 20 74 68 | 65 20 70 65 72 63 65 6e |X.X * th|e percen|
|000057d0| 74 61 67 65 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |tage the| number |
|000057e0| 6f 66 20 6f 75 74 2d 74 | 72 61 6e 73 69 74 69 6f |of out-t|ransitio|
|000057f0| 6e 73 20 61 20 73 74 61 | 74 65 20 6d 75 73 74 20 |ns a sta|te must |
|00005800| 62 65 20 6f 66 20 74 68 | 65 0a 58 20 2a 20 6e 75 |be of th|e.X * nu|
|00005810| 6d 62 65 72 20 6f 66 20 | 65 71 75 69 76 61 6c 65 |mber of |equivale|
|00005820| 6e 63 65 20 63 6c 61 73 | 73 65 73 20 69 6e 20 6f |nce clas|ses in o|
|00005830| 72 64 65 72 20 74 6f 20 | 62 65 20 63 6f 6e 73 69 |rder to |be consi|
|00005840| 64 65 72 65 64 20 66 6f | 72 20 74 61 62 6c 65 0a |dered fo|r table.|
|00005850| 58 20 2a 20 63 6f 6d 70 | 61 63 74 69 6f 6e 20 62 |X * comp|action b|
|00005860| 79 20 75 73 69 6e 67 20 | 70 72 6f 74 6f 73 0a 58 |y using |protos.X|
|00005870| 20 2a 2f 0a 58 23 64 65 | 66 69 6e 65 20 50 52 4f | */.X#de|fine PRO|
|00005880| 54 4f 5f 53 49 5a 45 5f | 50 45 52 43 45 4e 54 41 |TO_SIZE_|PERCENTA|
|00005890| 47 45 20 31 35 0a 58 0a | 58 2f 2a 20 74 68 65 20 |GE 15.X.|X/* the |
|000058a0| 70 65 72 63 65 6e 74 61 | 67 65 20 74 68 65 20 6e |percenta|ge the n|
|000058b0| 75 6d 62 65 72 20 6f 66 | 20 68 6f 6d 6f 67 65 6e |umber of| homogen|
|000058c0| 65 6f 75 73 20 6f 75 74 | 2d 74 72 61 6e 73 69 74 |eous out|-transit|
|000058d0| 69 6f 6e 73 20 6f 66 20 | 61 20 73 74 61 74 65 0a |ions of |a state.|
|000058e0| 58 20 2a 20 6d 75 73 74 | 20 62 65 20 6f 66 20 74 |X * must| be of t|
|000058f0| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 74 6f 74 |he numbe|r of tot|
|00005900| 61 6c 20 6f 75 74 2d 74 | 72 61 6e 73 69 74 69 6f |al out-t|ransitio|
|00005910| 6e 73 20 6f 66 20 74 68 | 65 20 73 74 61 74 65 20 |ns of th|e state |
|00005920| 69 6e 20 6f 72 64 65 72 | 0a 58 20 2a 20 74 68 61 |in order|.X * tha|
|00005930| 74 20 74 68 65 20 73 74 | 61 74 65 27 73 20 74 72 |t the st|ate's tr|
|00005940| 61 6e 73 69 74 69 6f 6e | 20 74 61 62 6c 65 20 69 |ansition| table i|
|00005950| 73 20 66 69 72 73 74 20 | 63 6f 6d 70 61 72 65 64 |s first |compared|
|00005960| 20 77 69 74 68 20 61 20 | 70 6f 74 65 6e 74 69 61 | with a |potentia|
|00005970| 6c 20 0a 58 20 2a 20 74 | 65 6d 70 6c 61 74 65 20 |l .X * t|emplate |
|00005980| 6f 66 20 74 68 65 20 6d | 6f 73 74 20 63 6f 6d 6d |of the m|ost comm|
|00005990| 6f 6e 20 6f 75 74 2d 74 | 72 61 6e 73 69 74 69 6f |on out-t|ransitio|
|000059a0| 6e 20 69 6e 73 74 65 61 | 64 20 6f 66 20 77 69 74 |n instea|d of wit|
|000059b0| 68 20 74 68 65 20 66 69 | 72 73 74 0a 58 20 2a 20 |h the fi|rst.X * |
|000059c0| 70 72 6f 74 6f 20 69 6e | 20 74 68 65 20 70 72 6f |proto in| the pro|
|000059d0| 74 6f 20 71 75 65 75 65 | 0a 58 20 2a 2f 0a 58 23 |to queue|.X */.X#|
|000059e0| 64 65 66 69 6e 65 20 43 | 48 45 43 4b 5f 43 4f 4d |define C|HECK_COM|
|000059f0| 5f 50 45 52 43 45 4e 54 | 41 47 45 20 35 30 0a 58 |_PERCENT|AGE 50.X|
|00005a00| 0a 58 2f 2a 20 74 68 65 | 20 70 65 72 63 65 6e 74 |.X/* the| percent|
|00005a10| 61 67 65 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f |age the |number o|
|00005a20| 66 20 64 69 66 66 65 72 | 65 6e 63 65 73 20 62 65 |f differ|ences be|
|00005a30| 74 77 65 65 6e 20 61 20 | 73 74 61 74 65 27 73 20 |tween a |state's |
|00005a40| 74 72 61 6e 73 69 74 69 | 6f 6e 0a 58 20 2a 20 74 |transiti|on.X * t|
|00005a50| 61 62 6c 65 20 61 6e 64 | 20 74 68 65 20 70 72 6f |able and| the pro|
|00005a60| 74 6f 20 69 74 20 77 61 | 73 20 66 69 72 73 74 20 |to it wa|s first |
|00005a70| 63 6f 6d 70 61 72 65 64 | 20 77 69 74 68 20 6d 75 |compared| with mu|
|00005a80| 73 74 20 62 65 20 6f 66 | 20 74 68 65 20 74 6f 74 |st be of| the tot|
|00005a90| 61 6c 0a 58 20 2a 20 6e | 75 6d 62 65 72 20 6f 66 |al.X * n|umber of|
|00005aa0| 20 6f 75 74 2d 74 72 61 | 6e 73 69 74 69 6f 6e 73 | out-tra|nsitions|
|00005ab0| 20 6f 66 20 74 68 65 20 | 73 74 61 74 65 20 69 6e | of the |state in|
|00005ac0| 20 6f 72 64 65 72 20 74 | 6f 20 6b 65 65 70 20 74 | order t|o keep t|
|00005ad0| 68 65 20 66 69 72 73 74 | 0a 58 20 2a 20 70 72 6f |he first|.X * pro|
|00005ae0| 74 6f 20 61 73 20 61 20 | 67 6f 6f 64 20 6d 61 74 |to as a |good mat|
|00005af0| 63 68 20 61 6e 64 20 6e | 6f 74 20 73 65 61 72 63 |ch and n|ot searc|
|00005b00| 68 20 61 6e 79 20 66 75 | 72 74 68 65 72 0a 58 20 |h any fu|rther.X |
|00005b10| 2a 2f 0a 58 23 64 65 66 | 69 6e 65 20 46 49 52 53 |*/.X#def|ine FIRS|
|00005b20| 54 5f 4d 41 54 43 48 5f | 44 49 46 46 5f 50 45 52 |T_MATCH_|DIFF_PER|
|00005b30| 43 45 4e 54 41 47 45 20 | 31 30 0a 58 0a 58 2f 2a |CENTAGE |10.X.X/*|
|00005b40| 20 74 68 65 20 70 65 72 | 63 65 6e 74 61 67 65 20 | the per|centage |
|00005b50| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 64 69 |the numb|er of di|
|00005b60| 66 66 65 72 65 6e 63 65 | 73 20 62 65 74 77 65 65 |fference|s betwee|
|00005b70| 6e 20 61 20 73 74 61 74 | 65 27 73 20 74 72 61 6e |n a stat|e's tran|
|00005b80| 73 69 74 69 6f 6e 0a 58 | 20 2a 20 74 61 62 6c 65 |sition.X| * table|
|00005b90| 20 61 6e 64 20 74 68 65 | 20 6d 6f 73 74 20 73 69 | and the| most si|
|00005ba0| 6d 69 6c 61 72 20 70 72 | 6f 74 6f 20 6d 75 73 74 |milar pr|oto must|
|00005bb0| 20 62 65 20 6f 66 20 74 | 68 65 20 73 74 61 74 65 | be of t|he state|
|00005bc0| 27 73 20 74 6f 74 61 6c | 20 6e 75 6d 62 65 72 0a |'s total| number.|
|00005bd0| 58 20 2a 20 6f 66 20 6f | 75 74 2d 74 72 61 6e 73 |X * of o|ut-trans|
|00005be0| 69 74 69 6f 6e 73 20 74 | 6f 20 75 73 65 20 74 68 |itions t|o use th|
|00005bf0| 65 20 70 72 6f 74 6f 20 | 61 73 20 61 6e 20 61 63 |e proto |as an ac|
|00005c00| 63 65 70 74 61 62 6c 65 | 20 63 6c 6f 73 65 20 6d |ceptable| close m|
|00005c10| 61 74 63 68 0a 58 20 2a | 2f 0a 58 23 64 65 66 69 |atch.X *|/.X#defi|
|00005c20| 6e 65 20 41 43 43 45 50 | 54 41 42 4c 45 5f 44 49 |ne ACCEP|TABLE_DI|
|00005c30| 46 46 5f 50 45 52 43 45 | 4e 54 41 47 45 20 35 30 |FF_PERCE|NTAGE 50|
|00005c40| 0a 58 0a 58 2f 2a 20 74 | 68 65 20 70 65 72 63 65 |.X.X/* t|he perce|
|00005c50| 6e 74 61 67 65 20 74 68 | 65 20 6e 75 6d 62 65 72 |ntage th|e number|
|00005c60| 20 6f 66 20 68 6f 6d 6f | 67 65 6e 65 6f 75 73 20 | of homo|geneous |
|00005c70| 6f 75 74 2d 74 72 61 6e | 73 69 74 69 6f 6e 73 20 |out-tran|sitions |
|00005c80| 6f 66 20 61 20 73 74 61 | 74 65 0a 58 20 2a 20 6d |of a sta|te.X * m|
|00005c90| 75 73 74 20 62 65 20 6f | 66 20 74 68 65 20 6e 75 |ust be o|f the nu|
|00005ca0| 6d 62 65 72 20 6f 66 20 | 74 6f 74 61 6c 20 6f 75 |mber of |total ou|
|00005cb0| 74 2d 74 72 61 6e 73 69 | 74 69 6f 6e 73 20 6f 66 |t-transi|tions of|
|00005cc0| 20 74 68 65 20 73 74 61 | 74 65 20 69 6e 20 6f 72 | the sta|te in or|
|00005cd0| 64 65 72 0a 58 20 2a 20 | 74 6f 20 63 6f 6e 73 69 |der.X * |to consi|
|00005ce0| 64 65 72 20 6d 61 6b 69 | 6e 67 20 61 20 74 65 6d |der maki|ng a tem|
|00005cf0| 70 6c 61 74 65 20 66 72 | 6f 6d 20 74 68 65 20 73 |plate fr|om the s|
|00005d00| 74 61 74 65 0a 58 20 2a | 2f 0a 58 23 64 65 66 69 |tate.X *|/.X#defi|
|00005d10| 6e 65 20 54 45 4d 50 4c | 41 54 45 5f 53 41 4d 45 |ne TEMPL|ATE_SAME|
|00005d20| 5f 50 45 52 43 45 4e 54 | 41 47 45 20 36 30 0a 58 |_PERCENT|AGE 60.X|
|00005d30| 0a 58 2f 2a 20 74 68 65 | 20 70 65 72 63 65 6e 74 |.X/* the| percent|
|00005d40| 61 67 65 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f |age the |number o|
|00005d50| 66 20 64 69 66 66 65 72 | 65 6e 63 65 73 20 62 65 |f differ|ences be|
|00005d60| 74 77 65 65 6e 20 61 20 | 73 74 61 74 65 27 73 20 |tween a |state's |
|00005d70| 74 72 61 6e 73 69 74 69 | 6f 6e 0a 58 20 2a 20 74 |transiti|on.X * t|
|00005d80| 61 62 6c 65 20 61 6e 64 | 20 74 68 65 20 6d 6f 73 |able and| the mos|
|00005d90| 74 20 73 69 6d 69 6c 61 | 72 20 70 72 6f 74 6f 20 |t simila|r proto |
|00005da0| 6d 75 73 74 20 62 65 20 | 6f 66 20 74 68 65 20 73 |must be |of the s|
|00005db0| 74 61 74 65 27 73 20 74 | 6f 74 61 6c 20 6e 75 6d |tate's t|otal num|
|00005dc0| 62 65 72 0a 58 20 2a 20 | 6f 66 20 6f 75 74 2d 74 |ber.X * |of out-t|
|00005dd0| 72 61 6e 73 69 74 69 6f | 6e 73 20 74 6f 20 63 72 |ransitio|ns to cr|
|00005de0| 65 61 74 65 20 61 20 6e | 65 77 20 70 72 6f 74 6f |eate a n|ew proto|
|00005df0| 20 66 72 6f 6d 20 74 68 | 65 20 73 74 61 74 65 0a | from th|e state.|
|00005e00| 58 20 2a 2f 0a 58 23 64 | 65 66 69 6e 65 20 4e 45 |X */.X#d|efine NE|
|00005e10| 57 5f 50 52 4f 54 4f 5f | 44 49 46 46 5f 50 45 52 |W_PROTO_|DIFF_PER|
|00005e20| 43 45 4e 54 41 47 45 20 | 32 30 0a 58 0a 58 2f 2a |CENTAGE |20.X.X/*|
|00005e30| 20 74 68 65 20 70 65 72 | 63 65 6e 74 61 67 65 20 | the per|centage |
|00005e40| 74 68 65 20 74 6f 74 61 | 6c 20 6e 75 6d 62 65 72 |the tota|l number|
|00005e50| 20 6f 66 20 6f 75 74 2d | 74 72 61 6e 73 69 74 69 | of out-|transiti|
|00005e60| 6f 6e 73 20 6f 66 20 61 | 20 73 74 61 74 65 20 6d |ons of a| state m|
|00005e70| 75 73 74 20 62 65 0a 58 | 20 2a 20 6f 66 20 74 68 |ust be.X| * of th|
|00005e80| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 65 71 75 69 |e number| of equi|
|00005e90| 76 61 6c 65 6e 63 65 20 | 63 6c 61 73 73 65 73 20 |valence |classes |
|00005ea0| 69 6e 20 6f 72 64 65 72 | 20 74 6f 20 63 6f 6e 73 |in order| to cons|
|00005eb0| 69 64 65 72 20 74 72 79 | 69 6e 67 20 74 6f 0a 58 |ider try|ing to.X|
|00005ec0| 20 2a 20 66 69 74 20 74 | 68 65 20 74 72 61 6e 73 | * fit t|he trans|
|00005ed0| 69 74 69 6f 6e 20 74 61 | 62 6c 65 20 69 6e 74 6f |ition ta|ble into|
|00005ee0| 20 22 68 6f 6c 65 73 22 | 20 69 6e 73 69 64 65 20 | "holes"| inside |
|00005ef0| 74 68 65 20 6e 78 74 2f | 63 68 6b 20 74 61 62 6c |the nxt/|chk tabl|
|00005f00| 65 2e 0a 58 20 2a 2f 0a | 58 23 64 65 66 69 6e 65 |e..X */.|X#define|
|00005f10| 20 49 4e 54 45 52 49 4f | 52 5f 46 49 54 5f 50 45 | INTERIO|R_FIT_PE|
|00005f20| 52 43 45 4e 54 41 47 45 | 20 31 35 0a 58 0a 58 2f |RCENTAGE| 15.X.X/|
|00005f30| 2a 20 73 69 7a 65 20 6f | 66 20 72 65 67 69 6f 6e |* size o|f region|
|00005f40| 20 73 65 74 20 61 73 69 | 64 65 20 74 6f 20 63 61 | set asi|de to ca|
|00005f50| 63 68 65 20 74 68 65 20 | 63 6f 6d 70 6c 65 74 65 |che the |complete|
|00005f60| 20 74 72 61 6e 73 69 74 | 69 6f 6e 20 74 61 62 6c | transit|ion tabl|
|00005f70| 65 20 6f 66 0a 58 20 2a | 20 70 72 6f 74 6f 73 20 |e of.X *| protos |
|00005f80| 6f 6e 20 74 68 65 20 70 | 72 6f 74 6f 20 71 75 65 |on the p|roto que|
|00005f90| 75 65 20 74 6f 20 65 6e | 61 62 6c 65 20 71 75 69 |ue to en|able qui|
|00005fa0| 63 6b 20 63 6f 6d 70 61 | 72 69 73 6f 6e 73 0a 58 |ck compa|risons.X|
|00005fb0| 20 2a 2f 0a 58 23 64 65 | 66 69 6e 65 20 50 52 4f | */.X#de|fine PRO|
|00005fc0| 54 5f 53 41 56 45 5f 53 | 49 5a 45 20 32 30 30 30 |T_SAVE_S|IZE 2000|
|00005fd0| 0a 58 0a 58 23 64 65 66 | 69 6e 65 20 4d 53 50 20 |.X.X#def|ine MSP |
|00005fe0| 35 30 09 2f 2a 20 6d 61 | 78 69 6d 75 6d 20 6e 75 |50./* ma|ximum nu|
|00005ff0| 6d 62 65 72 20 6f 66 20 | 73 61 76 65 64 20 70 72 |mber of |saved pr|
|00006000| 6f 74 6f 73 20 28 70 72 | 6f 74 6f 73 20 6f 6e 20 |otos (pr|otos on |
|00006010| 74 68 65 20 70 72 6f 74 | 6f 20 71 75 65 75 65 29 |the prot|o queue)|
|00006020| 20 2a 2f 0a 58 0a 58 2f | 2a 20 6d 61 78 69 6d 75 | */.X.X/|* maximu|
|00006030| 6d 20 6e 75 6d 62 65 72 | 20 6f 66 20 6f 75 74 2d |m number| of out-|
|00006040| 74 72 61 6e 73 69 74 69 | 6f 6e 73 20 61 20 73 74 |transiti|ons a st|
|00006050| 61 74 65 20 63 61 6e 20 | 68 61 76 65 20 74 68 61 |ate can |have tha|
|00006060| 74 20 77 65 27 6c 6c 20 | 72 75 6d 6d 61 67 65 0a |t we'll |rummage.|
|00006070| 58 20 2a 20 61 72 6f 75 | 6e 64 20 74 68 72 6f 75 |X * arou|nd throu|
|00006080| 67 68 20 74 68 65 20 69 | 6e 74 65 72 69 6f 72 20 |gh the i|nterior |
|00006090| 6f 66 20 74 68 65 20 69 | 6e 74 65 72 6e 61 6c 20 |of the i|nternal |
|000060a0| 66 61 73 74 20 74 61 62 | 6c 65 20 6c 6f 6f 6b 69 |fast tab|le looki|
|000060b0| 6e 67 20 66 6f 72 20 61 | 0a 58 20 2a 20 73 70 6f |ng for a|.X * spo|
|000060c0| 74 20 66 6f 72 20 69 74 | 0a 58 20 2a 2f 0a 58 23 |t for it|.X */.X#|
|000060d0| 64 65 66 69 6e 65 20 4d | 41 58 5f 58 54 49 4f 4e |define M|AX_XTION|
|000060e0| 53 5f 46 4f 52 5f 46 55 | 4c 4c 5f 49 4e 54 45 52 |S_FOR_FU|LL_INTER|
|000060f0| 49 4f 52 5f 46 49 54 20 | 34 0a 58 0a 58 2f 2a 20 |IOR_FIT |4.X.X/* |
|00006100| 6e 75 6d 62 65 72 20 74 | 68 61 74 2c 20 69 66 20 |number t|hat, if |
|00006110| 75 73 65 64 20 74 6f 20 | 73 75 62 73 63 72 69 70 |used to |subscrip|
|00006120| 74 20 61 6e 20 61 72 72 | 61 79 2c 20 68 61 73 20 |t an arr|ay, has |
|00006130| 61 20 67 6f 6f 64 20 63 | 68 61 6e 63 65 20 6f 66 |a good c|hance of|
|00006140| 20 70 72 6f 64 75 63 69 | 6e 67 0a 58 20 2a 20 61 | produci|ng.X * a|
|00006150| 6e 20 65 72 72 6f 72 3b | 20 73 68 6f 75 6c 64 20 |n error;| should |
|00006160| 62 65 20 73 6d 61 6c 6c | 20 65 6e 6f 75 67 68 20 |be small| enough |
|00006170| 74 6f 20 66 69 74 20 69 | 6e 74 6f 20 61 20 73 68 |to fit i|nto a sh|
|00006180| 6f 72 74 0a 58 20 2a 2f | 0a 58 23 64 65 66 69 6e |ort.X */|.X#defin|
|00006190| 65 20 42 41 44 5f 53 55 | 42 53 43 52 49 50 54 20 |e BAD_SU|BSCRIPT |
|000061a0| 2d 33 32 37 36 37 0a 58 | 0a 58 2f 2a 20 61 62 73 |-32767.X|.X/* abs|
|000061b0| 6f 6c 75 74 65 20 76 61 | 6c 75 65 20 6f 66 20 6c |olute va|lue of l|
|000061c0| 61 72 67 65 73 74 20 6e | 75 6d 62 65 72 20 74 68 |argest n|umber th|
|000061d0| 61 74 20 63 61 6e 20 62 | 65 20 73 74 6f 72 65 64 |at can b|e stored|
|000061e0| 20 69 6e 20 61 20 73 68 | 6f 72 74 2c 20 77 69 74 | in a sh|ort, wit|
|000061f0| 68 20 61 0a 58 20 2a 20 | 62 69 74 20 6f 66 20 73 |h a.X * |bit of s|
|00006200| 6c 6f 70 20 74 68 72 6f | 77 6e 20 69 6e 20 66 6f |lop thro|wn in fo|
|00006210| 72 20 67 65 6e 65 72 61 | 6c 20 70 61 72 61 6e 6f |r genera|l parano|
|00006220| 69 61 2e 0a 58 20 2a 2f | 0a 58 23 64 65 66 69 6e |ia..X */|.X#defin|
|00006230| 65 20 4d 41 58 5f 53 48 | 4f 52 54 20 33 32 37 36 |e MAX_SH|ORT 3276|
|00006240| 36 0a 58 0a 58 0a 58 2f | 2a 20 44 65 63 6c 61 72 |6.X.X.X/|* Declar|
|00006250| 61 74 69 6f 6e 73 20 66 | 6f 72 20 67 6c 6f 62 61 |ations f|or globa|
|00006260| 6c 20 76 61 72 69 61 62 | 6c 65 73 2e 20 2a 2f 0a |l variab|les. */.|
|00006270| 58 0a 58 2f 2a 20 76 61 | 72 69 61 62 6c 65 73 20 |X.X/* va|riables |
|00006280| 66 6f 72 20 73 79 6d 62 | 6f 6c 20 74 61 62 6c 65 |for symb|ol table|
|00006290| 73 3a 0a 58 20 2a 20 73 | 63 74 62 6c 20 2d 20 73 |s:.X * s|ctbl - s|
|000062a0| 74 61 72 74 2d 63 6f 6e | 64 69 74 69 6f 6e 20 73 |tart-con|dition s|
|000062b0| 79 6d 62 6f 6c 20 74 61 | 62 6c 65 0a 58 20 2a 20 |ymbol ta|ble.X * |
|000062c0| 6e 64 74 62 6c 20 2d 20 | 6e 61 6d 65 2d 64 65 66 |ndtbl - |name-def|
|000062d0| 69 6e 69 74 69 6f 6e 20 | 73 79 6d 62 6f 6c 20 74 |inition |symbol t|
|000062e0| 61 62 6c 65 0a 58 20 2a | 20 63 63 6c 74 61 62 20 |able.X *| ccltab |
|000062f0| 2d 20 63 68 61 72 61 63 | 74 65 72 20 63 6c 61 73 |- charac|ter clas|
|00006300| 73 20 74 65 78 74 20 73 | 79 6d 62 6f 6c 20 74 61 |s text s|ymbol ta|
|00006310| 62 6c 65 0a 58 20 2a 2f | 0a 58 0a 73 74 72 75 63 |ble.X */|.X.struc|
|00006320| 74 20 68 61 73 68 5f 65 | 6e 74 72 79 0a 58 20 20 |t hash_e|ntry.X |
|00006330| 20 20 7b 0a 58 20 20 20 | 20 73 74 72 75 63 74 20 | {.X | struct |
|00006340| 68 61 73 68 5f 65 6e 74 | 72 79 20 2a 70 72 65 76 |hash_ent|ry *prev|
|00006350| 2c 20 2a 6e 65 78 74 3b | 0a 58 20 20 20 20 63 68 |, *next;|.X ch|
|00006360| 61 72 20 2a 6e 61 6d 65 | 3b 0a 58 20 20 20 20 63 |ar *name|;.X c|
|00006370| 68 61 72 20 2a 73 74 72 | 5f 76 61 6c 3b 0a 58 20 |har *str|_val;.X |
|00006380| 20 20 20 69 6e 74 20 69 | 6e 74 5f 76 61 6c 3b 0a | int i|nt_val;.|
|00006390| 58 20 20 20 20 7d 20 3b | 0a 58 0a 74 79 70 65 64 |X } ;|.X.typed|
|000063a0| 65 66 20 73 74 72 75 63 | 74 20 68 61 73 68 5f 65 |ef struc|t hash_e|
|000063b0| 6e 74 72 79 20 2a 68 61 | 73 68 5f 74 61 62 6c 65 |ntry *ha|sh_table|
|000063c0| 5b 5d 3b 0a 58 0a 58 23 | 64 65 66 69 6e 65 20 4e |[];.X.X#|define N|
|000063d0| 41 4d 45 5f 54 41 42 4c | 45 5f 48 41 53 48 5f 53 |AME_TABL|E_HASH_S|
|000063e0| 49 5a 45 20 31 30 31 0a | 58 23 64 65 66 69 6e 65 |IZE 101.|X#define|
|000063f0| 20 53 54 41 52 54 5f 43 | 4f 4e 44 5f 48 41 53 48 | START_C|OND_HASH|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.