/// <summary> /// Determine if contains keyword and if it's possible to convert non-keyword types to keyword type /// ie. monday = 4 or month in (may,...,december) /// </summary> /// <param name="left">Node do check.</param> /// <param name="right">Node do check.</param> /// <returns>true if can be generalized, else false.</returns> private static bool CanBeGeneralized(RdlSyntaxNode left, RdlSyntaxNode right) { if (right.Token.Value == null) { return(false); } if (right.Token.Value.IsKeyword() && RdlMetadata.IsTypePossibleToConvert(left.ReturnType, typeof(int))) { return(true); } if (left.Token.Value == null) { return(false); } if (left.Token.Value.IsKeyword() && RdlMetadata.IsTypePossibleToConvert(typeof(int), right.ReturnType)) { return(true); } return(false); }
public DebuggerTrap(RdlSyntaxNode node, ExpressionState state, OnExpressionBegin expBeginCallback, OnExpressionEnd expEndCallback) { _node = node; _state = state; _expBeginCallback = expBeginCallback; _expEndCallback = expEndCallback; }
public ModuloNode(RdlSyntaxNode left, RdlSyntaxNode right) : base(left, right) { }
/// <inheritdoc /> /// <summary> /// Create instance of tree enumerator /// </summary> /// <param name="node">Abstract Syntax Tree</param> public ArythmeticEnumerator(RdlSyntaxNode node) : base(node) { Stack.Push(new VisitationState(Root)); }
/// <summary> /// Initialize object. /// </summary> /// <param name="root">Root element where enumeration will start from.</param> public KeywordEnumerator(RdlSyntaxNode root) : base(root) { Stack.Push(new VisitationState(root)); }
/// <summary> /// Initialize object /// </summary> /// <param name="node">Node that has to be tracked</param> public VisitationState(RdlSyntaxNode node) { Node = node; ToVisitDescendantIndex = 0; WasVisitedOnce = false; }
public FSlashNode(RdlSyntaxNode left, RdlSyntaxNode right) : base(left, right) { }
/// <summary> /// Initialize object. /// </summary> /// <param name="root">Root node where enumeration will start from.</param> protected EnumeratorBase(RdlSyntaxNode root) { Root = root; }
public StarNode(RdlSyntaxNode left, RdlSyntaxNode right) : base(left, right) { }
public CommaNode(RdlSyntaxNode left, RdlSyntaxNode right) : base(left, right) { }
public AddNode(RdlSyntaxNode left, RdlSyntaxNode right) : base(left, right) { }
private RdlSyntaxNode ComposeArithmeticOperators(Precendence precendence) { RdlSyntaxNode node = null; switch (precendence) { case Precendence.Level1: { node = ComposeArithmeticOperators(Precendence.Level2); while (IsArithmeticOperator(Current, Precendence.Level1)) { switch (Current.TokenType) { case StatementType.Star: Consume(StatementType.Star); node = new StarNode(node, ComposeBaseTypes()); break; case StatementType.FSlash: Consume(StatementType.FSlash); node = new FSlashNode(node, ComposeBaseTypes()); break; case StatementType.Mod: Consume(StatementType.Mod); node = new ModuloNode(node, ComposeBaseTypes()); break; case StatementType.In: Consume(StatementType.In); node = new InNode(node, ComposeArgs()); break; case StatementType.NotIn: Consume(StatementType.NotIn); node = new NotInNode(node, ComposeArgs()); break; } } break; } case Precendence.Level2: { node = ComposeArithmeticOperators(Precendence.Level3); while (IsArithmeticOperator(Current, Precendence.Level2)) { switch (Current.TokenType) { case StatementType.Plus: Consume(StatementType.Plus); node = new AddNode(node, ComposeBaseTypes()); break; case StatementType.Hyphen: Consume(StatementType.Hyphen); node = new HyphenNode(node, ComposeBaseTypes()); break; } } break; } case Precendence.Level3: node = ComposeBaseTypes(); break; } return(node); }