MCPcopy Create free account
hub / github.com/adhocteam/pushup / parseForStmt

Method parseForStmt

parser.go:815–837  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

813}
814
815func (p *codeParser) parseForStmt() *nodeFor {
816 var stmt nodeFor
817 start := p.peek().pos
818loop:
819 for {
820 switch p.peek().tok {
821 case token.EOF:
822 p.errorf("premature end of clause in FOR statement")
823 case token.LBRACE:
824 break loop
825 default:
826 p.advance()
827 }
828 }
829 n := (p.file.Offset(p.prev().pos) - p.file.Offset(start)) + len(p.prev().String())
830 offset := p.baseOffset + p.file.Offset(start)
831 stmt.clause = new(nodeGoCode)
832 stmt.clause.pos.start = offset
833 stmt.clause.pos.end = offset + n
834 stmt.clause.code = p.sourceFrom(start)[:n]
835 stmt.block = p.parseStmtBlock()
836 return &stmt
837}
838
839func (p *codeParser) parseStmtBlock() *nodeBlock {
840 // we are sitting on the opening '{' token here

Callers 1

parseCodeMethod · 0.95

Calls 7

peekMethod · 0.95
errorfMethod · 0.95
advanceMethod · 0.95
prevMethod · 0.95
sourceFromMethod · 0.95
parseStmtBlockMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected