Loyc.Syntax.Les.Les3PrettyPrinter.PrintToConsole C# (CSharp) Method

PrintToConsole() public method

public PrintToConsole ( IEnumerable nodes, bool endWithNewline = true ) : void
nodes IEnumerable
endWithNewline bool
return void
		public void PrintToConsole(IEnumerable<ILNode> nodes, bool endWithNewline = true)
		{
			base.Print(nodes);
			PrintToConsoleCore(SB, endWithNewline);
		}

Same methods

Les3PrettyPrinter::PrintToConsole ( ILNode node, bool endWithNewline = true ) : void

Usage Example

示例#1
0
		public void Les3PrettyPrinterDemo()
		{
			// Pretty printer demo
			var code = Les3LanguageService.Value.Parse(
				@".memory 1
				  .fn _sumIntegersDemo(input: i32, length: i32): i32 {
					sum: i32
					sum = 0
					.block {
					  .br stop if input s< 1
					  sum = 0
					  .loop loop {
						// I picked := for set_local and = for tee_local;
						// feel free to vote your own preference.
						$sum := i32[$input] + $sum
						$input := $input + 4
						.br loop if $length = $length + -1
					  }
					  stop:
					}
					sum // return value
				  }", msgs: ConsoleMessageSink.Value);
			var pp = new Les3PrettyPrinter(null, new Les3PrinterOptions { IndentString = "  " });
			pp.PrintToConsole(code.Cast<ILNode>());
		}