!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";t.defineMode("turtle",function(t){var r,i=t.indentUnit;function e(t){return new RegExp("^(?:"+t.join("|")+")$","i")}e([]);var c=e(["@prefix","@base","a"]),u=/[*+\-<>=&|]/;function l(t,e){var n=t.next();if(r=null,"<"!=n||t.match(/^[\s\u00a0=]/,!1)){if('"'==n||"'"==n)return e.tokenize=function(r){return function(t,e){for(var n,o=!1;null!=(n=t.next());){if(n==r&&!o){e.tokenize=l;break}o=!o&&"\\"==n}return"string"}}(n),e.tokenize(t,e);if(/[{}\(\),\.;\[\]]/.test(n))return r=n,null;if("#"==n)return t.skipToEnd(),"comment";if(u.test(n))return t.eatWhile(u),null;if(":"==n)return"operator";if(t.eatWhile(/[_\w\d]/),":"==t.peek())return"variable-3";var o=t.current();return c.test(o)?"meta":"A"<=n&&n<="Z"?"comment":"keyword"}return t.match(/^[^\s\u00a0>]*>?/),"atom"}function o(t,e,n){t.context={prev:t.context,indent:t.indent,col:n,type:e}}function a(t){t.indent=t.context.indent,t.context=t.context.prev}return{startState:function(){return{tokenize:l,context:null,indent:0,col:0}},token:function(t,e){if(t.sol()&&(e.context&&null==e.context.align&&(e.context.align=!1),e.indent=t.indentation()),t.eatSpace())return null;var n=e.tokenize(t,e);if("comment"!=n&&e.context&&null==e.context.align&&"pattern"!=e.context.type&&(e.context.align=!0),"("==r)o(e,")",t.column());else if("["==r)o(e,"]",t.column());else if("{"==r)o(e,"}",t.column());else if(/[\]\}\)]/.test(r)){for(;e.context&&"pattern"==e.context.type;)a(e);e.context&&r==e.context.type&&a(e)}else"."==r&&e.context&&"pattern"==e.context.type?a(e):/atom|string|variable/.test(n)&&e.context&&(/[\}\]]/.test(e.context.type)?o(e,"pattern",t.column()):"pattern"!=e.context.type||e.context.align||(e.context.align=!0,e.context.col=t.column()));return n},indent:function(t,e){var n=e&&e.charAt(0),o=t.context;if(/[\]\}]/.test(n))for(;o&&"pattern"==o.type;)o=o.prev;var r=o&&n==o.type;return o?"pattern"==o.type?o.col:o.align?o.col+(r?0:1):o.indent+(r?0:i):0},lineComment:"#"}}),t.defineMIME("text/turtle","turtle")});