Example #1
0
 function parse($string)
 {
     $tokenizer = new Math_Formula_Tokenizer();
     $tokens = $tokenizer->getTokens($string);
     $element = $this->getElement($tokens);
     if (!empty($tokens)) {
         throw new Math_Formula_Parser_Exception('Unexpected trailing characters.', $tokens);
     }
     return $element;
 }
 function testWordsAfterParenthesis()
 {
     $tokenizer = new Math_Formula_Tokenizer();
     $this->assertEquals(array('hello', '(', 'world', ')', 'foo-bar'), $tokenizer->getTokens('hello (world) foo-bar'));
 }
Example #3
0
 function testEndWithString()
 {
     $tokenizer = new Math_Formula_Tokenizer();
     $this->assertEquals(array('hello', '(', 'world', '"(test hello)"'), $tokenizer->getTokens('hello (world "(test hello)"'));
 }