public SymbolReference TryParseBasicRef(Expression compositeOuter = null) { Func <ASTNode> refParser = () => { var token = Tokens.ConsumeToken(TokenType.Word); if (token == null) { return(null); } ASTNode symbol = null; FunctionCall func = compositeOuter as FunctionCall; SymbolReference outer = compositeOuter as SymbolReference; if (func != null) { var containingClass = NodeUtils.GetContainingClass(func.ResolveType().Declaration); if (!Symbols.TryGetSymbolFromSpecificScope(token.Value, out symbol, containingClass.GetInheritanceString() + "." + func.Function.Name)) { return(Error("Left side has no member named '" + func.Function.Name + "'!", token.StartPosition, token.EndPosition)); } } else if (outer != null) { var containingClass = NodeUtils.GetContainingClass(outer.ResolveType().Declaration); if (!Symbols.TryGetSymbolFromSpecificScope(token.Value, out symbol, containingClass.GetInheritanceString() + "." + outer.ResolveType().Name)) { return(Error("Left side has no member named '" + outer.Name + "'!", token.StartPosition, token.EndPosition)); } } else { if (!Symbols.TryGetSymbol(token.Value, out symbol, NodeUtils.GetOuterClassScope(Node))) { return(Error("No symbol named '" + token.Value + "' exists in the current scope!", token.StartPosition, token.EndPosition)); } } return(new SymbolReference(symbol, token.StartPosition, token.EndPosition, token.Value)); }; return((SymbolReference)Tokens.TryGetTree(refParser)); }