Inheritance: extends SimpleLexer
Example #1
0
 public function testTagWithAttributesInLatin1()
 {
     $parser = $this->createParser();
     $parser->expectOnce('acceptTextToken', array('label', '*'));
     $parser->expectAt(0, 'acceptStartToken', array('<a', '*'));
     $parser->expectAt(1, 'acceptStartToken', array('href', '*'));
     $parser->expectAt(2, 'acceptStartToken', array('>', '*'));
     $parser->expectCallCount('acceptStartToken', 3);
     $parser->expectAt(0, 'acceptAttributeToken', array('= "', '*'));
     $parser->expectAt(1, 'acceptAttributeToken', array(utf8_decode('hère.html'), '*'));
     $parser->expectAt(2, 'acceptAttributeToken', array('"', '*'));
     $parser->expectCallCount('acceptAttributeToken', 3);
     $parser->expectOnce('acceptEndToken', array('</a>', '*'));
     $lexer = new SimpleHtmlLexer($parser);
     $this->assertTrue($lexer->parse(utf8_decode('<a href = "hère.html">label</a>')));
 }
Example #2
0
 /**
  *    Runs the content through the lexer which
  *    should call back to the acceptors.
  *    @param string $raw      Page text to parse.
  *    @return boolean         False if parse error.
  *    @access public
  */
 function parse($raw)
 {
     return $this->lexer->parse($raw);
 }