Documentation
¶
Index ¶
- func AutoQuote(s string) string
- func ClassExt(fname string) string
- func Format(f *FileSyntax) []byte
- func IsDirectoryPath(ns string) bool
- func MustQuote(s string) bool
- func SplitFname(fname string) (className, classExt string)
- type Class
- type Comment
- type CommentBlock
- type Comments
- type Compiler
- type Error
- type ErrorList
- type Expr
- type File
- type FileSyntax
- type Import
- type InvalidExtError
- type InvalidSymbolError
- type LParen
- type Line
- type LineBlock
- type Position
- type Project
- type RParen
- type Runner
- type VersionFixer
- type XGo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoQuote ¶
AutoQuote returns s or, if quoting is required for s to appear in a gox.mod, the quotation of s.
func Format ¶
func Format(f *FileSyntax) []byte
Format returns a gox.mod file as a byte slice, formatted in standard style.
func IsDirectoryPath ¶
IsDirectoryPath reports whether the given path should be interpreted as a directory path. Just like on the go command line, relative paths and rooted paths are directory paths; the rest are module paths.
func MustQuote ¶
MustQuote reports whether s must be quoted in order to appear as a single token in a gox.mod line.
func SplitFname ¶ added in v0.12.1
SplitFname splits fname into (className, classExt).
Types ¶
type Class ¶ added in v0.10.0
type Class struct {
Ext string // can be "_[class].gox" or ".[class]", eg. "_yap.gox" or ".spx"
FullExt string // can be "*_[class].gox", "_[class].gox", "*.[class]" or ".[class]"
Class string // "Sprite"
Proto string // prototype of the work class (not empty if multiple work classes)
Prefix string // prefix of the work class
Embedded bool // if true, the class instance will be embedded in the project
Syntax *Line
}
A Class is the work class statement.
type CommentBlock ¶
type CommentBlock = modfile.CommentBlock
A CommentBlock represents a top-level block of comments separate from any rule.
type File ¶
type File struct {
XGo *XGo
Compiler *Compiler // the underlying go compiler in go.mod (not gox.mod)
Projects []*Project
ClassMods []string // calc by require statements in go.mod (not gox.mod)
Syntax *FileSyntax
}
A File is the parsed, interpreted form of a gox.mod file.
func Parse ¶
func Parse(file string, data []byte, fix VersionFixer) (*File, error)
Parse parses and returns a gox.mod file.
file is the name of the file, used in positions and errors.
data is the content of the file.
fix is an optional function that canonicalizes module versions. If fix is nil, all module versions must be canonical (module.CanonicalVersion must return the same string).
func ParseLax ¶
func ParseLax(file string, data []byte, fix VersionFixer) (*File, error)
ParseLax is like Parse but ignores unknown statements. It is used when parsing gox.mod files other than the main module, under the theory that most statement types we add in the future will only apply in the main module, like exclude and replace, and so we get better gradual deployments if old go commands simply ignore those statements when found in gox.mod files in dependencies.
type FileSyntax ¶
type FileSyntax = modfile.FileSyntax
A FileSyntax represents an entire gox.mod file.
type InvalidExtError ¶
func (*InvalidExtError) Error ¶
func (e *InvalidExtError) Error() string
func (*InvalidExtError) Unwrap ¶
func (e *InvalidExtError) Unwrap() error
type InvalidSymbolError ¶ added in v0.10.0
func (*InvalidSymbolError) Error ¶ added in v0.10.0
func (e *InvalidSymbolError) Error() string
func (*InvalidSymbolError) Unwrap ¶ added in v0.10.0
func (e *InvalidSymbolError) Unwrap() error
type LParen ¶
An LParen represents the beginning of a parenthesized line block. It is a place to store suffix comments.
type Position ¶
A Position describes an arbitrary source position in a file, including the file, line, column, and byte offset.
type Project ¶ added in v0.10.0
type Project struct {
Ext string // can be "_[class].gox" or ".[class]", eg. "_yap.gox" or ".gmx"
FullExt string // can be "main_[class].gox", "*_[class].gox", "_[class].gox", "main.[class]", "*.[class]" or ".[class]"
Class string // "Game"
Works []*Class // work class of classfile
PkgPaths []string // package paths of classfile and optional inline-imported packages.
Import []*Import // auto-imported packages
Runner *Runner // custom runner
Syntax *Line
}
A Project is the project statement.
type RParen ¶
An RParen represents the end of a parenthesized line block. It is a place to store whole-line (before) comments.
type Runner ¶ added in v0.18.0
type Runner struct {
Path string // package path of the runner
Version string // optional version of the runner
Syntax *Line
}
A Runner is the runner statement that specifies a custom runner for the project. The runner directive must appear after a project statement and only one runner per project is allowed. Example: runner github.com/goplus/spx/v2/cmd/spxrun Example with version: runner github.com/goplus/spx/v2/cmd/spxrun v2.0.1
type VersionFixer ¶
type VersionFixer = modfile.VersionFixer