title: How to pass CommonTree parameter to an Antlr rule
body: <p>I am trying to do what I think is a simple parameter passing to a rule in Antlr 3.3:</p>
  
  <pre><code>grammar rule_params;
  
  
  options
  {
      output = AST;
  }
  
  rule_params
      :   outer;
  
  
  outer:  outer_id '[' inner[$outer_id.tree] ']';
  
  inner[CommonTree parent]    :   inner_id '['  ']';
  
  
  outer_id    : '#'! ID;
  
  inner_id    : '$'! ID ;
  
  
  ID   :  ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z' | '0'..'9' | '_' )* ;
  </code></pre>
  
  <p>So the <code>inner[CommonTree parent]</code> generates the following:</p>
  
  <pre><code>inner4=inner((outer_id2!=null?((Object)outer_id2.tree):null));
  </code></pre>
  
  <p>resulting in this error:</p>
  
  <pre><code>The method inner(CommonTree) in the type rule_paramsParser is not applicable for the arguments (Object)
  </code></pre>
  
  <p>As best I can tell, this is the exact same as the example in the Antrl book:</p>
  
  <pre><code>classDefinition[CommonTree mod]
  </code></pre>
  
  <p>(Kindle Location 3993) - sorry I don't know the page number but it is in the middle of the book in chapter 9, section labeled "Creating Nodes with Arbitrary Actions".</p>
  
  <p>Thanks for any help.</p>
  
  <p>M</p>