token

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotationFunctionType added in v0.0.4

type AnnotationFunctionType uint8
const (
	AnnotationFunctionTypeNormal AnnotationFunctionType = iota
	AnnotationFunctionTypeExternal
	AnnotationFunctionTypeExternalVar
	AnnotationFunctionTypeExternalVarEx
)

type BooleanToken

type BooleanToken struct {
	SourceFileReference
	// contains filtered or unexported fields
}

Keyword :

func NewBooleanToken

func NewBooleanToken(raw string, v bool, sourceFileReference SourceFileReference) BooleanToken

func (BooleanToken) FetchPositionLength

func (s BooleanToken) FetchPositionLength() SourceFileReference

func (BooleanToken) Raw

func (s BooleanToken) Raw() string

func (BooleanToken) String

func (s BooleanToken) String() string

func (BooleanToken) Type

func (s BooleanToken) Type() Type

func (BooleanToken) Value

func (s BooleanToken) Value() bool

type CharacterToken

type CharacterToken struct {
	SourceFileReference
	// contains filtered or unexported fields
}

CharacterToken :

func NewCharacterToken

func NewCharacterToken(raw string, text rune, position SourceFileReference) CharacterToken

func (CharacterToken) Character

func (s CharacterToken) Character() rune

func (CharacterToken) FetchPositionLength

func (s CharacterToken) FetchPositionLength() SourceFileReference

func (CharacterToken) Raw

func (s CharacterToken) Raw() string

func (CharacterToken) String

func (s CharacterToken) String() string

func (CharacterToken) Type

func (s CharacterToken) Type() Type

type Comment added in v0.0.2

type Comment interface {
	Raw() string
	Value() string
	FetchPositionLength() SourceFileReference
}

type CommentBlock

type CommentBlock struct {
	Comments []Comment
}

func MakeCommentBlock

func MakeCommentBlock(comments []Comment) CommentBlock

func (CommentBlock) LastComment added in v0.0.2

func (c CommentBlock) LastComment() Comment

type CommentToken

type CommentToken struct {
	SourceFileReference
	RawString        string
	CommentString    string
	ForDocumentation bool
}

func (CommentToken) FetchPositionLength

func (s CommentToken) FetchPositionLength() SourceFileReference

func (CommentToken) Raw

func (s CommentToken) Raw() string

func (CommentToken) Text

func (s CommentToken) Text() string

func (CommentToken) Type

func (s CommentToken) Type() Type

type DocumentURI

type DocumentURI string

func MakeDocumentURI

func MakeDocumentURI(s string) DocumentURI

func MakeDocumentURIFromLocalPath added in v0.0.4

func MakeDocumentURIFromLocalPath(s string) DocumentURI

func (DocumentURI) ToLocalFilePath

func (s DocumentURI) ToLocalFilePath() (string, error)

type ExternalFunctionToken

type ExternalFunctionToken struct {
	SourceFileReference
}

ExternalFunctionToken :

func NewExternalFunctionToken

func NewExternalFunctionToken(startPosition SourceFileReference) ExternalFunctionToken

func (ExternalFunctionToken) FetchPositionLength

func (s ExternalFunctionToken) FetchPositionLength() SourceFileReference

func (ExternalFunctionToken) String

func (s ExternalFunctionToken) String() string

func (ExternalFunctionToken) Type

func (s ExternalFunctionToken) Type() Type

type ExternalVarExFunction added in v0.0.4

type ExternalVarExFunction struct {
	SourceFileReference
}

ExternalVarExFunction :

func NewExternalVarExFunction added in v0.0.4

func NewExternalVarExFunction(startPosition SourceFileReference) ExternalVarExFunction

func (ExternalVarExFunction) FetchPositionLength added in v0.0.4

func (s ExternalVarExFunction) FetchPositionLength() SourceFileReference

func (ExternalVarExFunction) String added in v0.0.4

func (s ExternalVarExFunction) String() string

func (ExternalVarExFunction) Type added in v0.0.4

func (s ExternalVarExFunction) Type() Type

type ExternalVarFunction added in v0.0.4

type ExternalVarFunction struct {
	SourceFileReference
}

ExternalVarFunction :

func NewExternalVarFunction added in v0.0.4

func NewExternalVarFunction(startPosition SourceFileReference) ExternalVarFunction

func (ExternalVarFunction) FetchPositionLength added in v0.0.4

func (s ExternalVarFunction) FetchPositionLength() SourceFileReference

func (ExternalVarFunction) String added in v0.0.4

func (s ExternalVarFunction) String() string

func (ExternalVarFunction) Type added in v0.0.4

func (s ExternalVarFunction) Type() Type

type GuardToken

type GuardToken struct {
	SourceFileReference
	// contains filtered or unexported fields
}

GuardToken :

func NewGuardToken

func NewGuardToken(startPosition SourceFileReference, raw string, debugString string) GuardToken

func (GuardToken) DebugString

func (s GuardToken) DebugString() string

func (GuardToken) FetchPositionLength

func (s GuardToken) FetchPositionLength() SourceFileReference

func (GuardToken) Raw

func (s GuardToken) Raw() string

func (GuardToken) String

func (s GuardToken) String() string

func (GuardToken) Type

func (s GuardToken) Type() Type

type IndentationReport

type IndentationReport struct {
	PreviousIndentationSpaces int
	PreviousCloseIndentation  int
	PreviousExactIndentation  int
	IndentationSpaces         int
	SpacesUntilMaybeNewline   int
	ExactIndentation          int
	CloseIndentation          int
	NewLineCount              int
	EndOfFile                 bool
	StartPos                  PositionToken
	PositionLength            SourceFileReference
	Comments                  CommentBlock
	TrailingSpacesFound       bool
}

type Keyword

type Keyword struct {
	// contains filtered or unexported fields
}

Keyword :

func NewKeyword

func NewKeyword(raw string, tokenType Type, sourceFileReference SourceFileReference) Keyword

func (Keyword) FetchPositionLength

func (s Keyword) FetchPositionLength() SourceFileReference

func (Keyword) Raw

func (s Keyword) Raw() string

func (Keyword) String

func (s Keyword) String() string

func (Keyword) Type

func (s Keyword) Type() Type

type LineDelimiterToken

type LineDelimiterToken struct {
	SourceFileReference
}

LineDelimiterToken :

func NewLineDelimiter

func NewLineDelimiter(position SourceFileReference) LineDelimiterToken

func (LineDelimiterToken) FetchPositionLength

func (s LineDelimiterToken) FetchPositionLength() SourceFileReference

func (LineDelimiterToken) String

func (s LineDelimiterToken) String() string

func (LineDelimiterToken) Type

func (s LineDelimiterToken) Type() Type

type MultiLineCommentPart added in v0.0.2

type MultiLineCommentPart struct {
	SourceFileReference
	RawString     string
	CommentString string
}

type MultiLineCommentToken

type MultiLineCommentToken struct {
	ForDocumentation bool
	// contains filtered or unexported fields
}

MultiLineCommentToken :

func NewMultiLineCommentToken

func NewMultiLineCommentToken(parts []MultiLineCommentPart, forDocumentation bool) MultiLineCommentToken

func (MultiLineCommentToken) FetchPositionLength added in v0.0.2

func (s MultiLineCommentToken) FetchPositionLength() SourceFileReference

func (MultiLineCommentToken) Parts added in v0.0.2

func (MultiLineCommentToken) Raw added in v0.0.2

func (s MultiLineCommentToken) Raw() string

func (MultiLineCommentToken) String

func (s MultiLineCommentToken) String() string

func (MultiLineCommentToken) Type added in v0.0.2

func (s MultiLineCommentToken) Type() Type

func (MultiLineCommentToken) Value added in v0.0.2

func (s MultiLineCommentToken) Value() string

type NumberToken

type NumberToken struct {
	SourceFileReference
	// contains filtered or unexported fields
}

NumberToken :

func NewNumberToken

func NewNumberToken(raw string, v int32, isFixed bool, startPosition SourceFileReference) NumberToken

func (NumberToken) FetchPositionLength

func (s NumberToken) FetchPositionLength() SourceFileReference

func (NumberToken) Raw

func (s NumberToken) Raw() string

func (NumberToken) String

func (s NumberToken) String() string

func (NumberToken) Type

func (s NumberToken) Type() Type

func (NumberToken) Value

func (s NumberToken) Value() int32

type OperatorToken

type OperatorToken struct {
	SourceFileReference
	// contains filtered or unexported fields
}

OperatorToken :

func NewOperatorToken

func NewOperatorToken(operatorType Type, startPosition SourceFileReference, raw string, debugString string) OperatorToken

func (OperatorToken) DebugString

func (s OperatorToken) DebugString() string

func (OperatorToken) FetchPositionLength

func (s OperatorToken) FetchPositionLength() SourceFileReference

func (OperatorToken) Raw

func (s OperatorToken) Raw() string

func (OperatorToken) String

func (s OperatorToken) String() string

func (OperatorToken) Type

func (s OperatorToken) Type() Type

type ParenToken

type ParenToken struct {
	SourceFileReference
	// contains filtered or unexported fields
}

ParenToken :

func NewParenToken

func NewParenToken(raw string, operatorType Type, sourceFileReference SourceFileReference, debugString string) ParenToken

func (ParenToken) FetchPositionLength

func (s ParenToken) FetchPositionLength() SourceFileReference

func (ParenToken) Raw

func (s ParenToken) Raw() string

func (ParenToken) String

func (s ParenToken) String() string

func (ParenToken) Type

func (s ParenToken) Type() Type

type Position

type Position struct {
	// contains filtered or unexported fields
}

func MakePosition

func MakePosition(line int, column int, octetOffset int) Position

func NewPositionTopLeft

func NewPositionTopLeft() Position

func (Position) AddColumn added in v0.0.5

func (p Position) AddColumn(length int) Position

func (Position) Column

func (p Position) Column() int

func (Position) DebugString added in v0.0.2

func (p Position) DebugString() string

func (Position) FirstColumn

func (p Position) FirstColumn(octetOffset int) Position

func (Position) IsOnOrAfter added in v0.0.5

func (p Position) IsOnOrAfter(other Position) bool

func (Position) Line

func (p Position) Line() int

func (Position) NewLine added in v0.0.2

func (p Position) NewLine() Position

func (Position) NextColumn

func (p Position) NextColumn() Position

func (Position) NextLine

func (p Position) NextLine(octetOffset int) Position

func (Position) OctetOffset added in v0.0.2

func (p Position) OctetOffset() int

func (Position) PreviousColumn

func (p Position) PreviousColumn() Position

func (*Position) SetOctetOffset added in v0.0.5

func (p *Position) SetOctetOffset(offset int)

func (Position) String

func (p Position) String() string

type PositionToken

type PositionToken struct {
	// contains filtered or unexported fields
}

PositionToken :

func NewPositionToken

func NewPositionToken(position Position, indentation int) PositionToken

func (PositionToken) FetchPositionToken

func (p PositionToken) FetchPositionToken() PositionToken

func (PositionToken) Indentation

func (p PositionToken) Indentation() int

func (PositionToken) Position

func (p PositionToken) Position() Position

func (PositionToken) String

func (p PositionToken) String() string

type Range

type Range struct {
	// contains filtered or unexported fields
}

func MakeInclusiveRange

func MakeInclusiveRange(start Range, end Range) Range

func MakeRange

func MakeRange(start Position, end Position) Range

func NewPositionLength

func NewPositionLength(start Position, octetCountIncludingWhitespace int) Range

func NewPositionLengthFromEndPosition

func NewPositionLengthFromEndPosition(start Position, endPosition Position) Range

func RangeFromSameLineRanges added in v0.0.5

func RangeFromSameLineRanges(ranges []SameLineRange) Range

func RangeFromSingleSameLineRange added in v0.0.5

func RangeFromSingleSameLineRange(singleRange SameLineRange) Range

func (Range) Contains

func (p Range) Contains(pos Position) bool

func (Range) ContainsRange added in v0.0.5

func (p Range) ContainsRange(other Range) bool

func (Range) ContainsSameLineRanges added in v0.0.5

func (p Range) ContainsSameLineRanges(other []SameLineRange) bool

func (Range) End

func (p Range) End() Position

func (Range) IsAfter

func (p Range) IsAfter(other Range) bool

func (Range) IsEqual added in v0.0.5

func (p Range) IsEqual(other Range) bool

func (Range) OctetCount added in v0.0.2

func (p Range) OctetCount() int

func (Range) Position

func (p Range) Position() Position

func (Range) RuneWidth

func (p Range) RuneWidth() int

func (Range) SmallerThan

func (p Range) SmallerThan(other Range) bool

func (Range) Start

func (p Range) Start() Position

func (Range) String

func (p Range) String() string

type ResourceName

type ResourceName struct {
	SourceFileReference

	Indentation int
	// contains filtered or unexported fields
}

ResourceName :

func NewResourceName

func NewResourceName(raw string, startPosition SourceFileReference, indentation int) ResourceName

func (ResourceName) FetchIndentation

func (s ResourceName) FetchIndentation() int

func (ResourceName) FetchPositionLength

func (s ResourceName) FetchPositionLength() SourceFileReference

func (ResourceName) Name

func (s ResourceName) Name() string

func (ResourceName) Raw

func (s ResourceName) Raw() string

func (ResourceName) String

func (s ResourceName) String() string

func (ResourceName) Type

func (s ResourceName) Type() Type

type RuneToken

type RuneToken struct {
	SourceFileReference
	// contains filtered or unexported fields
}

RuneToken :

func NewRuneToken

func NewRuneToken(text rune, position SourceFileReference) RuneToken

func (RuneToken) FetchPositionLength

func (s RuneToken) FetchPositionLength() SourceFileReference

func (RuneToken) String

func (s RuneToken) String() string

func (RuneToken) Type

func (s RuneToken) Type() Type

type SameLineRange added in v0.0.5

type SameLineRange struct {
	Position         Position
	Length           int
	LocalOctetOffset int
}

func MakeSameLineRange added in v0.0.5

func MakeSameLineRange(start Position, length int, localOffset int) SameLineRange

func (SameLineRange) EndLocalStringOffset added in v0.0.5

func (s SameLineRange) EndLocalStringOffset() int

func (SameLineRange) LocalStringOffset added in v0.0.5

func (s SameLineRange) LocalStringOffset() int

func (SameLineRange) String added in v0.0.5

func (s SameLineRange) String() string

type SingleLineCommentToken

type SingleLineCommentToken struct {
	CommentToken
}

SingleLineCommentToken :

func NewSingleLineCommentToken

func NewSingleLineCommentToken(raw string, text string, forDocumentation bool, sourceFileReference SourceFileReference) SingleLineCommentToken

func (SingleLineCommentToken) FetchPositionLength

func (s SingleLineCommentToken) FetchPositionLength() SourceFileReference

func (SingleLineCommentToken) String

func (s SingleLineCommentToken) String() string

type SourceFileDocument

type SourceFileDocument struct {
	Uri DocumentURI
}

func MakeSourceFileDocument

func MakeSourceFileDocument(uri string) *SourceFileDocument

func MakeSourceFileDocumentFromLocalPath added in v0.0.4

func MakeSourceFileDocumentFromLocalPath(localPath string) *SourceFileDocument

func MakeSourceFileDocumentFromURI

func MakeSourceFileDocumentFromURI(uri DocumentURI) *SourceFileDocument

func NewInternalSourceFileDocument added in v0.0.9

func NewInternalSourceFileDocument() *SourceFileDocument

func (*SourceFileDocument) EqualTo

func (d *SourceFileDocument) EqualTo(uri DocumentURI) bool

func (*SourceFileDocument) String

func (d *SourceFileDocument) String() string

type SourceFileReference

type SourceFileReference struct {
	Range    Range
	Document *SourceFileDocument
}

func MakeInclusiveSourceFileReference

func MakeInclusiveSourceFileReference(start SourceFileReference, end SourceFileReference) SourceFileReference

func MakeSourceFileReference

func MakeSourceFileReference(uri *SourceFileDocument, tokenRange Range) SourceFileReference

func NewInternalSourceFileReference added in v0.0.9

func NewInternalSourceFileReference() SourceFileReference

func (SourceFileReference) String

func (s SourceFileReference) String() string

func (SourceFileReference) ToCompleteReferenceString

func (s SourceFileReference) ToCompleteReferenceString() string

func (SourceFileReference) ToReferenceString

func (s SourceFileReference) ToReferenceString() string

func (SourceFileReference) ToStandardReferenceString added in v0.0.4

func (s SourceFileReference) ToStandardReferenceString() string

type SourceFileReferenceProvider

type SourceFileReferenceProvider interface {
	FetchPositionLength() SourceFileReference
}

type SourceFileURI

type SourceFileURI struct {
	// contains filtered or unexported fields
}

func MakeSourceFileURI

func MakeSourceFileURI(name string) *SourceFileURI

func (*SourceFileURI) ReferenceString

func (s *SourceFileURI) ReferenceString() string

func (*SourceFileURI) ReferenceWithPositionString

func (s *SourceFileURI) ReferenceWithPositionString(pos Position) string

func (*SourceFileURI) String

func (s *SourceFileURI) String() string

type SpaceToken

type SpaceToken struct {
	SourceFileReference
	// contains filtered or unexported fields
}

SpaceToken :

func NewSpaceToken

func NewSpaceToken(position SourceFileReference, r rune) SpaceToken

func (SpaceToken) FetchPositionLength

func (s SpaceToken) FetchPositionLength() SourceFileReference

func (SpaceToken) String

func (s SpaceToken) String() string

func (SpaceToken) Type

func (s SpaceToken) Type() Type

type StringInterpolationString added in v0.0.4

type StringInterpolationString struct {
	// contains filtered or unexported fields
}

StringInterpolationString :

func NewStringInterpolationString added in v0.0.4

func NewStringInterpolationString(s StringToken) StringInterpolationString

func (StringInterpolationString) FetchPositionLength added in v0.0.4

func (s StringInterpolationString) FetchPositionLength() SourceFileReference

func (StringInterpolationString) String added in v0.0.4

func (s StringInterpolationString) String() string

func (StringInterpolationString) StringToken added in v0.0.4

func (s StringInterpolationString) StringToken() StringToken

func (StringInterpolationString) Type added in v0.0.4

type StringInterpolationTuple added in v0.0.4

type StringInterpolationTuple struct {
	// contains filtered or unexported fields
}

StringInterpolationTuple :

func NewStringInterpolationTuple added in v0.0.4

func NewStringInterpolationTuple(s StringToken) StringInterpolationTuple

func (StringInterpolationTuple) FetchPositionLength added in v0.0.4

func (s StringInterpolationTuple) FetchPositionLength() SourceFileReference

func (StringInterpolationTuple) String added in v0.0.4

func (s StringInterpolationTuple) String() string

func (StringInterpolationTuple) StringToken added in v0.0.4

func (s StringInterpolationTuple) StringToken() StringToken

func (StringInterpolationTuple) Type added in v0.0.4

func (s StringInterpolationTuple) Type() Type

type StringToken

type StringToken struct {
	SourceFileReference
	// contains filtered or unexported fields
}

StringToken :

func NewStringToken

func NewStringToken(raw string, text string, position SourceFileReference, stringLines []SameLineRange) StringToken

func (StringToken) CalculateRanges added in v0.0.5

func (s StringToken) CalculateRanges(start int, end int) []SameLineRange

func (StringToken) CalculateRangesWithOffset added in v0.0.5

func (s StringToken) CalculateRangesWithOffset(start int, end int, octetOffset int) []SameLineRange

func (StringToken) CalculateRangesWithOffsetAndString added in v0.0.5

func (s StringToken) CalculateRangesWithOffsetAndString(start int, end int, octetOffset int) ([]SameLineRange, string)

func (StringToken) DebugOutput added in v0.0.5

func (s StringToken) DebugOutput()

func (StringToken) FetchPositionLength

func (s StringToken) FetchPositionLength() SourceFileReference

func (StringToken) GetStringLinesFromLocalOctetOffset added in v0.0.5

func (s StringToken) GetStringLinesFromLocalOctetOffset(start int, end int) []SameLineRange

func (StringToken) Raw

func (s StringToken) Raw() string

func (StringToken) String

func (s StringToken) String() string

func (StringToken) StringLines added in v0.0.5

func (s StringToken) StringLines() []SameLineRange

func (StringToken) Text

func (s StringToken) Text() string

func (StringToken) Type

func (s StringToken) Type() Type

type Token

type Token interface {
	FetchPositionLength() SourceFileReference
	Type() Type
	String() string
}

Token :

type Type

type Type uint
const (
	OperatorPlus Type = iota
	OperatorMinus
	OperatorUnaryMinus
	OperatorMultiply
	OperatorDivide
	OperatorRemainder
	OperatorPipeRight
	OperatorPipeLeft
	OperatorArrowRight
	OperatorAnd
	OperatorOr
	OperatorGreater
	OperatorGreaterOrEqual
	OperatorLess
	OperatorLessOrEqual
	OperatorEqual
	OperatorNotEqual
	OperatorUnaryNot
	OperatorBitwiseOr
	OperatorBitwiseAnd
	OperatorBitwiseXor
	OperatorBitwiseNot
	OperatorBitwiseShiftLeft
	OperatorBitwiseShiftRight
	OperatorAppend
	OperatorCons
	Colon
	OperatorAssign
	Guard
	OperatorUpdate
	Accessor
	RightParen
	LeftParen
	RightCurlyBrace
	LeftCurlyBrace
	RightSquareBracket
	LeftSquareBracket
	LeftAngleBracket
	RightAngleBracket
	RightArrayBracket
	LeftArrayBracket
	Comma
	If
	Then
	Else
	Case
	Of
	Alias
	As
	Exposing
	TypeDef
	ExternalFunction
	Let
	In
	VariableSymbol
	ResourceNameSymbol
	TypeIdSymbol
	TypeSymbol
	Import
	BooleanType
	NumberInteger
	NumberFixed
	StringConstant
	StringInterpolationTupleConstant
	StringInterpolationStringConstant
	RuneConstant
	CommentConstant
	NewLine
	Space
	EOF
)

type TypeId

type TypeId struct {
	SourceFileReference

	Indentation int
	// contains filtered or unexported fields
}

TypeId :

func NewTypeId

func NewTypeId(raw string, startPosition SourceFileReference, indentation int) TypeId

func (TypeId) FetchIndentation

func (s TypeId) FetchIndentation() int

func (TypeId) FetchPositionLength

func (s TypeId) FetchPositionLength() SourceFileReference

func (TypeId) Name

func (s TypeId) Name() string

func (TypeId) Raw

func (s TypeId) Raw() string

func (TypeId) String

func (s TypeId) String() string

func (TypeId) Type

func (s TypeId) Type() Type

type TypeSymbolToken

type TypeSymbolToken struct {
	SourceFileReference

	Indentation int
	// contains filtered or unexported fields
}

VariableSymbolToken :

func NewTypeSymbolToken

func NewTypeSymbolToken(raw string, sourceFileReference SourceFileReference, indentation int) TypeSymbolToken

func (TypeSymbolToken) FetchIndentation

func (s TypeSymbolToken) FetchIndentation() int

func (TypeSymbolToken) FetchPositionLength

func (s TypeSymbolToken) FetchPositionLength() SourceFileReference

func (TypeSymbolToken) Name

func (s TypeSymbolToken) Name() string

func (TypeSymbolToken) Raw

func (s TypeSymbolToken) Raw() string

func (TypeSymbolToken) String

func (s TypeSymbolToken) String() string

func (TypeSymbolToken) Type

func (s TypeSymbolToken) Type() Type

type VariableSymbolToken

type VariableSymbolToken struct {
	SourceFileReference

	Indentation int
	// contains filtered or unexported fields
}

VariableSymbolToken :

func NewVariableSymbolToken

func NewVariableSymbolToken(raw string, startPosition SourceFileReference, indentation int) VariableSymbolToken

func (VariableSymbolToken) FetchIndentation

func (s VariableSymbolToken) FetchIndentation() int

func (VariableSymbolToken) FetchPositionLength

func (s VariableSymbolToken) FetchPositionLength() SourceFileReference

func (VariableSymbolToken) IsIgnore added in v0.0.4

func (s VariableSymbolToken) IsIgnore() bool

func (VariableSymbolToken) Name

func (s VariableSymbolToken) Name() string

func (VariableSymbolToken) Raw

func (s VariableSymbolToken) Raw() string

func (VariableSymbolToken) String

func (s VariableSymbolToken) String() string

func (VariableSymbolToken) Type

func (s VariableSymbolToken) Type() Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL