nitcc: tests script return non-zero on failure (print is not enough)
[nit.git] / examples / rosettacode / s_exp.nit
1 #!/usr/bin/env nit
2 #
3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # This program is public domain
5
6 # Simple Rosetta-code task : Parsing a S-Expression
7 module s_exp
8
9 import sexp
10
11 var src = """((data "quoted data" 123 4.5)
12 (data (!@# (4.5) "(more" "data)")))"""
13
14 var sexp = src.to_sexp
15
16 if sexp isa SExpError then
17 print sexp
18 exit(1)
19 end
20
21 print sexp
22
23 if sexp isa SExp then print sexp.pretty_to_s