parser: use control_verb parser inline

This commit is contained in:
Justin Viiret
2017-02-02 15:49:26 +11:00
committed by Matthew Barr
parent bfc8be5675
commit bef6889844
6 changed files with 28 additions and 20 deletions

View File

@@ -560,13 +560,13 @@ unichar readUtf8CodePoint4c(const char *s) {
throw LocatedParseError("(*UCP) must be at start of "
"expression, encountered");
};
'UTF16)' => {
throw LocatedParseError("(*UTF16) not supported");
};
'UTF32)' => {
throw LocatedParseError("(*UTF32) not supported");
};
any => {
# Use the control verb mini-parser to report an error for this
# unsupported/unknown verb.
[^)]+ ')' => {
ParseMode temp_mode;
assert(ts - 2 >= ptr); // parser needs the '(*' at the start too.
read_control_verbs(ts - 2, te, (ts - 2 - ptr), temp_mode);
assert(0); // Should have thrown a parse error.
throw LocatedParseError("Unknown control verb");
};
*|;
@@ -1838,7 +1838,7 @@ unique_ptr<Component> parse(const char *ptr, ParseMode &globalMode) {
// First, read the control verbs, set any global mode flags and move the
// ptr forward.
p = read_control_verbs(p, pe, globalMode);
p = read_control_verbs(p, pe, 0, globalMode);
const char *eof = pe;
int cs;