Skip to content
Snippets Groups Projects
Commit 69f75966 authored by Virgile Prevosto's avatar Virgile Prevosto Committed by Andre Maroneze
Browse files

[lexer] Proper error message in case of unfinished one-line comment

parent 30084eaa
No related branches found
No related tags found
No related merge requests found
...@@ -924,6 +924,7 @@ and annot_one_line = parse ...@@ -924,6 +924,7 @@ and annot_one_line = parse
| "" { annot_one_line_logic lexbuf } | "" { annot_one_line_logic lexbuf }
and annot_one_line_logic = parse and annot_one_line_logic = parse
| '\n' { make_annot ~one_line:true initial lexbuf (Buffer.contents buf) } | '\n' { make_annot ~one_line:true initial lexbuf (Buffer.contents buf) }
| eof { E.parse_error "Invalid C file: should end with a newline" }
| _ as c { Buffer.add_char buf c; annot_one_line_logic lexbuf } | _ as c { Buffer.add_char buf c; annot_one_line_logic lexbuf }
{ {
......
[kernel] Parsing tests/spec/unfinished-oneline-acsl-comment.i (no preprocessing)
[kernel] :0:
Invalid C file: should end with a newline:
Location: between <unknown> and 6:7, before or at token:
1 /* run.config
2 EXIT: 1
3 STDOPT:
4 */
5 // If you edit this file, make sure it ends WITHOUT a newline
6 //@ bad
[kernel] Frama-C aborted: invalid user input.
/* run.config
EXIT: 1
STDOPT:
*/
// If you edit this file, make sure it ends WITHOUT a newline
//@ bad
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment