processor

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(text string, filepath string, parserOptions ParserOptions) (*syntax.File, error)

func Print

func Print(originalText string, filepath string, syntaxOptions SyntaxOptions) (string, error)

Types

type Comment

type Comment struct {
	Hash Pos
	Text string
	Pos  Pos
	End  Pos
}

func (Comment) MarshalEasyJSON

func (v Comment) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Comment) MarshalJSON

func (v Comment) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Comment) UnmarshalEasyJSON

func (v *Comment) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Comment) UnmarshalJSON

func (v *Comment) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type File

type File struct {
	Name string
	Stmt []Stmt
	Last []Comment
	Pos  Pos
	End  Pos
}

func MapFile

func MapFile(file syntax.File) File

func (File) MarshalEasyJSON

func (v File) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (File) MarshalJSON

func (v File) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*File) UnmarshalEasyJSON

func (v *File) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*File) UnmarshalJSON

func (v *File) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Lit

type Lit struct {
	ValuePos Pos
	ValueEnd Pos
	Value    string
	Pos      Pos
	End      Pos
}

func (Lit) MarshalEasyJSON

func (v Lit) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Lit) MarshalJSON

func (v Lit) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Lit) UnmarshalEasyJSON

func (v *Lit) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Lit) UnmarshalJSON

func (v *Lit) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Node

type Node struct {
	Pos Pos
	End Pos
}

func (Node) MarshalEasyJSON

func (v Node) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Node) MarshalJSON

func (v Node) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Node) UnmarshalEasyJSON

func (v *Node) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Node) UnmarshalJSON

func (v *Node) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ParseError

type ParseError struct {
	syntax.ParseError
	Pos Pos
}

func MapParseError

func MapParseError(err error) (*ParseError, string)

func (ParseError) MarshalEasyJSON

func (v ParseError) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ParseError) MarshalJSON

func (v ParseError) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ParseError) UnmarshalEasyJSON

func (v *ParseError) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ParseError) UnmarshalJSON

func (v *ParseError) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ParserOptions

type ParserOptions struct {
	KeepComments bool
	StopAt       string
	Variant      syntax.LangVariant
}

type Pos

type Pos struct {
	Offset uint
	Line   uint
	Col    uint
}

func (Pos) MarshalEasyJSON

func (v Pos) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Pos) MarshalJSON

func (v Pos) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Pos) UnmarshalEasyJSON

func (v *Pos) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Pos) UnmarshalJSON

func (v *Pos) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PrinterOptions

type PrinterOptions struct {
	Indent           uint
	BinaryNextLine   bool
	SwitchCaseIndent bool
	SpaceRedirects   bool
	KeepPadding      bool
	Minify           bool
	FunctionNextLine bool
}

type Redirect

type Redirect struct {
	OpPos Pos
	Op    string
	N     *Lit
	Word  *Word
	Hdoc  *Word
	Pos   Pos
	End   Pos
}

func (Redirect) MarshalEasyJSON

func (v Redirect) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Redirect) MarshalJSON

func (v Redirect) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Redirect) UnmarshalEasyJSON

func (v *Redirect) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Redirect) UnmarshalJSON

func (v *Redirect) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Result

type Result struct {
	File        `json:"file"`
	Text        string `json:"text"`
	*ParseError `json:"parseError"`
	Message     string `json:"message"`
}

func (Result) MarshalEasyJSON

func (v Result) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Result) MarshalJSON

func (v Result) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Result) UnmarshalEasyJSON

func (v *Result) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Result) UnmarshalJSON

func (v *Result) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Stmt

type Stmt struct {
	Comments   []Comment
	Cmd        *Node
	Position   Pos
	Semicolon  Pos
	Negated    bool
	Background bool
	Coprocess  bool
	Redirs     []Redirect
	Pos        Pos
	End        Pos
}

func (Stmt) MarshalEasyJSON

func (v Stmt) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Stmt) MarshalJSON

func (v Stmt) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Stmt) UnmarshalEasyJSON

func (v *Stmt) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Stmt) UnmarshalJSON

func (v *Stmt) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SyntaxOptions

type SyntaxOptions struct {
	ParserOptions
	PrinterOptions
}

type Word

type Word struct {
	Parts []Node
	Lit   string
	Pos   Pos
	End   Pos
}

func (Word) MarshalEasyJSON

func (v Word) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Word) MarshalJSON

func (v Word) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Word) UnmarshalEasyJSON

func (v *Word) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Word) UnmarshalJSON

func (v *Word) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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