tlast

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ContactAuthorsString = "please check/create issue with example https://github.com/VKCOM/tl/issues" // TODO move to better place

Variables

This section is empty.

Functions

This section is empty.

Types

type Arithmetic

type Arithmetic struct {
	Nums []uint32
	Res  uint32
}

func (Arithmetic) IsEmpty

func (a Arithmetic) IsEmpty() bool

func (Arithmetic) StreamString added in v1.0.3

func (a Arithmetic) StreamString(qw422016 *qt422016.Writer)

func (Arithmetic) String

func (a Arithmetic) String() string

func (Arithmetic) WriteString added in v1.0.3

func (a Arithmetic) WriteString(qq422016 qtio422016.Writer)

type ArithmeticOrType

type ArithmeticOrType struct {
	IsArith bool
	Arith   Arithmetic
	T       TypeRef // PR of T can also be used for Arith
}

func (ArithmeticOrType) StreamString added in v1.0.3

func (aot ArithmeticOrType) StreamString(qw422016 *qt422016.Writer)

func (ArithmeticOrType) String

func (aot ArithmeticOrType) String() string

func (ArithmeticOrType) WriteString added in v1.0.3

func (aot ArithmeticOrType) WriteString(qq422016 qtio422016.Writer)

type Combinator

type Combinator struct {
	Builtin           bool
	IsFunction        bool
	Modifiers         []Modifier // TODO - rename to annotations
	Construct         Constructor
	TemplateArguments []TemplateArgument
	Fields            []Field
	TypeDecl          TypeDeclaration
	FuncDecl          TypeRef

	OriginalDescriptor *Combinator // hack - if some replacements were made, original descriptor is saved here
	OriginalOrderIndex int         // declaration order index (needed in TLO generation)

	TemplateArgumentsPR PositionRange // especially useful when 0 arguments
	PR                  PositionRange

	CommentBefore string // comment before combinator
	CommentRight  string // comment to the right of combinator
}

func (*Combinator) Crc32

func (descriptor *Combinator) Crc32() uint32

Crc32 returns tag of Combinator if tag not set explicitly Crc32 will calculate hash of Combinator in canonical form canonicalForm returns combinator in "canonical" form which is used for

  • combinator is written in one line
  • curly braces: '{', '}' are omitted
  • all tokens are separates from each other with one space
  • square brackets are also separated from content inside with one space example: "[ T ]"

func (Combinator) StreamString added in v1.0.3

func (descriptor Combinator) StreamString(qw422016 *qt422016.Writer)

func (Combinator) String

func (descriptor Combinator) String() string

func (Combinator) WriteString added in v1.0.3

func (descriptor Combinator) WriteString(qq422016 qtio422016.Writer)

type Constructor

type Constructor struct {
	Name Name
	ID   *uint32 // TODO - uint32 + bool IsExplicit

	NamePR PositionRange
	IDPR   PositionRange
}

func (Constructor) StreamString added in v1.0.3

func (c Constructor) StreamString(qw422016 *qt422016.Writer)

func (Constructor) String

func (c Constructor) String() string

func (Constructor) WriteString added in v1.0.3

func (c Constructor) WriteString(qq422016 qtio422016.Writer)

type Field

type Field struct {
	FieldName string
	Mask      *FieldMask
	Excl      bool

	IsRepeated  bool
	ScaleRepeat RepeatWithScale
	FieldType   TypeRef

	PR     PositionRange
	PRName PositionRange

	CommentBefore string // comment before field
	CommentRight  string // comment to the right of field
}

func (Field) StreamString added in v1.0.3

func (f Field) StreamString(qw422016 *qt422016.Writer)

func (Field) String

func (f Field) String() string

func (Field) WriteString added in v1.0.3

func (f Field) WriteString(qq422016 qtio422016.Writer)

type FieldMask

type FieldMask struct {
	MaskName  string
	BitNumber uint32

	PRName PositionRange
	PRBits PositionRange
}

func (FieldMask) StreamString added in v1.0.3

func (fm FieldMask) StreamString(qw422016 *qt422016.Writer)

func (FieldMask) String

func (fm FieldMask) String() string

func (FieldMask) WriteString added in v1.0.3

func (fm FieldMask) WriteString(qq422016 qtio422016.Writer)

type Modifier

type Modifier struct {
	Name string
	PR   PositionRange
}

type Name

type Name struct {
	Namespace string
	Name      string
}

func (Name) IsEmpty

func (n Name) IsEmpty() bool

func (Name) StreamString added in v1.0.3

func (n Name) StreamString(qw422016 *qt422016.Writer)

func (Name) String

func (n Name) String() string

func (Name) WriteString added in v1.0.3

func (n Name) WriteString(qq422016 qtio422016.Writer)

type ParseError

type ParseError struct {
	Err error

	Pos PositionRange
	// contains filtered or unexported fields
}

func BeautifulError2

func BeautifulError2(original *ParseError, compare *ParseError) *ParseError

func (*ParseError) ConsolePrint

func (e *ParseError) ConsolePrint(out io.Writer, outmostError error, isWarning bool)

func (ParseError) Error

func (e ParseError) Error() string

func (*ParseError) PrintWarning added in v1.0.6

func (e *ParseError) PrintWarning(out io.Writer, outmostError error)

func (ParseError) Unwrap

func (e ParseError) Unwrap() error

type Position

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

func (*Position) GetFile added in v1.0.3

func (p *Position) GetFile() string

func (Position) String

func (p Position) String() string

type PositionRange

type PositionRange struct {
	Outer Position // in lexer, it is empty, in parser set to start of combinator
	Begin Position
	End   Position
}

func (PositionRange) BeautifulError

func (pr PositionRange) BeautifulError(err error) *ParseError

func (PositionRange) CheckValidity

func (pr PositionRange) CheckValidity()

func (PositionRange) CollapseToBegin

func (pr PositionRange) CollapseToBegin() PositionRange

func (PositionRange) CollapseToEnd

func (pr PositionRange) CollapseToEnd() PositionRange

type RepeatWithScale

type RepeatWithScale struct {
	ExplicitScale bool
	Scale         ScaleFactor
	Rep           []Field

	PR PositionRange
}

func (RepeatWithScale) StreamString added in v1.0.3

func (rws RepeatWithScale) StreamString(qw422016 *qt422016.Writer)

func (RepeatWithScale) String

func (rws RepeatWithScale) String() string

func (RepeatWithScale) WriteString added in v1.0.3

func (rws RepeatWithScale) WriteString(qq422016 qtio422016.Writer)

type ScaleFactor

type ScaleFactor struct {
	IsArith bool
	Arith   Arithmetic
	Scale   string

	PR PositionRange
}

func (ScaleFactor) IsEmpty

func (sf ScaleFactor) IsEmpty() bool

func (ScaleFactor) StreamString added in v1.0.3

func (sf ScaleFactor) StreamString(qw422016 *qt422016.Writer)

func (ScaleFactor) String

func (sf ScaleFactor) String() string

func (ScaleFactor) WriteString added in v1.0.3

func (sf ScaleFactor) WriteString(qq422016 qtio422016.Writer)

type TL

type TL []*Combinator

func ParseTL

func ParseTL(str string) (TL, error)

func ParseTL2

func ParseTL2(str, file string, allowBuiltin, allowDirty bool) (TL, error)

ParseTL2 TL := TypesSection [ type ... ] FunctionSection [ function ... ] allowDirty - allows to use '_' (underscore) as constructor name

func ParseTLFile

func ParseTLFile(str, file string, allowDirty bool) (TL, error)

func (TL) Generate2TL added in v1.0.3

func (tl TL) Generate2TL() string

func (TL) GenerateTLO added in v1.0.4

func (tl TL) GenerateTLO() (tls.SchemaV4, error)

func (TL) GenerateTLOBytes added in v1.0.6

func (tl TL) GenerateTLOBytes() ([]byte, error)

func (TL) StreamGenerate2TL added in v1.0.3

func (tl TL) StreamGenerate2TL(qw422016 *qt422016.Writer)

func (TL) StreamString added in v1.0.3

func (tl TL) StreamString(qw422016 *qt422016.Writer)

func (TL) String

func (tl TL) String() string

func (TL) ToDot

func (tl TL) ToDot() string

func (TL) WriteGenerate2TL added in v1.0.3

func (tl TL) WriteGenerate2TL(qq422016 qtio422016.Writer)

func (TL) WriteString added in v1.0.3

func (tl TL) WriteString(qq422016 qtio422016.Writer)

type TemplateArgument

type TemplateArgument struct {
	FieldName string
	IsNat     bool
	PR        PositionRange // TODO - split into type and name
}

func (TemplateArgument) StreamString added in v1.0.3

func (ta TemplateArgument) StreamString(qw422016 *qt422016.Writer)

func (TemplateArgument) String

func (ta TemplateArgument) String() string

func (TemplateArgument) WriteString added in v1.0.3

func (ta TemplateArgument) WriteString(qq422016 qtio422016.Writer)

type TypeDeclaration

type TypeDeclaration struct {
	Name      Name
	Arguments []string

	PR          PositionRange
	NamePR      PositionRange
	ArgumentsPR []PositionRange
}

func (TypeDeclaration) StreamString added in v1.0.3

func (d TypeDeclaration) StreamString(qw422016 *qt422016.Writer)

func (TypeDeclaration) String

func (d TypeDeclaration) String() string

func (TypeDeclaration) WriteString added in v1.0.3

func (d TypeDeclaration) WriteString(qq422016 qtio422016.Writer)

type TypeRef

type TypeRef struct {
	Type Name
	Args []ArithmeticOrType
	Bare bool

	PR     PositionRange
	PRArgs PositionRange
}

func (TypeRef) IsEmpty

func (t TypeRef) IsEmpty() bool

func (TypeRef) StreamString added in v1.0.3

func (t TypeRef) StreamString(qw422016 *qt422016.Writer)

func (TypeRef) String

func (t TypeRef) String() string

func (TypeRef) WriteString added in v1.0.3

func (t TypeRef) WriteString(qq422016 qtio422016.Writer)

Directories

Path Synopsis
gentlo
constants
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
factory
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
internal
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
meta
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
tltls
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.
Code generated by vktl/cmd/tlgen2; DO NOT EDIT.

Jump to

Keyboard shortcuts

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