Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
fe8b612e
Commit
fe8b612e
authored
May 27, 2004
by
John van Groningen
Browse files
report a parse error if an instance definition contains a
nodedef after 'where', instead of aborting in postparse
parent
5a2408ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/parse.icl
View file @
fe8b612e
...
...
@@ -276,7 +276,7 @@ isGlobalContext parseContext :== parseContext bitand cGlobalContext <> 0 // not
isDclContext
parseContext
:==
parseContext
bitand
cICLContext
==
0
isIclContext
parseContext
:==
parseContext
bitand
cICLContext
<>
0
// not (isDclContext parseContext)
isClassOrInstanceDefsContext
parseContext
:==
parseContext
bitand
cClassOrInstanceDefsContext
<>
0
is
Not
ClassOrInstanceDefsContext
parseContext
:==
parseContext
bitand
cClassOrInstanceDefsContext
==
0
isGlobalOrClassOrInstanceDefsContext
parseContext
:==
parseContext
bitand
(
cGlobalContext
bitor
cClassOrInstanceDefsContext
)
<>
0
cWantIclFile
:==
True
...
...
@@ -528,9 +528,11 @@ where
#
(
ss_useLayout
,
pState
)
=
accScanState
UseLayout
pState
localsExpected
=
~
ss_useLayout
(
rhs
,
_,
pState
)
=
wantRhs
localsExpected
(
ruleDefiningRhsSymbol
parseContext
)
(
tokenBack
pState
)
|
isGlobalContext
parseContext
=
(
PD_NodeDef
pos
(
combine_args
args
)
rhs
,
parseError
"RHS"
No
"<global definition>"
pState
)
=
(
PD_NodeDef
pos
(
combine_args
args
)
rhs
,
pState
)
|
isLocalContext
parseContext
|
isNotClassOrInstanceDefsContext
parseContext
=
(
PD_NodeDef
pos
(
combine_args
args
)
rhs
,
pState
)
=
(
PD_NodeDef
pos
(
combine_args
args
)
rhs
,
parseError
"RHS"
No
"<class or instance definition>"
pState
)
=
(
PD_NodeDef
pos
(
combine_args
args
)
rhs
,
parseError
"RHS"
No
"<global definition>"
pState
)
where
want_node_def_token
s
EqualToken
=
s
want_node_def_token
s
DefinesColonToken
=
s
// PK replaceToken EqualToken s
...
...
@@ -541,7 +543,7 @@ where
want_rhs_of_def
parseContext
(
Yes
(
name
,
False
),
[])
definingToken
pos
pState
#
code_allowed
=
definingToken
==
EqualToken
|
isIclContext
parseContext
&&
isLocalContext
parseContext
&&
(
definingToken
==
EqualToken
||
definingToken
==
DefinesColonToken
)
&&
/* PK isLowerCaseName name.id_name && */
not
(
is
ClassOrInstanceDefsContext
parseContext
)
/* PK isLowerCaseName name.id_name && */
isNot
ClassOrInstanceDefsContext
parseContext
#
(
token
,
pState
)
=
nextToken
FunctionContext
pState
|
code_allowed
&&
token
==
CodeToken
#
(
rhs
,
pState
)
=
wantCodeRhs
pState
...
...
@@ -576,6 +578,7 @@ where
FK_Caf
|
isNotEmpty
args
->
(
PD_Function
pos
name
is_infix
[]
rhs
fun_kind
,
parseError
"CAF"
No
"No arguments for a CAF"
pState
)
_
->
(
PD_Function
pos
name
is_infix
args
rhs
fun_kind
,
pState
)
check_name_and_fixity
No
hasprio
pState
=
(
erroneousIdent
,
False
,
parseError
"Definition"
No
"identifier"
pState
)
check_name_and_fixity
(
Yes
(
name
,
is_infix
))
hasprio
pState
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment