operator [] method
When we create these from strings or from AST nodes, we want to look up and set their attributes by string names, so we override the indexing operators so that they behave like maps with respect to those attribute names.
Implementation
Message? operator [](String attributeName) {
switch (attributeName) {
case "zero":
return zero;
case "=0":
return zero;
case "one":
return one;
case "=1":
return one;
case "two":
return two;
case "=2":
return two;
case "few":
return few;
case "many":
return many;
case "other":
return other;
default:
return other;
}
}