(aa&bb)^(!cc ^!(dd ^ ee))SQLのような行:(?f LIKE "%aa%" AND?f LIKE "%bb%")OR(?f NOT LIKE "%cc% "OR!((?F LIKE"%dd% "OR?F LIKE"%ee% ")))。 簡単にするためにSQLのように書きました。実際にはSPHINXがあり、最終的には必須ではありませんでしたが、 正式な文法を記述してPHPに実装することでこれを達成した方法について説明します。
すでに投稿を入力している場合は、あなたにそれを公開します。数学の高等教育にもかかわらず、私は初めてこれを行いました。その前に聞いたことはありましたが、それを行う方法を見ていませんでした。 したがって、私はすべての高額な数学者と達人に正しい決定を下し、あらゆる方法で私を修正するように頼みますが、今のところ、私は自分の結果とどうやって来たのかについて話します。
目標を達成するためのいくつかのオプションがありました。
1つ目は、再帰的な(「?R」を思い出してください)レギュラーを書くことですが、「スポーツではない」というオプションは破棄しました。レミングスは私を罰します=)
2番目の方法は、ツリーの構造を手で書くことですが、どういうわけか、多くを書くのは非常に苦痛で、どういうわけか不器用です。
3番目は、「形式文法」という言葉を覚えることです。 はい、彼らは一見怖いように見えますが、実際には、すべてがはるかに優れており、便利です-私はそれを選びました。 私はこれがそのような概念の私の最初の実装であることを繰り返しますので、私の間違いを気軽に指摘してください!
それでは始めましょう:
アルファベットを作ろう
アルファベット= {(、)、!、&、^、(、)、AZ、space here、-、_、a-Z}
操作の優先順位を考慮して、タスクのメタアルファベットを作成します(&および^よりも優先順位が高く、後者も同じ優先順位です)。
F-> T | T&F | T ^ F
T *-> I |!I |!S
I->(F)| S
S-> C | SC
C-> [a-Z_ a-Z-]
これらは、メタアルファベット要素が下から上に形成される規則です。
Fは式、Tは用語、Iはアイテム、Sは文字列、Cは記号です。 彼はそのように呼んだ。
* T!Sに入力されているため、「!」のように解釈されます。
ご覧のとおり、否定の構文解析を含む文法(!)は、他の操作の構文解析を含む文法(&および^)よりも低く、括弧の構文解析を含む文法はさらに低くなっています-これは操作の優先順位を形成します。
このようなタスクのチョムスキー階層のコンテキストに依存しない G 2文法を取得しました-単純な短いが、有限状態マシンほど単純ではありません(したがって、純粋な「規則」では、そのような問題は再帰なしで解決されません)。
現在、これらすべてを実装する必要があります。 コーディングの仕方がおもしろいとは思わないので、読者を苦しめることなく最終的なコードをレイアウトします。構文エラーの検索を実装していないことに気付くでしょう(ただし、コードに最もひどいエラーをいくつか解析しました)。
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
Copy Source | Copy HTML class GrammarParcer2SQLToken{ private $string = '' ; private $index = 0 ; private $sql_token = '' ; private $error = null ; public function __construct( $s = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; } public function parce( $s = null , $e = null ){ if (! empty ( $s )) $this ->string = $s ; $this ->index = 0 ; $this ->error = null ; $this ->F(); $e = $this ->error; return $this ->sql_token; } public function getError(){ return $this ->error; } protected function setError( $mes ){ $this ->error = $mes ; } protected function isEnd(){ if (! empty ( $this ->error) or $this ->index >= strlen( $this ->string)) return true ; return false ; } protected function F(){ $this ->T(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '&' ){ $this ->sql_token.= ' AND ' ; } elseif ( $this ->string{ $this ->index} == '^' or $this ->string{ $this ->index} == '|' ){ $this ->sql_token.= ' OR ' ; } else { return ; } $this ->index++; $this ->F(); } protected function T(){ $this ->I(); if ( $this ->isEnd()) return ; if ( $this ->string{ $this ->index} == '!' ){ $this ->index++; if (! $this ->S( 'invert' )){ $this ->sql_token.= '!(' ; $this ->I(); $this ->sql_token.= ')' ; } } } protected function I(){ if ( $this ->string{ $this ->index} == '(' ){ $this ->sql_token.= '(' ; $this ->index++; $this ->F(); if ( $this ->string{ $this ->index} !== ')' ){ $this ->setError( 'parse error, expected ")" on offset: ' . $this ->index); // . } $this ->sql_token.= ')' ; $this ->index++; } else { $this ->S(); } } protected function S( $invert = false ){ if ( $this ->isEnd()) return false ; $string = '' ; while (! $this ->isEnd()){ if (preg_match( '~[0-9a-z-_ -]~i' , $this ->string{ $this ->index})){ $string .= $this ->string{ $this ->index}; $this ->index++; continue ; } elseif (!preg_match( '~[&)(!|^]~i' , $this ->string{ $this ->index})){ $this ->setError( 'parse error, unexpected "' . $this ->string{ $this ->index}. '" on offset: ' . $this ->index); // =) } break ; } if ( empty ( $string )) return false ; $this ->sql_token.= '?f ' .( $invert ? 'NOT ' : '' ). 'LIKE "%' .mysql_escape_string( $string ). '%"' ; return true ; } }
例を参照してください:
Copy Source | Copy HTML
- $ input = '(aa&bb)^(!cc ^!(dd ^ ee))' ;
- $パーサー = new GrammarParcer2SQLToken();
- echo $ parcer- > parce( $ input );
- echo "\ n" 。 $パーサー -> getError();
UPDがコードの色付けを行いました-sc.meに感謝