Apparently there is an interaction with the root directives.��

On Mon, Mar 27, 2017 at 6:34 PM, Stephane Ducasse <stepharo.self@gmail.com> wrote:
Now I tried to hook modifier logic to test and I cannot have two modifiers.
I thought that��

modifiers��
: modifier 'modifier'
| modifiers modifier 'modifier'
;
allows one to have 'public static' but apparently not so I'm totally confused.


On Mon, Mar 27, 2017 at 6:30 PM, Stephane Ducasse <stepharo.self@gmail.com> wrote:
Hi john

I'm learning smacc as a challenge :) I read a review the tutorial that we extracted form your doc.

I have the following expression��

FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )* ( 'returns' TypeNameList )?

and I started to handle the 'internal'....

Now my grammar does not succeed to parse
��(self parser parseFunctionTypeNameOptions: 'internal payable')

Attempt one: did not work
===================
FunctionTypeNameOptions
: {{}}
| ��FunctionTypeNameOptions "internal" 'option' {{}}
| ��FunctionTypeNameOptions "external" 'option' {{}}
| ��FunctionTypeNameOptions "constant" 'option' {{}}
| ��FunctionTypeNameOptions "payable" 'option' {{}}


Attempt two: did not work
===================
FunctionTypeNameOptions
:��
| FunctTypeNameOptions
;
FunctTypeNameOptions
: ��FunctTypeNameOptions "internal" 'option' {{}}
| ��FunctTypeNameOptions "external" 'option' {{}}
| ��FunctTypeNameOptions "constant" 'option' {{}}
| ��FunctTypeNameOptions "payable" 'option' {{}}
;

Attempt three: did not work
=====================

FunctionTypeNameOptions
:��
| FunctTypeNameOptions
;

FunctTypeNameOptions
: FunctTypeNameOption 'option'
| FunctTypeNameOptions FunctTypeNameOption 'option'
;
FunctTypeNameOption
: ��"internal" 'option' {{}}
| ��"external" 'option' {{}}
| ��"constant" 'option' {{}}
| ��"payable" 'option' {{}}
;



I studied the JavaParser and I do not get why my version does not work��

modifiers_opt
:
| modifiers��
;
modifiers��
: modifier 'modifier'
| modifiers modifier 'modifier'
;
modifier��
: "public" 'token' {{Modifier}}
| "protected" 'token' {{Modifier}}
| "private" 'token' {{Modifier}}
| "static" 'token' {{Modifier}}
;


Thanks in advance. I could have try to do it in petitParser but I want to have a real experience with Smacc.��

Stef