mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-27 09:31:18 +00:00
Syntax changes.
This commit is contained in:
parent
263987f059
commit
0a11eefda0
@ -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
|
@ -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> {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user