@mintplayer/polyglot-target-php 0.9.6 → 0.9.8
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/package.json +1 -1
- package/polyglot-plugin.json +181 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/polyglot-target-php",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.8",
|
|
4
4
|
"description": "MintPlayer Polyglot PHP target — a pure-JSON language plugin (spec + emission rules + capabilities + std bindings) for the polyglot transpiler.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polyglot",
|
package/polyglot-plugin.json
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
"blockLambdas": "native",
|
|
13
13
|
"extensionMethods": "emulated",
|
|
14
14
|
"operatorOverloading": false,
|
|
15
|
+
"operatorOverloading:eq": "native",
|
|
16
|
+
"operatorOverloading:indexers": "native",
|
|
15
17
|
"propertySetters": false
|
|
16
18
|
},
|
|
17
19
|
"spec": {
|
|
@@ -34,6 +36,7 @@
|
|
|
34
36
|
"throwKeyword": "throw",
|
|
35
37
|
"rethrow": "throw $__e;",
|
|
36
38
|
"memberOp": "->",
|
|
39
|
+
"enumMemberOp": "::",
|
|
37
40
|
"trueLit": "true",
|
|
38
41
|
"falseLit": "false",
|
|
39
42
|
"nullLit": "null",
|
|
@@ -178,7 +181,7 @@
|
|
|
178
181
|
"std": {
|
|
179
182
|
"std.collections": {
|
|
180
183
|
"List.type": "\\ArrayObject",
|
|
181
|
-
"List.
|
|
184
|
+
"List.constructor": "new \\ArrayObject()",
|
|
182
185
|
"List.count": "count($this)",
|
|
183
186
|
"List.add": "$this[] = $0",
|
|
184
187
|
"List.clear": "$this->exchangeArray([])",
|
|
@@ -205,11 +208,11 @@
|
|
|
205
208
|
},
|
|
206
209
|
"std.core": {
|
|
207
210
|
"Error.type": "\\Exception",
|
|
208
|
-
"Error.
|
|
211
|
+
"Error.constructor": "new $T($0)",
|
|
209
212
|
"Error.message": "$this->getMessage()",
|
|
210
213
|
"Iterable.type": "iterable",
|
|
211
214
|
"Array.type": "\\ArrayObject",
|
|
212
|
-
"Array.
|
|
215
|
+
"Array.constructor": "new \\ArrayObject()",
|
|
213
216
|
"Array.count": "count($this)",
|
|
214
217
|
"i8.parse": "intval($0)",
|
|
215
218
|
"i16.parse": "intval($0)",
|
|
@@ -731,6 +734,46 @@
|
|
|
731
734
|
")"
|
|
732
735
|
]
|
|
733
736
|
},
|
|
737
|
+
"IsTest": {
|
|
738
|
+
"tmpl": [
|
|
739
|
+
{ "emitChild": "node.operand", "side": "recv" },
|
|
740
|
+
" instanceof ",
|
|
741
|
+
{ "type": "node.testType" }
|
|
742
|
+
]
|
|
743
|
+
},
|
|
744
|
+
"AsCast": {
|
|
745
|
+
"case": {
|
|
746
|
+
"when": [
|
|
747
|
+
[
|
|
748
|
+
{ "eq": [ "node.operandIsSimple", "true" ] },
|
|
749
|
+
{
|
|
750
|
+
"tmpl": [
|
|
751
|
+
"(",
|
|
752
|
+
{ "emit": "node.operand" },
|
|
753
|
+
" instanceof ",
|
|
754
|
+
{ "type": "node.castType" },
|
|
755
|
+
" ? ",
|
|
756
|
+
{ "emit": "node.operand" },
|
|
757
|
+
" : null)"
|
|
758
|
+
]
|
|
759
|
+
}
|
|
760
|
+
]
|
|
761
|
+
],
|
|
762
|
+
"else": {
|
|
763
|
+
"tmpl": [
|
|
764
|
+
"(($",
|
|
765
|
+
{ "get": "node.tempName" },
|
|
766
|
+
" = ",
|
|
767
|
+
{ "emit": "node.operand" },
|
|
768
|
+
") instanceof ",
|
|
769
|
+
{ "type": "node.castType" },
|
|
770
|
+
" ? $",
|
|
771
|
+
{ "get": "node.tempName" },
|
|
772
|
+
" : null)"
|
|
773
|
+
]
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
},
|
|
734
777
|
"Unary": {
|
|
735
778
|
"case": {
|
|
736
779
|
"when": [
|
|
@@ -786,6 +829,24 @@
|
|
|
786
829
|
"Cast": {
|
|
787
830
|
"case": {
|
|
788
831
|
"when": [
|
|
832
|
+
[
|
|
833
|
+
{
|
|
834
|
+
"has": "node.convMethod"
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
"tmpl": [
|
|
838
|
+
{
|
|
839
|
+
"emitChild": "node.operand",
|
|
840
|
+
"side": "recv"
|
|
841
|
+
},
|
|
842
|
+
"->",
|
|
843
|
+
{
|
|
844
|
+
"get": "node.convMethod"
|
|
845
|
+
},
|
|
846
|
+
"()"
|
|
847
|
+
]
|
|
848
|
+
}
|
|
849
|
+
],
|
|
789
850
|
[
|
|
790
851
|
{
|
|
791
852
|
"eq": [
|
|
@@ -931,6 +992,75 @@
|
|
|
931
992
|
"Binary": {
|
|
932
993
|
"case": {
|
|
933
994
|
"when": [
|
|
995
|
+
[
|
|
996
|
+
{
|
|
997
|
+
"and": [
|
|
998
|
+
{
|
|
999
|
+
"or": [
|
|
1000
|
+
{
|
|
1001
|
+
"eq": [
|
|
1002
|
+
"node.op",
|
|
1003
|
+
"=="
|
|
1004
|
+
]
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
"eq": [
|
|
1008
|
+
"node.op",
|
|
1009
|
+
"!="
|
|
1010
|
+
]
|
|
1011
|
+
}
|
|
1012
|
+
]
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
"eq": [
|
|
1016
|
+
"node.lhsHasUserEq",
|
|
1017
|
+
"true"
|
|
1018
|
+
]
|
|
1019
|
+
}
|
|
1020
|
+
]
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"case": {
|
|
1024
|
+
"when": [
|
|
1025
|
+
[
|
|
1026
|
+
{
|
|
1027
|
+
"eq": [
|
|
1028
|
+
"node.op",
|
|
1029
|
+
"=="
|
|
1030
|
+
]
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
"tmpl": [
|
|
1034
|
+
{
|
|
1035
|
+
"emitChild": "node.lhs",
|
|
1036
|
+
"side": "recv"
|
|
1037
|
+
},
|
|
1038
|
+
"->eq(",
|
|
1039
|
+
{
|
|
1040
|
+
"emit": "node.rhs"
|
|
1041
|
+
},
|
|
1042
|
+
")"
|
|
1043
|
+
]
|
|
1044
|
+
}
|
|
1045
|
+
]
|
|
1046
|
+
],
|
|
1047
|
+
"else": {
|
|
1048
|
+
"tmpl": [
|
|
1049
|
+
"!",
|
|
1050
|
+
{
|
|
1051
|
+
"emitChild": "node.lhs",
|
|
1052
|
+
"side": "recv"
|
|
1053
|
+
},
|
|
1054
|
+
"->eq(",
|
|
1055
|
+
{
|
|
1056
|
+
"emit": "node.rhs"
|
|
1057
|
+
},
|
|
1058
|
+
")"
|
|
1059
|
+
]
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
],
|
|
934
1064
|
[
|
|
935
1065
|
{
|
|
936
1066
|
"and": [
|
|
@@ -2372,6 +2502,26 @@
|
|
|
2372
2502
|
},
|
|
2373
2503
|
"phpParam": {
|
|
2374
2504
|
"tmpl": [
|
|
2505
|
+
{
|
|
2506
|
+
"case": {
|
|
2507
|
+
"when": [
|
|
2508
|
+
[
|
|
2509
|
+
{
|
|
2510
|
+
"has": "item.attrInline"
|
|
2511
|
+
},
|
|
2512
|
+
{
|
|
2513
|
+
"tmpl": [
|
|
2514
|
+
{
|
|
2515
|
+
"get": "item.attrInline"
|
|
2516
|
+
},
|
|
2517
|
+
" "
|
|
2518
|
+
]
|
|
2519
|
+
}
|
|
2520
|
+
]
|
|
2521
|
+
],
|
|
2522
|
+
"else": ""
|
|
2523
|
+
}
|
|
2524
|
+
},
|
|
2375
2525
|
"$",
|
|
2376
2526
|
{
|
|
2377
2527
|
"fn": "ident",
|
|
@@ -3165,11 +3315,38 @@
|
|
|
3165
3315
|
{
|
|
3166
3316
|
"line": "<?php"
|
|
3167
3317
|
},
|
|
3318
|
+
{
|
|
3319
|
+
"case": {
|
|
3320
|
+
"when": [
|
|
3321
|
+
[
|
|
3322
|
+
{
|
|
3323
|
+
"not": {
|
|
3324
|
+
"eq": [
|
|
3325
|
+
"module.attrImportsBlock",
|
|
3326
|
+
""
|
|
3327
|
+
]
|
|
3328
|
+
}
|
|
3329
|
+
},
|
|
3330
|
+
{
|
|
3331
|
+
"line": {
|
|
3332
|
+
"get": "module.attrImportsBlock"
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
]
|
|
3336
|
+
]
|
|
3337
|
+
}
|
|
3338
|
+
},
|
|
3168
3339
|
{
|
|
3169
3340
|
"mapDecl": "module.imports",
|
|
3170
3341
|
"each": {
|
|
3171
3342
|
"line": {
|
|
3172
|
-
"tmpl": [
|
|
3343
|
+
"tmpl": [
|
|
3344
|
+
"require_once __DIR__ . '/",
|
|
3345
|
+
{
|
|
3346
|
+
"get": "item.path"
|
|
3347
|
+
},
|
|
3348
|
+
".php';"
|
|
3349
|
+
]
|
|
3173
3350
|
}
|
|
3174
3351
|
}
|
|
3175
3352
|
},
|