Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.antlr.codegen.templates.Ruby.AST.stg Maven / Gradle / Ivy
@parserBody.mixins() ::= <<
<@super.mixins()>
include ANTLR3::ASTBuilder
>>
gatedAction(block) ::= <<
if
end
>>
ruleDeclarations() ::= <<
root_0 = nil<\n>
>>
ruleLabelDefs() ::= <<
<[ruleDescriptor.tokenLabels,ruleDescriptor.wildcardTreeLabels,ruleDescriptor.wildcardTreeListLabels,ruleDescriptor.tokenListLabels]
:{int |tree_for_ = nil}; separator="\n">
= ANTLR3::AST::RewriteRuleStream.new( @adaptor, "token " )}; separator="\n">
= ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule " )}; separator="\n">
>>
alt(elements,altNum,description,autoAST,outerAlt,treeLevel,rew) ::= <<
root_0 = @adaptor.create_flat_list<\n><\n>
# at line
>>
tokenRefTrack(token,label,elementIndex,terminalOptions) ::= <<
.add( )})>
>>
tokenRefTrackAndListLabel(token,label,elementIndex,terminalOptions) ::= <<
},...)>
>>
tokenRefRuleRootTrack(token,label,elementIndex,terminalOptions) ::= <<
.add( )})>
>>
tokenRefRuleRootTrackAndListLabel(token,label,elementIndex,terminalOptions) ::= <<
>>
ruleRefTrack(rule,label,elementIndex,args,scope) ::= <<
.add( .tree )})>
>>
ruleRefTrackAndListLabel(rule,label,elementIndex,args,scope) ::= <<
.tree},...)>
>>
ruleRefRuleRootTrack(rule,label,elementIndex,args,scope) ::= <<
.add( .tree )})>
>>
ruleRefRuleRootTrackAndListLabel(rule,label,elementIndex,args,scope) ::= <<
.tree},...)>
>>
rewriteCode(alts, description,
referencedElementsDeep, // ALL referenced elements to right of ->
referencedTokenLabels,
referencedTokenListLabels,
referencedRuleLabels,
referencedRuleListLabels,
referencedWildcardLabels,
referencedWildcardListLabels,
rewriteBlockLevel, enclosingTreeLevel, treeLevel) ::=
<<
# AST Rewrite
# elements:
# token labels:
# rule labels:
# token list labels:
# rule list labels:
# wildcard labels: <[referencedWildcardLabels,referencedWildcardListLabels]; separator=", ">
.tree = root_0
root_0 = @adaptor.create_flat_list
}; anchor, separator="\n\n">
.tree = @adaptor.rule_post_processing( root_0 )
@input.replace_children(
@adaptor.parent( return_value.start ),
@adaptor.child_index( return_value.start ),
@adaptor.child_index( _last ),
return_value.tree
)<\n>
.tree = root_0<\n>
.tree = root_0<\n>
})>
>>
rewriteCodeLabels() ::= <<
= _stream( "token ", )};
separator="\n">
= _stream( "token ", list_of_ )};
separator="\n">
= subtree_stream( "wildcard ", )};
separator="\n">
= subtree_stream( "wildcard ", list_of_ )};
separator="\n">
= ? subtree_stream( "rule ", .tree ) : subtree_stream( "token " )};
separator="\n">
= subtree_stream( "token ", list_of_ )};
separator="\n">
>>
rewriteOptionalBlock(
alt,rewriteBlockLevel,
referencedElementsDeep, // all nested refs
referencedElements, // elements in immediately block; no nested blocks
description) ::=
<<
# at line
if .has_next?}; separator=" || ">
end
.reset();<\n>}>
>>
rewriteClosureBlock(
alt,rewriteBlockLevel,
referencedElementsDeep, // all nested refs
referencedElements, // elements in immediately block; no nested blocks
description) ::=
<<
# at line
while .has_next?}; separator=" || ">
end
.reset();<\n>}>
>>
rewritePositiveClosureBlock(
alt,rewriteBlockLevel,
referencedElementsDeep, // all nested refs
referencedElements, // elements in immediately block; no nested blocks
description) ::=
<<
# at line
.has_next?}; separator=" || "> or raise ANTLR3::RewriteEarlyExit
while .has_next?}; separator=" || ">
end
.reset<\n>}>
>>
rewriteAltRest(a) ::= <<
if
#
e
#
end
>>
rewriteAltFirst(a) ::= <<
if
#
#
>>
rewriteEmptyAlt() ::= "root_0 = nil"
rewriteTree(root,children,description,enclosingTreeLevel,treeLevel) ::= <<
# at line
root_ = @adaptor.create_flat_list
@adaptor.add_child( root_, root_ )<\n>
>>
rewriteElementList(elements) ::= ""
rewriteElement(e) ::= <<
<@pregen()>
>>
rewriteTokenRef(token,elementIndex,terminalOptions,args) ::= <<
@adaptor.add_child( root_, )<\n>
>>
rewriteTokenLabelRef(label,elementIndex) ::= <<
@adaptor.add_child( root_, stream_.next_node )<\n>
>>
rewriteTokenListLabelRef(label,elementIndex) ::= <<
@adaptor.add_child( root_, stream_.next_node )<\n>
>>
rewriteTokenLabelRefRoot(label,elementIndex) ::= <<
root_ = @adaptor.become_root( stream_.next_node, root_ )<\n>
>>
rewriteTokenListLabelRefRoot ::= rewriteTokenLabelRefRoot
rewriteTokenRefRoot(token,elementIndex,terminalOptions,args) ::= <<
root_ = @adaptor.become_root( , root_ )<\n>
>>
rewriteImaginaryTokenRef(args,token,terminalOptions,elementIndex) ::= <<
@adaptor.add_child( root_, )<\n>
>>
rewriteImaginaryTokenRefRoot(args,token,terminalOptions,elementIndex) ::= <<
root_ = @adaptor.become_root( , root_ )<\n>
>>
rewriteAction(action) ::= <<
root_0 = ( )<\n>
>>
prevRuleRootRef() ::= "return_value"
rewriteRuleRef(rule) ::= <<
@adaptor.add_child( root_, stream_.next_tree )<\n>
>>
rewriteRuleRefRoot(rule) ::= <<
root_ = @adaptor.become_root( stream_.next_node, root_ )<\n>
>>
rewriteNodeAction(action) ::= <<
@adaptor.add_child( root_, ( ) )<\n>
>>
rewriteNodeActionRoot(action) ::= <<
root_ = @adaptor.become_root( ( ), root_ )<\n>
>>
rewriteRuleLabelRef(label) ::= <<
@adaptor.add_child( root_, stream_.next_tree )<\n>
>>
rewriteRuleListLabelRef(label) ::= <<
@adaptor.add_child( root_, stream_.next_tree )<\n>
>>
rewriteRuleLabelRefRoot(label) ::= <<
root_ = @adaptor.become_root( stream_.next_node, root_ )<\n>
>>
rewriteRuleListLabelRefRoot(label) ::= <<
root_ = @adaptor.become_root( stream_.next_node, root_ )<\n>
>>
rewriteWildcardLabelRef(label) ::= <<
@adaptor.add_child( root_, stream_.next_tree )<\n>
>>
createImaginaryNode(tokenType,terminalOptions,args) ::= <<
.new( create_token( ), )
@adaptor.create_from_type( , "" )
@adaptor.create( , )
>>
createRewriteNodeFromElement(token,terminalOptions,args) ::= <<
.new( stream_.next, )
@adaptor.create_from_token( , )
@adaptor.create_from_token( , , )
stream_.next_node
>>