From 98ddff97ec1d092b18ef2d176e83bd92f9671e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gassmann?= Date: Fri, 11 Jun 2021 17:28:55 +0200 Subject: [+] Added StatementParser, [~] Restructured the Parsers --- calculator-java/src/main/java/ch/bfh/Main.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'calculator-java/src/main/java/ch/bfh/Main.java') diff --git a/calculator-java/src/main/java/ch/bfh/Main.java b/calculator-java/src/main/java/ch/bfh/Main.java index e57fc8a..5dc8a91 100644 --- a/calculator-java/src/main/java/ch/bfh/Main.java +++ b/calculator-java/src/main/java/ch/bfh/Main.java @@ -1,25 +1,25 @@ package ch.bfh; -import ch.bfh.parser.ExpressionParser; +import ch.bfh.parser.StatementParser; + import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); + StatementParser sp = new StatementParser(); while (true) { - CalculatorLexer cl = new CalculatorLexer(); System.out.print("Type your expression: "); String expression = scanner.nextLine(); try { - cl.initLexer(expression); - ExpressionParser ep = new ExpressionParser(cl); - System.out.println(ep.getValue()); + sp.parseStatement(expression); + System.out.println(sp.getValue()); } catch (Exception e) { System.out.println(e.getMessage()); } } } -} +} \ No newline at end of file -- cgit v1.2.3