I'm not seeing a Rule.getRuleModifier() method.

The modifier field is only used in two places. One is CSharp3.stg, where the
change will make it work correctly. I'm using the following template
expression, with the hope that "private" is used whenever no rule modifier
is given.

csharpVisibilityMap ::= [
        "private":"private",
        "protected":"protected",
        "public":"public",
        "fragment":"private",
        default:"private"
]

...

<csharpVisibilityMap.(ruleDescriptor.modifier)>



The other usage is in Ruby.stg, where it's gated as follows:

<if(ruleDescriptor.modifier)>...<endif>

If StringTemplate evaluates this condition the same way for a null string
and an empty string, then there is no change. Otherwise, the change would
could cause a problem for this template.

Sam

-----Original Message-----
From: Terence Parr [mailto:[email protected]] 
Sent: Sunday, November 28, 2010 3:40 PM
To: Sam Harwell
Cc: 'Johannes Luber'; [email protected]
Subject: Re: please remove hasDelegates

Are you sure this won't mess something else up?  What template expr are you
using that messes up?  You're referencing Rule.getRuleModifier() right?

Ter

On Nov 28, 2010, at 1:28 PM, Sam Harwell wrote:

> Can you also update the modifier field as mentioned in the last 
> paragraph (to an empty string instead of null)?
> 
> Thanks,
> Sam

>> The Java version of the tool does properly track the rule modifiers.
>> However, when the modifier isn't specified, the 'modifier' field in 
>> Rule.java defaults to null. Due to the early out in 
>> ASTExpr.getObjectProperty, a null value doesn't end up pulling the 
>> default value from the map defined in my template. If you use an 
>> empty string in Grammar.defineRule whenever the modifier argument is 
>> null, it corrects the issue.
>> 
>> Sam
> 
> 


_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to