Standard extension methods for ILNodePrinter.
示例#1
0
		private EcsLanguageService(bool printPlainCSharp)
		{
			if (printPlainCSharp) {
				_printer = EcsNodePrinter.PrintPlainCSharp;
				_fileExtensions = _fileExtensionsPlainCs;
				_name = "Enhanced C# (configured for C# output)";
			}
		}
示例#2
0
        /// <summary>Converts a sequences of LNodes to strings, adding a newline after each.</summary>
        /// <param name="printer">Printer for a single LNode.</param>
        /// <param name="mode">A language-specific way of modifying printer behavior.
        /// The printer ignores the mode object if it does not not understand it.</param>
        /// <param name="indentString">A string to print for each level of indentation, such as a tab or four spaces.</param>
        /// <param name="lineSeparator">Line separator, typically "\n" or "\r\n".</param>
        /// <returns>A string form of the nodes.</returns>
        public static string PrintMultiple(this LNodePrinter printer, IEnumerable <LNode> nodes, IMessageSink msgs = null, object mode = null, string indentString = "\t", string lineSeparator = "\n")
        {
            var sb = new StringBuilder();

            foreach (LNode node in nodes)
            {
                printer(node, sb, msgs ?? MessageSink.Current, mode, indentString, lineSeparator);
                sb.Append(lineSeparator);
            }
            return(sb.ToString());
        }
示例#3
0
		public InputOutput(ICharSource text, string fileName, IParsingService input = null, LNodePrinter outPrinter = null, string outFileName = null)
		{
			Text = text; FileName = fileName ?? ""; InputLang = input; OutPrinter = outPrinter; OutFileName = outFileName;
		}