From 46616561127654d68e9f8bf60e35ac6edc0d94ec Mon Sep 17 00:00:00 2001 From: Manas Date: Sun, 29 Sep 2019 09:06:32 +0530 Subject: [PATCH] Optional semicolon in the require syntax (#63) --- .../pesy-npm-scoped/package.json | 4 ++-- lib/Lexer.mll | 1 + lib/Parser.mly | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/e2e-tests/pesy-configure-test-projects/pesy-npm-scoped/package.json b/e2e-tests/pesy-configure-test-projects/pesy-npm-scoped/package.json index 6b0b75a5..62816c87 100644 --- a/e2e-tests/pesy-configure-test-projects/pesy-npm-scoped/package.json +++ b/e2e-tests/pesy-configure-test-projects/pesy-npm-scoped/package.json @@ -21,8 +21,8 @@ "library/foo/bar": {}, "executable": { "imports": [ - "Bar = require('@my-scope/pesy-npm/library/foo/bar')", - "Library = require('@my-scope/pesy-npm/library')" + "Bar = require('@my-scope/pesy-npm/library/foo/bar');", + "Library = require('@my-scope/pesy-npm/library');" ], "bin": { "pesy-npm-app.exe": "PesyNpmApp.re" diff --git a/lib/Lexer.mll b/lib/Lexer.mll index 6b885cdf..dbf06558 100644 --- a/lib/Lexer.mll +++ b/lib/Lexer.mll @@ -6,6 +6,7 @@ rule read = parse [' ' '\t'] { read lexbuf } (* skip blanks *) | ['('] { LPAREN } | [')'] { RPAREN } +| [';'] { SEMICOLON } | ['='] { ASSN } | "require" { REQUIRE } | ['\''] { SQUOTE } diff --git a/lib/Parser.mly b/lib/Parser.mly index 09a5160e..b76985a6 100644 --- a/lib/Parser.mly +++ b/lib/Parser.mly @@ -1,4 +1,4 @@ -%token LPAREN RPAREN +%token LPAREN RPAREN SEMICOLON %token EOL ASSN SQUOTE EOF REQUIRE %token MODULE_NAME %token MODULE_PATH @@ -6,5 +6,6 @@ %type main %% main: - MODULE_NAME ASSN REQUIRE LPAREN SQUOTE MODULE_PATH SQUOTE RPAREN EOF { ($1, $6) } + MODULE_NAME ASSN REQUIRE LPAREN SQUOTE MODULE_PATH SQUOTE RPAREN EOF { ($1, $6) } + | MODULE_NAME ASSN REQUIRE LPAREN SQUOTE MODULE_PATH SQUOTE RPAREN SEMICOLON EOF { ($1, $6) } ;