LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
| 4 |
| 5 // Package parser implements a parser for Go source files. Input may be |
| 6 // provided in a variety of forms (see the various Parse* functions); the |
| 7 // output is an abstract syntax tree (AST) representing the Go source. The |
| 8 // parser is invoked through one of the Parse* functions. |
4 | 9 |
5 package parser | 10 package parser |
6 | 11 |
7 import ( | 12 import ( |
8 "fmt" | 13 "fmt" |
9 "go/ast" | 14 "go/ast" |
10 "go/scanner" | 15 "go/scanner" |
11 "go/token" | 16 "go/token" |
12 ) | 17 ) |
13 | 18 |
(...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 ident.Obj = p.pkgScope.Lookup(ident.Name) // also removes unreso
lved sentinel | 2144 ident.Obj = p.pkgScope.Lookup(ident.Name) // also removes unreso
lved sentinel |
2140 if ident.Obj == nil { | 2145 if ident.Obj == nil { |
2141 p.unresolved[i] = ident | 2146 p.unresolved[i] = ident |
2142 i++ | 2147 i++ |
2143 } | 2148 } |
2144 } | 2149 } |
2145 | 2150 |
2146 // TODO(gri): store p.imports in AST | 2151 // TODO(gri): store p.imports in AST |
2147 return &ast.File{doc, pos, ident, decls, p.pkgScope, p.imports, p.unreso
lved[0:i], p.comments} | 2152 return &ast.File{doc, pos, ident, decls, p.pkgScope, p.imports, p.unreso
lved[0:i], p.comments} |
2148 } | 2153 } |
LEFT | RIGHT |