Enhanced C#
Language of your choice: library documentation
Properties | Public Member Functions | List of all members
Loyc.Ecs.EcsPrinterOptions Class Reference

Options to control the way EcsNodePrinter's output is formatted. More...


Source file:
Inheritance diagram for Loyc.Ecs.EcsPrinterOptions:
Loyc.Syntax.LNodePrinterOptions Loyc.Syntax.ILNodePrinterOptions

Remarks

Options to control the way EcsNodePrinter's output is formatted.

EcsPrinterOptions has some configuration options that will defeat round-tripping (from LNode to text and back) but will make the output look better. For example, AllowExtraBraceForIfElseAmbig will print a tree such as #if(a, #if(b, f()), g()) as if (a) { if (b) f(); } else g();, by adding braces to eliminate prefix notation, even though braces make the Loyc tree different.

Properties

override bool CompatibilityMode [get, set]
 
override bool CompactMode [get, set]
 
bool MixImmiscibleOperators [get, set]
 Allows operators to be mixed that will cause the parser to produce a warning. An example is x & @==(y, z): if you enable this option, it will be printed as x & y == z, which the parser will complain about because mixing those operators is deprecated. More...
 
bool AllowExtraBraceForIfElseAmbig [get, set]
 Solve if-else ambiguity by adding braces rather than reverting to prefix notation. More...
 
bool DropNonDeclarationAttributes [get, set]
 Suppresses printing of all attributes that are not on declaration or definition statements (such as classes, methods and variable declarations at statement level). Also, avoids prefix notation when the attributes would have required it, e.g. +([Foo] a, b) can be printed "a+b" instead. More...
 
bool OmitMissingArguments [get, set]
 When an argument to a method or macro has an empty name (@``), it will be omitted completely if this flag is set. More...
 
bool OmitSpaceTrivia [get, set]
 When this flag is set, space trivia attributes are ignored (e.g. CodeSymbols.TriviaSpaceAfter). More...
 
bool ObeyRawText [get, set]
 When this flag is set, raw text trivia attributes (e.g. CodeSymbols.TriviaRawTextBefore) are obeyed (cause raw text output); otherwise such attributes are treated as unknown trivia and, if OmitUnknownTrivia is false, printed as attributes. More...
 
bool QuoteUnprintableLiterals [get, set]
 When the printer encounters an unprintable literal, it calls Value.ToString(). When this flag is set, the string is placed in double quotes; when this flag is clear, it is printed as raw text. More...
 
bool AllowConstructorAmbiguity [get, set]
 Causes the ambiguity between constructors and method calls to be ignored; see EcsPrinterAndParserTests.ConstructorAmbiguities(). More...
 
bool AvoidMacroSyntax [get, set]
 Prints statements like "foo (...) bar()" in the equivalent form "foo (..., bar())" instead. Does not affect foo {...} because property and event definitions require this syntax (get {...}, set {...}). More...
 
bool PreferPlainCSharp [get, set]
 Prefers plain C# syntax for certain other things (not covered by the other options), even when the syntax tree requests a different style, e.g. EC# cast operators are blocked so x(->int) becomes (int) x, and <tt>at-identifiers are sanitized. More...
 
SpaceOpt SpaceOptions [get, set]
 Controls the locations where spaces should be emitted. More...
 
NewlineOpt NewlineOptions [get, set]
 Controls the locations where newlines should be emitted. More...
 
int SpaceAroundInfixStopPrecedence [get, set]
 The printer avoids printing spaces around infix (binary) operators that have the specified precedence or higher. More...
 
int SpaceAfterPrefixStopPrecedence [get, set]
 The printer avoids printing spaces after prefix operators that have the specified precedence or higher. More...
 
- Properties inherited from Loyc.Syntax.LNodePrinterOptions
virtual bool AllowChangeParentheses [get, set]
 
virtual bool OmitComments [get, set]
 
virtual bool OmitUnknownTrivia [get, set]
 
virtual bool PrintTriviaExplicitly [get, set]
 
virtual bool CompatibilityMode [get, set]
 
virtual bool CompactMode [get, set]
 
virtual string IndentString [get, set]
 
virtual string NewlineString [get, set]
 
- Properties inherited from Loyc.Syntax.ILNodePrinterOptions
bool AllowChangeParentheses [get]
 Indicates that it is preferable to add (or remove) parenthesis to produce good-looking output, rather than to express faithfully whether or not parentheses were present in the Loyc tree being printed. More...
 
bool OmitComments [get]
 When this flag is set, comment trivia attributes are suppressed (e.g. CodeSymbols.TriviaSLCommentAfter). More...
 
bool OmitUnknownTrivia [get]
 Causes trivia that the printer does not recognize (other than comments, spaces and raw text) to be dropped from the output rather than printed as attributes. More...
 
bool PrintTriviaExplicitly [get]
 If supported by the printer, this option causes comments and spaces to be printed as attributes in order to ensure faithful round-trip parsing. More...
 
bool CompatibilityMode [get]
 If there are multiple ways to print a given node, this option indicates that the printer should prefer an older, more compatible syntactic style over new ones, where applicable. More...
 
bool CompactMode [get]
 When this flag is set, the amount of whitespace in the output is reduced in a printer-defined way, in order to save bits. More...
 
string IndentString [get]
 Specifies the string to use for each level of indentation of nested constructs in the language, e.g. a tab or four spaces. More...
 
string NewlineString [get]
 Specifies the string to use for line breaks (typically "\n"). More...
 

Public Member Functions

 EcsPrinterOptions (ILNodePrinterOptions options)
 
EcsPrinterOptions SetPlainCSharpMode (bool flag=true)
 
- Public Member Functions inherited from Loyc.Syntax.LNodePrinterOptions
void CopyFrom (ILNodePrinterOptions original)
 

Property Documentation

bool Loyc.Ecs.EcsPrinterOptions.AllowConstructorAmbiguity
getset

Causes the ambiguity between constructors and method calls to be ignored; see EcsPrinterAndParserTests.ConstructorAmbiguities().

bool Loyc.Ecs.EcsPrinterOptions.AllowExtraBraceForIfElseAmbig
getset

Solve if-else ambiguity by adding braces rather than reverting to prefix notation.

For example, the tree #if(c1, #if(c2, x++), y++) will be parsed incorrectly if it is printed if (c1) if (c2) x++; else y++;. This problem can be resolved either by adding braces around if (c2) x++;, or by printing #if(c2, x++) in prefix notation.

bool Loyc.Ecs.EcsPrinterOptions.AvoidMacroSyntax
getset

Prints statements like "foo (...) bar()" in the equivalent form "foo (..., bar())" instead. Does not affect foo {...} because property and event definitions require this syntax (get {...}, set {...}).

bool Loyc.Ecs.EcsPrinterOptions.DropNonDeclarationAttributes
getset

Suppresses printing of all attributes that are not on declaration or definition statements (such as classes, methods and variable declarations at statement level). Also, avoids prefix notation when the attributes would have required it, e.g. +([Foo] a, b) can be printed "a+b" instead.

bool Loyc.Ecs.EcsPrinterOptions.MixImmiscibleOperators
getset

Allows operators to be mixed that will cause the parser to produce a warning. An example is x & @==(y, z): if you enable this option, it will be printed as x & y == z, which the parser will complain about because mixing those operators is deprecated.

NewlineOpt Loyc.Ecs.EcsPrinterOptions.NewlineOptions
getset

Controls the locations where newlines should be emitted.

Referenced by Loyc.Ecs.EcsNodePrinter.PrintECSharp().

bool Loyc.Ecs.EcsPrinterOptions.ObeyRawText
getset

When this flag is set, raw text trivia attributes (e.g. CodeSymbols.TriviaRawTextBefore) are obeyed (cause raw text output); otherwise such attributes are treated as unknown trivia and, if OmitUnknownTrivia is false, printed as attributes.

Initial value: true

bool Loyc.Ecs.EcsPrinterOptions.OmitMissingArguments
getset

When an argument to a method or macro has an empty name (@``), it will be omitted completely if this flag is set.

bool Loyc.Ecs.EcsPrinterOptions.OmitSpaceTrivia
getset

When this flag is set, space trivia attributes are ignored (e.g. CodeSymbols.TriviaSpaceAfter).

Note: since EcsNodePrinter inserts its own spaces automatically, space trivia (if any) may be redundant unless you set _o.SpaceOptions and/or NewlineOptions to zero.

bool Loyc.Ecs.EcsPrinterOptions.PreferPlainCSharp
getset

Prefers plain C# syntax for certain other things (not covered by the other options), even when the syntax tree requests a different style, e.g. EC# cast operators are blocked so x(->int) becomes (int) x, and <tt>at-identifiers are sanitized.

bool Loyc.Ecs.EcsPrinterOptions.QuoteUnprintableLiterals
getset

When the printer encounters an unprintable literal, it calls Value.ToString(). When this flag is set, the string is placed in double quotes; when this flag is clear, it is printed as raw text.

int Loyc.Ecs.EcsPrinterOptions.SpaceAfterPrefixStopPrecedence
getset

The printer avoids printing spaces after prefix operators that have the specified precedence or higher.

Referenced by Loyc.Ecs.EcsNodePrinter.PrintECSharp().

int Loyc.Ecs.EcsPrinterOptions.SpaceAroundInfixStopPrecedence
getset

The printer avoids printing spaces around infix (binary) operators that have the specified precedence or higher.

See also
EcsPrecedence

Referenced by Loyc.Ecs.EcsNodePrinter.PrintECSharp().

SpaceOpt Loyc.Ecs.EcsPrinterOptions.SpaceOptions
getset

Controls the locations where spaces should be emitted.

Referenced by Loyc.Ecs.EcsNodePrinter.PrintECSharp().