Syntax Error when using JFLEX
Hi,
can any body please tell me why
(?<=(<%))[^']+(?=(%>))
gives an syntax error when transformed via jflex
I want to get the content in between <% %>
tags. Regular expression seems to work when I checked with http://rubular.com/
Eg:
content not wanted <% needed content %>content not wanted
below is the error:
Error in file "/home/amila/jagtest2/jaggery.flex" (line 73):
Syntax error.
(?<=('<%'))[^']+(?=('%>')) { return JaggeryTokenTypes.JAVASCRIPT_TEXT;}
^
Error in file "/home/amila/jagtest2/jaggery.flex" (line 73):
Syntax error.
(?<=('<%'))[^']+(?=('%>')) { return JaggeryTokenTypes.JAVASCRIPT_TEXT;}
^
Error in file "/home/amila/jagtest2/jaggery.flex" (line 73):
Syntax error.
(?<=('<%'))[^']+(?=('%>')) { return JaggeryTokenTypes.JAVASCRIPT_TEXT;}
Thanks .. !!
Please sign in to leave a comment.
I won't go into whether you should be creating chameleon tokens or not - that would depend on what you are doing, though I think you probably should look into it at least.
You have to create tokens such that they cover all of the text. You can't skip any.
Here is a way you could do it - it may not be the best, but hopefully, it will get you started.
Also, I don't think you need all those single quotes and parens in your regex
Hi,
Thanks you very much for your help. I could manage it working adding
"<%" { yybegin(TAG_STARTED);return JaggeryTokenTypes.OUTERBRACKETS; }
[^<%]* {yybegin(YYINITIAL);return JaggeryTokenTypes.BAD_CHARACTER;}
in <YYINITIAL> state. Other wise if I edit over the very first bracket, highlighting of the first line after that bracket get distorted.
Thanks..