Merge pull request #1918 from renatahodovan/indent-with-spaces

Use spaces consistently to indent the generated Python code.
This commit is contained in:
Terence Parr 2017-06-27 08:16:02 -07:00 committed by GitHub
commit 916a872529
2 changed files with 24 additions and 24 deletions

View File

@ -167,16 +167,16 @@ class <parser.name> ( <if(superClass)><superClass><else>Parser<endif> ):
dumpActions(recog, argFuncs, actionFuncs, sempredFuncs) ::= <<
<if(actionFuncs)>
def action(self, localctx, ruleIndex, actionIndex):
if self._actions is None:
actions = dict()
if self._actions is None:
actions = dict()
<recog.actionFuncs.values:{f|
actions[<f.ruleIndex>] = self.<f.name>_action }; separator="\n">
self._actions = actions
action = self._actions.get(ruleIndex, None)
if action is not None:
action(localctx, actionIndex)
else:
raise Exception("No registered action for:" + str(ruleIndex))
actions[<f.ruleIndex>] = self.<f.name>_action }; separator="\n">
self._actions = actions
action = self._actions.get(ruleIndex, None)
if action is not None:
action(localctx, actionIndex)
else:
raise Exception("No registered action for:" + str(ruleIndex))
<actionFuncs.values; separator="\n">
@ -518,7 +518,7 @@ if not <chunks>:
ExceptionClause(e, catchArg, catchAction) ::= <<
catch (<catchArg>) {
<catchAction>
<catchAction>
}
>>
@ -623,7 +623,7 @@ def <r.name>(self, i=None):
LexerRuleContext() ::= "RuleContext"
/** The rule context name is the rule followed by a suffix; e.g.,
* r becomes rContext.
* r becomes rContext.
*/
RuleContextNameSuffix() ::= "Context"
@ -806,7 +806,7 @@ def serializedATN():
>>
/** Using a type to init value map, try to init a type; if not in table
* must be an object, default value is "null".
* must be an object, default value is "null".
*/
initValue(typeName) ::= <<
<javaTypeInitMap.(typeName)>

View File

@ -176,16 +176,16 @@ class <parser.name> ( <if(superClass)><superClass><else>Parser<endif> ):
dumpActions(recog, argFuncs, actionFuncs, sempredFuncs) ::= <<
<if(actionFuncs)>
def action(self, localctx:RuleContext, ruleIndex:int, actionIndex:int):
if self._actions is None:
actions = dict()
if self._actions is None:
actions = dict()
<recog.actionFuncs.values:{f|
actions[<f.ruleIndex>] = self.<f.name>_action }; separator="\n">
self._actions = actions
action = self._actions.get(ruleIndex, None)
if action is not None:
action(localctx, actionIndex)
else:
raise Exception("No registered action for:" + str(ruleIndex))
actions[<f.ruleIndex>] = self.<f.name>_action }; separator="\n">
self._actions = actions
action = self._actions.get(ruleIndex, None)
if action is not None:
action(localctx, actionIndex)
else:
raise Exception("No registered action for:" + str(ruleIndex))
<actionFuncs.values; separator="\n">
@ -527,7 +527,7 @@ if not <chunks>:
ExceptionClause(e, catchArg, catchAction) ::= <<
catch (<catchArg>) {
<catchAction>
<catchAction>
}
>>
@ -632,7 +632,7 @@ def <r.name>(self, i:int=None):
LexerRuleContext() ::= "RuleContext"
/** The rule context name is the rule followed by a suffix; e.g.,
* r becomes rContext.
* r becomes rContext.
*/
RuleContextNameSuffix() ::= "Context"
@ -813,7 +813,7 @@ def serializedATN():
>>
/** Using a type to init value map, try to init a type; if not in table
* must be an object, default value is "null".
* must be an object, default value is "null".
*/
initValue(typeName) ::= <<
<javaTypeInitMap.(typeName)>