Skip to content

Commit

Permalink
Less_Parser: Tweak parseRuleProperty to match upstream pattern
Browse files Browse the repository at this point in the history
Our match pattern still seemed to work correctly as-is, but the latest
version from lessjs-2.5.3.js changed during the 2.x release.

It was last changed uptream in commit
less/less.js@16c4f88b7f9e0

I ran `test/bench.php` before and after and did not find a consistent
change either faster or slower. I re-ran the same before/after with
our `>parseNameValue()` commented-out in case that our improvement
made that optimisation harder to observe, but it also made no
consistent difference. Seems the same either way, but let's match
upstream to be safe.

Change-Id: I72c4b370950bc0526d8e5eae2ec43ab1025a2619
  • Loading branch information
Krinkle committed Mar 15, 2024
1 parent d6124ba commit a7729b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Less/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2594,7 +2594,7 @@ private function parseRuleProperty() {
// @phan-suppress-next-line PhanPluginEmptyStatementWhileLoop
while ( $this->rulePropertyMatch( '/\\G((?:[\w-]+)|(?:@\{[\w-]+\}))/', $index, $name ) );

if ( ( count( $name ) > 1 ) && $this->rulePropertyMatch( '/\\G\s*((?:\+_|\+)?)\s*:/', $index, $name ) ) {
if ( ( count( $name ) > 1 ) && $this->rulePropertyMatch( '/\\G((?:\+_|\+)?)\s*:/', $index, $name ) ) {
$this->forget();

// at last, we have the complete match now. move forward,
Expand Down

0 comments on commit a7729b7

Please sign in to comment.