private DictAST Configure() { Eat(TokenType.LBRC); List <KeyValuePairAST> parameters = new List <KeyValuePairAST>(); while (true) { Backup(); KeyValuePairAST keyValuePairAST = Parameter(); if (currentToken.Type != TokenType.COMMA && currentToken.Type != TokenType.RBRC) { Restore(); keyValuePairAST = BlockParameter(); } parameters.Add(keyValuePairAST); if (currentToken.Type != TokenType.COMMA) { break; } else { Eat(TokenType.COMMA); } } Eat(TokenType.RBRC); return(new DictAST(parameters)); }
private KeyValuePair <string, object> Visit(KeyValuePairAST keyValuePairAST) { string key = Visit(keyValuePairAST.Key); object value = Visit(keyValuePairAST.Value); if (value is ILinkable linkable && !linkable.IsConfigured) { linkable.Configure(new Dict()); } return(new KeyValuePair <string, object>(key, value)); }