MCPcopy Create free account
hub / github.com/MirrowApp/mirrow / parseVariableReference

Method parseVariableReference

packages/core/src/compiler/parser.ts:858–880  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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,

Callers 2

parseAttributeValueMethod · 0.95
parseTupleItemMethod · 0.95

Calls 1

consumeMethod · 0.95

Tested by

no test coverage detected