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 // 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 addStr : function (s,q) { //q == quoted..
108 s = q ? s : Roo.util.Format.trim(s);
114 if ((s.toUpperCase() == 'AND') || (s.toUpperCase() == 'OR')) {
115 this.tokens.push( { type: s.toUpperCase() });
119 this.tokens.push( { type : 's' , v : s });
122 getChar : function ()
125 if (this.i >= this.strlen) {
128 c = this.str[this.i];
132 ungetChar : function ()
139 Pman.SearchTokenizer.parse = function(v) {
140 var x = new Pman.SearchTokenizer(v);