aboutsummaryrefslogtreecommitdiff
path: root/frontend/parse.icl
diff options
context:
space:
mode:
authorronny2001-12-18 09:14:24 +0000
committerronny2001-12-18 09:14:24 +0000
commit58b6428ef405dfc5114ac421c32f843a4e00596d (patch)
tree7d3df0c7556bf5663cc834a21e2efd124c62d972 /frontend/parse.icl
parentrestored cocl.prj, compilerSwitches.{icl,dcl} because the cvs-versions (diff)
bug fix: allow local functions with no arguments and a code block rhs
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@946 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/parse.icl')
-rw-r--r--frontend/parse.icl14
1 files changed, 7 insertions, 7 deletions
diff --git a/frontend/parse.icl b/frontend/parse.icl
index 68877e5..ef5b6fd 100644
--- a/frontend/parse.icl
+++ b/frontend/parse.icl
@@ -5,8 +5,6 @@ import scanner, syntax, hashtable, utilities, predef, compilerSwitches
ParseOnly :== False
-//import RWSDebug
-
toLineAndColumn {fp_line, fp_col}
= {lc_line = fp_line, lc_column = fp_col}
@@ -554,8 +552,14 @@ where
combine_args [arg] = arg
combine_args args = PE_List args
want_rhs_of_def parseContext (Yes (name, False), []) token pos pState
+ # code_allowed = token == EqualToken
| isIclContext parseContext && isLocalContext parseContext && (token == EqualToken || token == DefinesColonToken) &&
/* PK isLowerCaseName name.id_name && */ not (isClassOrInstanceDefsContext parseContext)
+ # (token, pState) = nextToken FunctionContext pState
+ | code_allowed && token == CodeToken
+ # (rhs, pState) = wantCodeRhs pState
+ = (PD_Function pos name False [] rhs (FK_Function cNameNotLocationDependent), pState)
+ # pState = tokenBack pState
# (rhs, _, pState) = wantRhs False (RhsDefiningSymbolExact token) (tokenBack pState)
| token == EqualToken
= (PD_Function pos name False [] rhs FK_NodeDefOrFunction, pState)
@@ -1143,9 +1147,7 @@ wantClassDefinition parseContext pos pState
# (begin_members, pState) = begin_member_group token pState
| begin_members
# (class_id, pState) = stringToIdent class_or_member_name IC_Class pState
-// RWS ... (members, pState) = wantDefinitions (SetLocalContext parseContext) pState
(members, pState) = wantDefinitions (SetClassOrInstanceDefsContext parseContext) pState
-// ... RWS
class_def = { class_name = class_id, class_arity = class_arity, class_args = class_args,
class_context = contexts, class_pos = pos, class_members = {}, class_cons_vars = class_cons_vars,
class_dictionary = { ds_ident = { class_id & id_info = nilPtr }, ds_arity = 0, ds_index = NoIndex},
@@ -1245,9 +1247,7 @@ wantInstanceDeclaration parseContext pi_pos pState
| isIclContext parseContext
# // PK pState = tokenBack pState // AA
pState = want_begin_group token pState
-// RWS ... (pi_members, pState) = wantDefinitions (SetLocalContext parseContext) pState
(pi_members, pState) = wantDefinitions (SetClassOrInstanceDefsContext parseContext) pState
-// ... RWS
pState = wantEndGroup "instance" pState
= (PD_Instance {pi_class = pi_class, pi_ident = pi_ident, pi_types = pi_types, pi_context = pi_context,
@@ -2862,7 +2862,7 @@ where
want_updates type token pState
# (updates, pState)
= parse_updates token pState
-// RWS +++ error message if updates == []
+// RWS FIXME error message if updates == []
= (updates, pState)
where
parse_updates :: Token ParseState -> ([NestedUpdate], ParseState)