public override string ToString()
{
int line = 0;
int charPos = -1;
if (_token != null)
{
line = _token.Line;
charPos = _token.CharPositionInLine;
// check the input streams - if different then token is embedded in templateToken and we need to adjust the offset
if (_templateToken != null && !_templateToken.InputStream.Equals(Token.InputStream))
{
int templateDelimiterSize = 1;
if (_templateToken.Type == GroupParser.BIGSTRING || _templateToken.Type == GroupParser.BIGSTRING_NO_NL)
templateDelimiterSize = 2;
line += _templateToken.Line - 1;
charPos += _templateToken.CharPositionInLine + templateDelimiterSize;
}
}
string filepos = string.Format("{0}:{1}", line, charPos);
if (_sourceName != null)
return string.Format("{0} {1}: {2}", _sourceName, filepos, string.Format(Error.Message, Arg, Arg2));
return string.Format("{0}: {1}", filepos, string.Format(Error.Message, Arg, Arg2));
}