public ParsingException(ParsingSession session, Parser parser, string after = "(not given)", string before = "(not given)")
            : base(string.Format(
				"Expected {0} at line {1}, offset {2}, col {3}, after {4}, before {5}", 
					parser.ToString(), 
					session.CurrentLine.ToString(), 
					session.Offset.ToString(),
					session.CurrentColumn.ToString(),
					after, before))
        {
        }
 public ConstructorParser(SettingsSyntax syntax)
     : base(syntax.HeadOpen, syntax.HeadClose, syntax.HeadDelimiter)
 {
     this.valueParser = new AnyParser (
         new NumericParser(),
         new FilenameParser(),
         new StringParser(),
         new StringConcatenationParser(syntax)
     );
 }
 public ParsingSession(string data, Parser whitespaceParser = null, bool profilingEnabled = false, Map<object> references = null)
 {
     this.whitespaceParser = whitespaceParser;
     this.References = references ?? new Map<object>();
     this.Data = data;
     this.Offset = 0;
     this.CurrentLine = 0;
     this.ProfilingEnabled = profilingEnabled;
     if (profilingEnabled)
         this.ParsingProfiler = new Profiler();
 }
 public DiamondFile(SettingsSyntax syntax)
 {
     this.opener  = new CharacterParser(syntax.AnonymousHeadOpener);
     this.closer = new CharacterParser(syntax.AnonymousHeadCloser);
     this.innerParser = new AnyStringParser ();
 }
 /// <summary>
 /// Reads all contents from a file for usage in a ParsingSession, and uses
 /// and alternative parser for whitespace regions (i.e. #operations)
 /// </summary>
 /// <returns>The file.</returns>
 /// <param name="file">File.</param>
 /// <param name="whitespaceParser">Whitespace parser.</param>
 public static ParsingSession FromFile(string file, Parser whitespaceParser, bool profilingEnabled = false)
 {
     ParsingSession result = new ParsingSession (File.ReadAllText (file), whitespaceParser, profilingEnabled);
     result.SourceFile = new FileInfo (file);
     result.WorkingDirectory = result.SourceFile.Directory.FullName;
     return result;
 }