Let me make this clear, I have this listing:
enum Token {
Number(v:Float);
Identifier(v:String);
TString(v:String);
Var;
Assign;
Division;
}
I want to check if the value of a variable is an identifier, but this does not work:
if(tk == Token.Identifier) {
This allows me to compare values if I pass arguments:
if(tk == Token.Identifier('test')) {
But this will only match if the identifier is a “test”, but I want to match any identifier.
user216441
source
share