var Location={PRE_SUBJECT:0,WRITING_SUB_URI:1,WRITING_BNODE_URI:2,PRE_PRED:3,WRITING_PRED_URI:4,PRE_OBJ:5,WRITING_OBJ_URI:6,WRITING_OBJ_BNODE:7,WRITING_OBJ_LITERAL:8,WRITING_LIT_LANG:9,WRITING_LIT_TYPE:10,POST_OBJ:11,ERROR:12};function transitState(t,n){var a,o=t.location;a=o==Location.PRE_SUBJECT&&"<"==n?Location.WRITING_SUB_URI:o==Location.PRE_SUBJECT&&"_"==n?Location.WRITING_BNODE_URI:o==Location.PRE_PRED&&"<"==n?Location.WRITING_PRED_URI:o==Location.PRE_OBJ&&"<"==n?Location.WRITING_OBJ_URI:o==Location.PRE_OBJ&&"_"==n?Location.WRITING_OBJ_BNODE:o==Location.PRE_OBJ&&'"'==n?Location.WRITING_OBJ_LITERAL:o==Location.WRITING_SUB_URI&&">"==n||o==Location.WRITING_BNODE_URI&&" "==n?Location.PRE_PRED:o==Location.WRITING_PRED_URI&&">"==n?Location.PRE_OBJ:o==Location.WRITING_OBJ_URI&&">"==n||o==Location.WRITING_OBJ_BNODE&&" "==n||o==Location.WRITING_OBJ_LITERAL&&'"'==n||o==Location.WRITING_LIT_LANG&&" "==n||o==Location.WRITING_LIT_TYPE&&">"==n?Location.POST_OBJ:o==Location.WRITING_OBJ_LITERAL&&"@"==n?Location.WRITING_LIT_LANG:o==Location.WRITING_OBJ_LITERAL&&"^"==n?Location.WRITING_LIT_TYPE:" "!=n||o!=Location.PRE_SUBJECT&&o!=Location.PRE_PRED&&o!=Location.PRE_OBJ&&o!=Location.POST_OBJ?o==Location.POST_OBJ&&"."==n?Location.PRE_SUBJECT:Location.ERROR:o,t.location=a;}const ntriples={startState:function(){return {location:Location.PRE_SUBJECT,uris:[],anchors:[],bnodes:[],langs:[],types:[]}},token:function(t,n){var a=t.next();if("<"==a){transitState(n,a);var o="";return t.eatWhile((function(t){return "#"!=t&&">"!=t&&(o+=t,!0)})),n.uris.push(o),t.match("#",!1)?"variable":(t.next(),transitState(n,">"),"variable")}if("#"==a){var i="";return t.eatWhile((function(t){return ">"!=t&&" "!=t&&(i+=t,!0)})),n.anchors.push(i),"url"}if(">"==a)return transitState(n,">"),"variable";if("_"==a){transitState(n,a);var I="";return t.eatWhile((function(t){return " "!=t&&(I+=t,!0)})),n.bnodes.push(I),t.next(),transitState(n," "),"builtin"}if('"'==a)return transitState(n,a),t.eatWhile((function(t){return '"'!=t})),t.next(),"@"!=t.peek()&&"^"!=t.peek()&&transitState(n,'"'),"string";if("@"==a){transitState(n,"@");var _="";return t.eatWhile((function(t){return " "!=t&&(_+=t,!0)})),n.langs.push(_),t.next(),transitState(n," "),"string.special"}if("^"==a){t.next(),transitState(n,"^");var R="";return t.eatWhile((function(t){return ">"!=t&&(R+=t,!0)})),n.types.push(R),t.next(),transitState(n,">"),"variable"}" "==a&&transitState(n,a),"."==a&&transitState(n,a);}};

export { ntriples };
