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

Method parseBlock

parse.go:386–409  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

384}
385
386func (t *Template) parseBlock() Node {
387 const context = "block clause"
388 var pipe Expression
389
390 name := t.expect(itemIdentifier, context, "name")
391 bplist := t.blockParametersList(true, context)
392
393 if t.peekNonSpace().typ != itemRightDelim {
394 pipe = t.expression(context, "context")
395 }
396
397 t.expectRightDelim(context)
398
399 list, end := t.itemList(nodeContent, nodeEnd)
400 var contentList *ListNode
401
402 if end.Type() == nodeContent {
403 contentList, _ = t.itemList(nodeEnd)
404 }
405
406 block := t.newBlock(name.pos, t.lex.lineNumber(), name.val, bplist, pipe, list, contentList)
407 t.passedBlocks[block.Name] = block
408 return block
409}
410
411func (t *Template) parseYield() Node {
412 const context = "yield clause"

Callers 1

actionMethod · 0.95

Calls 9

expectMethod · 0.95
blockParametersListMethod · 0.95
peekNonSpaceMethod · 0.95
expressionMethod · 0.95
expectRightDelimMethod · 0.95
itemListMethod · 0.95
newBlockMethod · 0.95
lineNumberMethod · 0.80
TypeMethod · 0.65

Tested by

no test coverage detected