public void TestUsingExpressionWithoutEndStatement() { var inputString = new InputString(@"using System; using Compiler.Parser.Nada using jamones;"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); }
private void declaringLocaleVariablesTest() { printHeader("declaringLocaleVariablesTest"); var inputString = new InputFile(@"..\..\..\testFiles\localVariablesTests.txt"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); parser.parse(); Console.Out.WriteLine("Parsed Successfully -> local Variables"); }
public void interfaceDeclarationStmtTest() { printHeader("interfaceDeclarationStmtTest"); var inputString = new InputFile(@"..\..\..\testFiles\interfaceDeclarationTests.txt"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); parser.parse(); Console.Out.WriteLine("Parsed Successfully -> enum"); }
public void usingStmtTest() { printHeader("usingStmtTest"); var inputString = new InputFile(@"..\..\..\testFiles\usingTests.txt"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); parser.parse(); Console.Out.WriteLine("Parsed Successfully -> usings"); }
public void TestInterfaceExpressionWrongInheritanceExpression() { var inputString = new InputString(@"using System; using Compiler.Parser.Nada; using jamones; interface DIASDELASEMANA : Padre,, Tia{ void metodo(int argument, float argument); };"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); }
public void TestVariousAssignOperatorsInEnumExpression() { var inputString = new InputString(@"using System; using Compiler.Parser.Nada; using jamones; public enum DIASDELASEMANA{ LUNES=1,MARTES=2,MIERCOLES==3,JUEVES=4,VIERNES=5, }"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); }
public void TestBadArgumentsListInInterfaceMethodExpression() { var inputString = new InputString(@"using System; using Compiler.Parser.Nada; using jamones; public interface DIASDELASEMANA{ void metodo(int argument, float argument argument); }"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); }
public void TestClassCantHaveAbstractConstructor() { var inputString = new InputString(@"using System; using Compiler.Parser.Nada; using jamones; public class kevin : Nexer, Javier{ public abstract kevin(){} } "); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); }
public void TestClassWithWrongInheritanceExpression() { var inputString = new InputString(@"using System; using Compiler.Parser.Nada; using jamones; public class kevin : Nexer, Javier,{ public kevin(); } "); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); }
public void TestWrongIsExpression() { var inputString = new InputString(@"public class kevin : Javier { int x = is persona carlos; }"); printHeader("TestWrongIsExpression"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> TestWrongIsExpression"); }
public void TestClassWrongNullCoalescingOperatorsInExpression() { var inputString = new InputString(@"public class kevin : Javier { int LUNES = x ?? ( y ?? (t??5) ); bool boleano = j ?? ); }"); printHeader("TestClassWrongNullCoalescingOperatorsInExpression"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> TestClassWrongNullCoalescingOperatorsInExpression"); }
public void TestClassWWrongTernaryOperatorsInExpression() { var inputString = new InputString(@"public class kevin : Javier { int LUNES = x==0? y=(5+3):z/2; bool boleano = y>5? k--: (k>4? y++k++); }"); printHeader("TestClassWWrongTernaryOperatorsInExpression"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> TestClassWWrongTernaryOperatorsInExpression"); }
public void TestWrongLogicalExpression() { var inputString = new InputString(@"public class kevin : Javier { int LUNES = (!(isVisible && isHere) ||); bool boleano = isNull ?? true; }"); printHeader("TestWrongLogicalExpression"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> TestWrongLogicalExpression"); }
public void TestClassWrongMultiplicativeOperatorsInExpression() { var inputString = new InputString(@"public class kevin : Javier { int LUNES = (1 * 5); bool boleano = (x/5); int otro = 10 * (otro%mama) /; float f = (mama / (0*5)); }"); printHeader("expreTestClassWrongMultiplicativeOperatorsInExpressionssionsTest"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> TestClassWrongMultiplicativeOperatorsInExpression"); }
public void TestUsingAfterANamespaceExpression() { var inputString = new InputString(@"using System; using Otro; using jamones; namespace A{ using prueba; namespace B { using prueba2.prueba3.prueba4; } using system; }"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); }
public void TestClassWrongBinaryOperatorsInExpression() { var inputString = new InputString(@"public class kevin : Javier { int LUNES = 1 << 5; bool boleano = 5; int otro = 10; float f = (1 | (0 &) (100^100)); }"); printHeader("TestClassWrongBinaryOperatorsInExpression"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> TestClassWrongBinaryOperatorsInExpression"); }
public void TestClassWrongAccesMemoryOperatorsInExpression() { var inputString = new InputString(@"public class kevin : Javier { float mana = (float)(n.atributo); public int funcion = persona.methodo(x=3).metodo; float f = persona.tryParse(x); Persona persona = this.atributo; Persona persona = this.method(x,y,r,,nada); }"); printHeader("TestClassWrongAccesMemoryOperatorsInExpression"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> TestClassWrongAccesMemoryOperatorsInExpression"); }
public void TestWrongInlineExpression() { var inputString = new InputString(@"public class kevin : Javier { int prueba = (!(isVisible && iden) || noEsta); int LUNES = ((5 + 3) + (4 3)); int MARTES = ((5 * 9 / 3) - 7 + (2 * 7 + 4) / ( (128 >> 5 * 5) - (1 << 7 * 46) / 3 )) + 15; int MIERCOLES = 0; int x = y = z = w = MARTES / 2; Kevin kevin = new persona(); }"); printHeader("TestWrongInlineExpression"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> TestWrongInlineExpression"); }
public void TestClassWrongArraysInExpression() { var inputString = new InputString(@"public class kevin : Javier { float mana = new int[2][][][]; private int arreglo = new float[]{ 5,3,5}; int arreglo = new int[,,]; int arreglo = new int[2][]{ new int[5],new int[8]}; int arreglo = { new int[5], new int[4], array }; int value = new Persona(x,y,w).array[2]; int[,,,] x = new int[5,5,3,4]; }"); printHeader("TestClassWrongArraysInExpression"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> TestClassWrongArraysInExpression"); }
public void TestClassWrongUnaryOperatorsInExpression() { var inputString = new InputString(@"public class kevin : Javier { int LUNES = (x += 5); bool boleano = (y >>= 5); int otro = ((x++)); int nuevo = + ++y; float f = (~nada!); bool c = (~(nada && isVisible) || !isVisible); int t = (int)nada; float mana = (float)(n.atributo); }"); printHeader("TestClassWrongUnaryOperatorsInExpression"); var tokenGenerators = Resources.getTokenGenerators(); var lexer = new Lexer(inputString, tokenGenerators); var parser = new Compiler.Parser(lexer); Assert.Throws <SyntaxTokenExpectedException>(() => parser.parse()); Console.Out.WriteLine("Parsed Successfully -> exprTestClassWrongUnaryOperatorsInExpressionessions"); }