Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
af4158ec
Commit
af4158ec
authored
Sep 14, 2014
by
Pietro Abate
Browse files
Cosmetic changes for the lexer
parent
b7e6b480
Changes
1
Hide whitespace changes
Inline
Side-by-side
parser/ulexer.ml
View file @
af4158ec
...
...
@@ -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")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment