public virtual Template GetMessageTemplate(ANTLRMessage msg)
{
Template messageST = msg.GetMessageTemplate(tool.longMessages);
Template locationST = GetLocationFormat();
Template reportST = GetReportFormat(msg.GetErrorType().severity);
Template messageFormatST = GetMessageFormat();
bool locationValid = false;
if (msg.line != -1)
{
locationST.Add("line", msg.line);
locationValid = true;
}
if (msg.charPosition != -1)
{
locationST.Add("column", msg.charPosition);
locationValid = true;
}
if (msg.fileName != null)
{
string f = msg.fileName;
// Don't show path to file in messages; too long.
string displayFileName = msg.fileName;
if (File.Exists(f))
{
displayFileName = Path.GetFileName(f);
}
locationST.Add("file", displayFileName);
locationValid = true;
}
messageFormatST.Add("id", msg.GetErrorType().code);
messageFormatST.Add("text", messageST);
if (locationValid)
{
reportST.Add("location", locationST);
}
reportST.Add("message", messageFormatST);
//((DebugST)reportST).inspect();
// reportST.impl.dump();
return(reportST);
}