Antlr3.Tool.ErrorManager.GetMessageFormat C# (CSharp) Method

GetMessageFormat() public static method

public static GetMessageFormat ( ) : Antlr4.StringTemplate.Template
return Antlr4.StringTemplate.Template
        public static StringTemplate GetMessageFormat()
        {
            return format.GetInstanceOf( "message" );
        }

Usage Example

Beispiel #1
0
        public virtual string ToString(StringTemplate messageST)
        {
            // setup the location
            locationST      = ErrorManager.GetLocationFormat();
            reportST        = ErrorManager.GetReportFormat();
            messageFormatST = ErrorManager.GetMessageFormat();
            bool locationValid = false;

            if (line != -1)
            {
                locationST.SetAttribute("line", line);
                locationValid = true;
            }
            if (charPositionInLine != -1)
            {
                locationST.SetAttribute("column", charPositionInLine + 1);
                locationValid = true;
            }
            if (file != null)
            {
                locationST.SetAttribute("file", file);
                locationValid = true;
            }

            messageFormatST.SetAttribute("id", msgID);
            messageFormatST.SetAttribute("text", messageST);

            if (locationValid)
            {
                reportST.SetAttribute("location", locationST);
            }
            reportST.SetAttribute("message", messageFormatST);
            reportST.SetAttribute("type", ErrorManager.GetMessageType(msgID));

            return(reportST.ToString());
        }