From c7fb71d493b01be1521f4cc1362625a67e9202b0 Mon Sep 17 00:00:00 2001 From: Tim Whiting Date: Sat, 9 Dec 2023 08:45:07 -0700 Subject: [PATCH] remove mod keyword --- doc/spec/grammar/lexer.l | 1 - doc/spec/grammar/parser.y | 6 +----- doc/spec/spec.kk.md | 4 ++-- support/pygments/koka.py | 4 ++-- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/doc/spec/grammar/lexer.l b/doc/spec/grammar/lexer.l index 82f744647..5fa2929bd 100644 --- a/doc/spec/grammar/lexer.l +++ b/doc/spec/grammar/lexer.l @@ -169,7 +169,6 @@ match { return MATCH;} return { return RETURN;} module { return MODULE;} -mod { return MOD;} import { return IMPORT;} pub { return PUB;} as { return AS;} diff --git a/doc/spec/grammar/parser.y b/doc/spec/grammar/parser.y index 6bc2ed748..450ab5b75 100644 --- a/doc/spec/grammar/parser.y +++ b/doc/spec/grammar/parser.y @@ -115,14 +115,10 @@ void printDecl( const char* sort, const char* name ); -- Program ----------------------------------------------------------*/ -program : semis modkeyword modulepath moduledecl { printDecl("module",$3); } +program : semis MODULE modulepath moduledecl { printDecl("module",$3); } | moduledecl { printDecl("module","main"); } ; -modkeyword : MODULE - | MOD - ; - moduledecl : '{' semis modulebody '}' semis | semis modulebody ; diff --git a/doc/spec/spec.kk.md b/doc/spec/spec.kk.md index 11b5e2d2c..3374709bd 100644 --- a/doc/spec/spec.kk.md +++ b/doc/spec/spec.kk.md @@ -99,7 +99,7 @@ grammar will draw it's lexemes from the _lex_ production. | _idfinal_ | ::= | [``'``]{.many} | | |   | | | | | _reserved_ | ::= | `infix` &bar; `infixr` &bar; `infixl` | | -| | &bar; | ``module`` &bar; `mod` &bar; `import` &bar; `as` | | +| | &bar; | ``module`` &bar; `import` &bar; `as` | | | | &bar; | ``pub`` &bar; `abstract` | | | | &bar; | `type` &bar; `struct` &bar; `alias` &bar; `effect` &bar; `con` | | | | &bar; | `forall` &bar; `exists` &bar; `some` | | @@ -485,7 +485,7 @@ ignored. |~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~| | _module_~[_lex_]{.opt}~ | ::= | [_moduledecl_]{.opt} _modulebody_ | | |   | | | | -| _moduledecl_ | ::= | _semis_ (`module` &bar; `mod`) _moduleid_ | | +| _moduledecl_ | ::= | _semis_ `module` _moduleid_ | | | _moduleid_ | ::= | _qvarid_ &bar; _varid_ | | |   | | | | | _modulebody_ | ::= | `{` _semis_ _declarations_ `}` _semis_ | | diff --git a/support/pygments/koka.py b/support/pygments/koka.py index ca2e5e0f6..34b63ac10 100644 --- a/support/pygments/koka.py +++ b/support/pygments/koka.py @@ -25,7 +25,7 @@ class KokaLexer(RegexLexer): keywords = [ 'infix', 'infixr', 'infixl', - 'module', 'import', 'as', 'mod' + 'module', 'import', 'as', 'pub', 'abstract', 'ctx' 'type', 'struct', 'alias', 'effect', 'con', 'forall', 'exists', 'some', @@ -87,7 +87,7 @@ class KokaLexer(RegexLexer): # special sequences of tokens (we use ?: for non-capturing group as # required by 'bygroups') - (r'(module|mod)(\s+)(interface\s+)?((?:[a-z]\w*/)*[a-z]\w*)', + (r'(module)(\s+)(interface\s+)?((?:[a-z]\w*/)*[a-z]\w*)', bygroups(Keyword, Text, Keyword, Name.Namespace)), (r'(import)(\s+)((?:[a-z]\w*/)*[a-z]\w*)' r'(?:(\s*)(=)(\s*)((?:qualified\s*)?)'