From fed70f3ac817ed4943a230cb901fcd65dc6fdd0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gassmann?= Date: Fri, 11 Jun 2021 20:55:12 +0200 Subject: [~] First totaly functional Calculator, reorganised the files, verified and added error messages --- calculator-java/src/main/java/ch/bfh/Main.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 5dc8a91..ea01185 100644 --- a/calculator-java/src/main/java/ch/bfh/Main.java +++ b/calculator-java/src/main/java/ch/bfh/Main.java @@ -1,7 +1,8 @@ package ch.bfh; +import ch.bfh.lexer.LexerException; +import ch.bfh.parser.ParserException; import ch.bfh.parser.StatementParser; - import java.util.Scanner; public class Main { @@ -16,8 +17,8 @@ public class Main { try { sp.parseStatement(expression); - System.out.println(sp.getValue()); - } catch (Exception e) { + System.out.println("Result: " + sp.getValue()); + } catch (LexerException | ParserException e) { System.out.println(e.getMessage()); } } -- cgit v1.2.3