parser/tests/fixtures/0223/ast.txt
Saif Eddin Gmati 6a6d4d0e5f
chore: refactor ident and dynamic var parsers (#192)
Signed-off-by: azjezz <azjezz@protonmail.com>
2022-12-10 15:24:55 +01:00

1605 lines
61 KiB
Plaintext

[
Function(
Function {
start: (
9,
1,
),
end: (
16,
1,
),
name: SimpleIdentifier {
span: (
9,
10,
),
name: "a",
},
attributes: [
AttributeGroup {
start: (
3,
1,
),
end: (
8,
1,
),
members: [
Attribute {
start: (
4,
5,
),
end: (
4,
7,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
4,
5,
),
name: "A1",
},
),
),
},
Attribute {
start: (
5,
5,
),
end: (
5,
9,
),
expression: Call {
target: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
5,
5,
),
name: "A2",
},
),
),
args: [],
},
},
Attribute {
start: (
6,
5,
),
end: (
6,
10,
),
expression: Call {
target: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
6,
5,
),
name: "A3",
},
),
),
args: [
Arg {
name: None,
value: LiteralInteger {
i: "0",
},
unpack: false,
},
],
},
},
Attribute {
start: (
7,
5,
),
end: (
7,
13,
),
expression: Call {
target: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
7,
5,
),
name: "A4",
},
),
),
args: [
Arg {
name: Some(
SimpleIdentifier {
span: (
7,
8,
),
name: "x",
},
),
value: LiteralInteger {
i: "1",
},
unpack: false,
},
],
},
},
],
},
],
parameters: FunctionParameterList {
start: (
9,
11,
),
end: (
15,
3,
),
members: [
FunctionParameter {
start: (
10,
5,
),
end: (
11,
17,
),
name: SimpleVariable {
span: (
11,
15,
),
name: "a",
},
attributes: [
AttributeGroup {
start: (
10,
5,
),
end: (
10,
9,
),
members: [
Attribute {
start: (
10,
7,
),
end: (
10,
9,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
10,
7,
),
name: "A5",
},
),
),
},
],
},
],
type: Some(
Union(
[
Integer,
Float,
],
),
),
variadic: false,
default: None,
by_ref: false,
},
FunctionParameter {
start: (
12,
5,
),
end: (
13,
7,
),
name: SimpleVariable {
span: (
13,
5,
),
name: "c",
},
attributes: [
AttributeGroup {
start: (
12,
5,
),
end: (
12,
9,
),
members: [
Attribute {
start: (
12,
7,
),
end: (
12,
9,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
12,
7,
),
name: "A6",
},
),
),
},
],
},
],
type: None,
variadic: false,
default: None,
by_ref: false,
},
FunctionParameter {
start: (
14,
5,
),
end: (
14,
20,
),
name: SimpleVariable {
span: (
14,
18,
),
name: "b",
},
attributes: [
AttributeGroup {
start: (
14,
5,
),
end: (
14,
9,
),
members: [
Attribute {
start: (
14,
7,
),
end: (
14,
9,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
14,
7,
),
name: "A7",
},
),
),
},
],
},
],
type: Some(
String,
),
variadic: false,
default: None,
by_ref: false,
},
],
},
return_type: None,
by_ref: false,
body: [],
},
),
Class(
Class {
start: (
20,
1,
),
end: (
34,
1,
),
name: SimpleIdentifier {
span: (
20,
7,
),
name: "C",
},
extends: None,
implements: None,
attributes: [
AttributeGroup {
start: (
19,
1,
),
end: (
19,
26,
),
members: [
Attribute {
start: (
19,
3,
),
end: (
19,
5,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
19,
3,
),
name: "A8",
},
),
),
},
Attribute {
start: (
19,
7,
),
end: (
19,
11,
),
expression: Call {
target: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
19,
7,
),
name: "A9",
},
),
),
args: [],
},
},
Attribute {
start: (
19,
13,
),
end: (
19,
26,
),
expression: Call {
target: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
19,
13,
),
name: "A10",
},
),
),
args: [
Arg {
name: Some(
SimpleIdentifier {
span: (
19,
17,
),
name: "foo",
},
),
value: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
19,
22,
),
name: "bar",
},
),
),
unpack: false,
},
],
},
},
],
},
],
members: [
Method(
Method {
start: (
22,
12,
),
end: (
25,
8,
),
name: SimpleIdentifier {
span: (
22,
21,
),
name: "__construct",
},
attributes: [
AttributeGroup {
start: (
21,
5,
),
end: (
21,
10,
),
members: [
Attribute {
start: (
21,
7,
),
end: (
21,
10,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
21,
7,
),
name: "A11",
},
),
),
},
],
},
],
parameters: MethodParameterList {
start: (
22,
32,
),
end: (
25,
7,
),
members: [
MethodParameter {
start: (
23,
9,
),
end: (
24,
34,
),
name: SimpleVariable {
span: (
24,
32,
),
name: "s",
},
attributes: [
AttributeGroup {
start: (
23,
9,
),
end: (
23,
14,
),
members: [
Attribute {
start: (
23,
11,
),
end: (
23,
14,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
23,
11,
),
name: "A12",
},
),
),
},
],
},
],
type: Some(
String,
),
variadic: false,
default: None,
modifiers: PromotedPropertyModifierGroup {
modifiers: [
Public {
start: (
24,
9,
),
end: (
24,
16,
),
},
Readonly {
start: (
24,
16,
),
end: (
24,
25,
),
},
],
},
by_ref: false,
},
],
},
body: Some(
[],
),
modifiers: MethodModifierGroup {
modifiers: [
Public {
start: (
22,
5,
),
end: (
22,
12,
),
},
],
},
return_type: None,
by_ref: false,
},
),
Method(
Method {
start: (
28,
12,
),
end: (
30,
8,
),
name: SimpleIdentifier {
span: (
28,
21,
),
name: "m",
},
attributes: [
AttributeGroup {
start: (
27,
5,
),
end: (
27,
10,
),
members: [
Attribute {
start: (
27,
7,
),
end: (
27,
10,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
27,
7,
),
name: "A13",
},
),
),
},
],
},
],
parameters: MethodParameterList {
start: (
28,
22,
),
end: (
30,
7,
),
members: [
MethodParameter {
start: (
29,
9,
),
end: (
29,
22,
),
name: SimpleVariable {
span: (
29,
16,
),
name: "param",
},
attributes: [
AttributeGroup {
start: (
29,
9,
),
end: (
29,
14,
),
members: [
Attribute {
start: (
29,
11,
),
end: (
29,
14,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
29,
11,
),
name: "A14",
},
),
),
},
],
},
],
type: None,
variadic: false,
default: None,
modifiers: PromotedPropertyModifierGroup {
modifiers: [],
},
by_ref: false,
},
],
},
body: Some(
[],
),
modifiers: MethodModifierGroup {
modifiers: [
Public {
start: (
28,
5,
),
end: (
28,
12,
),
},
],
},
return_type: None,
by_ref: false,
},
),
Property(
Property {
attributes: [
AttributeGroup {
start: (
32,
5,
),
end: (
32,
10,
),
members: [
Attribute {
start: (
32,
7,
),
end: (
32,
10,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
32,
7,
),
name: "A15",
},
),
),
},
],
},
],
type: None,
modifiers: PropertyModifierGroup {
modifiers: [
Public {
start: (
33,
5,
),
end: (
33,
12,
),
},
],
},
entries: [
PropertyEntry {
variable: SimpleVariable {
span: (
33,
12,
),
name: "prop",
},
value: None,
},
],
},
),
],
},
),
Trait(
Trait {
start: (
37,
1,
),
end: (
37,
10,
),
name: SimpleIdentifier {
span: (
37,
7,
),
name: "F",
},
attributes: [
AttributeGroup {
start: (
36,
1,
),
end: (
36,
6,
),
members: [
Attribute {
start: (
36,
3,
),
end: (
36,
6,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
36,
3,
),
name: "A16",
},
),
),
},
],
},
],
members: [],
},
),
UnitEnum(
UnitEnum {
start: (
40,
1,
),
end: (
40,
9,
),
name: SimpleIdentifier {
span: (
40,
6,
),
name: "P",
},
attributes: [
AttributeGroup {
start: (
39,
1,
),
end: (
39,
6,
),
members: [
Attribute {
start: (
39,
3,
),
end: (
39,
6,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
39,
3,
),
name: "A17",
},
),
),
},
],
},
],
implements: [],
members: [],
},
),
BackedEnum(
BackedEnum {
start: (
43,
1,
),
end: (
43,
14,
),
name: SimpleIdentifier {
span: (
43,
6,
),
name: "B",
},
attributes: [
AttributeGroup {
start: (
42,
1,
),
end: (
42,
6,
),
members: [
Attribute {
start: (
42,
3,
),
end: (
42,
6,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
42,
3,
),
name: "A18",
},
),
),
},
],
},
],
implements: [],
backed_type: Int(
(
43,
9,
),
),
members: [],
},
),
Interface(
Interface {
start: (
46,
1,
),
end: (
46,
14,
),
attributes: [
AttributeGroup {
start: (
45,
1,
),
end: (
45,
6,
),
members: [
Attribute {
start: (
45,
3,
),
end: (
45,
6,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
45,
3,
),
name: "A19",
},
),
),
},
],
},
],
name: SimpleIdentifier {
span: (
46,
11,
),
name: "I",
},
extends: None,
members: [],
},
),
Trait(
Trait {
start: (
49,
1,
),
end: (
49,
10,
),
name: SimpleIdentifier {
span: (
49,
7,
),
name: "T",
},
attributes: [
AttributeGroup {
start: (
48,
1,
),
end: (
48,
6,
),
members: [
Attribute {
start: (
48,
3,
),
end: (
48,
6,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
48,
3,
),
name: "A20",
},
),
),
},
],
},
],
members: [],
},
),
Expression {
expr: AssignmentOperation(
Assign {
left: Variable(
SimpleVariable(
SimpleVariable {
span: (
51,
1,
),
name: "x",
},
),
),
span: (
51,
4,
),
right: Closure(
Closure {
start: (
51,
13,
),
end: (
51,
25,
),
attributes: [
AttributeGroup {
start: (
51,
6,
),
end: (
51,
11,
),
members: [
Attribute {
start: (
51,
8,
),
end: (
51,
11,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
51,
8,
),
name: "A21",
},
),
),
},
],
},
],
parameters: FunctionParameterList {
start: (
51,
21,
),
end: (
51,
24,
),
members: [],
},
return_ty: None,
uses: [],
by_ref: false,
body: [],
static: false,
},
),
},
),
},
Expression {
expr: AssignmentOperation(
Assign {
left: Variable(
SimpleVariable(
SimpleVariable {
span: (
52,
1,
),
name: "y",
},
),
),
span: (
52,
4,
),
right: ArrowFunction(
ArrowFunction {
start: (
52,
13,
),
end: (
52,
22,
),
attributes: [
AttributeGroup {
start: (
52,
6,
),
end: (
52,
11,
),
members: [
Attribute {
start: (
52,
8,
),
end: (
52,
11,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
52,
8,
),
name: "A22",
},
),
),
},
],
},
],
parameters: FunctionParameterList {
start: (
52,
15,
),
end: (
52,
18,
),
members: [],
},
return_type: None,
by_ref: false,
body: LiteralInteger {
i: "0",
},
static: false,
},
),
},
),
},
Expression {
expr: AssignmentOperation(
Assign {
left: Variable(
SimpleVariable(
SimpleVariable {
span: (
53,
1,
),
name: "a",
},
),
),
span: (
53,
4,
),
right: Closure(
Closure {
start: (
53,
13,
),
end: (
53,
32,
),
attributes: [
AttributeGroup {
start: (
53,
6,
),
end: (
53,
11,
),
members: [
Attribute {
start: (
53,
8,
),
end: (
53,
11,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
53,
8,
),
name: "A23",
},
),
),
},
],
},
],
parameters: FunctionParameterList {
start: (
53,
28,
),
end: (
53,
31,
),
members: [],
},
return_ty: None,
uses: [],
by_ref: false,
body: [],
static: true,
},
),
},
),
},
Expression {
expr: AssignmentOperation(
Assign {
left: Variable(
SimpleVariable(
SimpleVariable {
span: (
54,
1,
),
name: "b",
},
),
),
span: (
54,
4,
),
right: ArrowFunction(
ArrowFunction {
start: (
54,
13,
),
end: (
54,
29,
),
attributes: [
AttributeGroup {
start: (
54,
6,
),
end: (
54,
11,
),
members: [
Attribute {
start: (
54,
8,
),
end: (
54,
11,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
54,
8,
),
name: "A24",
},
),
),
},
],
},
],
parameters: FunctionParameterList {
start: (
54,
22,
),
end: (
54,
25,
),
members: [],
},
return_type: None,
by_ref: false,
body: LiteralInteger {
i: "0",
},
static: true,
},
),
},
),
},
Expression {
expr: AssignmentOperation(
Assign {
left: Variable(
SimpleVariable(
SimpleVariable {
span: (
55,
1,
),
name: "z",
},
),
),
span: (
55,
4,
),
right: New {
target: AnonymousClass(
AnonymousClass {
start: (
55,
17,
),
end: (
58,
1,
),
extends: None,
implements: None,
attributes: [
AttributeGroup {
start: (
55,
10,
),
end: (
55,
15,
),
members: [
Attribute {
start: (
55,
12,
),
end: (
55,
15,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
55,
12,
),
name: "A25",
},
),
),
},
],
},
],
members: [
VariableProperty(
VariableProperty {
attributes: [
AttributeGroup {
start: (
56,
5,
),
end: (
56,
10,
),
members: [
Attribute {
start: (
56,
7,
),
end: (
56,
10,
),
expression: Identifier(
SimpleIdentifier(
SimpleIdentifier {
span: (
56,
7,
),
name: "A26",
},
),
),
},
],
},
],
type: None,
entries: [
VariablePropertyEntry {
variable: SimpleVariable {
span: (
57,
9,
),
name: "s",
},
value: None,
},
],
},
),
],
},
),
span: (
55,
6,
),
args: [],
},
},
),
},
]