function words(e){for(var n={},t=e.split(" "),r=0;r<t.length;++r)n[t[r]]=!0;return n}var keywords=words("if elsif else stop require"),atoms=words("true false not");function tokenBase(e,n){var t=e.next();if("/"==t&&e.eat("*"))return n.tokenize=tokenCComment,tokenCComment(e,n);if("#"===t)return e.skipToEnd(),"comment";if('"'==t)return n.tokenize=tokenString(t),n.tokenize(e,n);if("("==t)return n._indent.push("("),n._indent.push("{"),null;if("{"===t)return n._indent.push("{"),null;if(")"==t&&(n._indent.pop(),n._indent.pop()),"}"===t)return n._indent.pop(),null;if(","==t)return null;if(";"==t)return null;if(/[{}\(\),;]/.test(t))return null;if(/\d/.test(t))return e.eatWhile(/[\d]/),e.eat(/[KkMmGg]/),"number";if(":"==t)return e.eatWhile(/[a-zA-Z_]/),e.eatWhile(/[a-zA-Z0-9_]/),"operator";e.eatWhile(/\w/);var r=e.current();return "text"==r&&e.eat(":")?(n.tokenize=tokenMultiLineString,"string"):keywords.propertyIsEnumerable(r)?"keyword":atoms.propertyIsEnumerable(r)?"atom":null}function tokenMultiLineString(e,n){return n._multiLineString=!0,e.sol()?("."==e.next()&&e.eol()&&(n._multiLineString=!1,n.tokenize=tokenBase),"string"):(e.eatSpace(),"#"==e.peek()?(e.skipToEnd(),"comment"):(e.skipToEnd(),"string"))}function tokenCComment(e,n){for(var t,r=!1;null!=(t=e.next());){if(r&&"/"==t){n.tokenize=tokenBase;break}r="*"==t;}return "comment"}function tokenString(e){return function(n,t){for(var r,i=!1;null!=(r=n.next())&&(r!=e||i);)i=!i&&"\\"==r;return i||(t.tokenize=tokenBase),"string"}}const sieve={startState:function(e){return {tokenize:tokenBase,baseIndent:e||0,_indent:[]}},token:function(e,n){return e.eatSpace()?null:(n.tokenize||tokenBase)(e,n)},indent:function(e,n,t){var r=e._indent.length;return n&&"}"==n[0]&&r--,r<0&&(r=0),r*t.unit},languageData:{indentOnInput:/^\s*\}$/}};

export { sieve };
