hmmlib-js: spec update

This commit is contained in:
Alex Baines 2017-06-19 18:23:17 +01:00
parent e8f9869461
commit 74f667c5c6
4 changed files with 153 additions and 159 deletions

View File

@ -3,15 +3,7 @@ function HMML_parse(contents) {
var state = { var state = {
line: 0, line: 0,
annos: [], annos: [],
meta: { meta: {},
member: "",
twitch: "",
project: "",
title: "",
platform: "",
id: "",
annotator: ""
},
an: { an: {
line: 0, line: 0,
time: "", time: "",
@ -25,20 +17,7 @@ function HMML_parse(contents) {
}, },
is_quote: false is_quote: false
}, },
ref: { ref: {},
site: "",
page: "",
url: "",
title: "",
article: "",
author: "",
editor: "",
publisher: "",
isbn: "",
offset: 0
},
attr: "",
mnext: 0,
first: true first: true
}; };
l.setInput(contents, state); l.setInput(contents, state);
@ -482,342 +461,366 @@ HMMLexer.prototype = {
yy_.begin("V_ATTR"); yy_.begin("V_ATTR");
break; break;
case 6: case 6:
yy.attr = "twitch"; yy.attr = "stream_platform";
yy_.begin("V_ATTR"); yy_.begin("V_ATTR");
break; break;
case 7: case 7:
yy.attr = "project"; yy.attr = "stream_username";
yy_.begin("V_ATTR"); yy_.begin("V_ATTR");
break; break;
case 8: case 8:
yy.attr = "title"; yy.attr = "project";
yy_.begin("V_ATTR"); yy_.begin("V_ATTR");
break; break;
case 9: case 9:
yy.attr = "platform"; yy.attr = "title";
yy_.begin("V_ATTR"); yy_.begin("V_ATTR");
break; break;
case 10: case 10:
yy.attr = "id"; yy.attr = "vod_platform";
yy_.begin("V_ATTR"); yy_.begin("V_ATTR");
break; break;
case 11: case 11:
yy.attr = "annotator"; yy.attr = "id";
yy_.begin("V_ATTR"); yy_.begin("V_ATTR");
break; break;
case 12: case 12:
yy_.begin("ANNOTATION"); yy.attr = "co_host"
yy_.begin("V_ATTR");
break; break;
case 13: case 13:
ERR(yy, "Invalid char '" + yy_.yytext + "' in video tag."); yy.attr = "guest"
yy_.begin("V_ATTR");
break; break;
case 14: case 14:
yy_.begin("VIDEO"); yy.attr = "annotator";
yy_.begin("V_ATTR");
break; break;
case 15: case 15:
yy.meta[yy.attr] = yy_.yytext; yy_.begin("ANNOTATION");
yy_.begin("VIDEO");
break; break;
case 16: case 16:
yy.meta[yy.attr] = UNQUOTE(yy, yy_.yytext.substr(1, yy_.yyleng - 2)); ERR(yy, "Invalid char '" + yy_.yytext + "' in video tag.");
yy_.begin("VIDEO");
break; break;
case 17: case 17:
yy_.less(0);
yy_.begin("VIDEO"); yy_.begin("VIDEO");
break; break;
case 18: case 18:
yy.meta[yy.attr] = yy_.yytext;
yy_.begin("VIDEO");
break;
case 19:
yy.meta[yy.attr] = UNQUOTE(yy, yy_.yytext.substr(1, yy_.yyleng - 2));
yy_.begin("VIDEO");
break;
case 20:
yy_.less(0);
yy_.begin("VIDEO");
break;
case 21:
NEWANNO(yy); NEWANNO(yy);
return 1; return 1;
break; break;
case 19: case 22:
NEWANNO(yy); NEWANNO(yy);
yy.an.time = yy_.yytext.substr(1, yy_.yyleng - 4); yy.an.time = yy_.yytext.substr(1, yy_.yyleng - 4);
yy_.begin("AUTHOR"); yy_.begin("AUTHOR");
break; break;
case 20: case 23:
NEWANNO(yy); NEWANNO(yy);
yy.an.time = yy_.yytext.substr(1, yy_.yyleng - 2); yy.an.time = yy_.yytext.substr(1, yy_.yyleng - 2);
yy_.begin("TEXT_START"); yy_.begin("TEXT_START");
break; break;
case 21: case 24:
ERR(yy, "Timecode '" + yy_.yytext + "' out of range."); ERR(yy, "Timecode '" + yy_.yytext + "' out of range.");
break; break;
case 22: case 25:
break; break;
case 23: case 26:
ERR(yy, "Cannot parse annotation. Expected timecode."); ERR(yy, "Cannot parse annotation. Expected timecode.");
break; break;
case 24: case 27:
M_(yy, "CATEGORY", "TEXT"); M_(yy, "CATEGORY", "TEXT");
yy_.begin("MARKER"); yy_.begin("MARKER");
break; break;
case 25: case 28:
M_(yy, "MEMBER", "TEXT"); M_(yy, "MEMBER", "TEXT");
yy_.begin("MARKER"); yy_.begin("MARKER");
break; break;
case 26: case 29:
M_(yy, "PROJECT", "TEXT"); M_(yy, "PROJECT", "TEXT");
yy_.begin("MARKER"); yy_.begin("MARKER");
break; break;
case 27: case 30:
yy_.less(0); yy_.less(0);
yy_.begin("TEXT"); yy_.begin("TEXT");
break; break;
case 28: case 31:
ERR(yy, "Unknown character '" + yy_.yytext + "' after timecode."); ERR(yy, "Unknown character '" + yy_.yytext + "' after timecode.");
break; break;
case 29: case 32:
yy.an.text += yy_.yytext; yy.an.text += yy_.yytext;
break; break;
case 30: case 33:
CHECKESCAPE(yy, yy_.yytext.charAt(1)); CHECKESCAPE(yy, yy_.yytext.charAt(1));
yy.an.text += yy_.yytext.substr(1, yy_.yyleng - 1); yy.an.text += yy_.yytext.substr(1, yy_.yyleng - 1);
break; break;
case 31: case 34:
yy.an.text += ' '; yy.an.text += ' ';
M_(yy, "CATEGORY", "TEXT"); M_(yy, "CATEGORY", "TEXT");
yy_.begin("MARKER"); yy_.begin("MARKER");
break; break;
case 32: case 35:
yy.an.text += ' '; yy.an.text += ' ';
M_(yy, "MEMBER", "TEXT"); M_(yy, "MEMBER", "TEXT");
yy_.begin("MARKER"); yy_.begin("MARKER");
break; break;
case 33: case 36:
yy.an.text += ' '; yy.an.text += ' ';
M_(yy, "PROJECT", "TEXT"); M_(yy, "PROJECT", "TEXT");
yy_.begin("MARKER"); yy_.begin("MARKER");
break; break;
case 34: case 37:
M_(yy, "CATEGORY", "MARKER_XTRA"); M_(yy, "CATEGORY", "MARKER_XTRA");
yy_.begin("MARKER"); yy_.begin("MARKER");
break; break;
case 35: case 38:
M_(yy, "MEMBER", "MARKER_XTRA"); M_(yy, "MEMBER", "MARKER_XTRA");
yy_.begin("MARKER"); yy_.begin("MARKER");
break; break;
case 36: case 39:
M_(yy, "PROJECT", "MARKER_XTRA"); M_(yy, "PROJECT", "MARKER_XTRA");
yy_.begin("MARKER"); yy_.begin("MARKER");
break; break;
case 37: case 40:
yy_.begin("AFTERTEXT"); yy_.begin("AFTERTEXT");
break; break;
case 38: case 41:
yy.ref.offset = yy.an.text.length; yy.ref.offset = yy.an.text.length;
yy_.begin("REF"); yy_.begin("REF");
break; break;
case 39: case 42:
break; break;
case 40: case 43:
yy.an.text += ' '; yy.an.text += ' ';
break; break;
case 41: case 44:
yy.an.text += yy_.yytext; yy.an.text += yy_.yytext;
break; break;
case 42: case 45:
M_ADD(yy, yy_.yytext); M_ADD(yy, yy_.yytext);
yy_.begin(yy.mnext); yy_.begin(yy.mnext);
break; break;
case 43: case 46:
M_ADD(yy, yy_.yytext.substr(1, yy_.yyleng - 2)); M_ADD(yy, yy_.yytext.substr(1, yy_.yyleng - 2));
yy_.begin(yy.mnext); yy_.begin(yy.mnext);
break; break;
case 44: case 47:
ERR(yy, "Cannot parse Marker. Expected quoted or alphanumeric attribute."); ERR(yy, "Cannot parse Marker. Expected quoted or alphanumeric attribute.");
break; break;
case 45: case 48:
MX_ADD(yy, ']'); MX_ADD(yy, ']');
break; break;
case 46: case 49:
MX_ADD(yy, '#');
break;
case 50:
yy_.begin("TEXT"); yy_.begin("TEXT");
break; break;
case 47: case 51:
if (yy.an.markers[yy.an.markers.length - 1].parameter) { if (yy.an.markers[yy.an.markers.length - 1].parameter) {
MX_ADD(yy, ' '); MX_ADD(yy, ' ');
} }
break; break;
case 48: case 52:
var m = yy.an.markers[yy.an.markers.length - 1];
if (m.type == "PROJECT") {
m.episode = yy_.yytext.substr(2);
} else {
MX_ADD(yy_.yytext.substr(1));
}
break;
case 53:
MX_ADD(yy, yy_.yytext); MX_ADD(yy, yy_.yytext);
break; break;
case 49: case 54:
break; break;
case 50: case 55:
yy.attr = "site"; yy.attr = "site";
yy_.begin("R_ATTR"); yy_.begin("R_ATTR");
break; break;
case 51: case 56:
yy.attr = "page"; yy.attr = "page";
yy_.begin("R_ATTR"); yy_.begin("R_ATTR");
break; break;
case 52: case 57:
yy.attr = "url"; yy.attr = "url";
yy_.begin("R_ATTR"); yy_.begin("R_ATTR");
break; break;
case 53: case 58:
yy.attr = "title"; yy.attr = "title";
yy_.begin("R_ATTR"); yy_.begin("R_ATTR");
break; break;
case 54: case 59:
yy.attr = "article"; yy.attr = "article";
yy_.begin("R_ATTR"); yy_.begin("R_ATTR");
break; break;
case 55: case 60:
yy.attr = "author"; yy.attr = "author";
yy_.begin("R_ATTR"); yy_.begin("R_ATTR");
break; break;
case 56: case 61:
yy.attr = "editor"; yy.attr = "editor";
yy_.begin("R_ATTR"); yy_.begin("R_ATTR");
break; break;
case 57: case 62:
yy.attr = "publisher"; yy.attr = "publisher";
yy_.begin("R_ATTR"); yy_.begin("R_ATTR");
break; break;
case 58: case 63:
yy.attr = "isbn"; yy.attr = "isbn";
yy_.begin("R_ATTR"); yy_.begin("R_ATTR");
break; break;
case 59: case 64:
yy.an.references.push(yy.ref); yy.an.references.push(yy.ref);
yy.ref = {}; yy.ref = {};
yy_.begin("TEXT"); yy_.begin("TEXT");
break; break;
case 60: case 65:
ERR(yy, "Unexpected item in ref: " + yy_.yytext); ERR(yy, "Unexpected item in ref: " + yy_.yytext);
break; break;
case 61: case 66:
break; break;
case 62: case 67:
yy.ref[yy.attr] = yy_.yytext; yy.ref[yy.attr] = yy_.yytext;
yy_.begin("REF"); yy_.begin("REF");
break; break;
case 63: case 68:
yy.ref[yy.attr] = UNQUOTE(yy, yy_.yytext.substr(1, yy_.yyleng - 2)); yy.ref[yy.attr] = UNQUOTE(yy, yy_.yytext.substr(1, yy_.yyleng - 2));
yy_.begin("REF"); yy_.begin("REF");
break; break;
case 64: case 69:
NEWANNO(yy); NEWANNO(yy);
return 1; return 1;
break; break;
case 65: case 70:
break; break;
case 66: case 71:
yy_.begin("QUOTES"); yy_.begin("QUOTES");
break; break;
case 67: case 72:
yy_.begin("CATEGORIES"); yy_.begin("CATEGORIES");
yy_.less(1); yy_.less(1);
break; break;
case 68: case 73:
yy_.begin("ANNOTATION"); yy_.begin("ANNOTATION");
yy_.less(0); yy_.less(0);
break; break;
case 69: case 74:
ERR(yy, "Unexpected thing after text node: " + yy_.yytext); ERR(yy, "Unexpected thing after text node: " + yy_.yytext);
break; break;
case 70: case 75:
ERR(yy, "Unexpected thing after text node: " + yy_.yytext); ERR(yy, "Unexpected thing after text node: " + yy_.yytext);
break; break;
case 71: case 76:
yy.an.author = yy_.yytext.substr(0, yy_.yyleng - 1); yy.an.author = yy_.yytext.substr(0, yy_.yyleng - 1);
yy_.begin("TEXT_START"); yy_.begin("TEXT_START");
break; break;
case 72: case 77:
break; break;
case 73: case 78:
break; break;
case 74: case 79:
yy.an.markers.push({ yy.an.markers.push({
type: "CATEGORY", type: "CATEGORY",
marker: yy_.yytext.substr(1, yy_.yyleng - 1), marker: yy_.yytext.substr(1, yy_.yyleng - 1),
offset: -1 offset: -1
}); });
break; break;
case 75: case 80:
yy.an.markers.push({ yy.an.markers.push({
type: "CATEGORY", type: "CATEGORY",
marker: UNQUOTE(yy, yy_.yytext.substr(2, yy_.yyleng - 3)), marker: UNQUOTE(yy, yy_.yytext.substr(2, yy_.yyleng - 3)),
offset: -1 offset: -1
}); });
break; break;
case 76: case 81:
yy_.begin("QUOTES"); yy_.begin("QUOTES");
break; break;
case 77: case 82:
yy_.begin("ANNOTATION"); yy_.begin("ANNOTATION");
break; break;
case 78: case 83:
ERR(yy, "Unexpected character in category tag: " + yy_.yytext); ERR(yy, "Unexpected character in category tag: " + yy_.yytext);
break; break;
case 79: case 84:
break; break;
case 80: case 85:
yy.an.is_quote = true; yy.an.is_quote = true;
yy.an.quote.id = parseInt(yy_.yytext); yy.an.quote.id = parseInt(yy_.yytext);
yy_.begin("ANNOTATION"); yy_.begin("ANNOTATION");
break; break;
case 81: case 86:
yy.an.quote.author += yy_.yytext; yy.an.quote.author += yy_.yytext;
break; break;
case 82: case 87:
ERR(yy, "Unexpected character in quotes tag: " + yy_.yytext); ERR(yy, "Unexpected character in quotes tag: " + yy_.yytext);
break; break;
} }
}, },
rules: [/^(?:$)/, /^(?:\r\n|\n)/, /^(?:(\[video\b))/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:member([\t \r]*)=)/, /^(?:twitch_username([\t \r]*)=)/, /^(?:project([\t \r]*)=)/, /^(?:title([\t \r]*)=)/, /^(?:platform([\t \r]*)=)/, /^(?:id([\t \r]*)=)/, /^(?:annotator([\t \r]*)=)/, /^(?:\])/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:([^\" \]\t\r\n][^ \]\t\r\n]*))/, /^(?:("([^\n\"\\]|\\.)*"))/, /^(?:\])/, /^(?:\[\/video\])/, /^(?:(\[[0-9]{1,2}(:[0-5][0-9]){1,2}\])(\[)@)/, /^(?:(\[[0-9]{1,2}(:[0-5][0-9]){1,2}\]))/, /^(?:(\[[0-9]{1,2}(:[6-9][0-9]){1,2}\]))/, /^(?:([\t \r]+))/, /^(?:.)/, /^(?:(\[):)/, /^(?:(\[)@)/, /^(?:(\[)~)/, /^(?:(\[))/, /^(?:.)/, /^(?:([^\\\:\@\~\[\]\r\n\t ])+)/, /^(?:\\.)/, /^(?:[ \r\t]+:)/, /^(?:[ \r\t]+@)/, /^(?:[ \r\t]+~)/, /^(?:(\[):)/, /^(?:(\[)@)/, /^(?:(\[)~)/, /^(?:\])/, /^(?:(\[)ref\b)/, /^(?:(\[))/, /^(?:([\t \r]+))/, /^(?:.)/, /^(?:([0-9a-zA-Z][0-9a-zA-Z_]*))/, /^(?:("([^\n\"\\]|\\.)*"))/, /^(?:.)/, /^(?:\\)/, /^(?:\])/, /^(?:[ ])/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:site([\t \r]*)=)/, /^(?:page([\t \r]*)=)/, /^(?:url([\t \r]*)=)/, /^(?:title([\t \r]*)=)/, /^(?:article([\t \r]*)=)/, /^(?:author([\t \r]*)=)/, /^(?:editor([\t \r]*)=)/, /^(?:publisher([\t \r]*)=)/, /^(?:isbn([\t \r]*)=)/, /^(?:\])/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:([^\" \]\t\r\n][^ \]\t\r\n]*))/, /^(?:("([^\n\"\\]|\\.)*"))/, /^(?:\[\/video\])/, /^(?:([\t \r]+))/, /^(?:(\[)quote\b)/, /^(?:(\[):)/, /^(?:(\[)[0-9])/, /^(?:..)/, /^(?:.)/, /^(?:[^\]\n]+\])/, /^(?:([\t \r]+))/, /^(?:([\t \r]+))/, /^(?::([^\" \]\t\r\n][^ \]\t\r\n]*))/, /^(?::("([^\n\"\\]|\\.)*"))/, /^(?:\](\[))/, /^(?:\])/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:[0-9]+([\t \r]*)\])/, /^(?:([0-9a-zA-Z][0-9a-zA-Z_]*))/, /^(?:.)/], rules: [/^(?:$)/, /^(?:\r\n|\n)/, /^(?:(\[video\b))/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:member([\t \r]*)=)/, /^(?:stream_platform([\t \r]*)=)/, /^(?:stream_username([\t \r]*)=)/, /^(?:project([\t \r]*)=)/, /^(?:title([\t \r]*)=)/, /^(?:vod_platform([\t \r]*)=)/, /^(?:id([\t \r]*)=)/, /^(?:co_host([\t \r]*)=)/, /^(?:guest([\t \r]*)=)/, /^(?:annotator([\t \r]*)=)/, /^(?:\])/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:([^\" \]\t\r\n][^ \]\t\r\n]*))/, /^(?:("([^\n\"\\]|\\.)*"))/, /^(?:\])/, /^(?:\[\/video\])/, /^(?:(\[[0-9]{1,2}(:[0-5][0-9]){1,2}\])(\[)@)/, /^(?:(\[[0-9]{1,2}(:[0-5][0-9]){1,2}\]))/, /^(?:(\[[0-9]{1,2}(:[6-9][0-9]){1,2}\]))/, /^(?:([\t \r]+))/, /^(?:.)/, /^(?:(\[):)/, /^(?:(\[)@)/, /^(?:(\[)~)/, /^(?:(\[))/, /^(?:.)/, /^(?:([^\\\:\@\~\[\]\r\n\t ])+)/, /^(?:\\.)/, /^(?:[ \r\t]+:)/, /^(?:[ \r\t]+@)/, /^(?:[ \r\t]+~)/, /^(?:(\[):)/, /^(?:(\[)@)/, /^(?:(\[)~)/, /^(?:\])/, /^(?:(\[)ref\b)/, /^(?:(\[))/, /^(?:([\t \r]+))/, /^(?:.)/, /^(?:([0-9a-zA-Z][0-9a-zA-Z_]*))/, /^(?:("([^\n\"\\]|\\.)*"))/, /^(?:.)/, /^(?:\\)/, /^(?:\\#)/, /^(?:\])/, /^(?:[ ])/, /^(?:[ ]#[0-9]+)/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:site([\t \r]*)=)/, /^(?:page([\t \r]*)=)/, /^(?:url([\t \r]*)=)/, /^(?:title([\t \r]*)=)/, /^(?:article([\t \r]*)=)/, /^(?:author([\t \r]*)=)/, /^(?:editor([\t \r]*)=)/, /^(?:publisher([\t \r]*)=)/, /^(?:isbn([\t \r]*)=)/, /^(?:\])/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:([^\" \]\t\r\n][^ \]\t\r\n]*))/, /^(?:("([^\n\"\\]|\\.)*"))/, /^(?:\[\/video\])/, /^(?:([\t \r]+))/, /^(?:(\[)quote\b)/, /^(?:(\[):)/, /^(?:(\[)[0-9])/, /^(?:..)/, /^(?:.)/, /^(?:[^\]\n]+\])/, /^(?:([\t \r]+))/, /^(?:([\t \r]+))/, /^(?::([^\" \]\t\r\n][^ \]\t\r\n]*))/, /^(?::("([^\n\"\\]|\\.)*"))/, /^(?:\](\[))/, /^(?:\])/, /^(?:.)/, /^(?:([\t \r]+))/, /^(?:[0-9]+([\t \r]*)\])/, /^(?:([0-9a-zA-Z][0-9a-zA-Z_]*))/, /^(?:.)/],
conditions: { conditions: {
"QUOTES": { "QUOTES": {
"rules": [0, 1, 79, 80, 81, 82], "rules": [0, 1, 84, 85, 86, 87],
"inclusive": true "inclusive": true
}, },
"CATEGORIES": { "CATEGORIES": {
"rules": [0, 1, 73, 74, 75, 76, 77, 78], "rules": [0, 1, 78, 79, 80, 81, 82, 83],
"inclusive": true "inclusive": true
}, },
"AUTHOR": { "AUTHOR": {
"rules": [0, 1, 71, 72], "rules": [0, 1, 76, 77],
"inclusive": true "inclusive": true
}, },
"AFTERTEXT": { "AFTERTEXT": {
"rules": [0, 1, 64, 65, 66, 67, 68, 69, 70], "rules": [0, 1, 69, 70, 71, 72, 73, 74, 75],
"inclusive": true "inclusive": true
}, },
"R_ATTR": { "R_ATTR": {
"rules": [0, 1, 61, 62, 63], "rules": [0, 1, 66, 67, 68],
"inclusive": true "inclusive": true
}, },
"REF": { "REF": {
"rules": [0, 1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60], "rules": [0, 1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65],
"inclusive": true "inclusive": true
}, },
"MARKER_XTRA": { "MARKER_XTRA": {
"rules": [0, 1, 45, 46, 47, 48], "rules": [0, 1, 48, 49, 50, 51, 52, 53],
"inclusive": true "inclusive": true
}, },
"MARKER": { "MARKER": {
"rules": [0, 1, 42, 43, 44], "rules": [0, 1, 45, 46, 47],
"inclusive": true "inclusive": true
}, },
"TEXT": { "TEXT": {
"rules": [0, 1, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41], "rules": [0, 1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44],
"inclusive": true "inclusive": true
}, },
"TEXT_START": { "TEXT_START": {
"rules": [0, 1, 24, 25, 26, 27, 28], "rules": [0, 1, 27, 28, 29, 30, 31],
"inclusive": true "inclusive": true
}, },
"ANNOTATION": { "ANNOTATION": {
"rules": [0, 1, 18, 19, 20, 21, 22, 23], "rules": [0, 1, 21, 22, 23, 24, 25, 26],
"inclusive": true "inclusive": true
}, },
"V_ATTR": { "V_ATTR": {
"rules": [0, 1, 14, 15, 16, 17], "rules": [0, 1, 17, 18, 19, 20],
"inclusive": true "inclusive": true
}, },
"VIDEO": { "VIDEO": {
"rules": [0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], "rules": [0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
"inclusive": true "inclusive": true
}, },
"INITIAL": { "INITIAL": {

View File

@ -3,15 +3,7 @@ function HMML_parse(contents) {
var state = { var state = {
line: 0, line: 0,
annos: [], annos: [],
meta: { meta: {},
member: "",
twitch: "",
project: "",
title: "",
platform: "",
id: "",
annotator: ""
},
an: { an: {
line: 0, line: 0,
time: "", time: "",
@ -25,20 +17,7 @@ function HMML_parse(contents) {
}, },
is_quote: false is_quote: false
}, },
ref: { ref: {},
site: "",
page: "",
url: "",
title: "",
article: "",
author: "",
editor: "",
publisher: "",
isbn: "",
offset: 0
},
attr: "",
mnext: 0,
first: true first: true
}; };
l.setInput(contents, state); l.setInput(contents, state);

View File

@ -103,13 +103,16 @@ RB \]
<INITIAL>. { ERR(yy, "Missing video tag."); } <INITIAL>. { ERR(yy, "Missing video tag."); }
<VIDEO>{SP} {} <VIDEO>{SP} {}
<VIDEO>member{S}\= { yy.attr = "member"; yy_.begin("V_ATTR"); } <VIDEO>member{S}\= { yy.attr = "member"; yy_.begin("V_ATTR"); }
<VIDEO>twitch_username{S}\= { yy.attr = "twitch"; yy_.begin("V_ATTR"); } <VIDEO>stream_platform{S}\= { yy.attr = "stream_platform"; yy_.begin("V_ATTR"); }
<VIDEO>project{S}\= { yy.attr = "project"; yy_.begin("V_ATTR"); } <VIDEO>stream_username{S}\= { yy.attr = "stream_username"; yy_.begin("V_ATTR"); }
<VIDEO>title{S}\= { yy.attr = "title"; yy_.begin("V_ATTR"); } <VIDEO>project{S}\= { yy.attr = "project"; yy_.begin("V_ATTR"); }
<VIDEO>platform{S}\= { yy.attr = "platform"; yy_.begin("V_ATTR"); } <VIDEO>title{S}\= { yy.attr = "title"; yy_.begin("V_ATTR"); }
<VIDEO>id{S}\= { yy.attr = "id"; yy_.begin("V_ATTR"); } <VIDEO>vod_platform{S}\= { yy.attr = "vod_platform"; yy_.begin("V_ATTR"); }
<VIDEO>annotator{S}\= { yy.attr = "annotator"; yy_.begin("V_ATTR"); } <VIDEO>id{S}\= { yy.attr = "id"; yy_.begin("V_ATTR"); }
<VIDEO>co_host{S}\= { yy.attr = "co_host" yy_.begin("V_ATTR"); }
<VIDEO>guest{S}\= { yy.attr = "guest" yy_.begin("V_ATTR"); }
<VIDEO>annotator{S}\= { yy.attr = "annotator"; yy_.begin("V_ATTR"); }
<VIDEO>\] { yy_.begin("ANNOTATION"); }; <VIDEO>\] { yy_.begin("ANNOTATION"); };
<VIDEO>. { ERR(yy, "Invalid char '"+ yytext +"' in video tag."); } <VIDEO>. { ERR(yy, "Invalid char '"+ yytext +"' in video tag."); }
@ -128,17 +131,17 @@ RB \]
<TEXT_START>{LB}\: { M_(yy, "CATEGORY", "TEXT"); yy_.begin("MARKER"); } <TEXT_START>{LB}\: { M_(yy, "CATEGORY", "TEXT"); yy_.begin("MARKER"); }
<TEXT_START>{LB}\@ { M_(yy, "MEMBER" , "TEXT"); yy_.begin("MARKER"); } <TEXT_START>{LB}\@ { M_(yy, "MEMBER" , "TEXT"); yy_.begin("MARKER"); }
<TEXT_START>{LB}\~ { M_(yy, "PROJECT" , "TEXT"); yy_.begin("MARKER"); } <TEXT_START>{LB}\~ { M_(yy, "PROJECT" , "TEXT"); yy_.begin("MARKER"); }
<TEXT_START>{LB} { yy_.less(0); yy_.begin("TEXT"); } <TEXT_START>{LB} { yy_.less(0); yy_.begin("TEXT"); }
<TEXT_START>. { ERR(yy, "Unknown character '"+ yytext +"' after timecode."); } <TEXT_START>. { ERR(yy, "Unknown character '"+ yytext +"' after timecode."); }
<TEXT>{TEXT_BREAK}+ { yy.an.text += yytext; } <TEXT>{TEXT_BREAK}+ { yy.an.text += yytext; }
<TEXT>\\. { CHECKESCAPE(yy, yytext.charAt(1)); yy.an.text += yytext.substr(1, yyleng-1); } <TEXT>\\. { CHECKESCAPE(yy, yytext.charAt(1)); yy.an.text += yytext.substr(1, yyleng-1); }
<TEXT>[ \r\t]+\: { yy.an.text += ' '; M_(yy, "CATEGORY", "TEXT"); yy_.begin("MARKER"); } <TEXT>[ \r\t]+\: { yy.an.text += ' '; M_(yy, "CATEGORY", "TEXT"); yy_.begin("MARKER"); }
<TEXT>[ \r\t]+\@ { yy.an.text += ' '; M_(yy, "MEMBER" , "TEXT"); yy_.begin("MARKER"); } <TEXT>[ \r\t]+\@ { yy.an.text += ' '; M_(yy, "MEMBER" , "TEXT"); yy_.begin("MARKER"); }
<TEXT>[ \r\t]+\~ { yy.an.text += ' '; M_(yy, "PROJECT" , "TEXT"); yy_.begin("MARKER"); } <TEXT>[ \r\t]+\~ { yy.an.text += ' '; M_(yy, "PROJECT" , "TEXT"); yy_.begin("MARKER"); }
<TEXT>{LB}\: { M_(yy, "CATEGORY", "MARKER_XTRA"); yy_.begin("MARKER"); } <TEXT>{LB}\: { M_(yy, "CATEGORY", "MARKER_XTRA"); yy_.begin("MARKER"); }
<TEXT>{LB}\@ { M_(yy, "MEMBER" , "MARKER_XTRA"); yy_.begin("MARKER"); } <TEXT>{LB}\@ { M_(yy, "MEMBER" , "MARKER_XTRA"); yy_.begin("MARKER"); }
<TEXT>{LB}\~ { M_(yy, "PROJECT" , "MARKER_XTRA"); yy_.begin("MARKER"); } <TEXT>{LB}\~ { M_(yy, "PROJECT" , "MARKER_XTRA"); yy_.begin("MARKER"); }
<TEXT>\] { yy_.begin("AFTERTEXT"); } <TEXT>\] { yy_.begin("AFTERTEXT"); }
<TEXT>{LB}ref { yy.ref.offset = yy.an.text.length; yy_.begin("REF"); } <TEXT>{LB}ref { yy.ref.offset = yy.an.text.length; yy_.begin("REF"); }
<TEXT>{LB} {} <TEXT>{LB} {}
@ -149,10 +152,19 @@ RB \]
<MARKER>{ATTR_QUOTED} { M_ADD(yy, yytext.substr(1, yyleng-2)); yy_.begin(yy.mnext); }; <MARKER>{ATTR_QUOTED} { M_ADD(yy, yytext.substr(1, yyleng-2)); yy_.begin(yy.mnext); };
<MARKER>. { ERR(yy, "Cannot parse Marker. Expected quoted or alphanumeric attribute."); } <MARKER>. { ERR(yy, "Cannot parse Marker. Expected quoted or alphanumeric attribute."); }
<MARKER_XTRA>\\] { MX_ADD(yy, ']'); } <MARKER_XTRA>\\] { MX_ADD(yy, ']'); }
<MARKER_XTRA>\] { yy_.begin("TEXT"); } <MARKER_XTRA>\\\# { MX_ADD(yy, '#'); }
<MARKER_XTRA>[ ] { if(yy.an.markers[yy.an.markers.length - 1].parameter){ MX_ADD(yy, ' '); } } <MARKER_XTRA>\] { yy_.begin("TEXT"); }
<MARKER_XTRA>. { MX_ADD(yy, yytext); } <MARKER_XTRA>[ ] { if(yy.an.markers[yy.an.markers.length - 1].parameter){ MX_ADD(yy, ' '); } }
<MARKER_XTRA>[ ]\#[0-9]+ {
var m = yy.an.markers[yy.an.markers.length - 1];
if(m.type == "PROJECT"){
m.episode = yytext.substr(2);
} else {
MX_ADD(yytext.substr(1));
}
}
<MARKER_XTRA>. { MX_ADD(yy, yytext); }
<REF>{SP} {} <REF>{SP} {}
<REF>site{S}\= { yy.attr = "site"; yy_.begin("R_ATTR"); } <REF>site{S}\= { yy.attr = "site"; yy_.begin("R_ATTR"); }

View File

@ -1,4 +1,4 @@
[video member=nothings twitch_username=nothings2 project=obbg title="Open Block Building Game Development #42" platform=youtube id=FNL-4wnsSCo annotator=Miblo] [video member=nothings stream_platform=twitch stream_username=nothings2 project=obbg title="Open Block Building Game Development #42" vod_platform=youtube id=FNL-4wnsSCo annotator=Miblo]
[0:39][Recap and set the stage for the episode] [0:39][Recap and set the stage for the episode]
[1:15][:Run the game to :demo the current status, hit the assert in visit() and investigate why] [1:15][:Run the game to :demo the current status, hit the assert in visit() and investigate why]
[2:47][Fix that assert and consider natural things to do] [2:47][Fix that assert and consider natural things to do]
@ -61,7 +61,7 @@
[2:39:24][Introduce copy_belt(), copy_machine(), copy_belt_machine() and copy_picker()][:simulation] [2:39:24][Introduce copy_belt(), copy_machine(), copy_belt_machine() and copy_picker()][:simulation]
[2:46:52][Put the item directly in the render_belt_run struct and make the copy_*() functions take a belt_run][:simulation] [2:46:52][Put the item directly in the render_belt_run struct and make the copy_*() functions take a belt_run][:simulation]
[2:48:44][@edelknecht][Was / is there a good reason for old C not to allow declarations anywhere other than at the head of a block?][:experience :language] [2:48:44][@edelknecht][Was / is there a good reason for old C not to allow declarations anywhere other than at the head of a block?][:experience :language]
[2:50:53][@woogyface][I never saw something like uint8 state:6. What does :6 mean?][:language] [2:50:53][@woogyface][I never saw something like uint8 state\:6. What does \:6 mean?][:language]
[2:52:45][Make copy_logi_chunk() handle the new versions of the copy_*() functions, complete with sound effects][:simulation :trivia :audio] [2:52:45][Make copy_logi_chunk() handle the new versions of the copy_*() functions, complete with sound effects][:simulation :trivia :audio]
[2:53:46][@insofaras][I like keeping the scope of declarations as small as possible][:language] [2:53:46][@insofaras][I like keeping the scope of declarations as small as possible][:language]
[2:55:46][@ginger_bill][Do you think function overloading is ever "really needed"? Or are default parameters and / or parametric polymorphic functions better?][:language :experience :rant] [2:55:46][@ginger_bill][Do you think function overloading is ever "really needed"? Or are default parameters and / or parametric polymorphic functions better?][:language :experience :rant]