Posted 20 years ago
by Greg Shaffer
- Boulder
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
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