comparison src/urweb.lex @ 2078:6d126af2e1cb

Some more HTML5 input types
author Adam Chlipala <adam@chlipala.net>
date Sun, 16 Nov 2014 14:39:38 -0500
parents 403f0cc65b9c
children d4ed20beb93b 278e10629ba1
comparison
equal deleted inserted replaced
2077:3cd2bd4b1de0 2078:6d126af2e1cb
275 else 275 else
276 (str := ch :: !str; 276 (str := ch :: !str;
277 continue ()) 277 continue ())
278 end); 278 end);
279 279
280 <INITIAL> "<" {id} "/>"=>(let 280 <INITIAL> "<" {xmlid} "/>"=>(let
281 val tag = String.substring (yytext, 1, size yytext - 3) 281 val tag = String.substring (yytext, 1, size yytext - 3)
282 in 282 in
283 Tokens.XML_BEGIN_END (tag, yypos, yypos + size yytext) 283 Tokens.XML_BEGIN_END (tag, yypos, yypos + size yytext)
284 end); 284 end);
285 <INITIAL> "<" {id} ">"=> (let 285 <INITIAL> "<" {xmlid} ">"=> (let
286 val tag = String.substring (yytext, 1, size yytext - 2) 286 val tag = String.substring (yytext, 1, size yytext - 2)
287 in 287 in
288 YYBEGIN XML; 288 YYBEGIN XML;
289 xmlTag := tag :: (!xmlTag); 289 xmlTag := tag :: (!xmlTag);
290 Tokens.XML_BEGIN (tag, yypos, yypos + size yytext) 290 Tokens.XML_BEGIN (tag, yypos, yypos + size yytext)
291 end); 291 end);
292 <XML> "</" {id} ">" => (let 292 <XML> "</" {xmlid} ">" => (let
293 val id = String.substring (yytext, 2, size yytext - 3) 293 val id = String.substring (yytext, 2, size yytext - 3)
294 in 294 in
295 case !xmlTag of 295 case !xmlTag of
296 id' :: rest => 296 id' :: rest =>
297 if id = id' then 297 if id = id' then
302 Tokens.END_TAG (id, yypos, yypos + size yytext) 302 Tokens.END_TAG (id, yypos, yypos + size yytext)
303 | _ => 303 | _ =>
304 Tokens.END_TAG (id, yypos, yypos + size yytext) 304 Tokens.END_TAG (id, yypos, yypos + size yytext)
305 end); 305 end);
306 306
307 <XML> "<" {id} => (YYBEGIN XMLTAG; 307 <XML> "<" {xmlid} => (YYBEGIN XMLTAG;
308 Tokens.BEGIN_TAG (String.extract (yytext, 1, NONE), 308 Tokens.BEGIN_TAG (String.extract (yytext, 1, NONE),
309 yypos, yypos + size yytext)); 309 yypos, yypos + size yytext));
310 310
311 <XMLTAG> "/" => (Tokens.DIVIDE (yypos, yypos + size yytext)); 311 <XMLTAG> "/" => (Tokens.DIVIDE (yypos, yypos + size yytext));
312 <XMLTAG> ">" => (YYBEGIN XML; 312 <XMLTAG> ">" => (YYBEGIN XML;