Enhanced C#
Language of your choice: library documentation
|
Loyc.Syntax.dll: contains Loyc trees (Loyc.Syntax.LNode), lexing stuff, LLLPG base classes (BaseParser{T} and BaseLexer), the LES parser and printer, data types related to source code management (e.g. ISourceFile, SourceRange) and other general-purpose code related to the manipulation of syntax. More...
Namespaces | |
package | Les |
Contains classes related to Loyc Expression Syntax (LES), including the parser and printer (reachable through Loyc.Syntax.Les.LesLanguageService). | |
package | Lexing |
Contains classes related to lexical analysis, such as the universal token type (Loyc.Syntax.Lexing.Token) and Loyc.Syntax.Lexing.TokensToTree. | |
Classes | |
class | BaseParser< Token > |
An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator). Note: this is the old (harder to use) base class. You should use BaseParserForList{Token, LaType} instead. This class is now an alias for BaseParser{Token,int}. More... | |
class | BaseParser< Token, MatchType > |
An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator). Note: this is the old (harder to use) base class design. You should use BaseParserForList{Token,MatchType} instead. More... | |
class | BaseParserForList< Token, MatchType > |
An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator) and receive tokens from any IEnumerator{Token}. More... | |
class | BaseParserForList< Token, MatchType, List > |
An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator) and receive tokens from any IEnumerator{Token}. (Potentially also useful for parsers written by hand.) More... | |
class | BaseParserNoBacktracking< Token > |
An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator) and receive tokens from an IEnumerator{Token}. More... | |
class | BaseParserNoBacktracking< Token, Enumerator > |
An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator) and receive tokens from any IEnumerator{Token}. More... | |
class | CallNode |
Base class of all nodes that represent calls such as f(x) , operator calls such as x + y , braced blocks, and all other things that are not simple symbols and literals. More... | |
class | CharIndexPositionMapperTests |
class | CodeSymbols |
A list of common symbols that have special meaning somewhere in Loyc or EC#: operators, built-in data types, keywords, trivia, etc. More... | |
struct | DescendantsFrame |
Helper class used to enumerate LNode.Descendants(). More... | |
class | EmptySourceFile |
A dummy implementation of ISourceFile that has only a filename, no source text. Used as the source file of synthetic syntax nodes. More... | |
class | IdNode |
Base class of all nodes that represent simple identifiers (including special symbols such as #foo). More... | |
interface | IIndexPositionMapper |
This interface is for classes that can convert indexes to SourcePos structures and back. More... | |
interface | IIndexToLine |
Contains IndexToLine method. More... | |
interface | ILNodeVisitor |
Interface for people that want to implement the visitor pattern with LNode. If your visitor does not need a base class, use LNodeVisitor as the base class. More... | |
class | IndexPositionMapper |
Synonym for IndexPositionMapper<IListSource<char>> . More... | |
class | IndexPositionMapper< CharSource > |
Helper class for mapping from indexes to SourcePos and back. More... | |
interface | IParsingService |
An interface that encapsulates the lexer, parser, and printer of a programming language, or a non-programming language that can be represented by Loyc trees. More... | |
interface | ISourceFile |
Represents a text file with a file name and its textual content, plus the data necessary to convert between line-column positions and 0-based integer indexes. More... | |
class | LineAndCol |
Holds a line number (Line) and a position in the line (PosInLine). This class isn't really needed in Loyc but is separated from SourcePos in case anyone might want position without a filename. More... | |
class | LineRemapper |
A small helper class for languages such as C# and C++ that permit the locations reported by error messages to be remapped. This class stores and applies such commands (#line in C#/C++) More... | |
class | LiteralNode |
Base class of all nodes that represent literal values such as 123 and "foo". More... | |
class | LNode |
All nodes in a Loyc syntax tree share this base class. More... | |
class | LNodeExt |
Standard extension methods for LNode. More... | |
class | LNodeFactory |
Contains helper methods for creating LNodes. An LNodeFactory holds a reference to the current source file (File) so that it does not need to be repeated every time you create a node. More... | |
class | LNodeTests |
class | LNodeVisitor |
Base class for people that want to implement the visitor pattern with LNode. More... | |
class | ParserSource< Token > |
Alias for ParserSource{Token, int, IList{Token}}. More... | |
class | ParserSource< Token, MatchType > |
Alias for ParserSource{Token, int, IList{Token}}. More... | |
class | ParserSource< Token, MatchType, List > |
An implementation of the LLLPG Parser API, used with the LLLPG options inputSource and inputClass . More... | |
class | ParsingService |
Extension methods for IParsingService. More... | |
struct | Precedence |
A four-byte tuple that represents the precedence and miscibility of an operator. More... | |
class | SourceFile |
class | SourceFile< CharSource > |
A default implementation of ISourceFile based on IndexPositionMapper. More... | |
class | SourceFileWithLineRemaps |
An wrapper around ISourceFile that applies line remapping information (if the source file uses it). More... | |
class | SourcePos |
Holds a filename (FileName), a line number (Line) and a position in the line (PosInLine), representing a position in a source code file. More... | |
class | SourcePosAndIndex |
A SourcePos that also includes the original index from which the Line and PosInLine were derived. More... | |
struct | SourceRange |
Holds a reference to a source file (ISourceFile<char>) and the beginning and end indices of a range in that file. More... | |
class | StreamCharSource |
Exposes a stream as an ICharSource, as though it were an array of characters. The stream must support seeking, and if a text decoder is specified, it must meet certain constraints. More... | |
Enumerations | |
enum | NodeScanMode { YieldSelf = 1, YieldLocalAttrs = 2, YieldLocalHead = 4, YieldLocalArgsOnly = 8, YieldLocalNonAttrs = YieldLocalArgsOnly | YieldLocalHead, YieldLocal = YieldLocalAttrs | YieldLocalNonAttrs, YieldDeepAttrs = 16, YieldDeepHeads = 32, YieldDeepArgsOnly = 64, YieldDeepNonAttrs = YieldDeepArgsOnly | YieldDeepHeads, YieldDeep = YieldDeepAttrs | YieldDeepNonAttrs, YieldAttrs = YieldLocalAttrs | YieldDeepAttrs, YieldHeads = YieldLocalHead | YieldDeepHeads, YieldArgsOnly = YieldLocalArgsOnly | YieldDeepArgsOnly, YieldNonAttrs = YieldLocalNonAttrs | YieldDeepNonAttrs, YieldAllChildren = YieldAttrs | YieldNonAttrs, YieldAll = YieldAllChildren | YieldSelf, ScanAttrs = 128, ScanHeads = 256, ScanArgsOnly = 512, ScanNonAttrs = ScanHeads | ScanArgsOnly, ScanAll = ScanAttrs | ScanNonAttrs } |
Specifies which children to enumerate when calling LNode.Descendants(). More... | |
enum | LNodeKind { Id, Literal, Call } |
The three kinds of nodes in a Loyc tree More... | |
enum | NodeStyle : byte { NodeStyle.Default = 0, NodeStyle.Operator = 1, NodeStyle.Statement = 2, NodeStyle.Special = 3, NodeStyle.PrefixNotation = 4, NodeStyle.Expression = 5, NodeStyle.DataType = 6, NodeStyle.OldStyle = 7, NodeStyle.BaseStyleMask = 7, NodeStyle.Alternate = 8, NodeStyle.Alternate2 = 16, NodeStyle.Handled = 128 } |
Suggests a printing style when serializing a Loyc tree to text. More... | |
enum | OperatorShape { Suffix = -1, Nullary = 0, Prefix = 1, Infix = 2, Ternary = 3, Other = 4 } |
An enum of common operator formats. More... | |
Functions | |
delegate void | LNodePrinter (LNode node, StringBuilder target, IMessageSink errors, object mode=null, string indentString="\t", string lineSeparator="\n") |
Signature for a method that serializes a Loyc tree to text. Each programming language will have one (when complete). More... | |
Loyc.Syntax.dll: contains Loyc trees (Loyc.Syntax.LNode), lexing stuff, LLLPG base classes (BaseParser{T} and BaseLexer), the LES parser and printer, data types related to source code management (e.g. ISourceFile, SourceRange) and other general-purpose code related to the manipulation of syntax.
The three kinds of nodes in a Loyc tree
Specifies which children to enumerate when calling LNode.Descendants().
TODO code review
enum Loyc.Syntax.NodeStyle : byte |
Suggests a printing style when serializing a Loyc tree to text.
See LNode.Style.
TODO: review, rethink.
A printer should not throw exceptions unless specifically requested. It should ignore printing styles that it does not allow, rather than throwing.
Styles may be used in different ways by different parsers, different printers and different people. Be careful how you rely on them; they are intended to affect only the appearance of a node when it is printed, not its semantics.
Please note that language-specific printing styles can be denoted by attaching special attributes recognized by the printer for that language. These attributes should have Names starting with the string "#trivia_"; printers are programmed to ignore trivia attributes that they do not understand.
An enum of common operator formats.
It is intentional that the absolute value of each OperatorShape (except Other) is the arity of (number of arguments to) that shape.
delegate void Loyc.Syntax.LNodePrinter | ( | LNode | node, |
StringBuilder | target, | ||
IMessageSink | errors, | ||
object | mode = null , |
||
string | indentString = "\t" , |
||
string | lineSeparator = "\n" |
||
) |
Signature for a method that serializes a Loyc tree to text. Each programming language will have one (when complete).
node | Node to print |
target | Output buffer |
mode | A language-specific way of modifying printer behavior. The printer should ignore the mode object if it does not not understand it. |
indentString | A string to print for each level of indentation, such as a tab or four spaces. |
lineSeparator | Line separator, typically "\n" or "\r\n". |
This delegate only prints to a StringBuilder. Printing directly to a stream requires language-specific facilities.