HuoLanguage / huo

interpreted language written in C
MIT License
212 stars 21 forks source link

Add rudimentary EOF checks #15

Closed TheLoneWolfling closed 8 years ago

TheLoneWolfling commented 8 years ago

Not exactly the nicest way to do this, but it at least prevents a segfault (and provides a starting point for later).

incrediblesound commented 8 years ago

Could you explain why some of the functions terminate with exit(1) and some with exit(0)? Shouldn't they all be exit(0)?

TheLoneWolfling commented 8 years ago

...Because I changed them and missed some. I'll update it.

Personally, syntax errors (as in "this script is invalid") should be a failure return code (i.e. non-zero). For instance, python3 -c "abcd" gives a return code of 1. So they should all be non-zero.

TheLoneWolfling commented 8 years ago

That better?

TheLoneWolfling commented 8 years ago

(Just keeping this branch up to date with master)

incrediblesound commented 8 years ago

Nice! The error Macro is slightly hacky, but I think that's fine because it's just a convenience for printing errors and cleans up the rest of the code as well.

TheLoneWolfling commented 8 years ago

"Slightly", you say. It's certainly something that should be replaced somewhere down the line, that's for sure.