tree-sitter-dust/corpus/tables.txt
2023-09-29 16:54:13 -04:00

138 lines
2.4 KiB
Plaintext

==================
Table Declaration
==================
table <text, number> {
['answer', 42]
}
---
(root
(item
(statement
(open_statement
(expression
(value
(table
(identifier)
(identifier)
(list
(value
(string))
(value
(integer))))))))))
==================
Table Assignment
==================
foobar = table <text, number> {
['answer', 42]
}
foobar
---
(root
(item
(statement
(open_statement
(expression
(operation
(expression
(identifier))
(operator)
(expression
(value
(table
(identifier)
(identifier)
(list
(value
(string))
(value
(integer)))))))))))
(item
(statement
(open_statement
(expression
(identifier))))))
==================
Table Access
==================
foobar = table <text, number> {
['answer', 42]
}
select number from foobar where text == 'answer'
---
(root
(item
(statement
(open_statement
(expression
(operation
(expression
(identifier))
(operator)
(expression
(value
(table
(identifier)
(identifier)
(list
(value
(string))
(value
(integer)))))))))))
(item
(statement
(open_statement
(expression
(value
(42)))))))
==================
Table Insert
==================
foobar = table <text, number> {
['answer', 42]
}
insert ['bob was here', 0] into foobar
---
(root
(item
(statement
(open_statement
(expression
(operation
(expression
(identifier))
(operator)
(expression
(value
(table
(identifier)
(identifier)
(list
(value
(string))
(value
(integer)))))))))))
(item
(statement
(open_statement
(expression
(value
(42)))))))