1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
// Generated by re2java
// re2java $INPUT -o $OUTPUT --header lexer/state.java
package headers;
import headers.lexer.State;
class Main {
static int lex(String str) {
State yyrecord = new State(str);
int t;
{
char yych = 0;
int yystate = 0;
yyl: while (true) {
switch (yystate) {
case 0:
yych = yyrecord.yyinput.charAt(yyrecord.yycursor);
switch (yych) {
case 0x61:
yyrecord.yycursor += 1;
yystate = 0;
continue yyl;
case 0x62:
yyrecord.yyt1 = yyrecord.yycursor;
yyrecord.yycursor += 1;
yystate = 2;
continue yyl;
default:
yyrecord.yyt1 = yyrecord.yycursor;
yystate = 1;
continue yyl;
}
case 1:
t = yyrecord.yyt1;
{ return t; }
case 2:
yych = yyrecord.yyinput.charAt(yyrecord.yycursor);
switch (yych) {
case 0x62:
yyrecord.yycursor += 1;
yystate = 2;
continue yyl;
default:
yystate = 1;
continue yyl;
}
default:
throw new IllegalStateException("internal lexer error");
}
}
}
}
public static void main(String []args) {
assert lex("ab\0") == 1;
}
};
// Generated by re2java
package headers.lexer;
public class State {
public String yyinput;
public int yycursor;
public int yyt1;
public State(String str) {
yyinput = str;
yycursor = 0;
yyt1 = 0;
}
};
java/headers/header.re:35:25: warning: rule matches empty string [-Wmatch-empty-string]
|