z_mirror/luapls

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

Caleb HeuerFix testsa9d7242

main
7.4 KiB317 linesraw
1[
2  {
3    "Label": "repeat",
4    "Input": "local i = 0 repeat i = i + 1 until i == 50 print('done')",
5    "AST": {
6      "Type": "Block",
7      "Range": {
8        "Start": 0,
9        "End": 56
10      },
11      "Stmts": [
12        {
13          "Type": "LocalStatement",
14          "Range": {
15            "Start": 0,
16            "End": 11
17          },
18          "Names": [
19            {
20              "Type": "Identifier",
21              "Range": {
22                "Start": 6,
23                "End": 7
24              },
25              "Literal": "i"
26            }
27          ],
28          "Exps": [
29            {
30              "Type": "NumberLiteral",
31              "Range": {
32                "Start": 10,
33                "End": 11
34              },
35              "Literal": "0",
36              "Value": 0
37            }
38          ]
39        },
40        {
41          "Type": "RepeatStatement",
42          "Range": {
43            "Start": 12,
44            "End": 42
45          },
46          "Body": {
47            "Type": "Block",
48            "Range": {
49              "Start": 19,
50              "End": 28
51            },
52            "Stmts": [
53              {
54                "Type": "AssignmentStatement",
55                "Range": {
56                  "Start": 19,
57                  "End": 28
58                },
59                "Vars": [
60                  {
61                    "Type": "Identifier",
62                    "Range": {
63                      "Start": 19,
64                      "End": 20
65                    },
66                    "Literal": "i"
67                  }
68                ],
69                "Exps": [
70                  {
71                    "Type": "InfixExpression",
72                    "Range": {
73                      "Start": 23,
74                      "End": 28
75                    },
76                    "Left": {
77                      "Type": "Identifier",
78                      "Range": {
79                        "Start": 23,
80                        "End": 24
81                      },
82                      "Literal": "i"
83                    },
84                    "Operator": "plus",
85                    "Right": {
86                      "Type": "NumberLiteral",
87                      "Range": {
88                        "Start": 27,
89                        "End": 28
90                      },
91                      "Literal": "1",
92                      "Value": 1
93                    }
94                  }
95                ]
96              }
97            ]
98          },
99          "Condition": {
100            "Type": "InfixExpression",
101            "Range": {
102              "Start": 35,
103              "End": 42
104            },
105            "Left": {
106              "Type": "Identifier",
107              "Range": {
108                "Start": 35,
109                "End": 36
110              },
111              "Literal": "i"
112            },
113            "Operator": "equal",
114            "Right": {
115              "Type": "NumberLiteral",
116              "Range": {
117                "Start": 40,
118                "End": 42
119              },
120              "Literal": "50",
121              "Value": 50
122            }
123          }
124        },
125        {
126          "Type": "FunctionCall",
127          "Range": {
128            "Start": 43,
129            "End": 56
130          },
131          "Left": {
132            "Type": "Identifier",
133            "Range": {
134              "Start": 43,
135              "End": 48
136            },
137            "Literal": "print"
138          },
139          "Args": [
140            {
141              "Type": "StringLiteral",
142              "Range": {
143                "Start": 49,
144                "End": 55
145              },
146              "Literal": "'done'"
147            }
148          ]
149        }
150      ]
151    }
152  },
153  {
154    "Label": "return",
155    "Input": "return foo, bar",
156    "AST": {
157      "Type": "Block",
158      "Range": {
159        "Start": 0,
160        "End": 15
161      },
162      "Stmts": [
163        {
164          "Type": "ReturnStatement",
165          "Range": {
166            "Start": 0,
167            "End": 15
168          },
169          "Exps": [
170            {
171              "Type": "Identifier",
172              "Range": {
173                "Start": 7,
174                "End": 10
175              },
176              "Literal": "foo"
177            },
178            {
179              "Type": "Identifier",
180              "Range": {
181                "Start": 12,
182                "End": 15
183              },
184              "Literal": "bar"
185            }
186          ]
187        }
188      ]
189    }
190  },
191  {
192    "Label": "while",
193    "Input": "local i = 0 while i \u003c 10 do i = i + 1 end",
194    "AST": {
195      "Type": "Block",
196      "Range": {
197        "Start": 0,
198        "End": 41
199      },
200      "Stmts": [
201        {
202          "Type": "LocalStatement",
203          "Range": {
204            "Start": 0,
205            "End": 11
206          },
207          "Names": [
208            {
209              "Type": "Identifier",
210              "Range": {
211                "Start": 6,
212                "End": 7
213              },
214              "Literal": "i"
215            }
216          ],
217          "Exps": [
218            {
219              "Type": "NumberLiteral",
220              "Range": {
221                "Start": 10,
222                "End": 11
223              },
224              "Literal": "0",
225              "Value": 0
226            }
227          ]
228        },
229        {
230          "Type": "WhileStatement",
231          "Range": {
232            "Start": 12,
233            "End": 41
234          },
235          "Condition": {
236            "Type": "InfixExpression",
237            "Range": {
238              "Start": 18,
239              "End": 24
240            },
241            "Left": {
242              "Type": "Identifier",
243              "Range": {
244                "Start": 18,
245                "End": 19
246              },
247              "Literal": "i"
248            },
249            "Operator": "lt",
250            "Right": {
251              "Type": "NumberLiteral",
252              "Range": {
253                "Start": 22,
254                "End": 24
255              },
256              "Literal": "10",
257              "Value": 10
258            }
259          },
260          "Body": {
261            "Type": "Block",
262            "Range": {
263              "Start": 28,
264              "End": 37
265            },
266            "Stmts": [
267              {
268                "Type": "AssignmentStatement",
269                "Range": {
270                  "Start": 28,
271                  "End": 37
272                },
273                "Vars": [
274                  {
275                    "Type": "Identifier",
276                    "Range": {
277                      "Start": 28,
278                      "End": 29
279                    },
280                    "Literal": "i"
281                  }
282                ],
283                "Exps": [
284                  {
285                    "Type": "InfixExpression",
286                    "Range": {
287                      "Start": 32,
288                      "End": 37
289                    },
290                    "Left": {
291                      "Type": "Identifier",
292                      "Range": {
293                        "Start": 32,
294                        "End": 33
295                      },
296                      "Literal": "i"
297                    },
298                    "Operator": "plus",
299                    "Right": {
300                      "Type": "NumberLiteral",
301                      "Range": {
302                        "Start": 36,
303                        "End": 37
304                      },
305                      "Literal": "1",
306                      "Value": 1
307                    }
308                  }
309                ]
310              }
311            ]
312          }
313        }
314      ]
315    }
316  }
317]