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

GetMessageType() public static method

public static GetMessageType ( int msgID ) : String
msgID int
return String
        public static String GetMessageType( int msgID )
        {
            if ( GetErrorState().warningMsgIDs.Contains( msgID ) )
            {
                return messages.GetInstanceOf( "warning" ).Render();
            }
            else if ( GetErrorState().errorMsgIDs.Contains( msgID ) )
            {
                return messages.GetInstanceOf( "error" ).Render();
            }
            AssertTrue( false, "Assertion failed! Message ID " + msgID + " created but is not present in errorMsgIDs or warningMsgIDs." );
            return "";
        }

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