| @@ 762-769 (lines=8) @@ | ||
| 759 | * @param string $tok |
|
| 760 | * @param string|null $msg |
|
| 761 | */ |
|
| 762 | public function expect($tok, $msg = NULL) { |
|
| 763 | $result = $this->match( array($tok) ); |
|
| 764 | if (!$result) { |
|
| 765 | $this->Error( $msg ? "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'" : $msg ); |
|
| 766 | } else { |
|
| 767 | return $result; |
|
| 768 | } |
|
| 769 | } |
|
| 770 | ||
| 771 | /** |
|
| 772 | * @param string $tok |
|
| @@ 774-781 (lines=8) @@ | ||
| 771 | /** |
|
| 772 | * @param string $tok |
|
| 773 | */ |
|
| 774 | public function expectChar($tok, $msg = null ){ |
|
| 775 | $result = $this->MatchChar($tok); |
|
| 776 | if( !$result ){ |
|
| 777 | $this->Error( $msg ? "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'" : $msg ); |
|
| 778 | }else{ |
|
| 779 | return $result; |
|
| 780 | } |
|
| 781 | } |
|
| 782 | ||
| 783 | // |
|
| 784 | // Here in, the parsing rules/functions |
|