1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! `Checker` implementation for Tcl.
#![allow(clippy::wildcard_imports, clippy::enum_glob_use)]
use super::*;
impl Checker for TclCode {
// The one `Comment` row of `roles/tcl.rs`; no `DocComment` row (#1699).
impl_comment_from_rows!(tcl);
// The space tree is declared in `roles/tcl.rs` (#1696): the
// `FuncOpener` and `Container` rows are what the walk promotes and
// `opens_space` labels. The rows read no bytes and no chain, so the
// byte-less spelling forwards with none and answers the same.
impl_byte_less_func_space!(tcl);
fn is_func_space_with_code<'a>(
node: &Node<'a>,
code: &[u8],
ancestors: Ancestors<'a, '_>,
) -> bool {
crate::roles::tcl::opens_space(node, code, ancestors) != SpaceKind::Unknown
}
fn is_func<'a>(node: &Node<'a>, ancestors: Ancestors<'a, '_>) -> bool {
crate::roles::tcl::func_opener::is_callable(node, &[], ancestors)
}
// Tcl closures (`apply`) are ordinary commands; the grammar has no distinct closure node.
fn is_closure<'a>(_: &Node<'a>, _ancestors: Ancestors<'a, '_>) -> bool {
false
}
// `Call` and `StringLit` are the rows of `roles/tcl.rs` (#1698);
// the byte-less spellings are their kind tables, gates aside.
impl_row_predicates!(tcl, call, is_call, is_call_with_code);
impl_row_predicates!(tcl, string_lit, is_string, is_string_with_code);
// Tcl arguments are whitespace-separated; no punctuation to exclude.
fn is_non_arg(_: &Node) -> bool {
false
}
// The `ElseIf` row of `roles/tcl.rs`: the dedicated `elseif` node
// itself is the else-if, never a nested `if`. `Elseif2` is the
// `elseif` keyword token, not the clause, and the row leaves it out
// (#1697).
impl_else_if_from_row!(tcl);
}