()
| 856 | } |
| 857 | |
| 858 | private parseVariableReference(): VariableReference { |
| 859 | const token = this.consume( |
| 860 | TokenType.DOLLAR, |
| 861 | "Expected variable reference" |
| 862 | ); |
| 863 | |
| 864 | // Extract the variable name (remove the $ prefix) |
| 865 | const variableName = token.value.substring(1); |
| 866 | |
| 867 | // Validate that the variable has been declared |
| 868 | if (!this.symbolTable.has(variableName)) { |
| 869 | throw new ParserError( |
| 870 | `Variable '$${variableName}' is not defined`, |
| 871 | token.position |
| 872 | ); |
| 873 | } |
| 874 | |
| 875 | return { |
| 876 | type: "VariableReference", |
| 877 | name: variableName, |
| 878 | position: token.position, |
| 879 | }; |
| 880 | } |
| 881 | |
| 882 | private validateAttributeValue<T extends AttributeSpec>( |
| 883 | keyword: Keyword, |
no test coverage detected