function e(e){for(var t={},n=e.split(` `),r=0;r<n.length;++r)t[n[r]]=!0;return t}var t=e(`algorithm and annotation assert block break class connect connector constant constrainedby der discrete each else elseif elsewhen encapsulated end enumeration equation expandable extends external false final flow for function if import impure in initial inner input loop model not operator or outer output package parameter partial protected public pure record redeclare replaceable return stream then true type when while within`),n=e(`abs acos actualStream asin atan atan2 cardinality ceil cos cosh delay div edge exp floor getInstanceName homotopy inStream integer log log10 mod pre reinit rem semiLinear sign sin sinh spatialDistribution sqrt tan tanh`),r=e(`Real Boolean Integer String`),i=[].concat(Object.keys(t),Object.keys(n),Object.keys(r)),a=/[;=\(:\),{}.*<>+\-\/^\[\]]/,o=/(:=|<=|>=|==|<>|\.\+|\.\-|\.\*|\.\/|\.\^)/,s=/[0-9]/,c=/[_a-zA-Z]/;function l(e,t){return e.skipToEnd(),t.tokenize=null,`comment`}function u(e,t){for(var n=!1,r;r=e.next();){if(n&&r==`/`){t.tokenize=null;break}n=r==`*`}return`comment`}function d(e,t){for(var n=!1,r;(r=e.next())!=null;){if(r==`"`&&!n){t.tokenize=null,t.sol=!1;break}n=!n&&r==`\\`}return`string`}function f(e,i){for(e.eatWhile(s);e.eat(s)||e.eat(c););var a=e.current();return i.sol&&(a==`package`||a==`model`||a==`when`||a==`connector`)?i.level++:i.sol&&a==`end`&&i.level>0&&i.level--,i.tokenize=null,i.sol=!1,t.propertyIsEnumerable(a)?`keyword`:n.propertyIsEnumerable(a)?`builtin`:r.propertyIsEnumerable(a)?`atom`:`variable`}function p(e,t){for(;e.eat(/[^']/););return t.tokenize=null,t.sol=!1,e.eat(`'`)?`variable`:`error`}function m(e,t){return e.eatWhile(s),e.eat(`.`)&&e.eatWhile(s),(e.eat(`e`)||e.eat(`E`))&&(e.eat(`-`)||e.eat(`+`),e.eatWhile(s)),t.tokenize=null,t.sol=!1,`number`}var h={name:`modelica`,startState:function(){return{tokenize:null,level:0,sol:!0}},token:function(e,t){if(t.tokenize!=null)return t.tokenize(e,t);if(e.sol()&&(t.sol=!0),e.eatSpace())return t.tokenize=null,null;var n=e.next();if(n==`/`&&e.eat(`/`))t.tokenize=l;else if(n==`/`&&e.eat(`*`))t.tokenize=u;else if(o.test(n+e.peek()))return e.next(),t.tokenize=null,`operator`;else if(a.test(n))return t.tokenize=null,`operator`;else if(c.test(n))t.tokenize=f;else if(n==`'`&&e.peek()&&e.peek()!=`'`)t.tokenize=p;else if(n==`"`)t.tokenize=d;else if(s.test(n))t.tokenize=m;else return t.tokenize=null,`error`;return t.tokenize(e,t)},indent:function(e,t,n){if(e.tokenize!=null)return null;var r=e.level;return/(algorithm)/.test(t)&&r--,/(equation)/.test(t)&&r--,/(initial algorithm)/.test(t)&&r--,/(initial equation)/.test(t)&&r--,/(end)/.test(t)&&r--,r>0?n.unit*r:0},languageData:{commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}},autocomplete:i}};export{h as modelica};
//# sourceMappingURL=modelica.B4_xjNOc.js.map