3 * Search tokenizer - used with fields that are sent to Text_SearchParser
7 * x = new Pman.SearchTokenizer('a and b or "test this" or ( tst:aval and vvv:erer }')
12 * data = Pman.SearchTokenizer.parse(....)
15 Pman.SearchTokenizer = function(s)
18 this.strlen = s.length;
23 Pman.SearchTokenizer.prototype = {
36 if (false === c) { //eof..
41 case ':': this.tokens.push( { type : ':' }) ; break;
42 case '(': this.tokens.push( { type : '(' }) ; break;
43 case ')': this.tokens.push( { type : ')' }) ; break;
52 // should not get here...
55 strParse : function ()
70 case ')': this.addStr(str); this.ungetChar(); return;
76 this.strParseQuoted(c);
87 strParseQuoted: function (end)
89 var str = ''; /// ignore \" slashed ???
94 this.addStr(str,true);
98 this.addStr(str,true);
105 function addStr(s, q=false) { //q == quoted..
112 if ((strtoupper(s) == 'AND') || (strtoupper(s) == 'OR')) {
113 this.tokens[] = new Text_SearchParser_Token_Op(strtoupper(s));
117 this.tokens[] = new Text_SearchParser_Token_String(s);
122 if (this.i >= this.strlen) {
125 c = this.str[this.i];