fix(frontends/lean/scanner): assertion violation, and add more tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
fb73514913
commit
0363faeec8
11 changed files with 31 additions and 1 deletions
|
@ -353,9 +353,9 @@ scanner::token scanner::read_script_block() {
|
||||||
next();
|
next();
|
||||||
if (c1 == '*') {
|
if (c1 == '*') {
|
||||||
char c2 = curr();
|
char c2 = curr();
|
||||||
next();
|
|
||||||
if (c2 == EOF)
|
if (c2 == EOF)
|
||||||
throw_exception("unexpected end of script");
|
throw_exception("unexpected end of script");
|
||||||
|
next();
|
||||||
if (c2 == ')') {
|
if (c2 == ')') {
|
||||||
return token::ScriptBlock;
|
return token::ScriptBlock;
|
||||||
} else {
|
} else {
|
||||||
|
|
4
tests/lean/scan_error1.lean
Normal file
4
tests/lean/scan_error1.lean
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
..
|
||||||
|
print "begin"
|
||||||
|
..
|
||||||
|
print "done"
|
3
tests/lean/scan_error1.lean.expected.out
Normal file
3
tests/lean/scan_error1.lean.expected.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Set: pp::colors
|
||||||
|
Set: pp::unicode
|
||||||
|
Error (line: 1, pos: 3) invalid character sequence, '...' ellipsis expected
|
1
tests/lean/scan_error2.lean
Normal file
1
tests/lean/scan_error2.lean
Normal file
|
@ -0,0 +1 @@
|
||||||
|
(* print("from lua")
|
3
tests/lean/scan_error2.lean.expected.out
Normal file
3
tests/lean/scan_error2.lean.expected.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Set: pp::colors
|
||||||
|
Set: pp::unicode
|
||||||
|
Error (line: 1, pos: 21) unexpected end of script
|
1
tests/lean/scan_error3.lean
Normal file
1
tests/lean/scan_error3.lean
Normal file
|
@ -0,0 +1 @@
|
||||||
|
(* print("from lua") *
|
3
tests/lean/scan_error3.lean.expected.out
Normal file
3
tests/lean/scan_error3.lean.expected.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Set: pp::colors
|
||||||
|
Set: pp::unicode
|
||||||
|
Error (line: 1, pos: 23) unexpected end of script
|
1
tests/lean/scan_test1.lean
Normal file
1
tests/lean/scan_test1.lean
Normal file
|
@ -0,0 +1 @@
|
||||||
|
print 10.0.
|
3
tests/lean/scan_test1.lean.expected.out
Normal file
3
tests/lean/scan_test1.lean.expected.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Set: pp::colors
|
||||||
|
Set: pp::unicode
|
||||||
|
10
|
7
tests/lean/scan_test2.lean
Normal file
7
tests/lean/scan_test2.lean
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
(*
|
||||||
|
a = 1 *
|
||||||
|
2
|
||||||
|
print("a")
|
||||||
|
*)
|
||||||
|
|
||||||
|
prnt "fail"
|
4
tests/lean/scan_test2.lean.expected.out
Normal file
4
tests/lean/scan_test2.lean.expected.out
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Set: pp::colors
|
||||||
|
Set: pp::unicode
|
||||||
|
a
|
||||||
|
Error (line: 7, pos: 0) Command expected
|
Loading…
Reference in a new issue