[antlr-interest] @lexer::header{} or @parser::header{} doesn't work in v3
Austin Hastings
Austin_Hastings at Yahoo.com
Tue Oct 16 02:24:55 PDT 2007
The structure of an ANTLR file:
/** This is a document comment */
grammarType grammar name;
«optionsSpec»
«tokensSpec»
«attributeScopes»
«actions»
/** doc comment */
rule1 : ... | ... | ... ;
rule2 : ... | ... | ... ;
The @header/@members blocks are considered "actions".
=Austin
Peizhao Hu wrote:
> I tried it as well, then it will complaint about tokens{}
> :-(
>
>
> regards;
>
> Peizhao
>
>
> Guillaume Chavanon wrote:
>> Hi,
>>
>> Try writing options{...} before lexer/parser::header{...}
>>
>> Peizhao Hu wrote:
>>> Hi All,
>>>
>>> I tried the following statements in my grammar. when I compiled it,
>>> it throws out error saying "unexpected token: options {", which is
>>> the next statement of setting options
>>>
>>>
>>> @parser::header{
>>> package com.nicta.safe.ACoMS.sensor.teds;
>>> }
>>> @lexer::header{
>>> package com.nicta.safe.ACoMS.sensor.teds;
>>> }
>>>
>>> options {
>>> output=AST; /* output AST */
>>> k=2;
>>> }
>>>
>>> I tried to replace package with import statement, but the same problem.
>>
>> --
>> Systems'ViP
>> (Boost your R&D efficiency, implement the functional Virtual
>> Prototyping with us) <http://www.systemsvip.com>
>>
>>
>> *Guillaume Chavanon*
>> /
>> / 4 Rue Boussingault
>> F - 67000 Strasbourg
>> <http://www.systemsvip.com>
>> guillaume.chavanon at systemsvip.com
>> <mailto:guillaume.chavanon at systemsvip.com>
>> www.systemsvip.com <http://www.systemsvip.com>
>> tel: +33 811 036 094
>> fax: +33 874 761 346
>>
>>
>>
>> This e-mail, including attachments, is intended for the person(s) or
>> company named and may contain confidential and/or legally privileged
>> information. Unauthorized disclosure, copying or use of this
>> information may be unlawful and is prohibited. If you are not the
>> intended recipient,please delete this message and notify the sender
>
>
More information about the antlr-interest
mailing list