var i;function u(e){return RegExp("^(?:"+e.join("|")+")$","i")}u([]);var f=u(["@prefix","@base","a"]),x=/[*+\-<>=&|]/;function p(e,t){var n=e.next();if(i=null,n=="<"&&!e.match(/^[\s\u00a0=]/,!1))return e.match(/^[^\s\u00a0>]*>?/),"atom";if(n=='"'||n=="'")return t.tokenize=s(n),t.tokenize(e,t);if(/[{}\(\),\.;\[\]]/.test(n))return i=n,null;if(n=="#")return e.skipToEnd(),"comment";if(x.test(n))return e.eatWhile(x),null;if(n==":")return"operator";if(e.eatWhile(/[_\w\d]/),e.peek()==":")return"variableName.special";var r=e.current();return f.test(r)?"meta":n>="A"&&n<="Z"?"comment":"keyword";var r}function s(e){return function(t,n){for(var r=!1,o;(o=t.next())!=null;){if(o==e&&!r){n.tokenize=p;break}r=!r&&o=="\\"}return"string"}}function c(e,t,n){e.context={prev:e.context,indent:e.indent,col:n,type:t}}function a(e){e.indent=e.context.indent,e.context=e.context.prev}const m={name:"turtle",startState:function(){return{tokenize:p,context:null,indent:0,col:0}},token:function(e,t){if(e.sol()&&(t.context&&t.context.align==null&&(t.context.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var n=t.tokenize(e,t);if(n!="comment"&&t.context&&t.context.align==null&&t.context.type!="pattern"&&(t.context.align=!0),i=="(")c(t,")",e.column());else if(i=="[")c(t,"]",e.column());else if(i=="{")c(t,"}",e.column());else if(/[\]\}\)]/.test(i)){for(;t.context&&t.context.type=="pattern";)a(t);t.context&&i==t.context.type&&a(t)}else i=="."&&t.context&&t.context.type=="pattern"?a(t):/atom|string|variable/.test(n)&&t.context&&(/[\}\]]/.test(t.context.type)?c(t,"pattern",e.column()):t.context.type=="pattern"&&!t.context.align&&(t.context.align=!0,t.context.col=e.column()));return n},indent:function(e,t,n){var r=t&&t.charAt(0),o=e.context;if(/[\]\}]/.test(r))for(;o&&o.type=="pattern";)o=o.prev;var l=o&&r==o.type;return o?o.type=="pattern"?o.col:o.align?o.col+(l?0:1):o.indent+(l?0:n.unit):0},languageData:{commentTokens:{line:"#"}}};export{m as t};
