コード例 #1
0
ファイル: FoolsParser.cs プロジェクト: Minions/Minions
 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;
 }
コード例 #2
0
ファイル: ProgramFragment.cs プロジェクト: Minions/Minions
 public static ProgramFragment with_declarations([NotNull] IEnumerable<Declaration> data)
 {
     var result = new ProgramFragment();
     result.declarations.AddRange(data);
     return result;
 }
コード例 #3
0
ファイル: ProgramFragment.cs プロジェクト: Minions/Minions
 public static ProgramFragment with_declarations([NotNull] params Declaration[] data)
 {
     var result = new ProgramFragment();
     result.declarations.AddRange(data);
     return result;
 }
コード例 #4
0
ファイル: Report.cs プロジェクト: Minions/Minions
 public Report([NotNull] ProgramFragment result)
 {
     Debug.Assert(result != null, "result != null");
     _result = result;
 }