예제 #1
0
        /** Useful for when you are sure that you are not part of a composite
         *  already.  Used in Interp/RandomPhrase and testing.
         */
        public Grammar(Tool tool)
        {
            nameSpaceChecker = new NameSpaceChecker( this );
            ll1Analyzer = new LL1Analyzer( this );
            sanity = new GrammarSanity( this );

            builtFromString = true;
            composite = new CompositeGrammar( this );
            Tool = tool;

            TemplateGroup lexerGrammarTemplateGroup = new TemplateGroupString(lexerGrammarTemplateText);
            _lexerGrammarTemplate = lexerGrammarTemplateGroup.GetInstanceOf("grammar");
            string targetsDirectory = Path.Combine(AntlrTool.ToolPathRoot, "Targets");
            target = CodeGenerator.LoadLanguageTarget((string)GetOption("language"), targetsDirectory);
        }
예제 #2
0
파일: Grammar.cs 프로젝트: bszafko/antlrcs
        /** Useful for when you are sure that you are not part of a composite
         *  already.  Used in Interp/RandomPhrase and testing.
         */
        public Grammar()
        {
            nameSpaceChecker = new NameSpaceChecker( this );
            ll1Analyzer = new LL1Analyzer( this );
            sanity = new GrammarSanity( this );

            builtFromString = true;
            composite = new CompositeGrammar( this );
        }
예제 #3
0
        /** Create a grammar from file name.  */
        public Grammar( Tool tool, string fileName, CompositeGrammar composite )
        {
            nameSpaceChecker = new NameSpaceChecker( this );
            ll1Analyzer = new LL1Analyzer( this );
            sanity = new GrammarSanity( this );

            this.composite = composite;
            Tool = tool;
            FileName = fileName;
            // ensure we have the composite set to something
            if ( composite.DelegateGrammarTreeRoot == null )
            {
                composite.SetDelegationRoot( this );
            }
            else
            {
                defaultRuleModifier = composite.DelegateGrammarTreeRoot.Grammar.DefaultRuleModifier;
            }

            TemplateGroup lexerGrammarTemplateGroup = new TemplateGroupString(lexerGrammarTemplateText);
            _lexerGrammarTemplate = lexerGrammarTemplateGroup.GetInstanceOf("grammar");
            target = CodeGenerator.LoadLanguageTarget((string)GetOption("language"), tool.TargetsDirectory);
        }
예제 #4
0
파일: Grammar.cs 프로젝트: bszafko/antlrcs
        /** Create a grammar from file name.  */
        public Grammar( Tool tool, string fileName, CompositeGrammar composite )
        {
            nameSpaceChecker = new NameSpaceChecker( this );
            ll1Analyzer = new LL1Analyzer( this );
            sanity = new GrammarSanity( this );

            this.composite = composite;
            Tool = tool;
            FileName = fileName;
            // ensure we have the composite set to something
            if ( composite.delegateGrammarTreeRoot == null )
            {
                composite.SetDelegationRoot( this );
            }
            else
            {
                defaultRuleModifier = composite.delegateGrammarTreeRoot.grammar.DefaultRuleModifier;
            }
        }