public void FunctionCallTests() { string txt = "funcCall()"; AntlrInputStream inputStream = new AntlrInputStream(txt); BogieLangLexer lexer = new BogieLangLexer(inputStream); CommonTokenStream commonTokenStream = new CommonTokenStream(lexer); BogieLangParser parser = new BogieLangParser(commonTokenStream); BogieLangParser.FunctionCallContext functionCallContext = parser.functionCall(); BogieLangBaseVisitor <object> visitor = new BogieLangBaseVisitor <object>(); visitor.Visit(functionCallContext); FunctionCall functionCall = FunctionCall.Compile(functionCallContext); Assert.True(functionCall.Identifier == "funcCall"); Assert.True(functionCall.Arguments.Count == 0); txt = "funcCall(\"arg\")"; inputStream = new AntlrInputStream(txt); lexer = new BogieLangLexer(inputStream); lexer.AddErrorListener(new ParserErrorHandler <int>()); commonTokenStream = new CommonTokenStream(lexer); parser = new BogieLangParser(commonTokenStream); parser.AddErrorListener(new ParserErrorHandler <object>()); functionCallContext = parser.functionCall(); visitor = new BogieLangBaseVisitor <object>(); visitor.Visit(functionCallContext); functionCall = FunctionCall.Compile(functionCallContext); Assert.True(functionCall.Identifier == "funcCall"); Assert.True(functionCall.Arguments[0].Literal.String == "arg"); txt = "funcCall(10.0,funcCall2())"; inputStream = new AntlrInputStream(txt); lexer = new BogieLangLexer(inputStream); lexer.AddErrorListener(new ParserErrorHandler <int>()); commonTokenStream = new CommonTokenStream(lexer); parser = new BogieLangParser(commonTokenStream); parser.AddErrorListener(new ParserErrorHandler <object>()); functionCallContext = parser.functionCall(); visitor = new BogieLangBaseVisitor <object>(); visitor.Visit(functionCallContext); functionCall = FunctionCall.Compile(functionCallContext); Assert.True(functionCall.Identifier == "funcCall"); Assert.True(functionCall.Arguments[0].Literal.Real == 10.0); Assert.True(functionCall.Arguments[1].FunctionCall.Identifier == "funcCall2"); }