Track Ragel call stacks in the Java lexer.

This will be needed for the upcoming string lexing changes.
This commit is contained in:
Yorick Peterse 2014-10-26 11:39:19 +01:00
parent d951a8cc87
commit fca88a69d1
1 changed files with 12 additions and 3 deletions

View File

@ -40,6 +40,9 @@ public class Lexer extends RubyObject
/* Used by Ragel to keep track of the current state. */
int act;
int cs;
int top;
int lines;
int[] stack;
/**
* Sets up the current class in the Ruby runtime.
@ -94,12 +97,14 @@ public class Lexer extends RubyObject
int te = 0;
int p = 0;
int mark = 0;
int lines = 0;
int lines = this.lines;
int pe = data.length;
int eof = data.length;
%% write exec;
this.lines = lines;
return context.nil;
}
@ -110,6 +115,8 @@ public class Lexer extends RubyObject
public IRubyObject reset_native(ThreadContext context)
{
this.act = 0;
this.top = 0;
this.stack = new int[4];
this.cs = java_lexer_start;
return context.nil;
@ -158,6 +165,8 @@ public class Lexer extends RubyObject
%%{
variable act this.act;
variable cs this.cs;
variable stack this.stack;
variable top this.top;
include base_lexer "base_lexer.rl";
}%%