PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall
(n node)
| 515 | |
| 516 | // PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall |
| 517 | func (p *parser) parsePrimaryExpr(n node) (opnd node) { |
| 518 | switch p.r.typ { |
| 519 | case itemString: |
| 520 | opnd = newOperandNode(p.r.strval) |
| 521 | p.next() |
| 522 | case itemNumber: |
| 523 | opnd = newOperandNode(p.r.numval) |
| 524 | p.next() |
| 525 | case itemDollar: |
| 526 | p.next() |
| 527 | checkItem(p.r, itemName) |
| 528 | opnd = newVariableNode(p.r.prefix, p.r.name) |
| 529 | p.next() |
| 530 | case itemLParens: |
| 531 | p.next() |
| 532 | opnd = p.parseExpression(n) |
| 533 | if opnd.Type() != nodeConstantOperand { |
| 534 | opnd = newGroupNode(opnd) |
| 535 | } |
| 536 | p.skipItem(itemRParens) |
| 537 | case itemName: |
| 538 | if p.r.canBeFunc && !isNodeType(p.r) { |
| 539 | opnd = p.parseMethod(nil) |
| 540 | } |
| 541 | } |
| 542 | return opnd |
| 543 | } |
| 544 | |
| 545 | // FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' |
| 546 | func (p *parser) parseMethod(n node) node { |
no test coverage detected