Example #1
0
 public Token NextToken()
 {
     oldToken = token;
     switch(FileSection)
     {
         case Section.FORMAT : token = NextTokenInFormat();
             break;
         case Section.GENERAL_INFORMATION: token = NextTokenInGeneralInformation();
             break;
         case Section.CELLS: token = NextTokenInCells();
             break;
         case Section.CELLS_INNER:
             {
                 if (mode == MODE.SCENARIO)
                 {
                     token = NextTokenInInnerCells();
                 }
                 else
                 {
                     token = NextTokenInInnerAssignCells();
                 }
             }
             break;
         case Section.CELL_RELATION: token = NextTokenInCellRelation();
             break;
         case Section.CELL_RELATION_INNER: token = NextTokenInInnerCellRelation();
             break;
         case Section.BASE:
             {
                 NextFileSection();
             }
             break;
         case Section.END: token = new Token(Tag.END);
             break;
     }
     return token;
 }
Example #2
0
        private void NextFileSection()
        {
            if(Reader.EndOfStream)
            {
                FileSection = Section.END;
                return;
            }
            String line = "";
            while (line.Length <= 0)
            {
                line = Reader.ReadLine().Trim();
            }
            String[] words = line.Split(' ');

            foreach(String word in words)
            {
                switch (word)
                {
                    case "FORMAT":
                        {
                            FileSection = Section.FORMAT;
                            this.token = new Token(Tag.FORMAT_START);
                        }
                        break;
                    case "GENERAL_INFORMATION":
                        {
                            FileSection = Section.GENERAL_INFORMATION;
                            this.token = new Token(Tag.GENERATION_INFORMATION_START);

                        }
                        break;
                    case "CELLS":
                        {
                            FileSection = Section.CELLS;
                            this.token = new Token(Tag.CELLS_START);

                        }
                        break;
                    case "CELL_RELATIONS":
                        {
                            FileSection = Section.CELL_RELATION;
                            this.token = new Token(Tag.CELL_RELATION_START);

                        }
                        break;
                }
            }
        }