Subtle whitespace changes in Java.stg reduces size of generated code without hurting legibility

This commit is contained in:
Sam Harwell 2012-10-28 17:16:37 -05:00
parent 25c5802ba4
commit 37425b70d0
1 changed files with 48 additions and 48 deletions

View File

@ -290,7 +290,7 @@ CodeBlockForAlt(currentAltCodeBlock, locals, preamble, ops) ::= <<
LL1AltBlock(choice, preamble, alts, error) ::= <<
setState(<choice.stateNumber>);
//_errHandler.sync(this);
<!_errHandler.sync(this);!>
<if(choice.label)><labelref(choice.label)> = _input.LT(1);<endif>
<preamble; separator="\n">
switch (_input.LA(1)) {
@ -304,7 +304,7 @@ switch ( _input.LA(1) ) {
LL1OptionalBlock(choice, alts, error) ::= <<
setState(<choice.stateNumber>);
//_errHandler.sync(this);
<!_errHandler.sync(this);!>
switch (_input.LA(1)) {
<choice.altLook,alts:{look,alt| <cases(ttypes=look)>
<alt>
@ -316,7 +316,7 @@ switch ( _input.LA(1) ) {
LL1OptionalBlockSingleAlt(choice, expr, alts, preamble, error, followExpr) ::= <<
setState(<choice.stateNumber>);
//_errHandler.sync(this);
<!_errHandler.sync(this);!>
<preamble; separator="\n">
if (<expr>) {
<alts; separator="\n">
@ -386,7 +386,7 @@ do {
AltBlock(choice, preamble, alts, error) ::= <<
setState(<choice.stateNumber>);
//_errHandler.sync(this);
<!_errHandler.sync(this);!>
<if(choice.label)><labelref(choice.label)> = _input.LT(1);<endif>
<preamble; separator="\n">
switch ( getInterpreter().adaptivePredict(_input,<choice.decision>,_ctx) ) {
@ -399,7 +399,7 @@ case <i>:
OptionalBlock(choice, alts, error) ::= <<
setState(<choice.stateNumber>);
//_errHandler.sync(this);
<!_errHandler.sync(this);!>
switch ( getInterpreter().adaptivePredict(_input,<choice.decision>,_ctx) ) {
<alts:{alt |
case <i><if(!choice.ast.greedy)>+1<endif>:
@ -760,9 +760,9 @@ public static final ATN _ATN =
ATNSimulator.deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
//org.antlr.v4.tool.DOTGenerator dot = new org.antlr.v4.tool.DOTGenerator(null);
//System.out.println(dot.getDOT(_ATN.decisionToState.get(0), ruleNames, false));
//System.out.println(dot.getDOT(_ATN.ruleToStartState[2], ruleNames, false));
<! org.antlr.v4.tool.DOTGenerator dot = new org.antlr.v4.tool.DOTGenerator(null);!>
<! System.out.println(dot.getDOT(_ATN.decisionToState.get(0), ruleNames, false));!>
<! System.out.println(dot.getDOT(_ATN.ruleToStartState[2], ruleNames, false));!>
}
>>