public LexemVariable(string name, LexemValue value = null) : this() { if (String.IsNullOrEmpty(name)) throw new ArgumentException("Variable Name can't be null or empty"); this.Name = name; if (!CheckVariableName(this.Name)) throw new FormatException(String.Format($"Variable Name {this.Name} is incorrect")); this.Value = value; }
public LexemVariable Set(string name, LexemValue value) { if (value == null || String.IsNullOrEmpty(name)) return null; var variable = this.Get(name); if (variable == null) return this.Add(name, value); variable.Value = value; return variable; }
public virtual LexemVariable Execute(LexemValue argument, Lexem lexem) { if (this.OnLexemExecution != null) return this.OnLexemExecution(argument, lexem); return null; }
public LexemVariable Add(string name, LexemValue value) { var variable = new LexemVariable(name, value); _variables.Add(variable); return variable; }