z_mirror/luapls

git clone https://git.raiguard.me/z_mirror/luapls

Caleb HeuerFix testsa9d7242

main
5.2 KiB208 linesraw
1[
2  {
3    "Label": "function_expression",
4    "Input": "local add = function(a, b) print(a + b) end",
5    "AST": {
6      "Type": "Block",
7      "Range": {
8        "Start": 0,
9        "End": 43
10      },
11      "Stmts": [
12        {
13          "Type": "LocalStatement",
14          "Range": {
15            "Start": 0,
16            "End": 43
17          },
18          "Names": [
19            {
20              "Type": "Identifier",
21              "Range": {
22                "Start": 6,
23                "End": 9
24              },
25              "Literal": "add"
26            }
27          ],
28          "Exps": [
29            {
30              "Type": "FunctionExpression",
31              "Range": {
32                "Start": 12,
33                "End": 43
34              },
35              "Params": [
36                {
37                  "Type": "Identifier",
38                  "Range": {
39                    "Start": 21,
40                    "End": 22
41                  },
42                  "Literal": "a"
43                },
44                {
45                  "Type": "Identifier",
46                  "Range": {
47                    "Start": 24,
48                    "End": 25
49                  },
50                  "Literal": "b"
51                }
52              ],
53              "Vararg": false,
54              "Body": {
55                "Type": "Block",
56                "Range": {
57                  "Start": 27,
58                  "End": 39
59                },
60                "Stmts": [
61                  {
62                    "Type": "FunctionCall",
63                    "Range": {
64                      "Start": 27,
65                      "End": 39
66                    },
67                    "Left": {
68                      "Type": "Identifier",
69                      "Range": {
70                        "Start": 27,
71                        "End": 32
72                      },
73                      "Literal": "print"
74                    },
75                    "Args": [
76                      {
77                        "Type": "InfixExpression",
78                        "Range": {
79                          "Start": 33,
80                          "End": 38
81                        },
82                        "Left": {
83                          "Type": "Identifier",
84                          "Range": {
85                            "Start": 33,
86                            "End": 34
87                          },
88                          "Literal": "a"
89                        },
90                        "Operator": "plus",
91                        "Right": {
92                          "Type": "Identifier",
93                          "Range": {
94                            "Start": 37,
95                            "End": 38
96                          },
97                          "Literal": "b"
98                        }
99                      }
100                    ]
101                  }
102                ]
103              }
104            }
105          ]
106        }
107      ]
108    }
109  },
110  {
111    "Label": "function_statement",
112    "Input": "function add(a, b) print(a + b) end",
113    "AST": {
114      "Type": "Block",
115      "Range": {
116        "Start": 0,
117        "End": 35
118      },
119      "Stmts": [
120        {
121          "Type": "FunctionStatement",
122          "Range": {
123            "Start": 0,
124            "End": 35
125          },
126          "Left": {
127            "Type": "Identifier",
128            "Range": {
129              "Start": 9,
130              "End": 12
131            },
132            "Literal": "add"
133          },
134          "Params": [
135            {
136              "Type": "Identifier",
137              "Range": {
138                "Start": 13,
139                "End": 14
140              },
141              "Literal": "a"
142            },
143            {
144              "Type": "Identifier",
145              "Range": {
146                "Start": 16,
147                "End": 17
148              },
149              "Literal": "b"
150            }
151          ],
152          "Vararg": false,
153          "Body": {
154            "Type": "Block",
155            "Range": {
156              "Start": 19,
157              "End": 31
158            },
159            "Stmts": [
160              {
161                "Type": "FunctionCall",
162                "Range": {
163                  "Start": 19,
164                  "End": 31
165                },
166                "Left": {
167                  "Type": "Identifier",
168                  "Range": {
169                    "Start": 19,
170                    "End": 24
171                  },
172                  "Literal": "print"
173                },
174                "Args": [
175                  {
176                    "Type": "InfixExpression",
177                    "Range": {
178                      "Start": 25,
179                      "End": 30
180                    },
181                    "Left": {
182                      "Type": "Identifier",
183                      "Range": {
184                        "Start": 25,
185                        "End": 26
186                      },
187                      "Literal": "a"
188                    },
189                    "Operator": "plus",
190                    "Right": {
191                      "Type": "Identifier",
192                      "Range": {
193                        "Start": 29,
194                        "End": 30
195                      },
196                      "Literal": "b"
197                    }
198                  }
199                ]
200              }
201            ]
202          },
203          "IsLocal": false
204        }
205      ]
206    }
207  }
208]