{"modulePath":"github.com/hyperhq/hypercli","version":"v1.10.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package parser\n\nPackage parser implements a parser and parse tree dumper for Dockerfiles.\n\n## Types\n\n```go\ntype Node struct {\n\tValue      string          // actual content\n\tNext       *Node           // the next item in the current sexp\n\tChildren   []*Node         // the children of this sexp\n\tAttributes map[string]bool // special attributes for this node\n\tOriginal   string          // original line used before parsing\n\tFlags      []string        // only top Node should have this set\n\tStartLine  int             // the line in the original dockerfile where the node begins\n\tEndLine    int             // the line in the original dockerfile where the node ends\n}\n```\nNode is a structure used to represent a parse tree.\n\nIn the node there are three fields, Value, Next, and Children. Value is the current token's string value. Next is always the next non-child token, and children contains all the children. Here's an example:\n\n(value next (child child-next child-next-next) next-next)\n\nThis data structure is frankly pretty lousy for handling complex languages, but lucky for us the Dockerfile isn't very complicated. This structure works a little more effectively than a \"proper\" parse tree for our needs.\n\n```go\nfunc Parse(rwc io.Reader) (*Node, error)\n```\nParse is the main parse routine. It handles an io.ReadWriteCloser and returns the root of the AST.\n\n```go\nfunc (node *Node) Dump() string\n```\nDump dumps the AST defined by \\`node\\` as a list of sexps. Returns a string suitable for printing.\n\n","path":"github.com/hyperhq/hypercli/builder/dockerfile/parser","name":"parser","synopsis":"Package parser implements a parser and parse tree dumper for Dockerfiles.","isRedistributable":true}
