#include class Obj { public: // Decode a 3 byte integer from little endian inline int Int(int n) const; inline const Obj& Ref(const uint32_t* base, int n) const; inline const Obj* Optional(const uint32_t* base, int n) const; // NUL-terminated inline const char* Str(const uint32_t* base, int n) const; protected: uint8_t bytes_[1]; // first is ID; rest are a payload }; class line_span_t; class token_t; class bracket_op_t; class suffix_op_t; class array_item_t; class word_part_t; class word_t; class lvalue_t; class arith_expr_t; class bool_expr_t; class redir_t; class assign_pair_t; class env_pair_t; class command_t; class line_span_t : public Obj { public: inline int pool_index() const { return Int(0); } inline int col() const { return Int(3); } inline int length() const { return Int(6); } }; class token_t : public Obj { public: inline Id id() const { return static_cast(Int(0)); } inline const char* val(const uint32_t* base) const { return Str(base, 3); } inline const line_span_t* loc(const uint32_t* base) const; }; enum class bracket_op_e : uint8_t { WholeArray = 1, ArrayIndex = 2 }; class bracket_op_t : public Obj { public: bracket_op_e tag() const { return static_cast(bytes_[0]); } }; class WholeArray : public bracket_op_t { public: inline Id op_id() const { return static_cast(Int(1)); } }; class ArrayIndex : public bracket_op_t { public: inline const arith_expr_t& expr(const uint32_t* base) const; }; enum class suffix_op_e : uint8_t { StringUnary = 1, PatSub = 2, Slice = 3 }; class suffix_op_t : public Obj { public: suffix_op_e tag() const { return static_cast(bytes_[0]); } }; class StringUnary : public suffix_op_t { public: inline Id op_id() const { return static_cast(Int(1)); } inline const word_t& arg_word(const uint32_t* base) const; }; class PatSub : public suffix_op_t { public: inline const word_t& pat(const uint32_t* base) const; inline const word_t* replace(const uint32_t* base) const; inline bool do_all() const { return Int(7); } inline bool do_prefix() const { return Int(10); } inline bool do_suffix() const { return Int(13); } }; class Slice : public suffix_op_t { public: inline const arith_expr_t* begin(const uint32_t* base) const; inline const arith_expr_t* length(const uint32_t* base) const; }; enum class array_item_e : uint8_t { ArrayWord = 1, ArrayPair = 2 }; class array_item_t : public Obj { public: array_item_e tag() const { return static_cast(bytes_[0]); } }; class ArrayWord : public array_item_t { public: inline const word_t& w(const uint32_t* base) const; }; class ArrayPair : public array_item_t { public: inline const word_t& key(const uint32_t* base) const; inline const word_t& value(const uint32_t* base) const; }; enum class word_part_e : uint8_t { ArrayLiteralPart = 1, LiteralPart = 2, EscapedLiteralPart = 3, SingleQuotedPart = 4, DoubleQuotedPart = 5, VarSubPart = 6, TildeSubPart = 7, CommandSubPart = 8, ArithSubPart = 9 }; class word_part_t : public Obj { public: word_part_e tag() const { return static_cast(bytes_[0]); } }; class ArrayLiteralPart : public word_part_t { public: inline int words_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const word_t& words(const uint32_t* base, int index) const; }; class LiteralPart : public word_part_t { public: inline const token_t& token(const uint32_t* base) const; }; class EscapedLiteralPart : public word_part_t { public: inline const token_t& token(const uint32_t* base) const; }; class SingleQuotedPart : public word_part_t { public: inline int tokens_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const token_t& tokens(const uint32_t* base, int index) const; }; class DoubleQuotedPart : public word_part_t { public: inline int parts_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const word_part_t& parts(const uint32_t* base, int index) const; }; class VarSubPart : public word_part_t { public: inline const char* name(const uint32_t* base) const { return Str(base, 1); } inline Id prefix_op() const { return static_cast(Int(4)); } inline const bracket_op_t* bracket_op(const uint32_t* base) const; inline const suffix_op_t* suffix_op(const uint32_t* base) const; }; class TildeSubPart : public word_part_t { public: inline const char* prefix(const uint32_t* base) const { return Str(base, 1); } }; class CommandSubPart : public word_part_t { public: inline const command_t& command_list(const uint32_t* base) const; }; class ArithSubPart : public word_part_t { public: inline const arith_expr_t& anode(const uint32_t* base) const; }; enum class word_e : uint8_t { TokenWord = 1, CompoundWord = 2 }; class word_t : public Obj { public: word_e tag() const { return static_cast(bytes_[0]); } }; class TokenWord : public word_t { public: inline const token_t& token(const uint32_t* base) const; }; class CompoundWord : public word_t { public: inline int parts_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const word_part_t& parts(const uint32_t* base, int index) const; }; enum class lvalue_e : uint8_t { LeftVar = 1, LeftIndex = 2 }; class lvalue_t : public Obj { public: lvalue_e tag() const { return static_cast(bytes_[0]); } }; class LeftVar : public lvalue_t { public: inline const char* name(const uint32_t* base) const { return Str(base, 1); } }; class LeftIndex : public lvalue_t { public: inline const arith_expr_t& obj(const uint32_t* base) const; inline const arith_expr_t& index(const uint32_t* base) const; }; enum class arith_expr_e : uint8_t { RightVar = 1, ArithWord = 2, ArithUnary = 3, ArithBinary = 4, ArithAssign = 5, TernaryOp = 6, FuncCall = 7 }; class arith_expr_t : public Obj { public: arith_expr_e tag() const { return static_cast(bytes_[0]); } }; class RightVar : public arith_expr_t { public: inline const char* name(const uint32_t* base) const { return Str(base, 1); } }; class ArithWord : public arith_expr_t { public: inline const word_t& w(const uint32_t* base) const; }; class ArithUnary : public arith_expr_t { public: inline Id op_id() const { return static_cast(Int(1)); } inline const arith_expr_t& child(const uint32_t* base) const; }; class ArithBinary : public arith_expr_t { public: inline Id op_id() const { return static_cast(Int(1)); } inline const arith_expr_t& left(const uint32_t* base) const; inline const arith_expr_t& right(const uint32_t* base) const; }; class ArithAssign : public arith_expr_t { public: inline Id op_id() const { return static_cast(Int(1)); } inline const lvalue_t& left(const uint32_t* base) const; inline const arith_expr_t& right(const uint32_t* base) const; }; class TernaryOp : public arith_expr_t { public: inline const arith_expr_t& cond(const uint32_t* base) const; inline const arith_expr_t& true_expr(const uint32_t* base) const; inline const arith_expr_t& false_expr(const uint32_t* base) const; }; class FuncCall : public arith_expr_t { public: inline const arith_expr_t& func(const uint32_t* base) const; inline int args_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const arith_expr_t& args(const uint32_t* base, int index) const; }; enum class bool_expr_e : uint8_t { WordTest = 1, BoolBinary = 2, BoolUnary = 3, LogicalNot = 4, LogicalAnd = 5, LogicalOr = 6 }; class bool_expr_t : public Obj { public: bool_expr_e tag() const { return static_cast(bytes_[0]); } }; class WordTest : public bool_expr_t { public: inline const word_t& w(const uint32_t* base) const; }; class BoolBinary : public bool_expr_t { public: inline Id op_id() const { return static_cast(Int(1)); } inline const word_t& left(const uint32_t* base) const; inline const word_t& right(const uint32_t* base) const; }; class BoolUnary : public bool_expr_t { public: inline Id op_id() const { return static_cast(Int(1)); } inline const word_t& child(const uint32_t* base) const; }; class LogicalNot : public bool_expr_t { public: inline const bool_expr_t& child(const uint32_t* base) const; }; class LogicalAnd : public bool_expr_t { public: inline const bool_expr_t& left(const uint32_t* base) const; inline const bool_expr_t& right(const uint32_t* base) const; }; class LogicalOr : public bool_expr_t { public: inline const bool_expr_t& left(const uint32_t* base) const; inline const bool_expr_t& right(const uint32_t* base) const; }; enum class redir_e : uint8_t { Redirect = 1, HereDoc = 2 }; class redir_t : public Obj { public: redir_e tag() const { return static_cast(bytes_[0]); } }; class Redirect : public redir_t { public: inline Id op_id() const { return static_cast(Int(1)); } inline const word_t& arg_word(const uint32_t* base) const; inline int fd() const { return Int(7); } }; class HereDoc : public redir_t { public: inline Id op_id() const { return static_cast(Int(1)); } inline const word_t* arg_word(const uint32_t* base) const; inline int fd() const { return Int(7); } inline int do_expansion() const { return Int(10); } inline const char* here_end(const uint32_t* base) const { return Str(base, 13); } inline bool was_filled() const { return Int(16); } }; enum class assign_scope_e : uint8_t { Global = 1, Local = 2 }; enum class assign_flags_e : uint8_t { Export = 1, ReadOnly = 2 }; class assign_pair_t : public Obj { public: inline const lvalue_t& lhs(const uint32_t* base) const; inline const word_t& rhs(const uint32_t* base) const; }; class env_pair_t : public Obj { public: inline const char* name(const uint32_t* base) const { return Str(base, 0); } inline const word_t& val(const uint32_t* base) const; }; enum class command_e : uint8_t { NoOp = 1, SimpleCommand = 2, Assignment = 3, Fork = 4, Pipeline = 5, AndOr = 6, CommandList = 7, BraceGroup = 8, Subshell = 9, DParen = 10, DBracket = 11, ForEach = 12, ForExpr = 13, While = 14, Until = 15, If = 16, Case = 17, FuncDef = 18 }; class command_t : public Obj { public: command_e tag() const { return static_cast(bytes_[0]); } }; class SimpleCommand : public command_t { public: inline int words_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const word_t& words(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; inline int more_env_size(const uint32_t* base) const { return Ref(base, 7).Int(0); } inline const env_pair_t& more_env(const uint32_t* base, int index) const; }; class Assignment : public command_t { public: inline assign_scope_e scope() const { return static_cast(Int(1)); } inline int flags_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const assign_flags_e flags(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Int(a)); } inline int words_size(const uint32_t* base) const { return Ref(base, 7).Int(0); } inline const word_t& words(const uint32_t* base, int index) const; inline int pairs_size(const uint32_t* base) const { return Ref(base, 10).Int(0); } inline const assign_pair_t& pairs(const uint32_t* base, int index) const; }; class Fork : public command_t { public: inline int children_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; }; class Pipeline : public command_t { public: inline int children_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline bool negated() const { return Int(4); } inline int stderr_indices_size(const uint32_t* base) const { return Ref(base, 7).Int(0); } inline const int stderr_indices(const uint32_t* base, int index) const { int a = (index+1) * 3; return Ref(base, 7).Int(a); } }; class AndOr : public command_t { public: inline int children_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline Id op_id() const { return static_cast(Int(4)); } }; class CommandList : public command_t { public: inline int children_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; }; class BraceGroup : public command_t { public: inline int children_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class Subshell : public command_t { public: inline int children_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class DParen : public command_t { public: inline const arith_expr_t& child(const uint32_t* base) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class DBracket : public command_t { public: inline const bool_expr_t& expr(const uint32_t* base) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class ForEach : public command_t { public: inline const char* iter_name(const uint32_t* base) const { return Str(base, 1); } inline int iter_words_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const word_t& iter_words(const uint32_t* base, int index) const; inline bool do_arg_iter() const { return Int(7); } inline int children_size(const uint32_t* base) const { return Ref(base, 10).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 13).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class ForExpr : public command_t { public: inline const arith_expr_t* init(const uint32_t* base) const; inline const arith_expr_t* cond(const uint32_t* base) const; inline const arith_expr_t* update(const uint32_t* base) const; inline int children_size(const uint32_t* base) const { return Ref(base, 10).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 13).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class While : public command_t { public: inline int children_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class Until : public command_t { public: inline int children_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class If : public command_t { public: inline int children_size(const uint32_t* base) const { return Ref(base, 1).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class Case : public command_t { public: inline const word_t& to_match(const uint32_t* base) const; inline int pat_word_list_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const word_t& pat_word_list(const uint32_t* base, int index) const; inline int children_size(const uint32_t* base) const { return Ref(base, 7).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 10).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; class FuncDef : public command_t { public: inline const char* name(const uint32_t* base) const { return Str(base, 1); } inline int children_size(const uint32_t* base) const { return Ref(base, 4).Int(0); } inline const command_t& children(const uint32_t* base, int index) const; inline int redirects_size(const uint32_t* base) const { return Ref(base, 7).Int(0); } inline const redir_t& redirects(const uint32_t* base, int index) const; }; enum class and_or_e : uint8_t { DAmp = 1, DPipe = 2 }; inline const line_span_t* token_t::loc(const uint32_t* base) const { return static_cast(Optional(base, 6)); } inline const arith_expr_t& ArrayIndex::expr(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const word_t& StringUnary::arg_word(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const word_t& PatSub::pat(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const word_t* PatSub::replace(const uint32_t* base) const { return static_cast(Optional(base, 4)); } inline const arith_expr_t* Slice::begin(const uint32_t* base) const { return static_cast(Optional(base, 1)); } inline const arith_expr_t* Slice::length(const uint32_t* base) const { return static_cast(Optional(base, 4)); } inline const word_t& ArrayWord::w(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const word_t& ArrayPair::key(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const word_t& ArrayPair::value(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const word_t& ArrayLiteralPart::words(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const token_t& LiteralPart::token(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const token_t& EscapedLiteralPart::token(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const token_t& SingleQuotedPart::tokens(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const word_part_t& DoubleQuotedPart::parts(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const bracket_op_t* VarSubPart::bracket_op(const uint32_t* base) const { return static_cast(Optional(base, 7)); } inline const suffix_op_t* VarSubPart::suffix_op(const uint32_t* base) const { return static_cast(Optional(base, 10)); } inline const command_t& CommandSubPart::command_list(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const arith_expr_t& ArithSubPart::anode(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const token_t& TokenWord::token(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const word_part_t& CompoundWord::parts(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const arith_expr_t& LeftIndex::obj(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const arith_expr_t& LeftIndex::index(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const word_t& ArithWord::w(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const arith_expr_t& ArithUnary::child(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const arith_expr_t& ArithBinary::left(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const arith_expr_t& ArithBinary::right(const uint32_t* base) const { return static_cast(Ref(base, 7)); } inline const lvalue_t& ArithAssign::left(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const arith_expr_t& ArithAssign::right(const uint32_t* base) const { return static_cast(Ref(base, 7)); } inline const arith_expr_t& TernaryOp::cond(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const arith_expr_t& TernaryOp::true_expr(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const arith_expr_t& TernaryOp::false_expr(const uint32_t* base) const { return static_cast(Ref(base, 7)); } inline const arith_expr_t& FuncCall::func(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const arith_expr_t& FuncCall::args(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const word_t& WordTest::w(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const word_t& BoolBinary::left(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const word_t& BoolBinary::right(const uint32_t* base) const { return static_cast(Ref(base, 7)); } inline const word_t& BoolUnary::child(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const bool_expr_t& LogicalNot::child(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const bool_expr_t& LogicalAnd::left(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const bool_expr_t& LogicalAnd::right(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const bool_expr_t& LogicalOr::left(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const bool_expr_t& LogicalOr::right(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const word_t& Redirect::arg_word(const uint32_t* base) const { return static_cast(Ref(base, 4)); } inline const word_t* HereDoc::arg_word(const uint32_t* base) const { return static_cast(Optional(base, 4)); } inline const lvalue_t& assign_pair_t::lhs(const uint32_t* base) const { return static_cast(Ref(base, 0)); } inline const word_t& assign_pair_t::rhs(const uint32_t* base) const { return static_cast(Ref(base, 3)); } inline const word_t& env_pair_t::val(const uint32_t* base) const { return static_cast(Ref(base, 3)); } inline const word_t& SimpleCommand::words(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const redir_t& SimpleCommand::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const env_pair_t& SimpleCommand::more_env(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 7).Ref(base, a)); } inline const word_t& Assignment::words(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 7).Ref(base, a)); } inline const assign_pair_t& Assignment::pairs(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 10).Ref(base, a)); } inline const command_t& Fork::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const command_t& Pipeline::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const command_t& AndOr::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const command_t& CommandList::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const command_t& BraceGroup::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const redir_t& BraceGroup::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const command_t& Subshell::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const redir_t& Subshell::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const arith_expr_t& DParen::child(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const redir_t& DParen::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const bool_expr_t& DBracket::expr(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const redir_t& DBracket::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const word_t& ForEach::iter_words(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const command_t& ForEach::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 10).Ref(base, a)); } inline const redir_t& ForEach::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 13).Ref(base, a)); } inline const arith_expr_t* ForExpr::init(const uint32_t* base) const { return static_cast(Optional(base, 1)); } inline const arith_expr_t* ForExpr::cond(const uint32_t* base) const { return static_cast(Optional(base, 4)); } inline const arith_expr_t* ForExpr::update(const uint32_t* base) const { return static_cast(Optional(base, 7)); } inline const command_t& ForExpr::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 10).Ref(base, a)); } inline const redir_t& ForExpr::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 13).Ref(base, a)); } inline const command_t& While::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const redir_t& While::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const command_t& Until::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const redir_t& Until::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const command_t& If::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 1).Ref(base, a)); } inline const redir_t& If::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const word_t& Case::to_match(const uint32_t* base) const { return static_cast(Ref(base, 1)); } inline const word_t& Case::pat_word_list(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const command_t& Case::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 7).Ref(base, a)); } inline const redir_t& Case::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 10).Ref(base, a)); } inline const command_t& FuncDef::children(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 4).Ref(base, a)); } inline const redir_t& FuncDef::redirects(const uint32_t* base, int index) const { int a = (index+1) * 3; return static_cast(Ref(base, 7).Ref(base, a)); } inline int Obj::Int(int n) const { return bytes_[n] + (bytes_[n+1] << 8) + (bytes_[n+2] << 16); } inline const Obj& Obj::Ref(const uint32_t* base, int n) const { int offset = Int(n); return reinterpret_cast(base[offset]); } inline const Obj* Obj::Optional(const uint32_t* base, int n) const { int offset = Int(n); if (offset) { return reinterpret_cast(base + offset); } else { return nullptr; } } inline const char* Obj::Str(const uint32_t* base, int n) const { int offset = Int(n); return reinterpret_cast(base + offset); }