From 80f928e6c905f1e9d5948a5776e663da4c410e75 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 6 Mar 2017 23:33:45 +0100 Subject: Allow module on lower levels --- README.md | 17 ++++++++++++++++- frontend/parse.icl | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e95ea5e..a0e90e9 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ This is a fork to implement experimental new features. ## Contents 1\. [Syntactic sugar](#1-syntactic-sugar) -1.1. [Lambda-case](#11-lambda-case) +1.1. [Lambda-case](#11-lambda-case) +2\. [Syntax changes](#2-syntax-changes) +2.1. [Use of the `module` keyword](#21-use-of-the-module-keyword) --- @@ -48,6 +50,19 @@ LambdaAbstr = ... | \case of {CaseAltDef}+ ``` +## 2. Syntax changes + +### 2.1. Use of the `module` keyword + +The `module` keyword is only a keyword on the topmost level. This allows for +using it as a record field, for example: + +```clean +:: MyType = { module :: Int } +``` + +However, it is not allowed to define a function named `module`. + [clean]: http://clean.cs.ru.nl [cocl]: https://svn.cs.ru.nl/repos/clean-compiler/ [ghclambdacase]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#lambda-case diff --git a/frontend/parse.icl b/frontend/parse.icl index 03a968d..95e7b9d 100644 --- a/frontend/parse.icl +++ b/frontend/parse.icl @@ -5213,7 +5213,7 @@ wantNonUpperCaseName string pState */ wantLowerCaseName :: !String !ParseState -> (!String, !ParseState) wantLowerCaseName string pState - # (token, pState) = nextToken GeneralContext pState + # (token, pState) = nextToken TypeContext pState = case token of IdentToken name | isLowerCaseName name -- cgit v1.2.3