why is there no Tag property on the Parser class?

26 views
Skip to first unread message

Brannon King

unread,
Sep 17, 2013, 3:27:41 PM9/17/13
to eto-...@googlegroups.com
When I deconstruct my successful result, I would like some easy access to data I had when I constructed the grammar. I had expected some kind of Tag property on the Parser so that I could use Match.Parser.Tag to get the data I had when I made the Parser object. Am I thinking about this incorrectly?

Curtis Wensley

unread,
Sep 17, 2013, 3:31:58 PM9/17/13
to eto-...@googlegroups.com
Hm, there is a Tag property on the match itself, so you can assign different values to each match.. but you're right there's no Tag on the Parser to be able to have a single object available for all matches.

This would be a good enhancement!  Could you enter an issue on github, or if you're inclined to implement it send a pull request?

Thanks!
Curtis.

Brannon King

unread,
Sep 17, 2013, 4:39:01 PM9/17/13
to eto-...@googlegroups.com
This is my temporary workaround:
 
public class TelemetryLiteralTerminal: LiteralTerminal
{
 public readonly TelemetryDefinitionModel Model;
 public TelemetryLiteralTerminal(TelemetryDefinitionModel model):base("[" + model.Name + "]")
 {
  Model = model;
 }
}

Curtis Wensley

unread,
Sep 17, 2013, 4:41:40 PM9/17/13
to Brannon King, eto-...@googlegroups.com

Sounds good.  I'll add the Tag property for the next version..


--
You received this message because you are subscribed to the Google Groups "Eto.Parse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eto-parse+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Brannon King

unread,
Sep 17, 2013, 6:43:36 PM9/17/13
to eto-...@googlegroups.com, Brannon King
As I've thought about this, I really need a small memory footprint for the parser tree. It seems that my workaround (of creating an inheritor of LiteralTerminal) is the more ideal solution.

Curtis Wensley

unread,
Sep 17, 2013, 10:20:32 PM9/17/13
to eto-...@googlegroups.com, Brannon King

Sounds good then (;
Reply all
Reply to author
Forward
0 new messages