Reporting Syntax Errors within Token using IMergableLexicalParser

SyntaxEditor for Windows Forms Forum

Posted 10 years ago by M.Stange
Version: 13.1.0312
Avatar

How do I report a syntax error within a Token using IMergableLexicalParser?

I have my own implementation of IMergableLexicalParser doing the lexial parsing for me. However, there may be cases where a token can generally be parsed, but is still invalid. The best example is a string token, with an invalid escape sequence, such as "ABC\Z" where "\Z" is not a valid escape sequence.

How would I report such an error, so I get a squiggly red line at the corresponding position and still do proper semantic parsing, since the string is generally a valid token?

Comments (1)

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

Hello,

If you want to make use of the built in features for error display and have a semantic parser, you'd need to return your errors in the ICompilationUnit.SyntaxErrors collection that your semantic parser returns.  You can't return that directly from the lexical parser.

The other thing you could do if you want to manually manage error display without a semantic parser is to work directly with the syntax error indicator layer.  The Indicators QuickStart shows an example of that.


Actipro Software Support

The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.