public override LogicalOperation VisitIdentifier(LogicalGrammarParser.IdentifierContext context) { string id = context.GetText(); if (Variables.ContainsKey(id)) { return(new LogicalVariableUsage(Variables[id])); } var variable = new LogicalVariable(id); Variables.Add(id, variable); return(new LogicalVariableUsage(variable)); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null || this.GetType() != obj.GetType()) { return(false); } LogicalVariable other = (LogicalVariable)obj; if (variableName != null ? !variableName.Equals(other.variableName) : other.variableName != null) { return(false); } return(true); }
public override void ExitLogicalVariable([NotNull] RuleSetGrammarParser.LogicalVariableContext context) { LogicalVariable variable = new LogicalVariable(context.GetText()); this.logicalExpressions.Push(variable); }