Posted 15 years ago by Greg Shaffer - Boulder
Avatar
I noticed that I can figure out what type a token is by looking at the token's key property. Where are these strings defined? Is there an enumeration somewhere? Do you have const strings defined?

I'm talking about "PunctuationToken, IdentifierToken, WhitespaceToken, etc."

I figure that if I'm to populate my token's ISemanticParseData in the PostParse function of a semantic parser that I'd want to optimize my code for performance sake. In other words, I'd like to avoid doing unnecessary string comparisions, which means that I'm hoping there's an enumeration.

I'm also not sure why this field is named "key". If it is only a type, then maybe a name like "TokenType" might be more appropriate.

Or, maybe I'm not supposed to be using that field?

Thanks,
Greg

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Those are strings you define in your language definition files. Strings are generally keys. We may add a numeric id value as well for a future version that would allow for faster compares to enumerations that you can define.


Actipro Software Support

Posted 15 years ago by Greg Shaffer - Boulder
Avatar
Ah Ha...

Thanks,
Greg
The latest build of this product (v2018.1 build 0341) was released 7 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.