var d={term:!0,method:!0,accu:!0,rule:!0,then:!0,is:!0,and:!0,or:!0,if:!0,default:!0},c={var_input:!0,var_output:!0,fuzzify:!0,defuzzify:!0,function_block:!0,ruleblock:!0},i={end_ruleblock:!0,end_defuzzify:!0,end_function_block:!0,end_fuzzify:!0,end_var:!0},s={true:!0,false:!0,nan:!0,real:!0,min:!0,max:!0,cog:!0,cogs:!0},a=/[+\-*&^%:=<>!|\/]/;function u(e,n){var t=e.next();if(/[\d\.]/.test(t))return t=="."?e.match(/^[0-9]+([eE][\-+]?[0-9]+)?/):t=="0"?e.match(/^[xX][0-9a-fA-F]+/)||e.match(/^0[0-7]+/):e.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/),"number";if(t=="/"||t=="("){if(e.eat("*"))return n.tokenize=l,l(e,n);if(e.eat("/"))return e.skipToEnd(),"comment"}if(a.test(t))return e.eatWhile(a),"operator";e.eatWhile(/[\w\$_\xa1-\uffff]/);var r=e.current().toLowerCase();return d.propertyIsEnumerable(r)||c.propertyIsEnumerable(r)||i.propertyIsEnumerable(r)?"keyword":s.propertyIsEnumerable(r)?"atom":"variable"}function l(e,n){for(var t=!1,r;r=e.next();){if((r=="/"||r==")")&&t){n.tokenize=u;break}t=r=="*"}return"comment"}function f(e,n,t,r,o){this.indented=e,this.column=n,this.type=t,this.align=r,this.prev=o}function m(e,n,t){return e.context=new f(e.indented,n,t,null,e.context)}function p(e){if(e.context.prev)return e.context.type=="end_block"&&(e.indented=e.context.indented),e.context=e.context.prev}const k={name:"fcl",startState:function(e){return{tokenize:null,context:new f(-e,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,n){var t=n.context;if(e.sol()&&(t.align??(t.align=!1),n.indented=e.indentation(),n.startOfLine=!0),e.eatSpace())return null;var r=(n.tokenize||u)(e,n);if(r=="comment")return r;t.align??(t.align=!0);var o=e.current().toLowerCase();return c.propertyIsEnumerable(o)?m(n,e.column(),"end_block"):i.propertyIsEnumerable(o)&&p(n),n.startOfLine=!1,r},indent:function(e,n,t){if(e.tokenize!=u&&e.tokenize!=null)return 0;var r=e.context,o=i.propertyIsEnumerable(n);return r.align?r.column+(o?0:1):r.indented+(o?0:t.unit)},languageData:{commentTokens:{line:"//",block:{open:"(*",close:"*)"}}}};export{k as fcl};
