Object COLON27_tree=null;
RewriteRuleTokenStream stream_COLON=new RewriteRuleTokenStream(adaptor,"token COLON");
RewriteRuleTokenStream stream_RIGHT_CURLY=new RewriteRuleTokenStream(adaptor,"token RIGHT_CURLY");
RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL");
RewriteRuleTokenStream stream_LEFT_CURLY=new RewriteRuleTokenStream(adaptor,"token LEFT_CURLY");
RewriteRuleSubtreeStream stream_pattern=new RewriteRuleSubtreeStream(adaptor,"rule pattern");
String text = "";
boolean hasSpaceBefore = false;
boolean hasSpaceAfter = false;
try {
// src/main/resources/org/drools/lang/dsl/DSLMap.g:181:4: (lc= LEFT_CURLY name= LITERAL ( ( COLON q= LITERAL )? COLON pat= pattern )? rc= RIGHT_CURLY -> {hasSpaceBefore && !\"\".equals(text) && !hasSpaceAfter}? VT_SPACE ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) VT_PATTERN[$pat.start, text] ) -> {!hasSpaceBefore && !\"\".equals(text) && !hasSpaceAfter}? ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) VT_PATTERN[$pat.start, text] ) -> {hasSpaceBefore && !hasSpaceAfter}? VT_SPACE ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) ) -> {!hasSpaceBefore && !hasSpaceAfter}? ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) ) -> {hasSpaceBefore && !\"\".equals(text) && hasSpaceAfter}? VT_SPACE ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) VT_PATTERN[$pat.start, text] ) VT_SPACE -> {!hasSpaceBefore && !\"\".equals(text) && hasSpaceAfter}? ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) VT_PATTERN[$pat.start, text] ) VT_SPACE -> {hasSpaceBefore && hasSpaceAfter}? VT_SPACE ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) ) VT_SPACE -> {!hasSpaceBefore && hasSpaceAfter}? ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) ) VT_SPACE -> ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) ) )
// src/main/resources/org/drools/lang/dsl/DSLMap.g:181:4: lc= LEFT_CURLY name= LITERAL ( ( COLON q= LITERAL )? COLON pat= pattern )? rc= RIGHT_CURLY
{
lc=(Token)input.LT(1);
match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_variable_definition710); if (failed) return retval;
if ( backtracking==0 ) stream_LEFT_CURLY.add(lc);
if ( backtracking==0 ) {
CommonToken back2 = (CommonToken)input.LT(-2);
if( back2!=null && back2.getStopIndex() < ((CommonToken)lc).getStartIndex() -1 ) hasSpaceBefore = true;
}
name=(Token)input.LT(1);
match(input,LITERAL,FOLLOW_LITERAL_in_variable_definition721); if (failed) return retval;
if ( backtracking==0 ) stream_LITERAL.add(name);
// src/main/resources/org/drools/lang/dsl/DSLMap.g:186:15: ( ( COLON q= LITERAL )? COLON pat= pattern )?
int alt14=2;
int LA14_0 = input.LA(1);
if ( (LA14_0==COLON) ) {
alt14=1;
}
switch (alt14) {
case 1 :
// src/main/resources/org/drools/lang/dsl/DSLMap.g:186:17: ( COLON q= LITERAL )? COLON pat= pattern
{
// src/main/resources/org/drools/lang/dsl/DSLMap.g:186:17: ( COLON q= LITERAL )?
int alt13=2;
int LA13_0 = input.LA(1);
if ( (LA13_0==COLON) ) {
int LA13_1 = input.LA(2);
if ( (LA13_1==LITERAL) ) {
int LA13_2 = input.LA(3);
if ( (LA13_2==COLON) ) {
int LA13_4 = input.LA(4);
if ( (synpred21()) ) {
alt13=1;
}
}
}
}
switch (alt13) {
case 1 :
// src/main/resources/org/drools/lang/dsl/DSLMap.g:186:18: COLON q= LITERAL
{
COLON26=(Token)input.LT(1);
match(input,COLON,FOLLOW_COLON_in_variable_definition726); if (failed) return retval;
if ( backtracking==0 ) stream_COLON.add(COLON26);
q=(Token)input.LT(1);
match(input,LITERAL,FOLLOW_LITERAL_in_variable_definition730); if (failed) return retval;
if ( backtracking==0 ) stream_LITERAL.add(q);
}
break;
}
COLON27=(Token)input.LT(1);
match(input,COLON,FOLLOW_COLON_in_variable_definition734); if (failed) return retval;
if ( backtracking==0 ) stream_COLON.add(COLON27);
pushFollow(FOLLOW_pattern_in_variable_definition738);
pat=pattern();
_fsp--;
if (failed) return retval;
if ( backtracking==0 ) stream_pattern.add(pat.getTree());
if ( backtracking==0 ) {
text = input.toString(pat.start,pat.stop);
}
}
break;
}
rc=(Token)input.LT(1);
match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_variable_definition747); if (failed) return retval;
if ( backtracking==0 ) stream_RIGHT_CURLY.add(rc);
if ( backtracking==0 ) {
CommonToken rc1 = (CommonToken)input.LT(1);
if(!"=".equals(rc1.getText()) && ((CommonToken)rc).getStopIndex() < rc1.getStartIndex() - 1) hasSpaceAfter = true;
}
// AST REWRITE
// elements: name, q, q, q, q, q, name, q, name, name, name, q, name, name, name, q, q, name
// token labels: q, name
// rule labels: retval
// token list labels:
// rule list labels:
if ( backtracking==0 ) {
retval.tree = root_0;
RewriteRuleTokenStream stream_q=new RewriteRuleTokenStream(adaptor,"token q",q);
RewriteRuleTokenStream stream_name=new RewriteRuleTokenStream(adaptor,"token name",name);
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
root_0 = (Object)adaptor.nil();
// 191:2: -> {hasSpaceBefore && !\"\".equals(text) && !hasSpaceAfter}? VT_SPACE ^( VT_VAR_DEF $name ^( VT_QUAL ( $q)? ) VT_PATTERN[$pat.start, text] )
if (hasSpaceBefore && !"".equals(text) && !hasSpaceAfter) {
adaptor.addChild(root_0, adaptor.create(VT_SPACE, "VT_SPACE"));