Parsing numeric literals in programmatic lexer

SyntaxEditor for WPF Forum

Posted 9 years ago by Xuesong Wu
Version: 15.1.0623

I am writing a programmatic lexer that inherits from MergableLexerBase. In the lexer I need to able to recognize numeric literals, including decimal, hexdecimal, octal, and binary integers and floating numbers. Can I use Regular Expression to do the parsing? Or Must I hand-write the parser? Is there any sample code that does the similar things?


Xuesong Wu

Comments (1)

Answer - Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Xuesong,

Please have a look at the Getting Started 3c QuickStart as that shows a programmatic lexer.  Programmatic lexers require you to advance through the ITextBufferReader to consume the current token's text and then return what token that text was.  You can determine that however you need in code.  We have done it in hand-written code.  It would be difficult to use regular expressions though there because you don't have a text string to examine, since you are provided an ITextBufferReader.

Actipro Software Support

The latest build of this product (v24.1.2) was released 27 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.