Skip to content
Advertisement

Tag: lexer

ANTLR4: How to match extra spaces at the beginning of a line?

I tried to match the extra space at the beginning of the line, but it didn’t work. How to modify the lexer rule to match? TestParser.g4: TestLexer.g4: Text: Java code: The output is as follows: The idea is that when a non-option line is encountered in OPTION_MODE, the mode will pop up, and now when there is an extra space

Java and regex lexer

I am trying to make some sort of Lexer in Java using regex for a custom markdown “language” I’m making, it’s my first time working with this stuff so a little lost on a few things. An …

Advertisement