Package common defines types and utilities common to expression parsing, checking, and interpretation
const ( SelectAndIdentCost = 1 ConstCost = 0 ListCreateBaseCost = 10 MapCreateBaseCost = 30 StructCreateBaseCost = 40 StringTraversalCostFactor = 0.1 RegexStringLengthCostFactor = 0.25 )
MultilineDescription combines multiple lines into a newline separated string.
ParseDescription takes a single string containing newline characters and splits it into a multiline description. All empty lines will be skipped.
Returns an empty string if the input string is empty.
ParseDescriptions splits a documentation string into multiple multi-line description sections, using blank lines as delimiters.
Doc holds the documentation details for a specific program element like a variable, function, macro, or example.
NewExampleDoc creates a new Doc struct specifically for holding an example.
func NewFunctionDoc(name, description string, overloads ...*Doc) *Doc
NewFunctionDoc creates a new Doc struct for documenting a function.
func NewMacroDoc(name, description string, examples ...*Doc) *Doc
NewMacroDoc creates a new Doc struct for documenting a macro.
func NewOverloadDoc(id, signature string, examples ...*Doc) *Doc
NewOverloadDoc creates a new Doc struct for a function example.
func NewVariableDoc(name, celType, description string) *Doc
NewVariableDoc creates a new Doc struct specifically for documenting a variable.
DocKind indicates the type of documentation element.
const ( DocEnv DocKind = iota + 1 DocFunction DocOverload DocVariable DocMacro DocExample )
type Documentor interface { Documentation() *Doc }
Documentor is an interface for types that can provide their own documentation.
Error type which references an expression id, a location within source, and a message.
NewError creates an error associated with an expression id with the given message at the given location.
ToDisplayString decorates the error message with the source location.
Errors type which contains a list of errors observed during parsing.
NewErrors creates a new instance of the Errors type.
Append creates a new Errors object with the current and input errors.
GetErrors returns the list of observed errors.
ReportError records an error at a source location.
ReportErrorAtID records an error at a source location and expression id.
ReportErrorString records an error at a source location.
ToDisplayString returns the error set to a newline delimited string.
type Location interface { Line() int Column() int }
Location interface to represent a location within Source.
NewLocation creates a new location.
Source interface for filter source contents.
NewInfoSource creates a new Source from a SourceInfo.
NewStringSource creates a new Source from the given contents and description.
NewTextSource creates a new Source from the input text string.
type SourceLocation struct { }
SourceLocation helper type to manually construct a location.
func (*SourceLocation) Column ΒΆColumn returns the 0-based column number of the location.
Line returns the 1-based line of the location.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4