Documentation
¶
Overview ¶
Package ast provides the functionality and data structures around the Serene's AST.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var OutOfRangeLine string = "----"
Functions ¶
This section is empty.
Types ¶
type ILocatable ¶
type ILocatable interface {
GetLocation() *Location
}
ILocatable describes something that can be located in a source
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
Location is used to point to a specific location in the source code (before parse). It can point to a single point or a range.
func MakeLocation ¶
MakeLocation return a pointer to a `Location` in the given source `input` specified by the `start` and `end` boundaries
func MakeUnknownLocation ¶
func MakeUnknownLocation() *Location
func (*Location) DecEnd ¶
DecEnd decreases the end pointer of the location by `x` with respect to the boundaries of the source
func (*Location) DecStart ¶
DecStart decreases the start pointer of the location by `x` with respect to the boundaries of the source
func (*Location) GetSource ¶
GetSource returns the source of the current location or the "builtin" source to indicate that the source of this location is not known in the context of source code
func (*Location) IncEnd ¶
IncEnd increases the end pointer of the location by `x` with respect to the boundaries of the source
func (*Location) IncStart ¶
IncStart increases the start pointer of the location by `x` with respect to the boundaries of the source
func (*Location) IsKnownLocaiton ¶
type Source ¶
type Source struct { // A Pointer to the buffer where the parser used for parsing the source Buffer *[]string // The namespace name which this source is describing NS string // This array contains the boundaries of each line in the buffer. For example // [24 50 106] means that the buffer contains 3 lines and the first line can // be found from the index 0 to index 24 of the buffer and the second line is // from index 25 till 50 and so on LineIndex *[]int }
func GetBuiltinSource ¶
func GetBuiltinSource() *Source
GetBuiltinSource returns a pointer to a source that represents builtin expressions
func (*Source) GetLine ¶
GetLine returns the line specified by the `linenum` from the buffer. It will return "----" if the given line number exceeds the boundaries of the buffer
func (*Source) GetSubstr ¶
GetSubstr returns the a pointer to the string from the buffer specified by the `start` and `end`
func (*Source) LineNumberFor ¶
LineNumberFor returns the line number associated with the given position `pos` in the buffer