added "break" and "continue" statements

a LoopState was added to the CCompilerState struct which keeps track of breaks, start chunk index, and the start scope of the active loop.
Also, break.cosmo was added to the examples directory, 'continue' and 'break' work as expected.
This commit is contained in:
2020-12-24 00:41:00 -06:00
parent 31a852a127
commit a408353c25
4 changed files with 127 additions and 7 deletions

View File

@@ -5,6 +5,8 @@
CReservedWord reservedWords[] = {
{TOKEN_AND, "and", 3},
{TOKEN_BREAK, "break", 5},
{TOKEN_CONTINUE, "continue", 8},
{TOKEN_DO, "do", 2},
{TOKEN_ELSE, "else", 4},
{TOKEN_ELSEIF, "elseif", 6},