Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
27a156f0
Commit
27a156f0
authored
5 years ago
by
Allan Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
[Parsing] Fixes location of errors for ghost else with comments
parent
875373ce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/kernel_internals/parsing/clexer.mll
+8
-2
8 additions, 2 deletions
src/kernel_internals/parsing/clexer.mll
with
8 additions
and
2 deletions
src/kernel_internals/parsing/clexer.mll
+
8
−
2
View file @
27a156f0
...
@@ -347,6 +347,10 @@ let lex_comment remainder buffer lexbuf =
...
@@ -347,6 +347,10 @@ let lex_comment remainder buffer lexbuf =
(
match
buffer
with
None
->
()
|
Some
b
->
Buffer
.
add_string
b
s
)
;
(
match
buffer
with
None
->
()
|
Some
b
->
Buffer
.
add_string
b
s
)
;
remainder
buffer
lexbuf
remainder
buffer
lexbuf
let
error_count_lines
comments
=
let
newline_if_n
c
=
if
c
=
'\n'
then
E
.
newline
()
in
String
.
iter
newline_if_n
comments
let
do_lex_comment
?
(
first_string
=
""
)
remainder
lexbuf
=
let
do_lex_comment
?
(
first_string
=
""
)
remainder
lexbuf
=
let
buffer
=
let
buffer
=
if
Kernel
.
PrintComments
.
get
()
then
begin
if
Kernel
.
PrintComments
.
get
()
then
begin
...
@@ -809,11 +813,13 @@ and msasmnobrace = parse
...
@@ -809,11 +813,13 @@ and msasmnobrace = parse
cur
^
(
msasmnobrace
lexbuf
)
}
cur
^
(
msasmnobrace
lexbuf
)
}
and
annot_first_token
=
parse
and
annot_first_token
=
parse
|
"ghost"
(
blank
|
'\n'
|
(
"//"
[
^
'\n'
]
*
'\n'
)
)
*
"else"
{
|
"ghost"
(
(
blank
|
'\n'
|
(
"//"
[
^
'\n'
]
*
'\n'
)
)
*
as
comments
)
"else"
{
if
is_oneline_ghost
()
then
E
.
parse_error
"nested ghost code"
;
if
is_oneline_ghost
()
then
E
.
parse_error
"nested ghost code"
;
Buffer
.
clear
buf
;
Buffer
.
clear
buf
;
let
loc
=
currentLoc
()
in
error_count_lines
comments
;
enter_ghost_code
()
;
enter_ghost_code
()
;
LGHOST_ELSE
(
currentLoc
()
)
LGHOST_ELSE
(
loc
)
}
}
|
"ghost"
{
|
"ghost"
{
if
is_oneline_ghost
()
then
E
.
parse_error
"nested ghost code"
;
if
is_oneline_ghost
()
then
E
.
parse_error
"nested ghost code"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment