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