No, I confused right for lack of return type of this methods. The method
query() that parse entire query has return type boid. It is only modify the
state of the parser class state._fsp located in base class of Parser:
RecognizerSharedState. I suppose that after calling this method I must to
use standart feature of ANTLR for generating AST tree from this state.
This is a code of query() method that mutch query:
public final void query() throws RecognitionException {
try {
// C:\\Documents and
Settings\\rushan\\data\\workspace\\devel\\ANTLR\\sparkle-g-2.0\\src\\com\\sparkleg\\Sparql.g:36:5:
( prologue ( selectQuery | constructQuery | describeQuery | askQuery ) EOF )
// C:\\Documents and
Settings\\rushan\\data\\workspace\\devel\\ANTLR\\sparkle-g-2.0\\src\\com\\sparkleg\\Sparql.g:36:7:
prologue ( selectQuery | constructQuery | describeQuery | askQuery ) EOF
{
pushFollow(FOLLOW_prologue_in_query36);
prologue();
state._fsp--;
// C:\\Documents and
Settings\\rushan\\data\\workspace\\devel\\ANTLR\\sparkle-g-2.0\\src\\com\\sparkleg\\Sparql.g:36:16:
( selectQuery | constructQuery | describeQuery | askQuery )
int alt1=4;
switch ( input.LA(1) ) {
case SELECT:
{
alt1=1;
}
break;
case CONSTRUCT:
{
alt1=2;
}
break;
case DESCRIBE:
{
alt1=3;
}
break;
case ASK:
{
alt1=4;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 1, 0, input);
throw nvae;
}
switch (alt1) {
case 1 :
// C:\\Documents and
Settings\\rushan\\data\\workspace\\devel\\ANTLR\\sparkle-g-2.0\\src\\com\\sparkleg\\Sparql.g:36:18:
selectQuery
{
pushFollow(FOLLOW_selectQuery_in_query40);
selectQuery();
state._fsp--;
}
break;
case 2 :
// C:\\Documents and
Settings\\rushan\\data\\workspace\\devel\\ANTLR\\sparkle-g-2.0\\src\\com\\sparkleg\\Sparql.g:36:32:
constructQuery
{
pushFollow(FOLLOW_constructQuery_in_query44);
constructQuery();
state._fsp--;
}
break;
case 3 :
// C:\\Documents and
Settings\\rushan\\data\\workspace\\devel\\ANTLR\\sparkle-g-2.0\\src\\com\\sparkleg\\Sparql.g:36:49:
describeQuery
{
pushFollow(FOLLOW_describeQuery_in_query48);
describeQuery();
state._fsp--;
}
break;
case 4 :
// C:\\Documents and
Settings\\rushan\\data\\workspace\\devel\\ANTLR\\sparkle-g-2.0\\src\\com\\sparkleg\\Sparql.g:36:65:
askQuery
{
pushFollow(FOLLOW_askQuery_in_query52);
askQuery();
state._fsp--;
}
break;
}
match(input,EOF,FOLLOW_EOF_in_query56);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
--
View this message in context:
http://n2.nabble.com/Creating-AST-with-third-party-grammar-tp4524691p4542892.html
Sent from the ANTLR mailing list archive at Nabble.com.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.