z_mirror/luapls

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

Caleb HeuerRefactor the expressionsd89f2de

main
1015 B50 linesraw
1package ast
2
3import "github.com/raiguard/luapls/lua/token"
4
5type TableField interface {
6	Node
7	tableFieldNode()
8}
9
10type TableArrayField struct {
11	Expr Expression
12}
13
14func (taf *TableArrayField) tableFieldNode() {}
15func (taf *TableArrayField) Pos() token.Pos {
16	return taf.Expr.Pos()
17}
18func (taf *TableArrayField) End() token.Pos {
19	return taf.Expr.End()
20}
21
22type TableSimpleKeyField struct {
23	Name      Identifier
24	AssignTok Unit
25	Expr      Expression
26}
27
28func (tf *TableSimpleKeyField) tableFieldNode() {}
29func (tf *TableSimpleKeyField) Pos() token.Pos {
30	return tf.Name.Pos()
31}
32func (tf *TableSimpleKeyField) End() token.Pos {
33	return tf.Expr.End()
34}
35
36type TableExpressionKeyField struct {
37	LeftBracket  Unit
38	Name         Expression
39	RightBracket Unit
40	AssignTok    Unit
41	Expr         Expression
42}
43
44func (tf *TableExpressionKeyField) tableFieldNode() {}
45func (tf *TableExpressionKeyField) Pos() token.Pos {
46	return tf.LeftBracket.Pos()
47}
48func (tf *TableExpressionKeyField) End() token.Pos {
49	return tf.Expr.End()
50}