Mercurial > urweb
comparison src/urweb.lex @ 1840:146ec8e90063
Add some name-mangling rules to allow XML attribute 'name' and attributes with dashes
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 27 Dec 2012 15:34:11 -0500 |
parents | 818d4097e2ed |
children | 403f0cc65b9c |
comparison
equal
deleted
inserted
replaced
1839:d8c260bcc1f9 | 1840:146ec8e90063 |
---|---|
175 %header (functor UrwebLexFn(structure Tokens : Urweb_TOKENS)); | 175 %header (functor UrwebLexFn(structure Tokens : Urweb_TOKENS)); |
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 cid = [A-Z][A-Za-z0-9_]*; | 181 cid = [A-Z][A-Za-z0-9_]*; |
181 ws = [\ \t\012\r]; | 182 ws = [\ \t\012\r]; |
182 intconst = [0-9]+; | 183 intconst = [0-9]+; |
183 realconst = [0-9]+\.[0-9]*; | 184 realconst = [0-9]+\.[0-9]*; |
184 notags = ([^<{\n(]|(\([^\*<{\n]))+; | 185 notags = ([^<{\n(]|(\([^\*<{\n]))+; |
311 <XMLTAG> ">" => (YYBEGIN XML; | 312 <XMLTAG> ">" => (YYBEGIN XML; |
312 Tokens.GT (yypos, yypos + size yytext)); | 313 Tokens.GT (yypos, yypos + size yytext)); |
313 | 314 |
314 <XMLTAG> {ws}+ => (lex ()); | 315 <XMLTAG> {ws}+ => (lex ()); |
315 | 316 |
316 <XMLTAG> {id} => (Tokens.SYMBOL (yytext, yypos, yypos + size yytext)); | 317 <XMLTAG> {xmlid} => (Tokens.SYMBOL (yytext, yypos, yypos + size yytext)); |
317 <XMLTAG> "=" => (Tokens.EQ (yypos, yypos + size yytext)); | 318 <XMLTAG> "=" => (Tokens.EQ (yypos, yypos + size yytext)); |
318 | 319 |
319 <XMLTAG> {intconst} => (case Int64.fromString yytext of | 320 <XMLTAG> {intconst} => (case Int64.fromString yytext of |
320 SOME x => Tokens.INT (x, yypos, yypos + size yytext) | 321 SOME x => Tokens.INT (x, yypos, yypos + size yytext) |
321 | NONE => (ErrorMsg.errorAt' (yypos, yypos) | 322 | NONE => (ErrorMsg.errorAt' (yypos, yypos) |