%namespace Bts.ColumnMapExpressions %partial %visibility internal %tokentype ColumnMapExpressionToken %parsertype ColumnMapExpressionParser %union { public string Identifier; public KeyValuePair MappedColumn; public System.Collections.Immutable.ImmutableDictionary MappedColumns; public ColumnMapExpression Expression; } %token IDENTIFIER, MAP, NEGATE %type MappedColumns %type Expression %type MappedColumn %% Expression : NEGATE MappedColumns { $$ = new($2, false); } | NEGATE { $$ = new(System.Collections.Immutable.ImmutableDictionary.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.Empty.Add($1.Key, $1.Value); } | MappedColumn MappedColumns { $$ = $2.Add($1.Key, $1.Value); } ;