Skip to content

Commit 1391767

Browse files
committed
Fixed the EndOfLine token redundancy
1 parent ffd2d57 commit 1391767

File tree

3 files changed

+1
-7
lines changed

3 files changed

+1
-7
lines changed

readme.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ try {
6262
} catch (CalcoolException ce) {
6363
// CalcoolException means your expression was not valid
6464
stderr.writefln(ce.msg);
65-
} catch (EndException e) {
66-
// Ignore EndException, it only indicates the end of parsing phase, sorry
6765
} catch (Exception e) {
6866
// Something bad happened! Do what you have to do.
6967
}

source/app.d

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ version (CLI_APP) {
4646
p.parseExpression().evaluate().writeln();
4747
} catch (CalcoolException ce) {
4848
stderr.writeln(ce.msg);
49-
} catch (EolException e) {
50-
continue;
5149
} catch (EofException e) {
5250
break;
5351
} catch (Exception e) {
@@ -65,8 +63,6 @@ version (CLI_APP) {
6563
} catch (CalcoolException ce) {
6664
stderr.writefln(ce.msg);
6765
return 1;
68-
} catch (EndException e) {
69-
return 0;
7066
} catch (Exception e) {
7167
return 2;
7268
}

source/calcool/parser.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public:
8080
left = infix.parse(this, left, token);
8181
}
8282

83-
if (start && input.length > 0 && input.front().type != TokenType.EOL) {
83+
if (start && input.length > 0 && consume().type != TokenType.EOL) {
8484
error();
8585
}
8686
return left;

0 commit comments

Comments
 (0)