Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /smlnj-lib/trunk/JSON/json.lex
ViewVC logotype

Diff of /smlnj-lib/trunk/JSON/json.lex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3001, Tue Apr 22 14:27:15 2008 UTC revision 3004, Wed Apr 23 21:58:57 2008 UTC
# Line 14  Line 14 
14    fun eof () = T.EOF    fun eof () = T.EOF
15    fun int s = T.INT(valOf(IntInf.fromString s))    fun int s = T.INT(valOf(IntInf.fromString s))
16    fun float s = T.FLOAT(valOf(LargeReal.fromString s))    fun float s = T.FLOAT(valOf(LargeReal.fromString s))
17  )  (* support for incremental construction of strings *)
18      val sbuf : string list ref = ref []
19      fun addStr s = sbuf := s :: !sbuf
20      fun addUChr lit = let
21          (* trim the "\u" prefix *)
22            val digits = Substring.triml 2 (Substring.full lit)
23            val SOME(w, _) = Word.scan StringCvt.HEX Substring.getc digits
24            in
25              addStr(UTF8.encode w)
26            end
27      fun finishString () = (String.concat(List.rev(!sbuf)) before sbuf := [])
28    );
29    
30  %let digit1_9 = [1-9];  %let digit1_9 = [1-9];
31  %let digit = [0-9];  %let digit = [0-9];
32  %let digits = {digit}+;  %let digits = {digit}+;
33  %let int = "-"?({digit} | {digit1_9}{digits}+);  %let int = "-"?({digit} | {digit1_9}{digits}+);
34  %let frac = "."{num};  %let frac = "."{digits};
35  %let exp = [eE][+-]?{digits};  %let exp = [eE][+-]?{digits};
36  %let xdigit = {digit}|[a-fA-F];  %let xdigit = {digit}|[a-fA-F];
37    
# Line 56  Line 67 
67  <S>[^\\"]+              => ( addStr yytext; continue() );  <S>[^\\"]+              => ( addStr yytext; continue() );
68  <S>"\""                 => ( YYBEGIN INITIAL; finishString() );  <S>"\""                 => ( YYBEGIN INITIAL; finishString() );
69    
70  "/*"^(.*"*/".*)"*/"     => ( skip() );  "/*"~(.*"*/".*)"*/"     => ( skip() );

Legend:
Removed from v.3001  
changed lines
  Added in v.3004

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0