Lex contents of <script> tags as plain text.
When lexing input in HTML mode the lexer has to treat _all_ content of a <script> tag as plain text. This ensures that the lexer can process input such as "x <y" and "// <foo>" correctly. Fixes #70.
This commit is contained in:
1 parent
351b5ac004
commit
ba2177e2cf
4 files changed
+73
-2
No files matched your search
+10
-1
@@ -17,7 +17,13 @@ on `ts` and `te`) so the macro ignores this argument.
|
||||
liboga_xml_lexer_callback_simple(self, name);
|
||||
|
||||
#define advance_line(amount) \
|
||||
rb_funcall(self, rb_intern("advance_line"), 1, INT2NUM(amount));
|
||||
rb_funcall(self, id_advance_line, 1, INT2NUM(amount));
|
||||
|
||||
#define inside_html_script_p() \
|
||||
rb_funcall(self, id_inside_html_script_p, 0) == Qtrue
|
||||
|
||||
ID id_advance_line;
|
||||
ID id_inside_html_script_p;
|
||||
|
||||
%%machine c_lexer;
|
||||
|
||||
@@ -167,6 +173,9 @@ void Init_liboga_xml_lexer()
|
||||
VALUE mXML = rb_const_get(mOga, rb_intern("XML"));
|
||||
VALUE cLexer = rb_define_class_under(mXML, "Lexer", rb_cObject);
|
||||
|
||||
id_advance_line = rb_intern("advance_line");
|
||||
id_inside_html_script_p = rb_intern("inside_html_script?");
|
||||
|
||||
rb_define_method(cLexer, "advance_native", oga_xml_lexer_advance, 1);
|
||||
rb_define_method(cLexer, "reset_native", oga_xml_lexer_reset, 0);
|
||||
|
||||
|
||||
Reference in new issue
Block a user