RSyntaxTextArea Custom Language JFlex

594 views Asked by At

I'm trying to use JFlex to add custom language highlighting to RSyntaxTextArea. However, the moment I type a character I get an Index Out of Bounds Exception:

http://pastie.org/private/ygjyj4y5nludeu3dn1xug

This occurs even if I use the example JFlex code provided here: https://github.com/bobbylight/RSyntaxTextArea/wiki/Adding-Syntax-Highlighting-for-a-new-Language

I'm not sure what could be causing this. Could someone point me in the right direction?

1

There are 1 answers

0
Salman Arif On

I'm not quite sure why this works, but I appear to have fixed this problem by copying part of the yylex method from PythonTokenMaker.java to the Java class created by JFlex.

Specifically, I copied and replaced this section of the code: http://pastie.org/private/whjzfhbrzwm8qc88t1idq

It is from the defintion of the method to the line with the comment // store back cached position

Hopefully this will help someone stuck on the same problem!