/// <summary>
 /// Helper mapper function to translate a <see cref="ParseStringResults"/> onto a visual display of a <see cref="ListViewItem"/>.
 /// </summary>
 /// <param name="p">The <see cref="ParseStringResults"/> to display on a <see cref="ListViewItem"/>.</param>
 /// <param name="l">The <see cref="ListViewItem"/> to render the corresponding <see cref="ParseStringResults"/> on.</param>
 private void MapParseStringResultsToLV(ParseStringResults p, ListViewItem l)
 {
     l.EnsureListViewItemHasNItems(4);
     l.SubItems[0].Text = p.Input;
     l.SubItems[1].Text = p.Validated ? "T" : "F";
     l.SubItems[2].Text = p.HadError ? "T" : "F";
     l.SubItems[3].Text = p.IllegalChar.ToString();
 }
Beispiel #2
0
        /// <summary>
        /// ButtonClickEvent to evaluate the set of sentences with the <see cref="Automaton"/> defined.
        /// </summary>
        /// <param name="sender">The sender for the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> for the event.</param>
        private void BtnEval_Click(object sender, EventArgs e)
        {
            Automaton a = AutomatonParser.ParseAutomaton(this.rtbxAutomaton.Text);
            List <ParseStringResults> allResults = new List <ParseStringResults>();

            foreach (string s in this.rtbxStringsToEval.Lines)
            {
                try
                {
                    ParseStringResults currResults = AutomatonEvaluator.EvalAutomaton(a, s);
                    allResults.Add(currResults);
                }
                catch (Exception)
                {
                    // MATTHEWC: TODO: Maybe report errors separately?
                    // Maybe dummy up a ParseStringResults with error data?
                }
            }

            CtlVParseStringResultsLVAndDetail disp = new CtlVParseStringResultsLVAndDetail();

            disp.ParseStringResultsOnControls = allResults;
            MyGUIUtilities.DisplayUserControlInForm(disp, "Evaluated Strings via Automata", true);
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ParseStringResultsEventArgs"/> class.
 /// <para>Parameterized Constructor.</para>
 /// </summary>
 /// <param name="arg">The <see cref="ParseStringResults"/> corresponding to this <see cref="ParseStringResultsEventArgs"/>.</param>
 public ParseStringResultsEventArgs(ParseStringResults arg)
     : base()
 {
     this.Argument = arg;
 }