1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-03 12:07:26 +00:00

Syntax changes.

This commit is contained in:
jespergravgaard 2020-04-06 08:06:00 +02:00
parent 263987f059
commit 0a11eefda0
2 changed files with 3 additions and 7 deletions

View File

@ -9,7 +9,7 @@ import org.antlr.v4.runtime.*;
* <p> * <p>
* Used by #if in the preprocessor * Used by #if in the preprocessor
*/ */
public class ExpressionParser { public class ExprParser {
/** /**
* Parse an expression * Parse an expression

View File

@ -7,10 +7,7 @@ import org.antlr.v4.runtime.CodePointCharStream;
import org.antlr.v4.runtime.tree.TerminalNode; import org.antlr.v4.runtime.tree.TerminalNode;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; public class TestExprParser {
import java.net.URISyntaxException;
public class TestExpressionParser {
/** /**
* Test the ExpressionParser * Test the ExpressionParser
@ -28,13 +25,12 @@ public class TestExpressionParser {
CodePointCharStream fragmentCharStream = CharStreams.fromString(expr); CodePointCharStream fragmentCharStream = CharStreams.fromString(expr);
CParser cParser = new CParser(null); CParser cParser = new CParser(null);
KickCLexer kickCLexer = new KickCLexer(fragmentCharStream, cParser); KickCLexer kickCLexer = new KickCLexer(fragmentCharStream, cParser);
KickCParser.ExprContext exprContext = ExpressionParser.parseExpression(kickCLexer); KickCParser.ExprContext exprContext = ExprParser.parseExpression(kickCLexer);
final KickCParserBaseVisitor<String> exprVisitor = new ExprPrinter(); final KickCParserBaseVisitor<String> exprVisitor = new ExprPrinter();
final String exprOut = exprVisitor.visit(exprContext); final String exprOut = exprVisitor.visit(exprContext);
TestCase.assertEquals("Expression output does not match ", expected, exprOut); TestCase.assertEquals("Expression output does not match ", expected, exprOut);
} }
/** Prints the expression. */ /** Prints the expression. */
private static class ExprPrinter extends KickCParserBaseVisitor<String> { private static class ExprPrinter extends KickCParserBaseVisitor<String> {