コード例 #1
0
ファイル: Parser.php プロジェクト: jkimdon/cohomeals
 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;
 }
コード例 #2
0
 function testWordsAfterParenthesis()
 {
     $tokenizer = new Math_Formula_Tokenizer();
     $this->assertEquals(array('hello', '(', 'world', ')', 'foo-bar'), $tokenizer->getTokens('hello (world) foo-bar'));
 }
コード例 #3
0
ファイル: TokenizerTest.php プロジェクト: linuxwhy/tiki-1
 function testEndWithString()
 {
     $tokenizer = new Math_Formula_Tokenizer();
     $this->assertEquals(array('hello', '(', 'world', '"(test hello)"'), $tokenizer->getTokens('hello (world "(test hello)"'));
 }