Beispiel #1
0
 public static ProgramFragment find_blocks(string source_code, string file_name)
 {
     var result = new ProgramFragment();
     var parser = new FoolsPegParser {report = new Report(result)};
     try
     {
         var raw_parse = parser.Parse(source_code, file_name);
         Debug.Assert(raw_parse != null, "raw_parse != null");
         result.declarations.AddRange(raw_parse.without_nulls());
     }
     catch (FormatException e)
     {
         result.errors.Add(new ErrorReport(e.Message,
             (Cursor) e.Data["cursor"],
             null,
             null,
             null,
             "Hopefully I also gave you some more specific error messages. Try fixing those first."));
     }
     catch (FatalParseError e)
     {
         result.errors.Add(e.error);
     }
     return result;
 }
Beispiel #2
0
 public static ProgramFragment with_declarations([NotNull] IEnumerable<Declaration> data)
 {
     var result = new ProgramFragment();
     result.declarations.AddRange(data);
     return result;
 }
Beispiel #3
0
 public static ProgramFragment with_declarations([NotNull] params Declaration[] data)
 {
     var result = new ProgramFragment();
     result.declarations.AddRange(data);
     return result;
 }
Beispiel #4
0
 public Report([NotNull] ProgramFragment result)
 {
     Debug.Assert(result != null, "result != null");
     _result = result;
 }