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