Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
if module_name != null then file_out.write "module {module_name}\n"
file_out.write("\n")
if module_name != null then file_out.write "module {module_name}\n"
file_out.write("\n")
- file_out.write(imports.join(""))
+ file_out.write(imports.join)
- file_out.write(class_content.join(""))
- file_out.write(wrappers.join(""))
+ file_out.write(class_content.join)
+ file_out.write(wrappers.join)
end
fun gen_licence: String
end
fun gen_licence: String
temp.add("extern class Native{jtype.id} in \"Java\" `\{ {jtype} `\}\n")
temp.add("\tsuper JavaObject\n\n")
temp.add("extern class Native{jtype.id} in \"Java\" `\{ {jtype} `\}\n")
temp.add("\tsuper JavaObject\n\n")
end
fun gen_unknown_class_header(jtype: JavaType): String
end
fun gen_unknown_class_header(jtype: JavaType): String
temp.add("extern class {nit_type} in \"Java\" `\{ {jtype.to_package_name} `\}\n")
temp.add("\tsuper JavaObject\n\nend\n")
temp.add("extern class {nit_type} in \"Java\" `\{ {jtype.to_package_name} `\}\n")
temp.add("\tsuper JavaObject\n\nend\n")
end
fun gen_attribute(jid: String, jtype: JavaType): String
end
fun gen_attribute(jid: String, jtype: JavaType): String
var temp = new Array[String]
var temp = new Array[String]
- temp.add(comment + nit_signature.join(""))
+ temp.add(comment + nit_signature.join)
# FIXME : This huge `if` block is only necessary to copy primitive arrays as long as there's no better way to do it
if comment == "#" then
# FIXME : This huge `if` block is only necessary to copy primitive arrays as long as there's no better way to do it
if comment == "#" then
temp.add(" in \"Java\" `\{\n{comment}\t\tself.{jmethod_id}({java_params});\n{comment}\t`\}\n")
end
temp.add(" in \"Java\" `\{\n{comment}\t\tself.{jmethod_id}({java_params});\n{comment}\t`\}\n")
end
var name
if is_primitive_array then
# Primitive arrays have a special naming convention
var name
if is_primitive_array then
# Primitive arrays have a special naming convention
- name = "Native" + extern_class_name.join("").capitalized + "Array"
+ name = "Native" + extern_class_name.join.capitalized + "Array"
- name = "Native" + extern_class_name.join("")
+ name = "Native" + extern_class_name.join
end
var nit_type = new NitType(name)
end
var nit_type = new NitType(name)
var text = self["text"]
if text isa JsonArray then
var text = self["text"]
if text isa JsonArray then
else
return "UNDEFINED"
end
else
return "UNDEFINED"
end
do
var code_lines = new Array[String]
for line in lines do code_lines.add(line.text)
do
var code_lines = new Array[String]
for line in lines do code_lines.add(line.text)
- var code = code_lines.join("")
+ var code = code_lines.join
code = code.replace("\n","\\l").replace("\"","\\\"").replace("\\n","|n").replace("/","\\/").replace("\r","")
# the last one is a hack
code = code.replace("\n","\\l").replace("\"","\\\"").replace("\\n","|n").replace("/","\\/").replace("\r","")
# the last one is a hack
for i in [0..10[ do
var a = (['[', ']'] * n)
a.shuffle
for i in [0..10[ do
var a = (['[', ']'] * n)
a.shuffle
if is_balanced(b) then print "{b} is well-balanced" else print "{b} is not well-balanced"
end
if is_balanced(b) then print "{b} is well-balanced" else print "{b} is not well-balanced"
end
var ary = "_###_##_#_#_#_#__#__".chars
loop
var ary = "_###_##_#_#_#_#__#__".chars
loop
var nxt = evolve(ary)
if ary == nxt then break
ary = nxt
var nxt = evolve(ary)
if ary == nxt then break
ary = nxt
class XMLDocument
super XMLEntity
class XMLDocument
super XMLEntity
- redef fun to_s do return children.join("")
+ redef fun to_s do return children.join
end
# PCDATA is any kind of non-xml formatted text
end
# PCDATA is any kind of non-xml formatted text
end
# Similar to `build_c_signature` but adapted to create the signature expected by JNI for C functions
end
# Similar to `build_c_signature` but adapted to create the signature expected by JNI for C functions
# Fiveth way: Join arrays.
# Pro: Sometime efficient on complex concatenation.
# Con: Crazy.
# Fiveth way: Join arrays.
# Pro: Sometime efficient on complex concatenation.
# Con: Crazy.
-printn(["The value of a is: ", a.to_s, ".\n"].join(""))
+printn(["The value of a is: ", a.to_s, ".\n"].join)