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

SCM Repository

[smlnj] Annotation of /smlnj-lib/trunk/HTML4/html4-attr.l
ViewVC logotype

Annotation of /smlnj-lib/trunk/HTML4/html4-attr.l

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3985 - (view) (download)

1 : jhr 3962 (* html4-attr.l
2 :     *
3 :     * COPYRIGHT (c) 2014 The Fellowship of SML/NJ (http://www.smlnj.org)
4 :     * All rights reserved.
5 :     *
6 :     * Lexer for parsing HTML 4 attributes.
7 :     *)
8 : jriehl 3531
9 :     %name HTML4AttrLexer;
10 :    
11 :     %defs (
12 :     open HTML4AttrTokens
13 :    
14 :     fun eof() = EOF
15 :     type lex_result = token
16 :     );
17 :    
18 :     %let alpha=[A-Za-z];
19 :     %let digit=[0-9];
20 :     %let ws=[\ \t\r\n];
21 :    
22 : jhr 3985 (* some XHTML attributes have ":" in their name *)
23 :     {alpha}({alpha}|{digit}|[-.:])* => (NAME (Atom.atom yytext));
24 : jriehl 3531 {digit}+ => (NUMBER yytext);
25 : jhr 3985 "=" => (EQUALS);
26 : jriehl 3531 "." => (DOT);
27 :     [\"][^\"]*[\"] => (STRINGLIT yytext);
28 :     [\'][^\']*[\'] => (STRINGLIT yytext);
29 :    
30 : jhr 3985
31 : jriehl 3531 {ws}+ => (continue());
32 :    
33 : jhr 3985 . => ((* error; invalid character *) continue());
34 :    
35 : jriehl 3531 (* ______________________________________________________________________
36 :     End of html4-attr.l
37 :     ______________________________________________________________________ *)

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