Antlr3.Tool.ErrorManager.SetFormat C# (CSharp) Méthode

SetFormat() public static méthode

public static SetFormat ( String formatName ) : void
formatName String
Résultat void
        public static void SetFormat( String formatName )
        {
            if (ErrorManager.formatName == formatName)
                return;

            ErrorManager.formatName = formatName;
            string fileName = Path.Combine(Path.Combine(Path.Combine(Path.Combine(Path.Combine(AntlrTool.ToolPathRoot, "Tool"), "Templates"), "messages"), "formats"), formatName + ".stg");
            format = new TemplateGroupFile(fileName);
            if (!File.Exists(fileName) && formatName != "antlr")
            {
                SetFormat("antlr");
                return;
            }

            format.EnableCache = AntlrTool.EnableTemplateCache;
            format.Listener = initSTListener;
            if (!format.IsDefined("message"))
            {
                // pick random msg to load
                if (formatName.Equals("antlr"))
                {
                    RawError("no such message format file " + fileName + " retrying with default ANTLR format");
                    // recurse on this rule, trying the default message format
                    SetFormat("antlr");
                    return;
                }
                else
                {
                    // recurse on this rule, trying the default message format
                    SetFormat("antlr");
                }
            }

            format.Listener = blankSTListener;
            bool formatOK = VerifyFormat();
            if ( !formatOK && formatName.Equals( "antlr" ) )
            {
                RawError( "ANTLR installation corrupted; ANTLR messages format file " + formatName + ".stg incomplete" );
                Panic();
            }
            else if ( !formatOK )
            {
                SetFormat( "antlr" ); // recurse on this rule, trying the default message format
            }
        }