Commit Graph

1232 Commits

Author SHA1 Message Date
Nikita Popov
bf9956b634 Merge pull request #86 from GrahamCampbell/travis-tweaks
Run travis tests on hhvm as well
2014-01-20 08:24:18 -08:00
Graham Campbell
3a5f7d6cae Updated travis.yml 2014-01-20 11:20:54 +00:00
Nikita Popov
0353c921bd Merge pull request #81 from brikou/Elseif_to_ElseIf
Rename "Elseif" to "ElseIf"
2013-11-27 11:33:56 -08:00
Brikou Carré
72310dd5a3 s/Elseif/ElseIf/ 2013-11-27 15:05:37 +01:00
Jean-François Simon
7f4ab26732 Fix name resolver (class names are case insensitive) 2013-11-15 20:27:56 +01:00
Charles Sprayberry
700847e295 Add NodeTraverser::removeVisitor() 2013-09-28 13:21:30 +02:00
nikic
52aa17fa68 Require ext/tokenizer in composer.json 2013-09-27 21:08:51 +02:00
nikic
1e5e280ae8 Release PHP-Parser 0.9.4 2013-08-25 19:11:40 +02:00
nikic
3d467ca18e Add PHP 5.5 to .travis.yml 2013-08-04 16:15:12 +02:00
nikic
c8695a8f56 Remove obsolete item from grammar/README.md 2013-08-04 16:14:44 +02:00
nikic
01123ae6af Fix notices when generating expected tokens list (continued)
Forgot to add regenerated parser
2013-07-27 18:50:08 +02:00
nikic
09c106d11f Fix notices when generating expected tokens list 2013-07-27 18:48:49 +02:00
nikic
77c08a75c9 Fix pretty printing of include expressions 2013-07-27 16:23:27 +02:00
nikic
f9c3aa2a22 Improve PrettyPrinter construction perf by not using uniqid
The uniqid function is *very* slow on unix systems. The code has no
particular unique-ness requirements, so the much faster mt_rand()
function is used instead.

Closes PR #65.
2013-07-13 01:03:57 +02:00
nikic
5ccf6196d6 Update changelog 2013-05-23 15:17:59 +02:00
Florent
12faad529e Add interface builder 2013-05-23 15:14:58 +02:00
nikic
c0da1b88b2 Merge pull request #59 from Trismegiste/refactor-adding-an-interface-for-LSP
Adding an interface to the Node Traverser for LSP concern
2013-05-22 14:45:21 -07:00
nikic
bc9ab604f6 Merge pull request #58 from fantasticjamieburns/master
Fix typo in doccomment for lcfirst replacement
2013-05-17 08:14:14 -07:00
Florent
900a3f3b7c Implementing the interface for PHPParser_NodeTraverser 2013-05-16 15:44:12 +02:00
Florent
92df3e5add Adding the interface 2013-05-16 15:43:24 +02:00
Jamie Burns
ba91348142 Typo fix 2013-05-15 16:48:42 +02:00
nikic
8e686ce7a7 PHP-Parser supports PHP 5.5 2013-04-15 20:56:45 +02:00
nikic
08f0cde6f9 Add prettyPrintFile() method 2013-04-15 20:53:23 +02:00
nikic
5fca55702b Merge pull request #52 from igorw/patch-1
Add branch-alias
2013-03-05 06:42:24 -08:00
Igor Wiedler
dc95f3b425 Add branch-alias
This allows "0.9.*" or "~0.9" to install the dev version, if the
consumer allows for dev versions to be installed.
2013-03-05 12:50:52 +01:00
nikic
75ec7a3e78 Looks like I forgot to git add some files... 2013-02-14 21:49:08 +01:00
nikic
a249c002dd Add support for ClassName::class (PHP 5.5) 2013-02-14 21:46:58 +01:00
nikic
81d20bf10e Pretty print namespaces in semicolon-style if possible 2013-01-15 18:21:42 +01:00
nikic
db18906dfc Rename PrettyPrinter_Zend to PrettyPrinter_Default 2013-01-15 17:43:36 +01:00
nikic
fbaa1e5fc3 Add information on expected tokens to syntax errors
This now mimics the error messages provided by PHP itself (pre 5.4).
2013-01-15 17:30:14 +01:00
nikic
222c9612ab Use RegexIterator in docs (by @lstrojny)
Also fix formatting in changelog and be more specific in a doc comment.
2012-12-21 13:28:35 +01:00
nikic
eeb5e899a5 Merge pull request #46 from siwinski/pr-composer-x-bit
Remove composer.json execute bit
2012-12-21 04:20:39 -08:00
Shawn Iwinski
01c5b84db5 Removed composer.json execute bit 2012-12-20 22:18:59 -05:00
nikic
98ebfc8d54 Release PHP-Parser 0.9.3 2012-11-22 19:54:05 +01:00
nikic
9f0e12bfca Update changelog 2012-11-22 19:51:21 +01:00
nikic
cdbad02fb2 Fix endAttributes assignment
The end attributes previously were always assigned from the last read token,
which does not necessarily correspond to the last token in the reduced rule.
In particular this occurs if the parser read a new token and based on that
lookahead decided to reduce a rule. The behavior was only correct if the
newly read token was first shifted and then the rule was reduced.

This is fixed by buffering the endAttributes of the new token in a temporary
variable and only assigning them once the token is shifted.
2012-11-20 16:12:19 +01:00
nikic
b0c8787406 Merge pull request #43 from nicmart/patch-1
Update BuilderAbstract::normalizeValue() doc comment
2012-11-06 11:12:30 -08:00
nikic
2ae2410dbd Merge pull request #40 from fabpot/patch-2
Fixed some typos in the doc
2012-11-06 11:10:08 -08:00
Nicolò Martini
bdb58ada7c Update lib/PHPParser/BuilderAbstract.php
Updated BuilderAbstract::normalizeValue phpdoc description.
2012-11-06 18:28:15 +01:00
Fabien Potencier
efa872692e Fixed some typos in the doc 2012-11-05 17:44:56 +01:00
nikic
fc56da59ce Rename pSafe to pNoIndent
Matches the function more closely
2012-10-31 17:50:54 +01:00
nikic
df17d62b40 Fix switch formatting
The switch cases were not indented and fall-through cases had an
unnecessary additional newline.

Patch by @pscheit (PR #39).
2012-10-31 17:46:48 +01:00
nikic
ac6f221c50 Better prededence and associativity handling in pretty printer
Previously the pretty printer added unnecessary and odd-looking parentheses
when several operators with the same precedence were chained:

    'a' . 'b' . 'c' . 'd' . 'e'
    // was printed as
    'a' . ('b' . ('c' . ('d' . 'e')))

Another issue reported as part of #39 was that assignments inside closures
were wrapped in parentheses:

    function() {
        $a = $b;
    }
    // was printed as
    function() {
        ($a = $b);
    }

This was caused by the automatic precedence handling, which just regarded
the closure as an ordinal nested expression.

With the new system the $predenceMap of PrettyPrinterAbstract contains both
precedence and associativity and there is a new method pPrec() which prints
a node taking precedence and associativity into account.

For simpler usage there are additional function pInfixOp(), pPrefixOp() and
pPostfixOp().

Prints not going through pPrec() do not have any precedence handling (fixing
the closure issue).
2012-10-31 17:34:06 +01:00
nikic
759c04db9b Turn rebuildParser.php into a CLI script
The paths are now more generic so it can be run from any directory, not
just grammar/.
2012-10-19 19:11:47 +02:00
nikic
9e43acee2c Scalar_String::create() -> Scalar_String::parse()
Directly creating the node isn't necessary anymore, the token only needs
to be parsed. This makes it consistent with the other scalar parsing
methods and removes the need to pass $arguments around.
2012-10-19 15:17:08 +02:00
nikic
9d8e13b4a9 Fix Switch subnode order
Not that it makes much of a difference, but could have caused issues with
"out of order" visiting of nodes.
2012-10-19 14:54:56 +02:00
nikic
af5d288fb3 Add support for expressions in empty (PHP 5.5)
Apart from the grammar modifications this also renames the Empty subnode
from var to expr. This breaks BC.
2012-09-07 23:42:01 +02:00
nikic
f6c1ab6657 Adjust list and yield parsing, update prettyprinter
* nested list()s will now create nested List nodes (instead of just
   nested arrays)
 * yield $k => $v was parsed with key and value swapped. This is now fixed
 * the pretty printer now works with the newly added language constructs
2012-09-07 23:41:59 +02:00
nikic
4259b44a84 Add support for constant dereferencing (PHP 5.5)
Examples: "foo"[2], [1, 2, 3][2]
2012-09-07 23:41:58 +02:00
nikic
417a8bb07e Add support for yield expressions (PHP 5.5)
This adds a new Yield expression type, with subnodes key and value.
2012-09-07 23:41:57 +02:00