import javax.swing.text.Element;
@javax.annotation.Generated("JFlex")
-@SuppressWarnings("fallthrough")
%%
%public
%type int
%buffer 256
-%switch
-
%{
private ScilabDocument doc;
private Element elem;
public MatchingBlockScanner(ScilabDocument doc) {
this.doc = doc;
this.elem = doc.getDefaultRootElement();
- this.scilabLexer = doc.createLexer();
+ this.scilabLexer = new ScilabLexer(doc, null, false);
+ }
+
+ public int yychar() {
+ return (int) yychar;
}
public MatchingPositions getNextBlock(int pos, boolean lr) {
}
if (s == 0) {
if (lr) {
- return new MatchingPositions(pos, pos, pos + yychar, pos + yychar + (transp?(yylength()-1):yylength()));
+ return new MatchingPositions(pos, pos, pos + yychar(), pos + yychar() + (transp?(yylength()-1):yylength()));
} else {
- return new MatchingPositions(pos, pos, pos - yychar - yylength(), pos - yychar);
+ return new MatchingPositions(pos, pos, pos - yychar() - yylength(), pos - yychar());
}
}
}
if (s == 0) {
if (lr) {
- return new MatchingPositions(pos, p1, pos + yychar, pos + yychar + (transp?(yylength()-1):yylength()));
+ return new MatchingPositions(pos, p1, pos + yychar(), pos + yychar() + (transp?(yylength()-1):yylength()));
} else {
- return new MatchingPositions(p1, pos, pos - yychar - yylength(), pos - yychar);
+ return new MatchingPositions(p1, pos, pos - yychar() - yylength(), pos - yychar());
}
}
gnirtsq = \"{string}(\"|\')
transp = ({spec} | ")" | "]" | "}") "'"
-openK = ("if" | "for" | "while" | "select" | "try" | "function")
+openK = ("if" | "for" | "while" | "select" | "try" | "function" | "switch")
openKx = {openK}{spec}+
elseif = "elseif" | "else"
xcloseK = ({spec} | "%" ){closeK}
closeS = ")" | "]" | "}"
-esolcK = ("fi" | "rof" | "elihw" | "tceles" | "yrt" | "noitcnuf")
+esolcK = ("fi" | "rof" | "elihw" | "tceles" | "yrt" | "noitcnuf" | "hctiws")
esolcKx = {spec}{esolcK}
xesolcK = {esolcK}{spec}
nepoK = ("dne" | "noitcnufdne")
<PSNART> {
\' {
- if (scilabLexer.getKeyword(start - yychar, false) == ScilabLexerConstants.STRING) {
- savePos = start - yychar - scilabLexer.beginString - scilabLexer.start;
+ if (scilabLexer.getKeyword(start - yychar(), false) == ScilabLexerConstants.STRING) {
+ savePos = start - yychar() - scilabLexer.beginString - scilabLexer.start;
yybegin(SPEC);
} else {
yybegin(RL);