@jorgsowa/php-parser 3.2.5-1

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.
Files changed (153) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +108 -0
  3. package/dist/@jorgsowa/php-parser.js +11239 -0
  4. package/dist/@jorgsowa/php-parser.min.js +2 -0
  5. package/dist/@jorgsowa/php-parser.min.js.LICENSE.txt +10 -0
  6. package/package.json +86 -0
  7. package/src/ast/array.js +44 -0
  8. package/src/ast/arrowfunc.js +43 -0
  9. package/src/ast/assign.js +28 -0
  10. package/src/ast/assignref.js +27 -0
  11. package/src/ast/attrgroup.js +21 -0
  12. package/src/ast/attribute.js +26 -0
  13. package/src/ast/bin.js +27 -0
  14. package/src/ast/block.js +24 -0
  15. package/src/ast/boolean.js +23 -0
  16. package/src/ast/break.js +21 -0
  17. package/src/ast/byref.js +21 -0
  18. package/src/ast/call.js +26 -0
  19. package/src/ast/case.js +26 -0
  20. package/src/ast/cast.js +28 -0
  21. package/src/ast/catch.js +29 -0
  22. package/src/ast/class.js +36 -0
  23. package/src/ast/classconstant.js +71 -0
  24. package/src/ast/clone.js +21 -0
  25. package/src/ast/closure.js +47 -0
  26. package/src/ast/comment.js +23 -0
  27. package/src/ast/commentblock.js +22 -0
  28. package/src/ast/commentline.js +22 -0
  29. package/src/ast/constant.js +26 -0
  30. package/src/ast/constantstatement.js +24 -0
  31. package/src/ast/continue.js +24 -0
  32. package/src/ast/declaration.js +60 -0
  33. package/src/ast/declare.js +71 -0
  34. package/src/ast/declaredirective.js +26 -0
  35. package/src/ast/do.js +26 -0
  36. package/src/ast/echo.js +26 -0
  37. package/src/ast/empty.js +23 -0
  38. package/src/ast/encapsed.js +75 -0
  39. package/src/ast/encapsedpart.js +28 -0
  40. package/src/ast/entry.js +30 -0
  41. package/src/ast/enum.js +30 -0
  42. package/src/ast/enumcase.js +26 -0
  43. package/src/ast/error.js +30 -0
  44. package/src/ast/eval.js +24 -0
  45. package/src/ast/exit.js +26 -0
  46. package/src/ast/expression.js +20 -0
  47. package/src/ast/expressionstatement.js +24 -0
  48. package/src/ast/for.js +33 -0
  49. package/src/ast/foreach.js +33 -0
  50. package/src/ast/function.js +34 -0
  51. package/src/ast/global.js +24 -0
  52. package/src/ast/goto.js +22 -0
  53. package/src/ast/halt.js +22 -0
  54. package/src/ast/identifier.js +26 -0
  55. package/src/ast/if.js +30 -0
  56. package/src/ast/include.js +28 -0
  57. package/src/ast/inline.js +23 -0
  58. package/src/ast/interface.js +28 -0
  59. package/src/ast/intersectiontype.js +24 -0
  60. package/src/ast/isset.js +23 -0
  61. package/src/ast/label.js +21 -0
  62. package/src/ast/list.js +26 -0
  63. package/src/ast/literal.js +28 -0
  64. package/src/ast/location.js +22 -0
  65. package/src/ast/lookup.js +26 -0
  66. package/src/ast/magic.js +22 -0
  67. package/src/ast/match.js +26 -0
  68. package/src/ast/matcharm.js +26 -0
  69. package/src/ast/method.js +24 -0
  70. package/src/ast/name.js +55 -0
  71. package/src/ast/namedargument.js +27 -0
  72. package/src/ast/namespace.js +26 -0
  73. package/src/ast/new.js +26 -0
  74. package/src/ast/node.js +111 -0
  75. package/src/ast/noop.js +20 -0
  76. package/src/ast/nowdoc.js +26 -0
  77. package/src/ast/nullkeyword.js +20 -0
  78. package/src/ast/nullsafepropertylookup.js +22 -0
  79. package/src/ast/number.js +23 -0
  80. package/src/ast/offsetlookup.js +22 -0
  81. package/src/ast/operation.js +19 -0
  82. package/src/ast/parameter.js +61 -0
  83. package/src/ast/parentreference.js +24 -0
  84. package/src/ast/position.js +22 -0
  85. package/src/ast/post.js +26 -0
  86. package/src/ast/pre.js +26 -0
  87. package/src/ast/print.js +23 -0
  88. package/src/ast/program.js +32 -0
  89. package/src/ast/property.js +46 -0
  90. package/src/ast/propertyhook.js +33 -0
  91. package/src/ast/propertylookup.js +22 -0
  92. package/src/ast/propertystatement.js +59 -0
  93. package/src/ast/reference.js +21 -0
  94. package/src/ast/retif.js +28 -0
  95. package/src/ast/return.js +21 -0
  96. package/src/ast/selfreference.js +24 -0
  97. package/src/ast/silent.js +24 -0
  98. package/src/ast/statement.js +19 -0
  99. package/src/ast/static.js +24 -0
  100. package/src/ast/staticlookup.js +22 -0
  101. package/src/ast/staticreference.js +24 -0
  102. package/src/ast/staticvariable.js +26 -0
  103. package/src/ast/string.js +28 -0
  104. package/src/ast/switch.js +28 -0
  105. package/src/ast/throw.js +21 -0
  106. package/src/ast/trait.js +24 -0
  107. package/src/ast/traitalias.js +44 -0
  108. package/src/ast/traitprecedence.js +28 -0
  109. package/src/ast/traituse.js +26 -0
  110. package/src/ast/try.js +28 -0
  111. package/src/ast/typereference.js +40 -0
  112. package/src/ast/unary.js +26 -0
  113. package/src/ast/uniontype.js +24 -0
  114. package/src/ast/unset.js +23 -0
  115. package/src/ast/usegroup.js +30 -0
  116. package/src/ast/useitem.js +45 -0
  117. package/src/ast/variable.js +36 -0
  118. package/src/ast/variadic.js +25 -0
  119. package/src/ast/variadicplaceholder.js +24 -0
  120. package/src/ast/while.js +28 -0
  121. package/src/ast/yield.js +27 -0
  122. package/src/ast/yieldfrom.js +25 -0
  123. package/src/ast.js +593 -0
  124. package/src/index.js +239 -0
  125. package/src/lexer/attribute.js +85 -0
  126. package/src/lexer/comments.js +63 -0
  127. package/src/lexer/initial.js +64 -0
  128. package/src/lexer/numbers.js +171 -0
  129. package/src/lexer/property.js +96 -0
  130. package/src/lexer/scripting.js +114 -0
  131. package/src/lexer/strings.js +524 -0
  132. package/src/lexer/tokens.js +356 -0
  133. package/src/lexer/utils.js +112 -0
  134. package/src/lexer.js +561 -0
  135. package/src/parser/array.js +113 -0
  136. package/src/parser/class.js +718 -0
  137. package/src/parser/comment.js +52 -0
  138. package/src/parser/enum.js +56 -0
  139. package/src/parser/expr.js +848 -0
  140. package/src/parser/function.js +507 -0
  141. package/src/parser/if.js +94 -0
  142. package/src/parser/loops.js +168 -0
  143. package/src/parser/main.js +21 -0
  144. package/src/parser/namespace.js +231 -0
  145. package/src/parser/scalar.js +492 -0
  146. package/src/parser/statement.js +444 -0
  147. package/src/parser/switch.js +99 -0
  148. package/src/parser/try.js +43 -0
  149. package/src/parser/utils.js +203 -0
  150. package/src/parser/variable.js +363 -0
  151. package/src/parser.js +748 -0
  152. package/src/tokens.js +177 -0
  153. package/types.d.ts +1457 -0
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Block = require("./block");
9
+ const KIND = "declare";
10
+
11
+ /**
12
+ * The declare construct is used to set execution directives for a block of code
13
+ * @constructor Declare
14
+ * @memberOf module:php-parser
15
+ * @extends {Block}
16
+ * @property {DeclareDirective[]} directives
17
+ * @property {string} mode
18
+ * @see http://php.net/manual/en/control-structures.declare.php
19
+ */
20
+ const Declare = Block.extends(
21
+ KIND,
22
+ function Declare(directives, body, mode, docs, location) {
23
+ Block.apply(this, [KIND, body, docs, location]);
24
+ this.directives = directives;
25
+ this.mode = mode;
26
+ },
27
+ );
28
+
29
+ /**
30
+ * The node is declared as a short tag syntax :
31
+ * ```php
32
+ * <?php
33
+ * declare(ticks=1):
34
+ * // some statements
35
+ * enddeclare;
36
+ * ```
37
+ * @constant {String} Declare#MODE_SHORT
38
+ * @memberOf module:php-parser
39
+ */
40
+ Declare.MODE_SHORT = "short";
41
+
42
+ /**
43
+ * The node is declared bracket enclosed code :
44
+ * ```php
45
+ * <?php
46
+ * declare(ticks=1) {
47
+ * // some statements
48
+ * }
49
+ * ```
50
+ * @constant {String} Declare#MODE_BLOCK
51
+ * @memberOf module:php-parser
52
+ */
53
+ Declare.MODE_BLOCK = "block";
54
+
55
+ /**
56
+ * The node is declared as a simple statement. In order to make things simpler
57
+ * children of the node are automatically collected until the next
58
+ * declare statement.
59
+ * ```php
60
+ * <?php
61
+ * declare(ticks=1);
62
+ * // some statements
63
+ * declare(ticks=2);
64
+ * // some statements
65
+ * ```
66
+ * @constant {String} Declare#MODE_NONE
67
+ * @memberOf module:php-parser
68
+ */
69
+ Declare.MODE_NONE = "none";
70
+
71
+ module.exports = Declare;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Node = require("./node");
9
+ const KIND = "declaredirective";
10
+
11
+ /**
12
+ * Defines a constant
13
+ * @constructor DeclareDirective
14
+ * @memberOf module:php-parser
15
+ * @extends {Node}
16
+ * @property {Identifier} key
17
+ * @property {Node|string|number|boolean|null} value
18
+ */
19
+ module.exports = Node.extends(
20
+ KIND,
21
+ function DeclareDirective(key, value, docs, location) {
22
+ Node.apply(this, [KIND, docs, location]);
23
+ this.key = key;
24
+ this.value = value;
25
+ },
26
+ );
package/src/ast/do.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Statement = require("./statement");
9
+ const KIND = "do";
10
+
11
+ /**
12
+ * Defines a do/while statement
13
+ * @constructor Do
14
+ * @memberOf module:php-parser
15
+ * @extends {Statement}
16
+ * @property {Expression} test
17
+ * @property {Block | null} body
18
+ */
19
+ module.exports = Statement.extends(
20
+ KIND,
21
+ function Do(test, body, docs, location) {
22
+ Statement.apply(this, [KIND, docs, location]);
23
+ this.test = test;
24
+ this.body = body;
25
+ },
26
+ );
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Statement = require("./statement");
9
+ const KIND = "echo";
10
+
11
+ /**
12
+ * Defines system based call
13
+ * @constructor Echo
14
+ * @memberOf module:php-parser
15
+ * @property {boolean} shortForm
16
+ * @property {Expression[]} expressions
17
+ * @extends {Statement}
18
+ */
19
+ module.exports = Statement.extends(
20
+ KIND,
21
+ function Echo(expressions, shortForm, docs, location) {
22
+ Statement.apply(this, [KIND, docs, location]);
23
+ this.shortForm = shortForm;
24
+ this.expressions = expressions;
25
+ },
26
+ );
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Expression = require("./expression");
9
+ const KIND = "empty";
10
+
11
+ /**
12
+ * Defines an empty check call
13
+ * @constructor Empty
14
+ * @memberOf module:php-parser
15
+ * @extends {Expression}
16
+ */
17
+ module.exports = Expression.extends(
18
+ KIND,
19
+ function Empty(expression, docs, location) {
20
+ Expression.apply(this, [KIND, docs, location]);
21
+ this.expression = expression;
22
+ },
23
+ );
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Literal = require("./literal");
9
+ const KIND = "encapsed";
10
+
11
+ /**
12
+ * Defines an encapsed string (contains expressions)
13
+ * @constructor Encapsed
14
+ * @memberOf module:php-parser
15
+ * @extends {Literal}
16
+ * @property {String} type - Defines the type of encapsed string (shell, heredoc, string)
17
+ * @property {String|Null} label - The heredoc label, defined only when the type is heredoc
18
+ * @property {EncapsedPart[]} value
19
+ */
20
+ const Encapsed = Literal.extends(
21
+ KIND,
22
+ function Encapsed(value, raw, type, docs, location) {
23
+ Literal.apply(this, [KIND, value, raw, docs, location]);
24
+ this.type = type;
25
+ },
26
+ );
27
+
28
+ /**
29
+ * The node is a double quote string :
30
+ * ```php
31
+ * <?php
32
+ * echo "hello $world";
33
+ * ```
34
+ * @constant {String} Encapsed#TYPE_STRING - `string`
35
+ * @memberOf module:php-parser
36
+ */
37
+ Encapsed.TYPE_STRING = "string";
38
+
39
+ /**
40
+ * The node is a shell execute string :
41
+ * ```php
42
+ * <?php
43
+ * echo `ls -larth $path`;
44
+ * ```
45
+ * @constant {String} Encapsed#TYPE_SHELL - `shell`
46
+ * @memberOf module:php-parser
47
+ */
48
+ Encapsed.TYPE_SHELL = "shell";
49
+
50
+ /**
51
+ * The node is a shell execute string :
52
+ * ```php
53
+ * <?php
54
+ * echo <<<STR
55
+ * Hello $world
56
+ * STR
57
+ * ;
58
+ * ```
59
+ * @constant {String} Encapsed#TYPE_HEREDOC - `heredoc`
60
+ * @memberOf module:php-parser
61
+ */
62
+ Encapsed.TYPE_HEREDOC = "heredoc";
63
+
64
+ /**
65
+ * The node contains a list of constref / variables / expr :
66
+ * ```php
67
+ * <?php
68
+ * echo $foo->bar_$baz;
69
+ * ```
70
+ * @constant {String} Encapsed#TYPE_OFFSET - `offset`
71
+ * @memberOf module:php-parser
72
+ */
73
+ Encapsed.TYPE_OFFSET = "offset";
74
+
75
+ module.exports = Encapsed;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Expression = require("./expression");
9
+ const KIND = "encapsedpart";
10
+
11
+ /**
12
+ * Part of `Encapsed` node
13
+ * @constructor EncapsedPart
14
+ * @memberOf module:php-parser
15
+ * @extends {Expression}
16
+ * @property {Expression} expression
17
+ * @property {String} syntax
18
+ * @property {Boolean} curly
19
+ */
20
+ module.exports = Expression.extends(
21
+ KIND,
22
+ function EncapsedPart(expression, syntax, curly, docs, location) {
23
+ Expression.apply(this, [KIND, docs, location]);
24
+ this.expression = expression;
25
+ this.syntax = syntax;
26
+ this.curly = curly;
27
+ },
28
+ );
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Expression = require("./expression");
9
+ const KIND = "entry";
10
+
11
+ /**
12
+ * An array entry - see [Array](#array)
13
+ * @memberOf module:php-parser
14
+ * @constructor Entry
15
+ * @extends {Expression}
16
+ * @property {Node|null} key The entry key/offset
17
+ * @property {Node} value The entry value
18
+ * @property {Boolean} byRef By reference
19
+ * @property {Boolean} unpack Argument unpacking
20
+ */
21
+ module.exports = Expression.extends(
22
+ KIND,
23
+ function Entry(key, value, byRef, unpack, docs, location) {
24
+ Expression.apply(this, [KIND, docs, location]);
25
+ this.key = key;
26
+ this.value = value;
27
+ this.byRef = byRef;
28
+ this.unpack = unpack;
29
+ },
30
+ );
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Declaration = require("./declaration");
9
+ const KIND = "enum";
10
+
11
+ /**
12
+ * A enum definition
13
+ * @constructor Enum
14
+ * @memberOf module:php-parser
15
+ * @extends {Declaration}
16
+ * @property {Identifier|null} valueType
17
+ * @property {Identifier[]} implements
18
+ * @property {Declaration[]} body
19
+ * @property {AttrGroup[]} attrGroups
20
+ */
21
+ module.exports = Declaration.extends(
22
+ KIND,
23
+ function Enum(name, valueType, impl, body, docs, location) {
24
+ Declaration.apply(this, [KIND, name, docs, location]);
25
+ this.valueType = valueType;
26
+ this.implements = impl;
27
+ this.body = body;
28
+ this.attrGroups = [];
29
+ },
30
+ );
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Node = require("./node");
9
+ const KIND = "enumcase";
10
+
11
+ /**
12
+ * Declares a cases into the current scope
13
+ * @constructor EnumCase
14
+ * @memberOf module:php-parser
15
+ * @extends {Node}
16
+ * @property {string} name
17
+ * @property {string|number|null} value
18
+ */
19
+ module.exports = Node.extends(
20
+ KIND,
21
+ function EnumCase(name, value, docs, location) {
22
+ Node.apply(this, [KIND, docs, location]);
23
+ this.name = name;
24
+ this.value = value;
25
+ },
26
+ );
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Node = require("./node");
9
+ const KIND = "error";
10
+
11
+ /**
12
+ * Defines an error node (used only on silentMode)
13
+ * @constructor Error
14
+ * @memberOf module:php-parser
15
+ * @extends {Node}
16
+ * @property {string} message
17
+ * @property {number} line
18
+ * @property {number|string} token
19
+ * @property {string|array} expected
20
+ */
21
+ module.exports = Node.extends(
22
+ KIND,
23
+ function Error(message, token, line, expected, docs, location) {
24
+ Node.apply(this, [KIND, docs, location]);
25
+ this.message = message;
26
+ this.token = token;
27
+ this.line = line;
28
+ this.expected = expected;
29
+ },
30
+ );
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Expression = require("./expression");
9
+ const KIND = "eval";
10
+
11
+ /**
12
+ * Defines an eval statement
13
+ * @constructor Eval
14
+ * @memberOf module:php-parser
15
+ * @extends {Expression}
16
+ * @property {Node} source
17
+ */
18
+ module.exports = Expression.extends(
19
+ KIND,
20
+ function Eval(source, docs, location) {
21
+ Expression.apply(this, [KIND, docs, location]);
22
+ this.source = source;
23
+ },
24
+ );
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Expression = require("./expression");
9
+ const KIND = "exit";
10
+
11
+ /**
12
+ * Defines an exit / die call
13
+ * @constructor Exit
14
+ * @memberOf module:php-parser
15
+ * @extends {Expression}
16
+ * @property {Node|null} expression
17
+ * @property {boolean} useDie
18
+ */
19
+ module.exports = Expression.extends(
20
+ KIND,
21
+ function Exit(expression, useDie, docs, location) {
22
+ Expression.apply(this, [KIND, docs, location]);
23
+ this.expression = expression;
24
+ this.useDie = useDie;
25
+ },
26
+ );
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Node = require("./node");
9
+ const KIND = "expression";
10
+
11
+ /**
12
+ * Any expression node. Since the left-hand side of an assignment may
13
+ * be any expression in general, an expression can also be a pattern.
14
+ * @constructor Expression
15
+ * @memberOf module:php-parser
16
+ * @extends {Node}
17
+ */
18
+ module.exports = Node.extends(KIND, function Expression(kind, docs, location) {
19
+ Node.apply(this, [kind || KIND, docs, location]);
20
+ });
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Statement = require("./statement");
9
+ const KIND = "expressionstatement";
10
+
11
+ /**
12
+ * Defines an expression based statement
13
+ * @constructor ExpressionStatement
14
+ * @memberOf module:php-parser
15
+ * @extends {Statement}
16
+ * @property {Expression} expression
17
+ */
18
+ module.exports = Statement.extends(
19
+ KIND,
20
+ function ExpressionStatement(expr, docs, location) {
21
+ Statement.apply(this, [KIND, docs, location]);
22
+ this.expression = expr;
23
+ },
24
+ );
package/src/ast/for.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Statement = require("./statement");
9
+ const KIND = "for";
10
+
11
+ /**
12
+ * Defines a for iterator
13
+ * @constructor For
14
+ * @memberOf module:php-parser
15
+ * @extends {Statement}
16
+ * @property {Expression[]} init
17
+ * @property {Expression[]} test
18
+ * @property {Expression[]} increment
19
+ * @property {Block | null} body
20
+ * @property {boolean} shortForm
21
+ * @see http://php.net/manual/en/control-structures.for.php
22
+ */
23
+ module.exports = Statement.extends(
24
+ KIND,
25
+ function For(init, test, increment, body, shortForm, docs, location) {
26
+ Statement.apply(this, [KIND, docs, location]);
27
+ this.init = init;
28
+ this.test = test;
29
+ this.increment = increment;
30
+ this.shortForm = shortForm;
31
+ this.body = body;
32
+ },
33
+ );
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Statement = require("./statement");
9
+ const KIND = "foreach";
10
+
11
+ /**
12
+ * Defines a foreach iterator
13
+ * @constructor Foreach
14
+ * @memberOf module:php-parser
15
+ * @extends {Statement}
16
+ * @property {Expression} source
17
+ * @property {Expression|null} key
18
+ * @property {Expression} value
19
+ * @property {Block | null} body
20
+ * @property {boolean} shortForm
21
+ * @see http://php.net/manual/en/control-structures.foreach.php
22
+ */
23
+ module.exports = Statement.extends(
24
+ KIND,
25
+ function Foreach(source, key, value, body, shortForm, docs, location) {
26
+ Statement.apply(this, [KIND, docs, location]);
27
+ this.source = source;
28
+ this.key = key;
29
+ this.value = value;
30
+ this.shortForm = shortForm;
31
+ this.body = body;
32
+ },
33
+ );
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Declaration = require("./declaration");
9
+ const KIND = "function";
10
+
11
+ /**
12
+ * Defines a classic function
13
+ * @constructor Function
14
+ * @memberOf module:php-parser
15
+ * @extends {Declaration}
16
+ * @property {Parameter[]} arguments
17
+ * @property {Identifier} type
18
+ * @property {boolean} byref
19
+ * @property {boolean} nullable
20
+ * @property {Block|null} body
21
+ * @property {AttrGroup[]} attrGroups
22
+ */
23
+ module.exports = Declaration.extends(
24
+ KIND,
25
+ function _Function(name, args, byref, type, nullable, docs, location) {
26
+ Declaration.apply(this, [KIND, name, docs, location]);
27
+ this.arguments = args;
28
+ this.byref = byref;
29
+ this.type = type;
30
+ this.nullable = nullable;
31
+ this.body = null;
32
+ this.attrGroups = [];
33
+ },
34
+ );
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Statement = require("./statement");
9
+ const KIND = "global";
10
+
11
+ /**
12
+ * Imports a variable from the global scope
13
+ * @constructor Global
14
+ * @memberOf module:php-parser
15
+ * @extends {Statement}
16
+ * @property {Variable[]} items
17
+ */
18
+ module.exports = Statement.extends(
19
+ KIND,
20
+ function Global(items, docs, location) {
21
+ Statement.apply(this, [KIND, docs, location]);
22
+ this.items = items;
23
+ },
24
+ );
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Statement = require("./statement");
9
+ const KIND = "goto";
10
+
11
+ /**
12
+ * Defines goto statement
13
+ * @constructor Goto
14
+ * @memberOf module:php-parser
15
+ * @extends {Statement}
16
+ * @property {string} label
17
+ * @see {Label}
18
+ */
19
+ module.exports = Statement.extends(KIND, function Goto(label, docs, location) {
20
+ Statement.apply(this, [KIND, docs, location]);
21
+ this.label = label;
22
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (C) 2018 Glayzzle (BSD3 License)
3
+ * @authors https://github.com/glayzzle/php-parser/graphs/contributors
4
+ * @url http://glayzzle.com
5
+ */
6
+ "use strict";
7
+
8
+ const Statement = require("./statement");
9
+ const KIND = "halt";
10
+
11
+ /**
12
+ * Halts the compiler execution
13
+ * @constructor Halt
14
+ * @memberOf module:php-parser
15
+ * @extends {Statement}
16
+ * @property {String} after - String after the halt statement
17
+ * @see http://php.net/manual/en/function.halt-compiler.php
18
+ */
19
+ module.exports = Statement.extends(KIND, function Halt(after, docs, location) {
20
+ Statement.apply(this, [KIND, docs, location]);
21
+ this.after = after;
22
+ });