function throws_ok($content, $message = '') { global $t; $parser = new SCSS_Parser(); $lexer = new SCSS_Lexer(); $lexer->setBuffer($content); $t->throws_ok(array($lexer, $parser), '$p[1]->yyparse($p[0]);', $message); }
function throws_ok($content, $message = '', $debug = false) { global $t; $parser = new SCSS_Parser(); $lexer = new SCSS_Lexer($parser); $lexer->setBuffer($content); if ($debug) { $lexer->debug = true; $parser->debug = true; } $t->throws_ok(array($lexer, $parser), '$p[1]->yyparse($p[0]);', $message); }
function isToken($buffer, $tokenstr, $diag = null) { global $t; $lexer = new SCSS_Lexer(); $lexer->setBuffer($buffer); $results = array(); $tokens = array(); foreach (explode(' ', $tokenstr) as $token) { $tokens[] = $token; } while ($result = $lexer->analyze($yylval)) { $results[] = is_numeric($result) ? chr($result) : $result; } if (is_null($diag)) { $diag = "token: {$tokenstr}"; } $t->is($results, $tokens, $diag); }