public static bool findSequence(bool findAll, params string[] toks) { bool found = false; if (!File.Exists(file)) { return(false); } Lexer.Semi semi = new Lexer.Semi(); Lexer.Toker toker = new Lexer.Toker(); toker.open(file); semi.toker = toker; while (!semi.isDone()) { semi.get(); if (semi.hasSequence(toks)) { semi.show(); found = true; if (findAll == false) { return(true); } } } return(found); }
public bool doTest() { ReqDisplay.title("Requirement #10c"); ReqDisplay.message("Testing semi extraction"); result = FileUtils.fileLines(fileSpec2); if (!result) { return(false); } Lexer.Toker toker = new Lexer.Toker(); toker.doReturnComments = true; toker.open(fileSpec2); Lexer.Semi semi = new Lexer.Semi(); semi.toker = toker; while (!semi.isDone()) { semi.get(); replace(semi, "\n", "\\n"); replace(semi, "\r", "\\r"); //replace(semi, ) semi.show(); } return(result); }
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); }
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); }
public bool doTest() { ReqDisplay.title("Requirement #6"); ReqDisplay.message("Semi uses to get tokens until a terminator is retrieved"); Lexer.Toker toker = new Lexer.Toker(); fileSpec = Path.GetFullPath(fileSpec); if (!toker.open(fileSpec)) { Console.Write("\n toker can't open \"{0}\"", fileSpec); return(result = false); } else { Console.Write("\n processing file \"{0}\"", fileSpec); } Lexer.Semi semi = new Lexer.Semi(); semi.toker = toker; while (!semi.isDone()) { semi.get(); semi.show(); } return(result); }