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
POTTIER Francois
menhir
Commits
13bd0b0f
Commit
13bd0b0f
authored
Sep 24, 2015
by
POTTIER Francois
Browse files
Very slight improvement in the positions produced by [Lexer] on an error.
parent
73d7abcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lexer.mll
View file @
13bd0b0f
...
...
@@ -257,6 +257,9 @@
let
error1
pos
msg
=
Error
.
error
(
Positions
.
one
pos
)
msg
let
error2
lexbuf
msg
=
Error
.
error
(
Positions
.
two
lexbuf
.
lex_start_p
lexbuf
.
lex_curr_p
)
msg
}
let
newline
=
(
'\010'
|
'\013'
|
"
\013\010
"
)
...
...
@@ -374,7 +377,7 @@ rule main = parse
|
eof
{
EOF
}
|
_
{
error
1
(
lexeme_start_p
lexbuf
)
"unexpected character(s)."
}
{
error
2
lexbuf
"unexpected character(s)."
}
(* Skip C style comments. *)
...
...
@@ -437,7 +440,7 @@ and action percent openingpos pkeywords = parse
{
let
pkeyword
=
mk_keyword
lexbuf
w
f
n
id
in
action
percent
openingpos
(
pkeyword
::
pkeywords
)
lexbuf
}
|
previouserror
{
error
1
(
lexeme_start_p
lexbuf
)
"$previouserror is no longer supported."
}
{
error
2
lexbuf
"$previouserror is no longer supported."
}
|
syntaxerror
{
let
pkeyword
=
with_cpos
lexbuf
Keyword
.
PSyntaxError
in
action
percent
openingpos
(
pkeyword
::
pkeywords
)
lexbuf
}
...
...
@@ -475,7 +478,7 @@ and parentheses openingpos pkeywords = parse
{ let pkeyword = mk_keyword lexbuf w f n id in
parentheses openingpos (pkeyword :: pkeywords) lexbuf }
| previouserror
{ error
1 (lexeme_start_p
lexbuf
)
"$previouserror is no longer supported." }
{ error
2
lexbuf "$previouserror is no longer supported." }
| syntaxerror
{ let pkeyword = with_cpos lexbuf Keyword.PSyntaxError in
parentheses openingpos (pkeyword :: pkeywords) lexbuf }
...
...
Write
Preview
Supports
Markdown
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