public void ParsingSteps( Syntan.SyntacticAnalysis.ExtendedGrammar grammar, Syntan.SyntacticAnalysis.LR.ParserTable table, IEnumerable<Syntan.SyntacticAnalysis.TerminalSymbol> input, IEnumerable<Fixtures.ParsingStepData> expected_parsing_steps) { var p = new Parser(); p.Start(grammar, table, input); foreach( var step in expected_parsing_steps ) { Assert.Equal(step.Phase, p.Phase); Assert.Equal(step.IsParsing, p.IsParsing); Assert.Equal(step.IsFinished, p.IsFinished); Assert.Equal(step.StepCount, p.StepCount); Assert.Equal(step.CurrentState, p.CurrentState); Assert.Equal(step.CurrentInputSymbol, p.CurrentInputSymbol); Assert.Equal(step.ActionArgument, p.ActionArgument); if( step.AreReductionPropertiesSet ) { Assert.Equal(step.GotoState, p.GotoState); Assert.Equal(step.GotoSymbol, p.GotoSymbol); Assert.Equal(step.ReductionRule, p.ReductionRule); } p.StepPhase(); } }
public void ShowRule( int rule_index, Syntan.SyntacticAnalysis.Rule rule ) { this.RuleIndex_Label.Text = "(" + rule_index.ToString() + ")"; this.RuleLhs_Label.Text = rule.LeftHandSide.Name; this.RuleLhs_Label.BackColor = this.BackColor; this.RuleRhs_Label.Text = rule.RightHandSide.Count == 0 ? "ε" : string.Join(string.Empty, rule.RightHandSide.Select(s => s.Name)); this.RuleRhs_Label.BackColor = this.BackColor; this.Rule_TableLayout.Visible = true; }