Skip to content

Commit

Permalink
Fixed entering nothing giving an error
Browse files Browse the repository at this point in the history
  • Loading branch information
Samathingamajig committed Feb 13, 2021
1 parent 20e8e92 commit e335394
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion BarkScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "lexer.h"
#include "parser.h"

const std::string bsversion = "0.0.5";
const std::string bsversion = "0.0.5.1";

int main() {
std::cout << "BarkScript version " << bsversion << std::endl;
Expand Down
4 changes: 4 additions & 0 deletions Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ ParseResult Parser::expr() {
}

ParseResult Parser::parse() {
if (currentToken.type == tokens::EEOF) {
ParseResult pr;
return pr.success(makeSharedNode(Node()));
}
ParseResult pr = expr();
if (!pr.hasError() && currentToken.type != tokens::EEOF) {
return pr.failure(makeSharedError(InvalidSyntaxError(currentToken.positionStart, currentToken.positionEnd, "Expected +, -, *, /")));
Expand Down

0 comments on commit e335394

Please sign in to comment.