Commit 5a514e34 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: better parsing for properties


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent d0cb4f74
...@@ -4543,12 +4543,15 @@ pr_SingleVarInstance[Type type, parameterEvaluationType eval] returns[Def_Var de ...@@ -4543,12 +4543,15 @@ pr_SingleVarInstance[Type type, parameterEvaluationType eval] returns[Def_Var de
$definition = null; $definition = null;
Value value = null; Value value = null;
ArrayDimensions dimensions = null; ArrayDimensions dimensions = null;
boolean isProperty = false;
}: }:
( i = pr_Identifier ( ( PROPERTYKEYWORD { isProperty = true; } )?
i = pr_Identifier
( d = pr_ArrayDef { dimensions = $d.dimensions; })? ( d = pr_ArrayDef { dimensions = $d.dimensions; })?
( pr_AssignmentChar ( pr_AssignmentChar
v = pr_VarInitialValue { value = $v.value; } v = pr_VarInitialValue { value = $v.value; }
)? )?
pr_PropertyBody?
) )
{ {
if ($i.identifier != null) { if ($i.identifier != null) {
...@@ -9155,7 +9158,6 @@ pr_ClassMember returns[List<Definition> definitions] ...@@ -9155,7 +9158,6 @@ pr_ClassMember returns[List<Definition> definitions]
$definitions.add( $cl.def_type ); $definitions.add( $cl.def_type );
} }
} }
| pr_PropertyDef
) )
) )
{ {
...@@ -9396,34 +9398,42 @@ pr_SelectClassCase: ...@@ -9396,34 +9398,42 @@ pr_SelectClassCase:
SEMICOLON? SEMICOLON?
); );
pr_PropertyDef: pr_PropertyBody:
( (
PROPERTYKEYWORD pr_BeginChar
t = pr_Type ( pr_PropertyGetter pr_PropertySetter?
i = pr_Identifier | pr_PropertySetter pr_PropertyGetter?
)
pr_EndChar
);
pr_PropertyGetter:
(
( PUBLIC | PRIVATE )?
( pr_AbstractModifier | pr_FinalModifier )?
DETERMINISTICKEYWORD?
GETKEYWORD
( (
pr_BeginChar
( (
( vis1 = pr_OopVisibility )? CLASSCASTING
( ABSTRACTKEYWORD pr_TemplateBody
| FINALKEYWORD | pr_StatementBlock
| DETERMINISTICKEYWORD )
)?
GETKEYWORD
( CLASSCASTING pr_TemplateBody
| sb1 = pr_StatementBlock )?
SEMICOLON?
|
( vis2 = pr_OopVisibility )?
( ABSTRACTKEYWORD
| FINALKEYWORD
| DETERMINISTICKEYWORD
)?
SETKEYWORD
( CLASSCASTING pr_TemplateBody
| sb2 = pr_StatementBlock )?
SEMICOLON?
)*
pr_EndChar
)? )?
SEMICOLON?
);
pr_PropertySetter:
(
( PUBLIC | PRIVATE )?
( pr_AbstractModifier | pr_FinalModifier )?
DETERMINISTICKEYWORD?
SETKEYWORD
(
( CLASSCASTING
pr_TemplateBody
| pr_StatementBlock
)
)?
SEMICOLON?
); );
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment