Lines Matching defs:File
3 // license that can be found in the LICENSE file.
33 Write out an HTML file instead of launching a web browser:
55 output = flag.String("o", "", "file for output; default: stdout")
62 var counterStmt func(*File, string) string
133 return fmt.Errorf("missing source file")
152 // File is a wrapper for the state of a file used in the parser.
154 type File struct {
156 name string // Name of file.
157 astFile *ast.File
167 func (f *File) findText(pos token.Pos, text string) int {
200 func (f *File) Visit(node ast.Node) ast.Visitor {
314 file := &File{
327 file.edit.Insert(file.offset(file.astFile.Name.End()),
331 ast.Walk(file, file.astFile)
332 newContent := file.edit.Bytes()
348 file.addVariables(fd)
352 func setCounterStmt(f *File, counter string) string {
357 func incCounterStmt(f *File, counter string) string {
362 func atomicCounterStmt(f *File, counter string) string {
367 func (f *File) newCounter(start, end token.Pos, numStmt int) string {
385 func (f *File) addCounters(pos, insertPos, blockEnd token.Pos, list []ast.Stmt, extendToClosingBrace bool) {
463 func (f *File) statementBoundary(s ast.Stmt) token.Pos {
534 func (f *File) endsBasicSourceBlock(s ast.Stmt) bool {
572 func (f *File) isControl(s ast.Stmt) bool {
614 func (f *File) offset(pos token.Pos) int {
618 // addVariables adds to the end of the file the declarations to set up the counter and position variables.
619 func (f *File) addVariables(w io.Writer) {
681 // import and not used error when there's no code in a file.