Parser Error Numbers

SyntaxEditor for WPF Forum

Posted 11 years ago by Ian Davis
Version: 12.2.0572
Avatar

Is there any way to attach error numbers to parser and semantic analysis errors? I am trying to get something like this to work:

[Test]
public void Missing_conditional_in_if_statement_creates_expression_expected_error()
{
    string text = "if( ";
    FormulaParseData results = Parse(text, g => g.IfExpression);
    var errors = results.Errors.ToList();
    Assert.AreEqual(1, errors.Count);
    Assert.AreEqual(Errors.ExpressionExpected, errors[0].Number);
}

 Without this I am left with trying to match errors on their text contents.

Comments (1)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Ian,

Our parse errors are all IParseError objects.  So while they don't define an error number themselves, you could use an implementation class that includes a Number property.

If you are needing to assign error numbers to errors that come externally, you could wrap the existing IParser service with one of your own and update the IParseData results that come back to swap in your own IParseError objects before the result is returned to the caller.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.