vendredi 28 juin 2019

Label generation in Antlr4 with C++ does not allow accessing the label value

I have an old grammar that I had working with some Java code, I'm changing the generation now in Cpp.

My rule contains a label but when I'm implementing the Listener upon enter rule, there is no way to get the value of the item by label

the rule is :

msg : 
    destination=address
    time
    sender=address
;

My old code in Java was like this:

MyMessage.setDestinationAddess(ctx.destination.getText());

but some how now in CPP I can see that in the generated base listener the destination label is used to generate a nullptr that is never used.

MessageGrammar::AddressContext *destination = nullptr;

I'm I doing something wrong? are the labels not used in the CPP generation ?

Aucun commentaire:

Enregistrer un commentaire