Example #1
0
        public bool Equals(ProductionItem <TTokenKind> other, ProductionItemComparison comparison)
        {
            switch (comparison)
            {
            case ProductionItemComparison.MarkedProductionOnly:
                return(MarkedProduction.Equals(other.MarkedProduction));    // CORE is the same

            case ProductionItemComparison.LookaheadsOnly:
                return(Lookaheads.SetEquals(other.Lookaheads));

            case ProductionItemComparison.MarkedProductionAndLookaheads:
            default:
                return(MarkedProduction.Equals(other.MarkedProduction) && Lookaheads.SetEquals(other.Lookaheads));
            }
        }
Example #2
0
        public void CalculationTest(IReadOnlySet <object> result, string expression, Parser parser)
        {
            var tokens = expression.Split().Append(string.Empty);
            var set    = new StateMachine(parser).Calculate(tokens);

            Assert.True(result.SetEquals(set));
        }
 public bool SetEquals(IEnumerable <string> other) => _data.SetEquals(other);