X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Flexer.mll;h=f2d083063258da907818ec93939309a44712a302;hb=3ed50d510dbab127125a8af9f72554c2dec72ef5;hp=d0f4a1dec90903f302f885563c21b2fbeebda589;hpb=5a6a8b2b8e515941f9a2b3cc051da646ae696251;p=goals.git diff --git a/src/lexer.mll b/src/lexer.mll index d0f4a1d..f2d0830 100644 --- a/src/lexer.mll +++ b/src/lexer.mll @@ -34,7 +34,7 @@ let new_line lexbuf = let white = [' ' '\t']+ let newline = '\r' | '\n' | "\r\n" let comment = '#' (_#'\n')* -let id = ['a'-'z' 'A'-'Z' '_'] ['a'-'z' 'A'-'Z' '0'-'9' '_']* +let id = ['a'-'z' 'A'-'Z' '_'] ['a'-'z' 'A'-'Z' '0'-'9' '_' '-']* rule read = parse @@ -43,6 +43,7 @@ rule read = | newline { new_line lexbuf; read lexbuf } | "," { COMMA } | ":" { COLON } + | ";" { SEMICOLON } | "=" { EQUALS } | "(" { LEFT_PAREN } | ")" { RIGHT_PAREN } @@ -51,7 +52,12 @@ rule read = | '"' { read_string (Ast.Substs.create ()) lexbuf } | "{" { read_code (Ast.Substs.create ()) (ref 1) lexbuf } | "goal" { GOAL } + | "tactic" { TACTIC_KEYWORD } | "let" { LET } + | "include" { INCLUDE } + | "-include" { OPTINCLUDE } + | "*" id { (* NB: The initial '*' is part of the name. *) + TACTIC (Lexing.lexeme lexbuf) } | id { ID (Lexing.lexeme lexbuf) } | _ { raise (SyntaxError ("unexpected character: " ^ Lexing.lexeme lexbuf)) } @@ -102,7 +108,8 @@ and read_string buf = *) and read_code buf level = parse - | '{' { incr level; read_code buf level lexbuf } + | '{' { Ast.Substs.add_char buf '{'; + incr level; read_code buf level lexbuf } | '}' { decr level; if !level = 0 then CODE (Ast.Substs.get buf) else (