main 98594d0

ast.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3package expr
4
5// Node is a node of a parsed expression. The concrete types are [*Literal],
6// [*Unary], [*FunctionCall], [*Binary], [*Logical], [*Grouping],
7// [*ContextAccess], [*IndexAccess] and [*Star].
8type Node interface {
9	isNode()
10}
11
12// Literal is a null, boolean, number or string constant.
13type Literal struct {
14	Value Value
15	Token Token
16}
17
18// Unary is a negation: "!x".
19type Unary struct {
20	Operator Token
21	Expr     Node
22}
23
24// FunctionCall is a call such as "contains(a, b)". Name is the identifier
25// token as written; function names are case-insensitive.
26type FunctionCall struct {
27	Name Token
28	Args []Node
29}
30
31// Binary is a comparison: ==, !=, <, <=, > or >=.
32type Binary struct {
33	Left     Node
34	Operator Token
35	Right    Node
36}
37
38// Logical is a chain of && or || operands. The chain is flat: "a || b || c"
39// is one Logical with three Args. Operator is the first operator token.
40type Logical struct {
41	Operator Token
42	Args     []Node
43}
44
45// Grouping is a parenthesized expression.
46type Grouping struct {
47	Group Node
48}
49
50// ContextAccess is the name of a context, such as "github".
51type ContextAccess struct {
52	Name Token
53}
54
55// IndexAccess is "expr[index]" or "expr.name" (Index is then a string
56// [Literal]) or "expr.*" (Index is a [Star]).
57type IndexAccess struct {
58	Expr  Node
59	Index Node
60}
61
62// Star is the "*" of "expr.*" and "expr[*]".
63type Star struct{}
64
65func (*Literal) isNode()       {}
66func (*Unary) isNode()         {}
67func (*FunctionCall) isNode()  {}
68func (*Binary) isNode()        {}
69func (*Logical) isNode()       {}
70func (*Grouping) isNode()      {}
71func (*ContextAccess) isNode() {}
72func (*IndexAccess) isNode()   {}
73func (*Star) isNode()          {}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 3

↑↓ moveenter openesc close