Enhanced C#
Language of your choice: library documentation
Public fields | Properties | Public Member Functions | List of all members
Loyc.Syntax.Les.Les3PrinterOptions Class Reference

A set of extended options supported when printing in LES3. More...


Source file:
Inheritance diagram for Loyc.Syntax.Les.Les3PrinterOptions:
Loyc.Syntax.LNodePrinterOptions Loyc.Syntax.ILNodePrinterOptions

Remarks

A set of extended options supported when printing in LES3.

This type can be used, for example, in a call to Les3LanguageService.Print(ILNode, IMessageSink, ParsingMode, ILNodePrinterOptions).

Public fields

bool SpacesBetweenAppendedStatements = true
 Whether to add a space between multiple statements printed on one line (initial value: true). More...
 
int SpaceAroundInfixStopPrecedence = LesPrecedence.Multiply.Hi + 1
 The printer avoids printing spaces around infix (binary) operators that have the specified precedence or higher. More...
 
int SpaceAfterPrefixStopPrecedence = LesPrecedence.Multiply.Hi + 1
 The printer avoids printing spaces after prefix operators that have the specified precedence or higher. More...
 

Properties

override bool CompactMode [get, set]
 
bool SpaceInsideListBrackets [get, set]
 Whether to print a space inside square brackets for lists [ ... ]. More...
 
bool SpaceInsideArgLists [get, set]
 Whether to print a space inside argument lists like f( ... ). More...
 
bool SpaceInsideGroupingParens [get, set]
 Whether to print a space inside grouping parentheses ( ... ). More...
 
bool SpaceInsideTuples [get, set]
 Whether to print a space inside tuples like f( ...; ). More...
 
bool SpaceAfterComma [get, set]
 Whether to print a space after each comma in an argument list. More...
 
bool AllowExtraParenthesis [get, set]
 Introduces extra parenthesis to express precedence, without using an empty attribute list [] to allow perfect round-tripping. More...
 
bool OmitSpaceTrivia [get, set]
 When this flag is set, space trivia attributes are ignored (e.g. CodeSymbols.TriviaNewline). More...
 
bool WarnAboutUnprintableLiterals [get, set]
 Whether to print a warning when an "unprintable" literal is encountered. In any case the literal is converted to a string, placed in double quotes and prefixed by the unqualified Type of the Value. More...
 
bool ObeyRawText [get, set]
 Causes raw text to be printed verbatim, as the EC# printer does. When this option is false, raw text trivia is printed as a normal attribute. More...
 
bool UseRedundantSemicolons [get, set]
 If true, a semicolon is used in addition to the usual newline to terminate each expression inside braced blocks and at the top level. More...
 
bool PrefixNotationOnly [get, set]
 Print purely in prefix notation, e.g. ‘’+`(2,3) instead of 2 + 3. More...
 
int ForcedLineBreakThreshold [get, set]
 Although the LES3 printer is not designed to insert line breaks mid-expression or to keep lines under a certain length, this option can avoid extremely long lines in some cases, by (1) inserting line breaks after commas in argument lists, or after very long attribute lists, and (2) ignoring the CodeSymbols.TriviaAppendStatement attribute when an expression within a braced block starts after this column on a line. More...
 
char? DigitSeparator [get, set]
 Sets the "thousands" or other digit separator for numeric literals. Valid values are null (to disable the separator), underscore (_) and single quote ('). 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]
 
virtual ILiteralPrinter LiteralPrinter [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...
 
ILiteralPrinter LiteralPrinter [get]
 Requests that a specific printer be used to convert literals into strings. More...
 

Public Member Functions

 Les3PrinterOptions (ILNodePrinterOptions options)
 
- Public Member Functions inherited from Loyc.Syntax.LNodePrinterOptions
void CopyFrom (ILNodePrinterOptions original)
 

Member Data Documentation

◆ SpaceAfterPrefixStopPrecedence

int Loyc.Syntax.Les.Les3PrinterOptions.SpaceAfterPrefixStopPrecedence = LesPrecedence.Multiply.Hi + 1

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

◆ SpaceAroundInfixStopPrecedence

int Loyc.Syntax.Les.Les3PrinterOptions.SpaceAroundInfixStopPrecedence = LesPrecedence.Multiply.Hi + 1

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

See also
LesPrecedence

◆ SpacesBetweenAppendedStatements

bool Loyc.Syntax.Les.Les3PrinterOptions.SpacesBetweenAppendedStatements = true

Whether to add a space between multiple statements printed on one line (initial value: true).

Property Documentation

◆ AllowExtraParenthesis

bool Loyc.Syntax.Les.Les3PrinterOptions.AllowExtraParenthesis
getset

Introduces extra parenthesis to express precedence, without using an empty attribute list [] to allow perfect round-tripping.

For example, the Loyc tree x * +(a, b) will be printed x * (a + b), which is a slightly different tree (the parenthesis add the trivia attribute inParens.)

◆ DigitSeparator

char? Loyc.Syntax.Les.Les3PrinterOptions.DigitSeparator
getset

Sets the "thousands" or other digit separator for numeric literals. Valid values are null (to disable the separator), underscore (_) and single quote (').

Exceptions
ArgumentExceptionInvalid property value.

For decimal numbers, this value separates thousands (e.g. 12'345'678). For hex numbers, it separates groups of four digits (e.g. 0x1234'5678). For binary numbers, it separates groups of eight digits.

◆ ForcedLineBreakThreshold

int Loyc.Syntax.Les.Les3PrinterOptions.ForcedLineBreakThreshold
getset

Although the LES3 printer is not designed to insert line breaks mid-expression or to keep lines under a certain length, this option can avoid extremely long lines in some cases, by (1) inserting line breaks after commas in argument lists, or after very long attribute lists, and (2) ignoring the CodeSymbols.TriviaAppendStatement attribute when an expression within a braced block starts after this column on a line.

The default value is 120.

Setting the threshold to zero forces all "statements" (expressions in braces) to appear on a new line. Lines can still be arbitrarily long with this option, since breaks are only added at the end of expressions within a braced block.

◆ ObeyRawText

bool Loyc.Syntax.Les.Les3PrinterOptions.ObeyRawText
getset

Causes raw text to be printed verbatim, as the EC# printer does. When this option is false, raw text trivia is printed as a normal attribute.

◆ OmitSpaceTrivia

bool Loyc.Syntax.Les.Les3PrinterOptions.OmitSpaceTrivia
getset

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

◆ PrefixNotationOnly

bool Loyc.Syntax.Les.Les3PrinterOptions.PrefixNotationOnly
getset

Print purely in prefix notation, e.g. ‘’+`(2,3) instead of 2 + 3.

◆ SpaceAfterComma

bool Loyc.Syntax.Les.Les3PrinterOptions.SpaceAfterComma
getset

Whether to print a space after each comma in an argument list.

Initial value: true

◆ SpaceInsideArgLists

bool Loyc.Syntax.Les.Les3PrinterOptions.SpaceInsideArgLists
getset

Whether to print a space inside argument lists like f( ... ).

◆ SpaceInsideGroupingParens

bool Loyc.Syntax.Les.Les3PrinterOptions.SpaceInsideGroupingParens
getset

Whether to print a space inside grouping parentheses ( ... ).

◆ SpaceInsideListBrackets

bool Loyc.Syntax.Les.Les3PrinterOptions.SpaceInsideListBrackets
getset

Whether to print a space inside square brackets for lists [ ... ].

◆ SpaceInsideTuples

bool Loyc.Syntax.Les.Les3PrinterOptions.SpaceInsideTuples
getset

Whether to print a space inside tuples like f( ...; ).

◆ UseRedundantSemicolons

bool Loyc.Syntax.Les.Les3PrinterOptions.UseRedundantSemicolons
getset

If true, a semicolon is used in addition to the usual newline to terminate each expression inside braced blocks and at the top level.

Regardless of this flag, a semicolon is forced to appear when a node uses CodeSymbols.TriviaAppendStatement to put multiple expressions on one line.

◆ WarnAboutUnprintableLiterals

bool Loyc.Syntax.Les.Les3PrinterOptions.WarnAboutUnprintableLiterals
getset

Whether to print a warning when an "unprintable" literal is encountered. In any case the literal is converted to a string, placed in double quotes and prefixed by the unqualified Type of the Value.

Initial value: true