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

GetLocationFormat() public static method

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

Usage Example

Esempio n. 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());
        }