@ssweens/pi-leash 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,186 @@
1
+ export type ShellDialect = "posix" | "bash" | "mksh" | "zsh";
2
+ export type ParseOptions = {
3
+ dialect?: ShellDialect;
4
+ /** If true, keep comments as nodes/tokens in the output (future). */
5
+ keepComments?: boolean;
6
+ };
7
+ export type Literal = {
8
+ type: "Literal";
9
+ value: string;
10
+ };
11
+ export type SglQuoted = {
12
+ type: "SglQuoted";
13
+ value: string;
14
+ };
15
+ export type DblQuoted = {
16
+ type: "DblQuoted";
17
+ parts: WordPart[];
18
+ };
19
+ export type ParamExp = {
20
+ type: "ParamExp";
21
+ short: boolean;
22
+ param: Literal;
23
+ op?: string;
24
+ value?: Word;
25
+ };
26
+ export type CmdSubst = {
27
+ type: "CmdSubst";
28
+ stmts: Statement[];
29
+ };
30
+ export type ArithExp = {
31
+ type: "ArithExp";
32
+ expr: string;
33
+ };
34
+ export type ProcSubst = {
35
+ type: "ProcSubst";
36
+ op: "<" | ">";
37
+ stmts: Statement[];
38
+ };
39
+ export type WordPart = Literal | SglQuoted | DblQuoted | ParamExp | CmdSubst | ArithExp | ProcSubst;
40
+ export type Word = {
41
+ type: "Word";
42
+ parts: WordPart[];
43
+ };
44
+ export type Assignment = {
45
+ type: "Assignment";
46
+ name: string;
47
+ append?: boolean;
48
+ value?: Word;
49
+ array?: ArrayExpr;
50
+ };
51
+ export type ArrayElem = {
52
+ type: "ArrayElem";
53
+ index?: Word;
54
+ value?: Word;
55
+ };
56
+ export type ArrayExpr = {
57
+ type: "ArrayExpr";
58
+ elems: ArrayElem[];
59
+ };
60
+ export type RedirOp = ">" | "<" | ">>" | ">|" | ">&" | "<&" | "<>" | "&>" | "&>>" | "<<<" | "<<" | "<<-";
61
+ export type Redirect = {
62
+ type: "Redirect";
63
+ op: RedirOp;
64
+ fd?: string;
65
+ target: Word;
66
+ heredoc?: Word;
67
+ };
68
+ export type SimpleCommand = {
69
+ type: "SimpleCommand";
70
+ words?: Word[];
71
+ assignments?: Assignment[];
72
+ redirects?: Redirect[];
73
+ };
74
+ export type Subshell = {
75
+ type: "Subshell";
76
+ body: Statement[];
77
+ };
78
+ export type Block = {
79
+ type: "Block";
80
+ body: Statement[];
81
+ };
82
+ export type IfClause = {
83
+ type: "IfClause";
84
+ cond: Statement[];
85
+ then: Statement[];
86
+ else?: Statement[];
87
+ };
88
+ export type WhileClause = {
89
+ type: "WhileClause";
90
+ cond: Statement[];
91
+ body: Statement[];
92
+ until?: boolean;
93
+ };
94
+ export type ForClause = {
95
+ type: "ForClause";
96
+ name: string;
97
+ items?: Word[];
98
+ body: Statement[];
99
+ };
100
+ export type SelectClause = {
101
+ type: "SelectClause";
102
+ name: string;
103
+ items?: Word[];
104
+ body: Statement[];
105
+ };
106
+ export type FunctionDecl = {
107
+ type: "FunctionDecl";
108
+ name: string;
109
+ body: Statement[];
110
+ };
111
+ export type CaseItem = {
112
+ type: "CaseItem";
113
+ patterns: Word[];
114
+ body: Statement[];
115
+ };
116
+ export type CaseClause = {
117
+ type: "CaseClause";
118
+ word: Word;
119
+ items: CaseItem[];
120
+ };
121
+ export type TimeClause = {
122
+ type: "TimeClause";
123
+ command: Statement;
124
+ };
125
+ export type TestClause = {
126
+ type: "TestClause";
127
+ expr: Word[];
128
+ };
129
+ export type ArithCmd = {
130
+ type: "ArithCmd";
131
+ expr: string;
132
+ };
133
+ export type CoprocClause = {
134
+ type: "CoprocClause";
135
+ name?: string;
136
+ body: Statement;
137
+ };
138
+ export type DeclClause = {
139
+ type: "DeclClause";
140
+ variant: "declare" | "local" | "export" | "readonly" | "typeset" | "nameref";
141
+ args?: Word[];
142
+ assigns?: Assignment[];
143
+ redirects?: Redirect[];
144
+ };
145
+ export type LetClause = {
146
+ type: "LetClause";
147
+ exprs: Word[];
148
+ redirects?: Redirect[];
149
+ };
150
+ export type CStyleLoop = {
151
+ type: "CStyleLoop";
152
+ init?: string;
153
+ cond?: string;
154
+ post?: string;
155
+ body: Statement[];
156
+ };
157
+ export type CommentNode = {
158
+ type: "Comment";
159
+ text: string;
160
+ };
161
+ export type Pipeline = {
162
+ type: "Pipeline";
163
+ commands: Statement[];
164
+ };
165
+ export type Logical = {
166
+ type: "Logical";
167
+ op: "and" | "or";
168
+ left: Statement;
169
+ right: Statement;
170
+ };
171
+ export type Command = SimpleCommand | Subshell | Block | IfClause | WhileClause | ForClause | SelectClause | FunctionDecl | CaseClause | TimeClause | TestClause | ArithCmd | CoprocClause | Pipeline | Logical | DeclClause | LetClause | CStyleLoop;
172
+ export type Statement = {
173
+ type: "Statement";
174
+ command: Command;
175
+ background?: boolean;
176
+ negated?: boolean;
177
+ };
178
+ export type Program = {
179
+ type: "Program";
180
+ body: Statement[];
181
+ comments?: CommentNode[];
182
+ };
183
+ export type ParseResult = {
184
+ ast: Program;
185
+ };
186
+ //# sourceMappingURL=ast.d.ts.map
@@ -0,0 +1,3 @@
1
+ export type { ArithCmd, ArithExp, ArrayElem, ArrayExpr, Assignment, Block, CaseClause, CaseItem, CmdSubst, Command, CommentNode, CoprocClause, CStyleLoop, DblQuoted, DeclClause, ForClause, FunctionDecl, IfClause, LetClause, Literal, Logical, ParamExp, ParseOptions, ParseResult, Pipeline, ProcSubst, Program, Redirect, RedirOp, SelectClause, SglQuoted, ShellDialect, SimpleCommand, Statement, Subshell, TestClause, TimeClause, WhileClause, Word, WordPart, } from "./ast";
2
+ export { parse } from "./parse";
3
+ //# sourceMappingURL=index.d.ts.map