@appthreat/atom-parsetools 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -103
- package/astgen.js +148 -11
- package/package.json +12 -4
- package/phpastgen.js +1764 -18
- package/plugins/autoload.php +1 -1
- package/plugins/composer/autoload_classmap.php +1 -0
- package/plugins/composer/autoload_real.php +4 -4
- package/plugins/composer/autoload_static.php +5 -4
- package/plugins/composer/installed.json +7 -8
- package/plugins/composer/installed.php +9 -9
- package/plugins/composer.json +1 -1
- package/plugins/composer.lock +7 -8
- package/plugins/nikic/php-parser/composer.json +1 -2
- package/plugins/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php +1 -3
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +2 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php +20 -0
- package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php +5 -4
- package/plugins/nikic/php-parser/lib/PhpParser/ParserAbstract.php +7 -0
- package/plugins/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +20 -4
- package/svelteAst.js +1291 -0
package/plugins/autoload.php
CHANGED
|
@@ -46,6 +46,7 @@ return array(
|
|
|
46
46
|
'PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php',
|
|
47
47
|
'PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php',
|
|
48
48
|
'PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php',
|
|
49
|
+
'PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php',
|
|
49
50
|
'PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php',
|
|
50
51
|
'PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php',
|
|
51
52
|
'PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// autoload_real.php @generated by Composer
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class ComposerAutoloaderInitb1096a2b08d571b985540b4492c44680
|
|
6
6
|
{
|
|
7
7
|
private static $loader;
|
|
8
8
|
|
|
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit4ada460927b79cef097dac97641f1695
|
|
|
22
22
|
return self::$loader;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
spl_autoload_register(array('
|
|
25
|
+
spl_autoload_register(array('ComposerAutoloaderInitb1096a2b08d571b985540b4492c44680', 'loadClassLoader'), true, true);
|
|
26
26
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
|
27
|
-
spl_autoload_unregister(array('
|
|
27
|
+
spl_autoload_unregister(array('ComposerAutoloaderInitb1096a2b08d571b985540b4492c44680', 'loadClassLoader'));
|
|
28
28
|
|
|
29
29
|
require __DIR__ . '/autoload_static.php';
|
|
30
|
-
call_user_func(\Composer\Autoload\
|
|
30
|
+
call_user_func(\Composer\Autoload\ComposerStaticInitb1096a2b08d571b985540b4492c44680::getInitializer($loader));
|
|
31
31
|
|
|
32
32
|
$loader->register(true);
|
|
33
33
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
namespace Composer\Autoload;
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class ComposerStaticInitb1096a2b08d571b985540b4492c44680
|
|
8
8
|
{
|
|
9
9
|
public static $prefixLengthsPsr4 = array (
|
|
10
10
|
'P' =>
|
|
@@ -61,6 +61,7 @@ class ComposerStaticInit4ada460927b79cef097dac97641f1695
|
|
|
61
61
|
'PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php',
|
|
62
62
|
'PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php',
|
|
63
63
|
'PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php',
|
|
64
|
+
'PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php',
|
|
64
65
|
'PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php',
|
|
65
66
|
'PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php',
|
|
66
67
|
'PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php',
|
|
@@ -295,9 +296,9 @@ class ComposerStaticInit4ada460927b79cef097dac97641f1695
|
|
|
295
296
|
public static function getInitializer(ClassLoader $loader)
|
|
296
297
|
{
|
|
297
298
|
return \Closure::bind(function () use ($loader) {
|
|
298
|
-
$loader->prefixLengthsPsr4 =
|
|
299
|
-
$loader->prefixDirsPsr4 =
|
|
300
|
-
$loader->classMap =
|
|
299
|
+
$loader->prefixLengthsPsr4 = ComposerStaticInitb1096a2b08d571b985540b4492c44680::$prefixLengthsPsr4;
|
|
300
|
+
$loader->prefixDirsPsr4 = ComposerStaticInitb1096a2b08d571b985540b4492c44680::$prefixDirsPsr4;
|
|
301
|
+
$loader->classMap = ComposerStaticInitb1096a2b08d571b985540b4492c44680::$classMap;
|
|
301
302
|
|
|
302
303
|
}, null, ClassLoader::class);
|
|
303
304
|
}
|
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
"packages": [
|
|
3
3
|
{
|
|
4
4
|
"name": "nikic/php-parser",
|
|
5
|
-
"version": "v5.
|
|
6
|
-
"version_normalized": "5.
|
|
5
|
+
"version": "v5.8.0",
|
|
6
|
+
"version_normalized": "5.8.0.0",
|
|
7
7
|
"source": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/nikic/PHP-Parser.git",
|
|
10
|
-
"reference": "
|
|
10
|
+
"reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f"
|
|
11
11
|
},
|
|
12
12
|
"dist": {
|
|
13
13
|
"type": "zip",
|
|
14
|
-
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/
|
|
15
|
-
"reference": "
|
|
14
|
+
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
|
|
15
|
+
"reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
|
|
16
16
|
"shasum": ""
|
|
17
17
|
},
|
|
18
18
|
"require": {
|
|
19
|
-
"ext-ctype": "*",
|
|
20
19
|
"ext-json": "*",
|
|
21
20
|
"ext-tokenizer": "*",
|
|
22
21
|
"php": ">=7.4"
|
|
@@ -25,7 +24,7 @@
|
|
|
25
24
|
"ircmaxell/php-yacc": "^0.0.7",
|
|
26
25
|
"phpunit/phpunit": "^9.0"
|
|
27
26
|
},
|
|
28
|
-
"time": "
|
|
27
|
+
"time": "2026-07-04T14:30:18+00:00",
|
|
29
28
|
"bin": [
|
|
30
29
|
"bin/php-parse"
|
|
31
30
|
],
|
|
@@ -57,7 +56,7 @@
|
|
|
57
56
|
],
|
|
58
57
|
"support": {
|
|
59
58
|
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
|
60
|
-
"source": "https://github.com/nikic/PHP-Parser/tree/v5.
|
|
59
|
+
"source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0"
|
|
61
60
|
},
|
|
62
61
|
"install-path": "../nikic/php-parser"
|
|
63
62
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<?php return array(
|
|
2
2
|
'root' => array(
|
|
3
3
|
'name' => '__root__',
|
|
4
|
-
'pretty_version' => 'v1.
|
|
5
|
-
'version' => '1.
|
|
6
|
-
'reference' => '
|
|
4
|
+
'pretty_version' => 'v1.6.0',
|
|
5
|
+
'version' => '1.6.0.0',
|
|
6
|
+
'reference' => '6b530ed51ff42e8344f6944bf29a6f0042518cdc',
|
|
7
7
|
'type' => 'library',
|
|
8
8
|
'install_path' => __DIR__ . '/../../',
|
|
9
9
|
'aliases' => array(),
|
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
),
|
|
12
12
|
'versions' => array(
|
|
13
13
|
'__root__' => array(
|
|
14
|
-
'pretty_version' => 'v1.
|
|
15
|
-
'version' => '1.
|
|
16
|
-
'reference' => '
|
|
14
|
+
'pretty_version' => 'v1.6.0',
|
|
15
|
+
'version' => '1.6.0.0',
|
|
16
|
+
'reference' => '6b530ed51ff42e8344f6944bf29a6f0042518cdc',
|
|
17
17
|
'type' => 'library',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|
|
20
20
|
'dev_requirement' => false,
|
|
21
21
|
),
|
|
22
22
|
'nikic/php-parser' => array(
|
|
23
|
-
'pretty_version' => 'v5.
|
|
24
|
-
'version' => '5.
|
|
25
|
-
'reference' => '
|
|
23
|
+
'pretty_version' => 'v5.8.0',
|
|
24
|
+
'version' => '5.8.0.0',
|
|
25
|
+
'reference' => '044a6a392ff8ad0d61f14370a5fbbd0a0107152f',
|
|
26
26
|
'type' => 'library',
|
|
27
27
|
'install_path' => __DIR__ . '/../nikic/php-parser',
|
|
28
28
|
'aliases' => array(),
|
package/plugins/composer.json
CHANGED
package/plugins/composer.lock
CHANGED
|
@@ -4,24 +4,23 @@
|
|
|
4
4
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
|
5
5
|
"This file is @generated automatically"
|
|
6
6
|
],
|
|
7
|
-
"content-hash": "
|
|
7
|
+
"content-hash": "b1096a2b08d571b985540b4492c44680",
|
|
8
8
|
"packages": [
|
|
9
9
|
{
|
|
10
10
|
"name": "nikic/php-parser",
|
|
11
|
-
"version": "v5.
|
|
11
|
+
"version": "v5.8.0",
|
|
12
12
|
"source": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "https://github.com/nikic/PHP-Parser.git",
|
|
15
|
-
"reference": "
|
|
15
|
+
"reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f"
|
|
16
16
|
},
|
|
17
17
|
"dist": {
|
|
18
18
|
"type": "zip",
|
|
19
|
-
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/
|
|
20
|
-
"reference": "
|
|
19
|
+
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
|
|
20
|
+
"reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
|
|
21
21
|
"shasum": ""
|
|
22
22
|
},
|
|
23
23
|
"require": {
|
|
24
|
-
"ext-ctype": "*",
|
|
25
24
|
"ext-json": "*",
|
|
26
25
|
"ext-tokenizer": "*",
|
|
27
26
|
"php": ">=7.4"
|
|
@@ -60,9 +59,9 @@
|
|
|
60
59
|
],
|
|
61
60
|
"support": {
|
|
62
61
|
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
|
63
|
-
"source": "https://github.com/nikic/PHP-Parser/tree/v5.
|
|
62
|
+
"source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0"
|
|
64
63
|
},
|
|
65
|
-
"time": "
|
|
64
|
+
"time": "2026-07-04T14:30:18+00:00"
|
|
66
65
|
}
|
|
67
66
|
],
|
|
68
67
|
"packages-dev": [],
|
|
@@ -215,9 +215,7 @@ class ConstExprEvaluator {
|
|
|
215
215
|
case '<': return $this->evaluate($l) < $this->evaluate($r);
|
|
216
216
|
case '<=': return $this->evaluate($l) <= $this->evaluate($r);
|
|
217
217
|
case '<=>': return $this->evaluate($l) <=> $this->evaluate($r);
|
|
218
|
-
case '|>':
|
|
219
|
-
$lval = $this->evaluate($l);
|
|
220
|
-
return $this->evaluate($r)($lval);
|
|
218
|
+
case '|>': return ($this->fallbackEvaluator)($expr);
|
|
221
219
|
}
|
|
222
220
|
|
|
223
221
|
throw new \Exception('Should not happen');
|
|
@@ -9,6 +9,7 @@ use PhpParser\Lexer\TokenEmulator\AsymmetricVisibilityTokenEmulator;
|
|
|
9
9
|
use PhpParser\Lexer\TokenEmulator\AttributeEmulator;
|
|
10
10
|
use PhpParser\Lexer\TokenEmulator\EnumTokenEmulator;
|
|
11
11
|
use PhpParser\Lexer\TokenEmulator\ExplicitOctalEmulator;
|
|
12
|
+
use PhpParser\Lexer\TokenEmulator\FnTokenEmulator;
|
|
12
13
|
use PhpParser\Lexer\TokenEmulator\MatchTokenEmulator;
|
|
13
14
|
use PhpParser\Lexer\TokenEmulator\NullsafeTokenEmulator;
|
|
14
15
|
use PhpParser\Lexer\TokenEmulator\PipeOperatorEmulator;
|
|
@@ -40,6 +41,7 @@ class Emulative extends Lexer {
|
|
|
40
41
|
$this->hostPhpVersion = PhpVersion::getHostVersion();
|
|
41
42
|
|
|
42
43
|
$emulators = [
|
|
44
|
+
new FnTokenEmulator(),
|
|
43
45
|
new MatchTokenEmulator(),
|
|
44
46
|
new NullsafeTokenEmulator(),
|
|
45
47
|
new AttributeEmulator(),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
namespace PhpParser\Lexer\TokenEmulator;
|
|
4
|
+
|
|
5
|
+
use PhpParser\PhpVersion;
|
|
6
|
+
|
|
7
|
+
// Retained for reverse emulation support only.
|
|
8
|
+
final class FnTokenEmulator extends KeywordEmulator {
|
|
9
|
+
public function getPhpVersion(): PhpVersion {
|
|
10
|
+
return PhpVersion::fromString('7.4');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public function getKeywordString(): string {
|
|
14
|
+
return 'fn';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public function getKeywordToken(): int {
|
|
18
|
+
return \T_FN;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -14,7 +14,7 @@ abstract class KeywordEmulator extends TokenEmulator {
|
|
|
14
14
|
|
|
15
15
|
/** @param Token[] $tokens */
|
|
16
16
|
protected function isKeywordContext(array $tokens, int $pos): bool {
|
|
17
|
-
$prevToken = $this->
|
|
17
|
+
$prevToken = $this->getPreviousNonIgnorableToken($tokens, $pos);
|
|
18
18
|
if ($prevToken === null) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
@@ -35,13 +35,14 @@ abstract class KeywordEmulator extends TokenEmulator {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/** @param Token[] $tokens */
|
|
38
|
-
private function
|
|
38
|
+
private function getPreviousNonIgnorableToken(array $tokens, int $start): ?Token {
|
|
39
39
|
for ($i = $start - 1; $i >= 0; --$i) {
|
|
40
|
-
|
|
40
|
+
$token = $tokens[$i];
|
|
41
|
+
if ($token->id === T_WHITESPACE || $token->id == T_COMMENT || $token->id === T_DOC_COMMENT) {
|
|
41
42
|
continue;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
return $
|
|
45
|
+
return $token;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
return null;
|
|
@@ -1078,6 +1078,13 @@ abstract class ParserAbstract implements Parser {
|
|
|
1078
1078
|
$node->default->getAttributes()
|
|
1079
1079
|
));
|
|
1080
1080
|
}
|
|
1081
|
+
|
|
1082
|
+
if ($node->type instanceof Identifier && $node->type->name === 'void') {
|
|
1083
|
+
$this->emitError(new Error(
|
|
1084
|
+
'void cannot be used as a parameter type',
|
|
1085
|
+
$node->type->getAttributes()
|
|
1086
|
+
));
|
|
1087
|
+
}
|
|
1081
1088
|
}
|
|
1082
1089
|
|
|
1083
1090
|
protected function checkTryCatch(TryCatch $node): void {
|
|
@@ -1006,9 +1006,25 @@ abstract class PrettyPrinterAbstract implements PrettyPrinter {
|
|
|
1006
1006
|
|
|
1007
1007
|
list($findToken, $extraLeft, $extraRight) = $this->emptyListInsertionMap[$mapKey];
|
|
1008
1008
|
if (null !== $findToken) {
|
|
1009
|
-
|
|
1010
|
-
$
|
|
1011
|
-
$
|
|
1009
|
+
// For anon classes skip to the class keyword.
|
|
1010
|
+
$isAnonClassArgs = $mapKey === PrintableNewAnonClassNode::class . '->args';
|
|
1011
|
+
if ($isAnonClassArgs) {
|
|
1012
|
+
$insertPos = $this->origTokens->findRight($pos, \T_CLASS) + 1;
|
|
1013
|
+
$result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment);
|
|
1014
|
+
$pos = $insertPos;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
// If "new Foo" was used without arguments, we need to convert to "new Foo()".
|
|
1018
|
+
if (($mapKey === Expr\New_::class . '->args' || $isAnonClassArgs) &&
|
|
1019
|
+
!$this->origTokens->haveTokenImmediatelyAfter($pos - 1, '(')
|
|
1020
|
+
) {
|
|
1021
|
+
$extraLeft = '(';
|
|
1022
|
+
$extraRight = ')';
|
|
1023
|
+
} else {
|
|
1024
|
+
$insertPos = $this->origTokens->findRight($pos, $findToken) + 1;
|
|
1025
|
+
$result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment);
|
|
1026
|
+
$pos = $insertPos;
|
|
1027
|
+
}
|
|
1012
1028
|
}
|
|
1013
1029
|
|
|
1014
1030
|
$first = true;
|
|
@@ -1293,7 +1309,7 @@ abstract class PrettyPrinterAbstract implements PrettyPrinter {
|
|
|
1293
1309
|
$this->labelCharMap = [];
|
|
1294
1310
|
for ($i = 0; $i < 256; $i++) {
|
|
1295
1311
|
$chr = chr($i);
|
|
1296
|
-
$this->labelCharMap[$chr] =
|
|
1312
|
+
$this->labelCharMap[$chr] = (bool) preg_match('/^[a-zA-Z0-9_\x80-\xff]$/', $chr);
|
|
1297
1313
|
}
|
|
1298
1314
|
|
|
1299
1315
|
if ($this->phpVersion->allowsDelInIdentifiers()) {
|