PHP:正式な文法の実装

最近、次の形式の文字列を生成する検索文字列のパーサーを作成する必要がありました
(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 ; } }
  1. 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 ; } }
  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 ; } }
  3. 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 ; } }
  4. 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 ; } }
  5. 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 ; } }
  6. 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 ; } }
  7. 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 ; } }
  8. 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 ; } }
  9. 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 ; } }
  10. 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 ; } }
  11. 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 ; } }
  12. 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 ; } }
  13. 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 ; } }
  14. 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 ; } }
  15. 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 ; } }
  16. 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 ; } }
  17. 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 ; } }
  18. 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 ; } }
  19. 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 ; } }
  20. 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 ; } }
  21. 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 ; } }
  22. 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 ; } }
  23. 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 ; } }
  24. 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 ; } }
  25. 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 ; } }
  26. 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 ; } }
  27. 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 ; } }
  28. 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 ; } }
  29. 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 ; } }
  30. 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 ; } }
  31. 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 ; } }
  32. 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 ; } }
  33. 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 ; } }
  34. 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 ; } }
  35. 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 ; } }
  36. 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 ; } }
  37. 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 ; } }
  38. 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 ; } }
  39. 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 ; } }
  40. 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 ; } }
  41. 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 ; } }
  42. 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 ; } }
  43. 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 ; } }
  44. 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 ; } }
  45. 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 ; } }
  46. 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 ; } }
  47. 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 ; } }
  48. 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 ; } }
  49. 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 ; } }
  50. 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 ; } }
  51. 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 ; } }
  52. 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 ; } }
  53. 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 ; } }
  54. 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 ; } }
  55. 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 ; } }
  56. 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 ; } }
  57. 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 ; } }
  58. 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 ; } }
  59. 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 ; } }
  60. 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 ; } }
  61. 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 ; } }
  62. 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 ; } }
  63. 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 ; } }
  64. 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 ; } }
  65. 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 ; } }
  66. 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 ; } }
  67. 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 ; } }
  68. 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 ; } }
  69. 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 ; } }
  70. 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 ; } }
  71. 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 ; } }
  72. 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 ; } }
  73. 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 ; } }
  74. 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 ; } }
  75. 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 ; } }
  76. 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 ; } }
  77. 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 ; } }
  78. 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 ; } }
  79. 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 ; } }
  80. 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 ; } }
  81. 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 ; } }
  82. 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 ; } }
  83. 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 ; } }
  84. 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 ; } }
  85. 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 ; } }
  86. 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 ; } }
  87. 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 ; } }
  88. 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 ; } }
  89. 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 ; } }
  90. 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 ; } }
  91. 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 ; } }
  92. 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 ; } }
  93. 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 ; } }
  94. 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
  1. $ input = '(aa&bb)^(!cc ^!(dd ^ ee))' ;
  2. $パーサー = new GrammarParcer2SQLToken();
  3. echo $ parcer- > parce( $ input );
  4. echo "\ n"$パーサー -> getError();


UPDがコードの色付けを行いました-sc.meに感謝

Source: https://habr.com/ru/post/J73665/


All Articles