MCPcopy Create free account
hub / github.com/CloudyKit/jet / command

Method command

parse.go:748–776  ·  view source on GitHub ↗
(baseExpr Expression)

Source from the content-addressed store, hash-verified

746}
747
748func (t *Template) command(baseExpr Expression) *CommandNode {
749 cmd := t.newCommand(t.peekNonSpace().pos)
750
751 if baseExpr == nil {
752 baseExpr = t.expression("command", "name")
753 }
754
755 if baseExpr.Type() == NodeCallExpr {
756 call := baseExpr.(*CallExprNode)
757 cmd.CallExprNode = *call
758 return cmd
759 }
760
761 cmd.BaseExpr = baseExpr
762
763 next := t.nextNonSpace()
764 switch next.typ {
765 case itemColon:
766 cmd.CallArgs = t.parseArguments()
767 default:
768 t.backup()
769 }
770
771 if cmd.BaseExpr == nil {
772 t.errorf("empty command")
773 }
774
775 return cmd
776}
777
778// operand:
779//

Callers 1

pipelineMethod · 0.95

Calls 8

newCommandMethod · 0.95
peekNonSpaceMethod · 0.95
expressionMethod · 0.95
nextNonSpaceMethod · 0.95
parseArgumentsMethod · 0.95
backupMethod · 0.95
errorfMethod · 0.95
TypeMethod · 0.65

Tested by

no test coverage detected