All lex/yacc scanners/parsers are now generated with a proper dotnet nuget pkg, YaccLexTools. * Implements BooleanExpressionFilter with the new Parser.
41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
%namespace Bts.ColumnMapExpressions
|
|
%partial
|
|
%visibility internal
|
|
%tokentype ColumnMapExpressionToken
|
|
%parsertype ColumnMapExpressionParser
|
|
|
|
%union {
|
|
public string Identifier;
|
|
public KeyValuePair<string, string> MappedColumn;
|
|
public System.Collections.Immutable.ImmutableDictionary<string, string> MappedColumns;
|
|
public ColumnMapExpression Expression;
|
|
}
|
|
|
|
%token IDENTIFIER, MAP, NEGATE
|
|
|
|
%type <MappedColumns> MappedColumns
|
|
%type <Expression> Expression
|
|
%type <MappedColumn> MappedColumn
|
|
|
|
%%
|
|
|
|
Expression :
|
|
NEGATE MappedColumns { $$ = new($2, false); }
|
|
| NEGATE { $$ = new(System.Collections.Immutable.ImmutableDictionary<string, string>.Empty, false); }
|
|
| MappedColumns { $$ = new($1, true); }
|
|
;
|
|
|
|
MappedColumn :
|
|
IDENTIFIER {
|
|
$$ = new($1.Identifier, $1.Identifier);
|
|
}
|
|
| IDENTIFIER MAP IDENTIFIER {
|
|
$$ = new($1.Identifier, $3.Identifier);
|
|
}
|
|
;
|
|
|
|
MappedColumns :
|
|
MappedColumn { $$ = System.Collections.Immutable.ImmutableDictionary<string, string>.Empty.Add($1.Key, $1.Value); }
|
|
| MappedColumn MappedColumns { $$ = $2.Add($1.Key, $1.Value); }
|
|
;
|