1
1
mirror of https://github.com/github/semantic.git synced 2024-11-27 12:57:49 +03:00
semantic/tsg
2022-02-01 14:43:49 -05:00

81 lines
1.3 KiB
Plaintext

(module) @this
{
node @this.node
attr (@this.node) type = "module"
}
(identifier) @id
{
node @id.node
}
(string) @this
{
node @this.node
attr (@this.node) type = "string"
attr (@this.node) text = (source-text @this)
}
(true) @this
{
node @this.node
attr (@this.node) type = "true"
}
(false) @this
{
node @this.node
attr (@this.node) type = "false"
}
(print_statement argument: (_) @arg) @this
{
node @this.node
attr (@this.node) type = "print"
edge @this.node -> @arg.node
}
(raise_statement (_) @arg) @this
{
node @this.node
attr (@this.node) type = "throw"
edge @this.node -> @arg.node
}
(block (_)* @children) @this
{
node @this.node
attr (@this.node) type = "block"
for child in @children {
edge @this.node -> child.node
}
}
(else_clause body: (_) @body) @this
{
let @this.node = @body.node
}
(if_statement (_)) @this {
node @this.node
attr (@this.node) type = "if"
}
(if_statement condition: (_) @cond consequence: (_) @then) @this {
edge @this.node -> @cond.node
attr (@this.node -> @cond.node) type = "condition"
edge @this.node -> @then.node
attr (@this.node -> @then.node) type = "consequence"
}
(if_statement alternative: (_) @else) @this
{
edge @this.node -> @else.node
attr (@this.node -> @else.node) type = "alternative"
}
(module (_) @child) @this
{
edge @this.node -> @child.node
}