aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/robertkrimen/otto/file/README.markdown
blob: 79757baa8e5d8f5b2a90c5ebb7992f275b074569 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# file
--
    import "github.com/robertkrimen/otto/file"

Package file encapsulates the file abstractions used by the ast & parser.

## Usage

#### type File

```go
type File struct {
}
```


#### func  NewFile

```go
func NewFile(filename, src string, base int) *File
```

#### func (*File) Base

```go
func (fl *File) Base() int
```

#### func (*File) Name

```go
func (fl *File) Name() string
```

#### func (*File) Source

```go
func (fl *File) Source() string
```

#### type FileSet

```go
type FileSet struct {
}
```

A FileSet represents a set of source files.

#### func (*FileSet) AddFile

```go
func (self *FileSet) AddFile(filename, src string) int
```
AddFile adds a new file with the given filename and src.

This an internal method, but exported for cross-package use.

#### func (*FileSet) File

```go
func (self *FileSet) File(idx Idx) *File
```

#### func (*FileSet) Position

```go
func (self *FileSet) Position(idx Idx) *Position
```
Position converts an Idx in the FileSet into a Position.

#### type Idx

```go
type Idx int
```

Idx is a compact encoding of a source position within a file set. It can be
converted into a Position for a more convenient, but much larger,
representation.

#### type Position

```go
type Position struct {
    Filename string // The filename where the error occurred, if any
    Offset   int    // The src offset
    Line     int    // The line number, starting at 1
    Column   int    // The column number, starting at 1 (The character count)

}
```

Position describes an arbitrary source position including the filename, line,
and column location.

#### func (*Position) String

```go
func (self *Position) String() string
```
String returns a string in one of several forms:

    file:line:column    A valid position with filename
    line:column         A valid position without filename
    file                An invalid position with filename
    -                   An invalid position without filename

--
**godocdown** http://github.com/robertkrimen/godocdown