| @@ 778-785 (lines=8) @@ | ||
| 775 | * @param string $tok |
|
| 776 | * @param string|null $msg |
|
| 777 | */ |
|
| 778 | public function expect($tok, $msg = NULL) { |
|
| 779 | $result = $this->match( array($tok) ); |
|
| 780 | if (!$result) { |
|
| 781 | $this->Error( $msg ? "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'" : $msg ); |
|
| 782 | } else { |
|
| 783 | return $result; |
|
| 784 | } |
|
| 785 | } |
|
| 786 | ||
| 787 | /** |
|
| 788 | * @param string $tok |
|
| @@ 790-797 (lines=8) @@ | ||
| 787 | /** |
|
| 788 | * @param string $tok |
|
| 789 | */ |
|
| 790 | public function expectChar($tok, $msg = null ){ |
|
| 791 | $result = $this->MatchChar($tok); |
|
| 792 | if( !$result ){ |
|
| 793 | $this->Error( $msg ? "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'" : $msg ); |
|
| 794 | }else{ |
|
| 795 | return $result; |
|
| 796 | } |
|
| 797 | } |
|
| 798 | ||
| 799 | // |
|
| 800 | // Here in, the parsing rules/functions |
|