fix(frontends/lean/scanner): assertion violation, and add more tests

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-01-07 15:12:34 -08:00
parent fb73514913
commit 0363faeec8
11 changed files with 31 additions and 1 deletions

View file

@ -353,9 +353,9 @@ scanner::token scanner::read_script_block() {
next();
if (c1 == '*') {
char c2 = curr();
next();
if (c2 == EOF)
throw_exception("unexpected end of script");
next();
if (c2 == ')') {
return token::ScriptBlock;
} else {

View file

@ -0,0 +1,4 @@
..
print "begin"
..
print "done"

View file

@ -0,0 +1,3 @@
Set: pp::colors
Set: pp::unicode
Error (line: 1, pos: 3) invalid character sequence, '...' ellipsis expected

View file

@ -0,0 +1 @@
(* print("from lua")

View file

@ -0,0 +1,3 @@
Set: pp::colors
Set: pp::unicode
Error (line: 1, pos: 21) unexpected end of script

View file

@ -0,0 +1 @@
(* print("from lua") *

View file

@ -0,0 +1,3 @@
Set: pp::colors
Set: pp::unicode
Error (line: 1, pos: 23) unexpected end of script

View file

@ -0,0 +1 @@
print 10.0.

View file

@ -0,0 +1,3 @@
Set: pp::colors
Set: pp::unicode
10

View file

@ -0,0 +1,7 @@
(*
a = 1 *
2
print("a")
*)
prnt "fail"

View file

@ -0,0 +1,4 @@
Set: pp::colors
Set: pp::unicode
a
Error (line: 7, pos: 0) Command expected