diff --git a/ext/ragel/base_lexer.rl b/ext/ragel/base_lexer.rl index 850e11f..e38705e 100644 --- a/ext/ragel/base_lexer.rl +++ b/ext/ragel/base_lexer.rl @@ -50,25 +50,12 @@ comment_start = ''; + comment = comment_start (any* -- comment_end) comment_end; action start_comment { - mark = te; - - fnext comment_body; + callback("on_comment", data, encoding, ts + 4, te - 3); } - comment_body := |* - comment_end => { - callback("on_comment", data, encoding, mark, te - 3); - - mark = 0; - - fnext main; - }; - - any; - *|; - # CDATA # # http://www.w3.org/TR/html-markup/syntax.html#cdata-sections @@ -79,25 +66,12 @@ cdata_start = ''; + cdata = cdata_start (any* -- cdata_end) cdata_end; action start_cdata { - mark = te; - - fnext cdata_body; + callback("on_cdata", data, encoding, ts + 9, te - 3); } - cdata_body := |* - cdata_end => { - callback("on_cdata", data, encoding, mark, te - 3); - - mark = 0; - - fnext main; - }; - - any; - *|; - # Processing Instructions # # http://www.w3.org/TR/xpath/#section-Processing-Instruction-Nodes @@ -289,10 +263,11 @@ main := |* doctype_start => start_doctype; xml_decl_start => start_xml_decl; - comment_start => start_comment; - cdata_start => start_cdata; + comment => start_comment; + cdata => start_cdata; proc_ins_start => start_proc_ins; + # The start of an element. '<' => start_element;