~sircmpwn/hare-xml

4f785cbd53ab3f6fe6fb260c87097c30ec47ab4f — Sebastian 5 months ago cb21826
ascii: abort strcasecmp when non-ASCII encountered

Signed-off-by: Sebastian <sebastian@sebsite.pw>
1 files changed, 8 insertions(+), 12 deletions(-)

M parser.ha
M parser.ha => parser.ha +8 -12
@@ 467,13 467,11 @@ fn prolog(par: *parser) (void | error) = {
			return par.line: syntaxerr;
		};
		// XXX: Deliberate omission: all values other than utf-8
		match (ascii::strcasecmp(attr.1, "utf-8")) {
		case void =>
		if (!ascii::validstr(attr.1)) {
			return utf8::invalid;
		};
		if (ascii::strcasecmp(attr.1, "utf-8") != 0) {
			return utf8::invalid;
		case let n: int =>
			if (n != 0) {
				return utf8::invalid;
			};
		};
	};



@@ 491,13 489,11 @@ fn prolog(par: *parser) (void | error) = {
			return par.line: syntaxerr;
		};
		// XXX: Deliberate omission: non-standalone documents
		match (ascii::strcasecmp(attr.1, "yes")) {
		case void =>
		if (!ascii::validstr(attr.1)) {
			return par.line: syntaxerr;
		};
		if (ascii::strcasecmp(attr.1, "yes") != 0) {
			return par.line: syntaxerr;
		case let n: int =>
			if (n != 0) {
				return par.line: syntaxerr;
			};
		};
	};