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)
17 this.str = typeof(s) == 'string' ? s : '';
18 this.strlen = typeof(s) == 'string' ? s.length : 0;
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 // sort tokens longest first..
56 // should not get here...
59 strParse : function ()
74 case ')': this.addStr(str); this.ungetChar(); return;
80 this.strParseQuoted(c);
91 strParseQuoted: function (end)
93 var str = ''; /// ignore \" slashed ???
98 this.addStr(str,true);
102 this.addStr(str,true);
109 addStr : function (s,q) { //q == quoted..
112 s = q ? s : Roo.util.Format.trim(s);
118 if ((s.toUpperCase() == 'AND') || (s.toUpperCase() == 'OR')) {
119 this.tokens.push( { type: s.toUpperCase() });
123 this.tokens.push( { type : 's' , v : s, q: q });
126 getChar : function ()
129 if (this.i >= this.strlen) {
132 c = this.str[this.i];
136 ungetChar : function ()
143 Pman.SearchTokenizer.parse = function(v) {
144 var x = new Pman.SearchTokenizer(v);