本文整理匯總了Golang中github.com/elves/elvish/parse.Compound類的典型用法代碼示例。如果您正苦於以下問題:Golang Compound類的具體用法?Golang Compound怎麽用?Golang Compound使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Compound類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: mustPrimary
func mustPrimary(cp *compiler, cn *parse.Compound, msg string) *parse.Primary {
p := onePrimary(cn)
if p == nil {
cp.errorpf(cn.Begin(), cn.End(), msg)
}
return p
}
示例2: mustString
// mustString musts that a Compound contains exactly one Primary of type
// Variable.
func mustString(cp *compiler, cn *parse.Compound, msg string) string {
s, ok := oneString(cn)
if !ok {
cp.errorpf(cn.Begin(), cn.End(), msg)
}
return s
}
示例3: formHead
func (s *Stylist) formHead(n *parse.Compound) {
simple, head, err := simpleCompound(n, nil)
st := styles{}
if simple {
if goodFormHead(head, s.editor) {
st = styleForGoodCommand
} else {
st = styleForBadCommand
}
} else if err != nil {
st = styleForBadCommand
}
if len(st) > 0 {
s.add(st.String(), n.Begin(), n.End())
}
}
示例4: compoundOp
func (cp *compiler) compoundOp(n *parse.Compound) ValuesOp {
return ValuesOp{cp.compound(n), n.Begin(), n.End()}
}
示例5: isFormHead
func isFormHead(compound *parse.Compound) bool {
if form, ok := compound.Parent().(*parse.Form); ok {
return form.Head == compound
}
return false
}