var isStringChar=/[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\"\\]/,isOperatorChar=/[\|\!\+\-\*\?\~\^\&]/,isOperatorString=/^(OR|AND|NOT|TO)$/;function tokenWord(ch){return function(stream,state){for(var word=ch;(ch=stream.peek())&&null!=ch.match(isStringChar);)word+=stream.next();return state.tokenize=tokenBase,isOperatorString.test(word)?"operator":function(word){return parseFloat(word).toString()===word}(word)?"number":":"==stream.peek()?"propertyName":"string"}}function tokenBase(stream,state){var operator,quote,ch=stream.next();return'"'==ch?state.tokenize=(quote=ch,function(stream,state){for(var next,escaped=!1;null!=(next=stream.next())&&(next!=quote||escaped);)escaped=!escaped&&"\\"==next;return escaped||(state.tokenize=tokenBase),"string"}):isOperatorChar.test(ch)?state.tokenize=(operator=ch,function(stream,state){return"|"==operator?stream.eat(/\|/):"&"==operator&&stream.eat(/\&/),state.tokenize=tokenBase,"operator"}):isStringChar.test(ch)&&(state.tokenize=tokenWord(ch)),state.tokenize!=tokenBase?state.tokenize(stream,state):null}const solr={name:"solr",startState:function(){return{tokenize:tokenBase}},token:function(stream,state){return stream.eatSpace()?null:state.tokenize(stream,state)}};export{solr};
