diff --git a/node.go b/node.go index 55748d8..f6d9b4f 100644 --- a/node.go +++ b/node.go @@ -319,7 +319,14 @@ func (n *numberNode) pretty(w io.Writer, prefix string) error { if err != nil { return err } - fmt.Fprintf(w, "%snumber:\n%s%s%v\n", prefix, prefix, indent, v) + switch n.t { + case num_int: + fmt.Fprintf(w, "%sint:\n%s%s%v\n", prefix, prefix, indent, v) + case num_float: + fmt.Fprintf(w, "%sfloat:\n%s%s%v\n", prefix, prefix, indent, v) + case num_complex: + fmt.Fprintf(w, "%scomplex:\n%s%s%v\n", prefix, prefix, indent, v) + } return nil } diff --git a/tests/parse/02.out b/tests/parse/02.out index c1b448e..07123d6 100644 --- a/tests/parse/02.out +++ b/tests/parse/02.out @@ -9,65 +9,65 @@ root: name: an_int value: - number: + int: 1 assign: name: another_int value: - number: + int: 9 assign: name: moar_int value: - number: + int: -12 assign: name: a_float value: - number: + float: 1 assign: name: another_float value: - number: + float: -0.9 assign: name: extra_floaty value: - number: + float: 1.2 assign: name: complex1 value: - number: + complex: (1+1i) assign: name: complex2 value: - number: + complex: (1+0i) assign: name: complex3 value: - number: + complex: (1.3+4.7i) assign: name: complex4 value: - number: + complex: (-4.2+8.9i) assign: name: complex5 value: - number: + complex: (4.2-8.9i) diff --git a/tests/parse/03.out b/tests/parse/03.out index 964c7b9..1158123 100644 --- a/tests/parse/03.out +++ b/tests/parse/03.out @@ -4,9 +4,9 @@ root: items value: list: - number: + int: 1 - number: + int: 2 - number: + int: 3 diff --git a/tests/parse/04.out b/tests/parse/04.out index f53ad93..8aeb21a 100644 --- a/tests/parse/04.out +++ b/tests/parse/04.out @@ -3,31 +3,31 @@ root: name: root_int value: - number: + int: 1 assign: name: root_float value: - number: + float: 1.2 assign: name: root_exp value: - number: + float: 1e+09 assign: name: root_hex value: - number: + int: 703710 assign: name: root_oct value: - number: + int: 511 assign: name: @@ -48,18 +48,18 @@ root: string: three item_two: - number: + int: 2 item_one: - number: + int: 1 item_three: list: - number: + int: 1 - number: + int: 2 - number: + int: 3 item_two: string: