From 53314c2c0ce2d5fba997d59f5d667e52debab725 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Mon, 10 Jun 2019 15:19:42 +0200 Subject: [PATCH 1/2] Removed "assert" as reserved. Enabled terminating ";" in lists. --- .gitignore | 1 + src/parser/ligodity/Lexer.mll | 2 +- src/parser/ligodity/Parser.mly | 12 +++++++----- src/parser/ligodity/Version.ml | 1 - 4 files changed, 9 insertions(+), 7 deletions(-) delete mode 100644 src/parser/ligodity/Version.ml diff --git a/.gitignore b/.gitignore index 7483d1710..065477ab1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /dune-project *~ cache/* +Version.ml diff --git a/src/parser/ligodity/Lexer.mll b/src/parser/ligodity/Lexer.mll index 85ae4db48..9c2274f36 100644 --- a/src/parser/ligodity/Lexer.mll +++ b/src/parser/ligodity/Lexer.mll @@ -104,7 +104,7 @@ let keywords = Token.[ "and", None; "as", None; "asr", None; - "assert", None; + (* "assert", None;*) "class", None; "constraint", None; "do", None; diff --git a/src/parser/ligodity/Parser.mly b/src/parser/ligodity/Parser.mly index 76267b6d3..b21f4f1ec 100644 --- a/src/parser/ligodity/Parser.mly +++ b/src/parser/ligodity/Parser.mly @@ -179,11 +179,13 @@ tuple(item): (* Possibly empty semicolon-separated values between brackets *) list_of(item): - lbracket sepseq(item,semi) rbracket { - {opening = LBracket $1; - elements = $2; - terminator = None; - closing = RBracket $3} } + lbracket sep_or_term_list(item,semi) rbracket { + let elements, terminator = $2 in { + opening = LBracket $1; + elements = Some elements; + terminator; + closing = RBracket $3} + } (* Main *) diff --git a/src/parser/ligodity/Version.ml b/src/parser/ligodity/Version.ml deleted file mode 100644 index d89964cb1..000000000 --- a/src/parser/ligodity/Version.ml +++ /dev/null @@ -1 +0,0 @@ -let version = "UNKNOWN" From 37c2152fca1b9d1fc97d432aec6a982ae6399fcd Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Mon, 10 Jun 2019 19:59:22 +0200 Subject: [PATCH 2/2] Fixed the regression introducted by the previous commit (disallowing empty lists). --- src/parser/ligodity/Parser.mly | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parser/ligodity/Parser.mly b/src/parser/ligodity/Parser.mly index b21f4f1ec..b453e6fae 100644 --- a/src/parser/ligodity/Parser.mly +++ b/src/parser/ligodity/Parser.mly @@ -186,6 +186,11 @@ list_of(item): terminator; closing = RBracket $3} } +| lbracket rbracket { + {opening = LBracket $1; + elements = None; + terminator = None; + closing = RBracket $2} } (* Main *)