Remove dedicated string machine in the XML lexer.
This removes the need for another fcall/fret combination.
This commit is contained in:
parent
93b9718406
commit
feaf28d423
|
@ -47,23 +47,14 @@
|
||||||
dquote = '"';
|
dquote = '"';
|
||||||
squote = "'";
|
squote = "'";
|
||||||
|
|
||||||
# Machine for processing double quoted strings.
|
string_dquote = (dquote ^dquote+ dquote);
|
||||||
string_dquote := |*
|
string_squote = (squote ^squote+ squote);
|
||||||
^dquote+ => {
|
|
||||||
callback("on_string", data, encoding, ts, te);
|
|
||||||
};
|
|
||||||
|
|
||||||
dquote => { fret; };
|
string = string_dquote | string_squote;
|
||||||
*|;
|
|
||||||
|
|
||||||
# Machine for processing single quoted strings.
|
action emit_string {
|
||||||
string_squote := |*
|
callback("on_string", data, encoding, ts + 1, te - 1);
|
||||||
^squote+ => {
|
}
|
||||||
callback("on_string", data, encoding, ts, te);
|
|
||||||
};
|
|
||||||
|
|
||||||
squote => { fret; };
|
|
||||||
*|;
|
|
||||||
|
|
||||||
# DOCTYPES
|
# DOCTYPES
|
||||||
#
|
#
|
||||||
|
@ -96,8 +87,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Lex the public/system IDs as regular strings.
|
# Lex the public/system IDs as regular strings.
|
||||||
dquote => { fcall string_dquote; };
|
string => emit_string;
|
||||||
squote => { fcall string_squote; };
|
|
||||||
|
|
||||||
# Whitespace inside doctypes is ignored since there's no point in
|
# Whitespace inside doctypes is ignored since there's no point in
|
||||||
# including it.
|
# including it.
|
||||||
|
@ -137,8 +127,7 @@
|
||||||
callback("on_attribute", data, encoding, ts, te);
|
callback("on_attribute", data, encoding, ts, te);
|
||||||
};
|
};
|
||||||
|
|
||||||
dquote => { fcall string_dquote; };
|
string => emit_string;
|
||||||
squote => { fcall string_squote; };
|
|
||||||
|
|
||||||
any;
|
any;
|
||||||
*|;
|
*|;
|
||||||
|
@ -192,8 +181,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Attribute values.
|
# Attribute values.
|
||||||
dquote => { fcall string_dquote; };
|
string => emit_string;
|
||||||
squote => { fcall string_squote; };
|
|
||||||
|
|
||||||
# The closing character of the open tag.
|
# The closing character of the open tag.
|
||||||
('>' | '/') => {
|
('>' | '/') => {
|
||||||
|
|
Loading…
Reference in New Issue