/* Copyright 2010-2013 Kevin Glynn (kevin.glynn@twigletsoftware.com) Copyright 2007-2013 Rustici Software, LLC This program is free software: you can redistribute it and/or modify it under the terms of the MIT/X Window System License This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have received a copy of the MIT/X Window System License along with this program. If not, see */ using System; namespace Twiglet.CS2J.Translator { public class Templates { private static string _javaTemplateGroup = @" // version 1.1 group JavaPrettyPrintTemplates; itsmine(now, includeDate) ::= << // // Translated by CS2J (http://www.cs2j.com): <\n> // >> package(now, includeDate, packageName, imports, comments, modifiers, type, endComments) ::= << package ; >> import_list(nss) ::= << ;}; separator=""\n""> >> import_template(ns) ::= ""import ;"" // ******* CLASSES *********** class(modifiers, comments, attributes, type, name, typeparams, extends, imps, body, partial_types, end_comments) ::= << class { } >> class_body(entries) ::= << >> class_member(comments, member) ::= << >> constructor(modifiers, name, params, exceptions, body, bodyIsSemi) ::= << () throws ; <\n> >> static_constructor(modifiers, body, bodyIsSemi) ::= << ; <\n> >> method(modifiers, typeparams, type, name, params, exceptions, body, bodyIsSemi) ::= << () throws ; <\n> >> field(modifiers, type, field, comments, init) ::= "" ;"" variable_declarators(varinits) ::= """" variable_declarator(typename,init) ::= "" = "" primary_expression_start_parts(start,follows) ::= """" type_param_constraint(param, constraints) ::= "" extends "" fixed_parameter(mod,type,name,def) ::= << = >> varargs(type,name) ::= << ... >> identifier(id, id2) ::= ""::"" statement_list(statements) ::= << >> statement(statement) ::= << >> annotation(modifiers, comments, attributes, name, body) ::= << @interface { } >> //***** local var declarations: local_variable_declaration(type,decs) ::= "" "" local_variable_declarator(name, init) ::= "" = "" return(exp) ::= ""return ;"" throw(exp) ::= ""throw ;"" // ******* ENUMS *********** enum(modifiers,comments, attributes, name, body) ::= << enum { } >> enum_body(values) ::= """" enum_member(comments, value) ::= << >> type(name, rs, stars, opt) ::= """" namespace_or_type(type1, type2, types) ::= ""::."" modifiers(mods) ::= << >> type_parameter_list(items) ::= << \<\> >> extends(types) ::= ""extends "" imps(types) ::= ""implements "" // ******* STATEMENTS ******* if_template(comments, cond, then, thenindent, else, elseindent, elseisif) ::= << if () else >> while(comments,cond,block) ::= << while () >> do(comments,cond,block) ::= << do while (); >> for(comments,init,cond,iter,block,blockindent) ::= << for (;;) >> foreach(comments,type,loopid,fromexp,block,blockindent) ::= << for ( : ) >> try(comments,block, blockindent, catches, fin) ::= << try >> catch_template(type, id, block, blockindent) ::= << catch ( ) >> fin(block, blockindent) ::= << finally >> switch(comments,scrutinee, sections) ::= << switch() { } >> switch_section(labels,statements) ::= << >> case(what) ::= << case : >> default_template() ::= << default: >> synchstat(comments,exp,stat) ::= << synchronized () >> yield(comments,exp) ::= << yield return break; >> keyword_block(comments,keyword,block, indent) ::= << >> block(statements, indent) ::= << >> braceblock(statements) ::= << { } >> // ******* EXPRESSIONS ******* cast_expr(type, exp) ::= ""()"" construct(type, args, inits) ::= ""new () /* [UNIMPLEMENTED] */"" delegate(type, args, body) ::= << new () { } >> lambda(args, body) ::= << () => >> array_construct(type, args, inits) ::= ""new []"" array_construct_nobracks(type, inits) ::= ""new "" array_initializer(init) ::= ""{ }"" application(func, funcparens, args) ::= ""()"" index(func, funcparens, args) ::= ""[]"" stackalloc(type, exp) ::= ""stackalloc []"" typeof(type) ::= "".class"" cond(condexp,condparens,thenexp,thenparens,elseexp,elseparens) ::= << () ? () : () >> // ******* TYPES *********** void() ::= ""void"" // ******* MISC *********** optparens(parens, e) ::= ""()"" parens(e) ::= ""()"" rank_specifiers(rs) ::= """" op(comments,pre,op,post,preparen,postparen,space) ::= << (
)()
>>
member_access(comments,pre,op,access,access_tyargs,preparen) ::= <<

(
)
>>
assign(lhs,lhsparen,assign,rhs,rhsparen) ::= ""()  ()""
generic_args(args) ::= ""\<\>""
parameter(annotation,param) ::=  ""/*  */ ""
inline_comment(payload, explanation) ::= ""/*   */""
commalist(items) ::= """"
dotlist(items) ::= """"
//list(items,sep) ::= """"
list(items,sep) ::= <<

>>
seplist(items,sep) ::= <<

>>

unsupported(reason, text) ::= ""/* [UNSUPPORTED]  \""\"" */""


// ******* UTILITY ***********
string(payload) ::= """"

verbatim_string(payload) ::= <<
""""
>>

";

	public static string JavaTemplateGroup { get
                { return _javaTemplateGroup; }
        }
    }
}