diff --git a/HISTORY b/HISTORY index dff3f0d..f291518 100755 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,6 @@ +Apr. 15 2016 +Added some error raising when met incomplete routine or class + Apr. 13 2016 Fixed a negative calculation issue with brackets diff --git a/README.md b/README.md index 11aea1c..c7b559d 100755 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ MY-BASIC is a lightweight cross-platform easy extendable BASIC interpreter writt ## Compatibility -It fits well with Workstation, PC, Tablet, Pad, Mobile Phone, PDA, Video Game Console, Raspberry Pi, Intel Edison, Arduino and even MCU; totally portable to Windows, OS X, Unix, Linux, iOS, Android, RTOS, etc. +It fits well with Workstation, PC, Tablet, Pad, Mobile Phone, PDA, Video Game Console, Raspberry Pi, Intel Edison, Arduino and even MCU; totally portable to Windows, MacOS, Unix, Linux, iOS, Android, RTOS, etc. ## Main features @@ -91,10 +91,10 @@ More detail are issued in the [Wiki](https://github.com/paladin-t/my_basic/wiki) ### Use standalone interpreter binary -This repository contains precompiled binaries for [Windows](output/my_basic.exe) and [OS X](output/my_basic_mac), it's efficient to download it and have a first impressive playground. Or you could make a build as follow: +This repository contains precompiled binaries for [Windows](output/my_basic.exe) and [MacOS](output/my_basic_mac), it's efficient to download it and have a first impressive playground. Or you could make a build as follow: * Open the Visual Studio solution `my_basic.sln` on Windows to build an executable -* Open the Xcode solution `my_basic_mac.xcodeproj` on OS X to build an OS X executable +* Open the Xcode solution `my_basic_mac.xcodeproj` on MacOS to build an MacOS executable * If you were using a *nix OS, then use the `makefile` with a "make" toolchain to build an interpreter binary according to your specific platform To compile an interpreter binary for your own platform manually, please follow the steps: diff --git a/core/my_basic.c b/core/my_basic.c index 5132ef5..20e6e3e 100755 --- a/core/my_basic.c +++ b/core/my_basic.c @@ -265,9 +265,11 @@ static const char* _ERR_DESC[] = { "Don't suspend in a routine", "Don't mix instructional and structured sub routines", "Invalid routine", + "Incomplete routine", "Routine expected", "Duplicate routine", "Invalid class", + "Incomplete class", "Class expected", "Duplicate class", "Wrong meta class", @@ -11854,6 +11856,23 @@ int mb_run(struct mb_interpreter_t* s) { mb_assert(s); + if(s->parsing_context) { + if(s->parsing_context->routine_state) { + result = MB_FUNC_ERR; + _handle_error_now(s, SE_RN_INCOMPLETE_ROUTINE, s->source_file, MB_FUNC_ERR); + + goto _exit; + } +#ifdef MB_ENABLE_CLASS + if(s->parsing_context->class_state != _CLASS_STATE_NONE) { + result = MB_FUNC_ERR; + _handle_error_now(s, SE_RN_INCOMPLETE_CLASS, s->source_file, MB_FUNC_ERR); + + goto _exit; + } +#endif /* MB_ENABLE_CLASS */ + } + _destroy_parsing_context(&s->parsing_context); s->handled_error = false; diff --git a/core/my_basic.h b/core/my_basic.h index 7a90cb3..2d37897 100755 --- a/core/my_basic.h +++ b/core/my_basic.h @@ -391,9 +391,11 @@ typedef enum mb_error_e { SE_RN_DONT_SUSPEND_IN_A_ROUTINE, SE_RN_DONT_MIX_INSTRUCTIONAL_AND_STRUCTURED, SE_RN_INVALID_ROUTINE, + SE_RN_INCOMPLETE_ROUTINE, SE_RN_ROUTINE_EXPECTED, SE_RN_DUPLICATE_ROUTINE, SE_RN_INVALID_CLASS, + SE_RN_INCOMPLETE_CLASS, SE_RN_CLASS_EXPECTED, SE_RN_DUPLICATE_CLASS, SE_RN_WRONG_META_CLASS, diff --git a/output/my_basic.exe b/output/my_basic.exe index af803f3..bf39662 100755 Binary files a/output/my_basic.exe and b/output/my_basic.exe differ