Hi I'm new to the list, 

 

I've created a custom test suite for the php runtime:

http://code.google.com/p/antlrphpruntime/

 

I'd like to test some improvements but I'm having a hard time finding the
tests I should be running.

 

For example: <http://code.google.com/p/antlrphpruntime/> 

https://github.com/antlr/antlr/blob/master/runtime/Python/tests/t022scopes.g

 

/* recursive rule scopes, access with negative index */

 

f returns [res]

scope {

    a

}

@after {

    $res = $f::a;

}

    : NUM { $f[-2]::a = int($NUM.text); }

    | '{' f '}'

    ;

 

It seems that python and java have different implementations for a "negative
index":

 

JAVA

scopeSetAttributeRef(scope,attr,expr,index,negIndex) ::= <<
<if(negIndex)>
((<scope>_scope)<scope>_stack.elementAt(<scope>_stack.size()-<negIndex>-1)).
<attr.name> =<expr>;
<else>

 

PYTHON

scopeSetAttributeRef(scope,attr,expr,index,negIndex) ::= <<

<if(negIndex)>

<!FIXME: this seems not to be used by ActionTranslator...!>

self.<scope>_stack[-<negIndex>].<attr.name> = <expr>

<else>

 

Questions:

-          Is there a test suite (i.e. for java) I should be looking at?

-          Any documentation/more examples on recursive rules scope and what
this test does? What is special about negIndex? 

 

Thanks J 

_______________________________________________
antlr-dev mailing list
antlr-dev@antlr.org
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to