From cd5cb328d707b89caad44b038422d6456c1aee03 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 3 Jan 2020 14:48:54 +0000 Subject: [PATCH] parser: Optional semicolon between statements. --- src/lexer.mll | 1 + src/parser.mly | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lexer.mll b/src/lexer.mll index 4a316a0..f2d0830 100644 --- a/src/lexer.mll +++ b/src/lexer.mll @@ -43,6 +43,7 @@ rule read = | newline { new_line lexbuf; read lexbuf } | "," { COMMA } | ":" { COLON } + | ";" { SEMICOLON } | "=" { EQUALS } | "(" { LEFT_PAREN } | ")" { RIGHT_PAREN } diff --git a/src/parser.mly b/src/parser.mly index db70924..b84ac15 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -70,6 +70,7 @@ let do_include env loc filename optflag file = %token OPTINCLUDE %token RIGHT_ARRAY %token RIGHT_PAREN +%token SEMICOLON %token STRING %token TACTIC %token TACTIC_KEYWORD @@ -85,11 +86,12 @@ file: stmts: | (* none *) { Ast.Env.empty } - | stmts INCLUDE STRING + | stmts INCLUDE STRING option(SEMICOLON) { do_include $1 $loc $3 false file } - | stmts OPTINCLUDE STRING + | stmts OPTINCLUDE STRING option(SEMICOLON) { do_include $1 $loc $3 true file } - | stmts stmt { let name, expr = $2 in Ast.Env.add name expr $1 } + | stmts stmt option(SEMICOLON) + { let name, expr = $2 in Ast.Env.add name expr $1 } ; stmt: -- 1.8.3.1