Lines Matching defs:parser

17 package parser  package
30 type parser struct { struct
31 file *token.File
32 errors scanner.ErrorList
33 scanner scanner.Scanner
36 mode Mode // parsing mode
37 trace bool // == (mode & Trace != 0)
38 indent int // indentation used for tracing output
41 comments []*ast.CommentGroup
42 leadComment *ast.CommentGroup // last lead comment
43 lineComment *ast.CommentGroup // last line comment
46 pos token.Pos // token position
47 tok token.Token // one token look-ahead
48 lit string // token literal
54 syncPos token.Pos // last synchronization position
55 syncCnt int // number of parser.advance calls without progress
58 exprLev int // < 0: in control clause, >= 0: in expression
59 inRhs bool // if set, the parser is parsing a rhs expression
62 pkgScope *ast.Scope // pkgScope.Outer == nil
63 topScope *ast.Scope // top-most scope; may be pkgScope
64 unresolved []*ast.Ident // unresolved identifiers
65 imports []*ast.ImportSpec // list of imports
69 labelScope *ast.Scope // label scope for current function
70 targetStack [][]*ast.Ident // stack of unresolved labels
73 func (p *parser) init(fset *token.FileSet, filename string, src []byte, mode Mode) {
91 func (p *parser) openScope() {
95 func (p *parser) closeScope() {
99 func (p *parser) openLabelScope() {
104 func (p *parser) closeLabelScope() {
119 …parser) declare(decl, data interface{}, scope *ast.Scope, kind ast.ObjKind, idents ...*ast.Ident) {
140 func (p *parser) shortVarDecl(decl *ast.AssignStmt, list []ast.Expr) {
178 func (p *parser) tryResolve(x ast.Expr, collectUnresolved bool) {
205 func (p *parser) resolve(x ast.Expr) {
212 func (p *parser) printTrace(a ...interface{}) {
227 func trace(p *parser, msg string) *parser {
234 func un(p *parser) {
240 func (p *parser) next0() {
261 func (p *parser) consumeComment() (comment *ast.Comment, endline int) {
285 func (p *parser) consumeCommentGroup(n int) (comments *ast.CommentGroup, endline int) {
316 func (p *parser) next() {
354 func (p *parser) error(pos token.Pos, msg string) {
373 func (p *parser) errorExpected(pos token.Pos, msg string) {
391 func (p *parser) expect(tok token.Token) token.Pos {
402 func (p *parser) expect2(tok token.Token) (pos token.Pos) {
415 func (p *parser) expectClosing(tok token.Token, context string) token.Pos {
423 func (p *parser) expectSemi() {
440 func (p *parser) atComma(context string, follow token.Token) bool {
463 func (p *parser) advance(to map[token.Token]bool) {
533 func (p *parser) safePos(pos token.Pos) (res token.Pos) {
546 func (p *parser) parseIdent() *ast.Ident {
558 func (p *parser) parseIdentList() (list []*ast.Ident) {
576 func (p *parser) parseExprList(lhs bool) (list []ast.Expr) {
590 func (p *parser) parseLhsList() []ast.Expr {
618 func (p *parser) parseRhsList() []ast.Expr {
629 func (p *parser) parseType() ast.Expr {
647 func (p *parser) parseTypeName() ast.Expr {
666 func (p *parser) parseArrayType() ast.Expr {
688 func (p *parser) makeIdentList(list []ast.Expr) []*ast.Ident {
704 func (p *parser) parseFieldDecl(scope *ast.Scope) *ast.Field {
757 func (p *parser) parseStructType() *ast.StructType {
784 func (p *parser) parsePointerType() *ast.StarExpr {
796 func (p *parser) tryVarType(isParam bool) ast.Expr {
813 func (p *parser) parseVarType(isParam bool) ast.Expr {
824 func (p *parser) parseParameterList(scope *ast.Scope, ellipsisOk bool) (params []*ast.Field) {
883 func (p *parser) parseParameters(scope *ast.Scope, ellipsisOk bool) *ast.FieldList {
898 func (p *parser) parseResult(scope *ast.Scope) *ast.FieldList {
917 func (p *parser) parseSignature(scope *ast.Scope) (params, results *ast.FieldList) {
928 func (p *parser) parseFuncType() (*ast.FuncType, *ast.Scope) {
940 func (p *parser) parseMethodSpec(scope *ast.Scope) *ast.Field {
968 func (p *parser) parseInterfaceType() *ast.InterfaceType {
992 func (p *parser) parseMapType() *ast.MapType {
1006 func (p *parser) parseChanType() *ast.ChanType {
1032 func (p *parser) tryIdentOrType() ast.Expr {
1063 func (p *parser) tryType() ast.Expr {
1074 func (p *parser) parseStmtList() (list []ast.Stmt) {
1086 func (p *parser) parseBody(scope *ast.Scope) *ast.BlockStmt {
1102 func (p *parser) parseBlockStmt() *ast.BlockStmt {
1119 func (p *parser) parseFuncTypeOrLit() ast.Expr {
1141 func (p *parser) parseOperand(lhs bool) ast.Expr {
1186 func (p *parser) parseSelector(x ast.Expr) ast.Expr {
1196 func (p *parser) parseTypeAssertion(x ast.Expr) ast.Expr {
1214 func (p *parser) parseIndexOrSlice(x ast.Expr) ast.Expr {
1261 func (p *parser) parseCallOrConversion(fun ast.Expr) *ast.CallExpr {
1287 func (p *parser) parseValue(keyOk bool) ast.Expr {
1329 func (p *parser) parseElement() ast.Expr {
1344 func (p *parser) parseElementList() (list []ast.Expr) {
1360 func (p *parser) parseLiteralValue(typ ast.Expr) ast.Expr {
1377 func (p *parser) checkExpr(x ast.Expr) ast.Expr {
1457 func (p *parser) checkExprOrType(x ast.Expr) ast.Expr {
1473 func (p *parser) parsePrimaryExpr(lhs bool) ast.Expr {
1528 func (p *parser) parseUnaryExpr(lhs bool) ast.Expr {
1597 func (p *parser) tokPrec() (token.Token, int) {
1606 func (p *parser) parseBinaryExpr(lhs bool, prec1 int) ast.Expr {
1631 func (p *parser) parseExpr(lhs bool) ast.Expr {
1639 func (p *parser) parseRhs() ast.Expr {
1647 func (p *parser) parseRhsOrType() ast.Expr {
1669 func (p *parser) parseSimpleStmt(mode int) (ast.Stmt, bool) {
1747 func (p *parser) parseCallExpr(callType string) *ast.CallExpr {
1759 func (p *parser) parseGoStmt() ast.Stmt {
1774 func (p *parser) parseDeferStmt() ast.Stmt {
1789 func (p *parser) parseReturnStmt() *ast.ReturnStmt {
1805 func (p *parser) parseBranchStmt(tok token.Token) *ast.BranchStmt {
1823 func (p *parser) makeExpr(s ast.Stmt, want string) ast.Expr {
1841 func (p *parser) parseIfHeader() (init ast.Stmt, cond ast.Expr) {
1901 func (p *parser) parseIfStmt() *ast.IfStmt {
1933 func (p *parser) parseTypeList() (list []ast.Expr) {
1947 func (p *parser) parseCaseClause(typeSwitch bool) *ast.CaseClause {
1978 func (p *parser) isTypeSwitchGuard(s ast.Stmt) bool {
1999 func (p *parser) parseSwitchStmt() ast.Stmt {
2057 func (p *parser) parseCommClause() *ast.CommClause {
2115 func (p *parser) parseSelectStmt() *ast.SelectStmt {
2133 func (p *parser) parseForStmt() ast.Stmt {
2216 func (p *parser) parseStmt() (s ast.Stmt) {
2291 func (p *parser) parseImportSpec(doc *ast.CommentGroup, _ token.Token, _ int) ast.Spec {
2330 func (p *parser) parseValueSpec(doc *ast.CommentGroup, keyword token.Token, iota int) ast.Spec {
2377 func (p *parser) parseTypeSpec(doc *ast.CommentGroup, _ token.Token, _ int) ast.Spec {
2401 func (p *parser) parseGenDecl(keyword token.Token, f parseSpecFunction) *ast.GenDecl {
2432 func (p *parser) parseFuncDecl() *ast.FuncDecl {
2492 func (p *parser) parseDecl(sync map[token.Token]bool) ast.Decl {
2521 func (p *parser) parseFile() *ast.File {