The Value property provides easy access to the lexer, parser and printer for Enhanced C#.
More...
Source file:
The Value property provides easy access to the lexer, parser and printer for Enhanced C#.
EC# overview: https://sourceforge.net/apps/mediawiki/loyc/index.php?title=Ecs
|
IEnumerable< string > | FileExtensions [get] |
|
LNodePrinter | Printer [get] |
|
bool | HasTokenizer [get] |
|
IEnumerable< string > | FileExtensions [get] |
| Standard file extensions for this language, without leading dots, with the first one being the most common. More...
|
|
bool | HasTokenizer [get] |
| Returns true if the Tokenize() method is available. More...
|
|
LNodePrinter | Printer [get] |
| Gets a printer delegate that you can use with LNode.Printer and LNode.PushPrinter, or null if there is no corresponding printer available for the parser reresented by this object. More...
|
|
|
override string | ToString () |
|
string | Print (LNode node, IMessageSink msgs=null, object mode=null, string indentString="\t", string lineSeparator="\n") |
| Converts the specified syntax tree to a string. More...
|
|
ILexer< Token > | Tokenize (ICharSource text, string fileName, IMessageSink msgs) |
| Returns a lexer that is configured to begin reading the specified file. More...
|
|
IListSource< LNode > | Parse (ICharSource text, string fileName, IMessageSink msgs, Symbol inputType=null) |
| Parses a source file into one or more Loyc trees. More...
|
|
IListSource< LNode > | Parse (ILexer< Token > input, IMessageSink msgs, Symbol inputType=null) |
| If HasTokenizer is true, this method accepts a lexer returned by Tokenize() and begins parsing. More...
|
|
IListSource< LNode > | Parse (IListSource< Token > input, ISourceFile file, IMessageSink msgs, Symbol inputType=null) |
| Parses a token tree, such as one that came from a token literal. More...
|
|
Parses a source file into one or more Loyc trees.
- Parameters
-
file | input file or string. |
msgs | output sink for error and warning messages. |
inputType | Indicates the kind of input: Exprs (one or more expressions, typically seprated by commas but this is language- defined), Stmts (a series of statements), or File (an entire source file). null is a synonym for File . |
Implements Loyc.Syntax.IParsingService.
If HasTokenizer is true, this method accepts a lexer returned by Tokenize() and begins parsing.
- Parameters
-
msgs | output sink for error and warning messages. |
inputType | Indicates how the input should be interpreted: ParsingService.File, ParsingService.Exprs or ParsingService.Stmts. The default input type should be File. |
- Exceptions
-
NotSupportedException | HasTokenizer is false. |
This method adds any preprocessing steps to the lexer (tree-ification or token preprocessing) that are required by this language before it sends the results to the parser. If possible, the output is computed lazily.
Implements Loyc.Syntax.IParsingService.
Parses a token tree, such as one that came from a token literal.
Some languages may offer token literals, which are stored as token trees that can be processed by "macros" or compiler plugins. A macro may wish to parse some of the token literal using the host language's parser (e.g. LLLPG needs to do this), so this method is provided for that purpose.
- Exceptions
-
NotSupportedException | This feature is not supported by this parsing service. |
Implements Loyc.Syntax.IParsingService.
References Loyc.Syntax.ParsingService.Exprs, and Loyc.Collections.IListSource< out T >.TryGet().
string Loyc.Ecs.EcsLanguageService.Print |
( |
LNode |
node, |
|
|
IMessageSink |
msgs = null , |
|
|
object |
mode = null , |
|
|
string |
indentString = "\t" , |
|
|
string |
lineSeparator = "\n" |
|
) |
| |
|
inline |
Converts the specified syntax tree to a string.
- Parameters
-
node | A syntax tree to print. |
msgs | If errors or warnings occur during printing, they are sent here. If this is null, messages shall be sent to MessageSink.Current. |
mode | Language-defined configuration. It is suggested that the printing service should accept ParsingService.Exprs, ParsingService.Stmts and ParsingService.File as possible printing modes. |
indentString | Indent character for multi-line nodes |
lineSeparator | Newline string for multi-line nodes |
Implements Loyc.Syntax.IParsingService.
Returns a lexer that is configured to begin reading the specified file.
- Parameters
-
file | Text to be tokenized (e.g. UString) |
fileName | File name to be associated with any errors that occur. |
msgs | Error messages are sent to this object. |
The returned lexer should be a "simple" tokenizer. If the language uses tree lexing (in which tokens are grouped by parentheses and braces), the returned lexer should NOT include the grouping process, and it should not remove comments, although it may skip spaces and perhaps newlines. If there is a preprocessor, it should not run.
Implements Loyc.Syntax.IParsingService.