Added mem::safe_recursive_clone, and while it works for regex, it's actually slower then remaking it. Hmmmm, maybe because some of the stdlib is inefficent
This commit is contained in:
@@ -6,14 +6,15 @@ import util:*
|
||||
|
||||
fun main():int {
|
||||
var a = load_grammer(read_file(string("../krakenGrammer.kgm")))
|
||||
/*var a = load_grammer(string("grammer.kgm"))*/
|
||||
/*var a = load_grammer(read_file(string("grammer.kgm")))*/
|
||||
println(a.to_string())
|
||||
var lex = lexer(a.regexs)
|
||||
lex.set_input(read_file(string("test_grammer.krak")))
|
||||
/*lex.set_input(string("ccdahas spacedhas*/
|
||||
/*returndaaaaaaaaaaaaaa"))*/
|
||||
println("woo lexing:")
|
||||
range(80).for_each(fun(i: int) { println(lex.next().to_string()); } )
|
||||
range(8).for_each(fun(i: int) { println(lex.next().to_string()); } )
|
||||
/*range(80).for_each(fun(i: int) { println(lex.next().to_string()); } )*/
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
5
tests/test_rec_closure.expected_results
Normal file
5
tests/test_rec_closure.expected_results
Normal file
@@ -0,0 +1,5 @@
|
||||
thingy: 4
|
||||
thingy: 3
|
||||
thingy: 2
|
||||
thingy: 1
|
||||
thingy: 0
|
||||
12
tests/test_rec_closure.krak
Normal file
12
tests/test_rec_closure.krak
Normal file
@@ -0,0 +1,12 @@
|
||||
import io:*
|
||||
|
||||
fun main():int {
|
||||
var message = "thingy: "
|
||||
var func: fun(int):void = fun(it: int) {
|
||||
print(message); println(it)
|
||||
if (it > 0)
|
||||
func(it-1)
|
||||
}
|
||||
func(4)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user