Mercurial > urweb
comparison src/urweb.lex @ 2241:2b1af5dc6dee
Merge.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Sun, 19 Jul 2015 19:05:16 -0700 |
parents | e10881cd92da 9ea29c93246d |
children |
comparison
equal
deleted
inserted
replaced
2240:88cc0f44c940 | 2241:2b1af5dc6dee |
---|---|
176 %full | 176 %full |
177 %s COMMENT STRING CHAR XML XMLTAG; | 177 %s COMMENT STRING CHAR XML XMLTAG; |
178 | 178 |
179 id = [a-z_][A-Za-z0-9_']*; | 179 id = [a-z_][A-Za-z0-9_']*; |
180 xmlid = [A-Za-z][A-Za-z0-9_-]*; | 180 xmlid = [A-Za-z][A-Za-z0-9_-]*; |
181 cid = [A-Z][A-Za-z0-9_]*; | 181 cid = [A-Z][A-Za-z0-9_']*; |
182 ws = [\ \t\012\r]; | 182 ws = [\ \t\012\r]; |
183 intconst = [0-9]+; | 183 intconst = [0-9]+; |
184 realconst = [0-9]+\.[0-9]*; | 184 realconst = [0-9]+\.[0-9]*; |
185 hexconst = 0x[0-9A-F]{1,8}; | 185 hexconst = 0x[0-9A-F]+; |
186 notags = ([^<{\n(]|(\([^\*<{\n]))+; | 186 notags = ([^<{\n(]|(\([^\*<{\n]))+; |
187 xcom = ([^\-]|(-[^\-]))+; | 187 xcom = ([^\-]|(-[^\-]))+; |
188 oint = [0-9][0-9][0-9]; | 188 oint = [0-9][0-9][0-9]; |
189 xint = x[0-9a-fA-F][0-9a-fA-F]; | 189 xint = x[0-9a-fA-F][0-9a-fA-F]; |
190 | 190 |
535 <INITIAL> "CASCADE" => (Tokens.CASCADE (pos yypos, pos yypos + size yytext)); | 535 <INITIAL> "CASCADE" => (Tokens.CASCADE (pos yypos, pos yypos + size yytext)); |
536 <INITIAL> "REFERENCES"=> (Tokens.REFERENCES (pos yypos, pos yypos + size yytext)); | 536 <INITIAL> "REFERENCES"=> (Tokens.REFERENCES (pos yypos, pos yypos + size yytext)); |
537 | 537 |
538 <INITIAL> "CURRENT_TIMESTAMP" => (Tokens.CURRENT_TIMESTAMP (pos yypos, pos yypos + size yytext)); | 538 <INITIAL> "CURRENT_TIMESTAMP" => (Tokens.CURRENT_TIMESTAMP (pos yypos, pos yypos + size yytext)); |
539 | 539 |
540 <INITIAL> "CURRENT_TIMESTAMP" => (Tokens.CURRENT_TIMESTAMP (pos yypos, pos yypos + size yytext)); | 540 <INITIAL> "_LOC_" => (let val strLoc = ErrorMsg.spanToString (ErrorMsg.spanOf |
541 (pos yypos, pos yypos + size yytext)) | |
542 in | |
543 Tokens.STRING (strLoc, pos yypos, pos yypos + size yytext) | |
544 end); | |
541 | 545 |
542 <INITIAL> {id} => (Tokens.SYMBOL (yytext, pos yypos, pos yypos + size yytext)); | 546 <INITIAL> {id} => (Tokens.SYMBOL (yytext, pos yypos, pos yypos + size yytext)); |
543 <INITIAL> {cid} => (Tokens.CSYMBOL (yytext, pos yypos, pos yypos + size yytext)); | 547 <INITIAL> {cid} => (Tokens.CSYMBOL (yytext, pos yypos, pos yypos + size yytext)); |
544 | 548 |
545 <INITIAL> {hexconst} => (case StringCvt.scanString (Int64.scan StringCvt.HEX) (String.extract (yytext, 2, NONE)) of | 549 <INITIAL> {hexconst} => (let val digits = String.extract (yytext, 2, NONE) |
550 val v = (StringCvt.scanString (Int64.scan StringCvt.HEX) digits) | |
551 handle Overflow => NONE | |
552 in | |
553 case v of | |
546 SOME x => Tokens.INT (x, pos yypos, pos yypos + size yytext) | 554 SOME x => Tokens.INT (x, pos yypos, pos yypos + size yytext) |
547 | NONE => (ErrorMsg.errorAt' (pos yypos, pos yypos) | 555 | NONE => (ErrorMsg.errorAt' (pos yypos, pos yypos) |
548 ("Expected hexInt, received: " ^ yytext); | 556 ("Expected hexInt, received: " ^ yytext); |
549 continue ())); | 557 continue ()) |
550 | 558 end); |
551 <INITIAL> {intconst} => (case Int64.fromString yytext of | 559 |
560 <INITIAL> {intconst} => (let val v = (Int64.fromString yytext) handle Overflow => NONE | |
561 in | |
562 case v of | |
552 SOME x => Tokens.INT (x, pos yypos, pos yypos + size yytext) | 563 SOME x => Tokens.INT (x, pos yypos, pos yypos + size yytext) |
553 | NONE => (ErrorMsg.errorAt' (pos yypos, pos yypos) | 564 | NONE => (ErrorMsg.errorAt' (pos yypos, pos yypos) |
554 ("Expected int, received: " ^ yytext); | 565 ("Expected int, received: " ^ yytext); |
555 continue ())); | 566 continue ()) |
567 end); | |
556 <INITIAL> {realconst} => (case Real64.fromString yytext of | 568 <INITIAL> {realconst} => (case Real64.fromString yytext of |
557 SOME x => Tokens.FLOAT (x, pos yypos, pos yypos + size yytext) | 569 SOME x => Tokens.FLOAT (x, pos yypos, pos yypos + size yytext) |
558 | NONE => (ErrorMsg.errorAt' (pos yypos, pos yypos) | 570 | NONE => (ErrorMsg.errorAt' (pos yypos, pos yypos) |
559 ("Expected float, received: " ^ yytext); | 571 ("Expected float, received: " ^ yytext); |
560 continue ())); | 572 continue ())); |