Ejemplo n.º 1
0
        public bool doTest()
        {
            ReqDisplay.title("Requirement #10b");
            ReqDisplay.message("Testing token extraction");

            result = FileUtils.fileLines(fileSpec1);
            if (!result)
            {
                return(false);
            }

            Lexer.Toker toker = new Lexer.Toker();
            toker.doReturnComments = true;
            toker.open(fileSpec1);
            List <Token> tokList = new List <Token>();

            while (!toker.isDone())
            {
                Token tok = toker.getTok();
                if (tok == "\n")
                {
                    tok = "\\n";
                }
                if (tok == "\r")
                {
                    tok = "\\r";
                }
                tokList.Add(tok);
            }
            ReqDisplay.showList(tokList, "Tokens:");
            return(result);
        }
Ejemplo n.º 2
0
        public bool doTest()
        {
            ReqDisplay.title("Requirement #5");
            ReqDisplay.message("Toker reads one token with each call to getTok()");
            Lexer.Toker toker = new Lexer.Toker();
            fileSpec = Path.GetFullPath(fileSpec);

            if (!toker.open(fileSpec))
            {
                Console.Write("\n  Toker can't open file \"{0}\"", fileSpec);
                return(result = false);
            }
            else
            {
                Console.Write("\n  tokenizing file \"{0}\"", fileSpec);
            }
            for (int i = 0; i < 5; ++i)
            {
                Console.Write("\n  called Toker.getTok() to get \"{0}\"", toker.getTok());
            }
            return(result);
        }