/// <summary>
        /// Initializes a new instance of the <see cref="RegexConditional"/> class.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        public RegexConditional(RegexBuffer buffer)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer", "RegexBuffer is null");
            }

            this.startLocation = buffer.Offset;

            this.expression = new RegexExpression(buffer);
            this.CheckClosingParen(buffer);

            this.yesNo = new RegexExpression(buffer);
            this.CheckClosingParen(buffer);

            buffer.AddLookup(this, this.startLocation, buffer.Offset - 1);
        }
Ejemplo n.º 2
0
 private void InterpretRegEx()
 {
     this.buffer = new RegexBuffer(this.textBoxRegex.Text)
     {
         RegexOptions = this.CreateRegexOptions()
     };
     try
     {
         RegexExpression exp = new RegexExpression(this.buffer);
         this.textBoxInterpretation.Text      = exp.ToString(0);
         this.textBoxInterpretation.ForeColor = Color.Black;
     }
     catch (Exception ex)
     {
         this.textBoxInterpretation.Text = "We have a situation...\r\n\r\n (" + ex.Message + ")";
         this.textBoxRegex.Focus();
         this.textBoxInterpretation.ForeColor = Color.Gray;
     }
 }