@@ -133,19 +133,19 @@ private function read_next_token(): ?token {
133133 return $ this ->read_operator ();
134134 }
135135 // There are some single-character tokens...
136- if ( preg_match ( ' /[]\[(){},;π \\ \]/ ' , $ currentchar )) {
137- $ types = [
138- ' [ ' => token::OPENING_BRACKET ,
139- ' ( ' => token::OPENING_PAREN ,
140- ' { ' => token::OPENING_BRACE ,
141- ' ] ' => token::CLOSING_BRACKET ,
142- ' ) ' => token::CLOSING_PAREN ,
143- ' } ' => token::CLOSING_BRACE ,
144- ' , ' => token::ARG_SEPARATOR ,
145- '\\ ' => token::PREFIX ,
146- ' ; ' => token::END_OF_STATEMENT ,
147- ' π ' => token:: CONSTANT ,
148- ];
136+ $ types = [
137+ ' [ ' => token:: OPENING_BRACKET ,
138+ ' ( ' => token::OPENING_PAREN ,
139+ ' { ' => token::OPENING_BRACE ,
140+ ' ] ' => token::CLOSING_BRACKET ,
141+ ' ) ' => token::CLOSING_PAREN ,
142+ ' } ' => token::CLOSING_BRACE ,
143+ ' , ' => token::ARG_SEPARATOR ,
144+ '\\ ' => token::PREFIX ,
145+ ' ; ' => token::END_OF_STATEMENT ,
146+ ' π ' => token::CONSTANT ,
147+ ];
148+ if ( in_array ( $ currentchar , array_keys ( $ types ))) {
149149 return $ this ->read_single_char_token ($ types [$ currentchar ]);
150150 }
151151 // If we are still here, that's not good at all. We need to read the char (it is only peeked
0 commit comments