sample-code: update for new WIP syntax (it's more persnickety)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! Implements format string evaluation in weak Conlang
|
||||
|
||||
|
||||
/// Formats a string
|
||||
#[rustfmt::skip]
|
||||
fn f(__fmt: &str) -> &str {
|
||||
let __out = "";
|
||||
let __expr = "";
|
||||
@@ -10,13 +10,13 @@ fn f(__fmt: &str) -> &str {
|
||||
for __c in chars(__fmt) {
|
||||
match __c {
|
||||
'{' => {
|
||||
__depth += 1
|
||||
__depth += 1;
|
||||
if __depth <= 1 {
|
||||
continue
|
||||
}
|
||||
},
|
||||
'}' => {
|
||||
__depth -= 1
|
||||
__depth -= 1;
|
||||
if __depth <= 0 {
|
||||
__out = fmt(__out, __label, eval(__expr));
|
||||
(__expr, __label) = ("", "");
|
||||
@@ -24,11 +24,11 @@ fn f(__fmt: &str) -> &str {
|
||||
}
|
||||
},
|
||||
':' => if __depth == 1 && __label.len() == 0 {
|
||||
__label = __expr + __c
|
||||
__label = __expr + __c;
|
||||
continue
|
||||
},
|
||||
'=' => if __depth == 1 && __label.len() == 0 {
|
||||
__label = __expr + __c
|
||||
__label = __expr + __c;
|
||||
continue
|
||||
},
|
||||
_ => {}
|
||||
|
||||
Reference in New Issue
Block a user