Grasshopper2.Parsingnamespace

Types

Grasshopper2.Parsing.IResult
Interface for parsing results.
Grasshopper2.Parsing.Argument
One argument within a bracketed list, i.e. the "y: 5" in "point(1, y: 5)".
Grasshopper2.Parsing.Arguments
The arguments inside a bracketed list, each given either by position or by name.

Arguments are separated by top level commas, or, when there are none, by whitespace, so that "rgb(1, 0.5, 0)" and "rgb(1 0.5 0)" agree. An argument is named when a word is followed by a colon; a number before a colon is left alone, which is what keeps "13:45" a time rather than an argument called thirteen.

Grasshopper2.Parsing.ArgumentSyntax
Represents a syntactic description for a class of mutually exclusive arguments in parsing notation.
Grasshopper2.Parsing.BracketFragment
One side of a bracket pair. Pairing is by nesting position only; the most recent unclosed bracket is matched regardless of shape.
Grasshopper2.Parsing.BracketShape
The shape of a bracket. Interval notation permits a pair of brackets with different shapes, i.e. "[5,8)", so shapes are recorded rather than enforced. It is up to interpreters to decide which combinations they accept.
Grasshopper2.Parsing.CommentFragment
An inline or block comment.
Grasshopper2.Parsing.Fragment
A single categorised span of a string. Fragments are created only by Fragments and are immutable once that collection is built.
Grasshopper2.Parsing.Fragmentation
Choices which affect how a string is split into Fragments. These have to be made up front, because they change what the characters mean rather than what is done with them afterwards.
Grasshopper2.Parsing.FragmentKind
The category of a Fragment. These are flag values so that groups of kinds can be expressed as a single mask.
Grasshopper2.Parsing.Fragments
A string split into categorised fragments, plus the views derived from it.

Scanning happens once, on creation, and never fails. Problems such as an unterminated literal or an unmatched bracket are recorded on the fragment they belong to, so that half typed input still yields a complete and navigable result. Call Fragments.Validate() when well formed input is required.

Every view is pinned to the same Fragments.Source string and every fragment reports absolute indices into it, so error positions remain valid no matter how deeply a view is derived.

Grasshopper2.Parsing.Interpret
Interprets Fragments views as specific types. Think of Fragments as the tokenizer for value notation and the Interpret class as the parser.
Grasshopper2.Parsing.LineBreakFragment
A single line break. Line breaks are not trivia; they almost always act as boundaries and are never skipped during navigation.
Grasshopper2.Parsing.LiteralFragment
A quote delineated text literal.
Grasshopper2.Parsing.Notation
Enumerates all supported notation patterns for parsing.
Grasshopper2.Parsing.NumberFragment
A numeric literal. Leading signs and trailing unit suffixes are not part of a number; they are separate fragments, because neither can be classified without knowing the grammar.
Grasshopper2.Parsing.NumberNotation
The notations which make up a numeric fragment. Several of these combine, i.e. "6.02×10²³" is written using NumberNotation.Digits, NumberNotation.Separator, NumberNotation.Scientific and NumberNotation.Superscript.
Grasshopper2.Parsing.Result<T>
The result of a parsing operation.
Grasshopper2.Parsing.SymbolFragment
A single character which belongs to no other category. Symbols are always one character long; multi character operators are matched by testing adjacency with Fragment.IsAdjacentTo(Fragment).
Grasshopper2.Parsing.TerminalFragment
A zero length marker at either end of a Fragments view.
Grasshopper2.Parsing.WhitespaceFragment
A run of whitespace, never spanning a line break.
Grasshopper2.Parsing.WordFragment
A run of letters, digits and underscores, starting with a letter or an underscore. Words are scanned greedily, so "point2" is a single word and the 'e' inside "Hello" cannot be mistaken for Euler's number.