El 26/02/15 a les 19:46, Gabriel Riba ha escrit:
<INITIAL> {hexconst} => (case StringCvt.scanString (Int64.scan
StringCvt.HEX)
(String.extract (yytext, 2, NONE)) of
SOME x => Tokens.INT (x, pos yypos, pos
yypos + size yytext)
| NONE => (ErrorMsg.errorAt' (pos yypos,
pos yypos)
("Expected
hexadecimal int, received: " ^ yytext);
It seems that I left a line out while copying it (also missing in the
patch), so it should be
<INITIAL> {hexconst} => (case StringCvt.scanString (Int64.scan
StringCvt.HEX) (String.extract (yytext, 2, NONE)) of
SOME x => Tokens.INT (x, pos yypos, pos
yypos + size yytext)
| NONE => (ErrorMsg.errorAt' (pos yypos,
pos yypos)
("Expected
hexInt, received: " ^ yytext);
continue ()));
although the error branch will never happen.
--- ../../urweb-20150214/src/urweb.lex 2014-12-06 21:28:52.000000000 +0100
+++ urweb-20150214/src/urweb.lex 2015-02-26 21:45:05.355707890 +0100
@@ -182,6 +182,7 @@
ws = [\ \t\012\r];
intconst = [0-9]+;
realconst = [0-9]+\.[0-9]*;
+hexconst = 0x[0-9A-F]{1,8};
notags = ([^<{\n(]|(\([^\*<{\n]))+;
xcom = ([^\-]|(-[^\-]))+;
oint = [0-9][0-9][0-9];
@@ -532,6 +533,12 @@
<INITIAL> {id} => (Tokens.SYMBOL (yytext, pos yypos, pos yypos + size yytext));
<INITIAL> {cid} => (Tokens.CSYMBOL (yytext, pos yypos, pos yypos + size yytext));
+<INITIAL> {hexconst} => (case StringCvt.scanString (Int64.scan StringCvt.HEX) (String.extract (yytext, 2, NONE)) of
+ SOME x => Tokens.INT (x, pos yypos, pos yypos + size yytext)
+ | NONE => (ErrorMsg.errorAt' (pos yypos, pos yypos)
+ ("Expected hexInt, received: " ^ yytext);
+ continue ()));
+
<INITIAL> {intconst} => (case Int64.fromString yytext of
SOME x => Tokens.INT (x, pos yypos, pos yypos + size yytext)
| NONE => (ErrorMsg.errorAt' (pos yypos, pos yypos)
_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur