Commit af4158ec authored by Pietro Abate's avatar Pietro Abate

Cosmetic changes for the lexer

parent b7e6b480
......@@ -223,9 +223,11 @@ let rec token = lexer
| ".."
| ["?+*"] "?" | "#" ->
return lexbuf (KEYWORD (L.utf8_lexeme lexbuf))
| "[" -> in_brackets := !in_brackets + 1;
| "[" ->
incr in_brackets;
return lexbuf (KEYWORD (L.utf8_lexeme lexbuf))
| "]" -> in_brackets := !in_brackets - 1;
| "]" ->
decr in_brackets;
return lexbuf (KEYWORD (L.utf8_lexeme lexbuf))
| '"' ->
let start = L.lexeme_start lexbuf in
......@@ -280,9 +282,11 @@ and token2 = lexer
| ".."
| ["?+*"] "?" | "#" ->
return lexbuf (KEYWORD (L.utf8_lexeme lexbuf))
| "[" -> in_brackets := !in_brackets + 1;
| "[" ->
incr in_brackets;
return lexbuf (KEYWORD (L.utf8_lexeme lexbuf))
| "]" -> in_brackets := !in_brackets - 1;
| "]" ->
decr in_brackets;
return lexbuf (KEYWORD (L.utf8_lexeme lexbuf))
| '"' ->
let start = L.lexeme_start lexbuf in
......@@ -348,9 +352,11 @@ and token2toplevel = lexer
| ".."
| ["?+*"] "?" | "#" ->
return lexbuf (KEYWORD (L.utf8_lexeme lexbuf))
| "[" -> in_brackets := !in_brackets + 1;
| "[" ->
incr in_brackets;
return lexbuf (KEYWORD (L.utf8_lexeme lexbuf))
| "]" -> in_brackets := !in_brackets - 1;
| "]" ->
decr in_brackets;
return lexbuf (KEYWORD (L.utf8_lexeme lexbuf))
| '"' ->
let start = L.lexeme_start lexbuf in
......@@ -432,8 +438,10 @@ and string start endchar = lexer
| eof -> error start (start+1) "Unterminated string"
| _ -> store_lexeme lexbuf; string start endchar lexbuf
let token lexbuf = if !in_brackets = 0 then token lexbuf
else if !toplevel then token2toplevel lexbuf else token2 lexbuf
let token lexbuf =
if !in_brackets = 0 then token lexbuf
else if !toplevel then token2toplevel lexbuf
else token2 lexbuf
let lexbuf = ref None
let last_tok = ref (KEYWORD "DUMMY")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment