亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
archive archive/tar archive/zip bufio bufio(緩存) builtin builtin(內(nèi)置包) bytes bytes(包字節(jié)) compress compress/bzip2(壓縮/bzip2) compress/flate(壓縮/flate) compress/gzip(壓縮/gzip) compress/lzw(壓縮/lzw) compress/zlib(壓縮/zlib) container container/heap(容器數(shù)據(jù)結(jié)構(gòu)heap) container/list(容器數(shù)據(jù)結(jié)構(gòu)list) container/ring(容器數(shù)據(jù)結(jié)構(gòu)ring) context context(上下文) crypto crypto(加密) crypto/aes(加密/aes) crypto/cipher(加密/cipher) crypto/des(加密/des) crypto/dsa(加密/dsa) crypto/ecdsa(加密/ecdsa) crypto/elliptic(加密/elliptic) crypto/hmac(加密/hmac) crypto/md5(加密/md5) crypto/rand(加密/rand) crypto/rc4(加密/rc4) crypto/rsa(加密/rsa) crypto/sha1(加密/sha1) crypto/sha256(加密/sha256) crypto/sha512(加密/sha512) crypto/subtle(加密/subtle) crypto/tls(加密/tls) crypto/x509(加密/x509) crypto/x509/pkix(加密/x509/pkix) database database/sql(數(shù)據(jù)庫/sql) database/sql/driver(數(shù)據(jù)庫/sql/driver) debug debug/dwarf(調(diào)試/dwarf) debug/elf(調(diào)試/elf) debug/gosym(調(diào)試/gosym) debug/macho(調(diào)試/macho) debug/pe(調(diào)試/pe) debug/plan9obj(調(diào)試/plan9obj) encoding encoding(編碼) encoding/ascii85(編碼/ascii85) encoding/asn1(編碼/asn1) encoding/base32(編碼/base32) encoding/base64(編碼/base64) encoding/binary(編碼/binary) encoding/csv(編碼/csv) encoding/gob(編碼/gob) encoding/hex(編碼/hex) encoding/json(編碼/json) encoding/pem(編碼/pem) encoding/xml(編碼/xml) errors errors(錯(cuò)誤) expvar expvar flag flag(命令行參數(shù)解析flag包) fmt fmt go go/ast(抽象語法樹) go/build go/constant(常量) go/doc(文檔) go/format(格式) go/importer go/parser go/printer go/scanner(掃描儀) go/token(令牌) go/types(類型) hash hash(散列) hash/adler32 hash/crc32 hash/crc64 hash/fnv html html html/template(模板) image image(圖像) image/color(顏色) image/color/palette(調(diào)色板) image/draw(繪圖) image/gif image/jpeg image/png index index/suffixarray io io io/ioutil log log log/syslog(日志系統(tǒng)) math math math/big math/big math/bits math/bits math/cmplx math/cmplx math/rand math/rand mime mime mime/multipart(多部分) mime/quotedprintable net net net/http net/http net/http/cgi net/http/cookiejar net/http/fcgi net/http/httptest net/http/httptrace net/http/httputil net/http/internal net/http/pprof net/mail net/mail net/rpc net/rpc net/rpc/jsonrpc net/smtp net/smtp net/textproto net/textproto net/url net/url os os os/exec os/signal os/user path path path/filepath(文件路徑) plugin plugin(插件) reflect reflect(反射) regexp regexp(正則表達(dá)式) regexp/syntax runtime runtime(運(yùn)行時(shí)) runtime/debug(調(diào)試) runtime/internal/sys runtime/pprof runtime/race(競(jìng)爭(zhēng)) runtime/trace(執(zhí)行追蹤器) sort sort(排序算法) strconv strconv(轉(zhuǎn)換) strings strings(字符串) sync sync(同步) sync/atomic(原子操作) syscall syscall(系統(tǒng)調(diào)用) testing testing(測(cè)試) testing/iotest testing/quick text text/scanner(掃描文本) text/tabwriter text/template(定義模板) text/template/parse time time(時(shí)間戳) unicode unicode unicode/utf16 unicode/utf8 unsafe unsafe
characters

  • import "text/template/parse"

  • 概觀

  • 索引

概觀

解析構(gòu)包建為 text / template和html / template 定義的模板分析樹??蛻魬?yīng)該使用這些軟件包來構(gòu)建模板,而不是這個(gè)軟件包,它提供了不用于一般用途的共享內(nèi)部數(shù)據(jù)結(jié)構(gòu)。

索引

  • func IsEmptyTree(n Node) bool

  • func Parse(name, text, leftDelim, rightDelim string, funcs ...map[string]interface{}) (map[string]*Tree, error)

  • type ActionNode

  • func (a *ActionNode) Copy() Node

  • func (a *ActionNode) String() string

  • type BoolNode

  • func (b *BoolNode) Copy() Node

  • func (b *BoolNode) String() string

  • type BranchNode

  • func (b *BranchNode) Copy() Node

  • func (b *BranchNode) String() string

  • type ChainNode

  • func (c *ChainNode) Add(field string)

  • func (c *ChainNode) Copy() Node

  • func (c *ChainNode) String() string

  • type CommandNode

  • func (c *CommandNode) Copy() Node

  • func (c *CommandNode) String() string

  • type DotNode

  • func (d *DotNode) Copy() Node

  • func (d *DotNode) String() string

  • func (d *DotNode) Type() NodeType

  • type FieldNode

  • func (f *FieldNode) Copy() Node

  • func (f *FieldNode) String() string

  • type IdentifierNode

  • func NewIdentifier(ident string) *IdentifierNode

  • func (i *IdentifierNode) Copy() Node

  • func (i *IdentifierNode) SetPos(pos Pos) *IdentifierNode

  • func (i *IdentifierNode) SetTree(t *Tree) *IdentifierNode

  • func (i *IdentifierNode) String() string

  • type IfNode

  • func (i *IfNode) Copy() Node

  • type ListNode

  • func (l *ListNode) Copy() Node

  • func (l *ListNode) CopyList() *ListNode

  • func (l *ListNode) String() string

  • type NilNode

  • func (n *NilNode) Copy() Node

  • func (n *NilNode) String() string

  • func (n *NilNode) Type() NodeType

  • type Node

  • type NodeType

  • func (t NodeType) Type() NodeType

  • type NumberNode

  • func (n *NumberNode) Copy() Node

  • func (n *NumberNode) String() string

  • type PipeNode

  • func (p *PipeNode) Copy() Node

  • func (p *PipeNode) CopyPipe() *PipeNode

  • func (p *PipeNode) String() string

  • type Pos

  • func (p Pos) Position() Pos

  • type RangeNode

  • func (r *RangeNode) Copy() Node

  • type StringNode

  • func (s *StringNode) Copy() Node

  • func (s *StringNode) String() string

  • type TemplateNode

  • func (t *TemplateNode) Copy() Node

  • func (t *TemplateNode) String() string

  • type TextNode

  • func (t *TextNode) Copy() Node

  • func (t *TextNode) String() string

  • type Tree

  • func New(name string, funcs ...map[string]interface{}) *Tree

  • func (t *Tree) Copy() *Tree

  • func (t *Tree) ErrorContext(n Node) (location, context string)

  • func (t *Tree) Parse(text, leftDelim, rightDelim string, treeSet map[string]*Tree, funcs ...map[string]interface{}) (tree *Tree, err error)

  • type VariableNode

  • func (v *VariableNode) Copy() Node

  • func (v *VariableNode) String() string

  • type WithNode

  • func (w *WithNode) Copy() Node

文件包

lex.go node.go parse.go

func IsEmptyTree

func IsEmptyTree(n Node) bool

IsEmptyTree 報(bào)告此樹(節(jié)點(diǎn))是否為空而不是空間。

func Parse

func Parse(name, text, leftDelim, rightDelim string, funcs ...map[string]interface{}) (map[string]*Tree, error)

Parse 從模板名稱返回映射到 parse.Tree,通過解析參數(shù)字符串中描述的模板創(chuàng)建。頂層模板將被賦予指定的名稱。如果遇到錯(cuò)誤,解析將停止并返回一個(gè)空映射并顯示錯(cuò)誤。

鍵入ActionNode

ActionNode 包含一個(gè)動(dòng)作(由分隔符限定)。控制動(dòng)作有自己的節(jié)點(diǎn);ActionNode 表示簡(jiǎn)單的例如字段評(píng)估和圓括號(hào)的管道。

type ActionNode struct {
        NodeType
        Pos

        Line int       // The line number in the input. Deprecated: Kept for compatibility.
        Pipe *PipeNode // The pipeline in the action.        // contains filtered or unexported fields}

func (*ActionNode) Copy

func (a *ActionNode) Copy() Node

func (*ActionNode) String

func (a *ActionNode) String() string

鍵入BoolNode

BoolNode 保存一個(gè)布爾常量。

type BoolNode struct {
        NodeType
        Pos

        True bool // The value of the boolean constant.        // contains filtered or unexported fields}

func (*BoolNode) Copy

func (b *BoolNode) Copy() Node

func (*BoolNode) String

func (b *BoolNode) String() string

鍵入BranchNode

BranchNode 是 if,range 和 with 的常見表示。

type BranchNode struct {
        NodeType
        Pos

        Line     int       // The line number in the input. Deprecated: Kept for compatibility.
        Pipe     *PipeNode // The pipeline to be evaluated.
        List     *ListNode // What to execute if the value is non-empty.
        ElseList *ListNode // What to execute if the value is empty (nil if absent).        // contains filtered or unexported fields}

func (*BranchNode) Copy

func (b *BranchNode) Copy() Node

func (*BranchNode) String

func (b *BranchNode) String() string

type ChainNode

ChainNode 包含一個(gè)術(shù)語,后跟一串字段訪問(標(biāo)識(shí)符以'。'開頭)。這些名字可能被鏈接('.x.y')。期間從每個(gè)身份證中刪除。

type ChainNode struct {
        NodeType
        Pos

        Node  Node
        Field []string // The identifiers in lexical order.        // contains filtered or unexported fields}

func (*ChainNode) Add

func (c *ChainNode) Add(field string)

添加將指定的字段(應(yīng)以句點(diǎn)開頭)添加到鏈的末尾。

func (*ChainNode) Copy

func (c *ChainNode) Copy() Node

func (*ChainNode) String

func (c *ChainNode) String() string

鍵入CommandNode

CommandNode 包含一個(gè)命令(一個(gè)評(píng)估操作中的管道)。

type CommandNode struct {
        NodeType
        Pos

        Args []Node // Arguments in lexical order: Identifier, field, or constant.        // contains filtered or unexported fields}

func (*CommandNode) Copy

func (c *CommandNode) Copy() Node

func (*CommandNode) String

func (c *CommandNode) String() string

type DotNode

DotNode 包含特殊標(biāo)識(shí)符'。'。

type DotNode struct {
        NodeType
        Pos        // contains filtered or unexported fields}

func (*DotNode) Copy

func (d *DotNode) Copy() Node

func (*DotNode) String

func (d *DotNode) String() string

func (*DotNode) Type

func (d *DotNode) Type() NodeType

type FieldNode

FieldNode 包含一個(gè)字段(標(biāo)識(shí)符以'。'開始)。這些名字可能被鏈接('.x.y')。該期限從每個(gè)身份證件中刪除。

type FieldNode struct {
        NodeType
        Pos

        Ident []string // The identifiers in lexical order.        // contains filtered or unexported fields}

func (*FieldNode) Copy

func (f *FieldNode) Copy() Node

func (*FieldNode) String

func (f *FieldNode) String() string

鍵入IdentifierNode

IdentifierNode 包含一個(gè)標(biāo)識(shí)符。

type IdentifierNode struct {
        NodeType
        Pos

        Ident string // The identifier's name.        // contains filtered or unexported fields}

func NewIdentifier

func NewIdentifier(ident string) *IdentifierNode

NewIdentifier 用給定的標(biāo)識(shí)符名稱返回一個(gè)新的 IdentifierNode。

func (*IdentifierNode) Copy

func (i *IdentifierNode) Copy() Node

func (*IdentifierNode) SetPos

func (i *IdentifierNode) SetPos(pos Pos) *IdentifierNode

SetPos 設(shè)置位置。NewIdentifier 是一種公共方法,所以我們不能修改它的簽名。為了方便鏈接。TODO:修好一天?

func (*IdentifierNode) SetTree

func (i *IdentifierNode) SetTree(t *Tree) *IdentifierNode

SetTree 設(shè)置節(jié)點(diǎn)的父樹。NewIdentifier 是一種公共方法,所以我們不能修改它的簽名。為了方便鏈接。TODO:修好一天?

func (*IdentifierNode) String

func (i *IdentifierNode) String() string

type IfNode

IfNode 表示一個(gè) {{if}} 動(dòng)作及其命令。

type IfNode struct {
        BranchNode}

func (*IfNode) Copy

func (i *IfNode) Copy() Node

type ListNode

ListNode 包含一系列節(jié)點(diǎn)。

type ListNode struct {
        NodeType
        Pos

        Nodes []Node // The element nodes in lexical order.        // contains filtered or unexported fields}

func (*ListNode) Copy

func (l *ListNode) Copy() Node

func (*ListNode) CopyList

func (l *ListNode) CopyList() *ListNode

func (*ListNode) String

func (l *ListNode) String() string

type NilNode

NilNode 保存表示無類型 nil 常量的特殊標(biāo)識(shí)符'nil'。

type NilNode struct {
        NodeType
        Pos        // contains filtered or unexported fields}

func (*NilNode) Copy

func (n *NilNode) Copy() Node

func (*NilNode) String

func (n *NilNode) String() string

func (*NilNode) Type

func (n *NilNode) Type() NodeType

type Node

節(jié)點(diǎn)是分析樹中的一個(gè)元素。界面很簡(jiǎn)單。該接口包含一個(gè)未導(dǎo)出的方法,因此只有該包的本地類型才能滿足它。

type Node interface {        Type() NodeType        String() string        // Copy does a deep copy of the Node and all its components.        // To avoid type assertions, some XxxNodes also have specialized        // CopyXxx methods that return *XxxNode.        Copy() Node        Position() Pos // byte position of start of node in full original input string        // contains filtered or unexported methods}

鍵入NodeType

NodeType 標(biāo)識(shí)分析樹節(jié)點(diǎn)的類型。

type NodeType int
const (
        NodeText    NodeType = iota // Plain text.
        NodeAction                  // A non-control action such as a field evaluation.
        NodeBool                    // A boolean constant.
        NodeChain                   // A sequence of field accesses.
        NodeCommand                 // An element of a pipeline.
        NodeDot                     // The cursor, dot.

        NodeField      // A field or method name.
        NodeIdentifier // An identifier; always a function name.
        NodeIf         // An if action.
        NodeList       // A list of Nodes.
        NodeNil        // An untyped nil constant.
        NodeNumber     // A numerical constant.
        NodePipe       // A pipeline of commands.
        NodeRange      // A range action.
        NodeString     // A string constant.
        NodeTemplate   // A template invocation action.
        NodeVariable   // A $ variable.
        NodeWith       // A with action.)

func (NodeType) Type

func (t NodeType) Type() NodeType

Type 返回自身并提供一個(gè)簡(jiǎn)單的默認(rèn)實(shí)現(xiàn)來嵌入節(jié)點(diǎn)。嵌入在所有非平凡的節(jié)點(diǎn)中。

鍵入NumberNode

NumberNode 包含一個(gè)數(shù)字:有符號(hào)或無符號(hào)整數(shù),浮點(diǎn)數(shù)或復(fù)數(shù)。該值被解析并存儲(chǔ)在所有可以表示該值的類型下。這在少量代碼中模擬 Go 的理想常量的行為。

type NumberNode struct {
        NodeType
        Pos

        IsInt      bool       // Number has an integral value.
        IsUint     bool       // Number has an unsigned integral value.
        IsFloat    bool       // Number has a floating-point value.
        IsComplex  bool       // Number is complex.
        Int64      int64      // The signed integer value.
        Uint64     uint64     // The unsigned integer value.
        Float64    float64    // The floating-point value.
        Complex128 complex128 // The complex value.
        Text       string     // The original textual representation from the input.        // contains filtered or unexported fields}

func (*NumberNode) Copy

func (n *NumberNode) Copy() Node

func (*NumberNode) String

func (n *NumberNode) String() string

鍵入PipeNode

PipeNode 擁有一個(gè)可選聲明的管道

type PipeNode struct {
        NodeType
        Pos

        Line int             // The line number in the input. Deprecated: Kept for compatibility.
        Decl []*VariableNode // Variable declarations in lexical order.
        Cmds []*CommandNode  // The commands in lexical order.        // contains filtered or unexported fields}

func (*PipeNode) Copy

func (p *PipeNode) Copy() Node

func (*PipeNode) CopyPipe

func (p *PipeNode) CopyPipe() *PipeNode

func (*PipeNode) String

func (p *PipeNode) String() string

鍵入Pos

Pos 表示從中解析模板的原始輸入文本中的字節(jié)位置。

type Pos int

func (Pos) Position

func (p Pos) Position() Pos

鍵入RangeNode

RangeNode表示一個(gè) {{range}} 動(dòng)作及其命令。

type RangeNode struct {
        BranchNode}

func (*RangeNode) Copy

func (r *RangeNode) Copy() Node

鍵入StringNode

StringNode 包含一個(gè)字符串常量。該值已被“未引用”。

type StringNode struct {
        NodeType
        Pos

        Quoted string // The original text of the string, with quotes.
        Text   string // The string, after quote processing.        // contains filtered or unexported fields}

func (*StringNode) Copy

func (s *StringNode) Copy() Node

func (*StringNode) String

func (s *StringNode) String() string

鍵入TemplateNode

TemplateNode 表示一個(gè) {{template}} 動(dòng)作。

type TemplateNode struct {
        NodeType
        Pos

        Line int       // The line number in the input. Deprecated: Kept for compatibility.
        Name string    // The name of the template (unquoted).
        Pipe *PipeNode // The command to evaluate as dot for the template.        // contains filtered or unexported fields}

func (*TemplateNode) Copy

func (t *TemplateNode) Copy() Node

func (*TemplateNode) String

func (t *TemplateNode) String() string

鍵入TextNode

TextNode 保存純文本。

type TextNode struct {
        NodeType
        Pos

        Text []byte // The text; may span newlines.        // contains filtered or unexported fields}

func (*TextNode) Copy

func (t *TextNode) Copy() Node

func (*TextNode) String

func (t *TextNode) String() string

鍵入Tree

樹是單個(gè)解析模板的表示。

type Tree struct {
        Name      string    // name of the template represented by the tree.
        ParseName string    // name of the top-level template during parsing, for error messages.
        Root      *ListNode // top-level root of the tree.        // contains filtered or unexported fields}

func New

func New(name string, funcs ...map[string]interface{}) *Tree

New 分配給定名稱的新分析樹。

func (*Tree) Copy

func (t *Tree) Copy() *Tree

Copy 返回樹的副本。任何解析狀態(tài)都會(huì)被丟棄。

func (*Tree) ErrorContext

func (t *Tree) ErrorContext(n Node) (location, context string)

ErrorContext 返回輸入文本中節(jié)點(diǎn)位置的文本表示。只有當(dāng)節(jié)點(diǎn)沒有指向內(nèi)部樹的指針時(shí)才會(huì)使用接收器,這可能會(huì)發(fā)生在舊代碼中。

func (*Tree) Parse

func (t *Tree) Parse(text, leftDelim, rightDelim string, treeSet map[string]*Tree, funcs ...map[string]interface{}) (tree *Tree, err error)

Parse 解析模板定義字符串以構(gòu)建用于執(zhí)行的模板表示。如果任何動(dòng)作分隔符字符串為空,則使用默認(rèn)值(“{{”或“}}”)。嵌入式模板定義被添加到樹形圖。

鍵入VariableNode

VariableNode 包含變量名稱列表,可能帶有鏈接字段訪問。美元符號(hào)是(第一)名稱的一部分。

type VariableNode struct {
        NodeType
        Pos

        Ident []string // Variable name and fields in lexical order.        // contains filtered or unexported fields}

func (*VariableNode) Copy

func (v *VariableNode) Copy() Node

func (*VariableNode) String

func (v *VariableNode) String() string

鍵入WithNode

WithNode 表示一個(gè) {{with}} 動(dòng)作及其命令。

type WithNode struct {
        BranchNode}

func (*WithNode) Copy

func (w *WithNode) Copy() Node
Previous article: Next article: