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

Source files:
Inheritance diagram for Loyc.Syntax.Les.Les3Printer:
Loyc.Syntax.Les.Les3PrettyPrinter

Properties

StringBuilder SB [get, set]
 
IMessageSink?? MessageSink [get, set]
 Target for warning messages. More...
 
Les3PrinterOptions Options [get]
 

Public Member Functions

void SetOptions (ILNodePrinterOptions options)
 
StringBuilder Print (ILNode node, string suffix=null)
 
override string ToString ()
 
void VisitId (ILNode node)
 
void PrintIdCore (UString name, bool startToken, bool forceQuote=false)
 
void VisitLiteral (ILNode node)
 
void VisitCall (ILNode node)
 

Static Public Member Functions

static bool IsNormalIdentifier (UString name)
 
static bool IsComboOpPrefixChar (char c)
 
static bool CanPrintAsNumber (UString textValue, Symbol typeMarker)
 

Protected Types

enum  Chars {
  Delimiter = 0, IdStart = 1, SingleQuote = 2,
  Id = IdStart | SingleQuote, Punc = 4, Dot = 16,
  NumberStart = IdStart | Dot, NumberEnd = Id | Dot, DoubleQuote = 32,
  BQId = 64, StringStart = DoubleQuote | Id | BQId, At = 128,
  Space = 256, SLComment = 512
}
 Based on these flags, StartToken() and WriteToken() ensure that two adjacent tokens aren't treated like a single token when reparsed, by printing a space between them if necessary. More...
 
enum  NewlineContext {
  NewlineUnsafe = 0, NewlineSafeAfter = 1, NewlineSafeBefore = 2,
  NewlineSensitive = 4, StatementLevel = NewlineSafeBefore | NewlineSafeAfter | NewlineSensitive, AutoDetect = 8
}
 Used to help keep track of where newline trivia (and single- line comments ending in a newline) are permitted, to avoid printing newline trivia where it would count as "end of expression". More...
 

Protected Member Functions

void Print (ILNode node, Precedence context, string suffix=null, NewlineContext nlContext=NewlineContext.AutoDetect)
 
void PrintCore (ILNode node, string suffix, bool avoidKwExprBraceAmbiguity=false)
 
void StartToken (LesColorCode kind, Chars charSet)
 
void StartToken (LesColorCode kind, Chars startSet, Chars endSet)
 
void WriteToken (char firstChar, LesColorCode kind, Chars tokenSet)
 
void WriteToken (string text, LesColorCode kind, Chars tokenSet)
 
void WriteToken (string text, LesColorCode kind, Chars startSet, Chars endSet)
 
virtual void StartToken (LesColorCode kind)
 
void WriteOutsideToken (char space)
 
void Newline (bool avoidExtraNewline=false)
 
void Space (bool condition=true)
 
virtual LesColorCode ColorCodeForId (UString name)
 

Protected fields

PrinterState PS
 
ILNode _n
 
Precedence _context = Precedence.MinValue
 
NewlineContext _nlContext = NewlineContext.NewlineUnsafe
 
bool _inParensOrBracks = false
 
Chars _curSet = 0
 

Member Enumeration Documentation

◆ Chars

enum Loyc.Syntax.Les.Les3Printer.Chars
strongprotected

Based on these flags, StartToken() and WriteToken() ensure that two adjacent tokens aren't treated like a single token when reparsed, by printing a space between them if necessary.

◆ NewlineContext

Used to help keep track of where newline trivia (and single- line comments ending in a newline) are permitted, to avoid printing newline trivia where it would count as "end of expression".

Property Documentation

◆ MessageSink

IMessageSink?? Loyc.Syntax.Les.Les3Printer.MessageSink
getset

Target for warning messages.