(
and )
sexp :: SExp :: defaultinit
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
sexp :: SExpEntity :: defaultinit
sexp :: SExp :: defaultinit
core :: Object :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
sexp :: SExpEntity :: location=
Location in the source documentcore :: Object :: output_class_name
Display class name on stdout (debug only).
# A full S-Expression, delimited by `(` and `)`
class SExp
super SExpEntity
# Children of a SExp
var content = new Array[SExpEntity]
redef fun to_s do return "({content.join(" ")})"
# Returns a pretty-printable version of self
#
# assert "( ( sp 12.3 ) \"DQString\")".to_sexp.as(SExp).pretty_to_s == "(\n\t(\n\t\tsp\n\t\t12.30\n\t)\n\t\"DQString\"\n)"
fun pretty_to_s: String do return recurse_to_s(0)
private fun recurse_to_s(depth: Int): String do
var s = "{"\t" * depth}(\n"
for i in content do
if i isa SExp then
s += i.recurse_to_s(depth + 1)
s += "\n"
continue
end
s += "\t" * (depth + 1)
s += i.to_s
s += "\n"
end
return s + "{"\t" * depth})"
end
end
lib/sexp/sexp.nit:23,1--51,3