/PHP-Parser/test/PhpParser/ |
H A D | ParserTestAbstract.php | 17 $parser = $this->getParser(new Lexer()); 18 $parser->parse('<?php foo'); 24 $parser = $this->getParser(new Lexer()); 31 $parser = $this->getParser(new Lexer()); 32 $parser->parse('<?php /*'); 49 $parser = $this->getParser($lexer); 50 $stmts = $parser->parse($code); 114 $parser = $this->getParser($lexer); 115 $parser->parse('dummy'); 194 $parser = $this->getParser($lexer); [all …]
|
H A D | JsonDecoderTest.php | 16 $parser = new Parser\Php7(new Lexer()); 17 $stmts = $parser->parse($code);
|
H A D | CodeParsingTest.php | 14 $parser = $this->createParser($modes['version'] ?? null); 15 list($stmts, $output) = $this->getParseOutput($parser, $code, $modes); 29 public function getParseOutput(Parser $parser, $code, array $modes) { argument 34 $stmts = $parser->parse($code, $errors);
|
H A D | PrettyPrinterTest.php | 22 $parser = $factory->createForVersion($parserVersion !== null 28 return [$parser, $prettyPrinter]; 32 [$parser, $prettyPrinter] = $this->createParserAndPrinter($this->parseModeLine($modeLine)); 33 $output = canonicalize($prettyPrinter->$method($parser->parse($code))); 192 [$parser, $printer] = $this->createParserAndPrinter($this->parseModeLine($modeLine)); 195 $oldStmts = $parser->parse($code); 196 $oldTokens = $parser->getTokens(); 230 [$parser, $printer] = $this->createParserAndPrinter($this->parseModeLine($modeLine)); 234 $oldStmts = $parser->parse($code); 240 $oldTokens = $parser->getTokens();
|
H A D | CodeTestAbstract.php | 7 $parser = new CodeTestParser(); 10 list($name, $tests) = $parser->parseTest($fileContents, $chunksPerTest);
|
H A D | NodeDumperTest.php | 61 $parser = (new ParserFactory())->createForHostVersion(); 87 $stmts = $parser->parse($code);
|
H A D | ConstExprEvaluatorTest.php | 11 $parser = new Parser\Php7(new Lexer()); 12 $expr = $parser->parse('<?php ' . $exprString . ';')[0]->expr;
|
/PHP-Parser/tools/fuzzing/ |
H A D | target.php | 25 $parser = new PhpParser\Parser\Php7($lexer); variable 103 $fuzzer->setTarget(function(string $input) use($lexer, $parser, $prettyPrinter, $nodeDumper, $visit… 104 $stmts = $parser->parse($input); 107 $visitor->setTokens($parser->getTokens()); 114 $printedStmts = $parser->parse($printed); 119 $visitor->setTokens($parser->getTokens());
|
/PHP-Parser/test/PhpParser/Node/Scalar/ |
H A D | DNumberTest.php | 11 $parser = (new ParserFactory())->createForNewestSupportedVersion(); 12 $nodes = $parser->parse('<?php echo 1_234.56;');
|
H A D | NumberTest.php | 10 $parser = (new ParserFactory())->createForNewestSupportedVersion(); 11 $nodes = $parser->parse('<?php echo 1_234;');
|
H A D | StringTest.php | 10 $parser = (new ParserFactory())->createForNewestSupportedVersion(); 11 $nodes = $parser->parse('<?php echo "sequence \x41";');
|
/PHP-Parser/grammar/ |
H A D | README.md | 5 * `parser.template`: A `kmyacc` parser prototype file for PHP 6 * `rebuildParsers.php`: Preprocesses the grammar and builds the parser using `kmyacc` 18 Building the parser
|
/PHP-Parser/test/ |
H A D | updateTests.php | 23 $parser = $codeParsingTest->createParser($modes['version'] ?? null); variable 24 list(, $output) = $codeParsingTest->getParseOutput($parser, $input, $modes);
|
/PHP-Parser/doc/component/ |
H A D | FAQ.markdown | 21 $parser = (new ParserFactory())->createForHostVersion(); 22 $ast = $parser->parse($code); 43 $parser = (new ParserFactory())->createForHostVersion(); 44 $ast = $parser->parse($code);
|
H A D | Lexer.markdown | 4 The lexer is responsible for providing tokens to the parser. Typical use of the library does not re… 11 While this library implements a custom parser, it relies on PHP's `ext/tokenizer` extension to perf… 17 polyfill implementation will also perform two emulations that are required by the parser and cannot… 24 will not be accepted by the parser. 27 …ED_BY_VAR_OR_VARARG` or `T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG`. This is required by the parser 61 The lexer is normally invoked implicitly by the parser. In that case, the tokens for the last parse… 64 Nodes in the AST produced by the parser always corresponds to some range of tokens. The parser adds… 114 $parser = (new PhpParser\ParserFactory())->createForHostVersion($lexerOptions); 120 $stmts = $parser->parse($code); 121 $visitor->setTokens($parser->getTokens());
|
H A D | Error_handling.markdown | 34 The error behavior of the parser (and other components) is controlled by an `ErrorHandler`. Wheneve… 42 $parser = (new PhpParser\ParserFactory())->createForHostVersion(); 45 $stmts = $parser->parse($code, $errorHandler);
|
/PHP-Parser/ |
H A D | UPGRADE-3.0.md | 42 creating the parser, while collected errors were retrieved using the `getErrors()` method: 46 $parser = (new ParserFactory)->create(ParserFactor::ONLY_PHP7, $lexer, [ 50 $stmts = $parser->parse($code); 51 $errors = $parser->getErrors(); 63 $parser = (new ParserFactory)->create(ParserFactor::ONLY_PHP7, $lexer); 66 $stmts = $parser->parse($code, $errorHandler); 73 #### Multiple parser fallback in error recovery mode 77 parsing never throws in error recovery mode, the result from the first parser will always be 80 The PHP 7 parser is a superset of the PHP 5 parser, with the exceptions that `=& new` and 82 parser will be able to recover from the error in both cases. For this reason, this change will [all …]
|
H A D | UPGRADE-2.0.md | 9 ### Creating a parser instance 12 will not work, because the parser class was renamed. 18 $parser = new Parser(new Lexer\Emulative); 25 $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); 45 $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7, $lexer); 52 described above to create your parser instance, these changes should have no further impact on you.
|
H A D | UPGRADE-5.0.md | 10 The dedicated parser for PHP 5 has been removed. The PHP 7 parser now accepts a `PhpVersion` argume… 24 …* The PHP 7 parser will accept many constructs that are not valid in PHP 5. However, this was also… 32 ### Changes to the parser factory 53 $parser = $factory->create(ParserFactory::PREFER_PHP7); 56 $parser = $factory->createForNewestSupportedVersion(); 58 $parser = $factory->createForHostVersion(); 61 $parser = $factory->create(ParserFactory::ONLY_PHP5); 510 $parser = new Parser\Php7($lexer); 511 $oldStmts = $parser->parse($code); 521 $oldStmts = $parser->parse($code); [all …]
|
H A D | CONTRIBUTING.md | 24 3. Add support for the new syntax in `grammar/php.y`. Regenerate the parser by running 27 5. Add tests both in `test/code/parser` and `test/code/prettyPrinter`.
|
/PHP-Parser/doc/ |
H A D | 0_Introduction.markdown | 4 This project is a PHP parser **written in PHP itself**. 9 A parser is useful for [static analysis][0], manipulation of code and basically any other 10 application dealing with code programmatically. A parser constructs an [Abstract Syntax Tree][1] 21 Another question is: Why would I want to have a PHP parser *written in PHP*? Well, PHP might not be 29 The parser supports parsing PHP 7 and PHP 8 code, with the following exceptions: 44 As the parser is based on the tokens returned by `token_get_all` (which is only able to lex the PHP 49 Finally, it should be noted that the parser aims to accept all valid code, not reject all invalid 56 The parser produces an [Abstract Syntax Tree][1] (AST) also known as a node tree. How this looks 84 Apart from the parser itself, this package also bundles support for some other, related features:
|
/PHP-Parser/test_old/ |
H A D | run.php | 142 $parser = (new PhpParser\ParserFactory())->createForVersion(PhpParser\PhpVersion::fromString($phpVe… variable 181 $origStmts = $parser->parse($origCode); 184 $origTokens = $parser->getTokens(); 209 $ppStmts = $parser->parse($code);
|
/PHP-Parser/bin/ |
H A D | php-parse | 29 $parser = (new PhpParser\ParserFactory())->createForVersion($attributes['version']); variable 58 $stmts = $parser->parse($code, $errorHandler); 68 $stmts = $parser->parse($code);
|
/PHP-Parser/test/code/parser/expr/ |
H A D | firstClassCallables.test | 8 // These are invalid, but accepted on the parser level. 66 0: // These are invalid, but accepted on the parser level.
|
/PHP-Parser/test/PhpParser/NodeVisitor/ |
H A D | NameResolverTest.php | 484 $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer\Emulative()); 485 $stmts = $parser->parse($source); 513 $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer\Emulative()); 514 $stmts = $parser->parse($source); 570 $parser = new PhpParser\Parser\Php8(new PhpParser\Lexer\Emulative()); 574 $stmts = $parser->parse($code);
|