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