Example #1
0
        public List <IStatementList> GetPathsFrom(Statement statement)
        {
            List <IStatementList> paths   = new List <IStatementList>();
            IStatementList        newPath = ImplementationFactory.CreateStatementList();

            BuildPath(paths, newPath, statement);
            return(paths);
        }
Example #2
0
 public Assign(Variable left, Token operation, Factor right, int programLine) : base(programLine)
 {
     Left       = left;
     Operation  = operation;
     Right      = right;
     AffectedBy = ImplementationFactory.CreateStatementList();
     Affecting  = ImplementationFactory.CreateStatementList();
 }
Example #3
0
 public Variable(string name)
 {
     Name                 = name;
     Attribute            = new Attribute("varName", Name);
     ModifiedByProcedures = ImplementationFactory.CreateProcedureList();
     ModifiedByStatements = ImplementationFactory.CreateStatementList();
     UsedByProcedures     = ImplementationFactory.CreateProcedureList();
     UsedByStatements     = ImplementationFactory.CreateStatementList();
 }
Example #4
0
 public Variable(Token token)
 {
     Name                 = token.Value.ToString();
     Attribute            = new Attribute("varName", Name);
     ModifiedByProcedures = ImplementationFactory.CreateProcedureList();
     ModifiedByStatements = ImplementationFactory.CreateStatementList();
     UsedByProcedures     = ImplementationFactory.CreateProcedureList();
     UsedByStatements     = ImplementationFactory.CreateStatementList();
 }
Example #5
0
        protected override IEntityList ProcessRightSide(IProgramKnowledgeBase pkb, IEntity arg)
        {
            Statement      statement = arg as Statement;
            Statement      parent    = pkb.ParentTable.GetParent(statement);
            IStatementList result    = ImplementationFactory.CreateStatementList();

            result.AddStatement(parent);
            return(result);
        }
Example #6
0
        protected override IEntityList ProcessRightSide(IProgramKnowledgeBase pkb, IEntity arg)
        {
            Statement      statement = arg as Statement;
            Statement      followed  = pkb.FollowsTable.GetFollowedBy(statement);
            IStatementList result    = ImplementationFactory.CreateStatementList();

            result.AddStatement(followed);
            return(result);
        }
Example #7
0
 public Statement(int programLine)
 {
     ProgramLine = programLine;
     Attribute   = new Attribute("progLine", ProgramLine.ToString());
     Modifying   = ImplementationFactory.CreateVariableList();
     Using       = ImplementationFactory.CreateVariableList();
     NextedBy    = ImplementationFactory.CreateStatementList();
     Nexting     = ImplementationFactory.CreateStatementList();
     Children    = ImplementationFactory.CreateStatementList();
 }
Example #8
0
 public Procedure(string name)
 {
     Name      = name;
     Body      = ImplementationFactory.CreateStatementList();
     Attribute = new Attribute("procName", Name);
     Modifying = ImplementationFactory.CreateVariableList();
     Using     = ImplementationFactory.CreateVariableList();
     CalledBy  = ImplementationFactory.CreateProcedureList();
     Calling   = ImplementationFactory.CreateProcedureList();
 }
Example #9
0
 public IStatementList GetUsesStatements(Variable variable)
 {
     if (variable != null)
     {
         return(variable.UsedByStatements);
     }
     else
     {
         return(ImplementationFactory.CreateStatementList());
     }
 }
Example #10
0
 public IStatementList GetParentedBy(Statement statement)
 {
     if (statement != null)
     {
         return(statement.Children.Copy());
     }
     else
     {
         return(ImplementationFactory.CreateStatementList());
     }
 }
Example #11
0
 public IStatementList GetAffects(Assign assignment)
 {
     if (assignment != null)
     {
         return(assignment.AffectedBy.Copy());
     }
     else
     {
         return(ImplementationFactory.CreateStatementList());
     }
 }
Example #12
0
 public IStatementList GetNextedBy(Statement statement)
 {
     if (statement != null)
     {
         return(statement.Nexting.Copy());
     }
     else
     {
         return(ImplementationFactory.CreateStatementList());
     }
 }
Example #13
0
        public IStatementList GetParentT(Statement statement)
        {
            IStatementList parents         = ImplementationFactory.CreateStatementList();
            Statement      parentStatement = GetParent(statement);

            parents.AddStatement(parentStatement);
            for (int i = 0; i < parents.GetSize(); i++)
            {
                parents.AddEntity(GetParent(parents[i]));
            }
            return(parents);
        }
Example #14
0
        public IStatementList GetFollowsT(Statement statement)
        {
            IStatementList following          = ImplementationFactory.CreateStatementList();
            Statement      followingStatement = GetFollows(statement);

            following.AddStatement(followingStatement);
            for (int i = 0; i < following.GetSize(); i++)
            {
                following.AddStatement(GetFollows(following[i]));
            }
            return(following);
        }
Example #15
0
        public IStatementList GetFollowedByT(Statement statement)
        {
            IStatementList followed          = ImplementationFactory.CreateStatementList();
            Statement      followedStatement = GetFollowedBy(statement);

            followed.AddStatement(followedStatement);
            for (int i = 0; i < followed.GetSize(); i++)
            {
                followed.AddStatement(GetFollowedBy(followed[i]));
            }
            return(followed);
        }
Example #16
0
        private IStatementList Statements()
        {
            Statement      statement  = SingleStatement();
            IStatementList statements = ImplementationFactory.CreateStatementList();

            statements.AddStatement(statement);

            while (currentToken.Type != TokenType.RBRACE)
            {
                statements.AddStatement(SingleStatement());
            }
            return(statements);
        }
Example #17
0
        public DesignExtractor()
        {
            Statements    = ImplementationFactory.CreateStatementList();
            Variables     = ImplementationFactory.CreateVariableList();
            Procedures    = ImplementationFactory.CreateProcedureList();
            Constants     = ImplementationFactory.CreateConstantList();
            FollowsTable  = ImplementationFactory.CreateFollowsTable();
            ModifiesTable = ImplementationFactory.CreateModifiesTable();
            ParentTable   = ImplementationFactory.CreateParentTable();
            UsesTable     = ImplementationFactory.CreateUsesTable();
            CallsTable    = ImplementationFactory.CreateCallsTable();
            NextTable     = ImplementationFactory.CreateNextTable();
            AffectsTable  = ImplementationFactory.CreateAffectsTable();

            calls = new Dictionary <Procedure, List <Call> >();
        }
Example #18
0
        private IStatementList StmtLst()
        {
            Eat(TokenType.LBRACE);
            IStatementList statements = Statements();

            Eat(TokenType.RBRACE);

            IStatementList root = ImplementationFactory.CreateStatementList();

            foreach (Statement statement in statements)
            {
                root.AddStatement(statement);
            }

            return(root);
        }
Example #19
0
 public While(int programLine) : base(programLine)
 {
     Body = ImplementationFactory.CreateStatementList();
 }
Example #20
0
 public override IEntityList CreateNewList()
 {
     return(ImplementationFactory.CreateStatementList());
 }