blob: 9e3e3943d3e77e0dcff49410e6e2ff133f4ac702 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package hu.bme.mit.inf.dslreasoner.formatting
import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter
import org.eclipse.xtext.formatting.impl.FormattingConfig
import hu.bme.mit.inf.dslreasoner.services.SmtLanguageGrammarAccess
/**
* 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 SmtLanguageFormatter extends AbstractDeclarativeFormatter {
// @Inject extension SmtLanguageGrammarAccess
override protected void configureFormatting(FormattingConfig c) {
val f = getGrammarAccess as SmtLanguageGrammarAccess
c.setAutoLinewrap(100000);
for(pair : f.findKeywordPairs("(",")")) {
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
c.setLinewrap.after(f.SMTAssertionRule)
c.setLinewrap.after(f.SMTFunctionDeclarationRule)
c.setLinewrap.after(f.SMTFunctionDefinitionRule)
c.setLinewrap.after(f.SMTEnumeratedTypeDeclarationRule)
c.setLinewrap.after(f.SMTSetTypeDeclarationRule)
c.setLinewrap.after(f.SMTOptionRule)
}
}
|