diff options
Diffstat (limited to 'lib/xml_lexer.mll')
-rw-r--r-- | lib/xml_lexer.mll | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/xml_lexer.mll b/lib/xml_lexer.mll index a33be9da..290f2c89 100644 --- a/lib/xml_lexer.mll +++ b/lib/xml_lexer.mll @@ -88,7 +88,8 @@ let error lexbuf e = let newline = ['\n'] let break = ['\r'] let space = [' ' '\t'] -let identchar = ['A'-'Z' 'a'-'z' '_' '0'-'9' ':' '-'] +let identchar = ['A'-'Z' 'a'-'z' '_' '0'-'9' ':' '-' '.'] +let ident = ['A'-'Z' 'a'-'z' '_' ':'] identchar* let entitychar = ['A'-'Z' 'a'-'z'] let pcchar = [^ '\r' '\n' '<' '>' '&'] @@ -226,7 +227,7 @@ and entity = parse { raise (Error EUnterminatedEntity) } and ident_name = parse - | identchar+ + | ident { lexeme lexbuf } | _ | eof { error lexbuf EIdentExpected } @@ -252,7 +253,7 @@ and attributes = parse } and attribute = parse - | identchar+ + | ident { lexeme lexbuf } | _ | eof { error lexbuf EAttributeNameExpected } @@ -281,6 +282,11 @@ and dq_string = parse Buffer.add_char tmp (lexeme_char lexbuf 1); dq_string lexbuf } + | '&' + { + Buffer.add_string tmp (entity lexbuf); + dq_string lexbuf + } | eof { raise (Error EUnterminatedString) } | _ @@ -297,6 +303,11 @@ and q_string = parse Buffer.add_char tmp (lexeme_char lexbuf 1); q_string lexbuf } + | '&' + { + Buffer.add_string tmp (entity lexbuf); + q_string lexbuf + } | eof { raise (Error EUnterminatedString) } | _ |