示例#1
0
        public Compiler(Assembly asm)
        {
            mapper = asm.GetExportedTypes().ToDictionary(t => t.Name, t => t);

            var scoperType = mapper.Values.FirstOrDefault(t => typeof(IHasPrepareScope).IsAssignableFrom(t));

            if (scoperType != null)
            {
                scoper = Activator.CreateInstance(scoperType) as IHasPrepareScope;
            }

            ActHeaderNode                = MakeCreator("ActHeaderNode");
            BinaryOperatorNode           = MakeCreator("BinaryOperatorNode");
            CharacterDeclarationListNode = MakeCreator("CharacterDeclarationListNode");
            CharacterDeclarationNode     = MakeCreator("CharacterDeclarationNode");
            CommentNode               = MakeCreator("CommentNode");
            ComparativeNode           = MakeCreator("ComparativeNode");
            ComparisonNode            = MakeCreator("ComparisonNode");
            ConditionalNode           = MakeCreator("ConditionalNode");
            ConstantNode              = MakeCreator("ConstantNode");
            EnterNode                 = MakeCreator("EnterNode");
            EqualityNode              = MakeCreator("EqualityNode");
            ExitNode                  = MakeCreator("ExitNode");
            InOutNode                 = MakeCreator("InOutNode");
            JumpNode                  = MakeCreator("JumpNode");
            LineNode                  = MakeCreator("LineNode");
            NegativeComparativeNode   = MakeCreator("NegativeComparativeNode");
            NegativeConstantNode      = MakeCreator("NegativeConstantNode");
            NonnegatedComparisonNode  = MakeCreator("NonnegatedComparisonNode");
            PlayNode                  = MakeCreator("PlayNode");
            PositiveComparativeNode   = MakeCreator("PositiveComparativeNode");
            PositiveConstantNode      = MakeCreator("PositiveConstantNode");
            PronounNode               = MakeCreator("PronounNode");
            QuestionNode              = MakeCreator("QuestionNode");
            RecallNode                = MakeCreator("RecallNode");
            RememberNode              = MakeCreator("RememberNode");
            SceneHeaderNode           = MakeCreator("SceneHeaderNode");
            SentenceNode              = MakeCreator("SentenceNode");
            StatementNode             = MakeCreator("StatementNode");
            TitleNode                 = MakeCreator("TitleNode");
            UnaryOperatorNode         = MakeCreator("UnaryOperatorNode");
            UnconditionalSentenceNode = MakeCreator("UnconditionalSentenceNode");
            ValueNode                 = MakeCreator("ValueNode");
        }
        public Compiler(Assembly asm)
        {
            mapper = asm.GetExportedTypes().ToDictionary(t => t.Name, t => t);

            var scoperType = mapper.Values.FirstOrDefault(t => typeof(IHasPrepareScope).IsAssignableFrom(t));
            if (scoperType != null)
                scoper = Activator.CreateInstance(scoperType) as IHasPrepareScope;

            ActHeaderNode = MakeCreator("ActHeaderNode");
            BinaryOperatorNode = MakeCreator("BinaryOperatorNode");
            CharacterDeclarationListNode = MakeCreator("CharacterDeclarationListNode");
            CharacterDeclarationNode = MakeCreator("CharacterDeclarationNode");
            CommentNode = MakeCreator("CommentNode");
            ComparativeNode = MakeCreator("ComparativeNode");
            ComparisonNode = MakeCreator("ComparisonNode");
            ConditionalNode = MakeCreator("ConditionalNode");
            ConstantNode = MakeCreator("ConstantNode");
            EnterNode = MakeCreator("EnterNode");
            EqualityNode = MakeCreator("EqualityNode");
            ExitNode = MakeCreator("ExitNode");
            InOutNode = MakeCreator("InOutNode");
            JumpNode = MakeCreator("JumpNode");
            LineNode = MakeCreator("LineNode");
            NegativeComparativeNode = MakeCreator("NegativeComparativeNode");
            NegativeConstantNode = MakeCreator("NegativeConstantNode");
            NonnegatedComparisonNode = MakeCreator("NonnegatedComparisonNode");
            PlayNode = MakeCreator("PlayNode");
            PositiveComparativeNode = MakeCreator("PositiveComparativeNode");
            PositiveConstantNode = MakeCreator("PositiveConstantNode");
            PronounNode = MakeCreator("PronounNode");
            QuestionNode = MakeCreator("QuestionNode");
            RecallNode = MakeCreator("RecallNode");
            RememberNode = MakeCreator("RememberNode");
            SceneHeaderNode = MakeCreator("SceneHeaderNode");
            SentenceNode = MakeCreator("SentenceNode");
            StatementNode = MakeCreator("StatementNode");
            TitleNode = MakeCreator("TitleNode");
            UnaryOperatorNode = MakeCreator("UnaryOperatorNode");
            UnconditionalSentenceNode = MakeCreator("UnconditionalSentenceNode");
            ValueNode = MakeCreator("ValueNode");
        }