2010-11-10 19:03:09 +01:00
|
|
|
group JavaPrettyPrintTemplates;
|
|
|
|
|
|
|
|
itsmine(now, includeDate) ::= <<
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// This file was translated from C# to Java by CS2J (http://www.cs2j.com).
|
|
|
|
//
|
|
|
|
// This code is to be used for evaluation of the CS2J tool ONLY.
|
|
|
|
//
|
|
|
|
// For more information about CS2J please contact cs2jcontact@scorm.com
|
|
|
|
<if(includeDate)>
|
|
|
|
//
|
|
|
|
// Translated: <now><\n>
|
|
|
|
<endif>
|
|
|
|
//
|
|
|
|
|
|
|
|
>>
|
|
|
|
|
2011-01-07 16:14:17 +01:00
|
|
|
package(now, includeDate, packageName, imports, comments, modifiers, type, endComments) ::= <<
|
2010-11-10 19:03:09 +01:00
|
|
|
<itsmine(now=now,includeDate=includeDate)>
|
2010-12-03 20:17:40 +01:00
|
|
|
<if(packageName)>package <packageName>;<endif>
|
2010-11-10 19:03:09 +01:00
|
|
|
|
2010-11-13 19:11:47 +01:00
|
|
|
<comments; separator="\n">
|
2011-01-07 16:14:17 +01:00
|
|
|
<imports>
|
|
|
|
|
2010-11-16 17:29:08 +01:00
|
|
|
<type>
|
2010-11-15 11:47:32 +01:00
|
|
|
|
|
|
|
<endComments; separator="\n">
|
2010-11-10 19:03:09 +01:00
|
|
|
>>
|
2010-11-16 13:51:43 +01:00
|
|
|
|
2011-01-07 16:14:17 +01:00
|
|
|
import_template(ns) ::= "import <ns>;"
|
|
|
|
|
2010-11-16 17:29:08 +01:00
|
|
|
// ******* CLASSES ***********
|
|
|
|
|
2010-12-13 16:27:06 +01:00
|
|
|
class(modifiers, comments, attributes, name, typeparams, extends, imps, body) ::= <<
|
2010-11-16 17:29:08 +01:00
|
|
|
<comments; separator="\n">
|
2010-12-13 16:27:06 +01:00
|
|
|
<modifiers(modifiers)>class <name> <typeparams> <extends> <imps>
|
2010-11-18 14:23:17 +01:00
|
|
|
{
|
|
|
|
<body>
|
|
|
|
}
|
|
|
|
>>
|
|
|
|
|
|
|
|
iface(modifiers, comments, attributes, name, imps, body) ::= <<
|
|
|
|
<comments; separator="\n">
|
|
|
|
<modifiers(modifiers)>interface <name> <imps>
|
2010-11-16 17:29:08 +01:00
|
|
|
{
|
|
|
|
<body>
|
|
|
|
}
|
|
|
|
>>
|
|
|
|
|
2010-11-20 15:29:39 +01:00
|
|
|
class_body(entries) ::= <<
|
|
|
|
<entries; separator="\n">
|
|
|
|
>>
|
|
|
|
|
|
|
|
class_member(comments, member) ::= <<
|
|
|
|
<comments; separator="\n">
|
|
|
|
<member>
|
|
|
|
>>
|
|
|
|
|
2010-12-21 17:11:10 +01:00
|
|
|
constructor(modifiers, name, params, exceptions, body, bodyIsSemi) ::= <<
|
|
|
|
<modifiers(modifiers)><name>(<params; separator=", ">)<if(exceptions)> throws <exceptions; separator=", "><endif> <if(bodyIsSemi)>;
|
2010-12-20 22:05:25 +01:00
|
|
|
<else>
|
|
|
|
<body>
|
|
|
|
<endif>
|
|
|
|
<\n>
|
2010-12-15 12:26:21 +01:00
|
|
|
>>
|
|
|
|
|
2010-12-21 12:03:24 +01:00
|
|
|
static_constructor(modifiers, body, bodyIsSemi) ::= <<
|
|
|
|
<modifiers(modifiers)><if(bodyIsSemi)>;
|
|
|
|
<else>
|
|
|
|
<body>
|
|
|
|
<endif>
|
|
|
|
<\n>
|
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
method(modifiers, typeparams, type, name, params, exceptions, body, bodyIsSemi) ::= <<
|
|
|
|
<modifiers(modifiers)><typeparams> <type> <name>(<params; separator=", ">)<if(exceptions)> throws <exceptions; separator=", "><endif> <if(bodyIsSemi)>;
|
|
|
|
<else>
|
|
|
|
<body>
|
|
|
|
<endif>
|
|
|
|
<\n>
|
2010-12-06 10:18:23 +01:00
|
|
|
>>
|
|
|
|
|
|
|
|
field(modifiers, type, field, comments, init) ::= "<comments><modifiers(modifiers)><type> <field>;"
|
|
|
|
|
2010-12-04 13:00:16 +01:00
|
|
|
variable_declarators(varinits) ::= "<varinits; separator=\", \">"
|
2010-11-24 07:27:05 +01:00
|
|
|
variable_declarator(typename,init) ::= "<typename><if(init)> = <init><endif>"
|
|
|
|
|
|
|
|
primary_expression_start_parts(start,follows) ::= "<start><follows>"
|
2010-11-20 15:29:39 +01:00
|
|
|
|
2010-11-19 16:49:43 +01:00
|
|
|
type_param_constraint(param, constraints) ::= "<param> extends <constraints; separator=\" & \">"
|
|
|
|
|
2010-12-06 17:24:18 +01:00
|
|
|
fixed_parameter(mod,type,name,def) ::= <<
|
|
|
|
<mod> <type> <name><if(def)> = <def><endif>
|
|
|
|
>>
|
|
|
|
|
2010-12-20 10:00:43 +01:00
|
|
|
varargs(type,name) ::= <<
|
|
|
|
<type>... <name>
|
|
|
|
>>
|
|
|
|
|
2010-12-06 10:18:23 +01:00
|
|
|
identifier(id, id2) ::= "<id><if(id2)>::<id2><endif>"
|
|
|
|
|
2010-12-06 19:56:10 +01:00
|
|
|
statement_list(statements) ::= <<
|
|
|
|
<statements; separator="\n">
|
|
|
|
>>
|
|
|
|
|
2010-12-07 15:30:04 +01:00
|
|
|
statement(statement) ::= <<
|
2010-12-09 17:30:11 +01:00
|
|
|
<statement>
|
2010-12-07 15:30:04 +01:00
|
|
|
>>
|
|
|
|
|
2011-02-04 11:58:50 +01:00
|
|
|
annotation(modifiers, comments, attributes, name, body) ::= <<
|
|
|
|
<comments; separator="\n">
|
|
|
|
<modifiers(modifiers)>@interface <name>
|
|
|
|
{
|
|
|
|
<body>
|
|
|
|
}
|
|
|
|
>>
|
2010-12-07 15:30:04 +01:00
|
|
|
|
|
|
|
//***** local var declarations:
|
|
|
|
|
2010-12-10 18:16:01 +01:00
|
|
|
local_variable_declaration(type,decs) ::= "<type> <decs>"
|
2010-12-07 15:30:04 +01:00
|
|
|
local_variable_declarator(name, init) ::= "<name><if(init)> = <init><endif>"
|
|
|
|
|
2010-12-09 17:30:11 +01:00
|
|
|
return(exp) ::= "return <exp>;"
|
|
|
|
throw(exp) ::= "throw <exp>;"
|
2010-12-07 15:30:04 +01:00
|
|
|
|
2010-11-16 17:29:08 +01:00
|
|
|
// ******* ENUMS ***********
|
2010-11-16 13:51:43 +01:00
|
|
|
|
2010-11-16 17:29:08 +01:00
|
|
|
enum(modifiers,comments, attributes, name, body) ::= <<
|
2010-11-16 13:51:43 +01:00
|
|
|
<comments; separator="\n">
|
2010-11-16 17:29:08 +01:00
|
|
|
<modifiers(modifiers)>enum <name>
|
2010-11-16 13:51:43 +01:00
|
|
|
{
|
|
|
|
<body>
|
|
|
|
}
|
|
|
|
>>
|
|
|
|
|
|
|
|
enum_body(values) ::= "<values; separator=\",\n\">"
|
|
|
|
|
|
|
|
enum_member(comments, value) ::= <<
|
|
|
|
<comments; separator="\n">
|
|
|
|
<value>
|
|
|
|
>>
|
|
|
|
|
2010-11-20 15:29:39 +01:00
|
|
|
type(name, rs, stars, opt) ::= "<name><rs><stars><opt>"
|
2010-11-18 14:23:17 +01:00
|
|
|
namespace_or_type(type1, type2, types) ::= "<type1><if(type2)>::<type2><endif><if(types)>.<types; separator=\".\"><endif>"
|
|
|
|
|
2010-11-24 07:27:05 +01:00
|
|
|
modifiers(mods) ::= "<if(mods)><mods; separator=\" \"> <endif>"
|
2010-11-18 14:23:17 +01:00
|
|
|
|
2010-12-06 17:24:18 +01:00
|
|
|
type_parameter_list(items) ::= <<
|
|
|
|
\<<items; separator=", ">\>
|
|
|
|
>>
|
|
|
|
|
2010-12-20 22:08:38 +01:00
|
|
|
extends(types) ::= "<if(types)>extends <types; separator=\", \"><endif>"
|
|
|
|
imps(types) ::= "<if(types)>implements <types; separator=\", \"><endif>"
|
2010-11-16 13:51:43 +01:00
|
|
|
|
2010-12-08 13:47:04 +01:00
|
|
|
// ******* STATEMENTS *******
|
2010-12-20 22:05:25 +01:00
|
|
|
if_template(comments, cond, then, thenindent, else, elseindent, elseisif) ::= <<
|
2010-12-10 18:57:37 +01:00
|
|
|
<comments; separator="\n">
|
2010-12-08 13:47:04 +01:00
|
|
|
if (<cond>)
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = then, indent = thenindent)>
|
2010-12-09 17:30:11 +01:00
|
|
|
<if(else)>
|
2010-12-20 22:05:25 +01:00
|
|
|
else<if(elseisif)> <block(statements = else)><else>
|
2010-12-09 17:30:11 +01:00
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = else, indent = elseindent)>
|
2010-12-09 17:30:11 +01:00
|
|
|
<endif>
|
|
|
|
<endif>
|
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
while(comments,cond,block) ::= <<
|
2010-12-10 18:57:37 +01:00
|
|
|
<comments; separator="\n">
|
2010-12-10 18:16:01 +01:00
|
|
|
while (<cond>)
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = block)>
|
2010-12-10 18:16:01 +01:00
|
|
|
>>
|
|
|
|
|
2011-03-02 19:25:41 +01:00
|
|
|
do(comments,cond,block) ::= <<
|
|
|
|
<comments; separator="\n">
|
|
|
|
do
|
|
|
|
<block(statements = block)>
|
|
|
|
while (<cond>);
|
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
for(comments,init,cond,iter,block,blockindent) ::= <<
|
2010-12-10 18:57:37 +01:00
|
|
|
<comments; separator="\n">
|
2010-12-10 18:16:01 +01:00
|
|
|
for (<init>;<cond>;<iter>)
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = block, indent=blockindent)>
|
2010-12-10 18:16:01 +01:00
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
foreach(comments,type,loopid,fromexp,block,blockindent) ::= <<
|
2010-12-10 18:57:37 +01:00
|
|
|
<comments; separator="\n">
|
2010-12-10 18:16:01 +01:00
|
|
|
for (<type> <loopid> : <fromexp>)
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = block,indent=blockindent)>
|
2010-12-10 18:16:01 +01:00
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
try(comments,block, blockindent, catches, fin) ::= <<
|
2010-12-10 18:57:37 +01:00
|
|
|
<comments; separator="\n">
|
2010-12-10 18:16:01 +01:00
|
|
|
try
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = block, indent=blockindent)>
|
2010-12-10 18:16:01 +01:00
|
|
|
<catches>
|
|
|
|
<fin>
|
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
catch_template(type, id, block, blockindent) ::= <<
|
2010-12-10 18:16:01 +01:00
|
|
|
catch (<type> <id>)
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = block, indent = blockindent)>
|
2010-12-10 18:16:01 +01:00
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
fin(block, blockindent) ::= <<
|
2010-12-10 18:16:01 +01:00
|
|
|
finally
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = block, indent = blockindent)>
|
2010-12-10 18:16:01 +01:00
|
|
|
>>
|
|
|
|
|
|
|
|
|
2010-12-10 18:57:37 +01:00
|
|
|
switch(comments,scrutinee, sections) ::= <<
|
|
|
|
<comments; separator="\n">
|
2010-12-10 18:16:01 +01:00
|
|
|
switch(<scrutinee>)
|
2010-12-10 20:36:47 +01:00
|
|
|
{
|
2010-12-10 18:16:01 +01:00
|
|
|
<sections>
|
2010-12-10 20:36:47 +01:00
|
|
|
}
|
2010-12-10 18:16:01 +01:00
|
|
|
>>
|
|
|
|
|
|
|
|
switch_section(labels,statements) ::= <<
|
2010-12-11 12:59:42 +01:00
|
|
|
<labels; separator="\n">
|
2010-12-10 18:16:01 +01:00
|
|
|
<statements; separator="\n">
|
|
|
|
|
|
|
|
>>
|
|
|
|
|
|
|
|
case(what) ::= <<
|
|
|
|
case <what>:
|
|
|
|
>>
|
|
|
|
|
|
|
|
default_template() ::= <<
|
|
|
|
default:
|
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
lock(comments,exp,block, indent) ::= <<
|
2010-12-10 18:57:37 +01:00
|
|
|
<comments; separator="\n">
|
2010-12-10 18:16:01 +01:00
|
|
|
lock(<exp>)
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = block, indent = indent)>
|
2010-12-10 18:16:01 +01:00
|
|
|
>>
|
|
|
|
|
2011-03-16 14:48:56 +01:00
|
|
|
yield(comments,exp) ::= <<
|
|
|
|
<comments; separator="\n">
|
|
|
|
yield <if(exp)>return <exp><else>break<endif>;
|
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
keyword_block(comments,keyword,block, indent) ::= <<
|
2010-12-20 10:58:48 +01:00
|
|
|
<comments; separator="\n">
|
|
|
|
<keyword>
|
2010-12-20 22:05:25 +01:00
|
|
|
<block(statements = block, indent = indent)>
|
2010-12-20 10:58:48 +01:00
|
|
|
>>
|
|
|
|
|
2010-12-20 22:05:25 +01:00
|
|
|
block(statements, indent) ::= <<
|
|
|
|
<if(indent)>
|
|
|
|
<statements>
|
2010-12-08 13:47:04 +01:00
|
|
|
<else>
|
2010-12-20 22:05:25 +01:00
|
|
|
<statements>
|
2010-12-09 17:30:11 +01:00
|
|
|
<endif>
|
2010-12-20 22:05:25 +01:00
|
|
|
>>
|
|
|
|
|
|
|
|
braceblock(statements) ::= <<
|
|
|
|
{
|
|
|
|
<statements; separator="\n">
|
2010-12-09 17:30:11 +01:00
|
|
|
}
|
2010-12-08 13:47:04 +01:00
|
|
|
>>
|
|
|
|
|
2010-11-24 11:29:30 +01:00
|
|
|
// ******* EXPRESSIONS *******
|
|
|
|
|
|
|
|
cast_expr(type, exp) ::= "(<type>)<exp>"
|
2010-12-07 15:30:04 +01:00
|
|
|
construct(type, args, inits) ::= "new <type>(<args>)<if(inits)> /* [UNIMPLEMENTED] <inits> */<endif>"
|
2010-12-17 13:48:09 +01:00
|
|
|
array_construct(type, args, inits) ::= "new <type><if(args)>[<args>]<endif><if(inits)><inits><endif>"
|
|
|
|
array_initializer(init) ::= "{ <init> }"
|
2010-12-09 17:30:11 +01:00
|
|
|
application(func, funcparens, args) ::= "<optparens(parens=funcparens,e=func)>(<args>)"
|
2010-12-10 18:16:01 +01:00
|
|
|
index(func, funcparens, args) ::= "<optparens(parens=funcparens,e=func)>[<args>]"
|
2010-12-07 15:30:04 +01:00
|
|
|
stackalloc(type, exp) ::= "stackalloc <type>[<exp>]"
|
2010-12-10 18:16:01 +01:00
|
|
|
typeof(type) ::= "<type>.class"
|
2010-11-24 11:29:30 +01:00
|
|
|
|
2010-12-10 20:36:47 +01:00
|
|
|
cond(condexp,condparens,thenexp,thenparens,elseexp,elseparens) ::= <<
|
|
|
|
<if(condparens)>(<endif><condexp><if(condparens)>)<endif> ? <if(thenparens)>(<endif><thenexp><if(thenparens)>)<endif> : <if(elseparens)>(<endif><elseexp><if(elseparens)>)<endif>
|
|
|
|
>>
|
|
|
|
|
2010-12-09 17:30:11 +01:00
|
|
|
// ******* TYPES ***********
|
|
|
|
void() ::= "void"
|
|
|
|
|
2010-12-06 17:24:18 +01:00
|
|
|
// ******* MISC ***********
|
|
|
|
|
2010-12-09 17:30:11 +01:00
|
|
|
optparens(parens, e) ::= "<if(parens)>(<endif><e><if(parens)>)<endif>"
|
2010-12-06 17:24:18 +01:00
|
|
|
parens(e) ::= "(<e>)"
|
|
|
|
rank_specifiers(rs) ::= "<rs>"
|
2010-12-11 12:59:42 +01:00
|
|
|
op(comments,pre,op,post,preparen,postparen,space) ::= <<
|
2010-12-10 18:57:37 +01:00
|
|
|
<comments; separator="\n">
|
2010-12-11 12:59:42 +01:00
|
|
|
<if(pre)><if(preparen)>(<endif><pre><if(preparen)>)<endif><space><endif><op><if(post)><space><if(postparen)>(<endif><post><if(postparen)>)<endif><endif>
|
2010-12-10 18:57:37 +01:00
|
|
|
>>
|
2010-12-19 16:13:15 +01:00
|
|
|
member_access(comments,pre,op,access,access_tyargs,preparen) ::= <<
|
|
|
|
<comments; separator="\n">
|
|
|
|
<if(preparen)>(<endif><pre><if(preparen)>)<endif><op><access_tyargs><access>
|
|
|
|
>>
|
2010-12-09 17:30:11 +01:00
|
|
|
assign(lhs,lhsparen,assign,rhs,rhsparen) ::= "<if(lhsparen)>(<endif><lhs><if(lhsparen)>)<endif> <assign> <if(rhsparen)>(<endif><rhs><if(rhsparen)>)<endif>"
|
2010-12-06 17:24:18 +01:00
|
|
|
generic_args(args) ::= "\<<args>\>"
|
|
|
|
parameter(annotation,param) ::= "/* <annotation> */ <param>"
|
|
|
|
inline_comment(payload, explanation) ::= "/* <explanation> <payload> */"
|
|
|
|
commalist(items) ::= "<items; separator=\", \">"
|
|
|
|
dotlist(items) ::= "<items; separator=\".\">"
|
2010-12-11 11:19:53 +01:00
|
|
|
//list(items,sep) ::= "<items;separator=sep>"
|
|
|
|
list(items,sep) ::= <<
|
|
|
|
<items;separator=sep>
|
|
|
|
>>
|
|
|
|
seplist(items,sep) ::= <<
|
|
|
|
<items;separator=sep>
|
|
|
|
>>
|
2010-12-07 15:30:04 +01:00
|
|
|
|
|
|
|
unsupported(reason, text) ::= "/* [UNSUPPORTED] <reason> \"<text>\" */"
|
|
|
|
|
2010-12-06 17:24:18 +01:00
|
|
|
|
2010-11-16 17:29:08 +01:00
|
|
|
// ******* UTILITY ***********
|
2010-12-04 13:00:16 +01:00
|
|
|
string(payload) ::= "<payload>"
|
|
|
|
|
|
|
|
verbatim_string(payload) ::= <<
|
|
|
|
"<payload; separator="\" + \n\"">"
|
2010-12-06 10:18:23 +01:00
|
|
|
>>
|