RagelTokenMaker is a base class I use for convenience when using Ragel with RSyntaxTextArea. The class that my app actually uses for tokens is TableLayoutTokenizer
. It is hard to read because most of it is code generated from this
much easier to read file, but (at the bottom) I already have getCurlyBracesDenoteCodeBlocks returning true.
I dug into it a little and found that RSyntaxUtilities.getMatchingBracketPosition only works if the bracket is a Token.SEPARATOR. I changed my TableLayoutTokenizer to use Token.SEPARATOR and it does indeed work. However, I match parenthesis and square bracket with different token types because I want to color them differently. I also would like pointy brackets to be matched. I went ahead and modified getMatchingBracketPosition to do what I need for now.
This is probably the same problem with my tab lines. I'm using my own token types, but I see now that RSyntaxTextArea assumes I will use its token types (eg, Token.NUM_TOKEN_TYPES). I rearranged my parsing to differentiate from plain text and whitespace, then I used Token.WHITESPACE for whitespace, and now I have tab lines.
Note sure what else gets messed up by using my own token types.
It might be cool if the TokenMaker has methods like isWhitespace(int type) and isSeparator(int type) to allow a little more flexibility. It hasn't needed it, since adding support for a new language is so hard with JFlex. The Ragel way of parsing is really sweet.
You can see my app running here:http://table-layout.googlecode.com/svn/ ... or.jnlp?12