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

Method parseArguments

parse.go:858–889  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

856}
857
858func (t *Template) parseArguments() (args CallArgs) {
859 context := "call expression argument list"
860 args.Exprs = []Expression{}
861loop:
862 for {
863 peek := t.peekNonSpace()
864 if peek.typ == itemRightParen {
865 break
866 }
867 var (
868 expr Expression
869 endtoken item
870 )
871 expr, endtoken = t.parseExpression(context)
872 if expr.Type() == NodeUnderscore {
873 // slot for piped argument
874 if args.HasPipeSlot {
875 t.errorf("found two pipe slot markers ('_') for the same function call")
876 }
877 args.HasPipeSlot = true
878 }
879 args.Exprs = append(args.Exprs, expr)
880 switch endtoken.typ {
881 case itemComma:
882 // continue with closing parens (allowed because of multiline syntax) or next arg
883 default:
884 t.backup()
885 break loop
886 }
887 }
888 return
889}
890
891func (t *Template) parseControl(allowElseIf bool, context string) (pos Pos, line int, set *SetNode, expression Expression, list, elseList *ListNode) {
892 line = t.lex.lineNumber()

Callers 2

commandMethod · 0.95
operandMethod · 0.95

Calls 5

peekNonSpaceMethod · 0.95
parseExpressionMethod · 0.95
errorfMethod · 0.95
backupMethod · 0.95
TypeMethod · 0.65

Tested by

no test coverage detected