Replaced fcall/fret with fnext in the XML lexer.
With the rules being cleaned up/moved around a bit we can drop the use of fcall/fret. This saves the need of having to maintain a stack (position).
This commit is contained in:
parent
c56b0395e4
commit
4542f06d0f
|
@ -84,13 +84,6 @@ VALUE oga_xml_lexer_advance(VALUE self)
|
|||
|
||||
int act = 0;
|
||||
int cs = 0;
|
||||
int top = 0;
|
||||
|
||||
/*
|
||||
Fixed stack size is enough since the lexer doesn't use that many nested
|
||||
fcalls.
|
||||
*/
|
||||
int stack[8];
|
||||
|
||||
%% write init;
|
||||
%% write exec;
|
||||
|
|
|
@ -94,10 +94,6 @@ public class Lexer extends RubyObject
|
|||
int p = 0;
|
||||
int pe = data.length;
|
||||
int eof = data.length;
|
||||
int top = 0;
|
||||
|
||||
// Fixed stack size of 8 should be more than enough.
|
||||
int[] stack = new int[8];
|
||||
|
||||
%% write init;
|
||||
%% write exec;
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
action start_doctype {
|
||||
callback_simple("on_doctype_start");
|
||||
fcall doctype;
|
||||
fnext doctype;
|
||||
}
|
||||
|
||||
# Machine for processing doctypes. Doctype values such as the public
|
||||
|
@ -99,7 +99,7 @@
|
|||
|
||||
'>' => {
|
||||
callback_simple("on_doctype_end");
|
||||
fret;
|
||||
fnext main;
|
||||
};
|
||||
*|;
|
||||
|
||||
|
@ -112,14 +112,14 @@
|
|||
|
||||
action start_xml_decl {
|
||||
callback_simple("on_xml_decl_start");
|
||||
fcall xml_decl;
|
||||
fnext xml_decl;
|
||||
}
|
||||
|
||||
# Machine that processes the contents of an XML declaration tag.
|
||||
xml_decl := |*
|
||||
xml_decl_end => {
|
||||
callback_simple("on_xml_decl_end");
|
||||
fret;
|
||||
fnext main;
|
||||
};
|
||||
|
||||
# Attributes and their values (e.g. version="1.0").
|
||||
|
@ -142,7 +142,7 @@
|
|||
# machine.
|
||||
action start_element {
|
||||
fhold;
|
||||
fcall element_head;
|
||||
fnext element_head;
|
||||
}
|
||||
|
||||
# Machine used for lexing the name/namespace of an element.
|
||||
|
@ -153,7 +153,7 @@
|
|||
|
||||
identifier => {
|
||||
callback("on_element_name", data, encoding, ts, te);
|
||||
fret;
|
||||
fnext element_head;
|
||||
};
|
||||
*|;
|
||||
|
||||
|
@ -168,7 +168,7 @@
|
|||
|
||||
'<' => {
|
||||
callback_simple("on_element_start");
|
||||
fcall element_name;
|
||||
fnext element_name;
|
||||
};
|
||||
|
||||
newline => {
|
||||
|
@ -186,13 +186,13 @@
|
|||
# We're done with the open tag of the element.
|
||||
'>' => {
|
||||
callback_simple("on_element_open_end");
|
||||
fret;
|
||||
fnext main;
|
||||
};
|
||||
|
||||
# Self closing tags.
|
||||
'/>' => {
|
||||
callback_simple("on_element_end");
|
||||
fret;
|
||||
fnext main;
|
||||
};
|
||||
*|;
|
||||
|
||||
|
|
Loading…
Reference in New Issue