Track Ragel call stacks in the Java lexer.
This will be needed for the upcoming string lexing changes.
This commit is contained in:
parent
d951a8cc87
commit
fca88a69d1
|
@ -40,6 +40,9 @@ public class Lexer extends RubyObject
|
||||||
/* Used by Ragel to keep track of the current state. */
|
/* Used by Ragel to keep track of the current state. */
|
||||||
int act;
|
int act;
|
||||||
int cs;
|
int cs;
|
||||||
|
int top;
|
||||||
|
int lines;
|
||||||
|
int[] stack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the current class in the Ruby runtime.
|
* Sets up the current class in the Ruby runtime.
|
||||||
|
@ -94,12 +97,14 @@ public class Lexer extends RubyObject
|
||||||
int te = 0;
|
int te = 0;
|
||||||
int p = 0;
|
int p = 0;
|
||||||
int mark = 0;
|
int mark = 0;
|
||||||
int lines = 0;
|
int lines = this.lines;
|
||||||
int pe = data.length;
|
int pe = data.length;
|
||||||
int eof = data.length;
|
int eof = data.length;
|
||||||
|
|
||||||
%% write exec;
|
%% write exec;
|
||||||
|
|
||||||
|
this.lines = lines;
|
||||||
|
|
||||||
return context.nil;
|
return context.nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +114,10 @@ public class Lexer extends RubyObject
|
||||||
@JRubyMethod
|
@JRubyMethod
|
||||||
public IRubyObject reset_native(ThreadContext context)
|
public IRubyObject reset_native(ThreadContext context)
|
||||||
{
|
{
|
||||||
this.act = 0;
|
this.act = 0;
|
||||||
this.cs = java_lexer_start;
|
this.top = 0;
|
||||||
|
this.stack = new int[4];
|
||||||
|
this.cs = java_lexer_start;
|
||||||
|
|
||||||
return context.nil;
|
return context.nil;
|
||||||
}
|
}
|
||||||
|
@ -158,6 +165,8 @@ public class Lexer extends RubyObject
|
||||||
%%{
|
%%{
|
||||||
variable act this.act;
|
variable act this.act;
|
||||||
variable cs this.cs;
|
variable cs this.cs;
|
||||||
|
variable stack this.stack;
|
||||||
|
variable top this.top;
|
||||||
|
|
||||||
include base_lexer "base_lexer.rl";
|
include base_lexer "base_lexer.rl";
|
||||||
}%%
|
}%%
|
||||||
|
|
Loading…
Reference in New Issue