public void DetectAndIgnoreWhitespaceNewLinesR() { var program = "\r"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("EofSym", token.Name); }
public void DetectAndReturnPlusSymbol() { string program = "+"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("PlusOp", token.Name); }
public void DetectAndReturnSemiColon() { string program = ";"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("SemiColon", token.Name); }
public void DetectAndReturnComma() { string program = ","; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("Comma", token.Name); }
public void TurnEmptyProgamIntoEofSymToken() { var program = string.Empty; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("EofSym", token.Name); }
public void DetectAndReturnRightParen() { string program = ")"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("RParen", token.Name); }
public void DetectAndReturnMinusOp() { string program = "-"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("MinusOp", token.Name); }
public void ReturnLexicalErrorWhenBadCharactersEncountered() { string program = "First<Second"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("Id", token.Name); Assert.AreEqual("First", token.Value); token = microScanner.Scan(); Assert.AreEqual("Lexical Error", token.Name, token.Value); Assert.AreEqual("Bad char value: '<'", token.Value); token = microScanner.Scan(); Assert.AreEqual("Id", token.Name); Assert.AreEqual("Second", token.Value); }
public void ReturnTokenWhenScanIsCalled() { string program = "Begin"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("BeginSym", token.Name); }
public void DetectSingleEqualAsError() { string program = "="; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("Lexical Error", token.Name); }
public void DetectAndReturnIntLiteral() { string program = "1234"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("IntLiteral", token.Name); Assert.AreEqual("1234", token.Value); }
public void DetectAndReturnEndReservedWord() { string program = "End"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("EndSym", token.Name); Assert.AreEqual("END", token.Value); }
public void DetectColonFollwedByAnythingButEqualAsError() { string program = ":a"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("Lexical Error", token.Name); Assert.AreEqual("Bad char value: ':a'", token.Value); }
public void DetectAndReturnAssignOp() { string program = ":="; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("AssignOp", token.Name); Assert.AreEqual(":=", token.Value); }
public void DetectAndIgnoreCommentLine() { string program = "-- Some comment 12345\r\n "; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("EofSym", token.Name); Assert.AreEqual("EOF", token.Value); }
public void DetectAndReturnLiteral() { string program = "abcdefghijklmnopqrstuvwxyz0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("Id", token.Name); Assert.AreEqual(program, token.Value); }
public void DetectAndReturnBeginSymbol() { string program = "Begin"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("BeginSym", token.Name); Assert.AreEqual("BEGIN", token.Value); }
public void DetectAndReturnWriteReservedWord() { string program = "Write"; var microScanner = new MicroScanner(program); var token = microScanner.Scan(); Assert.AreEqual("WriteSym", token.Name); Assert.AreEqual("WRITE", token.Value); }