pascalabcnet/Parsers/KuMir-gppg-Parser/KuMir00ParserTools.cs
Бондарев Иван e6e67c193c initial commit
2015-05-14 21:35:07 +02:00

26 lines
987 B
C#

using System.Collections.Generic;
using PascalABCCompiler.SyntaxTree;
using PascalABCCompiler.Errors;
using QUT.Gppg;
namespace PascalABCCompiler.KuMir00Parser
{
// Класс глобальных описаний и статических методов
// для использования различными подсистемами парсера
public static class PT // PT - parser tools
{
public static List<Error> Errors;
//public static int max_errors;
public static string CurrentFileName;
public static SourceContext ToSourceContext(LexLocation loc)
{
if (loc != null)
return new SourceContext(loc.StartLine, loc.StartColumn + 1, loc.EndLine, loc.EndColumn);
return null;
}
public static void AddError(string message, LexLocation loc)
{
Errors.Add(new SyntaxError(message, CurrentFileName, ToSourceContext(loc), null));
}
}
}