Added back in float and double suffexes!

This commit is contained in:
Nathan Braswell
2015-06-28 20:50:07 -04:00
parent ce6c8241fb
commit 93cb0732cc
3 changed files with 31 additions and 1 deletions

View File

@@ -120,7 +120,8 @@ assignment_statement = factor WS "=" WS boolean_expression | factor WS "\+=" WS
declaration_statement = "var" WS identifier WS "=" WS boolean_expression | "var" WS identifier WS dec_type WS "=" WS boolean_expression | "var" WS identifier WS dec_type | "var" WS identifier WS "." WS identifier WS "\(" WS opt_parameter_list WS "\)" WS dec_type ;
hexadecimal = "0x(1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)+" ;
integer = numeric | hexadecimal ;
floating_literal = numeric "." numeric ;
floating_literal = numeric "." float_end ;
float_end = "(0|1|2|3|4|5|6|7|8|9)+" | "(0|1|2|3|4|5|6|7|8|9)+f" | "(0|1|2|3|4|5|6|7|8|9)+d" ;
bool = "true" | "false" ;
character = "'(`|1|2|3|4|5|6|7|8|9|0|-|=|(\\t)|q|w|e|r|t|y|u|i|o|p|[|]|(\\\\)|a|s|d|f|g|h|j|k|l|;|'|(\\n)|z|x|c|v|b|n|m|,|.|/|~|!|@|#|$|%|^|&|\*|\(|\)|_|\+|Q|W|E|R|T|Y|U|I|O|P|{|}|\||A|S|D|F|G|H|J|K|L|:|\"|Z|X|C|V|B|N|M|<|>|\?| |(\\0))'" ;

View File

@@ -0,0 +1,4 @@
int: 1
double: 1.000000
float: 1.000000
double: 1.000000

25
tests/test_literal.krak Normal file
View File

@@ -0,0 +1,25 @@
import io:*
fun do_num(it: int) {
print("int: ")
println(it)
}
fun do_num(it: float) {
print("float: ")
println(it)
}
fun do_num(it: double) {
print("double: ")
println(it)
}
fun main():int {
do_num(1)
do_num(1.0)
do_num(1.0f)
do_num(1.0d)
return 0
}