what was strange is that this version

<whitespace> : \s+;

%root MultiListObject;
%prefix XPML;
modifiers_opt
:
| modifiers
;
modifiers
: modifier 'modifier' {{}}
| modifiers modifier 'modifier' {{}}
;
modifier
: "public" 'token' {{Modifier}}
| "protected" 'token' {{Modifier}}
| "private" 'token' {{Modifier}}
| "static" 'token' {{Modifier}}
;


did not accept 'public static'

I found that there were obsolete classes around and I reloaded SmaCC in a
fresh image
then regenerate this and my test pass now. So I will do the same for my
solidity parser.


On Mon, Mar 27, 2017 at 6:40 PM, Stephane Ducasse <stepharo.s...@gmail.com>
wrote:

> Apparently there is an interaction with the root directives.
>
> On Mon, Mar 27, 2017 at 6:34 PM, Stephane Ducasse <stepharo.s...@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.s...@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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>

Reply via email to