All lex/yacc scanners/parsers are now generated with a proper dotnet nuget pkg, YaccLexTools. * Implements BooleanExpressionFilter with the new Parser.
28 lines
776 B
C#
28 lines
776 B
C#
namespace Bts.DataStreamExpressions;
|
|
|
|
using BCG;
|
|
|
|
class Assignment : StatementExpression {
|
|
readonly StatementExpression expression;
|
|
readonly string id;
|
|
|
|
public Assignment(string identifier, StatementExpression st) {
|
|
id = identifier;
|
|
expression = st;
|
|
}
|
|
|
|
public override string print(int startCol, IList<string> activeBindings) {
|
|
string prelude = id + " = ";
|
|
string result = prelude + expression.print(startCol + prelude.Length, activeBindings);
|
|
if (activeBindings.IndexOf(id) == -1)
|
|
activeBindings.Add(id);
|
|
return result;
|
|
}
|
|
|
|
public override ViewStream? myGetView(IDictionary<string, StatementExpression> env) {
|
|
var result = expression.getView(env);
|
|
env[id] = expression;
|
|
return result;
|
|
}
|
|
}
|