IsDefined() public method

public IsDefined ( string name ) : bool
name string
return bool
コード例 #1
0
        public virtual void LoadPrecRuleTemplates()
        {
            string templateGroupFile = Path.Combine("Tool", "Templates", "LeftRecursiveRules.stg");
            recRuleTemplates = new TemplateGroupFile(
                Path.Combine(
                    Path.GetDirectoryName(typeof(AntlrTool).GetTypeInfo().Assembly.Location),
                    templateGroupFile),
                Encoding.UTF8);
            if (!recRuleTemplates.IsDefined("recRule"))
            {
                tool.errMgr.ToolError(ErrorType.MISSING_CODE_GEN_TEMPLATES, "LeftRecursiveRules");
            }

            // use codegen to get correct language templates; that's it though
            CodeGenerator gen = new CodeGenerator(tool, null, language);
            TemplateGroup templates = gen.GetTemplates();
            if (templates == null)
            {
                // this class will still operate using Java templates
                templates = new CodeGenerator(tool, null, "Java").GetTemplates();
                Debug.Assert(templates != null);
            }

            codegenTemplates = templates;
        }