Commit 4e5102ac authored by Alex Baines's avatar Alex Baines

fix CHECKESCAPE + end tag not being found

parent 6729e0b4
This diff is collapsed.
......@@ -37,10 +37,6 @@ function HMML_parse(contents) {
isbn: "",
offset: 0
},
error: {
line: 0,
msg: ""
},
attr: "",
mnext: 0,
first: true
......@@ -65,7 +61,7 @@ function HMML_parse(contents) {
};
} catch (e) {
return {
error: state.error
error: e
};
}
}
......
%{
function ERR(yy, err){
console.log(err);
yy.error.line = yy.line;
yy.error.msg = err;
throw "tantrum";
console.log("hmmlib error: L%d: %s\n", yy.line, err);
throw { message: err, line: yy.line };
}
function CHECKESCAPE(yy, str){
if(!"[]:@~\\\"".find(str)){
if("[]:@~\\\"".indexOf(str) == -1){
ERR(yy, "hmmlib: Unknown backslash escape code: %s", str);
}
}
......@@ -120,11 +118,12 @@ RB \]
<V_ATTR>{ATTR_QUOTED} { yy.meta[yy.attr] = UNQUOTE(yy, yytext.substr(1, yyleng-2)); yy_.begin("VIDEO"); }
<V_ATTR>\] { yy_.less(0); yy_.begin("VIDEO"); }
<ANNOTATION>\[\/video\] { NEWANNO(yy); return 1; }
<ANNOTATION>{TIMECODE}{LB}\@ { NEWANNO(yy); yy.an.time = yytext.substr(1, yyleng-4); yy_.begin("AUTHOR"); }
<ANNOTATION>{TIMECODE} { NEWANNO(yy); yy.an.time = yytext.substr(1, yyleng-2); yy_.begin("TEXT_START"); }
<ANNOTATION>{BAD_TIMECODE} { ERR(yy, "Timecode '"+ yytext +"' out of range."); }
<ANNOTATION>{SP} {}
<ANNOTATION>. { ERR(yy, "Cannot parse annotation. Expected timecode."); }
<ANNOTATION>{TIMECODE} { NEWANNO(yy); yy.an.time = yytext.substr(1, yyleng-2); yy_.begin("TEXT_START"); }
<ANNOTATION>{BAD_TIMECODE} { ERR(yy, "Timecode '"+ yytext +"' out of range."); }
<ANNOTATION>{SP} {}
<ANNOTATION>. { ERR(yy, "Cannot parse annotation. Expected timecode."); }
<TEXT_START>{LB}\: { M_(yy, "CATEGORY", "TEXT"); yy_.begin("MARKER"); }
<TEXT_START>{LB}\@ { M_(yy, "MEMBER" , "TEXT"); yy_.begin("MARKER"); }
......@@ -172,7 +171,7 @@ RB \]
<R_ATTR>{ATTR_SIMPLE} { yy.ref[yy.attr] = yytext; yy_.begin("REF"); }
<R_ATTR>{ATTR_QUOTED} { yy.ref[yy.attr] = UNQUOTE(yy, yytext.substr(1, yyleng-2)); yy_.begin("REF"); }
<AFTERTEXT,ANNOTATION>\[\/video\] { NEWANNO(yy); return 1; }
<AFTERTEXT>\[\/video\] { NEWANNO(yy); return 1; }
<AFTERTEXT>{SP} {}
<AFTERTEXT>{LB}quote { yy_.begin("QUOTES"); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment