diff --git a/repl.spl b/repl.spl index 5099906..6bd73de 100644 --- a/repl.spl +++ b/repl.spl @@ -8,7 +8,7 @@ func main { mega | with args ; catch { " > " print readln dyn-read exec2 "\n" print } - with { with err ; + { with err ; err:message dup null eq if { pop "Uncaught error." diff --git a/src/lexer.rs b/src/lexer.rs index b5f1208..ab1941a 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -179,8 +179,10 @@ fn read_block(str_words: &[String], isfn: bool) -> Result<(Option, Words, u types.push(str_words[i].to_owned()); i += 1; } + println!("{} {}", str_words[i], str_words[i+1]); let blk = read_block(&str_words[i + 1..], false)?; - i += 1 + blk.2; + i += 2 + blk.2; + println!("{} {}", str_words[i], str_words[i+1]); let ctch = read_block(&str_words[i + 1..], false)?; i += 1 + ctch.2; words.push(Word::Key(Keyword::Catch(types, blk.1, ctch.1))) diff --git a/std.spl b/std.spl index 6778f4a..ac1986b 100644 --- a/std.spl +++ b/std.spl @@ -473,7 +473,7 @@ func call-main-on-file { | with file ; update-types argv main exit } - with { with err ; + { with err ; err:message dup null eq if { pop "Uncaught error." diff --git a/test.spl b/test.spl index 31ecf04..2ec47f5 100644 --- a/test.spl +++ b/test.spl @@ -120,8 +120,7 @@ func main { int | with args ; "testing http" println def req "tudbut.de" 81 "GET" "/spltest" Request:new =req req:send:body _str println - } - with { with e ; + } { with e ; e:message println "it seems the internet is not available" println } @@ -136,7 +135,7 @@ func main { int | with args ; catch { "heya" throw - } with { with e ; + } { with e ; e:message println } "" println