Debian Codegraph @

lib/mlrisc-lib/MLRISC/Tools/Parser/mdl.lex.sml

raw
1 functor MDLLexFun(Tokens : MDL_TOKENS) = struct
2
3 structure yyInput : sig
4
5 type stream
6 val mkStream : (int -> string) -> stream
7 val fromStream : TextIO.StreamIO.instream -> stream
8 val getc : stream -> (Char.char * stream) option
9 val getpos : stream -> int
10 val getlineNo : stream -> int
11 val subtract : stream * stream -> string
12 val eof : stream -> bool
13 val lastWasNL : stream -> bool
14
15 end = struct
16
17 structure TIO = TextIO
18 structure TSIO = TIO.StreamIO
19 structure TPIO = TextPrimIO
20
21 datatype stream = Stream of {
22 strm : TSIO.instream,
23 id : int, (* track which streams originated
24 * from the same stream *)
25 pos : int,
26 lineNo : int,
27 lastWasNL : bool
28 }
29
30 local
31 val next = ref 0
32 in
33 fun nextId() = !next before (next := !next + 1)
34 end
35
36 val initPos = 2 (* ml-lex bug compatibility *)
37
38 fun mkStream inputN = let
39 val strm = TSIO.mkInstream
40 (TPIO.RD {
41 name = "lexgen",
42 chunkSize = 4096,
43 readVec = SOME inputN,
44 readArr = NONE,
45 readVecNB = NONE,
46 readArrNB = NONE,
47 block = NONE,
48 canInput = NONE,
49 avail = (fn () => NONE),
50 getPos = NONE,
51 setPos = NONE,
52 endPos = NONE,
53 verifyPos = NONE,
54 close = (fn () => ()),
55 ioDesc = NONE
56 }, "")
57 in
58 Stream {strm = strm, id = nextId(), pos = initPos, lineNo = 1,
59 lastWasNL = true}
60 end
61
62 fun fromStream strm = Stream {
63 strm = strm, id = nextId(), pos = initPos, lineNo = 1, lastWasNL = true
64 }
65
66 fun getc (Stream {strm, pos, id, lineNo, ...}) = (case TSIO.input1 strm
67 of NONE => NONE
68 | SOME (c, strm') =>
69 SOME (c, Stream {
70 strm = strm',
71 pos = pos+1,
72 id = id,
73 lineNo = lineNo +
74 (if c = #"\n" then 1 else 0),
75 lastWasNL = (c = #"\n")
76 })
77 (* end case*))
78
79 fun getpos (Stream {pos, ...}) = pos
80
81 fun getlineNo (Stream {lineNo, ...}) = lineNo
82
83 fun subtract (new, old) = let
84 val Stream {strm = strm, pos = oldPos, id = oldId, ...} = old
85 val Stream {pos = newPos, id = newId, ...} = new
86 val (diff, _) = if newId = oldId andalso newPos >= oldPos
87 then TSIO.inputN (strm, newPos - oldPos)
88 else raise Fail
89 "BUG: yyInput: attempted to subtract incompatible streams"
90 in
91 diff
92 end
93
94 fun eof (Stream {strm, ...}) = TSIO.endOfStream strm
95
96 fun lastWasNL (Stream {lastWasNL, ...}) = lastWasNL
97
98 end
99
100 datatype yystart_state =
101 ASM | COMMENT | ASMQUOTE | INITIAL
102 structure UserDeclarations =
103 struct
104
105 exception Error
106
107 type pos = int
108 type svalue = Tokens.svalue
109 type ('a,'b) token = ('a,'b) Tokens.token
110 type lexresult = (svalue,pos) token
111 type lexarg = {srcMap : SourceMapping.sourcemap,
112 err : pos * pos * string -> unit,
113 MDLmode : bool
114 }
115 type arg = lexarg
116
117 open Tokens
118
119 val commentLevel = ref 0
120 val metaLevel = ref 0
121
122 val asmLQuote = ref "``"
123 val asmRQuote = ref "''"
124 val asmLMeta = ref "<"
125 val asmRMeta = ref ">"
126
127 exception Error
128
129 fun init() = (commentLevel := 0; metaLevel := 0;
130 asmLQuote := "``"; asmRQuote := "''";
131 asmLMeta := "<"; asmRMeta := ">"
132 )
133
134 fun eof{srcMap,err,MDLmode} =
135 let val pos = SourceMapping.currPos srcMap
136 in EOF(pos,pos) end
137 fun debug _ = ()
138
139 fun check(err,_,_,SOME w) = w
140 | check(err,pos,s,NONE) =
141 (err(pos,pos+size s,"bad literal "^s); raise Error)
142
143 fun strip k s = String.substring(s,k,String.size s - k)
144 fun scan err fmt (s,s') tok pos =
145 tok(check(err,pos,s,StringCvt.scanString fmt s'),
146 pos,pos + size s)
147 handle _ => ID(s,pos,pos)
148
149 fun wdecimal(err,s,pos) =
150 scan err (Word32.scan StringCvt.DEC) (s,strip 2 s) WORD pos
151 fun whex(err,s,pos) =
152 scan err (Word32.scan StringCvt.HEX) (s,strip 3 s) WORD pos
153 fun woctal(err,s,pos) = scan err (Word32.scan StringCvt.OCT) (s,strip 3 s) WORD pos
154 fun wbinary(err,s,pos) = scan err (Word32.scan StringCvt.BIN) (s,strip 3 s) WORD pos
155 fun decimal(err,s,pos) = scan err (Int.scan StringCvt.DEC) (s,s) INT pos
156 fun real(err,s,pos) = scan err (Real.scan) (s,s)
157 (fn (x,y,z) => REAL(Real.toString x, y, z)) pos
158 fun hex(err,s,pos) = scan err (Int.scan StringCvt.HEX) (s,strip 2 s) INT pos
159 fun octal(err,s,pos) = scan err (Int.scan StringCvt.OCT) (s,strip 2 s) INT pos
160 fun binary(err,s,pos) = scan err (Int.scan StringCvt.BIN) (s,strip 2 s) INT pos
161
162 fun decimalinf(err,s,pos) = scan err (IntInf.scan StringCvt.DEC) (s,s) INTINF pos
163 fun hexinf(err,s,pos) = scan err (IntInf.scan StringCvt.HEX) (s,strip 2 s) INTINF pos
164 fun octalinf(err,s,pos) = scan err (IntInf.scan StringCvt.OCT) (s,strip 2 s) INTINF pos
165 fun binaryinf(err,s,pos) = scan err (IntInf.scan StringCvt.BIN) (s,strip 2 s) INTINF pos
166
167 fun string(err,s,pos) =
168 STRING(
169 check(err,pos,s,String.fromString(String.substring(s,1,String.size s-2))),
170 pos, pos + size s)
171 fun char(err,s,pos) =
172 CHAR(check(err,pos,s,Char.fromString(String.substring(s,2,String.size s-3))),
173 pos,pos + size s)
174 fun transAsm s =
175 let fun loop(#"\\" :: #"<" ::s) = #"<"::loop s
176 | loop(#"\\" :: #">" ::s) = #">"::loop s
177 | loop(c::s) = c::loop s
178 | loop [] = []
179 in String.implode(loop(String.explode s))
180 end
181
182 fun asmtext(err,s,pos) =
183 ASMTEXT(check(err,pos,s,String.fromString(transAsm s)),pos,pos + size s)
184
185 infix $$
186 fun x $$ y = y :: x
187
188 exception NotFound
189
190 val keywords = HashTable.mkTable (HashString.hashString,op =) (13,NotFound)
191 : (string,int * int -> (svalue,int) token) HashTable.hash_table
192 val MDLkeywords = HashTable.mkTable (HashString.hashString,op =) (13,NotFound)
193 : (string,int * int -> (svalue,int) token) HashTable.hash_table
194 val symbols = HashTable.mkTable (HashString.hashString,op =) (13,NotFound)
195 : (string,int * int -> (svalue,int) token) HashTable.hash_table
196
197 val _ = app (HashTable.insert keywords)
198 ( nil $$
199 ("_",WILD) $$
200 ("datatype", DATATYPE) $$
201 ("type", TYPE) $$
202 ("end", END) $$
203 ("fun", FUN) $$
204 ("fn", FN) $$
205 ("val", VAL) $$
206 ("raise", RAISE) $$
207 ("handle", HANDLE) $$
208 ("let", LET) $$
209 ("local", LOCAL) $$
210 ("exception", EXCEPTION) $$
211 ("structure", STRUCTURE) $$
212 ("signature", SIGNATURE) $$
213 ("functor", FUNCTOR) $$
214 ("sig", SIG) $$
215 ("struct", STRUCT) $$
216 ("sharing", SHARING) $$
217 ("where", WHERE) $$
218 ("withtype", WITHTYPE) $$
219 ("if", IF) $$
220 ("then", THEN) $$
221 ("else", ELSE) $$
222 ("in", IN) $$
223 ("true", TRUE) $$
224 ("false", FALSE) $$
225 ("and", AND) $$
226 ("at", AT) $$
227 ("of", OF) $$
228 ("case", CASE) $$
229 ("as", AS) $$
230 ("open", OPEN) $$
231 ("op", OP) $$
232 ("include", INCLUDE) $$
233 ("infix", INFIX) $$
234 ("infixr", INFIXR) $$
235 ("nonfix", NONFIX) $$
236 ("not", NOT)
237 )
238
239 val _ = app (HashTable.insert MDLkeywords)
240 ( nil $$
241 ("architecture", ARCHITECTURE) $$
242 ("assembly", ASSEMBLY) $$
243 ("storage", STORAGE) $$
244 ("locations", LOCATIONS) $$
245 ("equation", EQUATION) $$
246 ("at", AT) $$
247 ("vliw", VLIW) $$
248 ("field", FIELD) $$
249 ("fields", FIELDS) $$
250 ("signed", SIGNED) $$
251 ("unsigned", UNSIGNED) $$
252 ("superscalar", SUPERSCALAR) $$
253 ("bits", BITS) $$
254 ("ordering", ORDERING) $$
255 ("little", LITTLE) $$
256 ("big", BIG) $$
257 ("endian", ENDIAN) $$
258 ("register", REGISTER) $$
259 ("as", AS) $$
260 ("cell", CELL) $$
261 ("cells", CELLS) $$
262 ("cellset", CELLSET) $$
263 ("pipeline", PIPELINE) $$
264 ("cpu", CPU) $$
265 ("resource", RESOURCE) $$
266 ("reservation", RESERVATION) $$
267 ("table", TABLE) $$
268 ("latency", LATENCY) $$
269 ("predicated", PREDICATED) $$
270 ("instruction", INSTRUCTION) $$
271 ("formats", FORMATS) $$
272 ("uppercase", UPPERCASE) $$
273 ("lowercase", LOWERCASE) $$
274 ("verbatim", VERBATIM) $$
275 ("span", SPAN) $$
276 ("dependent", DEPENDENT) $$
277 ("always", ALWAYS) $$
278 ("never", NEVER) $$
279 ("delayslot", DELAYSLOT) $$
280 (* ("branching", BRANCHING) $$ *)
281 ("candidate", CANDIDATE) $$
282 ("rtl", RTL) $$
283 ("debug", DEBUG) $$
284 ("aliasing", ALIASING) $$
285 ("aggregable",AGGREGABLE)
286 )
287
288 val _ = app (HashTable.insert symbols)
289 (
290 nil $$
291 ("=", EQ) $$
292 ("*", TIMES) $$
293 (":", COLON) $$
294 (":>",COLONGREATER) $$
295 ("|", BAR) $$
296 ("->", ARROW) $$
297 ("=>", DARROW) $$
298 ("#", HASH) $$
299 ("!", DEREF) $$
300 ("^^", CONCAT)
301 )
302
303 fun lookup(MDLmode,s,yypos) =
304 let val l = String.size s
305 fun id() = ID(UniqueSymbol.toString
306 (UniqueSymbol.fromString s), yypos, yypos + l)
307 in HashTable.lookup keywords s (yypos,yypos + l)
308 handle _ =>
309 (if MDLmode then
310 (HashTable.lookup MDLkeywords s (yypos,yypos + l) handle _ => id())
311 else id()
312 )
313 end
314
315 fun lookupSym(s,yypos) =
316 let val l = String.size s
317 in HashTable.lookup symbols s (yypos,yypos + l)
318 handle _ => SYMBOL(UniqueSymbol.toString
319 (UniqueSymbol.fromString s), yypos, yypos + l)
320 end
321
322
323
324 end
325
326 datatype yymatch
327 = yyNO_MATCH
328 | yyMATCH of yyInput.stream * action * yymatch
329 withtype action = yyInput.stream * yymatch -> UserDeclarations.lexresult
330
331 local
332
333 val yytable =
334 #[
335 ([(#"\^@",#"\b",4),
336 (#"\v",#"\^_",4),
337 (#"\127",#"\255",4),
338 (#"\t",#"\t",5),
339 (#" ",#" ",5),
340 (#"\n",#"\n",6),
341 (#"!",#"!",7),
342 (#"%",#"&",7),
343 (#"*",#"+",7),
344 (#"-",#"-",7),
345 (#"/",#"/",7),
346 (#":",#":",7),
347 (#"?",#"@",7),
348 (#"^",#"^",7),
349 (#"|",#"|",7),
350 (#"\"",#"\"",8),
351 (#"#",#"#",9),
352 (#"$",#"$",10),
353 (#"'",#"'",11),
354 (#"(",#"(",12),
355 (#")",#")",13),
356 (#",",#",",14),
357 (#".",#".",15),
358 (#"0",#"0",16),
359 (#"1",#"9",17),
360 (#";",#";",18),
361 (#"<",#"<",19),
362 (#"=",#"=",20),
363 (#">",#">",21),
364 (#"A",#"Z",22),
365 (#"_",#"_",22),
366 (#"b",#"b",22),
367 (#"e",#"l",22),
368 (#"o",#"o",22),
369 (#"q",#"q",22),
370 (#"s",#"z",22),
371 (#"[",#"[",23),
372 (#"\\",#"\\",24),
373 (#"]",#"]",25),
374 (#"`",#"`",26),
375 (#"a",#"a",27),
376 (#"c",#"c",28),
377 (#"d",#"d",29),
378 (#"m",#"m",30),
379 (#"n",#"n",31),
380 (#"p",#"p",32),
381 (#"r",#"r",33),
382 (#"{",#"{",34),
383 (#"}",#"}",35),
384 (#"~",#"~",36)], []), ([(#"\^@",#"\b",120),
385 (#"\v",#"\^_",120),
386 (#"!",#"'",120),
387 (#")",#")",120),
388 (#"+",#"\255",120),
389 (#"\t",#"\t",121),
390 (#" ",#" ",121),
391 (#"\n",#"\n",6),
392 (#"(",#"(",122),
393 (#"*",#"*",123)], []), ([(#"\^@",#"\b",126),
394 (#"\v",#" ",126),
395 (#"\"",#"\"",126),
396 (#"(",#")",126),
397 (#",",#",",126),
398 (#"0",#"9",126),
399 (#";",#";",126),
400 (#"A",#"[",126),
401 (#"]",#"]",126),
402 (#"_",#"_",126),
403 (#"a",#"{",126),
404 (#"}",#"}",126),
405 (#"\127",#"\255",126),
406 (#"\t",#"\t",4),
407 (#"\n",#"\n",127),
408 (#"!",#"!",128),
409 (#"#",#"&",128),
410 (#"*",#"+",128),
411 (#"-",#"/",128),
412 (#":",#":",128),
413 (#"?",#"@",128),
414 (#"^",#"^",128),
415 (#"|",#"|",128),
416 (#"'",#"'",129),
417 (#"<",#"<",130),
418 (#"=",#"=",131),
419 (#">",#">",132),
420 (#"\\",#"\\",133),
421 (#"`",#"`",134),
422 (#"~",#"~",135)], []), ([(#"\^@",#"\b",4),
423 (#"\v",#"\^_",4),
424 (#"\\",#"\\",4),
425 (#"\127",#"\255",4),
426 (#"\t",#"\t",5),
427 (#" ",#" ",5),
428 (#"\n",#"\n",6),
429 (#"!",#"!",145),
430 (#"%",#"&",145),
431 (#"*",#"+",145),
432 (#"-",#"-",145),
433 (#"/",#"/",145),
434 (#":",#":",145),
435 (#"<",#"@",145),
436 (#"^",#"^",145),
437 (#"|",#"|",145),
438 (#"\"",#"\"",8),
439 (#"#",#"#",146),
440 (#"$",#"$",147),
441 (#"'",#"'",148),
442 (#"(",#"(",149),
443 (#")",#")",13),
444 (#",",#",",14),
445 (#".",#".",150),
446 (#"0",#"0",16),
447 (#"1",#"9",17),
448 (#";",#";",18),
449 (#"A",#"Z",22),
450 (#"_",#"_",22),
451 (#"b",#"b",22),
452 (#"e",#"l",22),
453 (#"o",#"o",22),
454 (#"q",#"q",22),
455 (#"s",#"z",22),
456 (#"[",#"[",23),
457 (#"]",#"]",25),
458 (#"`",#"`",151),
459 (#"a",#"a",27),
460 (#"c",#"c",28),
461 (#"d",#"d",29),
462 (#"m",#"m",30),
463 (#"n",#"n",31),
464 (#"p",#"p",32),
465 (#"r",#"r",33),
466 (#"{",#"{",34),
467 (#"}",#"}",35),
468 (#"~",#"~",152)], []), ([], [48]), ([], [1, 48]), ([], [0]), ([(#"!",#"!",37),
469 (#"#",#"&",37),
470 (#"*",#"+",37),
471 (#"-",#"/",37),
472 (#":",#":",37),
473 (#"=",#"=",37),
474 (#"?",#"@",37),
475 (#"^",#"^",37),
476 (#"|",#"|",37),
477 (#"~",#"~",37)], [43, 48]), ([(#"\^@",#"\b",117),
478 (#"\v",#"!",117),
479 (#"#",#"[",117),
480 (#"]",#"\255",117),
481 (#"\"",#"\"",118),
482 (#"\\",#"\\",119)], [48]), ([(#"!",#"!",37),
483 (#"#",#"&",37),
484 (#"*",#"+",37),
485 (#"-",#"/",37),
486 (#":",#":",37),
487 (#"=",#"=",37),
488 (#"?",#"@",37),
489 (#"^",#"^",37),
490 (#"|",#"|",37),
491 (#"~",#"~",37),
492 (#"\"",#"\"",113),
493 (#"[",#"[",114)], [43, 48]), ([(#"!",#"!",37),
494 (#"#",#"&",37),
495 (#"*",#"+",37),
496 (#"-",#"/",37),
497 (#":",#":",37),
498 (#"=",#"=",37),
499 (#"?",#"@",37),
500 (#"^",#"^",37),
501 (#"|",#"|",37),
502 (#"~",#"~",37)], [19, 43, 48]), ([(#"'",#"'",111),
503 (#"A",#"Z",112),
504 (#"_",#"_",112),
505 (#"a",#"z",112)], [43, 48]), ([], [29, 48]), ([], [30, 48]), ([], [36, 48]), ([(#"!",#"!",37),
506 (#"#",#"&",37),
507 (#"*",#"+",37),
508 (#"-",#"-",37),
509 (#"/",#"/",37),
510 (#":",#":",37),
511 (#"=",#"=",37),
512 (#"?",#"@",37),
513 (#"^",#"^",37),
514 (#"|",#"|",37),
515 (#"~",#"~",37),
516 (#".",#".",109)], [38, 43, 48]), ([(#".",#".",41),
517 (#"0",#"7",93),
518 (#"8",#"9",38),
519 (#"b",#"b",94),
520 (#"i",#"i",42),
521 (#"w",#"w",95),
522 (#"x",#"x",96)], [4, 48]), ([(#".",#".",41),
523 (#"0",#"9",38),
524 (#"i",#"i",42)], [4, 48]), ([], [37, 48]), ([(#"<",#"<",92)], [43, 48]), ([(#"!",#"!",37),
525 (#"#",#"&",37),
526 (#"*",#"+",37),
527 (#"-",#"/",37),
528 (#":",#":",37),
529 (#"=",#"=",37),
530 (#"?",#"@",37),
531 (#"^",#"^",37),
532 (#"|",#"|",37),
533 (#"~",#"~",37),
534 (#">",#">",40)], [43, 48]), ([(#">",#">",91)], [43, 48]), ([(#"'",#"'",47),
535 (#"0",#"9",47),
536 (#"A",#"Z",47),
537 (#"_",#"_",47),
538 (#"a",#"z",47)], [27, 48]), ([], [31, 48]), ([(#"\^@",#"\t",40),
539 (#"\v",#"\255",40)], [48]), ([], [33, 48]), ([(#"`",#"`",90)], [43, 48]), ([(#"'",#"'",47),
540 (#"0",#"9",47),
541 (#"A",#"Z",47),
542 (#"_",#"_",47),
543 (#"a",#"r",47),
544 (#"t",#"z",47),
545 (#"s",#"s",87)], [27, 48]), ([(#"'",#"'",47),
546 (#"0",#"9",47),
547 (#"A",#"Z",47),
548 (#"_",#"_",47),
549 (#"b",#"z",47),
550 (#"a",#"a",78)], [27, 48]), ([(#"'",#"'",47),
551 (#"0",#"9",47),
552 (#"A",#"Z",47),
553 (#"_",#"_",47),
554 (#"a",#"d",47),
555 (#"f",#"z",47),
556 (#"e",#"e",69)], [27, 48]), ([(#"'",#"'",47),
557 (#"0",#"9",47),
558 (#"A",#"Z",47),
559 (#"_",#"_",47),
560 (#"a",#"b",47),
561 (#"d",#"z",47),
562 (#"c",#"c",67)], [27, 48]), ([(#"'",#"'",47),
563 (#"0",#"9",47),
564 (#"A",#"Z",47),
565 (#"_",#"_",47),
566 (#"a",#"t",47),
567 (#"v",#"z",47),
568 (#"u",#"u",58)], [27, 48]), ([(#"'",#"'",47),
569 (#"0",#"9",47),
570 (#"A",#"Z",47),
571 (#"_",#"_",47),
572 (#"b",#"z",47),
573 (#"a",#"a",51)], [27, 48]), ([(#"'",#"'",47),
574 (#"0",#"9",47),
575 (#"A",#"Z",47),
576 (#"_",#"_",47),
577 (#"a",#"s",47),
578 (#"u",#"z",47),
579 (#"t",#"t",48)], [27, 48]), ([], [34, 48]), ([], [35, 48]), ([(#"!",#"!",37),
580 (#"#",#"&",37),
581 (#"*",#"+",37),
582 (#"-",#"/",37),
583 (#":",#":",37),
584 (#"=",#"=",37),
585 (#"?",#"@",37),
586 (#"^",#"^",37),
587 (#"|",#"|",37),
588 (#"~",#"~",37),
589 (#"0",#"9",38),
590 (#">",#">",39)], [43, 48]), ([(#"!",#"!",37),
591 (#"#",#"&",37),
592 (#"*",#"+",37),
593 (#"-",#"/",37),
594 (#":",#":",37),
595 (#"=",#"=",37),
596 (#"?",#"@",37),
597 (#"^",#"^",37),
598 (#"|",#"|",37),
599 (#"~",#"~",37)], [43]), ([(#".",#".",41),
600 (#"0",#"9",38),
601 (#"i",#"i",42)], [4]), ([(#">",#">",40)], []), ([], [43]), ([(#"0",#"9",43)], []), ([], [8]), ([(#"0",#"9",43),
602 (#"e",#"e",44)], [18]), ([(#"0",#"9",45),
603 (#"~",#"~",46)], []), ([(#"0",#"9",45)], [18]), ([(#"0",#"9",45)], []), ([(#"'",#"'",47),
604 (#"0",#"9",47),
605 (#"A",#"Z",47),
606 (#"_",#"_",47),
607 (#"a",#"z",47)], [27]), ([(#"'",#"'",47),
608 (#"0",#"9",47),
609 (#"A",#"Z",47),
610 (#"_",#"_",47),
611 (#"a",#"k",47),
612 (#"m",#"z",47),
613 (#"l",#"l",49)], [27]), ([(#"'",#"'",47),
614 (#"0",#"9",47),
615 (#"A",#"Z",47),
616 (#"_",#"_",47),
617 (#"a",#"z",47),
618 (#":",#":",50)], [27]), ([], [22]), ([(#"'",#"'",47),
619 (#"0",#"9",47),
620 (#"A",#"Z",47),
621 (#"_",#"_",47),
622 (#"a",#"c",47),
623 (#"e",#"z",47),
624 (#"d",#"d",52)], [27]), ([(#"'",#"'",47),
625 (#"0",#"9",47),
626 (#"A",#"Z",47),
627 (#"_",#"_",47),
628 (#"a",#"c",47),
629 (#"e",#"z",47),
630 (#"d",#"d",53)], [27]), ([(#"'",#"'",47),
631 (#"0",#"9",47),
632 (#"A",#"Z",47),
633 (#"_",#"_",47),
634 (#"a",#"h",47),
635 (#"j",#"z",47),
636 (#"i",#"i",54)], [27]), ([(#"'",#"'",47),
637 (#"0",#"9",47),
638 (#"A",#"Z",47),
639 (#"_",#"_",47),
640 (#"a",#"m",47),
641 (#"o",#"z",47),
642 (#"n",#"n",55)], [27]), ([(#"'",#"'",47),
643 (#"0",#"9",47),
644 (#"A",#"Z",47),
645 (#"_",#"_",47),
646 (#"a",#"f",47),
647 (#"h",#"z",47),
648 (#"g",#"g",56)], [27]), ([(#"'",#"'",47),
649 (#"0",#"9",47),
650 (#"A",#"Z",47),
651 (#"_",#"_",47),
652 (#"a",#"z",47),
653 (#":",#":",57)], [27]), ([], [24]), ([(#"'",#"'",47),
654 (#"0",#"9",47),
655 (#"A",#"Z",47),
656 (#"_",#"_",47),
657 (#"a",#"k",47),
658 (#"m",#"z",47),
659 (#"l",#"l",59)], [27]), ([(#"'",#"'",47),
660 (#"0",#"9",47),
661 (#"A",#"Z",47),
662 (#"_",#"_",47),
663 (#"a",#"k",47),
664 (#"m",#"z",47),
665 (#"l",#"l",60)], [27]), ([(#"'",#"'",47),
666 (#"0",#"9",47),
667 (#"A",#"Z",47),
668 (#"_",#"_",47),
669 (#"a",#"h",47),
670 (#"j",#"z",47),
671 (#"i",#"i",61)], [27]), ([(#"'",#"'",47),
672 (#"0",#"9",47),
673 (#"A",#"Z",47),
674 (#"_",#"_",47),
675 (#"a",#"e",47),
676 (#"g",#"z",47),
677 (#"f",#"f",62)], [27]), ([(#"'",#"'",47),
678 (#"0",#"9",47),
679 (#"A",#"Z",47),
680 (#"_",#"_",47),
681 (#"a",#"h",47),
682 (#"j",#"z",47),
683 (#"i",#"i",63)], [27]), ([(#"'",#"'",47),
684 (#"0",#"9",47),
685 (#"A",#"Z",47),
686 (#"_",#"_",47),
687 (#"a",#"d",47),
688 (#"f",#"z",47),
689 (#"e",#"e",64)], [27]), ([(#"'",#"'",47),
690 (#"0",#"9",47),
691 (#"A",#"Z",47),
692 (#"_",#"_",47),
693 (#"a",#"c",47),
694 (#"e",#"z",47),
695 (#"d",#"d",65)], [27]), ([(#"'",#"'",47),
696 (#"0",#"9",47),
697 (#"A",#"Z",47),
698 (#"_",#"_",47),
699 (#"a",#"z",47),
700 (#":",#":",66)], [27]), ([], [25]), ([(#"'",#"'",47),
701 (#"0",#"9",47),
702 (#"A",#"Z",47),
703 (#"_",#"_",47),
704 (#"a",#"z",47),
705 (#":",#":",68)], [27]), ([], [21]), ([(#"'",#"'",47),
706 (#"0",#"9",47),
707 (#"A",#"Z",47),
708 (#"_",#"_",47),
709 (#"a",#"k",47),
710 (#"m",#"z",47),
711 (#"l",#"l",70)], [27]), ([(#"'",#"'",47),
712 (#"0",#"9",47),
713 (#"A",#"Z",47),
714 (#"_",#"_",47),
715 (#"b",#"z",47),
716 (#"a",#"a",71)], [27]), ([(#"'",#"'",47),
717 (#"0",#"9",47),
718 (#"A",#"Z",47),
719 (#"_",#"_",47),
720 (#"a",#"x",47),
721 (#"z",#"z",47),
722 (#"y",#"y",72)], [27]), ([(#"'",#"'",47),
723 (#"0",#"9",47),
724 (#"A",#"Z",47),
725 (#"_",#"_",47),
726 (#"a",#"r",47),
727 (#"t",#"z",47),
728 (#"s",#"s",73)], [27]), ([(#"'",#"'",47),
729 (#"0",#"9",47),
730 (#"A",#"Z",47),
731 (#"_",#"_",47),
732 (#"a",#"k",47),
733 (#"m",#"z",47),
734 (#"l",#"l",74)], [27]), ([(#"'",#"'",47),
735 (#"0",#"9",47),
736 (#"A",#"Z",47),
737 (#"_",#"_",47),
738 (#"a",#"n",47),
739 (#"p",#"z",47),
740 (#"o",#"o",75)], [27]), ([(#"'",#"'",47),
741 (#"0",#"9",47),
742 (#"A",#"Z",47),
743 (#"_",#"_",47),
744 (#"a",#"s",47),
745 (#"u",#"z",47),
746 (#"t",#"t",76)], [27]), ([(#"'",#"'",47),
747 (#"0",#"9",47),
748 (#"A",#"Z",47),
749 (#"_",#"_",47),
750 (#"a",#"z",47),
751 (#":",#":",77)], [27]), ([], [23]), ([(#"'",#"'",47),
752 (#"0",#"9",47),
753 (#"A",#"Z",47),
754 (#"_",#"_",47),
755 (#"a",#"m",47),
756 (#"o",#"z",47),
757 (#"n",#"n",79)], [27]), ([(#"'",#"'",47),
758 (#"0",#"9",47),
759 (#"A",#"Z",47),
760 (#"_",#"_",47),
761 (#"a",#"c",47),
762 (#"e",#"z",47),
763 (#"d",#"d",80)], [27]), ([(#"'",#"'",47),
764 (#"0",#"9",47),
765 (#"A",#"Z",47),
766 (#"_",#"_",47),
767 (#"a",#"h",47),
768 (#"j",#"z",47),
769 (#"i",#"i",81)], [27]), ([(#"'",#"'",47),
770 (#"0",#"9",47),
771 (#"A",#"Z",47),
772 (#"_",#"_",47),
773 (#"a",#"c",47),
774 (#"e",#"z",47),
775 (#"d",#"d",82)], [27]), ([(#"'",#"'",47),
776 (#"0",#"9",47),
777 (#"A",#"Z",47),
778 (#"_",#"_",47),
779 (#"b",#"z",47),
780 (#"a",#"a",83)], [27]), ([(#"'",#"'",47),
781 (#"0",#"9",47),
782 (#"A",#"Z",47),
783 (#"_",#"_",47),
784 (#"a",#"s",47),
785 (#"u",#"z",47),
786 (#"t",#"t",84)], [27]), ([(#"'",#"'",47),
787 (#"0",#"9",47),
788 (#"A",#"Z",47),
789 (#"_",#"_",47),
790 (#"a",#"d",47),
791 (#"f",#"z",47),
792 (#"e",#"e",85)], [27]), ([(#"'",#"'",47),
793 (#"0",#"9",47),
794 (#"A",#"Z",47),
795 (#"_",#"_",47),
796 (#"a",#"z",47),
797 (#":",#":",86)], [27]), ([], [26]), ([(#"'",#"'",47),
798 (#"0",#"9",47),
799 (#"A",#"Z",47),
800 (#"_",#"_",47),
801 (#"a",#"l",47),
802 (#"n",#"z",47),
803 (#"m",#"m",88)], [27]), ([(#"'",#"'",47),
804 (#"0",#"9",47),
805 (#"A",#"Z",47),
806 (#"_",#"_",47),
807 (#"a",#"z",47),
808 (#":",#":",89)], [27]), ([], [20]), ([(#"`",#"`",90)], [43]), ([(#">",#">",91)], [43]), ([(#"<",#"<",92)], [43]), ([(#".",#".",41),
809 (#"0",#"7",93),
810 (#"8",#"9",38),
811 (#"i",#"i",108)], [4, 6]), ([(#"0",#"1",106)], []), ([(#"0",#"0",99),
812 (#"1",#"9",100),
813 (#"b",#"b",101),
814 (#"x",#"x",102)], []), ([(#"0",#"9",97),
815 (#"A",#"F",97),
816 (#"a",#"f",97)], []), ([(#"0",#"9",97),
817 (#"A",#"F",97),
818 (#"a",#"f",97),
819 (#"i",#"i",98)], [5]), ([], [9]), ([(#"0",#"7",105),
820 (#"8",#"9",100)], [12]), ([(#"0",#"9",100)], [12]), ([(#"0",#"1",104)], []), ([(#"0",#"9",103),
821 (#"A",#"F",103),
822 (#"a",#"f",103)], []), ([(#"0",#"9",103),
823 (#"A",#"F",103),
824 (#"a",#"f",103)], [13]), ([(#"0",#"1",104)], [15]), ([(#"0",#"7",105),
825 (#"8",#"9",100)], [12, 14]), ([(#"0",#"1",106),
826 (#"i",#"i",107)], [7]), ([], [11]), ([], [8, 10]), ([(#"!",#"!",37),
827 (#"#",#"&",37),
828 (#"*",#"+",37),
829 (#"-",#"-",37),
830 (#"/",#"/",37),
831 (#":",#":",37),
832 (#"=",#"=",37),
833 (#"?",#"@",37),
834 (#"^",#"^",37),
835 (#"|",#"|",37),
836 (#"~",#"~",37),
837 (#".",#".",110)], [39, 43]), ([(#"!",#"!",37),
838 (#"#",#"&",37),
839 (#"*",#"+",37),
840 (#"-",#"/",37),
841 (#":",#":",37),
842 (#"=",#"=",37),
843 (#"?",#"@",37),
844 (#"^",#"^",37),
845 (#"|",#"|",37),
846 (#"~",#"~",37)], [40, 43]), ([(#"'",#"'",111)], [43]), ([(#"'",#"'",112),
847 (#"0",#"9",112),
848 (#"A",#"Z",112),
849 (#"_",#"_",112),
850 (#"a",#"z",112)], [28]), ([(#"\^@",#"\b",113),
851 (#"\v",#"!",113),
852 (#"#",#"[",113),
853 (#"]",#"\255",113),
854 (#"\"",#"\"",115),
855 (#"\\",#"\\",116)], []), ([], [32]), ([], [17]), ([(#"\^@",#"\t",113),
856 (#"\v",#"\255",113)], []), ([(#"\^@",#"\b",117),
857 (#"\v",#"!",117),
858 (#"#",#"[",117),
859 (#"]",#"\255",117),
860 (#"\"",#"\"",118),
861 (#"\\",#"\\",119)], []), ([], [16]), ([(#"\^@",#"\t",117),
862 (#"\v",#"\255",117)], []), ([], [47, 48]), ([], [1, 47, 48]), ([(#"*",#"*",125)], [47, 48]), ([(#")",#")",124)], [47, 48]), ([], [45]), ([], [46]), ([(#"\^@",#"\b",136),
863 (#"\v",#"&",136),
864 (#"(",#";",136),
865 (#"=",#"=",136),
866 (#"?",#"\255",136)], [44, 48]), ([], [2]), ([(#"\^@",#"\b",136),
867 (#"\v",#" ",136),
868 (#"\"",#"\"",136),
869 (#"(",#")",136),
870 (#",",#",",136),
871 (#"0",#"9",136),
872 (#";",#";",136),
873 (#"A",#"]",136),
874 (#"_",#"{",136),
875 (#"}",#"}",136),
876 (#"\127",#"\255",136),
877 (#"!",#"!",137),
878 (#"#",#"&",137),
879 (#"*",#"+",137),
880 (#"-",#"/",137),
881 (#":",#":",137),
882 (#"=",#"=",137),
883 (#"?",#"@",137),
884 (#"^",#"^",137),
885 (#"|",#"|",137),
886 (#"~",#"~",137)], [42, 44, 48]), ([(#"'",#"'",144)], [42, 44, 48]), ([(#"<",#"<",143)], [42, 48]), ([(#"\^@",#"\b",136),
887 (#"\v",#" ",136),
888 (#"\"",#"\"",136),
889 (#"(",#")",136),
890 (#",",#",",136),
891 (#"0",#"9",136),
892 (#";",#";",136),
893 (#"A",#"]",136),
894 (#"_",#"{",136),
895 (#"}",#"}",136),
896 (#"\127",#"\255",136),
897 (#"!",#"!",137),
898 (#"#",#"&",137),
899 (#"*",#"+",137),
900 (#"-",#"/",137),
901 (#":",#":",137),
902 (#"=",#"=",137),
903 (#"?",#"@",137),
904 (#"^",#"^",137),
905 (#"|",#"|",137),
906 (#"~",#"~",137),
907 (#">",#">",139)], [42, 44, 48]), ([(#">",#">",142)], [42, 48]), ([(#"\^@",#"\b",141),
908 (#"\v",#"&",141),
909 (#"(",#";",141),
910 (#"=",#"=",141),
911 (#"?",#"\255",141),
912 (#"\t",#"\t",139),
913 (#"'",#"'",139),
914 (#"<",#"<",139),
915 (#">",#">",139)], [44, 48]), ([(#"\^@",#"\b",136),
916 (#"\v",#"&",136),
917 (#"(",#";",136),
918 (#"=",#"=",136),
919 (#"?",#"_",136),
920 (#"a",#"\255",136),
921 (#"`",#"`",140)], [42, 44, 48]), ([(#"\^@",#"\b",136),
922 (#"\v",#" ",136),
923 (#"\"",#"\"",136),
924 (#"(",#")",136),
925 (#",",#",",136),
926 (#"0",#"9",136),
927 (#";",#";",136),
928 (#"A",#"]",136),
929 (#"_",#"{",136),
930 (#"}",#"}",136),
931 (#"\127",#"\255",136),
932 (#"!",#"!",137),
933 (#"#",#"&",137),
934 (#"*",#"+",137),
935 (#"-",#"/",137),
936 (#":",#":",137),
937 (#"=",#"=",137),
938 (#"?",#"@",137),
939 (#"^",#"^",137),
940 (#"|",#"|",137),
941 (#"~",#"~",137),
942 (#">",#">",138)], [42, 44, 48]), ([(#"\^@",#"\b",136),
943 (#"\v",#"&",136),
944 (#"(",#";",136),
945 (#"=",#"=",136),
946 (#"?",#"\255",136)], [44]), ([(#"\^@",#"\b",136),
947 (#"\v",#" ",136),
948 (#"\"",#"\"",136),
949 (#"(",#")",136),
950 (#",",#",",136),
951 (#"0",#"9",136),
952 (#";",#";",136),
953 (#"A",#"]",136),
954 (#"_",#"{",136),
955 (#"}",#"}",136),
956 (#"\127",#"\255",136),
957 (#"!",#"!",137),
958 (#"#",#"&",137),
959 (#"*",#"+",137),
960 (#"-",#"/",137),
961 (#":",#":",137),
962 (#"=",#"=",137),
963 (#"?",#"@",137),
964 (#"^",#"^",137),
965 (#"|",#"|",137),
966 (#"~",#"~",137)], [42, 44]), ([(#">",#">",139)], []), ([], [42]), ([(#"\^@",#"\b",136),
967 (#"\v",#"&",136),
968 (#"(",#";",136),
969 (#"=",#"=",136),
970 (#"?",#"_",136),
971 (#"a",#"\255",136),
972 (#"`",#"`",140)], [42, 44]), ([(#"\^@",#"\b",136),
973 (#"\v",#"&",136),
974 (#"(",#";",136),
975 (#"=",#"=",136),
976 (#"?",#"\255",136)], [42, 44]), ([(#">",#">",142)], [42]), ([(#"<",#"<",143)], [42]), ([(#"'",#"'",144)], [42]), ([(#"!",#"!",153),
977 (#"#",#"&",153),
978 (#"*",#"+",153),
979 (#"-",#"-",153),
980 (#"/",#"/",153),
981 (#":",#":",153),
982 (#"<",#"@",153),
983 (#"^",#"^",153),
984 (#"|",#"|",153),
985 (#"~",#"~",153)], [41, 48]), ([(#"!",#"!",153),
986 (#"#",#"&",153),
987 (#"*",#"+",153),
988 (#"-",#"-",153),
989 (#"/",#"/",153),
990 (#":",#":",153),
991 (#"<",#"@",153),
992 (#"^",#"^",153),
993 (#"|",#"|",153),
994 (#"~",#"~",153),
995 (#"\"",#"\"",113),
996 (#"[",#"[",114)], [41, 48]), ([(#"!",#"!",153),
997 (#"#",#"&",153),
998 (#"*",#"+",153),
999 (#"-",#"-",153),
1000 (#"/",#"/",153),
1001 (#":",#":",153),
1002 (#"<",#"@",153),
1003 (#"^",#"^",153),
1004 (#"|",#"|",153),
1005 (#"~",#"~",153)], [19, 41, 48]), ([(#"'",#"'",154),
1006 (#"A",#"Z",112),
1007 (#"_",#"_",112),
1008 (#"a",#"z",112)], [48]), ([(#"*",#"*",157)], [29, 48]), ([(#".",#".",155)], [38, 48]), ([(#"`",#"`",154)], [48]), ([(#"!",#"!",153),
1009 (#"#",#"&",153),
1010 (#"*",#"+",153),
1011 (#"-",#"-",153),
1012 (#"/",#"/",153),
1013 (#":",#":",153),
1014 (#"<",#"@",153),
1015 (#"^",#"^",153),
1016 (#"|",#"|",153),
1017 (#"~",#"~",153),
1018 (#"0",#"9",38)], [41, 48]), ([(#"!",#"!",153),
1019 (#"#",#"&",153),
1020 (#"*",#"+",153),
1021 (#"-",#"-",153),
1022 (#"/",#"/",153),
1023 (#":",#":",153),
1024 (#"<",#"@",153),
1025 (#"^",#"^",153),
1026 (#"|",#"|",153),
1027 (#"~",#"~",153)], [41]), ([], [41]), ([(#".",#".",156)], [39]), ([], [40]), ([], [3])]
1028
1029 fun mk yyins = let
1030 (* current start state *)
1031 val yyss = ref INITIAL
1032 fun YYBEGIN ss = (yyss := ss)
1033 (* current input stream *)
1034 val yystrm = ref yyins
1035 (* get one char of input *)
1036 val yygetc = yyInput.getc
1037 (* create yytext *)
1038 fun yymktext(strm) = yyInput.subtract (strm, !yystrm)
1039 open UserDeclarations
1040 fun lex
1041 (yyarg as ({srcMap,err,MDLmode})) () = let
1042 fun continue() = let
1043 val yylastwasn = yyInput.lastWasNL (!yystrm)
1044 fun yystuck (yyNO_MATCH) = raise Fail "stuck state"
1045 | yystuck (yyMATCH (strm, action, old)) =
1046 action (strm, old)
1047 val yypos = yyInput.getpos (!yystrm)
1048 val yygetlineNo = yyInput.getlineNo
1049 fun yyactsToMatches (strm, [], oldMatches) = oldMatches
1050 | yyactsToMatches (strm, act::acts, oldMatches) =
1051 yyMATCH (strm, act, yyactsToMatches (strm, acts, oldMatches))
1052 fun yygo actTable =
1053 (fn (~1, _, oldMatches) => yystuck oldMatches
1054 | (curState, strm, oldMatches) => let
1055 val (transitions, finals') = Vector.sub (yytable, curState)
1056 val finals = map (fn i => Vector.sub (actTable, i)) finals'
1057 fun tryfinal() =
1058 yystuck (yyactsToMatches (strm, finals, oldMatches))
1059 fun find (c, []) = NONE
1060 | find (c, (c1, c2, s)::ts) =
1061 if c1 <= c andalso c <= c2 then SOME s
1062 else find (c, ts)
1063 in case yygetc strm
1064 of SOME(c, strm') =>
1065 (case find (c, transitions)
1066 of NONE => tryfinal()
1067 | SOME n =>
1068 yygo actTable
1069 (n, strm',
1070 yyactsToMatches (strm, finals, oldMatches)))
1071 | NONE => tryfinal()
1072 end)
1073 in
1074 let
1075 fun yyAction0 (strm, lastMatch : yymatch) = (yystrm := strm;
1076 (SourceMapping.newline srcMap yypos; continue()))
1077 fun yyAction1 (strm, lastMatch : yymatch) = (yystrm := strm; (continue()))
1078 fun yyAction2 (strm, lastMatch : yymatch) = let
1079 val yytext = yymktext(strm)
1080 in
1081 yystrm := strm;
1082 (err(yypos,yypos+size yytext,
1083 "newline in assembly text!"); continue())
1084 end
1085 fun yyAction3 (strm, lastMatch : yymatch) = (yystrm := strm;
1086 (commentLevel := 1; YYBEGIN COMMENT; continue()))
1087 fun yyAction4 (strm, lastMatch : yymatch) = let
1088 val yytext = yymktext(strm)
1089 in
1090 yystrm := strm; (decimal(err,yytext,yypos))
1091 end
1092 fun yyAction5 (strm, lastMatch : yymatch) = let
1093 val yytext = yymktext(strm)
1094 in
1095 yystrm := strm; (hex(err,yytext,yypos))
1096 end
1097 fun yyAction6 (strm, lastMatch : yymatch) = let
1098 val yytext = yymktext(strm)
1099 in
1100 yystrm := strm; (octal(err,yytext,yypos))
1101 end
1102 fun yyAction7 (strm, lastMatch : yymatch) = let
1103 val yytext = yymktext(strm)
1104 in
1105 yystrm := strm; (binary(err,yytext,yypos))
1106 end
1107 fun yyAction8 (strm, lastMatch : yymatch) = let
1108 val yytext = yymktext(strm)
1109 in
1110 yystrm := strm; (decimalinf(err,yytext,yypos))
1111 end
1112 fun yyAction9 (strm, lastMatch : yymatch) = let
1113 val yytext = yymktext(strm)
1114 in
1115 yystrm := strm; (hexinf(err,yytext,yypos))
1116 end
1117 fun yyAction10 (strm, lastMatch : yymatch) = let
1118 val yytext = yymktext(strm)
1119 in
1120 yystrm := strm; (octalinf(err,yytext,yypos))
1121 end
1122 fun yyAction11 (strm, lastMatch : yymatch) = let
1123 val yytext = yymktext(strm)
1124 in
1125 yystrm := strm; (binaryinf(err,yytext,yypos))
1126 end
1127 fun yyAction12 (strm, lastMatch : yymatch) = let
1128 val yytext = yymktext(strm)
1129 in
1130 yystrm := strm; (wdecimal(err,yytext,yypos))
1131 end
1132 fun yyAction13 (strm, lastMatch : yymatch) = let
1133 val yytext = yymktext(strm)
1134 in
1135 yystrm := strm; (whex(err,yytext,yypos))
1136 end
1137 fun yyAction14 (strm, lastMatch : yymatch) = let
1138 val yytext = yymktext(strm)
1139 in
1140 yystrm := strm; (woctal(err,yytext,yypos))
1141 end
1142 fun yyAction15 (strm, lastMatch : yymatch) = let
1143 val yytext = yymktext(strm)
1144 in
1145 yystrm := strm; (wbinary(err,yytext,yypos))
1146 end
1147 fun yyAction16 (strm, lastMatch : yymatch) = let
1148 val yytext = yymktext(strm)
1149 in
1150 yystrm := strm; (string(err,yytext,yypos))
1151 end
1152 fun yyAction17 (strm, lastMatch : yymatch) = let
1153 val yytext = yymktext(strm)
1154 in
1155 yystrm := strm; (char(err,yytext,yypos))
1156 end
1157 fun yyAction18 (strm, lastMatch : yymatch) = let
1158 val yytext = yymktext(strm)
1159 in
1160 yystrm := strm; (real(err,yytext,yypos))
1161 end
1162 fun yyAction19 (strm, lastMatch : yymatch) = (yystrm := strm;
1163 (if MDLmode then DOLLAR(yypos,yypos+1)
1164 else SYMBOL("$",yypos,yypos+1)))
1165 fun yyAction20 (strm, lastMatch : yymatch) = let
1166 val oldStrm = !(yystrm)
1167 fun REJECT () = (yystrm := oldStrm; yystuck(lastMatch))
1168 val yytext = yymktext(strm)
1169 in
1170 yystrm := strm;
1171 (if MDLmode then
1172 ASM_COLON(yypos,yypos+size yytext) else REJECT())
1173 end
1174 fun yyAction21 (strm, lastMatch : yymatch) = let
1175 val oldStrm = !(yystrm)
1176 fun REJECT () = (yystrm := oldStrm; yystuck(lastMatch))
1177 val yytext = yymktext(strm)
1178 in
1179 yystrm := strm;
1180 (if MDLmode then
1181 MC_COLON(yypos,yypos+size yytext) else REJECT())
1182 end
1183 fun yyAction22 (strm, lastMatch : yymatch) = let
1184 val oldStrm = !(yystrm)
1185 fun REJECT () = (yystrm := oldStrm; yystuck(lastMatch))
1186 val yytext = yymktext(strm)
1187 in
1188 yystrm := strm;
1189 (if MDLmode then
1190 RTL_COLON(yypos,yypos+size yytext) else REJECT())
1191 end
1192 fun yyAction23 (strm, lastMatch : yymatch) = let
1193 val oldStrm = !(yystrm)
1194 fun REJECT () = (yystrm := oldStrm; yystuck(lastMatch))
1195 val yytext = yymktext(strm)
1196 in
1197 yystrm := strm;
1198 (if MDLmode then
1199 DELAYSLOT_COLON(yypos,size yytext) else REJECT())
1200 end
1201 fun yyAction24 (strm, lastMatch : yymatch) = let
1202 val oldStrm = !(yystrm)
1203 fun REJECT () = (yystrm := oldStrm; yystuck(lastMatch))
1204 val yytext = yymktext(strm)
1205 in
1206 yystrm := strm;
1207 (if MDLmode then
1208 PADDING_COLON(yypos,size yytext) else REJECT())
1209 end
1210 fun yyAction25 (strm, lastMatch : yymatch) = let
1211 val oldStrm = !(yystrm)
1212 fun REJECT () = (yystrm := oldStrm; yystuck(lastMatch))
1213 val yytext = yymktext(strm)
1214 in
1215 yystrm := strm;
1216 (if MDLmode then
1217 NULLIFIED_COLON(yypos,size yytext) else REJECT())
1218 end
1219 fun yyAction26 (strm, lastMatch : yymatch) = let
1220 val oldStrm = !(yystrm)
1221 fun REJECT () = (yystrm := oldStrm; yystuck(lastMatch))
1222 val yytext = yymktext(strm)
1223 in
1224 yystrm := strm;
1225 (if MDLmode then
1226 CANDIDATE_COLON(yypos,size yytext) else REJECT())
1227 end
1228 fun yyAction27 (strm, lastMatch : yymatch) = let
1229 val yytext = yymktext(strm)
1230 in
1231 yystrm := strm; (lookup(MDLmode,yytext,yypos))
1232 end
1233 fun yyAction28 (strm, lastMatch : yymatch) = let
1234 val yytext = yymktext(strm)
1235 in
1236 yystrm := strm; (TYVAR(yytext,yypos,yypos + size yytext))
1237 end
1238 fun yyAction29 (strm, lastMatch : yymatch) = (yystrm := strm;
1239 (LPAREN(yypos,yypos+1)))
1240 fun yyAction30 (strm, lastMatch : yymatch) = (yystrm := strm;
1241 (RPAREN(yypos,yypos+1)))
1242 fun yyAction31 (strm, lastMatch : yymatch) = (yystrm := strm;
1243 (LBRACKET(yypos,yypos+1)))
1244 fun yyAction32 (strm, lastMatch : yymatch) = (yystrm := strm;
1245 (LHASHBRACKET(yypos,yypos+1)))
1246 fun yyAction33 (strm, lastMatch : yymatch) = (yystrm := strm;
1247 (RBRACKET(yypos,yypos+1)))
1248 fun yyAction34 (strm, lastMatch : yymatch) = (yystrm := strm;
1249 (LBRACE(yypos,yypos+1)))
1250 fun yyAction35 (strm, lastMatch : yymatch) = (yystrm := strm;
1251 (RBRACE(yypos,yypos+1)))
1252 fun yyAction36 (strm, lastMatch : yymatch) = (yystrm := strm;
1253 (COMMA(yypos,yypos+1)))
1254 fun yyAction37 (strm, lastMatch : yymatch) = (yystrm := strm;
1255 (SEMICOLON(yypos,yypos+1)))
1256 fun yyAction38 (strm, lastMatch : yymatch) = (yystrm := strm;
1257 (DOT(yypos,yypos+1)))
1258 fun yyAction39 (strm, lastMatch : yymatch) = (yystrm := strm;
1259 (DOTDOT(yypos,yypos+2)))
1260 fun yyAction40 (strm, lastMatch : yymatch) = (yystrm := strm;
1261 (DOTDOT(yypos,yypos+3)))
1262 fun yyAction41 (strm, lastMatch : yymatch) = let
1263 val yytext = yymktext(strm)
1264 in
1265 yystrm := strm;
1266 (if yytext = !asmLQuote then
1267 (debug("lquote "^yytext^"\n");
1268 YYBEGIN ASMQUOTE;
1269 LDQUOTE(yypos,yypos+size yytext))
1270 else
1271 lookupSym(yytext,yypos))
1272 end
1273 fun yyAction42 (strm, lastMatch : yymatch) = let
1274 val yytext = yymktext(strm)
1275 in
1276 yystrm := strm;
1277 (if yytext = !asmRQuote then
1278 (if !metaLevel <> 0 then
1279 err(yypos,yypos+size yytext,
1280 "Mismatch between "^(!asmLMeta)^
1281 " and "^(!asmRMeta)) else ();
1282 debug("rquote "^yytext^"\n");
1283 YYBEGIN INITIAL;
1284 RDQUOTE(yypos,yypos+size yytext))
1285 else if yytext = !asmLMeta then
1286 (metaLevel := !metaLevel + 1;
1287 debug("lmeta "^yytext^"\n");
1288 YYBEGIN ASM; LMETA(yypos,yypos+size yytext))
1289 else
1290 asmtext(err,yytext,yypos))
1291 end
1292 fun yyAction43 (strm, lastMatch : yymatch) = let
1293 val yytext = yymktext(strm)
1294 in
1295 yystrm := strm;
1296 (if yytext = !asmRMeta then
1297 (metaLevel := !metaLevel - 1;
1298 debug("rmeta "^yytext^"("^Int.toString(!metaLevel)^")\n");
1299 if !metaLevel = 0 then YYBEGIN ASMQUOTE
1300 else (); RMETA(yypos,yypos+size yytext))
1301 else
1302 lookupSym(yytext,yypos))
1303 end
1304 fun yyAction44 (strm, lastMatch : yymatch) = let
1305 val yytext = yymktext(strm)
1306 in
1307 yystrm := strm;
1308 (debug("text="^yytext^"\n");
1309 asmtext(err,yytext,yypos))
1310 end
1311 fun yyAction45 (strm, lastMatch : yymatch) = (yystrm := strm;
1312 (commentLevel := !commentLevel - 1;
1313 if !commentLevel = 0 then YYBEGIN INITIAL else ();
1314 continue()))
1315 fun yyAction46 (strm, lastMatch : yymatch) = (yystrm := strm;
1316 (commentLevel := !commentLevel + 1; continue()))
1317 fun yyAction47 (strm, lastMatch : yymatch) = (yystrm := strm; (continue()))
1318 fun yyAction48 (strm, lastMatch : yymatch) = let
1319 val yytext = yymktext(strm)
1320 in
1321 yystrm := strm;
1322 (err(yypos,yypos+size yytext,
1323 "unknown character "^String.toString yytext);
1324 continue())
1325 end
1326 val yyactTable = Vector.fromList([yyAction0, yyAction1, yyAction2, yyAction3,
1327 yyAction4, yyAction5, yyAction6, yyAction7, yyAction8, yyAction9, yyAction10,
1328 yyAction11, yyAction12, yyAction13, yyAction14, yyAction15, yyAction16,
1329 yyAction17, yyAction18, yyAction19, yyAction20, yyAction21, yyAction22,
1330 yyAction23, yyAction24, yyAction25, yyAction26, yyAction27, yyAction28,
1331 yyAction29, yyAction30, yyAction31, yyAction32, yyAction33, yyAction34,
1332 yyAction35, yyAction36, yyAction37, yyAction38, yyAction39, yyAction40,
1333 yyAction41, yyAction42, yyAction43, yyAction44, yyAction45, yyAction46,
1334 yyAction47, yyAction48])
1335 in
1336 if yyInput.eof(!(yystrm))
1337 then UserDeclarations.eof(yyarg)
1338 else (case (!(yyss))
1339 of ASM => yygo yyactTable (0, !(yystrm), yyNO_MATCH)
1340 | COMMENT => yygo yyactTable (1, !(yystrm), yyNO_MATCH)
1341 | ASMQUOTE => yygo yyactTable (2, !(yystrm), yyNO_MATCH)
1342 | INITIAL => yygo yyactTable (3, !(yystrm), yyNO_MATCH)
1343 (* end case *))
1344 end
1345 end
1346 in
1347 continue()
1348 handle IO.Io{cause, ...} => raise cause
1349 end
1350 in
1351 lex
1352 end
1353 in
1354 fun makeLexer yyinputN = mk (yyInput.mkStream yyinputN)
1355 fun makeLexer' ins = mk (yyInput.mkStream ins)
1356 end
1357
1358 end