コード例 #1
0
 public function testFilteredScan()
 {
     $reader = new FileReader(__DIR__ . '/../Fixtures/files/TestFile.php');
     // Test the raw file with newlines and whitespaces
     $context = new DefaultScannerContext();
     $context->addTokenFilter(new TokenFilter\NoNewlinesFilter());
     $context->addTokenFilter(new TokenFilter\NoWhitespacesFilter());
     $scanner = new GenericScanner($context);
     $queue = $scanner->scan($reader);
     $this->assertTokens($this->expectedTokensNoEmptyToken, $queue);
 }
コード例 #2
0
ファイル: CndParser.php プロジェクト: frogriotcom/phpcr-utils
 private function parse(ReaderInterface $reader)
 {
     $scanner = new GenericScanner(new DefaultScannerContextWithoutSpacesAndComments());
     $this->tokenQueue = $scanner->scan($reader);
     while (!$this->tokenQueue->isEof()) {
         while ($this->checkToken(Token::TK_SYMBOL, '<')) {
             $this->parseNamespaceMapping();
         }
         if (!$this->tokenQueue->isEof()) {
             $this->parseNodeType();
         }
     }
     return array('namespaces' => $this->namespaces, 'nodeTypes' => $this->nodeTypes);
 }