# Packages
Package typedjson allows encoding and decoding shell syntax trees as JSON.
# Functions
BinaryNextLine will make binary operators appear on the next line when a binary command, such as a pipe, spans multiple lines.
DebugPrint prints the provided syntax tree, spanning multiple lines and with indentation.
FunctionNextLine will place a function's opening braces on the next line.
Indent sets the number of spaces used for indentation.
IsIncomplete reports whether a Parser error could have been avoided with extra input bytes.
IsKeyword returns true if the given word is part of the language keywords.
KeepComments makes the parser parse comments and attach them to nodes, as opposed to discarding them.
KeepPadding will keep most nodes and tokens in the same column that they were in the original source.
Minify will print programs in a way to save the most bytes possible.
NewParser allocates a new Parser and applies any number of options.
NewPos creates a position with the given offset, line, and column.
NewPrinter allocates a new Printer and applies any number of options.
Quote returns a quoted version of the input string, so that the quoted version is expanded or interpreted as the original string in the given language variant.
Simplify modifies a node to remove redundant pieces of syntax, and returns whether any changes were made.
SingleLine will attempt to print programs in one line.
SpaceRedirects will put a space after most redirection operators.
SplitBraces parses brace expansions within a word's literal parts.
StopAt configures the lexer to stop at an arbitrary word, treating it as if it were the end of the input.
SwitchCaseIndent will make switch cases be indented.
ValidName returns whether val is a valid name as per the POSIX spec.
Variant changes the shell language variant that the parser will accept.
Walk traverses a syntax tree in depth-first order: It starts by calling f(node); node must not be nil.
# Constants
+.
+=.
+.
:+.
&.
&&.
&=.
&&.
&&.
&>>.
>>.
=.
=.
:=.
~.
;;.
>|.
<(.
>(.
,.
<<-.
--.
-.
:-.
<&.
>&.
==.
?.
:?.
;&.
>=.
!(.
@(.
+(.
*(.
?(.
>.
<<.
++.
LangAuto corresponds to automatic language detection, commonly used by end-user applications like shfmt, which can guess a file's language variant given its filename or shebang.
LangBash corresponds to the GNU Bash language, as described in its manual at https://www.gnu.org/software/bash/manual/bash.html.
LangBats corresponds to the Bash Automated Testing System language, as described at https://github.com/bats-core/bats-core.
LangMirBSDKorn corresponds to the MirBSD Korn Shell, also known as mksh, as described at http://www.mirbsd.org/htman/i386/man1/mksh.htm.
LangPOSIX corresponds to the POSIX Shell language, as described at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html.
<=.
,,.
,.
<.
-.
*.
*=.
*.
@.
!=.
!.
|.
||.
|=.
||.
||.
@.
|.
|&.
+.
**.
/.
/=.
&>.
<.
<>.
>.
%.
%=.
##.
%%.
#.
%.
;;&.
;|.
<<.
<<=.
>>.
>>=.
-.
-=.
:.
?.
>.
<.
-b.
-c.
-ef.
-d.
-z.
-eq.
-x.
-e.
-t.
-ge.
-g.
-G.
-gt.
-le.
-lt.
==.
=.
-N.
-n.
-ne.
-nt.
-p.
-s.
!=.
!.
-ot.
-o.
(.
-r.
-R.
-f.
=~.
-L.
-S.
-k.
-u.
-O.
-v.
-w.
^^.
^.
<<<.
^.
^=.
# Structs
ArithmCmd represents an arithmetic command.
ArithmExp represents an arithmetic expansion.
ArrayElem represents a Bash array element.
ArrayExpr represents a Bash array expression.
Assign represents an assignment to a variable.
BinaryArithm represents a binary arithmetic expression.
BinaryCmd represents a binary expression between two statements.
BinaryTest represents a binary test expression.
Block represents a series of commands that should be executed in a nested scope.
BraceExp represents a Bash brace expression, such as "{a,f}" or "{1..10}".
CallExpr represents a command execution or function call, otherwise known as a "simple command".
CaseClause represents a case (switch) clause.
CaseItem represents a pattern list (case) within a CaseClause.
CmdSubst represents a command substitution.
Comment represents a single comment on a single line.
CoprocClause represents a Bash coproc clause.
CStyleLoop represents the behavior of a for clause similar to the C language.
DblQuoted represents a list of nodes within double quotes.
DeclClause represents a Bash declare clause.
Expansion represents string manipulation in a ParamExp other than those covered by Replace.
ExtGlob represents a Bash extended globbing expression.
File represents a shell source file.
ForClause represents a for or a select clause.
FuncDecl represents the declaration of a function.
IfClause represents an if statement.
LangError is returned when the parser encounters code that is only valid in other shell language variants.
LetClause represents a Bash let clause.
Lit represents a string literal.
ParamExp represents a parameter expansion.
ParenArithm represents an arithmetic expression within parentheses.
ParenTest represents a test expression within parentheses.
ParseError represents an error found when parsing a source file, from which the parser cannot recover.
Parser holds the internal state of the parsing mechanism of a program.
Pos is a position within a shell source file.
Printer holds the internal state of the printing mechanism of a program.
ProcSubst represents a Bash process substitution.
No description provided by the author
Redirect represents an input/output redirection.
Replace represents a search and replace expression inside a ParamExp.
SglQuoted represents a string within single quotes.
Slice represents a character slicing expression inside a ParamExp.
Stmt represents a statement, also known as a "complete command".
Subshell represents a series of commands that should be executed in a nested shell environment.
TestClause represents a Bash extended test clause.
TestDecl represents the declaration of a Bats test function.
TimeClause represents a Bash time clause.
UnaryArithm represents an unary arithmetic expression.
UnaryTest represents a unary test expression.
WhileClause represents a while or an until clause.
Word represents a shell word, containing one or more word parts contiguous to each other.
WordIter represents the iteration of a variable over a series of words in a for clause.
# Interfaces
ArithmExpr represents all nodes that form arithmetic expressions.
Command represents all nodes that are simple or compound commands, including function declarations.
Loop holds either *WordIter or *CStyleLoop.
Node represents a syntax tree node.
TestExpr represents all nodes that form test expressions.
WordPart represents all nodes that can form part of a word.
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
LangVariant describes a shell language variant to use when tokenizing and parsing shell code.
No description provided by the author
No description provided by the author
ParserOption is a function which can be passed to NewParser to alter its behavior.
PrinterOption is a function which can be passed to NewPrinter to alter its behavior.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author