forked from jasder/antlr
Combine multiple spaces around ::= into one
This commit is contained in:
parent
4cdc421ce7
commit
d4d46b2930
|
@ -566,13 +566,13 @@ catch (<catchArg>) {
|
|||
|
||||
// lexer actions are not associated with model objects
|
||||
|
||||
LexerSkipCommand() ::= "p.Skip()"
|
||||
LexerMoreCommand() ::= "p.More()"
|
||||
LexerSkipCommand() ::="p.Skip()"
|
||||
LexerMoreCommand() ::="p.More()"
|
||||
LexerPopModeCommand() ::= "p.PopMode()"
|
||||
LexerTypeCommand(arg) ::= "p.SetType(<arg>)"
|
||||
LexerChannelCommand(arg) ::= "p.SetChannel(<arg>)"
|
||||
LexerModeCommand(arg) ::= "p.SetMode(<arg>)"
|
||||
LexerPushModeCommand(arg) ::= "p.PushMode(<arg>)"
|
||||
LexerTypeCommand(arg) ::="p.SetType(<arg>)"
|
||||
LexerChannelCommand(arg) ::="p.SetChannel(<arg>)"
|
||||
LexerModeCommand(arg) ::="p.SetMode(<arg>)"
|
||||
LexerPushModeCommand(arg) ::="p.PushMode(<arg>)"
|
||||
|
||||
ActionText(t) ::= "<t.text>"
|
||||
ActionTemplate(t) ::= "<t.st>"
|
||||
|
@ -593,7 +593,7 @@ TokenLabelType() ::= "<file.TokenLabelType; null={antlr.Token}>"
|
|||
InputSymbolType() ::= "<file.InputSymbolType; null={antlr.Token}>"
|
||||
|
||||
TokenPropertyRef_text(t) ::= "(func() string { if <ctx(t)>.Get<t.label; format={cap}>() == nil { return \"\" } else { return <ctx(t)>.Get<t.label; format={cap}>().GetText() }}())"
|
||||
TokenPropertyRef_type(t) ::= "(func() int { if <ctx(t)>.Get<t.label; format={cap}>() == nil { return 0 } else { return <ctx(t)>.Get<t.label; format={cap}>().GetTokenType() }}())"
|
||||
TokenPropertyRef_type(t) ::= "(func() int { if <ctx(t)>.Get<t.label; format={cap}>() == nil { return 0 } else { return <ctx(t)>.Get<t.label; format={cap}>().GetTokenType() }}())"
|
||||
TokenPropertyRef_line(t) ::= "(func() int { if <ctx(t)>.Get<t.label; format={cap}>() == nil { return 0 } else { return <ctx(t)>.Get<t.label; format={cap}>().GetLine() }}())"
|
||||
TokenPropertyRef_pos(t) ::= "(func() int { if <ctx(t)>.Get<t.label; format={cap}>() == nil { return 0 } else { return <ctx(t)>.Get<t.label; format={cap}>().GetColumn() }}())"
|
||||
TokenPropertyRef_channel(t) ::= "(func() int { if <ctx(t)>.Get<t.label; format={cap}>() == nil { return 0 } else { return <ctx(t)>.Get<t.label; format={cap}>().GetChannel() }}())"
|
||||
|
@ -601,19 +601,19 @@ TokenPropertyRef_index(t) ::= "(func() int { if <ctx(t)>.Get<t.label; format={ca
|
|||
TokenPropertyRef_int(t) ::= "(func() int { if <ctx(t)>.Get<t.label; format={cap}>() == nil { return 0 } else { i,_ := strconv.Atoi(<ctx(t)>.Get<t.label; format={cap}>().GetText()); return i }}())"
|
||||
|
||||
RulePropertyRef_start(r) ::= "(func() antlr.Token { if <ctx(r)>.Get<r.label;format={cap}>() == nil { return nil } else { return <ctx(r)>.Get<r.label;format={cap}>().GetStart() }}())"
|
||||
RulePropertyRef_stop(r) ::= "(func() antlr.Token { if <ctx(r)>.Get<r.label;format={cap}>() == nil { return nil } else { return <ctx(r)>.Get<r.label;format={cap}>().GetStop() }}())"
|
||||
RulePropertyRef_text(r) ::= "(func() string { if <ctx(r)>.Get<r.label;format={cap}>() == nil { return \"\" } else { return p.GetTokenStream().GetTextFromTokens( <ctx(r)>.Get<r.label;format={cap}>().GetStart(),<ctx(r)>.<r.label>.GetStop()) }}())"
|
||||
RulePropertyRef_ctx(r) ::= "<ctx(r)>.Get<r.label;format={cap}>()"
|
||||
RulePropertyRef_parser(r) ::= "p"
|
||||
RulePropertyRef_stop(r) ::="(func() antlr.Token { if <ctx(r)>.Get<r.label;format={cap}>() == nil { return nil } else { return <ctx(r)>.Get<r.label;format={cap}>().GetStop() }}())"
|
||||
RulePropertyRef_text(r) ::="(func() string { if <ctx(r)>.Get<r.label;format={cap}>() == nil { return \"\" } else { return p.GetTokenStream().GetTextFromTokens( <ctx(r)>.Get<r.label;format={cap}>().GetStart(),<ctx(r)>.<r.label>.GetStop()) }}())"
|
||||
RulePropertyRef_ctx(r) ::="<ctx(r)>.Get<r.label;format={cap}>()"
|
||||
RulePropertyRef_parser(r) ::="p"
|
||||
|
||||
ThisRulePropertyRef_start(r) ::= "localctx.GetStart()"
|
||||
ThisRulePropertyRef_stop(r) ::= "localctx.GetStop()"
|
||||
ThisRulePropertyRef_text(r) ::= "p.GetTokenStream().GetTextFromTokens(localctx.GetStart(), p.GetTokenStream().LT(-1))"
|
||||
ThisRulePropertyRef_ctx(r) ::= "<ctx(r)>"
|
||||
ThisRulePropertyRef_parser(r) ::= "p"
|
||||
ThisRulePropertyRef_stop(r) ::="localctx.GetStop()"
|
||||
ThisRulePropertyRef_text(r) ::="p.GetTokenStream().GetTextFromTokens(localctx.GetStart(), p.GetTokenStream().LT(-1))"
|
||||
ThisRulePropertyRef_ctx(r) ::="<ctx(r)>"
|
||||
ThisRulePropertyRef_parser(r) ::="p"
|
||||
|
||||
NonLocalAttrRef(s) ::= "GetInvokingContext(<s.ruleIndex>).<s.name>"
|
||||
SetNonLocalAttr(s, rhsChunks) ::= "GetInvokingContext(<s.ruleIndex>).<s.name> = <rhsChunks>"
|
||||
NonLocalAttrRef(s) ::="GetInvokingContext(<s.ruleIndex>).<s.name>"
|
||||
SetNonLocalAttr(s, rhsChunks) ::="GetInvokingContext(<s.ruleIndex>).<s.name> = <rhsChunks>"
|
||||
|
||||
AddToLabelList(a) ::= "<ctx(a.label)>.<a.listName> = append(<ctx(a.label)>.<a.listName>, <labelref(a.label)>)"
|
||||
|
||||
|
@ -626,18 +626,18 @@ RuleContextListDecl(rdecl) ::= "<rdecl.name> []I<rdecl.ctxName>"
|
|||
|
||||
AttributeDecl(d) ::= "<d.name> <d.type;format={lower}><if(d.initValue)>// TODO = <d.initValue><endif>"
|
||||
|
||||
ContextTokenGetterDecl(t) ::= <<
|
||||
ContextTokenGetterDecl(t) ::=<<
|
||||
<t.name; format="cap">() antlr.TerminalNode {
|
||||
return s.GetToken(<parser.name><t.name>, 0)
|
||||
}
|
||||
>>
|
||||
|
||||
// should never be called
|
||||
ContextTokenListGetterDecl(t) ::= <<
|
||||
ContextTokenListGetterDecl(t) ::=<<
|
||||
fail: ContextTokenListGetterDecl should never be called!
|
||||
>>
|
||||
|
||||
ContextTokenListIndexedGetterDecl(t) ::= <<
|
||||
ContextTokenListIndexedGetterDecl(t) ::=<<
|
||||
<t.name; format="cap">(i int) []antlr.TerminalNode {
|
||||
if i \< 0 {
|
||||
return s.GetTokens(<parser.name><t.name>)
|
||||
|
@ -647,7 +647,7 @@ ContextTokenListIndexedGetterDecl(t) ::= <<
|
|||
}
|
||||
>>
|
||||
|
||||
ContextRuleGetterDecl(r) ::= <<
|
||||
ContextRuleGetterDecl(r) ::=<<
|
||||
<r.name; format="cap">() I<r.ctxName> {
|
||||
v := s.GetTypedRuleContext( reflect.TypeOf((*I<r.ctxName>)(nil)).Elem(),0);
|
||||
|
||||
|
@ -660,11 +660,11 @@ ContextRuleGetterDecl(r) ::= <<
|
|||
>>
|
||||
|
||||
// should never be called
|
||||
ContextRuleListGetterDecl(r) ::= <<
|
||||
ContextRuleListGetterDecl(r) ::=<<
|
||||
fail: ContextRuleListGetterDecl should never be called!
|
||||
>>
|
||||
|
||||
ContextRuleListIndexedGetterDecl(r) ::= <<
|
||||
ContextRuleListIndexedGetterDecl(r) ::=<<
|
||||
<r.name; format="cap">(i int) []I<r.ctxName> {
|
||||
var ts []antlr.RuleContext;
|
||||
|
||||
|
@ -695,9 +695,9 @@ LexerRuleContext() ::= "RuleContext"
|
|||
RuleContextNameSuffix() ::= "Context"
|
||||
|
||||
ImplicitTokenLabel(tokenName) ::= "_<tokenName>"
|
||||
ImplicitRuleLabel(ruleName) ::= "_<ruleName>"
|
||||
ImplicitSetLabel(id) ::= "_tset<id>"
|
||||
ListLabelName(label) ::= "<label>"
|
||||
ImplicitRuleLabel(ruleName) ::="_<ruleName>"
|
||||
ImplicitSetLabel(id) ::="_tset<id>"
|
||||
ListLabelName(label) ::="<label>"
|
||||
|
||||
CaptureNextToken(d) ::= "<d.varName> = p.GetTokenStream().LT(1)"
|
||||
CaptureNextTokenType(d) ::= "<d.varName> = p.GetTokenStream().LA(1);"
|
||||
|
@ -855,9 +855,9 @@ labelref(x) ::= "<if(!x.isLocal)>localctx.(*<x.ctx.name>).<endif><x.name>"
|
|||
ctx(actionChunk) ::= "localctx.(*<actionChunk.ctx.name>)"
|
||||
|
||||
// used for left-recursive rules
|
||||
recRuleAltPredicate(ruleName,opPrec) ::= "p.Precpred(p.GetParserRuleContext(), <opPrec>)"
|
||||
recRuleSetReturnAction(src,name) ::= "$<name>=$<src>.<name>"
|
||||
recRuleSetStopToken() ::= "p.GetParserRuleContext().SetStop( p.GetTokenStream().LT(-1) )"
|
||||
recRuleAltPredicate(ruleName,opPrec) ::="p.Precpred(p.GetParserRuleContext(), <opPrec>)"
|
||||
recRuleSetReturnAction(src,name) ::="$<name>=$<src>.<name>"
|
||||
recRuleSetStopToken() ::="p.GetParserRuleContext().SetStop( p.GetTokenStream().LT(-1) )"
|
||||
|
||||
recRuleAltStartAction(ruleName, ctxName, label) ::= <<
|
||||
localctx = New<ctxName>Context(p, _parentctx, _parentState)
|
||||
|
|
Loading…
Reference in New Issue