From 91a68ac2b16b7c7369afde9c1af7c803f05e1e88 Mon Sep 17 00:00:00 2001 From: Nathan Braswell Date: Thu, 3 Jul 2014 01:52:44 -0700 Subject: [PATCH] Fixed silly not bug - in one location ! was written \!, which made practically no difference to the regex, but made it so that the parser wouldn't match it to !. Also added else to grammer, but this needs work in the ASTTransformation and CGenerator. --- krakenGrammer.kgm | 6 +++--- stdlib/vector.krak | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/krakenGrammer.kgm b/krakenGrammer.kgm index 755de32..02598ac 100644 --- a/krakenGrammer.kgm +++ b/krakenGrammer.kgm @@ -36,7 +36,7 @@ triple_quoted_string = "\"\"\"((\"\"(`|1|2|3|4|5|6|7|8|9|0|-|=| |q|w|e|r|t|y|u|i identifier = alpha | alpha alphanumeric ; -overloadable_operator = "\+" | "-" | "\*" | "/" | "%" | "^" | "&" | "\|" | "~" | "\!" | "," | "=" | "\+\+" | "--" | "<<" | ">>" | "==" | "!=" | "&&" | "\|\|" | "\+=" | "-=" | "/=" | "%=" | "^=" | "&=" | "\|=" | "\*=" | "<<=" | ">>=" | "->" ; +overloadable_operator = "\+" | "-" | "\*" | "/" | "%" | "^" | "&" | "\|" | "~" | "!" | "," | "=" | "\+\+" | "--" | "<<" | ">>" | "==" | "!=" | "&&" | "\|\|" | "\+=" | "-=" | "/=" | "%=" | "^=" | "&=" | "\|=" | "\*=" | "<<=" | ">>=" | "->" ; func_identifier = identifier | identifier overloadable_operator ; function = template_dec WS type WS func_identifier WS "\(" WS opt_typed_parameter_list WS "\)" WS code_block | type WS func_identifier WS "\(" WS opt_typed_parameter_list WS "\)" WS code_block ; @@ -53,7 +53,7 @@ class_innerds = visibility_block WS class_innerds | visibility_block ; visibility_block = "public:" WS declaration_block | "protected:" WS declaration_block | "private:" WS declaration_block ; declaration_block = declaration_statement WS ";" WS declaration_block | function WS declaration_block | declaration_statement WS ";" | function ; -if_statement = "if" WS "\(" WS boolean_expression WS "\)" WS statement ; +if_statement = "if" WS "\(" WS boolean_expression WS "\)" WS statement | "if" WS "\(" WS boolean_expression WS "\)" WS statement WS "else" WS statement ; while_loop = "while" WS boolean_expression WS statement ; @@ -69,7 +69,7 @@ function_call = unarad "\(" WS opt_parameter_list WS "\)" ; boolean_expression = boolean_expression WS "\|\|" WS and_boolean_expression | and_boolean_expression ; and_boolean_expression = and_boolean_expression "&&" bool_exp | bool_exp ; -bool_exp = "!" WS bool_exp | expression WS comparator WS expression | bool | expression ; +bool_exp = expression WS comparator WS expression | bool | expression ; comparator = "==" | "<=" | ">=" | "!=" | "<" | ">" ; expression = expression WS "<<" WS term | expression WS ">>" WS shiftand | shiftand ; diff --git a/stdlib/vector.krak b/stdlib/vector.krak index a8d8537..7ab5cc2 100644 --- a/stdlib/vector.krak +++ b/stdlib/vector.krak @@ -38,7 +38,7 @@ typedef template vector { } void set(int index, T dataIn) { - if (index < 0 || index => size) + if (index < 0 || index >= size) return; data[index] = dataIn; }