Documentation
¶
Overview ¶
Package parser contains the interface for using parsers for all supported Lojban dialects.
Index ¶
- Constants
- func AddElidedTerminators(n *peg.Node)
- func CollapseLists(n *peg.Node)
- func Locations(text string, n *peg.Fail) map[*peg.Fail]Loc
- func Parse(dialect string, text string) (*peg.Node, error)
- func Register(d Dialect, makeParser func(string) Parser)
- func RemoveMorphology(n *peg.Node)
- func RemoveSpace(n *peg.Node)
- type Dialect
- type Error
- type Loc
- type Parser
Constants ¶
const SpaceChars = ".\t\n\r?!\x20"
SpaceChars is the string of all whitespace characters.
Variables ¶
This section is empty.
Functions ¶
func AddElidedTerminators ¶
AddElidedTerminators sets the Text of an elided terminator node to the terminator name in all caps. This flags any functions removing empty Nodes to keep the elided terminator Node, as its Text is no longer empty.
func CollapseLists ¶
CollapseLists collapses chains of single-kid nodes.
func Parse ¶
Parse parses text using a given Lojban dialect. On success, the parseTree is returned. On failure, both the word-level and the raw, morphological errors are returned.
func RemoveMorphology ¶
RemoveMorphology removes all nodes beneath whole words.
Types ¶
type Dialect ¶
type Dialect struct { // Name is the name of the dialect. Name string // Version is the version of the dialect's grammar. Version string // Descr is a map from language codes // to text describing the dialect // in the corresponding language. Descr map[string]string // OfficialURL is the official URL for the parser's homepage. OfficialURL string // GrammarURL is the URL of the grammar file. GrammarURL string }
A Dialect describes a dialect of the Lojban language.
type Parser ¶
type Parser interface { // Parse parses the text and returns // the maximum error position seen during the parse // and whether the parse succeeded. Parse() (int, bool) // ErrorTree returns the parse error tree for a failed parse. // The tree contains all errors at or beyond minErrorPos. ErrorTree(minErrorPos int) *peg.Fail // ParseTree returns the parse tree for a successful parse. ParseTree() *peg.Node }
Parser is a low-level interface to a Lojban parser.
Directories
¶
Path | Synopsis |
---|---|
Package alldialects can be imported to register all supported Lojban dialects.
|
Package alldialects can be imported to register all supported Lojban dialects. |
Package camxes is the camxes implementation of the official Lojban grammar.
|
Package camxes is the camxes implementation of the official Lojban grammar. |
Package camxes is the camxes implementation of the official Lojban grammar.
|
Package camxes is the camxes implementation of the official Lojban grammar. |
Package ilmentufa is the ilmentufa dialect of Lojban.
|
Package ilmentufa is the ilmentufa dialect of Lojban. |
Package maftufa is the maftufa dialect of Lojban grammar.
|
Package maftufa is the maftufa dialect of Lojban grammar. |
Package zantufa is the zantufa dialect of Lojban.
|
Package zantufa is the zantufa dialect of Lojban. |