3 ms·
Can you define a const array with type Array<TokenId> and use it every time you want to loop through these keys?
by lozenge 4y ago
Can you define a const array with type Array<TokenId> and use it every time you want to loop through these keys?
- shadowofneptune 4y agoThat's a possibility, yes. This is the only time in the program that a token table is iterated through, however. Most of the time a table is consulted to pursue an action in the parser. For example, there's a function table for when a statement is encountered, another for when an expression operand is encountered, etc. Each entry in the table is either an error message or code which completes the parsing of that statement. The awkwardness above is excusable when it is encountered so little. When writing expression-heavy stuff like 'Object.keys(typedObjName).map(...)' it's more of a problem.