/* * generated by Xtext */ package hu.bme.mit.inf.dslreasoner.formatting import com.google.inject.Inject import hu.bme.mit.inf.dslreasoner.services.AlloyLanguageGrammarAccess import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter import org.eclipse.xtext.formatting.impl.FormattingConfig /** * This class contains custom formatting description. * * see : http://www.eclipse.org/Xtext/documentation.html#formatting * on how and when to use it * * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example */ class AlloyLanguageFormatter extends AbstractDeclarativeFormatter { @Inject extension AlloyLanguageGrammarAccess override protected void configureFormatting(FormattingConfig c) { // It's usually a good idea to activate the following three statements. // They will add and preserve newlines around comments c.setLinewrap(0, 1, 2).before(SL_COMMENTRule) c.setLinewrap(0, 1, 2).before(ML_COMMENTRule) c.setLinewrap(0, 1, 1).after(ML_COMMENTRule) c.setAutoLinewrap(100000); //Signatures c.setIndentationIncrement.after(ALSSignatureBodyAccess.leftCurlyBracketKeyword_5); c.setLinewrap.after(ALSSignatureBodyAccess.leftCurlyBracketKeyword_5) c.setIndentationDecrement.before(ALSSignatureBodyAccess.rightCurlyBracketKeyword_7); c.setLinewrap.after(ALSSignatureBodyAccess.rightCurlyBracketKeyword_7) c.setLinewrap.before(ALSSignatureBodyAccess.rightCurlyBracketKeyword_7) c.setNoSpace.before(ALSSignatureBodyAccess.commaKeyword_3_0) c.setLinewrap.after(ALSSignatureBodyAccess.commaKeyword_3_0) c.setNoSpace.before(ALSSignatureBodyAccess.commaKeyword_3_0) c.setNoSpace.before(ALSSignatureBodyAccess.commaKeyword_6_1_0) c.setLinewrap.after(ALSSignatureBodyAccess.commaKeyword_6_1_0) c.setNoSpace.before(ALSSignatureBodyAccess.commaKeyword_6_1_0) //c.setLinewrap(0,1,2).between(ALSSignatureDeclarationRule,ALSSignatureDeclarationRule) //Enums c.setIndentationIncrement.after(ALSEnumDeclarationAccess.leftCurlyBracketKeyword_2) c.setLinewrap.after(ALSEnumDeclarationAccess.leftCurlyBracketKeyword_2) c.setIndentationDecrement.before(ALSEnumDeclarationAccess.rightCurlyBracketKeyword_5) c.setLinewrap.before(ALSEnumDeclarationAccess.rightCurlyBracketKeyword_5) c.setLinewrap.after(ALSEnumDeclarationAccess.rightCurlyBracketKeyword_5) c.setNoSpace.before(ALSEnumDeclarationAccess.commaKeyword_4_0) //facts c.setIndentationIncrement.after(ALSFactDeclarationAccess.leftCurlyBracketKeyword_3) c.setLinewrap.after(ALSFactDeclarationAccess.leftCurlyBracketKeyword_3) c.setIndentationDecrement.before(ALSFactDeclarationAccess.rightCurlyBracketKeyword_5) c.setLinewrap.before(ALSFactDeclarationAccess.rightCurlyBracketKeyword_5) c.setLinewrap.after(ALSFactDeclarationAccess.rightCurlyBracketKeyword_5) //predicates c.setIndentationIncrement.after(ALSRelationDefinitionAccess.leftCurlyBracketKeyword_6) c.setLinewrap.after(ALSRelationDefinitionAccess.leftCurlyBracketKeyword_6) c.setIndentationDecrement.before(ALSRelationDefinitionAccess.rightCurlyBracketKeyword_8) c.setLinewrap.before(ALSRelationDefinitionAccess.rightCurlyBracketKeyword_8) c.setLinewrap.after(ALSRelationDefinitionAccess.rightCurlyBracketKeyword_8) c.setNoSpace.after(ALSRelationDefinitionAccess.leftSquareBracketKeyword_2) c.setNoSpace.before(ALSRelationDefinitionAccess.rightSquareBracketKeyword_5) c.setNoSpace.before(ALSRelationDefinitionAccess.commaKeyword_4_0) // terms //c.setNoSpace.before(ALSJoinAccess.rightSquareBracketKeyword_1_2_1_3) c.setNoSpace.before(ALSJoinAccess.fullStopKeyword_1_1) c.setNoSpace.after(ALSJoinAccess.fullStopKeyword_1_1) c.setNoSpace.before(ALSDirectProductAccess.hyphenMinusGreaterThanSignKeyword_1_2) c.setNoSpace.after(ALSDirectProductAccess.hyphenMinusGreaterThanSignKeyword_1_2) c.setNoSpace.before(ALSVariableDeclarationAccess.colonKeyword_1) // c.setNoSpace.before(ALSPreficedAccess.commaKeyword_5_3_0) // c.setNoSpace.before(ALSPreficedAccess.commaKeyword_6_4_0) // // c.setIndentationIncrement.after(ALSPreficedAccess.leftCurlyBracketKeyword_5_4) // c.setLinewrap.after(ALSPreficedAccess.leftCurlyBracketKeyword_5_4) // c.setLinewrap.before(ALSPreficedAccess.rightCurlyBracketKeyword_5_6) // c.setIndentationDecrement.before(ALSPreficedAccess.rightCurlyBracketKeyword_5_6) c.setNoSpace.after(ALSBasicRelationTermAccess.leftParenthesisKeyword_6_0) c.setNoSpace.before(ALSBasicRelationTermAccess.rightParenthesisKeyword_6_2) // Quantified expression c.setNoSpace.before(ALSQuantifiedAccess.commaKeyword_0_4_0) } }