Skip to content

Commit 06d0724

Browse files
Update LexicalAnalyser.java
Throws LexicalException
1 parent c75abb9 commit 06d0724

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Assignment2/src/com/company/LexicalAnalyser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public static List<Token> analyse(String sourceCode) throws LexicalException {
3737
String s = furtherSplitList.get(i);
3838
if (s.length() > 0) {
3939
try {
40+
System.out.println(s);
4041
if (i > 0 && furtherSplitList.get(i - 1).matches("\"")) {
4142
tokenList.add(tokenTypeStringLit(s).get());
4243
} else if (i > 0 && furtherSplitList.get(i - 1).matches("'")) {
@@ -55,7 +56,8 @@ public static List<Token> analyse(String sourceCode) throws LexicalException {
5556
} else {tokenList.add(tokenFromString(s).get()); }
5657
} catch (NoSuchElementException e) {
5758
// tokenList.add(Optional.empty());
58-
System.out.print("Token not found: " + e + "\n");
59+
// System.out.print("Token not found: " + e + "\n");
60+
throw new LexicalException("Token not found: " + e);
5961
} catch (Exception e) {
6062
System.out.print(e);
6163
}

0 commit comments

Comments
 (0)