aboutsummaryrefslogtreecommitdiff
path: root/calculator-java/src/main/java/ch/bfh/Main.java
diff options
context:
space:
mode:
authorMaël Gassmann <mael.gassmann@students.bfh.ch>2021-06-11 20:55:12 +0200
committerMaël Gassmann <mael.gassmann@students.bfh.ch>2021-06-11 20:55:12 +0200
commitfed70f3ac817ed4943a230cb901fcd65dc6fdd0c (patch)
treeaea4de81656c677d33e4af6eb11375303d1dfdda /calculator-java/src/main/java/ch/bfh/Main.java
parent3baa44f1c8459713a96f4db994ee9905cc4e8df1 (diff)
[~] First totaly functional Calculator, reorganised the files, verified and added error messages
Diffstat (limited to 'calculator-java/src/main/java/ch/bfh/Main.java')
-rw-r--r--calculator-java/src/main/java/ch/bfh/Main.java7
1 files changed, 4 insertions, 3 deletions
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());
}
}