Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestRefSimple ¶
Types ¶
type Diagnostic ¶
type Diagnostic struct {
Span source.Span
Message string
// Code classifies a warning for the consumers that report it; errors carry
// the "syntax" code their reporters give them.
Code string
// Fixes are the unambiguous edits resolving the diagnostic, offered by an
// editor as quick fixes.
Fixes []quickfix.Fix
}
Diagnostic is a parser-emitted syntax error. It is unified with the pass/validation diagnostic model in Plan 4; kept local here to avoid a premature cross-package dependency.
type Parser ¶
type Parser struct {
// Diagnostics are syntax errors: input the parser could not read as
// well-formed SysML.
Diagnostics []Diagnostic
// Warnings are findings on input that parsed into the tree the author
// intended but is not well-formed SysML, such as a reserved keyword written
// as a declaration name.
Warnings []Diagnostic
// contains filtered or unexported fields
}
Parser is a hand-written recursive-descent parser over a lexer token stream. It buffers non-trivia tokens for lookahead and collects diagnostics; it always produces a tree (ErrorNodes for bad input).
func (*Parser) Offset ¶
Offset returns the source offset of the next unconsumed token, which is where a caller parsing a sequence of productions continues from. A node's span is not that position: a parenthesized expression's span is its contents.
func (*Parser) ParseExpression ¶
ParseExpression parses a full expression (conditional at the lowest level).
func (*Parser) ParseFile ¶
func (p *Parser) ParseFile() *ast.RootNamespace
ParseFile parses the whole source as a RootNamespace (brace-less member list).