@@ -43,16 +43,18 @@ fn extract_cirru_edn(
4343 ':' => Tag (try ! s1 [1 :].to_string ())
4444 '"' | '|' => Str (try ! s1 [1 :].to_string ())
4545 _ =>
46- match
47- ( try ? @strconv .parse_double (s1 .trim (char_set = " " ).to_string ())) {
48- Ok ( f ) => Number ( f )
49- Err ( e ) =>
46+ try
47+ @strconv .parse_double (s1 .trim (char_set = " " ).to_string ())
48+ catch {
49+ e =>
5050 match e {
5151 @strconv .StrConvError (s ) =>
5252 raise @strconv .StrConvError (
5353 "failed to parse number: " + s ,
5454 )
5555 }
56+ } noraise {
57+ f => Number (f )
5658 }
5759 }
5860 }
@@ -86,7 +88,9 @@ fn extract_cirru_edn(
8688 None => raise @strconv .StrConvError ("missing edn do value" )
8789 Some (_v ) => ()
8890 }
89- ret .or_error (@strconv .StrConvError ("missing edn do value" ))
91+ ret .unwrap_or_error (
92+ @strconv .StrConvError ("missing edn do value" ),
93+ )
9094 }
9195 "atom" =>
9296 if xs .length () == 2 {
@@ -121,9 +125,10 @@ fn extract_cirru_edn(
121125 if is_comment (x ) {
122126 continue
123127 }
124- match (try ? extract_cirru_edn (x )) {
125- Ok (v ) => ys .push (v )
126- Err (v ) => raise @strconv .StrConvError (v .to_string ())
128+ try extract_cirru_edn (x ) catch {
129+ v => raise @strconv .StrConvError (v .to_string ())
130+ } noraise {
131+ v => ys .push (v )
127132 }
128133 }
129134 List (EdnListView (ys ))
@@ -134,9 +139,10 @@ fn extract_cirru_edn(
134139 if is_comment (x ) {
135140 continue
136141 }
137- match (try ? extract_cirru_edn (x )) {
138- Ok (v ) => ys .add (v )
139- Err (v ) => raise @strconv .StrConvError (v .to_string ())
142+ try extract_cirru_edn (x ) catch {
143+ v => raise @strconv .StrConvError (v .to_string ())
144+ } noraise {
145+ v => ys .add (v )
140146 }
141147 }
142148 Edn ::Set (EdnSetView (ys ))
@@ -240,15 +246,16 @@ fn extract_cirru_edn(
240246 match x {
241247 Leaf (y ) =>
242248 if y .length () == 2 {
243- match (try ? @strconv .parse_int (y )) {
244- Ok (b ) => ys .push (b .reinterpret_as_uint ())
245- Err (e ) =>
249+ try @strconv .parse_int (y ) catch {
250+ e =>
246251 match e {
247252 @strconv .StrConvError (s ) =>
248253 raise @strconv .StrConvError (
249254 "expected length 2 hex string in buffer, got: \{ y } \{ s } " ,
250255 )
251256 }
257+ } noraise {
258+ b => ys .push (b .reinterpret_as_uint ())
252259 }
253260 } else {
254261 raise @strconv .StrConvError (
@@ -289,7 +296,7 @@ fn assemble_cirru_node(data : Edn) -> @cirru_parser.Cirru raise EdnCommonError {
289296 Bool (v ) => Leaf (v .to_string ())
290297 Number (n ) => Leaf (n .to_string ())
291298 Symbol (s ) => Leaf ("'\{ s } " )
292- Tag (s ) => Leaf (":" + s .inner () )
299+ Tag (s ) => Leaf (":" + s .0 )
293300 Str (s ) => Leaf ("|" + s )
294301 Quote (v ) => List ([Leaf ("quote" ), v ])
295302 List (xs ) => {
@@ -303,7 +310,7 @@ fn assemble_cirru_node(data : Edn) -> @cirru_parser.Cirru raise EdnCommonError {
303310 Set (xs ) => {
304311 let ys : Array [@cirru_parser .Cirru ] = []
305312 ys .push (@cirru_parser .Cirru ::Leaf ("#{}" ))
306- let items = xs .inner ()
313+ let items = xs .0
307314 // items.sort()
308315 for x in items {
309316 ys .push (assemble_cirru_node (x ))
@@ -313,7 +320,7 @@ fn assemble_cirru_node(data : Edn) -> @cirru_parser.Cirru raise EdnCommonError {
313320 Map (xs ) => {
314321 let ys : Array [@cirru_parser .Cirru ] = []
315322 ys .push (@cirru_parser .Cirru ::Leaf ("{}" ))
316- let items = Array ::from_iter (xs .inner () .iter ())
323+ let items = Array ::from_iter (xs .0 .iter ())
317324 items .sort_by (fn (left , right ) {
318325 let (a1 , a2 ) = left
319326 let (b1 , b2 ) = right
@@ -336,7 +343,7 @@ fn assemble_cirru_node(data : Edn) -> @cirru_parser.Cirru raise EdnCommonError {
336343 Record ({ tag : name , extra : entries }) => {
337344 let ys : Array [@cirru_parser .Cirru ] = []
338345 ys .push (Leaf ("%{}" ))
339- ys .push (Leaf (":" + name .inner () ))
346+ ys .push (Leaf (":" + name .0 ))
340347 let ordered_entries = entries
341348 ordered_entries .sort_by (fn (left , right ) {
342349 let (_a1 , a2 ) = left
@@ -349,7 +356,7 @@ fn assemble_cirru_node(data : Edn) -> @cirru_parser.Cirru raise EdnCommonError {
349356 })
350357 for entry in ordered_entries {
351358 let v = entry .1
352- ys .push (List ([Leaf (":" + entry .0 .inner () ), assemble_cirru_node (v )]))
359+ ys .push (List ([Leaf (":" + entry .0 .0 ), assemble_cirru_node (v )]))
353360 }
354361 List (ys )
355362 }
@@ -366,7 +373,7 @@ fn assemble_cirru_node(data : Edn) -> @cirru_parser.Cirru raise EdnCommonError {
366373 Buffer (buf ) => {
367374 let ys : Array [@cirru_parser .Cirru ] = []
368375 ys .push (Leaf ("buf" ))
369- for b in buf .inner () {
376+ for b in buf .0 {
370377 ys .push (Leaf (BigInt ::from_int (b .reinterpret_as_int ()).to_hex ()))
371378 }
372379 List (ys )
0 commit comments