Documentation ¶
Index ¶
- Constants
- Variables
- type Argument
- type Atom
- type BodyToken
- type Branch
- type DefaultParseErrorHandler
- type File
- type For
- type GenericSymbol
- type If
- type Lexer
- type LexerImpl
- type Location
- type ParseErrorHandler
- type Reducer
- type ReducerImpl
- func (ReducerImpl) AddToBody(body []Statement, statement Statement) ([]Statement, error)
- func (ReducerImpl) AddToCaseList(cases []*Branch, predicate *Value, body []Statement) ([]*Branch, error)
- func (ReducerImpl) AddToElseIfList(elseIfs []*Branch, predicate *Value, body []Statement) ([]*Branch, error)
- func (ReducerImpl) AtomToStatement(atom Statement) (Statement, error)
- func (ReducerImpl) BreakToAtom(break_ *Atom) (Statement, error)
- func (ReducerImpl) CaseToCaseList(predicate *Value, body []Statement) ([]*Branch, error)
- func (ReducerImpl) CommentToAtom(comment *Atom) (Statement, error)
- func (ReducerImpl) ContinueToAtom(cont *Atom) (Statement, error)
- func (ReducerImpl) CopySectionToAtom(copySection *Atom) (Statement, error)
- func (ReducerImpl) DefaultToOptionalDefault(default_ *TToken, body []Statement) (*Branch, error)
- func (ReducerImpl) ElseToOptionalElse(else_ *TToken, body []Statement) (*Branch, error)
- func (ReducerImpl) EmbedToAtom(embed *Atom) (Statement, error)
- func (ReducerImpl) ErrorToAtom(err *Atom) (Statement, error)
- func (ReducerImpl) ForToStatement(for_ Statement) (Statement, error)
- func (ReducerImpl) IfToStatement(if_ Statement) (Statement, error)
- func (ReducerImpl) ImportsToOptionalImports(imports *Value) (*Value, error)
- func (ReducerImpl) NilToBody() ([]Statement, error)
- func (ReducerImpl) NilToElseIfList() ([]*Branch, error)
- func (ReducerImpl) NilToOptionalDefault() (*Branch, error)
- func (ReducerImpl) NilToOptionalElse() (*Branch, error)
- func (ReducerImpl) NilToOptionalImports() (*Value, error)
- func (ReducerImpl) ReturnToAtom(ret *Atom) (Statement, error)
- func (ReducerImpl) SubstitutionToAtom(sub *Atom) (Statement, error)
- func (ReducerImpl) SwitchToStatement(switch_ Statement) (Statement, error)
- func (ReducerImpl) TextToAtom(text *Atom) (Statement, error)
- func (ReducerImpl) ToFile(pkg *Value, imports *Value, template *TemplateDeclaration, ...) (*File, error)
- func (ReducerImpl) ToFor(for_ *Value, body []Statement, end *TToken) (Statement, error)
- func (ReducerImpl) ToIf(predicate *Value, body []Statement, elseIfs []*Branch, else_ *Branch, ...) (Statement, error)
- func (ReducerImpl) WithWhitespaceToSwitch(switch_ *Value, whitespace *Atom, cases []*Branch, default_ *Branch, ...) (Statement, error)
- func (ReducerImpl) WithoutWhitespaceToSwitch(switch_ *Value, cases []*Branch, default_ *Branch, end *TToken) (Statement, error)
- type Statement
- type Switch
- type Symbol
- type SymbolId
- type TToken
- type TemplateDeclaration
- type Token
- type Value
Constants ¶
View Source
const ( SectionMarkerToken = SymbolId(256) PackageToken = SymbolId(257) ImportToken = SymbolId(258) TemplateDeclToken = SymbolId(259) ForToken = SymbolId(260) SwitchToken = SymbolId(261) CaseToken = SymbolId(262) IfToken = SymbolId(263) ElseIfToken = SymbolId(264) DefaultToken = SymbolId(265) ElseToken = SymbolId(266) EndToken = SymbolId(267) TextToken = SymbolId(268) SubstitutionToken = SymbolId(269) EmbedToken = SymbolId(270) CopySectionToken = SymbolId(271) CommentToken = SymbolId(272) ContinueToken = SymbolId(273) BreakToken = SymbolId(274) ReturnToken = SymbolId(275) ErrorToken = SymbolId(276) )
View Source
const ( FileType = SymbolId(277) OptionalImportsType = SymbolId(278) BodyType = SymbolId(279) StatementType = SymbolId(280) AtomType = SymbolId(281) ForType = SymbolId(282) SwitchType = SymbolId(283) CaseListType = SymbolId(284) OptionalDefaultType = SymbolId(285) IfType = SymbolId(286) ElseIfListType = SymbolId(287) OptionalElseType = SymbolId(288) )
Variables ¶
View Source
var (
OutputablePrimitiveTypes = []string{
"bool",
"uint",
"uint8",
"uint16",
"uint32",
"uint64",
"int",
"int8",
"int16",
"int32",
"int64",
"float32",
"float64",
"complex64",
"complex128",
}
)
Functions ¶
This section is empty.
Types ¶
type BodyToken ¶
type BodyToken interface { Token // When true, and the previous statement is text, remove the whitespaces // in the text that are adjacent to this statement, potentially up to and // including the previous line's newline character. TrimLeadingWhitespaces() bool // When true, and the next statement is text, remove the whitespaces // in the text taht are adjacent to this statement, potentially up to and // including the current line's newline character. TrimTrailingWhitespaces() bool }
type DefaultParseErrorHandler ¶
type DefaultParseErrorHandler struct{}
func (DefaultParseErrorHandler) Error ¶
func (DefaultParseErrorHandler) Error(nextToken Token, stack _Stack) error
type File ¶
type File struct { PackageName string Imports string *TemplateDeclaration Body []Statement }
func ParseWithCustomErrorHandler ¶
func ParseWithCustomErrorHandler( lexer Lexer, reducer Reducer, errHandler ParseErrorHandler) ( *File, error)
type GenericSymbol ¶
func (*GenericSymbol) Id ¶
func (t *GenericSymbol) Id() SymbolId
func (*GenericSymbol) Loc ¶
func (t *GenericSymbol) Loc() Location
type If ¶
func (If) IsStatement ¶
func (If) IsStatement()
type Lexer ¶
type LexerImpl ¶
type LexerImpl struct {
// contains filtered or unexported fields
}
func (*LexerImpl) CurrentLocation ¶
type Location ¶
func (Location) ShortString ¶
type ParseErrorHandler ¶
type Reducer ¶
type Reducer interface { // 22:8: file -> ... ToFile(Package_ *Value, OptionalImports_ *Value, TemplateDecl_ *TemplateDeclaration, SectionMarker_ *GenericSymbol, Body_ []Statement) (*File, error) // 29:4: optional_imports -> imports: ... ImportsToOptionalImports(Import_ *Value) (*Value, error) // 30:4: optional_imports -> nil: ... NilToOptionalImports() (*Value, error) // 33:4: body -> add: ... AddToBody(Body_ []Statement, Statement_ Statement) ([]Statement, error) // 34:4: body -> nil: ... NilToBody() ([]Statement, error) // 37:4: statement -> atom: ... AtomToStatement(Atom_ Statement) (Statement, error) // 38:4: statement -> for: ... ForToStatement(For_ Statement) (Statement, error) // 39:4: statement -> switch: ... SwitchToStatement(Switch_ Statement) (Statement, error) // 40:4: statement -> if: ... IfToStatement(If_ Statement) (Statement, error) // 43:4: atom -> text: ... TextToAtom(Text_ *Atom) (Statement, error) // 44:4: atom -> substitution: ... SubstitutionToAtom(Substitution_ *Atom) (Statement, error) // 45:4: atom -> embed: ... EmbedToAtom(Embed_ *Atom) (Statement, error) // 46:4: atom -> copy_section: ... CopySectionToAtom(CopySection_ *Atom) (Statement, error) // 47:4: atom -> comment: ... CommentToAtom(Comment_ *Atom) (Statement, error) // 48:4: atom -> continue: ... ContinueToAtom(Continue_ *Atom) (Statement, error) // 49:4: atom -> break: ... BreakToAtom(Break_ *Atom) (Statement, error) // 50:4: atom -> return: ... ReturnToAtom(Return_ *Atom) (Statement, error) // 51:4: atom -> error: ... ErrorToAtom(Error_ *Atom) (Statement, error) // 53:7: for -> ... ToFor(For_ *Value, Body_ []Statement, End_ *TToken) (Statement, error) // 57:4: switch -> with_whitespace: ... WithWhitespaceToSwitch(Switch_ *Value, Text_ *Atom, CaseList_ []*Branch, OptionalDefault_ *Branch, End_ *TToken) (Statement, error) // 58:4: switch -> without_whitespace: ... WithoutWhitespaceToSwitch(Switch_ *Value, CaseList_ []*Branch, OptionalDefault_ *Branch, End_ *TToken) (Statement, error) // 61:4: case_list -> add: ... AddToCaseList(CaseList_ []*Branch, Case_ *Value, Body_ []Statement) ([]*Branch, error) // 62:4: case_list -> case: ... CaseToCaseList(Case_ *Value, Body_ []Statement) ([]*Branch, error) // 65:4: optional_default -> default: ... DefaultToOptionalDefault(Default_ *TToken, Body_ []Statement) (*Branch, error) // 66:4: optional_default -> nil: ... NilToOptionalDefault() (*Branch, error) // 68:6: if -> ... ToIf(If_ *Value, Body_ []Statement, ElseIfList_ []*Branch, OptionalElse_ *Branch, End_ *TToken) (Statement, error) // 71:4: else_if_list -> add: ... AddToElseIfList(ElseIfList_ []*Branch, ElseIf_ *Value, Body_ []Statement) ([]*Branch, error) // 72:4: else_if_list -> nil: ... NilToElseIfList() ([]*Branch, error) // 75:4: optional_else -> else: ... ElseToOptionalElse(Else_ *TToken, Body_ []Statement) (*Branch, error) // 76:4: optional_else -> nil: ... NilToOptionalElse() (*Branch, error) }
type ReducerImpl ¶
type ReducerImpl struct{}
func (ReducerImpl) AddToBody ¶
func (ReducerImpl) AddToBody( body []Statement, statement Statement) ( []Statement, error)
func (ReducerImpl) AddToCaseList ¶
func (ReducerImpl) AddToElseIfList ¶
func (ReducerImpl) AtomToStatement ¶
func (ReducerImpl) AtomToStatement(atom Statement) (Statement, error)
func (ReducerImpl) BreakToAtom ¶
func (ReducerImpl) BreakToAtom(break_ *Atom) (Statement, error)
func (ReducerImpl) CaseToCaseList ¶
func (ReducerImpl) CaseToCaseList( predicate *Value, body []Statement) ( []*Branch, error)
func (ReducerImpl) CommentToAtom ¶
func (ReducerImpl) CommentToAtom(comment *Atom) (Statement, error)
func (ReducerImpl) ContinueToAtom ¶
func (ReducerImpl) ContinueToAtom(cont *Atom) (Statement, error)
func (ReducerImpl) CopySectionToAtom ¶
func (ReducerImpl) CopySectionToAtom(copySection *Atom) (Statement, error)
func (ReducerImpl) DefaultToOptionalDefault ¶
func (ReducerImpl) DefaultToOptionalDefault( default_ *TToken, body []Statement) ( *Branch, error)
func (ReducerImpl) ElseToOptionalElse ¶
func (ReducerImpl) ElseToOptionalElse( else_ *TToken, body []Statement) ( *Branch, error)
func (ReducerImpl) EmbedToAtom ¶
func (ReducerImpl) EmbedToAtom(embed *Atom) (Statement, error)
func (ReducerImpl) ErrorToAtom ¶
func (ReducerImpl) ErrorToAtom(err *Atom) (Statement, error)
func (ReducerImpl) ForToStatement ¶
func (ReducerImpl) ForToStatement(for_ Statement) (Statement, error)
func (ReducerImpl) IfToStatement ¶
func (ReducerImpl) IfToStatement(if_ Statement) (Statement, error)
func (ReducerImpl) ImportsToOptionalImports ¶
func (ReducerImpl) ImportsToOptionalImports(imports *Value) (*Value, error)
func (ReducerImpl) NilToBody ¶
func (ReducerImpl) NilToBody() ([]Statement, error)
func (ReducerImpl) NilToElseIfList ¶
func (ReducerImpl) NilToElseIfList() ([]*Branch, error)
func (ReducerImpl) NilToOptionalDefault ¶
func (ReducerImpl) NilToOptionalDefault() (*Branch, error)
func (ReducerImpl) NilToOptionalElse ¶
func (ReducerImpl) NilToOptionalElse() (*Branch, error)
func (ReducerImpl) NilToOptionalImports ¶
func (ReducerImpl) NilToOptionalImports() (*Value, error)
func (ReducerImpl) ReturnToAtom ¶
func (ReducerImpl) ReturnToAtom(ret *Atom) (Statement, error)
func (ReducerImpl) SubstitutionToAtom ¶
func (ReducerImpl) SubstitutionToAtom(sub *Atom) (Statement, error)
func (ReducerImpl) SwitchToStatement ¶
func (ReducerImpl) SwitchToStatement(switch_ Statement) (Statement, error)
func (ReducerImpl) TextToAtom ¶
func (ReducerImpl) TextToAtom(text *Atom) (Statement, error)
func (ReducerImpl) ToFile ¶
func (ReducerImpl) ToFile( pkg *Value, imports *Value, template *TemplateDeclaration, sectionMarker *GenericSymbol, body []Statement) ( *File, error)
func (ReducerImpl) WithWhitespaceToSwitch ¶
func (ReducerImpl) WithoutWhitespaceToSwitch ¶
type Switch ¶
func (Switch) IsStatement ¶
func (Switch) IsStatement()
type Symbol ¶
type SymbolId ¶
type SymbolId int
func ExpectedTerminals ¶
func ExpectedTerminals(id _StateId) []SymbolId
type TToken ¶
type TToken struct { GenericSymbol // contains filtered or unexported fields }
func (*TToken) TrimLeadingWhitespaces ¶
func (*TToken) TrimTrailingWhitespaces ¶
type TemplateDeclaration ¶
type TemplateDeclaration struct { GenericSymbol TemplateName string Arguments []Argument }
func NewTemplateDeclaration ¶
func NewTemplateDeclaration( loc Location, name string, args []Argument) *TemplateDeclaration
Source Files ¶
Click to show internal directories.
Click to hide internal directories.