Documentation
¶
Index ¶
- Variables
- type As
- type AsClause
- type Association
- type At
- type AtClause
- type Backtick
- type BlockLit
- type Call
- type CloseBrace
- type CloseBracket
- type CloseParen
- type Comment
- type Comments
- type Condition
- type Decl
- type Else
- type ElseIfStmt
- type ElseStmt
- type Entry
- type Expr
- type ExprList
- type ExprStmt
- type Field
- type FieldDefault
- type FieldList
- type FieldStmt
- type For
- type ForHeader
- type ForStmt
- type From
- type Func
- type FuncDecl
- type Group
- type Heredoc
- type HeredocEnd
- type HeredocFragment
- type Ident
- type If
- type IfStmt
- type Import
- type ImportDecl
- type In
- type Interpolated
- type Literal
- type Modifier
- type Module
- type Newline
- type NumericLit
- type Op
- type OpenBrace
- type OpenBracket
- type OpenInterpolated
- type OpenParen
- type Public
- type Quote
- type RawHeredoc
- type RawString
- type Ref
- type RefNext
- type Selector
- type Splat
- type Stmt
- type StmtList
- type String
- type StringFragment
- type StringLit
- type Subscript
- type Terminal
- type Type
- type Unary
- type With
- type WithClause
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Lexer = lexer.MustStateful(lexer.Rules{ "Root": { {"whitespace", `[\r\t ]+`, nil}, {"Modifier", `\b(pub)\b`, nil}, {"Keyword", `\b(if|else|for|in|with|as|import|fun)\b`, nil}, {"Numeric", `\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\b`, nil}, {"Decimal", `\b(0|[1-9][0-9]*)\b`, nil}, {"Bool", `\b(true|false)\b`, nil}, {"String", `"`, lexer.Push("String")}, {"RawString", "`", lexer.Push("RawString")}, {"Heredoc", `<<[-~]?(\w+)`, lexer.Push("Heredoc")}, {"RawHeredoc", "<<[-~]?`(\\w+)`", lexer.Push("RawHeredoc")}, {"Brace", `{`, lexer.Push("Brace")}, {"Paren", `\(`, lexer.Push("Paren")}, {"Bracket", `\[`, lexer.Push("Bracket")}, {"Ident", `\b([[:alpha:]_]\w*)\b`, nil}, {"Operator", `(>=|<=|&&|\|\||==|!=|[-+=*/%<>^!|&])`, nil}, {"Punct", `[@:;?.,]`, nil}, {"Newline", `\n`, nil}, {"Comment", `#`, lexer.Push("Comment")}, }, "String": { {"StringEnd", `"`, lexer.Pop()}, {"Escaped", `\\.`, nil}, {"Interpolated", `\${`, lexer.Push("Interpolated")}, {"Char", `\$|[^"$\\]+`, nil}, }, "RawString": { {"RawStringEnd", "`", lexer.Pop()}, {"RawChar", "[^`]+", nil}, }, "Heredoc": { {"HeredocEnd", `\b\1\b`, lexer.Pop()}, {"Spaces", `\s+`, nil}, {"Escaped", `\\.`, nil}, {"Interpolated", `\${`, lexer.Push("Interpolated")}, {"Text", `\$|[^\s$]+`, nil}, }, "RawHeredoc": { {"RawHeredocEnd", `\b\1\b`, lexer.Pop()}, {"Whitespace", `\s+`, nil}, {"RawText", `[^\s]+`, nil}, }, "Interpolated": { {"BraceEnd", `}`, lexer.Pop()}, lexer.Include("Root"), }, "Brace": { {"BraceEnd", `}`, lexer.Pop()}, lexer.Include("Root"), }, "Paren": { {"ParenEnd", `\)`, lexer.Pop()}, lexer.Include("Root"), }, "Bracket": { {"BracketEnd", `\]`, lexer.Pop()}, lexer.Include("Root"), }, "Comment": { {"CommentEnd", `\n`, lexer.Pop()}, {"CommentText", `[^\n]`, nil}, }, }) Parser = participle.MustBuild( &Module{}, participle.Lexer(&semicolonLexerDefinition{}), ) )
Functions ¶
This section is empty.
Types ¶
type Association ¶
type Call ¶
type Call struct { Args *ExprList `parser:"@@?"` At *AtClause `parser:"@@?"` With *WithClause `parser:"@@?"` As *AsClause `parser:"@@?"` }
type CloseBrace ¶
type CloseBrace struct {
Text string `parser:"@BraceEnd"`
}
type CloseBracket ¶
type CloseBracket struct {
Text string `parser:"@BracketEnd"`
}
type CloseParen ¶
type CloseParen struct {
Text string `parser:"@ParenEnd"`
}
type Condition ¶
type Condition struct { OpenParen *OpenParen `parser:"@@"` Expr *Expr `parser:"@@"` CloseParen *CloseParen `parser:"@@"` }
type Decl ¶
type Decl struct { Import *ImportDecl `parser:"( @@ ';'?"` Func *FuncDecl `parser:"| @@ ';'?"` Newline *Newline `parser:"| @@"` Comments *Comments `parser:"| @@ )"` }
type ElseIfStmt ¶
type ExprList ¶
type ExprList struct { OpenParen *OpenParen `parser:"@@"` Exprs []*ExprStmt `parser:"@@*"` CloseParen *CloseParen `parser:"@@"` }
type Field ¶
type Field struct { Type *Type `parser:"@@"` Variadic *string `parser:"@( '.' '.' '.' )?"` Name *Ident `parser:"@@"` Default *FieldDefault `parser:"@@?"` }
type FieldDefault ¶
type FieldList ¶
type FieldList struct { OpenParen *OpenParen `parser:"@@"` Fields []*FieldStmt `parser:"@@*"` CloseParen *CloseParen `parser:"@@"` }
type Group ¶
type Group struct { OpenParen *OpenParen `parser:"@@"` Expr *Expr `parser:"@@"` CloseParen *CloseParen `parser:"@@"` }
type Heredoc ¶
type Heredoc struct { Value string Start string `parser:"@Heredoc"` Fragments []*HeredocFragment `parser:"@@*"` End *HeredocEnd `parser:"@@"` }
type HeredocEnd ¶
type HeredocEnd struct {
Text string `parser:"@(HeredocEnd | RawHeredocEnd)"`
}
type HeredocFragment ¶
type HeredocFragment struct { Spaces *string `parser:"( @Spaces"` Escaped *string `parser:"| @Escaped"` Interpolated *Interpolated `parser:"| @@"` Text *string `parser:"| @(Text | RawText) )"` }
type IfStmt ¶
type IfStmt struct { If *If `parser:"@@"` Condition *Condition `parser:"@@"` Body *StmtList `parser:"@@"` ElseIfs []*ElseIfStmt `parser:"@@*"` Else *ElseStmt `parser:"@@?"` }
type ImportDecl ¶
type Interpolated ¶
type Interpolated struct { Start *OpenInterpolated `parser:"@@"` Expr *Expr `parser:"@@?"` End *CloseBrace `parser:"@@"` }
type Literal ¶
type Literal struct { Block *BlockLit `parser:"( @@"` Decimal *int `parser:"| @Decimal"` Numeric *NumericLit `parser:"| @Numeric"` Bool *bool `parser:"| @Bool"` String *StringLit `parser:"| @@ )"` }
type NumericLit ¶
func (*NumericLit) Capture ¶
func (l *NumericLit) Capture(tokens []string) error
type OpenBracket ¶
type OpenBracket struct {
Text string `parser:"@Bracket"`
}
type OpenInterpolated ¶
type OpenInterpolated struct {
Text string `parser:"@Interpolated"`
}
type RawHeredoc ¶
type RawHeredoc struct { Start string `parser:"@RawHeredoc"` Fragments []*HeredocFragment `parser:"@@*"` End *HeredocEnd `parser:"@@"` }
type StmtList ¶
type StmtList struct { OpenBrace *OpenBrace `parser:"@@"` Stmts []*Stmt `parser:"@@*"` CloseBrace *CloseBrace `parser:"@@"` }
type String ¶
type String struct { Start *Quote `parser:"@@"` Fragments []*StringFragment `parser:"@@*"` End *Quote `parser:"@@"` }
type StringFragment ¶
type StringFragment struct { Escaped *string `parser:"( @Escaped"` Interpolated *Interpolated `parser:"| @@"` Text *string `parser:"| @Char )"` }
type StringLit ¶
type StringLit struct { String *String `parser:"( @@"` RawString *RawString `parser:"| @@"` Heredoc *Heredoc `parser:"| @@"` RawHeredoc *RawHeredoc `parser:"| @@ )"` }
type Subscript ¶
type Subscript struct { OpenBracket *OpenBracket `parser:"@@"` LeftExpr *Expr `parser:"( @@?"` Colon *string `parser:"@':'?"` RightExpr *Expr `parser:"@@? )!"` CloseBracket *CloseBracket `parser:"@@"` }
type Type ¶
type Type struct { Scalar *Ident `parser:"( @@"` Array *Type `parser:"| '[' ']' @@ )"` Association *Association `parser:"@@?"` }
type WithClause ¶
Click to show internal directories.
Click to hide internal directories.