Skip to content

Commit e335394

Browse files
Fixed entering nothing giving an error
1 parent 20e8e92 commit e335394

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

BarkScript.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "lexer.h"
55
#include "parser.h"
66

7-
const std::string bsversion = "0.0.5";
7+
const std::string bsversion = "0.0.5.1";
88

99
int main() {
1010
std::cout << "BarkScript version " << bsversion << std::endl;

Parser.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ ParseResult Parser::expr() {
4848
}
4949

5050
ParseResult Parser::parse() {
51+
if (currentToken.type == tokens::EEOF) {
52+
ParseResult pr;
53+
return pr.success(makeSharedNode(Node()));
54+
}
5155
ParseResult pr = expr();
5256
if (!pr.hasError() && currentToken.type != tokens::EEOF) {
5357
return pr.failure(makeSharedError(InvalidSyntaxError(currentToken.positionStart, currentToken.positionEnd, "Expected +, -, *, /")));

0 commit comments

Comments
 (0)