package testdata

file mytest.gop
ast.GenDecl:
  Tok: import
  Specs:
    ast.ImportSpec:
      Path:
        ast.BasicLit:
          Kind: STRING
          Value: "go/token"
    ast.ImportSpec:
      Path:
        ast.BasicLit:
          Kind: STRING
          Value: "os"
ast.GenDecl:
  Tok: var
  Specs:
    ast.ValueSpec:
      Names:
        ast.Ident:
          Name: stmtStart
      Values:
        ast.CompositeLit:
          Type:
            ast.MapType:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: Token
              Value:
                ast.Ident:
                  Name: bool
          Elts:
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: BREAK
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: CONST
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: CONTINUE
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: DEFER
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: FALLTHROUGH
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: FOR
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: GO
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: GOTO
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: IF
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: RETURN
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: SELECT
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: SWITCH
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: TYPE
              Value:
                ast.Ident:
                  Name: true
            ast.KeyValueExpr:
              Key:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: token
                  Sel:
                    ast.Ident:
                      Name: VAR
              Value:
                ast.Ident:
                  Name: true
ast.GenDecl:
  Tok: type
  Specs:
    ast.TypeSpec:
      Name:
        ast.Ident:
          Name: Mode
      Type:
        ast.Ident:
          Name: uint
ast.GenDecl:
  Tok: const
  Specs:
    ast.ValueSpec:
      Doc:
        ast.CommentGroup:
          List:
            ast.Comment:
              Text: // PackageClauseOnly - stop parsing after package clause
      Names:
        ast.Ident:
          Name: PackageClauseOnly
      Type:
        ast.Ident:
          Name: Mode
      Values:
        ast.BinaryExpr:
          X:
            ast.BasicLit:
              Kind: INT
              Value: 1
          Op: <<
          Y:
            ast.Ident:
              Name: iota
    ast.ValueSpec:
      Doc:
        ast.CommentGroup:
          List:
            ast.Comment:
              Text: // ImportsOnly - stop parsing after import declarations
      Names:
        ast.Ident:
          Name: ImportsOnly
    ast.ValueSpec:
      Doc:
        ast.CommentGroup:
          List:
            ast.Comment:
              Text: // ParseComments - parse comments and add them to AST
      Names:
        ast.Ident:
          Name: ParseComments
    ast.ValueSpec:
      Doc:
        ast.CommentGroup:
          List:
            ast.Comment:
              Text: // Trace - print a trace of parsed productions
      Names:
        ast.Ident:
          Name: Trace
    ast.ValueSpec:
      Doc:
        ast.CommentGroup:
          List:
            ast.Comment:
              Text: // DeclarationErrors - report declaration errors
      Names:
        ast.Ident:
          Name: DeclarationErrors
    ast.ValueSpec:
      Doc:
        ast.CommentGroup:
          List:
            ast.Comment:
              Text: // AllErrors - report all errors (not just the first 10 on different lines)
      Names:
        ast.Ident:
          Name: AllErrors
ast.GenDecl:
  Doc:
    ast.CommentGroup:
      List:
        ast.Comment:
          Text: // FileSystem represents a file system.
  Tok: type
  Specs:
    ast.TypeSpec:
      Name:
        ast.Ident:
          Name: FileSystem
      Type:
        ast.InterfaceType:
          Methods:
            ast.FieldList:
              List:
                ast.Field:
                  Names:
                    ast.Ident:
                      Name: ReadDir
                  Type:
                    ast.FuncType:
                      Params:
                        ast.FieldList:
                          List:
                            ast.Field:
                              Names:
                                ast.Ident:
                                  Name: dirname
                              Type:
                                ast.Ident:
                                  Name: string
                      Results:
                        ast.FieldList:
                          List:
                            ast.Field:
                              Type:
                                ast.ArrayType:
                                  Elt:
                                    ast.SelectorExpr:
                                      X:
                                        ast.Ident:
                                          Name: os
                                      Sel:
                                        ast.Ident:
                                          Name: FileInfo
                            ast.Field:
                              Type:
                                ast.Ident:
                                  Name: error
                ast.Field:
                  Names:
                    ast.Ident:
                      Name: ReadFile
                  Type:
                    ast.FuncType:
                      Params:
                        ast.FieldList:
                          List:
                            ast.Field:
                              Names:
                                ast.Ident:
                                  Name: filename
                              Type:
                                ast.Ident:
                                  Name: string
                      Results:
                        ast.FieldList:
                          List:
                            ast.Field:
                              Type:
                                ast.ArrayType:
                                  Elt:
                                    ast.Ident:
                                      Name: byte
                            ast.Field:
                              Type:
                                ast.Ident:
                                  Name: error
                ast.Field:
                  Names:
                    ast.Ident:
                      Name: Join
                  Type:
                    ast.FuncType:
                      Params:
                        ast.FieldList:
                          List:
                            ast.Field:
                              Names:
                                ast.Ident:
                                  Name: elem
                              Type:
                                ast.Ellipsis:
                                  Elt:
                                    ast.Ident:
                                      Name: string
                      Results:
                        ast.FieldList:
                          List:
                            ast.Field:
                              Type:
                                ast.Ident:
                                  Name: string
ast.GenDecl:
  Tok: type
  Specs:
    ast.TypeSpec:
      Name:
        ast.Ident:
          Name: IF
      Type:
        ast.Ident:
          Name: FileSystem
ast.GenDecl:
  Tok: type
  Specs:
    ast.TypeSpec:
      Name:
        ast.Ident:
          Name: Foo
      Type:
        ast.StructType:
          Fields:
            ast.FieldList:
              List:
                ast.Field:
                  Names:
                    ast.Ident:
                      Name: a
                    ast.Ident:
                      Name: b
                  Type:
                    ast.MapType:
                      Key:
                        ast.Ident:
                          Name: string
                      Value:
                        ast.StructType:
                          Fields:
                            ast.FieldList:
ast.FuncDecl:
  Recv:
    ast.FieldList:
      List:
        ast.Field:
          Names:
            ast.Ident:
              Name: p
          Type:
            ast.StarExpr:
              X:
                ast.Ident:
                  Name: Foo
  Name:
    ast.Ident:
      Name: bar
  Type:
    ast.FuncType:
      Params:
        ast.FieldList:
  Body:
    ast.BlockStmt:
ast.FuncDecl:
  Name:
    ast.Ident:
      Name: init
  Type:
    ast.FuncType:
      Params:
        ast.FieldList:
  Body:
    ast.BlockStmt:
      List:
        ast.AssignStmt:
          Lhs:
            ast.Ident:
              Name: f
            ast.Ident:
              Name: err
          Tok: :=
          Rhs:
            ast.CallExpr:
              Fun:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: os
                  Sel:
                    ast.Ident:
                      Name: Open
              Args:
                ast.BasicLit:
                  Kind: STRING
                  Value: "a"
        ast.IfStmt:
          Cond:
            ast.BinaryExpr:
              X:
                ast.Ident:
                  Name: err
              Op: !=
              Y:
                ast.Ident:
                  Name: nil
          Body:
            ast.BlockStmt:
              List:
                ast.ReturnStmt:
        ast.DeferStmt:
          Call:
            ast.CallExpr:
              Fun:
                ast.SelectorExpr:
                  X:
                    ast.Ident:
                      Name: f
                  Sel:
                    ast.Ident:
                      Name: Close
        ast.AssignStmt:
          Lhs:
            ast.Ident:
              Name: ch
          Tok: :=
          Rhs:
            ast.CallExpr:
              Fun:
                ast.Ident:
                  Name: make
              Args:
                ast.ChanType:
                  Value:
                    ast.Ident:
                      Name: bool
                ast.BasicLit:
                  Kind: INT
                  Value: 100
        ast.SelectStmt:
          Body:
            ast.BlockStmt:
              List:
                ast.CommClause:
                  Comm:
                    ast.ExprStmt:
                      X:
                        ast.UnaryExpr:
                          Op: <-
                          X:
                            ast.Ident:
                              Name: ch
                  Body:
                    ast.ExprStmt:
                      X:
                        ast.CallExpr:
                          Fun:
                            ast.Ident:
                              Name: println
                          Args:
                            ast.BasicLit:
                              Kind: STRING
                              Value: "1"
                ast.CommClause:
                  Comm:
                    ast.SendStmt:
                      Chan:
                        ast.Ident:
                          Name: ch
                      Value:
                        ast.Ident:
                          Name: true
                  Body:
                    ast.ExprStmt:
                      X:
                        ast.CallExpr:
                          Fun:
                            ast.Ident:
                              Name: println
                          Args:
                            ast.BasicLit:
                              Kind: STRING
                              Value: "2"
        ast.GoStmt:
          Call:
            ast.CallExpr:
              Fun:
                ast.FuncLit:
                  Type:
                    ast.FuncType:
                      Params:
                        ast.FieldList:
                          List:
                            ast.Field:
                              Names:
                                ast.Ident:
                                  Name: fs
                              Type:
                                ast.Ident:
                                  Name: FileSystem
                  Body:
                    ast.BlockStmt:
                      List:
                        ast.IfStmt:
                          Init:
                            ast.AssignStmt:
                              Lhs:
                                ast.Ident:
                                  Name: foo
                                ast.Ident:
                                  Name: ok
                              Tok: :=
                              Rhs:
                                ast.TypeAssertExpr:
                                  X:
                                    ast.Ident:
                                      Name: fs
                                  Type:
                                    ast.StarExpr:
                                      X:
                                        ast.Ident:
                                          Name: Foo
                          Cond:
                            ast.Ident:
                              Name: ok
                          Body:
                            ast.BlockStmt:
                              List:
                                ast.ExprStmt:
                                  X:
                                    ast.CallExpr:
                                      Fun:
                                        ast.Ident:
                                          Name: println
                                      Args:
                                        ast.Ident:
                                          Name: foo
              Args:
                ast.Ident:
                  Name: nil
