()
| 512 | } |
| 513 | |
| 514 | func (t *Template) action() (n Node) { |
| 515 | switch token := t.nextNonSpace(); token.typ { |
| 516 | case itemInclude: |
| 517 | return t.parseInclude() |
| 518 | case itemBlock: |
| 519 | return t.parseBlock() |
| 520 | case itemEnd: |
| 521 | return t.endControl() |
| 522 | case itemYield: |
| 523 | return t.parseYield() |
| 524 | case itemContent: |
| 525 | return t.contentControl() |
| 526 | case itemIf: |
| 527 | return t.ifControl() |
| 528 | case itemElse: |
| 529 | return t.elseControl() |
| 530 | case itemRange: |
| 531 | return t.rangeControl() |
| 532 | case itemTry: |
| 533 | return t.parseTry() |
| 534 | case itemCatch: |
| 535 | return t.parseCatch() |
| 536 | case itemReturn: |
| 537 | return t.parseReturn() |
| 538 | } |
| 539 | |
| 540 | t.backup() |
| 541 | action := t.newAction(t.peek().pos, t.lex.lineNumber()) |
| 542 | |
| 543 | expr := t.assignmentOrExpression("command") |
| 544 | if expr.Type() == NodeSet { |
| 545 | action.Set = expr.(*SetNode) |
| 546 | expr = nil |
| 547 | if t.expectOneOf(itemSemicolon, itemRightDelim, "command", "semicolon or right delimiter").typ == itemSemicolon { |
| 548 | expr = t.expression("command", "pipeline base expression") |
| 549 | } |
| 550 | } |
| 551 | if expr != nil { |
| 552 | action.Pipe = t.pipeline("command", expr) |
| 553 | } |
| 554 | return action |
| 555 | } |
| 556 | |
| 557 | func (t *Template) logicalExpression(context string) (Expression, item) { |
| 558 | left, endtoken := t.comparativeExpression(context) |
no test coverage detected