mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Fixed empty inputs breaking the interactive repl
Also tweaked README.md and CONTRIBUTING.md
This commit is contained in:
@@ -26,10 +26,10 @@ These data structures should be as independent as they can be, but there are som
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
Toy_Value ---> Toy_Stack
|
||||
Toy_Value ---> Toy_String
|
||||
Toy_Value ---> Toy_Table
|
||||
Toy_Bucket ---> Toy_String
|
||||
Toy_Value ---> Toy_String
|
||||
Toy_Value ---> Toy_Stack
|
||||
Toy_Value ---> Toy_Table
|
||||
Toy_Array
|
||||
```
|
||||
|
||||
|
||||
@@ -23,7 +23,11 @@ This repository holds the reference implementation for Toy version 2.x, written
|
||||
# Syntax
|
||||
|
||||
```toy
|
||||
print 42; //print is a built-in keyword
|
||||
//print is a built-in keyword, that can handle complex expressions
|
||||
print 6 * 7;
|
||||
|
||||
//strings can be concatenated with the .. operator
|
||||
print "Hello" .. "world!";
|
||||
|
||||
//more examples to be added as the features are implemented
|
||||
```
|
||||
|
||||
@@ -186,6 +186,11 @@ int repl(const char* name) {
|
||||
inputBuffer[--length] = '\0';
|
||||
}
|
||||
|
||||
if (length == 0) {
|
||||
printf("%s> ", name); //shows the terminal prompt
|
||||
continue;
|
||||
}
|
||||
|
||||
//end
|
||||
if (strlen(inputBuffer) == 4 && (strncmp(inputBuffer, "exit", 4) == 0 || strncmp(inputBuffer, "quit", 4) == 0)) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user