Documentation ¶
Overview ¶
Package parser parses Encore applications into an Encore Syntax Tree (EST).
Index ¶
- func ParseMeta(appRevision string, appHasUncommittedChanges bool, appRoot string, ...) (*meta.Data, map[*est.Package]TraceNodes, error)
- type Config
- type LiteralStruct
- func (l *LiteralStruct) DynamicFields() map[string]ast.Expr
- func (l *LiteralStruct) Expr(fieldName string) ast.Expr
- func (l *LiteralStruct) FullyConstant() bool
- func (l *LiteralStruct) Int64(fieldName string, defaultValue int64) int64
- func (l *LiteralStruct) IsSet(fieldName string) bool
- func (l *LiteralStruct) Lit() *ast.CompositeLit
- func (l *LiteralStruct) Pos(fieldName string) token.Pos
- func (l *LiteralStruct) Str(fieldName string, defaultValue string) string
- func (l *LiteralStruct) Value(fieldName string) constant.Value
- type Result
- type TraceNodes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { AppRoot string AppRevision string AppHasUncommittedChanges bool ModulePath string WorkingDir string ParseTests bool }
Config represents the configuration options for parsing. TODO(domblack): Remove AppRevision and AppHasUncommittedChanges from here as it's compiler concern not a parser concern
type LiteralStruct ¶ added in v1.3.0
type LiteralStruct struct {
// contains filtered or unexported fields
}
LiteralStruct represents a struct literal at compile time
func (*LiteralStruct) DynamicFields ¶ added in v1.3.0
func (l *LiteralStruct) DynamicFields() map[string]ast.Expr
DynamicFields returns the names of the fields and ast.Expr that are not constant
Child structs will be included with the field name prefixed with the struct name; i.e. `parentField.childField`
func (*LiteralStruct) Expr ¶ added in v1.3.0
func (l *LiteralStruct) Expr(fieldName string) ast.Expr
Expr returns ast.Expr for the given field name.
If the field is known, it returns the ast.Expr If the field is not known, it returns nil
You can reference a child struct field with `.`; i.e. `parent.child`
func (*LiteralStruct) FullyConstant ¶ added in v1.3.0
func (l *LiteralStruct) FullyConstant() bool
FullyConstant returns true if every value in this struct and the child structs fully known as compile time as a constant value
func (*LiteralStruct) Int64 ¶ added in v1.3.0
func (l *LiteralStruct) Int64(fieldName string, defaultValue int64) int64
Int64 returns the value of the field as an int64
This function will convert other number types into an Int64, but will not convert strings. If after conversion the value is 0, the defaultValue will be returned
You can reference a child struct field with `.`; i.e. `parent.child`
func (*LiteralStruct) IsSet ¶ added in v1.3.0
func (l *LiteralStruct) IsSet(fieldName string) bool
IsSet returns true if the given field is set in this struct
You can reference a child struct field with `.`; i.e. `parent.child`
func (*LiteralStruct) Lit ¶ added in v1.7.0
func (l *LiteralStruct) Lit() *ast.CompositeLit
func (*LiteralStruct) Pos ¶ added in v1.3.0
func (l *LiteralStruct) Pos(fieldName string) token.Pos
Pos returns the position of the field in the source code
If the field is not found, the closest position to where the field should have been will be returned
You can reference a child struct field with `.`; i.e. `parent.child`
func (*LiteralStruct) Str ¶ added in v1.3.0
func (l *LiteralStruct) Str(fieldName string, defaultValue string) string
Str returns the value of the field as an string
This function will convert all types to a string If after conversion the value is "", the defaultValue will be returned
You can reference a child struct field with `.`; i.e. `parent.child`
func (*LiteralStruct) Value ¶ added in v1.3.0
func (l *LiteralStruct) Value(fieldName string) constant.Value
Value returns the value of the field as a constant.Value. If the field is not constant or does not exist, an unknown value will be returned
You can reference a child struct field with `.`; i.e. `parent.child`