summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Kerneis2014-07-04 06:52:33 +0100
committerGabriel Kerneis2014-07-04 07:16:02 +0100
commit174a4bffa3214c7d2403ab1329b74d970e30e801 (patch)
tree649e1e714f4fe85698e23f2fabd7815044f81967 /src
parentbe252b50a8f1f4f0fafa871c737f5a91d8c3131a (diff)
Force end-of-input when parsing expression list
Diffstat (limited to 'src')
-rw-r--r--src/parser.mly7
-rw-r--r--src/sail_lib.ml2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/parser.mly b/src/parser.mly
index 416d4d92..aa6c853d 100644
--- a/src/parser.mly
+++ b/src/parser.mly
@@ -163,12 +163,12 @@ let make_vector_sugar typ typ1 =
%token <string> LtEqUnderUiI LtUnderSI LtUnderSiI LtUnderUI LtUnderUiI StarStarUnderSI StarStarUnderSiI StarUnderSI
%token <string> StarUnderSiI StarUnderUI StarUnderUiI TwoCarrotI
-%start file exp semi_exps
+%start file nonempty_exp_list
%type <Parse_ast.defs> defs
%type <Parse_ast.atyp> typ
%type <Parse_ast.pat> pat
%type <Parse_ast.exp> exp
-%type <Parse_ast.exp list> semi_exps
+%type <Parse_ast.exp list> nonempty_exp_list
%type <Parse_ast.defs> file
@@ -1198,3 +1198,6 @@ file:
| defs Eof
{ $1 }
+nonempty_exp_list:
+ | semi_exps_help Eof { $1 }
+
diff --git a/src/sail_lib.ml b/src/sail_lib.ml
index fca6e412..66db451a 100644
--- a/src/sail_lib.ml
+++ b/src/sail_lib.ml
@@ -11,7 +11,7 @@ module Pretty = Pretty_print
let parse_exps s =
let lexbuf = Lexing.from_string s in
try
- let pre_exps = Parser.semi_exps Lexer.token lexbuf in
+ let pre_exps = Parser.nonempty_exp_list Lexer.token lexbuf in
List.map (Initial_check.to_ast_exp Type_internal.initial_kind_env) pre_exps
with
| Parsing.Parse_error ->