[antlr-interest] Literals not handled in grammars with import

Thomas Brandon tbrandonau at gmail.com
Mon Aug 25 00:08:55 PDT 2008


In 31, imported literals are not being handled correctly in tree
grammars utilising import.

Given the included grammars, while TestTree.g works properly, in
TestTree2.g the literals are not correctly imported and new token
types are assigned. This occurs in both rules from the imported
grammar (tok1 in TestTree2_TestTree.java) and new rules in the
importing grammar (tok1_2 in TestTree2.java).

Tom.

<Test.g>
grammar Test;

tok1: 'tok1';
</Test.g>

<TestTree.g>
tree grammar TestTree;

options {
	tokenVocab=Test;
	ASTLabelType = CommonTree;
}

tok1:
	'tok1'
	;
</Test2.g>

<TestTree2.g>
tree grammar TestTree2;

options {
	tokenVocab=Test;
	ASTLabelType = CommonTree;
}

import TestTree;

tok1_2:
	'tok1'
	;
</TestTree2.g>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.g
Type: application/octet-stream
Size: 31 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080825/fd70a5b2/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestTree.g
Type: application/octet-stream
Size: 108 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080825/fd70a5b2/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestTree2.g
Type: application/octet-stream
Size: 131 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080825/fd70a5b2/attachment-0002.obj 


More information about the antlr-interest mailing list