[jboss-svn-commits] JBL Code SVN: r20067 - labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon May 19 16:48:40 EDT 2008
Author: mattgeis
Date: 2008-05-19 16:48:40 -0400 (Mon, 19 May 2008)
New Revision: 20067
Added:
labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapLexer.java
labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapParser.java
labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapWalker.java
labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLTokenizedMappingFile.java
Log:
added new ANTLR-generated files and DSLMappingFile subclass to use ANTLR to parse DSL files (generated from ANTLR .g files)
Added: labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapLexer.java
===================================================================
--- labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapLexer.java (rev 0)
+++ labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapLexer.java 2008-05-19 20:48:40 UTC (rev 20067)
@@ -0,0 +1,1044 @@
+// $ANTLR 3.0.1 DSLMap.g 2008-05-14 15:02:18
+
+ package org.drools.lang.dsl;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+public class DSLMapLexer extends Lexer {
+ public static final int RIGHT_CURLY=28;
+ public static final int VT_ENTRY_VAL=14;
+ public static final int WS=29;
+ public static final int MISC=33;
+ public static final int VT_META=12;
+ public static final int VT_CONSEQUENCE=9;
+ public static final int VT_SPACE=19;
+ public static final int LINE_COMMENT=21;
+ public static final int VT_ANY=11;
+ public static final int VT_LITERAL=17;
+ public static final int DOT=31;
+ public static final int EQUALS=22;
+ public static final int VT_DSL_GRAMMAR=4;
+ public static final int VT_CONDITION=8;
+ public static final int VT_ENTRY=6;
+ public static final int VT_VAR_DEF=15;
+ public static final int VT_PATTERN=18;
+ public static final int LITERAL=25;
+ public static final int EscapeSequence=30;
+ public static final int VT_COMMENT=5;
+ public static final int EOF=-1;
+ public static final int EOL=20;
+ public static final int LEFT_SQUARE=23;
+ public static final int Tokens=34;
+ public static final int VT_ENTRY_KEY=13;
+ public static final int VT_SCOPE=7;
+ public static final int COLON=26;
+ public static final int VT_KEYWORD=10;
+ public static final int VT_VAR_REF=16;
+ public static final int LEFT_CURLY=27;
+ public static final int POUND=32;
+ public static final int RIGHT_SQUARE=24;
+ public DSLMapLexer() {;}
+ public DSLMapLexer(CharStream input) {
+ super(input);
+ ruleMemo = new HashMap[16+1];
+ }
+ public String getGrammarFileName() { return "DSLMap.g"; }
+
+ // $ANTLR start WS
+ public final void mWS() throws RecognitionException {
+ try {
+ int _type = WS;
+ // DSLMap.g:231:9: ( ( ' ' | '\\t' | '\\f' )+ )
+ // DSLMap.g:231:17: ( ' ' | '\\t' | '\\f' )+
+ {
+ // DSLMap.g:231:17: ( ' ' | '\\t' | '\\f' )+
+ int cnt1=0;
+ loop1:
+ do {
+ int alt1=2;
+ int LA1_0 = input.LA(1);
+
+ if ( (LA1_0=='\t'||LA1_0=='\f'||LA1_0==' ') ) {
+ alt1=1;
+ }
+
+
+ switch (alt1) {
+ case 1 :
+ // DSLMap.g:
+ {
+ if ( input.LA(1)=='\t'||input.LA(1)=='\f'||input.LA(1)==' ' ) {
+ input.consume();
+ failed=false;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ MismatchedSetException mse =
+ new MismatchedSetException(null,input);
+ recover(mse); throw mse;
+ }
+
+
+ }
+ break;
+
+ default :
+ if ( cnt1 >= 1 ) break loop1;
+ if (backtracking>0) {failed=true; return ;}
+ EarlyExitException eee =
+ new EarlyExitException(1, input);
+ throw eee;
+ }
+ cnt1++;
+ } while (true);
+
+ if ( backtracking==0 ) {
+ channel=HIDDEN;
+ }
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end WS
+
+ // $ANTLR start EOL
+ public final void mEOL() throws RecognitionException {
+ try {
+ int _type = EOL;
+ // DSLMap.g:238:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
+ // DSLMap.g:239:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+ {
+ // DSLMap.g:239:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+ int alt2=3;
+ int LA2_0 = input.LA(1);
+
+ if ( (LA2_0=='\r') ) {
+ int LA2_1 = input.LA(2);
+
+ if ( (LA2_1=='\n') && (synpred1())) {
+ alt2=1;
+ }
+ else {
+ alt2=2;}
+ }
+ else if ( (LA2_0=='\n') ) {
+ alt2=3;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("239:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 2, 0, input);
+
+ throw nvae;
+ }
+ switch (alt2) {
+ case 1 :
+ // DSLMap.g:239:14: ( '\\r\\n' )=> '\\r\\n'
+ {
+ match("\r\n"); if (failed) return ;
+
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:240:25: '\\r'
+ {
+ match('\r'); if (failed) return ;
+
+ }
+ break;
+ case 3 :
+ // DSLMap.g:241:25: '\\n'
+ {
+ match('\n'); if (failed) return ;
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end EOL
+
+ // $ANTLR start EscapeSequence
+ public final void mEscapeSequence() throws RecognitionException {
+ try {
+ // DSLMap.g:247:5: ( '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' | '=' | 'u' | '0' | '#' ) )
+ // DSLMap.g:247:9: '\\\\' ( 'b' | 'B' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' | '.' | 'o' | 'x' | 'a' | 'e' | 'c' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' | 'p' | 'A' | 'G' | 'Z' | 'z' | 'Q' | 'E' | '*' | '[' | ']' | '(' | ')' | '$' | '^' | '{' | '}' | '?' | '+' | '-' | '&' | '|' | '=' | 'u' | '0' | '#' )
+ {
+ match('\\'); if (failed) return ;
+ if ( (input.LA(1)>='\"' && input.LA(1)<='$')||(input.LA(1)>='&' && input.LA(1)<='+')||(input.LA(1)>='-' && input.LA(1)<='.')||input.LA(1)=='0'||input.LA(1)=='='||input.LA(1)=='?'||(input.LA(1)>='A' && input.LA(1)<='B')||(input.LA(1)>='D' && input.LA(1)<='E')||input.LA(1)=='G'||input.LA(1)=='Q'||input.LA(1)=='S'||input.LA(1)=='W'||(input.LA(1)>='Z' && input.LA(1)<='^')||(input.LA(1)>='a' && input.LA(1)<='f')||(input.LA(1)>='n' && input.LA(1)<='p')||(input.LA(1)>='r' && input.LA(1)<='u')||(input.LA(1)>='w' && input.LA(1)<='x')||(input.LA(1)>='z' && input.LA(1)<='}') ) {
+ input.consume();
+ failed=false;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ MismatchedSetException mse =
+ new MismatchedSetException(null,input);
+ recover(mse); throw mse;
+ }
+
+
+ }
+
+ }
+ finally {
+ }
+ }
+ // $ANTLR end EscapeSequence
+
+ // $ANTLR start LEFT_SQUARE
+ public final void mLEFT_SQUARE() throws RecognitionException {
+ try {
+ int _type = LEFT_SQUARE;
+ // DSLMap.g:254:9: ( '[' )
+ // DSLMap.g:254:11: '['
+ {
+ match('['); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end LEFT_SQUARE
+
+ // $ANTLR start RIGHT_SQUARE
+ public final void mRIGHT_SQUARE() throws RecognitionException {
+ try {
+ int _type = RIGHT_SQUARE;
+ // DSLMap.g:258:9: ( ']' )
+ // DSLMap.g:258:11: ']'
+ {
+ match(']'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end RIGHT_SQUARE
+
+ // $ANTLR start LEFT_CURLY
+ public final void mLEFT_CURLY() throws RecognitionException {
+ try {
+ int _type = LEFT_CURLY;
+ // DSLMap.g:262:9: ( '{' )
+ // DSLMap.g:262:11: '{'
+ {
+ match('{'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end LEFT_CURLY
+
+ // $ANTLR start RIGHT_CURLY
+ public final void mRIGHT_CURLY() throws RecognitionException {
+ try {
+ int _type = RIGHT_CURLY;
+ // DSLMap.g:266:9: ( '}' )
+ // DSLMap.g:266:11: '}'
+ {
+ match('}'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end RIGHT_CURLY
+
+ // $ANTLR start EQUALS
+ public final void mEQUALS() throws RecognitionException {
+ try {
+ int _type = EQUALS;
+ // DSLMap.g:269:8: ( '=' )
+ // DSLMap.g:269:10: '='
+ {
+ match('='); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end EQUALS
+
+ // $ANTLR start DOT
+ public final void mDOT() throws RecognitionException {
+ try {
+ int _type = DOT;
+ // DSLMap.g:272:5: ( '.' )
+ // DSLMap.g:272:7: '.'
+ {
+ match('.'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end DOT
+
+ // $ANTLR start POUND
+ public final void mPOUND() throws RecognitionException {
+ try {
+ int _type = POUND;
+ // DSLMap.g:275:9: ( '#' )
+ // DSLMap.g:275:11: '#'
+ {
+ match('#'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end POUND
+
+ // $ANTLR start COLON
+ public final void mCOLON() throws RecognitionException {
+ try {
+ int _type = COLON;
+ // DSLMap.g:278:7: ( ':' )
+ // DSLMap.g:278:9: ':'
+ {
+ match(':'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end COLON
+
+ // $ANTLR start LINE_COMMENT
+ public final void mLINE_COMMENT() throws RecognitionException {
+ try {
+ int _type = LINE_COMMENT;
+ // DSLMap.g:286:2: ( POUND ( options {greedy=false; } : . )* EOL )
+ // DSLMap.g:286:4: POUND ( options {greedy=false; } : . )* EOL
+ {
+ mPOUND(); if (failed) return ;
+ // DSLMap.g:286:10: ( options {greedy=false; } : . )*
+ loop3:
+ do {
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+
+ if ( (LA3_0=='\r') ) {
+ alt3=2;
+ }
+ else if ( (LA3_0=='\n') ) {
+ alt3=2;
+ }
+ else if ( ((LA3_0>='\u0000' && LA3_0<='\t')||(LA3_0>='\u000B' && LA3_0<='\f')||(LA3_0>='\u000E' && LA3_0<='\uFFFE')) ) {
+ alt3=1;
+ }
+
+
+ switch (alt3) {
+ case 1 :
+ // DSLMap.g:286:37: .
+ {
+ matchAny(); if (failed) return ;
+
+ }
+ break;
+
+ default :
+ break loop3;
+ }
+ } while (true);
+
+ mEOL(); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end LINE_COMMENT
+
+ // $ANTLR start LITERAL
+ public final void mLITERAL() throws RecognitionException {
+ try {
+ int _type = LITERAL;
+ // DSLMap.g:294:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '\\u00c0' .. '\\u00ff' | MISC | EscapeSequence | DOT )+ )
+ // DSLMap.g:294:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '\\u00c0' .. '\\u00ff' | MISC | EscapeSequence | DOT )+
+ {
+ // DSLMap.g:294:4: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '\\u00c0' .. '\\u00ff' | MISC | EscapeSequence | DOT )+
+ int cnt4=0;
+ loop4:
+ do {
+ int alt4=9;
+ switch ( input.LA(1) ) {
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ {
+ alt4=1;
+ }
+ break;
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ {
+ alt4=2;
+ }
+ break;
+ case '_':
+ {
+ alt4=3;
+ }
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ alt4=4;
+ }
+ break;
+ case '\u00C0':
+ case '\u00C1':
+ case '\u00C2':
+ case '\u00C3':
+ case '\u00C4':
+ case '\u00C5':
+ case '\u00C6':
+ case '\u00C7':
+ case '\u00C8':
+ case '\u00C9':
+ case '\u00CA':
+ case '\u00CB':
+ case '\u00CC':
+ case '\u00CD':
+ case '\u00CE':
+ case '\u00CF':
+ case '\u00D0':
+ case '\u00D1':
+ case '\u00D2':
+ case '\u00D3':
+ case '\u00D4':
+ case '\u00D5':
+ case '\u00D6':
+ case '\u00D7':
+ case '\u00D8':
+ case '\u00D9':
+ case '\u00DA':
+ case '\u00DB':
+ case '\u00DC':
+ case '\u00DD':
+ case '\u00DE':
+ case '\u00DF':
+ case '\u00E0':
+ case '\u00E1':
+ case '\u00E2':
+ case '\u00E3':
+ case '\u00E4':
+ case '\u00E5':
+ case '\u00E6':
+ case '\u00E7':
+ case '\u00E8':
+ case '\u00E9':
+ case '\u00EA':
+ case '\u00EB':
+ case '\u00EC':
+ case '\u00ED':
+ case '\u00EE':
+ case '\u00EF':
+ case '\u00F0':
+ case '\u00F1':
+ case '\u00F2':
+ case '\u00F3':
+ case '\u00F4':
+ case '\u00F5':
+ case '\u00F6':
+ case '\u00F7':
+ case '\u00F8':
+ case '\u00F9':
+ case '\u00FA':
+ case '\u00FB':
+ case '\u00FC':
+ case '\u00FD':
+ case '\u00FE':
+ case '\u00FF':
+ {
+ alt4=5;
+ }
+ break;
+ case '!':
+ case '\"':
+ case '$':
+ case '%':
+ case '&':
+ case '\'':
+ case '(':
+ case ')':
+ case '*':
+ case '+':
+ case '-':
+ case '/':
+ case ';':
+ case '?':
+ case '@':
+ case '^':
+ case '|':
+ {
+ alt4=6;
+ }
+ break;
+ case '\\':
+ {
+ alt4=7;
+ }
+ break;
+ case '.':
+ {
+ alt4=8;
+ }
+ break;
+
+ }
+
+ switch (alt4) {
+ case 1 :
+ // DSLMap.g:294:5: 'a' .. 'z'
+ {
+ matchRange('a','z'); if (failed) return ;
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:294:14: 'A' .. 'Z'
+ {
+ matchRange('A','Z'); if (failed) return ;
+
+ }
+ break;
+ case 3 :
+ // DSLMap.g:294:23: '_'
+ {
+ match('_'); if (failed) return ;
+
+ }
+ break;
+ case 4 :
+ // DSLMap.g:294:27: '0' .. '9'
+ {
+ matchRange('0','9'); if (failed) return ;
+
+ }
+ break;
+ case 5 :
+ // DSLMap.g:294:36: '\\u00c0' .. '\\u00ff'
+ {
+ matchRange('\u00C0','\u00FF'); if (failed) return ;
+
+ }
+ break;
+ case 6 :
+ // DSLMap.g:294:55: MISC
+ {
+ mMISC(); if (failed) return ;
+
+ }
+ break;
+ case 7 :
+ // DSLMap.g:294:60: EscapeSequence
+ {
+ mEscapeSequence(); if (failed) return ;
+
+ }
+ break;
+ case 8 :
+ // DSLMap.g:294:75: DOT
+ {
+ mDOT(); if (failed) return ;
+
+ }
+ break;
+
+ default :
+ if ( cnt4 >= 1 ) break loop4;
+ if (backtracking>0) {failed=true; return ;}
+ EarlyExitException eee =
+ new EarlyExitException(4, input);
+ throw eee;
+ }
+ cnt4++;
+ } while (true);
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end LITERAL
+
+ // $ANTLR start MISC
+ public final void mMISC() throws RecognitionException {
+ try {
+ // DSLMap.g:298:7: ( '!' | '@' | '$' | '%' | '^' | '*' | '-' | '+' | '?' | '/' | '\\'' | '\"' | '|' | '&' | '(' | ')' | ';' )
+ // DSLMap.g:
+ {
+ if ( (input.LA(1)>='!' && input.LA(1)<='\"')||(input.LA(1)>='$' && input.LA(1)<='+')||input.LA(1)=='-'||input.LA(1)=='/'||input.LA(1)==';'||(input.LA(1)>='?' && input.LA(1)<='@')||input.LA(1)=='^'||input.LA(1)=='|' ) {
+ input.consume();
+ failed=false;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ MismatchedSetException mse =
+ new MismatchedSetException(null,input);
+ recover(mse); throw mse;
+ }
+
+
+ }
+
+ }
+ finally {
+ }
+ }
+ // $ANTLR end MISC
+
+ public void mTokens() throws RecognitionException {
+ // DSLMap.g:1:8: ( WS | EOL | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | EQUALS | DOT | POUND | COLON | LINE_COMMENT | LITERAL )
+ int alt5=12;
+ switch ( input.LA(1) ) {
+ case '\t':
+ case '\f':
+ case ' ':
+ {
+ alt5=1;
+ }
+ break;
+ case '\n':
+ case '\r':
+ {
+ alt5=2;
+ }
+ break;
+ case '[':
+ {
+ alt5=3;
+ }
+ break;
+ case ']':
+ {
+ alt5=4;
+ }
+ break;
+ case '{':
+ {
+ alt5=5;
+ }
+ break;
+ case '}':
+ {
+ alt5=6;
+ }
+ break;
+ case '=':
+ {
+ alt5=7;
+ }
+ break;
+ case '.':
+ {
+ int LA5_8 = input.LA(2);
+
+ if ( ((LA5_8>='!' && LA5_8<='\"')||(LA5_8>='$' && LA5_8<='+')||(LA5_8>='-' && LA5_8<='9')||LA5_8==';'||(LA5_8>='?' && LA5_8<='Z')||LA5_8=='\\'||(LA5_8>='^' && LA5_8<='_')||(LA5_8>='a' && LA5_8<='z')||LA5_8=='|'||(LA5_8>='\u00C0' && LA5_8<='\u00FF')) ) {
+ alt5=12;
+ }
+ else {
+ alt5=8;}
+ }
+ break;
+ case '#':
+ {
+ int LA5_9 = input.LA(2);
+
+ if ( ((LA5_9>='\u0000' && LA5_9<='\uFFFE')) ) {
+ alt5=11;
+ }
+ else {
+ alt5=9;}
+ }
+ break;
+ case ':':
+ {
+ alt5=10;
+ }
+ break;
+ case '!':
+ case '\"':
+ case '$':
+ case '%':
+ case '&':
+ case '\'':
+ case '(':
+ case ')':
+ case '*':
+ case '+':
+ case '-':
+ case '/':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case ';':
+ case '?':
+ case '@':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '\\':
+ case '^':
+ case '_':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ case '|':
+ case '\u00C0':
+ case '\u00C1':
+ case '\u00C2':
+ case '\u00C3':
+ case '\u00C4':
+ case '\u00C5':
+ case '\u00C6':
+ case '\u00C7':
+ case '\u00C8':
+ case '\u00C9':
+ case '\u00CA':
+ case '\u00CB':
+ case '\u00CC':
+ case '\u00CD':
+ case '\u00CE':
+ case '\u00CF':
+ case '\u00D0':
+ case '\u00D1':
+ case '\u00D2':
+ case '\u00D3':
+ case '\u00D4':
+ case '\u00D5':
+ case '\u00D6':
+ case '\u00D7':
+ case '\u00D8':
+ case '\u00D9':
+ case '\u00DA':
+ case '\u00DB':
+ case '\u00DC':
+ case '\u00DD':
+ case '\u00DE':
+ case '\u00DF':
+ case '\u00E0':
+ case '\u00E1':
+ case '\u00E2':
+ case '\u00E3':
+ case '\u00E4':
+ case '\u00E5':
+ case '\u00E6':
+ case '\u00E7':
+ case '\u00E8':
+ case '\u00E9':
+ case '\u00EA':
+ case '\u00EB':
+ case '\u00EC':
+ case '\u00ED':
+ case '\u00EE':
+ case '\u00EF':
+ case '\u00F0':
+ case '\u00F1':
+ case '\u00F2':
+ case '\u00F3':
+ case '\u00F4':
+ case '\u00F5':
+ case '\u00F6':
+ case '\u00F7':
+ case '\u00F8':
+ case '\u00F9':
+ case '\u00FA':
+ case '\u00FB':
+ case '\u00FC':
+ case '\u00FD':
+ case '\u00FE':
+ case '\u00FF':
+ {
+ alt5=12;
+ }
+ break;
+ default:
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("1:1: Tokens : ( WS | EOL | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | EQUALS | DOT | POUND | COLON | LINE_COMMENT | LITERAL );", 5, 0, input);
+
+ throw nvae;
+ }
+
+ switch (alt5) {
+ case 1 :
+ // DSLMap.g:1:10: WS
+ {
+ mWS(); if (failed) return ;
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:1:13: EOL
+ {
+ mEOL(); if (failed) return ;
+
+ }
+ break;
+ case 3 :
+ // DSLMap.g:1:17: LEFT_SQUARE
+ {
+ mLEFT_SQUARE(); if (failed) return ;
+
+ }
+ break;
+ case 4 :
+ // DSLMap.g:1:29: RIGHT_SQUARE
+ {
+ mRIGHT_SQUARE(); if (failed) return ;
+
+ }
+ break;
+ case 5 :
+ // DSLMap.g:1:42: LEFT_CURLY
+ {
+ mLEFT_CURLY(); if (failed) return ;
+
+ }
+ break;
+ case 6 :
+ // DSLMap.g:1:53: RIGHT_CURLY
+ {
+ mRIGHT_CURLY(); if (failed) return ;
+
+ }
+ break;
+ case 7 :
+ // DSLMap.g:1:65: EQUALS
+ {
+ mEQUALS(); if (failed) return ;
+
+ }
+ break;
+ case 8 :
+ // DSLMap.g:1:72: DOT
+ {
+ mDOT(); if (failed) return ;
+
+ }
+ break;
+ case 9 :
+ // DSLMap.g:1:76: POUND
+ {
+ mPOUND(); if (failed) return ;
+
+ }
+ break;
+ case 10 :
+ // DSLMap.g:1:82: COLON
+ {
+ mCOLON(); if (failed) return ;
+
+ }
+ break;
+ case 11 :
+ // DSLMap.g:1:88: LINE_COMMENT
+ {
+ mLINE_COMMENT(); if (failed) return ;
+
+ }
+ break;
+ case 12 :
+ // DSLMap.g:1:101: LITERAL
+ {
+ mLITERAL(); if (failed) return ;
+
+ }
+ break;
+
+ }
+
+ }
+
+ // $ANTLR start synpred1
+ public final void synpred1_fragment() throws RecognitionException {
+ // DSLMap.g:239:14: ( '\\r\\n' )
+ // DSLMap.g:239:16: '\\r\\n'
+ {
+ match("\r\n"); if (failed) return ;
+
+
+ }
+ }
+ // $ANTLR end synpred1
+
+ public final boolean synpred1() {
+ backtracking++;
+ int start = input.mark();
+ try {
+ synpred1_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !failed;
+ input.rewind(start);
+ backtracking--;
+ failed=false;
+ return success;
+ }
+
+
+
+
+}
\ No newline at end of file
Property changes on: labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapLexer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapParser.java
===================================================================
--- labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapParser.java (rev 0)
+++ labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapParser.java 2008-05-19 20:48:40 UTC (rev 20067)
@@ -0,0 +1,2687 @@
+// $ANTLR 3.0.1 DSLMap.g 2008-05-14 15:02:18
+
+ package org.drools.lang.dsl;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.antlr.runtime.tree.*;
+
+public class DSLMapParser extends Parser {
+ public static final String[] tokenNames = new String[] {
+ "<invalid>", "<EOR>", "<DOWN>", "<UP>", "VT_DSL_GRAMMAR", "VT_COMMENT", "VT_ENTRY", "VT_SCOPE", "VT_CONDITION", "VT_CONSEQUENCE", "VT_KEYWORD", "VT_ANY", "VT_META", "VT_ENTRY_KEY", "VT_ENTRY_VAL", "VT_VAR_DEF", "VT_VAR_REF", "VT_LITERAL", "VT_PATTERN", "VT_SPACE", "EOL", "LINE_COMMENT", "EQUALS", "LEFT_SQUARE", "RIGHT_SQUARE", "LITERAL", "COLON", "LEFT_CURLY", "RIGHT_CURLY", "WS", "EscapeSequence", "DOT", "POUND", "MISC"
+ };
+ public static final int RIGHT_CURLY=28;
+ public static final int VT_ENTRY_VAL=14;
+ public static final int WS=29;
+ public static final int MISC=33;
+ public static final int VT_META=12;
+ public static final int VT_CONSEQUENCE=9;
+ public static final int VT_SPACE=19;
+ public static final int LINE_COMMENT=21;
+ public static final int VT_ANY=11;
+ public static final int VT_LITERAL=17;
+ public static final int DOT=31;
+ public static final int EQUALS=22;
+ public static final int VT_DSL_GRAMMAR=4;
+ public static final int VT_CONDITION=8;
+ public static final int VT_ENTRY=6;
+ public static final int VT_VAR_DEF=15;
+ public static final int LITERAL=25;
+ public static final int VT_PATTERN=18;
+ public static final int EscapeSequence=30;
+ public static final int VT_COMMENT=5;
+ public static final int EOF=-1;
+ public static final int EOL=20;
+ public static final int LEFT_SQUARE=23;
+ public static final int VT_ENTRY_KEY=13;
+ public static final int COLON=26;
+ public static final int VT_SCOPE=7;
+ public static final int VT_KEYWORD=10;
+ public static final int POUND=32;
+ public static final int LEFT_CURLY=27;
+ public static final int VT_VAR_REF=16;
+ public static final int RIGHT_SQUARE=24;
+
+ public DSLMapParser(TokenStream input) {
+ super(input);
+ ruleMemo = new HashMap[43+1];
+ }
+
+ protected TreeAdaptor adaptor = new CommonTreeAdaptor();
+
+ public void setTreeAdaptor(TreeAdaptor adaptor) {
+ this.adaptor = adaptor;
+ }
+ public TreeAdaptor getTreeAdaptor() {
+ return adaptor;
+ }
+
+ public String[] getTokenNames() { return tokenNames; }
+ public String getGrammarFileName() { return "DSLMap.g"; }
+
+
+ //we may not need the check on [], as the LITERAL token being examined
+ //should not have them.
+ private boolean validateLT(int LTNumber, String text){
+ if (null == input) return false;
+ if (null == input.LT(LTNumber)) return false;
+ if (null == input.LT(LTNumber).getText()) return false;
+
+ String text2Validate = input.LT(LTNumber).getText();
+ if (text2Validate.startsWith("[") && text2Validate.endsWith("]")){
+ text2Validate = text2Validate.substring(1, text2Validate.length() - 1);
+ }
+
+ return text2Validate.equalsIgnoreCase(text);
+ }
+
+ private boolean validateIdentifierKey(String text){
+ return validateLT(1, text);
+ }
+
+ protected void mismatch(IntStream input, int ttype, BitSet follow)
+ throws RecognitionException{
+ throw new MismatchedTokenException(ttype, input);
+ }
+
+ public void recoverFromMismatchedSet(IntStream input,
+ RecognitionException e, BitSet follow) throws RecognitionException{
+ throw e;
+ }
+
+
+
+ public static class mapping_file_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start mapping_file
+ // DSLMap.g:76:1: mapping_file : ( statement )* -> ^( VT_DSL_GRAMMAR ( statement )* ) ;
+ public final mapping_file_return mapping_file() throws RecognitionException {
+ mapping_file_return retval = new mapping_file_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ statement_return statement1 = null;
+
+
+ RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
+ try {
+ // DSLMap.g:77:2: ( ( statement )* -> ^( VT_DSL_GRAMMAR ( statement )* ) )
+ // DSLMap.g:77:4: ( statement )*
+ {
+ // DSLMap.g:77:4: ( statement )*
+ loop1:
+ do {
+ int alt1=2;
+ int LA1_0 = input.LA(1);
+
+ if ( ((LA1_0>=EOL && LA1_0<=LINE_COMMENT)||LA1_0==LEFT_SQUARE) ) {
+ alt1=1;
+ }
+
+
+ switch (alt1) {
+ case 1 :
+ // DSLMap.g:0:0: statement
+ {
+ pushFollow(FOLLOW_statement_in_mapping_file257);
+ statement1=statement();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_statement.add(statement1.getTree());
+
+ }
+ break;
+
+ default :
+ break loop1;
+ }
+ } while (true);
+
+
+ // AST REWRITE
+ // elements: statement
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 78:2: -> ^( VT_DSL_GRAMMAR ( statement )* )
+ {
+ // DSLMap.g:78:5: ^( VT_DSL_GRAMMAR ( statement )* )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_DSL_GRAMMAR, "VT_DSL_GRAMMAR"), root_1);
+
+ // DSLMap.g:78:22: ( statement )*
+ while ( stream_statement.hasNext() ) {
+ adaptor.addChild(root_1, stream_statement.next());
+
+ }
+ stream_statement.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end mapping_file
+
+ public static class statement_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start statement
+ // DSLMap.g:81:1: statement : ( entry | comment | EOL );
+ public final statement_return statement() throws RecognitionException {
+ statement_return retval = new statement_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token EOL4=null;
+ entry_return entry2 = null;
+
+ comment_return comment3 = null;
+
+
+ Object EOL4_tree=null;
+
+ try {
+ // DSLMap.g:82:2: ( entry | comment | EOL )
+ int alt2=3;
+ switch ( input.LA(1) ) {
+ case LEFT_SQUARE:
+ {
+ alt2=1;
+ }
+ break;
+ case LINE_COMMENT:
+ {
+ alt2=2;
+ }
+ break;
+ case EOL:
+ {
+ alt2=3;
+ }
+ break;
+ default:
+ if (backtracking>0) {failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("81:1: statement : ( entry | comment | EOL );", 2, 0, input);
+
+ throw nvae;
+ }
+
+ switch (alt2) {
+ case 1 :
+ // DSLMap.g:82:4: entry
+ {
+ root_0 = (Object)adaptor.nil();
+
+ pushFollow(FOLLOW_entry_in_statement280);
+ entry2=entry();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) adaptor.addChild(root_0, entry2.getTree());
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:83:4: comment
+ {
+ root_0 = (Object)adaptor.nil();
+
+ pushFollow(FOLLOW_comment_in_statement287);
+ comment3=comment();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) adaptor.addChild(root_0, comment3.getTree());
+
+ }
+ break;
+ case 3 :
+ // DSLMap.g:84:4: EOL
+ {
+ root_0 = (Object)adaptor.nil();
+
+ EOL4=(Token)input.LT(1);
+ match(input,EOL,FOLLOW_EOL_in_statement293); if (failed) return retval;
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end statement
+
+ public static class comment_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start comment
+ // DSLMap.g:89:1: comment : LINE_COMMENT -> ^( VT_COMMENT[$LINE_COMMENT, \"COMMENT\"] LINE_COMMENT ) ;
+ public final comment_return comment() throws RecognitionException {
+ comment_return retval = new comment_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token LINE_COMMENT5=null;
+
+ Object LINE_COMMENT5_tree=null;
+ RewriteRuleTokenStream stream_LINE_COMMENT=new RewriteRuleTokenStream(adaptor,"token LINE_COMMENT");
+
+ try {
+ // DSLMap.g:89:9: ( LINE_COMMENT -> ^( VT_COMMENT[$LINE_COMMENT, \"COMMENT\"] LINE_COMMENT ) )
+ // DSLMap.g:89:11: LINE_COMMENT
+ {
+ LINE_COMMENT5=(Token)input.LT(1);
+ match(input,LINE_COMMENT,FOLLOW_LINE_COMMENT_in_comment309); if (failed) return retval;
+ if ( backtracking==0 ) stream_LINE_COMMENT.add(LINE_COMMENT5);
+
+
+ // AST REWRITE
+ // elements: LINE_COMMENT
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 90:2: -> ^( VT_COMMENT[$LINE_COMMENT, \"COMMENT\"] LINE_COMMENT )
+ {
+ // DSLMap.g:90:5: ^( VT_COMMENT[$LINE_COMMENT, \"COMMENT\"] LINE_COMMENT )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_COMMENT, LINE_COMMENT5, "COMMENT"), root_1);
+
+ adaptor.addChild(root_1, stream_LINE_COMMENT.next());
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end comment
+
+ public static class entry_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start entry
+ // DSLMap.g:94:1: entry : scope_section meta_section key_section EQUALS value_section ( EOL | EOF ) -> ^( VT_ENTRY scope_section meta_section key_section value_section ) ;
+ public final entry_return entry() throws RecognitionException {
+ entry_return retval = new entry_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token EQUALS9=null;
+ Token EOL11=null;
+ Token EOF12=null;
+ scope_section_return scope_section6 = null;
+
+ meta_section_return meta_section7 = null;
+
+ key_section_return key_section8 = null;
+
+ value_section_return value_section10 = null;
+
+
+ Object EQUALS9_tree=null;
+ Object EOL11_tree=null;
+ Object EOF12_tree=null;
+ RewriteRuleTokenStream stream_EQUALS=new RewriteRuleTokenStream(adaptor,"token EQUALS");
+ RewriteRuleTokenStream stream_EOF=new RewriteRuleTokenStream(adaptor,"token EOF");
+ RewriteRuleTokenStream stream_EOL=new RewriteRuleTokenStream(adaptor,"token EOL");
+ RewriteRuleSubtreeStream stream_key_section=new RewriteRuleSubtreeStream(adaptor,"rule key_section");
+ RewriteRuleSubtreeStream stream_value_section=new RewriteRuleSubtreeStream(adaptor,"rule value_section");
+ RewriteRuleSubtreeStream stream_scope_section=new RewriteRuleSubtreeStream(adaptor,"rule scope_section");
+ RewriteRuleSubtreeStream stream_meta_section=new RewriteRuleSubtreeStream(adaptor,"rule meta_section");
+ try {
+ // DSLMap.g:94:8: ( scope_section meta_section key_section EQUALS value_section ( EOL | EOF ) -> ^( VT_ENTRY scope_section meta_section key_section value_section ) )
+ // DSLMap.g:94:10: scope_section meta_section key_section EQUALS value_section ( EOL | EOF )
+ {
+ pushFollow(FOLLOW_scope_section_in_entry334);
+ scope_section6=scope_section();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_scope_section.add(scope_section6.getTree());
+ pushFollow(FOLLOW_meta_section_in_entry336);
+ meta_section7=meta_section();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_meta_section.add(meta_section7.getTree());
+ pushFollow(FOLLOW_key_section_in_entry338);
+ key_section8=key_section();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_key_section.add(key_section8.getTree());
+ EQUALS9=(Token)input.LT(1);
+ match(input,EQUALS,FOLLOW_EQUALS_in_entry340); if (failed) return retval;
+ if ( backtracking==0 ) stream_EQUALS.add(EQUALS9);
+
+ pushFollow(FOLLOW_value_section_in_entry342);
+ value_section10=value_section();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_value_section.add(value_section10.getTree());
+ // DSLMap.g:94:70: ( EOL | EOF )
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+
+ if ( (LA3_0==EOL) ) {
+ alt3=1;
+ }
+ else if ( (LA3_0==EOF) ) {
+ alt3=2;
+ }
+ else {
+ if (backtracking>0) {failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("94:70: ( EOL | EOF )", 3, 0, input);
+
+ throw nvae;
+ }
+ switch (alt3) {
+ case 1 :
+ // DSLMap.g:94:71: EOL
+ {
+ EOL11=(Token)input.LT(1);
+ match(input,EOL,FOLLOW_EOL_in_entry345); if (failed) return retval;
+ if ( backtracking==0 ) stream_EOL.add(EOL11);
+
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:94:75: EOF
+ {
+ EOF12=(Token)input.LT(1);
+ match(input,EOF,FOLLOW_EOF_in_entry347); if (failed) return retval;
+ if ( backtracking==0 ) stream_EOF.add(EOF12);
+
+
+ }
+ break;
+
+ }
+
+
+ // AST REWRITE
+ // elements: value_section, meta_section, scope_section, key_section
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 95:2: -> ^( VT_ENTRY scope_section meta_section key_section value_section )
+ {
+ // DSLMap.g:95:5: ^( VT_ENTRY scope_section meta_section key_section value_section )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_ENTRY, "VT_ENTRY"), root_1);
+
+ adaptor.addChild(root_1, stream_scope_section.next());
+ adaptor.addChild(root_1, stream_meta_section.next());
+ adaptor.addChild(root_1, stream_key_section.next());
+ adaptor.addChild(root_1, stream_value_section.next());
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end entry
+
+ public static class scope_section_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start scope_section
+ // DSLMap.g:100:1: scope_section : LEFT_SQUARE (value1= condition_key | value2= consequence_key | value3= keyword_key | value4= any_key ) RIGHT_SQUARE -> ^( VT_SCOPE[$LEFT_SQUARE, \"SCOPE SECTION\"] ( $value1)? ( $value2)? ( $value3)? ( $value4)? ) ;
+ public final scope_section_return scope_section() throws RecognitionException {
+ scope_section_return retval = new scope_section_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token LEFT_SQUARE13=null;
+ Token RIGHT_SQUARE14=null;
+ condition_key_return value1 = null;
+
+ consequence_key_return value2 = null;
+
+ keyword_key_return value3 = null;
+
+ any_key_return value4 = null;
+
+
+ Object LEFT_SQUARE13_tree=null;
+ Object RIGHT_SQUARE14_tree=null;
+ RewriteRuleTokenStream stream_LEFT_SQUARE=new RewriteRuleTokenStream(adaptor,"token LEFT_SQUARE");
+ RewriteRuleTokenStream stream_RIGHT_SQUARE=new RewriteRuleTokenStream(adaptor,"token RIGHT_SQUARE");
+ RewriteRuleSubtreeStream stream_condition_key=new RewriteRuleSubtreeStream(adaptor,"rule condition_key");
+ RewriteRuleSubtreeStream stream_any_key=new RewriteRuleSubtreeStream(adaptor,"rule any_key");
+ RewriteRuleSubtreeStream stream_keyword_key=new RewriteRuleSubtreeStream(adaptor,"rule keyword_key");
+ RewriteRuleSubtreeStream stream_consequence_key=new RewriteRuleSubtreeStream(adaptor,"rule consequence_key");
+ try {
+ // DSLMap.g:101:2: ( LEFT_SQUARE (value1= condition_key | value2= consequence_key | value3= keyword_key | value4= any_key ) RIGHT_SQUARE -> ^( VT_SCOPE[$LEFT_SQUARE, \"SCOPE SECTION\"] ( $value1)? ( $value2)? ( $value3)? ( $value4)? ) )
+ // DSLMap.g:101:4: LEFT_SQUARE (value1= condition_key | value2= consequence_key | value3= keyword_key | value4= any_key ) RIGHT_SQUARE
+ {
+ LEFT_SQUARE13=(Token)input.LT(1);
+ match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_scope_section377); if (failed) return retval;
+ if ( backtracking==0 ) stream_LEFT_SQUARE.add(LEFT_SQUARE13);
+
+ // DSLMap.g:102:3: (value1= condition_key | value2= consequence_key | value3= keyword_key | value4= any_key )
+ int alt4=4;
+ int LA4_0 = input.LA(1);
+
+ if ( (LA4_0==LITERAL) ) {
+ int LA4_1 = input.LA(2);
+
+ if ( ((synpred5()&&validateIdentifierKey("condition")||validateIdentifierKey("when"))) ) {
+ alt4=1;
+ }
+ else if ( ((synpred6()&&validateIdentifierKey("consequence")||validateIdentifierKey("then"))) ) {
+ alt4=2;
+ }
+ else if ( ((synpred7()&&validateIdentifierKey("keyword"))) ) {
+ alt4=3;
+ }
+ else if ( (validateIdentifierKey("*")) ) {
+ alt4=4;
+ }
+ else {
+ if (backtracking>0) {failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("102:3: (value1= condition_key | value2= consequence_key | value3= keyword_key | value4= any_key )", 4, 1, input);
+
+ throw nvae;
+ }
+ }
+ else {
+ if (backtracking>0) {failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("102:3: (value1= condition_key | value2= consequence_key | value3= keyword_key | value4= any_key )", 4, 0, input);
+
+ throw nvae;
+ }
+ switch (alt4) {
+ case 1 :
+ // DSLMap.g:102:4: value1= condition_key
+ {
+ pushFollow(FOLLOW_condition_key_in_scope_section385);
+ value1=condition_key();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_condition_key.add(value1.getTree());
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:103:5: value2= consequence_key
+ {
+ pushFollow(FOLLOW_consequence_key_in_scope_section394);
+ value2=consequence_key();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_consequence_key.add(value2.getTree());
+
+ }
+ break;
+ case 3 :
+ // DSLMap.g:104:5: value3= keyword_key
+ {
+ pushFollow(FOLLOW_keyword_key_in_scope_section402);
+ value3=keyword_key();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_keyword_key.add(value3.getTree());
+
+ }
+ break;
+ case 4 :
+ // DSLMap.g:105:5: value4= any_key
+ {
+ pushFollow(FOLLOW_any_key_in_scope_section410);
+ value4=any_key();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_any_key.add(value4.getTree());
+
+ }
+ break;
+
+ }
+
+ RIGHT_SQUARE14=(Token)input.LT(1);
+ match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_scope_section418); if (failed) return retval;
+ if ( backtracking==0 ) stream_RIGHT_SQUARE.add(RIGHT_SQUARE14);
+
+
+ // AST REWRITE
+ // elements: value3, value1, value4, value2
+ // token labels:
+ // rule labels: value1, value4, value2, retval, value3
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_value1=new RewriteRuleSubtreeStream(adaptor,"token value1",value1!=null?value1.tree:null);
+ RewriteRuleSubtreeStream stream_value4=new RewriteRuleSubtreeStream(adaptor,"token value4",value4!=null?value4.tree:null);
+ RewriteRuleSubtreeStream stream_value2=new RewriteRuleSubtreeStream(adaptor,"token value2",value2!=null?value2.tree:null);
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+ RewriteRuleSubtreeStream stream_value3=new RewriteRuleSubtreeStream(adaptor,"token value3",value3!=null?value3.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 108:2: -> ^( VT_SCOPE[$LEFT_SQUARE, \"SCOPE SECTION\"] ( $value1)? ( $value2)? ( $value3)? ( $value4)? )
+ {
+ // DSLMap.g:108:5: ^( VT_SCOPE[$LEFT_SQUARE, \"SCOPE SECTION\"] ( $value1)? ( $value2)? ( $value3)? ( $value4)? )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_SCOPE, LEFT_SQUARE13, "SCOPE SECTION"), root_1);
+
+ // DSLMap.g:108:47: ( $value1)?
+ if ( stream_value1.hasNext() ) {
+ adaptor.addChild(root_1, stream_value1.next());
+
+ }
+ stream_value1.reset();
+ // DSLMap.g:108:56: ( $value2)?
+ if ( stream_value2.hasNext() ) {
+ adaptor.addChild(root_1, stream_value2.next());
+
+ }
+ stream_value2.reset();
+ // DSLMap.g:108:65: ( $value3)?
+ if ( stream_value3.hasNext() ) {
+ adaptor.addChild(root_1, stream_value3.next());
+
+ }
+ stream_value3.reset();
+ // DSLMap.g:108:74: ( $value4)?
+ if ( stream_value4.hasNext() ) {
+ adaptor.addChild(root_1, stream_value4.next());
+
+ }
+ stream_value4.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end scope_section
+
+ public static class meta_section_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start meta_section
+ // DSLMap.g:113:1: meta_section : LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) ;
+ public final meta_section_return meta_section() throws RecognitionException {
+ meta_section_return retval = new meta_section_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token LEFT_SQUARE15=null;
+ Token LITERAL16=null;
+ Token RIGHT_SQUARE17=null;
+
+ Object LEFT_SQUARE15_tree=null;
+ Object LITERAL16_tree=null;
+ Object RIGHT_SQUARE17_tree=null;
+ RewriteRuleTokenStream stream_LEFT_SQUARE=new RewriteRuleTokenStream(adaptor,"token LEFT_SQUARE");
+ RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL");
+ RewriteRuleTokenStream stream_RIGHT_SQUARE=new RewriteRuleTokenStream(adaptor,"token RIGHT_SQUARE");
+
+ try {
+ // DSLMap.g:114:2: ( LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) )
+ // DSLMap.g:114:4: LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE
+ {
+ LEFT_SQUARE15=(Token)input.LT(1);
+ match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_meta_section456); if (failed) return retval;
+ if ( backtracking==0 ) stream_LEFT_SQUARE.add(LEFT_SQUARE15);
+
+ // DSLMap.g:114:16: ( LITERAL )?
+ int alt5=2;
+ int LA5_0 = input.LA(1);
+
+ if ( (LA5_0==LITERAL) ) {
+ alt5=1;
+ }
+ switch (alt5) {
+ case 1 :
+ // DSLMap.g:0:0: LITERAL
+ {
+ LITERAL16=(Token)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_meta_section458); if (failed) return retval;
+ if ( backtracking==0 ) stream_LITERAL.add(LITERAL16);
+
+
+ }
+ break;
+
+ }
+
+ RIGHT_SQUARE17=(Token)input.LT(1);
+ match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_meta_section461); if (failed) return retval;
+ if ( backtracking==0 ) stream_RIGHT_SQUARE.add(RIGHT_SQUARE17);
+
+
+ // AST REWRITE
+ // elements: LITERAL
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 115:2: -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? )
+ {
+ // DSLMap.g:115:5: ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_META, LEFT_SQUARE15, "META SECTION"), root_1);
+
+ // DSLMap.g:115:45: ( LITERAL )?
+ if ( stream_LITERAL.hasNext() ) {
+ adaptor.addChild(root_1, stream_LITERAL.next());
+
+ }
+ stream_LITERAL.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end meta_section
+
+ public static class key_section_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start key_section
+ // DSLMap.g:118:1: key_section : ( key_sentence )+ -> ^( VT_ENTRY_KEY ( key_sentence )+ ) ;
+ public final key_section_return key_section() throws RecognitionException {
+ key_section_return retval = new key_section_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ key_sentence_return key_sentence18 = null;
+
+
+ RewriteRuleSubtreeStream stream_key_sentence=new RewriteRuleSubtreeStream(adaptor,"rule key_sentence");
+ try {
+ // DSLMap.g:119:2: ( ( key_sentence )+ -> ^( VT_ENTRY_KEY ( key_sentence )+ ) )
+ // DSLMap.g:119:4: ( key_sentence )+
+ {
+ // DSLMap.g:119:4: ( key_sentence )+
+ int cnt6=0;
+ loop6:
+ do {
+ int alt6=2;
+ int LA6_0 = input.LA(1);
+
+ if ( ((LA6_0>=LITERAL && LA6_0<=LEFT_CURLY)) ) {
+ alt6=1;
+ }
+
+
+ switch (alt6) {
+ case 1 :
+ // DSLMap.g:0:0: key_sentence
+ {
+ pushFollow(FOLLOW_key_sentence_in_key_section483);
+ key_sentence18=key_sentence();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_key_sentence.add(key_sentence18.getTree());
+
+ }
+ break;
+
+ default :
+ if ( cnt6 >= 1 ) break loop6;
+ if (backtracking>0) {failed=true; return retval;}
+ EarlyExitException eee =
+ new EarlyExitException(6, input);
+ throw eee;
+ }
+ cnt6++;
+ } while (true);
+
+
+ // AST REWRITE
+ // elements: key_sentence
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 120:2: -> ^( VT_ENTRY_KEY ( key_sentence )+ )
+ {
+ // DSLMap.g:120:5: ^( VT_ENTRY_KEY ( key_sentence )+ )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_ENTRY_KEY, "VT_ENTRY_KEY"), root_1);
+
+ if ( !(stream_key_sentence.hasNext()) ) {
+ throw new RewriteEarlyExitException();
+ }
+ while ( stream_key_sentence.hasNext() ) {
+ adaptor.addChild(root_1, stream_key_sentence.next());
+
+ }
+ stream_key_sentence.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end key_section
+
+ public static class key_sentence_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start key_sentence
+ // DSLMap.g:123:1: key_sentence : ( variable_definition | cb= key_chunk -> VT_LITERAL[$cb.start, text] );
+ public final key_sentence_return key_sentence() throws RecognitionException {
+ key_sentence_return retval = new key_sentence_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ key_chunk_return cb = null;
+
+ variable_definition_return variable_definition19 = null;
+
+
+ RewriteRuleSubtreeStream stream_key_chunk=new RewriteRuleSubtreeStream(adaptor,"rule key_chunk");
+
+ String text = "";
+
+ try {
+ // DSLMap.g:127:2: ( variable_definition | cb= key_chunk -> VT_LITERAL[$cb.start, text] )
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+
+ if ( (LA7_0==LEFT_CURLY) ) {
+ alt7=1;
+ }
+ else if ( ((LA7_0>=LITERAL && LA7_0<=COLON)) ) {
+ alt7=2;
+ }
+ else {
+ if (backtracking>0) {failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("123:1: key_sentence : ( variable_definition | cb= key_chunk -> VT_LITERAL[$cb.start, text] );", 7, 0, input);
+
+ throw nvae;
+ }
+ switch (alt7) {
+ case 1 :
+ // DSLMap.g:127:4: variable_definition
+ {
+ root_0 = (Object)adaptor.nil();
+
+ pushFollow(FOLLOW_variable_definition_in_key_sentence514);
+ variable_definition19=variable_definition();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) adaptor.addChild(root_0, variable_definition19.getTree());
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:128:4: cb= key_chunk
+ {
+ pushFollow(FOLLOW_key_chunk_in_key_sentence521);
+ cb=key_chunk();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_key_chunk.add(cb.getTree());
+ if ( backtracking==0 ) {
+ text = input.toString(cb.start,cb.stop);
+ }
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 129:2: -> VT_LITERAL[$cb.start, text]
+ {
+ adaptor.addChild(root_0, adaptor.create(VT_LITERAL, ((Token)cb.start), text));
+
+ }
+
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end key_sentence
+
+ public static class key_chunk_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start key_chunk
+ // DSLMap.g:132:1: key_chunk : ( literal )+ ;
+ public final key_chunk_return key_chunk() throws RecognitionException {
+ key_chunk_return retval = new key_chunk_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ literal_return literal20 = null;
+
+
+
+ try {
+ // DSLMap.g:133:2: ( ( literal )+ )
+ // DSLMap.g:133:4: ( literal )+
+ {
+ root_0 = (Object)adaptor.nil();
+
+ // DSLMap.g:133:4: ( literal )+
+ int cnt8=0;
+ loop8:
+ do {
+ int alt8=2;
+ int LA8_0 = input.LA(1);
+
+ if ( ((LA8_0>=LITERAL && LA8_0<=COLON)) ) {
+ int LA8_2 = input.LA(2);
+
+ if ( (synpred11()) ) {
+ alt8=1;
+ }
+
+
+ }
+
+
+ switch (alt8) {
+ case 1 :
+ // DSLMap.g:0:0: literal
+ {
+ pushFollow(FOLLOW_literal_in_key_chunk542);
+ literal20=literal();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) adaptor.addChild(root_0, literal20.getTree());
+
+ }
+ break;
+
+ default :
+ if ( cnt8 >= 1 ) break loop8;
+ if (backtracking>0) {failed=true; return retval;}
+ EarlyExitException eee =
+ new EarlyExitException(8, input);
+ throw eee;
+ }
+ cnt8++;
+ } while (true);
+
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end key_chunk
+
+ public static class value_section_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start value_section
+ // DSLMap.g:136:1: value_section : ( value_sentence )+ -> ^( VT_ENTRY_VAL ( value_sentence )+ ) ;
+ public final value_section_return value_section() throws RecognitionException {
+ value_section_return retval = new value_section_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ value_sentence_return value_sentence21 = null;
+
+
+ RewriteRuleSubtreeStream stream_value_sentence=new RewriteRuleSubtreeStream(adaptor,"rule value_sentence");
+ try {
+ // DSLMap.g:137:2: ( ( value_sentence )+ -> ^( VT_ENTRY_VAL ( value_sentence )+ ) )
+ // DSLMap.g:137:4: ( value_sentence )+
+ {
+ // DSLMap.g:137:4: ( value_sentence )+
+ int cnt9=0;
+ loop9:
+ do {
+ int alt9=2;
+ int LA9_0 = input.LA(1);
+
+ if ( (LA9_0==EQUALS||(LA9_0>=LITERAL && LA9_0<=LEFT_CURLY)) ) {
+ alt9=1;
+ }
+
+
+ switch (alt9) {
+ case 1 :
+ // DSLMap.g:0:0: value_sentence
+ {
+ pushFollow(FOLLOW_value_sentence_in_value_section557);
+ value_sentence21=value_sentence();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_value_sentence.add(value_sentence21.getTree());
+
+ }
+ break;
+
+ default :
+ if ( cnt9 >= 1 ) break loop9;
+ if (backtracking>0) {failed=true; return retval;}
+ EarlyExitException eee =
+ new EarlyExitException(9, input);
+ throw eee;
+ }
+ cnt9++;
+ } while (true);
+
+
+ // AST REWRITE
+ // elements: value_sentence
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 138:2: -> ^( VT_ENTRY_VAL ( value_sentence )+ )
+ {
+ // DSLMap.g:138:5: ^( VT_ENTRY_VAL ( value_sentence )+ )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_ENTRY_VAL, "VT_ENTRY_VAL"), root_1);
+
+ if ( !(stream_value_sentence.hasNext()) ) {
+ throw new RewriteEarlyExitException();
+ }
+ while ( stream_value_sentence.hasNext() ) {
+ adaptor.addChild(root_1, stream_value_sentence.next());
+
+ }
+ stream_value_sentence.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end value_section
+
+ public static class value_sentence_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start value_sentence
+ // DSLMap.g:141:1: value_sentence : ( variable_reference | vc= value_chunk -> VT_LITERAL[$vc.start, text] );
+ public final value_sentence_return value_sentence() throws RecognitionException {
+ value_sentence_return retval = new value_sentence_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ value_chunk_return vc = null;
+
+ variable_reference_return variable_reference22 = null;
+
+
+ RewriteRuleSubtreeStream stream_value_chunk=new RewriteRuleSubtreeStream(adaptor,"rule value_chunk");
+
+ String text = "";
+
+ try {
+ // DSLMap.g:145:2: ( variable_reference | vc= value_chunk -> VT_LITERAL[$vc.start, text] )
+ int alt10=2;
+ int LA10_0 = input.LA(1);
+
+ if ( (LA10_0==LEFT_CURLY) ) {
+ alt10=1;
+ }
+ else if ( (LA10_0==EQUALS||(LA10_0>=LITERAL && LA10_0<=COLON)) ) {
+ alt10=2;
+ }
+ else {
+ if (backtracking>0) {failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("141:1: value_sentence : ( variable_reference | vc= value_chunk -> VT_LITERAL[$vc.start, text] );", 10, 0, input);
+
+ throw nvae;
+ }
+ switch (alt10) {
+ case 1 :
+ // DSLMap.g:145:4: variable_reference
+ {
+ root_0 = (Object)adaptor.nil();
+
+ pushFollow(FOLLOW_variable_reference_in_value_sentence588);
+ variable_reference22=variable_reference();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) adaptor.addChild(root_0, variable_reference22.getTree());
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:146:4: vc= value_chunk
+ {
+ pushFollow(FOLLOW_value_chunk_in_value_sentence595);
+ vc=value_chunk();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) stream_value_chunk.add(vc.getTree());
+ if ( backtracking==0 ) {
+ text = input.toString(vc.start,vc.stop);
+ }
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 147:2: -> VT_LITERAL[$vc.start, text]
+ {
+ adaptor.addChild(root_0, adaptor.create(VT_LITERAL, ((Token)vc.start), text));
+
+ }
+
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end value_sentence
+
+ public static class value_chunk_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start value_chunk
+ // DSLMap.g:150:1: value_chunk : ( literal | EQUALS )+ ;
+ public final value_chunk_return value_chunk() throws RecognitionException {
+ value_chunk_return retval = new value_chunk_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token EQUALS24=null;
+ literal_return literal23 = null;
+
+
+ Object EQUALS24_tree=null;
+
+ try {
+ // DSLMap.g:151:2: ( ( literal | EQUALS )+ )
+ // DSLMap.g:151:4: ( literal | EQUALS )+
+ {
+ root_0 = (Object)adaptor.nil();
+
+ // DSLMap.g:151:4: ( literal | EQUALS )+
+ int cnt11=0;
+ loop11:
+ do {
+ int alt11=3;
+ int LA11_0 = input.LA(1);
+
+ if ( ((LA11_0>=LITERAL && LA11_0<=COLON)) ) {
+ int LA11_2 = input.LA(2);
+
+ if ( (synpred14()) ) {
+ alt11=1;
+ }
+
+
+ }
+ else if ( (LA11_0==EQUALS) ) {
+ int LA11_3 = input.LA(2);
+
+ if ( (synpred15()) ) {
+ alt11=2;
+ }
+
+
+ }
+
+
+ switch (alt11) {
+ case 1 :
+ // DSLMap.g:151:5: literal
+ {
+ pushFollow(FOLLOW_literal_in_value_chunk617);
+ literal23=literal();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) adaptor.addChild(root_0, literal23.getTree());
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:151:13: EQUALS
+ {
+ EQUALS24=(Token)input.LT(1);
+ match(input,EQUALS,FOLLOW_EQUALS_in_value_chunk619); if (failed) return retval;
+ if ( backtracking==0 ) {
+ EQUALS24_tree = (Object)adaptor.create(EQUALS24);
+ adaptor.addChild(root_0, EQUALS24_tree);
+ }
+
+ }
+ break;
+
+ default :
+ if ( cnt11 >= 1 ) break loop11;
+ if (backtracking>0) {failed=true; return retval;}
+ EarlyExitException eee =
+ new EarlyExitException(11, input);
+ throw eee;
+ }
+ cnt11++;
+ } while (true);
+
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end value_chunk
+
+ public static class literal_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start literal
+ // DSLMap.g:154:1: literal : ( LITERAL | COLON ) ;
+ public final literal_return literal() throws RecognitionException {
+ literal_return retval = new literal_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token set25=null;
+
+ Object set25_tree=null;
+
+ try {
+ // DSLMap.g:156:2: ( ( LITERAL | COLON ) )
+ // DSLMap.g:156:4: ( LITERAL | COLON )
+ {
+ root_0 = (Object)adaptor.nil();
+
+ set25=(Token)input.LT(1);
+ if ( (input.LA(1)>=LITERAL && input.LA(1)<=COLON) ) {
+ input.consume();
+ if ( backtracking==0 ) adaptor.addChild(root_0, adaptor.create(set25));
+ errorRecovery=false;failed=false;
+ }
+ else {
+ if (backtracking>0) {failed=true; return retval;}
+ MismatchedSetException mse =
+ new MismatchedSetException(null,input);
+ recoverFromMismatchedSet(input,mse,FOLLOW_set_in_literal637); throw mse;
+ }
+
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end literal
+
+ public static class variable_definition_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start variable_definition
+ // DSLMap.g:160:1: variable_definition : lc= LEFT_CURLY name= LITERAL ( COLON pat= pattern )? RIGHT_CURLY -> {hasSpace && !\"\".equals(text)}? VT_SPACE ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] ) -> {!hasSpace && !\"\".equals(text)}? ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] ) -> {hasSpace}? VT_SPACE ^( VT_VAR_DEF $name) -> ^( VT_VAR_DEF $name) ;
+ public final variable_definition_return variable_definition() throws RecognitionException {
+ variable_definition_return retval = new variable_definition_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token lc=null;
+ Token name=null;
+ Token COLON26=null;
+ Token RIGHT_CURLY27=null;
+ pattern_return pat = null;
+
+
+ Object lc_tree=null;
+ Object name_tree=null;
+ Object COLON26_tree=null;
+ Object RIGHT_CURLY27_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 hasSpace = false;
+
+ try {
+ // DSLMap.g:165:2: (lc= LEFT_CURLY name= LITERAL ( COLON pat= pattern )? RIGHT_CURLY -> {hasSpace && !\"\".equals(text)}? VT_SPACE ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] ) -> {!hasSpace && !\"\".equals(text)}? ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] ) -> {hasSpace}? VT_SPACE ^( VT_VAR_DEF $name) -> ^( VT_VAR_DEF $name) )
+ // DSLMap.g:165:4: lc= LEFT_CURLY name= LITERAL ( COLON pat= pattern )? RIGHT_CURLY
+ {
+ lc=(Token)input.LT(1);
+ match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_variable_definition665); if (failed) return retval;
+ if ( backtracking==0 ) stream_LEFT_CURLY.add(lc);
+
+ if ( backtracking==0 ) {
+ if( ((CommonToken)input.LT(-2)).getStopIndex() < ((CommonToken)lc).getStartIndex() -1 ) hasSpace = true;
+ }
+ name=(Token)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_variable_definition673); if (failed) return retval;
+ if ( backtracking==0 ) stream_LITERAL.add(name);
+
+ // DSLMap.g:166:15: ( COLON pat= pattern )?
+ int alt12=2;
+ int LA12_0 = input.LA(1);
+
+ if ( (LA12_0==COLON) ) {
+ alt12=1;
+ }
+ switch (alt12) {
+ case 1 :
+ // DSLMap.g:166:17: COLON pat= pattern
+ {
+ COLON26=(Token)input.LT(1);
+ match(input,COLON,FOLLOW_COLON_in_variable_definition677); if (failed) return retval;
+ if ( backtracking==0 ) stream_COLON.add(COLON26);
+
+ pushFollow(FOLLOW_pattern_in_variable_definition681);
+ 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;
+
+ }
+
+ RIGHT_CURLY27=(Token)input.LT(1);
+ match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_variable_definition688); if (failed) return retval;
+ if ( backtracking==0 ) stream_RIGHT_CURLY.add(RIGHT_CURLY27);
+
+
+ // AST REWRITE
+ // elements: name, name, name, name
+ // token labels: name
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ 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();
+ // 167:2: -> {hasSpace && !\"\".equals(text)}? VT_SPACE ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] )
+ if (hasSpace && !"".equals(text)) {
+ adaptor.addChild(root_0, adaptor.create(VT_SPACE, "VT_SPACE"));
+ // DSLMap.g:167:46: ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_VAR_DEF, "VT_VAR_DEF"), root_1);
+
+ adaptor.addChild(root_1, stream_name.next());
+ adaptor.addChild(root_1, adaptor.create(VT_PATTERN, ((Token)pat.start), text));
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+ else // 168:2: -> {!hasSpace && !\"\".equals(text)}? ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] )
+ if (!hasSpace && !"".equals(text)) {
+ // DSLMap.g:168:38: ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_VAR_DEF, "VT_VAR_DEF"), root_1);
+
+ adaptor.addChild(root_1, stream_name.next());
+ adaptor.addChild(root_1, adaptor.create(VT_PATTERN, ((Token)pat.start), text));
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+ else // 169:2: -> {hasSpace}? VT_SPACE ^( VT_VAR_DEF $name)
+ if (hasSpace) {
+ adaptor.addChild(root_0, adaptor.create(VT_SPACE, "VT_SPACE"));
+ // DSLMap.g:169:26: ^( VT_VAR_DEF $name)
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_VAR_DEF, "VT_VAR_DEF"), root_1);
+
+ adaptor.addChild(root_1, stream_name.next());
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+ else // 170:2: -> ^( VT_VAR_DEF $name)
+ {
+ // DSLMap.g:170:5: ^( VT_VAR_DEF $name)
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_VAR_DEF, "VT_VAR_DEF"), root_1);
+
+ adaptor.addChild(root_1, stream_name.next());
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end variable_definition
+
+ public static class variable_definition2_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start variable_definition2
+ // DSLMap.g:173:1: variable_definition2 : LEFT_CURLY name= LITERAL ( COLON pat= pattern )? RIGHT_CURLY -> {!\"\".equals(text)}? ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] ) -> ^( VT_VAR_DEF $name) ;
+ public final variable_definition2_return variable_definition2() throws RecognitionException {
+ variable_definition2_return retval = new variable_definition2_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token name=null;
+ Token LEFT_CURLY28=null;
+ Token COLON29=null;
+ Token RIGHT_CURLY30=null;
+ pattern_return pat = null;
+
+
+ Object name_tree=null;
+ Object LEFT_CURLY28_tree=null;
+ Object COLON29_tree=null;
+ Object RIGHT_CURLY30_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 = "";
+
+ try {
+ // DSLMap.g:177:2: ( LEFT_CURLY name= LITERAL ( COLON pat= pattern )? RIGHT_CURLY -> {!\"\".equals(text)}? ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] ) -> ^( VT_VAR_DEF $name) )
+ // DSLMap.g:177:4: LEFT_CURLY name= LITERAL ( COLON pat= pattern )? RIGHT_CURLY
+ {
+ LEFT_CURLY28=(Token)input.LT(1);
+ match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_variable_definition2770); if (failed) return retval;
+ if ( backtracking==0 ) stream_LEFT_CURLY.add(LEFT_CURLY28);
+
+ name=(Token)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_variable_definition2774); if (failed) return retval;
+ if ( backtracking==0 ) stream_LITERAL.add(name);
+
+ // DSLMap.g:177:28: ( COLON pat= pattern )?
+ int alt13=2;
+ int LA13_0 = input.LA(1);
+
+ if ( (LA13_0==COLON) ) {
+ alt13=1;
+ }
+ switch (alt13) {
+ case 1 :
+ // DSLMap.g:177:30: COLON pat= pattern
+ {
+ COLON29=(Token)input.LT(1);
+ match(input,COLON,FOLLOW_COLON_in_variable_definition2778); if (failed) return retval;
+ if ( backtracking==0 ) stream_COLON.add(COLON29);
+
+ pushFollow(FOLLOW_pattern_in_variable_definition2782);
+ 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;
+
+ }
+
+ RIGHT_CURLY30=(Token)input.LT(1);
+ match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_variable_definition2789); if (failed) return retval;
+ if ( backtracking==0 ) stream_RIGHT_CURLY.add(RIGHT_CURLY30);
+
+
+ // AST REWRITE
+ // elements: name, name
+ // token labels: name
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ 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();
+ // 178:2: -> {!\"\".equals(text)}? ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] )
+ if (!"".equals(text)) {
+ // DSLMap.g:178:25: ^( VT_VAR_DEF $name VT_PATTERN[$pat.start, text] )
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_VAR_DEF, "VT_VAR_DEF"), root_1);
+
+ adaptor.addChild(root_1, stream_name.next());
+ adaptor.addChild(root_1, adaptor.create(VT_PATTERN, ((Token)pat.start), text));
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+ else // 179:2: -> ^( VT_VAR_DEF $name)
+ {
+ // DSLMap.g:179:5: ^( VT_VAR_DEF $name)
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_VAR_DEF, "VT_VAR_DEF"), root_1);
+
+ adaptor.addChild(root_1, stream_name.next());
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end variable_definition2
+
+ public static class pattern_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start pattern
+ // DSLMap.g:183:1: pattern : ( literal | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+ ;
+ public final pattern_return pattern() throws RecognitionException {
+ pattern_return retval = new pattern_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token LEFT_CURLY32=null;
+ Token RIGHT_CURLY34=null;
+ Token LEFT_SQUARE35=null;
+ Token RIGHT_SQUARE37=null;
+ literal_return literal31 = null;
+
+ literal_return literal33 = null;
+
+ pattern_return pattern36 = null;
+
+
+ Object LEFT_CURLY32_tree=null;
+ Object RIGHT_CURLY34_tree=null;
+ Object LEFT_SQUARE35_tree=null;
+ Object RIGHT_SQUARE37_tree=null;
+
+ try {
+ // DSLMap.g:184:9: ( ( literal | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+ )
+ // DSLMap.g:184:11: ( literal | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+
+ {
+ root_0 = (Object)adaptor.nil();
+
+ // DSLMap.g:184:11: ( literal | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+
+ int cnt14=0;
+ loop14:
+ do {
+ int alt14=4;
+ switch ( input.LA(1) ) {
+ case LITERAL:
+ case COLON:
+ {
+ alt14=1;
+ }
+ break;
+ case LEFT_CURLY:
+ {
+ alt14=2;
+ }
+ break;
+ case LEFT_SQUARE:
+ {
+ alt14=3;
+ }
+ break;
+
+ }
+
+ switch (alt14) {
+ case 1 :
+ // DSLMap.g:184:13: literal
+ {
+ pushFollow(FOLLOW_literal_in_pattern840);
+ literal31=literal();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) adaptor.addChild(root_0, literal31.getTree());
+
+ }
+ break;
+ case 2 :
+ // DSLMap.g:185:13: LEFT_CURLY literal RIGHT_CURLY
+ {
+ LEFT_CURLY32=(Token)input.LT(1);
+ match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_pattern854); if (failed) return retval;
+ if ( backtracking==0 ) {
+ LEFT_CURLY32_tree = (Object)adaptor.create(LEFT_CURLY32);
+ adaptor.addChild(root_0, LEFT_CURLY32_tree);
+ }
+ pushFollow(FOLLOW_literal_in_pattern856);
+ literal33=literal();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) adaptor.addChild(root_0, literal33.getTree());
+ RIGHT_CURLY34=(Token)input.LT(1);
+ match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_pattern858); if (failed) return retval;
+ if ( backtracking==0 ) {
+ RIGHT_CURLY34_tree = (Object)adaptor.create(RIGHT_CURLY34);
+ adaptor.addChild(root_0, RIGHT_CURLY34_tree);
+ }
+
+ }
+ break;
+ case 3 :
+ // DSLMap.g:186:13: LEFT_SQUARE pattern RIGHT_SQUARE
+ {
+ LEFT_SQUARE35=(Token)input.LT(1);
+ match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_pattern872); if (failed) return retval;
+ if ( backtracking==0 ) {
+ LEFT_SQUARE35_tree = (Object)adaptor.create(LEFT_SQUARE35);
+ adaptor.addChild(root_0, LEFT_SQUARE35_tree);
+ }
+ pushFollow(FOLLOW_pattern_in_pattern874);
+ pattern36=pattern();
+ _fsp--;
+ if (failed) return retval;
+ if ( backtracking==0 ) adaptor.addChild(root_0, pattern36.getTree());
+ RIGHT_SQUARE37=(Token)input.LT(1);
+ match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_pattern876); if (failed) return retval;
+ if ( backtracking==0 ) {
+ RIGHT_SQUARE37_tree = (Object)adaptor.create(RIGHT_SQUARE37);
+ adaptor.addChild(root_0, RIGHT_SQUARE37_tree);
+ }
+
+ }
+ break;
+
+ default :
+ if ( cnt14 >= 1 ) break loop14;
+ if (backtracking>0) {failed=true; return retval;}
+ EarlyExitException eee =
+ new EarlyExitException(14, input);
+ throw eee;
+ }
+ cnt14++;
+ } while (true);
+
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end pattern
+
+ public static class variable_reference_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start variable_reference
+ // DSLMap.g:191:1: variable_reference : lc= LEFT_CURLY name= LITERAL RIGHT_CURLY -> {hasSpace}? VT_SPACE ^( VT_VAR_REF $name) -> ^( VT_VAR_REF $name) ;
+ public final variable_reference_return variable_reference() throws RecognitionException {
+ variable_reference_return retval = new variable_reference_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token lc=null;
+ Token name=null;
+ Token RIGHT_CURLY38=null;
+
+ Object lc_tree=null;
+ Object name_tree=null;
+ Object RIGHT_CURLY38_tree=null;
+ 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");
+
+
+ boolean hasSpace = false;
+
+ try {
+ // DSLMap.g:195:2: (lc= LEFT_CURLY name= LITERAL RIGHT_CURLY -> {hasSpace}? VT_SPACE ^( VT_VAR_REF $name) -> ^( VT_VAR_REF $name) )
+ // DSLMap.g:195:4: lc= LEFT_CURLY name= LITERAL RIGHT_CURLY
+ {
+ lc=(Token)input.LT(1);
+ match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_variable_reference911); if (failed) return retval;
+ if ( backtracking==0 ) stream_LEFT_CURLY.add(lc);
+
+ if ( backtracking==0 ) {
+ if( ((CommonToken)input.LT(-2)).getStopIndex() < ((CommonToken)lc).getStartIndex() -1 ) hasSpace = true;
+ }
+ name=(Token)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_variable_reference919); if (failed) return retval;
+ if ( backtracking==0 ) stream_LITERAL.add(name);
+
+ RIGHT_CURLY38=(Token)input.LT(1);
+ match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_variable_reference921); if (failed) return retval;
+ if ( backtracking==0 ) stream_RIGHT_CURLY.add(RIGHT_CURLY38);
+
+
+ // AST REWRITE
+ // elements: name, name
+ // token labels: name
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ 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();
+ // 197:2: -> {hasSpace}? VT_SPACE ^( VT_VAR_REF $name)
+ if (hasSpace) {
+ adaptor.addChild(root_0, adaptor.create(VT_SPACE, "VT_SPACE"));
+ // DSLMap.g:197:26: ^( VT_VAR_REF $name)
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_VAR_REF, "VT_VAR_REF"), root_1);
+
+ adaptor.addChild(root_1, stream_name.next());
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+ else // 198:2: -> ^( VT_VAR_REF $name)
+ {
+ // DSLMap.g:198:6: ^( VT_VAR_REF $name)
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_VAR_REF, "VT_VAR_REF"), root_1);
+
+ adaptor.addChild(root_1, stream_name.next());
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end variable_reference
+
+ public static class variable_reference2_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start variable_reference2
+ // DSLMap.g:202:1: variable_reference2 : LEFT_CURLY name= LITERAL RIGHT_CURLY -> ^( VT_VAR_REF $name) ;
+ public final variable_reference2_return variable_reference2() throws RecognitionException {
+ variable_reference2_return retval = new variable_reference2_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token name=null;
+ Token LEFT_CURLY39=null;
+ Token RIGHT_CURLY40=null;
+
+ Object name_tree=null;
+ Object LEFT_CURLY39_tree=null;
+ Object RIGHT_CURLY40_tree=null;
+ 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");
+
+ try {
+ // DSLMap.g:203:2: ( LEFT_CURLY name= LITERAL RIGHT_CURLY -> ^( VT_VAR_REF $name) )
+ // DSLMap.g:203:4: LEFT_CURLY name= LITERAL RIGHT_CURLY
+ {
+ LEFT_CURLY39=(Token)input.LT(1);
+ match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_variable_reference2962); if (failed) return retval;
+ if ( backtracking==0 ) stream_LEFT_CURLY.add(LEFT_CURLY39);
+
+ name=(Token)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_variable_reference2966); if (failed) return retval;
+ if ( backtracking==0 ) stream_LITERAL.add(name);
+
+ RIGHT_CURLY40=(Token)input.LT(1);
+ match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_variable_reference2968); if (failed) return retval;
+ if ( backtracking==0 ) stream_RIGHT_CURLY.add(RIGHT_CURLY40);
+
+
+ // AST REWRITE
+ // elements: name
+ // token labels: name
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ 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();
+ // 204:2: -> ^( VT_VAR_REF $name)
+ {
+ // DSLMap.g:204:5: ^( VT_VAR_REF $name)
+ {
+ Object root_1 = (Object)adaptor.nil();
+ root_1 = (Object)adaptor.becomeRoot(adaptor.create(VT_VAR_REF, "VT_VAR_REF"), root_1);
+
+ adaptor.addChild(root_1, stream_name.next());
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end variable_reference2
+
+ public static class condition_key_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start condition_key
+ // DSLMap.g:208:1: condition_key : {...}?value= LITERAL -> VT_CONDITION[$value] ;
+ public final condition_key_return condition_key() throws RecognitionException {
+ condition_key_return retval = new condition_key_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token value=null;
+
+ Object value_tree=null;
+ RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL");
+
+ try {
+ // DSLMap.g:209:2: ({...}?value= LITERAL -> VT_CONDITION[$value] )
+ // DSLMap.g:209:4: {...}?value= LITERAL
+ {
+ if ( !(validateIdentifierKey("condition")||validateIdentifierKey("when")) ) {
+ if (backtracking>0) {failed=true; return retval;}
+ throw new FailedPredicateException(input, "condition_key", "validateIdentifierKey(\"condition\")||validateIdentifierKey(\"when\")");
+ }
+ value=(Token)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_condition_key997); if (failed) return retval;
+ if ( backtracking==0 ) stream_LITERAL.add(value);
+
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 210:2: -> VT_CONDITION[$value]
+ {
+ adaptor.addChild(root_0, adaptor.create(VT_CONDITION, value));
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end condition_key
+
+ public static class consequence_key_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start consequence_key
+ // DSLMap.g:213:1: consequence_key : {...}?value= LITERAL -> VT_CONSEQUENCE[$value] ;
+ public final consequence_key_return consequence_key() throws RecognitionException {
+ consequence_key_return retval = new consequence_key_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token value=null;
+
+ Object value_tree=null;
+ RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL");
+
+ try {
+ // DSLMap.g:214:2: ({...}?value= LITERAL -> VT_CONSEQUENCE[$value] )
+ // DSLMap.g:214:4: {...}?value= LITERAL
+ {
+ if ( !(validateIdentifierKey("consequence")||validateIdentifierKey("then")) ) {
+ if (backtracking>0) {failed=true; return retval;}
+ throw new FailedPredicateException(input, "consequence_key", "validateIdentifierKey(\"consequence\")||validateIdentifierKey(\"then\")");
+ }
+ value=(Token)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_consequence_key1020); if (failed) return retval;
+ if ( backtracking==0 ) stream_LITERAL.add(value);
+
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 215:2: -> VT_CONSEQUENCE[$value]
+ {
+ adaptor.addChild(root_0, adaptor.create(VT_CONSEQUENCE, value));
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end consequence_key
+
+ public static class keyword_key_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start keyword_key
+ // DSLMap.g:218:1: keyword_key : {...}?value= LITERAL -> VT_KEYWORD[$value] ;
+ public final keyword_key_return keyword_key() throws RecognitionException {
+ keyword_key_return retval = new keyword_key_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token value=null;
+
+ Object value_tree=null;
+ RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL");
+
+ try {
+ // DSLMap.g:219:2: ({...}?value= LITERAL -> VT_KEYWORD[$value] )
+ // DSLMap.g:219:4: {...}?value= LITERAL
+ {
+ if ( !(validateIdentifierKey("keyword")) ) {
+ if (backtracking>0) {failed=true; return retval;}
+ throw new FailedPredicateException(input, "keyword_key", "validateIdentifierKey(\"keyword\")");
+ }
+ value=(Token)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_keyword_key1043); if (failed) return retval;
+ if ( backtracking==0 ) stream_LITERAL.add(value);
+
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 220:2: -> VT_KEYWORD[$value]
+ {
+ adaptor.addChild(root_0, adaptor.create(VT_KEYWORD, value));
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end keyword_key
+
+ public static class any_key_return extends ParserRuleReturnScope {
+ Object tree;
+ public Object getTree() { return tree; }
+ };
+
+ // $ANTLR start any_key
+ // DSLMap.g:223:1: any_key : {...}?value= LITERAL -> VT_ANY[$value] ;
+ public final any_key_return any_key() throws RecognitionException {
+ any_key_return retval = new any_key_return();
+ retval.start = input.LT(1);
+
+ Object root_0 = null;
+
+ Token value=null;
+
+ Object value_tree=null;
+ RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL");
+
+ try {
+ // DSLMap.g:224:2: ({...}?value= LITERAL -> VT_ANY[$value] )
+ // DSLMap.g:224:4: {...}?value= LITERAL
+ {
+ if ( !(validateIdentifierKey("*")) ) {
+ if (backtracking>0) {failed=true; return retval;}
+ throw new FailedPredicateException(input, "any_key", "validateIdentifierKey(\"*\")");
+ }
+ value=(Token)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_any_key1066); if (failed) return retval;
+ if ( backtracking==0 ) stream_LITERAL.add(value);
+
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ if ( backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"token retval",retval!=null?retval.tree:null);
+
+ root_0 = (Object)adaptor.nil();
+ // 225:2: -> VT_ANY[$value]
+ {
+ adaptor.addChild(root_0, adaptor.create(VT_ANY, value));
+
+ }
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( backtracking==0 ) {
+ retval.tree = (Object)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return retval;
+ }
+ // $ANTLR end any_key
+
+ // $ANTLR start synpred5
+ public final void synpred5_fragment() throws RecognitionException {
+ // DSLMap.g:102:4: ( condition_key )
+ // DSLMap.g:102:4: condition_key
+ {
+ pushFollow(FOLLOW_condition_key_in_synpred5385);
+ condition_key();
+ _fsp--;
+ if (failed) return ;
+
+ }
+ }
+ // $ANTLR end synpred5
+
+ // $ANTLR start synpred6
+ public final void synpred6_fragment() throws RecognitionException {
+ // DSLMap.g:103:5: ( consequence_key )
+ // DSLMap.g:103:5: consequence_key
+ {
+ pushFollow(FOLLOW_consequence_key_in_synpred6394);
+ consequence_key();
+ _fsp--;
+ if (failed) return ;
+
+ }
+ }
+ // $ANTLR end synpred6
+
+ // $ANTLR start synpred7
+ public final void synpred7_fragment() throws RecognitionException {
+ // DSLMap.g:104:5: ( keyword_key )
+ // DSLMap.g:104:5: keyword_key
+ {
+ pushFollow(FOLLOW_keyword_key_in_synpred7402);
+ keyword_key();
+ _fsp--;
+ if (failed) return ;
+
+ }
+ }
+ // $ANTLR end synpred7
+
+ // $ANTLR start synpred11
+ public final void synpred11_fragment() throws RecognitionException {
+ // DSLMap.g:133:4: ( literal )
+ // DSLMap.g:133:4: literal
+ {
+ pushFollow(FOLLOW_literal_in_synpred11542);
+ literal();
+ _fsp--;
+ if (failed) return ;
+
+ }
+ }
+ // $ANTLR end synpred11
+
+ // $ANTLR start synpred14
+ public final void synpred14_fragment() throws RecognitionException {
+ // DSLMap.g:151:5: ( literal )
+ // DSLMap.g:151:5: literal
+ {
+ pushFollow(FOLLOW_literal_in_synpred14617);
+ literal();
+ _fsp--;
+ if (failed) return ;
+
+ }
+ }
+ // $ANTLR end synpred14
+
+ // $ANTLR start synpred15
+ public final void synpred15_fragment() throws RecognitionException {
+ // DSLMap.g:151:13: ( EQUALS )
+ // DSLMap.g:151:13: EQUALS
+ {
+ match(input,EQUALS,FOLLOW_EQUALS_in_synpred15619); if (failed) return ;
+
+ }
+ }
+ // $ANTLR end synpred15
+
+ public final boolean synpred7() {
+ backtracking++;
+ int start = input.mark();
+ try {
+ synpred7_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !failed;
+ input.rewind(start);
+ backtracking--;
+ failed=false;
+ return success;
+ }
+ public final boolean synpred14() {
+ backtracking++;
+ int start = input.mark();
+ try {
+ synpred14_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !failed;
+ input.rewind(start);
+ backtracking--;
+ failed=false;
+ return success;
+ }
+ public final boolean synpred11() {
+ backtracking++;
+ int start = input.mark();
+ try {
+ synpred11_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !failed;
+ input.rewind(start);
+ backtracking--;
+ failed=false;
+ return success;
+ }
+ public final boolean synpred5() {
+ backtracking++;
+ int start = input.mark();
+ try {
+ synpred5_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !failed;
+ input.rewind(start);
+ backtracking--;
+ failed=false;
+ return success;
+ }
+ public final boolean synpred6() {
+ backtracking++;
+ int start = input.mark();
+ try {
+ synpred6_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !failed;
+ input.rewind(start);
+ backtracking--;
+ failed=false;
+ return success;
+ }
+ public final boolean synpred15() {
+ backtracking++;
+ int start = input.mark();
+ try {
+ synpred15_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !failed;
+ input.rewind(start);
+ backtracking--;
+ failed=false;
+ return success;
+ }
+
+
+
+
+ public static final BitSet FOLLOW_statement_in_mapping_file257 = new BitSet(new long[]{0x0000000000B00002L});
+ public static final BitSet FOLLOW_entry_in_statement280 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_comment_in_statement287 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_EOL_in_statement293 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LINE_COMMENT_in_comment309 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_scope_section_in_entry334 = new BitSet(new long[]{0x0000000000800000L});
+ public static final BitSet FOLLOW_meta_section_in_entry336 = new BitSet(new long[]{0x000000000E000000L});
+ public static final BitSet FOLLOW_key_section_in_entry338 = new BitSet(new long[]{0x0000000000400000L});
+ public static final BitSet FOLLOW_EQUALS_in_entry340 = new BitSet(new long[]{0x000000000E400000L});
+ public static final BitSet FOLLOW_value_section_in_entry342 = new BitSet(new long[]{0x0000000000100000L});
+ public static final BitSet FOLLOW_EOL_in_entry345 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_EOF_in_entry347 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_SQUARE_in_scope_section377 = new BitSet(new long[]{0x0000000002000000L});
+ public static final BitSet FOLLOW_condition_key_in_scope_section385 = new BitSet(new long[]{0x0000000001000000L});
+ public static final BitSet FOLLOW_consequence_key_in_scope_section394 = new BitSet(new long[]{0x0000000001000000L});
+ public static final BitSet FOLLOW_keyword_key_in_scope_section402 = new BitSet(new long[]{0x0000000001000000L});
+ public static final BitSet FOLLOW_any_key_in_scope_section410 = new BitSet(new long[]{0x0000000001000000L});
+ public static final BitSet FOLLOW_RIGHT_SQUARE_in_scope_section418 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_SQUARE_in_meta_section456 = new BitSet(new long[]{0x0000000003000000L});
+ public static final BitSet FOLLOW_LITERAL_in_meta_section458 = new BitSet(new long[]{0x0000000001000000L});
+ public static final BitSet FOLLOW_RIGHT_SQUARE_in_meta_section461 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_key_sentence_in_key_section483 = new BitSet(new long[]{0x000000000E000002L});
+ public static final BitSet FOLLOW_variable_definition_in_key_sentence514 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_key_chunk_in_key_sentence521 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_literal_in_key_chunk542 = new BitSet(new long[]{0x0000000006000002L});
+ public static final BitSet FOLLOW_value_sentence_in_value_section557 = new BitSet(new long[]{0x000000000E400002L});
+ public static final BitSet FOLLOW_variable_reference_in_value_sentence588 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_value_chunk_in_value_sentence595 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_literal_in_value_chunk617 = new BitSet(new long[]{0x0000000006400002L});
+ public static final BitSet FOLLOW_EQUALS_in_value_chunk619 = new BitSet(new long[]{0x0000000006400002L});
+ public static final BitSet FOLLOW_set_in_literal637 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_CURLY_in_variable_definition665 = new BitSet(new long[]{0x0000000002000000L});
+ public static final BitSet FOLLOW_LITERAL_in_variable_definition673 = new BitSet(new long[]{0x0000000014000000L});
+ public static final BitSet FOLLOW_COLON_in_variable_definition677 = new BitSet(new long[]{0x000000000E800000L});
+ public static final BitSet FOLLOW_pattern_in_variable_definition681 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_RIGHT_CURLY_in_variable_definition688 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_CURLY_in_variable_definition2770 = new BitSet(new long[]{0x0000000002000000L});
+ public static final BitSet FOLLOW_LITERAL_in_variable_definition2774 = new BitSet(new long[]{0x0000000014000000L});
+ public static final BitSet FOLLOW_COLON_in_variable_definition2778 = new BitSet(new long[]{0x000000000E800000L});
+ public static final BitSet FOLLOW_pattern_in_variable_definition2782 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_RIGHT_CURLY_in_variable_definition2789 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_literal_in_pattern840 = new BitSet(new long[]{0x000000000E800002L});
+ public static final BitSet FOLLOW_LEFT_CURLY_in_pattern854 = new BitSet(new long[]{0x0000000006000000L});
+ public static final BitSet FOLLOW_literal_in_pattern856 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_RIGHT_CURLY_in_pattern858 = new BitSet(new long[]{0x000000000E800002L});
+ public static final BitSet FOLLOW_LEFT_SQUARE_in_pattern872 = new BitSet(new long[]{0x000000000E800000L});
+ public static final BitSet FOLLOW_pattern_in_pattern874 = new BitSet(new long[]{0x0000000001000000L});
+ public static final BitSet FOLLOW_RIGHT_SQUARE_in_pattern876 = new BitSet(new long[]{0x000000000E800002L});
+ public static final BitSet FOLLOW_LEFT_CURLY_in_variable_reference911 = new BitSet(new long[]{0x0000000002000000L});
+ public static final BitSet FOLLOW_LITERAL_in_variable_reference919 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_RIGHT_CURLY_in_variable_reference921 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_CURLY_in_variable_reference2962 = new BitSet(new long[]{0x0000000002000000L});
+ public static final BitSet FOLLOW_LITERAL_in_variable_reference2966 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_RIGHT_CURLY_in_variable_reference2968 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LITERAL_in_condition_key997 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LITERAL_in_consequence_key1020 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LITERAL_in_keyword_key1043 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LITERAL_in_any_key1066 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_condition_key_in_synpred5385 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_consequence_key_in_synpred6394 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_keyword_key_in_synpred7402 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_literal_in_synpred11542 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_literal_in_synpred14617 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_EQUALS_in_synpred15619 = new BitSet(new long[]{0x0000000000000002L});
+
+}
\ No newline at end of file
Property changes on: labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapParser.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapWalker.java
===================================================================
--- labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapWalker.java (rev 0)
+++ labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapWalker.java 2008-05-19 20:48:40 UTC (rev 20067)
@@ -0,0 +1,1013 @@
+// $ANTLR 3.0.1 DSLMapWalker.g 2008-05-14 15:02:19
+
+ package org.drools.lang.dsl;
+
+ import java.util.Map;
+ import java.util.HashMap;
+
+
+
+import org.antlr.runtime.*;
+import org.antlr.runtime.tree.*;import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+public class DSLMapWalker extends TreeParser {
+ public static final String[] tokenNames = new String[] {
+ "<invalid>", "<EOR>", "<DOWN>", "<UP>", "VT_DSL_GRAMMAR", "VT_COMMENT", "VT_ENTRY", "VT_SCOPE", "VT_CONDITION", "VT_CONSEQUENCE", "VT_KEYWORD", "VT_ANY", "VT_META", "VT_ENTRY_KEY", "VT_ENTRY_VAL", "VT_VAR_DEF", "VT_VAR_REF", "VT_LITERAL", "VT_PATTERN", "VT_SPACE", "EOL", "LINE_COMMENT", "EQUALS", "LEFT_SQUARE", "RIGHT_SQUARE", "LITERAL", "COLON", "LEFT_CURLY", "RIGHT_CURLY", "WS", "EscapeSequence", "DOT", "POUND", "MISC"
+ };
+ public static final int RIGHT_CURLY=28;
+ public static final int VT_ENTRY_VAL=14;
+ public static final int WS=29;
+ public static final int MISC=33;
+ public static final int VT_META=12;
+ public static final int VT_CONSEQUENCE=9;
+ public static final int VT_SPACE=19;
+ public static final int LINE_COMMENT=21;
+ public static final int VT_ANY=11;
+ public static final int VT_LITERAL=17;
+ public static final int DOT=31;
+ public static final int EQUALS=22;
+ public static final int VT_DSL_GRAMMAR=4;
+ public static final int VT_CONDITION=8;
+ public static final int VT_ENTRY=6;
+ public static final int VT_VAR_DEF=15;
+ public static final int VT_PATTERN=18;
+ public static final int LITERAL=25;
+ public static final int EscapeSequence=30;
+ public static final int VT_COMMENT=5;
+ public static final int EOF=-1;
+ public static final int EOL=20;
+ public static final int LEFT_SQUARE=23;
+ public static final int VT_ENTRY_KEY=13;
+ public static final int VT_SCOPE=7;
+ public static final int COLON=26;
+ public static final int VT_KEYWORD=10;
+ public static final int VT_VAR_REF=16;
+ public static final int LEFT_CURLY=27;
+ public static final int POUND=32;
+ public static final int RIGHT_SQUARE=24;
+
+ public DSLMapWalker(TreeNodeStream input) {
+ super(input);
+ }
+
+
+ public String[] getTokenNames() { return tokenNames; }
+ public String getGrammarFileName() { return "DSLMapWalker.g"; }
+
+
+ protected static class mapping_file_scope {
+ DSLMapping retval;
+ }
+ protected Stack mapping_file_stack = new Stack();
+
+
+ // $ANTLR start mapping_file
+ // DSLMapWalker.g:17:1: mapping_file returns [DSLMapping mapping] : ^( VT_DSL_GRAMMAR ( entry )* ) ;
+ public final DSLMapping mapping_file() throws RecognitionException {
+ mapping_file_stack.push(new mapping_file_scope());
+ DSLMapping mapping = null;
+
+
+ ((mapping_file_scope)mapping_file_stack.peek()).retval = new DefaultDSLMapping() ;
+
+ try {
+ // DSLMapWalker.g:24:2: ( ^( VT_DSL_GRAMMAR ( entry )* ) )
+ // DSLMapWalker.g:24:4: ^( VT_DSL_GRAMMAR ( entry )* )
+ {
+ match(input,VT_DSL_GRAMMAR,FOLLOW_VT_DSL_GRAMMAR_in_mapping_file54);
+
+ if ( input.LA(1)==Token.DOWN ) {
+ match(input, Token.DOWN, null);
+ // DSLMapWalker.g:24:21: ( entry )*
+ loop1:
+ do {
+ int alt1=2;
+ int LA1_0 = input.LA(1);
+
+ if ( (LA1_0==VT_ENTRY) ) {
+ alt1=1;
+ }
+
+
+ switch (alt1) {
+ case 1 :
+ // DSLMapWalker.g:24:21: entry
+ {
+ pushFollow(FOLLOW_entry_in_mapping_file56);
+ entry();
+ _fsp--;
+
+
+ }
+ break;
+
+ default :
+ break loop1;
+ }
+ } while (true);
+
+
+ match(input, Token.UP, null);
+ }
+
+ System.out.println("done parsing file");
+ //System.out.println(((mapping_file_scope)mapping_file_stack.peek()).retval.dumpFile());
+ mapping = ((mapping_file_scope)mapping_file_stack.peek()).retval;
+ //java.io.StringWriter sw = new java.io.StringWriter();
+ //((mapping_file_scope)mapping_file_stack.peek()).retval.saveMapping(sw);
+ //System.out.println(sw.toString());
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ mapping_file_stack.pop();
+ }
+ return mapping;
+ }
+ // $ANTLR end mapping_file
+
+
+ // $ANTLR start mapping_entry
+ // DSLMapWalker.g:35:1: mapping_entry : ent= entry ;
+ public final void mapping_entry() throws RecognitionException {
+ DSLMappingEntry ent = null;
+
+
+ try {
+ // DSLMapWalker.g:36:2: (ent= entry )
+ // DSLMapWalker.g:36:4: ent= entry
+ {
+ pushFollow(FOLLOW_entry_in_mapping_entry76);
+ ent=entry();
+ _fsp--;
+
+
+ ((mapping_file_scope)mapping_file_stack.peek()).retval.addEntry(ent);
+ System.out.println("mapping size is now " + ((mapping_file_scope)mapping_file_stack.peek()).retval.getEntries().size());
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end mapping_entry
+
+
+ // $ANTLR start valid_entry
+ // DSLMapWalker.g:43:1: valid_entry returns [DSLMappingEntry mappingEntry] : (ent= entry | VT_COMMENT );
+ public final DSLMappingEntry valid_entry() throws RecognitionException {
+ DSLMappingEntry mappingEntry = null;
+
+ DSLMappingEntry ent = null;
+
+
+ try {
+ // DSLMapWalker.g:44:2: (ent= entry | VT_COMMENT )
+ int alt2=2;
+ int LA2_0 = input.LA(1);
+
+ if ( (LA2_0==VT_ENTRY) ) {
+ alt2=1;
+ }
+ else if ( (LA2_0==VT_COMMENT) ) {
+ alt2=2;
+ }
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("43:1: valid_entry returns [DSLMappingEntry mappingEntry] : (ent= entry | VT_COMMENT );", 2, 0, input);
+
+ throw nvae;
+ }
+ switch (alt2) {
+ case 1 :
+ // DSLMapWalker.g:44:4: ent= entry
+ {
+ pushFollow(FOLLOW_entry_in_valid_entry97);
+ ent=entry();
+ _fsp--;
+
+ mappingEntry = ent;
+
+ }
+ break;
+ case 2 :
+ // DSLMapWalker.g:45:4: VT_COMMENT
+ {
+ match(input,VT_COMMENT,FOLLOW_VT_COMMENT_in_valid_entry104);
+ mappingEntry = null;
+
+ }
+ break;
+
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return mappingEntry;
+ }
+ // $ANTLR end valid_entry
+
+ protected static class entry_scope {
+ Map variables;
+ DefaultDSLMappingEntry retval;
+ int counter;
+ StringBuffer keybuffer;
+ StringBuffer valuebuffer;
+ }
+ protected Stack entry_stack = new Stack();
+
+
+ // $ANTLR start entry
+ // DSLMapWalker.g:49:1: entry returns [DSLMappingEntry mappingEntry] : ^( VT_ENTRY scope_section meta_section key_section value_section ) ;
+ public final DSLMappingEntry entry() throws RecognitionException {
+ entry_stack.push(new entry_scope());
+ DSLMappingEntry mappingEntry = null;
+
+
+ ((entry_scope)entry_stack.peek()).retval = new DefaultDSLMappingEntry() ;
+ ((entry_scope)entry_stack.peek()).variables = new HashMap();
+ ((entry_scope)entry_stack.peek()).keybuffer = new StringBuffer();
+ ((entry_scope)entry_stack.peek()).valuebuffer = new StringBuffer();
+
+ try {
+ // DSLMapWalker.g:63:2: ( ^( VT_ENTRY scope_section meta_section key_section value_section ) )
+ // DSLMapWalker.g:63:4: ^( VT_ENTRY scope_section meta_section key_section value_section )
+ {
+ match(input,VT_ENTRY,FOLLOW_VT_ENTRY_in_entry132);
+
+ match(input, Token.DOWN, null);
+ pushFollow(FOLLOW_scope_section_in_entry134);
+ scope_section();
+ _fsp--;
+
+ pushFollow(FOLLOW_meta_section_in_entry136);
+ meta_section();
+ _fsp--;
+
+ pushFollow(FOLLOW_key_section_in_entry138);
+ key_section();
+ _fsp--;
+
+ pushFollow(FOLLOW_value_section_in_entry140);
+ value_section();
+ _fsp--;
+
+
+ match(input, Token.UP, null);
+
+ System.out.println("for this entry, metadata is " + ((entry_scope)entry_stack.peek()).retval.getMetaData().getMetaData());
+ System.out.println("variables are " + ((entry_scope)entry_stack.peek()).variables);
+ System.out.println("keybuffer: " + ((entry_scope)entry_stack.peek()).keybuffer);
+ System.out.println("valuebuffer: " + ((entry_scope)entry_stack.peek()).valuebuffer);
+ // ((mapping_file_scope)mapping_file_stack.peek()).retval.addEntry(((entry_scope)entry_stack.peek()).retval);
+ // System.out.println("mapping size is now " + ((mapping_file_scope)mapping_file_stack.peek()).retval.getEntries().size());
+ mappingEntry = ((entry_scope)entry_stack.peek()).retval;
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ entry_stack.pop();
+ }
+ return mappingEntry;
+ }
+ // $ANTLR end entry
+
+
+ // $ANTLR start scope_section
+ // DSLMapWalker.g:76:1: scope_section : ^(thescope= VT_SCOPE ( condition_key )? ( consequence_key )? ( keyword_key )? ( any_key )? ) ;
+ public final void scope_section() throws RecognitionException {
+ CommonTree thescope=null;
+
+ try {
+ // DSLMapWalker.g:77:2: ( ^(thescope= VT_SCOPE ( condition_key )? ( consequence_key )? ( keyword_key )? ( any_key )? ) )
+ // DSLMapWalker.g:77:4: ^(thescope= VT_SCOPE ( condition_key )? ( consequence_key )? ( keyword_key )? ( any_key )? )
+ {
+ thescope=(CommonTree)input.LT(1);
+ match(input,VT_SCOPE,FOLLOW_VT_SCOPE_in_scope_section160);
+
+ if ( input.LA(1)==Token.DOWN ) {
+ match(input, Token.DOWN, null);
+ // DSLMapWalker.g:77:24: ( condition_key )?
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+
+ if ( (LA3_0==VT_CONDITION) ) {
+ alt3=1;
+ }
+ switch (alt3) {
+ case 1 :
+ // DSLMapWalker.g:77:24: condition_key
+ {
+ pushFollow(FOLLOW_condition_key_in_scope_section162);
+ condition_key();
+ _fsp--;
+
+
+ }
+ break;
+
+ }
+
+ // DSLMapWalker.g:77:39: ( consequence_key )?
+ int alt4=2;
+ int LA4_0 = input.LA(1);
+
+ if ( (LA4_0==VT_CONSEQUENCE) ) {
+ alt4=1;
+ }
+ switch (alt4) {
+ case 1 :
+ // DSLMapWalker.g:77:39: consequence_key
+ {
+ pushFollow(FOLLOW_consequence_key_in_scope_section165);
+ consequence_key();
+ _fsp--;
+
+
+ }
+ break;
+
+ }
+
+ // DSLMapWalker.g:77:56: ( keyword_key )?
+ int alt5=2;
+ int LA5_0 = input.LA(1);
+
+ if ( (LA5_0==VT_KEYWORD) ) {
+ alt5=1;
+ }
+ switch (alt5) {
+ case 1 :
+ // DSLMapWalker.g:77:56: keyword_key
+ {
+ pushFollow(FOLLOW_keyword_key_in_scope_section168);
+ keyword_key();
+ _fsp--;
+
+
+ }
+ break;
+
+ }
+
+ // DSLMapWalker.g:77:69: ( any_key )?
+ int alt6=2;
+ int LA6_0 = input.LA(1);
+
+ if ( (LA6_0==VT_ANY) ) {
+ alt6=1;
+ }
+ switch (alt6) {
+ case 1 :
+ // DSLMapWalker.g:77:69: any_key
+ {
+ pushFollow(FOLLOW_any_key_in_scope_section171);
+ any_key();
+ _fsp--;
+
+
+ }
+ break;
+
+ }
+
+
+ match(input, Token.UP, null);
+ }
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end scope_section
+
+
+ // $ANTLR start meta_section
+ // DSLMapWalker.g:82:1: meta_section : ^( VT_META (metalit= LITERAL )? ) ;
+ public final void meta_section() throws RecognitionException {
+ CommonTree metalit=null;
+
+ try {
+ // DSLMapWalker.g:83:2: ( ^( VT_META (metalit= LITERAL )? ) )
+ // DSLMapWalker.g:83:4: ^( VT_META (metalit= LITERAL )? )
+ {
+ match(input,VT_META,FOLLOW_VT_META_in_meta_section188);
+
+ if ( input.LA(1)==Token.DOWN ) {
+ match(input, Token.DOWN, null);
+ // DSLMapWalker.g:83:21: (metalit= LITERAL )?
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+
+ if ( (LA7_0==LITERAL) ) {
+ alt7=1;
+ }
+ switch (alt7) {
+ case 1 :
+ // DSLMapWalker.g:83:21: metalit= LITERAL
+ {
+ metalit=(CommonTree)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_meta_section192);
+
+ }
+ break;
+
+ }
+
+
+ match(input, Token.UP, null);
+ }
+
+ if ( metalit == null || metalit.getText() == null || metalit.getText().length() == 0 ) {
+ ((entry_scope)entry_stack.peek()).retval.setMetaData(DSLMappingEntry.EMPTY_METADATA);
+ } else {
+ ((entry_scope)entry_stack.peek()).retval.setMetaData(new DSLMappingEntry.DefaultDSLEntryMetaData( metalit.getText() ));
+ }
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end meta_section
+
+
+ // $ANTLR start key_section
+ // DSLMapWalker.g:93:1: key_section : ^( VT_ENTRY_KEY ( key_sentence )+ ) ;
+ public final void key_section() throws RecognitionException {
+ try {
+ // DSLMapWalker.g:94:2: ( ^( VT_ENTRY_KEY ( key_sentence )+ ) )
+ // DSLMapWalker.g:94:4: ^( VT_ENTRY_KEY ( key_sentence )+ )
+ {
+ match(input,VT_ENTRY_KEY,FOLLOW_VT_ENTRY_KEY_in_key_section209);
+
+ match(input, Token.DOWN, null);
+ // DSLMapWalker.g:94:19: ( key_sentence )+
+ int cnt8=0;
+ loop8:
+ do {
+ int alt8=2;
+ int LA8_0 = input.LA(1);
+
+ if ( (LA8_0==VT_VAR_DEF||LA8_0==VT_LITERAL||LA8_0==VT_SPACE) ) {
+ alt8=1;
+ }
+
+
+ switch (alt8) {
+ case 1 :
+ // DSLMapWalker.g:94:19: key_sentence
+ {
+ pushFollow(FOLLOW_key_sentence_in_key_section211);
+ key_sentence();
+ _fsp--;
+
+
+ }
+ break;
+
+ default :
+ if ( cnt8 >= 1 ) break loop8;
+ EarlyExitException eee =
+ new EarlyExitException(8, input);
+ throw eee;
+ }
+ cnt8++;
+ } while (true);
+
+
+ match(input, Token.UP, null);
+
+ ((entry_scope)entry_stack.peek()).retval.setMappingKey(((entry_scope)entry_stack.peek()).keybuffer.toString());
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end key_section
+
+
+ // $ANTLR start key_sentence
+ // DSLMapWalker.g:100:1: key_sentence : ( variable_definition | vtl= VT_LITERAL | VT_SPACE );
+ public final void key_sentence() throws RecognitionException {
+ CommonTree vtl=null;
+
+ try {
+ // DSLMapWalker.g:101:2: ( variable_definition | vtl= VT_LITERAL | VT_SPACE )
+ int alt9=3;
+ switch ( input.LA(1) ) {
+ case VT_VAR_DEF:
+ {
+ alt9=1;
+ }
+ break;
+ case VT_LITERAL:
+ {
+ alt9=2;
+ }
+ break;
+ case VT_SPACE:
+ {
+ alt9=3;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("100:1: key_sentence : ( variable_definition | vtl= VT_LITERAL | VT_SPACE );", 9, 0, input);
+
+ throw nvae;
+ }
+
+ switch (alt9) {
+ case 1 :
+ // DSLMapWalker.g:101:4: variable_definition
+ {
+ pushFollow(FOLLOW_variable_definition_in_key_sentence229);
+ variable_definition();
+ _fsp--;
+
+
+ }
+ break;
+ case 2 :
+ // DSLMapWalker.g:102:4: vtl= VT_LITERAL
+ {
+ vtl=(CommonTree)input.LT(1);
+ match(input,VT_LITERAL,FOLLOW_VT_LITERAL_in_key_sentence236);
+
+ System.out.println("in key_sentence, literal is " + vtl.getText());
+ ((entry_scope)entry_stack.peek()).keybuffer.append(vtl.getText());
+
+
+ }
+ break;
+ case 3 :
+ // DSLMapWalker.g:107:4: VT_SPACE
+ {
+ match(input,VT_SPACE,FOLLOW_VT_SPACE_in_key_sentence245);
+
+ ((entry_scope)entry_stack.peek()).keybuffer.append("\\s+");
+
+
+ }
+ break;
+
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end key_sentence
+
+
+ // $ANTLR start value_section
+ // DSLMapWalker.g:117:1: value_section : ^( VT_ENTRY_VAL ( value_sentence )+ ) ;
+ public final void value_section() throws RecognitionException {
+ try {
+ // DSLMapWalker.g:118:2: ( ^( VT_ENTRY_VAL ( value_sentence )+ ) )
+ // DSLMapWalker.g:118:4: ^( VT_ENTRY_VAL ( value_sentence )+ )
+ {
+ match(input,VT_ENTRY_VAL,FOLLOW_VT_ENTRY_VAL_in_value_section264);
+
+ match(input, Token.DOWN, null);
+ // DSLMapWalker.g:118:19: ( value_sentence )+
+ int cnt10=0;
+ loop10:
+ do {
+ int alt10=2;
+ int LA10_0 = input.LA(1);
+
+ if ( ((LA10_0>=VT_VAR_REF && LA10_0<=VT_LITERAL)||LA10_0==VT_SPACE) ) {
+ alt10=1;
+ }
+
+
+ switch (alt10) {
+ case 1 :
+ // DSLMapWalker.g:118:19: value_sentence
+ {
+ pushFollow(FOLLOW_value_sentence_in_value_section266);
+ value_sentence();
+ _fsp--;
+
+
+ }
+ break;
+
+ default :
+ if ( cnt10 >= 1 ) break loop10;
+ EarlyExitException eee =
+ new EarlyExitException(10, input);
+ throw eee;
+ }
+ cnt10++;
+ } while (true);
+
+
+ match(input, Token.UP, null);
+
+ ((entry_scope)entry_stack.peek()).retval.setMappingValue(((entry_scope)entry_stack.peek()).valuebuffer.toString());
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end value_section
+
+
+ // $ANTLR start value_sentence
+ // DSLMapWalker.g:124:1: value_sentence : ( variable_reference | vtl= VT_LITERAL | VT_SPACE );
+ public final void value_sentence() throws RecognitionException {
+ CommonTree vtl=null;
+
+ try {
+ // DSLMapWalker.g:125:2: ( variable_reference | vtl= VT_LITERAL | VT_SPACE )
+ int alt11=3;
+ switch ( input.LA(1) ) {
+ case VT_VAR_REF:
+ {
+ alt11=1;
+ }
+ break;
+ case VT_LITERAL:
+ {
+ alt11=2;
+ }
+ break;
+ case VT_SPACE:
+ {
+ alt11=3;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("124:1: value_sentence : ( variable_reference | vtl= VT_LITERAL | VT_SPACE );", 11, 0, input);
+
+ throw nvae;
+ }
+
+ switch (alt11) {
+ case 1 :
+ // DSLMapWalker.g:125:4: variable_reference
+ {
+ pushFollow(FOLLOW_variable_reference_in_value_sentence286);
+ variable_reference();
+ _fsp--;
+
+
+ }
+ break;
+ case 2 :
+ // DSLMapWalker.g:126:4: vtl= VT_LITERAL
+ {
+ vtl=(CommonTree)input.LT(1);
+ match(input,VT_LITERAL,FOLLOW_VT_LITERAL_in_value_sentence293);
+
+ System.out.println("in value_sentence, literal is " + vtl.getText());
+ ((entry_scope)entry_stack.peek()).valuebuffer.append(vtl.getText());
+
+
+ }
+ break;
+ case 3 :
+ // DSLMapWalker.g:131:4: VT_SPACE
+ {
+ match(input,VT_SPACE,FOLLOW_VT_SPACE_in_value_sentence301);
+
+ ((entry_scope)entry_stack.peek()).valuebuffer.append("\\s+");
+
+
+ }
+ break;
+
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end value_sentence
+
+
+ // $ANTLR start literal
+ // DSLMapWalker.g:141:1: literal : theliteral= VT_LITERAL ;
+ public final void literal() throws RecognitionException {
+ CommonTree theliteral=null;
+
+ try {
+ // DSLMapWalker.g:142:2: (theliteral= VT_LITERAL )
+ // DSLMapWalker.g:142:4: theliteral= VT_LITERAL
+ {
+ theliteral=(CommonTree)input.LT(1);
+ match(input,VT_LITERAL,FOLLOW_VT_LITERAL_in_literal321);
+ System.out.println("theliteral is " + theliteral.getText());
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end literal
+
+
+ // $ANTLR start variable_definition
+ // DSLMapWalker.g:146:1: variable_definition : ^( VT_VAR_DEF varname= LITERAL (pattern= VT_PATTERN )? ) ;
+ public final void variable_definition() throws RecognitionException {
+ CommonTree varname=null;
+ CommonTree pattern=null;
+
+ try {
+ // DSLMapWalker.g:148:2: ( ^( VT_VAR_DEF varname= LITERAL (pattern= VT_PATTERN )? ) )
+ // DSLMapWalker.g:148:6: ^( VT_VAR_DEF varname= LITERAL (pattern= VT_PATTERN )? )
+ {
+ match(input,VT_VAR_DEF,FOLLOW_VT_VAR_DEF_in_variable_definition340);
+
+ match(input, Token.DOWN, null);
+ varname=(CommonTree)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_variable_definition344);
+ // DSLMapWalker.g:148:42: (pattern= VT_PATTERN )?
+ int alt12=2;
+ int LA12_0 = input.LA(1);
+
+ if ( (LA12_0==VT_PATTERN) ) {
+ alt12=1;
+ }
+ switch (alt12) {
+ case 1 :
+ // DSLMapWalker.g:148:42: pattern= VT_PATTERN
+ {
+ pattern=(CommonTree)input.LT(1);
+ match(input,VT_PATTERN,FOLLOW_VT_PATTERN_in_variable_definition348);
+
+ }
+ break;
+
+ }
+
+
+ match(input, Token.UP, null);
+
+ System.out.println("variable " + varname.getText() + " defined with pattern " + pattern);
+ ((entry_scope)entry_stack.peek()).counter++;
+ ((entry_scope)entry_stack.peek()).variables.put(varname.getText(), new Integer(((entry_scope)entry_stack.peek()).counter));
+ ((entry_scope)entry_stack.peek()).keybuffer.append(pattern != null? "(" + pattern.getText() + ")" : "(.*?)");
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end variable_definition
+
+
+ // $ANTLR start variable_reference
+ // DSLMapWalker.g:158:1: variable_reference : ^(varref= VT_VAR_REF lit= LITERAL ) ;
+ public final void variable_reference() throws RecognitionException {
+ CommonTree varref=null;
+ CommonTree lit=null;
+
+ try {
+ // DSLMapWalker.g:159:2: ( ^(varref= VT_VAR_REF lit= LITERAL ) )
+ // DSLMapWalker.g:159:4: ^(varref= VT_VAR_REF lit= LITERAL )
+ {
+ varref=(CommonTree)input.LT(1);
+ match(input,VT_VAR_REF,FOLLOW_VT_VAR_REF_in_variable_reference370);
+
+ match(input, Token.DOWN, null);
+ lit=(CommonTree)input.LT(1);
+ match(input,LITERAL,FOLLOW_LITERAL_in_variable_reference374);
+
+ match(input, Token.UP, null);
+
+ System.out.println("varref is " + varref.getText() + " and points to " + lit.getText());
+ ((entry_scope)entry_stack.peek()).valuebuffer.append("\\$" + ((entry_scope)entry_stack.peek()).variables.get(lit.getText()));
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end variable_reference
+
+
+ // $ANTLR start condition_key
+ // DSLMapWalker.g:166:1: condition_key : VT_CONDITION ;
+ public final void condition_key() throws RecognitionException {
+ try {
+ // DSLMapWalker.g:167:2: ( VT_CONDITION )
+ // DSLMapWalker.g:167:4: VT_CONDITION
+ {
+ match(input,VT_CONDITION,FOLLOW_VT_CONDITION_in_condition_key392);
+ ((entry_scope)entry_stack.peek()).retval.setSection(DSLMappingEntry.CONDITION);
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end condition_key
+
+
+ // $ANTLR start consequence_key
+ // DSLMapWalker.g:171:1: consequence_key : VT_CONSEQUENCE ;
+ public final void consequence_key() throws RecognitionException {
+ try {
+ // DSLMapWalker.g:172:2: ( VT_CONSEQUENCE )
+ // DSLMapWalker.g:172:4: VT_CONSEQUENCE
+ {
+ match(input,VT_CONSEQUENCE,FOLLOW_VT_CONSEQUENCE_in_consequence_key407);
+ ((entry_scope)entry_stack.peek()).retval.setSection(DSLMappingEntry.CONSEQUENCE);
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end consequence_key
+
+
+ // $ANTLR start keyword_key
+ // DSLMapWalker.g:176:1: keyword_key : VT_KEYWORD ;
+ public final void keyword_key() throws RecognitionException {
+ try {
+ // DSLMapWalker.g:177:2: ( VT_KEYWORD )
+ // DSLMapWalker.g:177:4: VT_KEYWORD
+ {
+ match(input,VT_KEYWORD,FOLLOW_VT_KEYWORD_in_keyword_key422);
+ ((entry_scope)entry_stack.peek()).retval.setSection(DSLMappingEntry.KEYWORD);
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end keyword_key
+
+
+ // $ANTLR start any_key
+ // DSLMapWalker.g:181:1: any_key : VT_ANY ;
+ public final void any_key() throws RecognitionException {
+ try {
+ // DSLMapWalker.g:182:2: ( VT_ANY )
+ // DSLMapWalker.g:182:4: VT_ANY
+ {
+ match(input,VT_ANY,FOLLOW_VT_ANY_in_any_key437);
+ ((entry_scope)entry_stack.peek()).retval.setSection(DSLMappingEntry.ANY);
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end any_key
+
+
+
+
+ public static final BitSet FOLLOW_VT_DSL_GRAMMAR_in_mapping_file54 = new BitSet(new long[]{0x0000000000000004L});
+ public static final BitSet FOLLOW_entry_in_mapping_file56 = new BitSet(new long[]{0x0000000000000048L});
+ public static final BitSet FOLLOW_entry_in_mapping_entry76 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_entry_in_valid_entry97 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_COMMENT_in_valid_entry104 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_ENTRY_in_entry132 = new BitSet(new long[]{0x0000000000000004L});
+ public static final BitSet FOLLOW_scope_section_in_entry134 = new BitSet(new long[]{0x0000000000001000L});
+ public static final BitSet FOLLOW_meta_section_in_entry136 = new BitSet(new long[]{0x0000000000002000L});
+ public static final BitSet FOLLOW_key_section_in_entry138 = new BitSet(new long[]{0x0000000000004000L});
+ public static final BitSet FOLLOW_value_section_in_entry140 = new BitSet(new long[]{0x0000000000000008L});
+ public static final BitSet FOLLOW_VT_SCOPE_in_scope_section160 = new BitSet(new long[]{0x0000000000000004L});
+ public static final BitSet FOLLOW_condition_key_in_scope_section162 = new BitSet(new long[]{0x0000000000000E08L});
+ public static final BitSet FOLLOW_consequence_key_in_scope_section165 = new BitSet(new long[]{0x0000000000000C08L});
+ public static final BitSet FOLLOW_keyword_key_in_scope_section168 = new BitSet(new long[]{0x0000000000000808L});
+ public static final BitSet FOLLOW_any_key_in_scope_section171 = new BitSet(new long[]{0x0000000000000008L});
+ public static final BitSet FOLLOW_VT_META_in_meta_section188 = new BitSet(new long[]{0x0000000000000004L});
+ public static final BitSet FOLLOW_LITERAL_in_meta_section192 = new BitSet(new long[]{0x0000000000000008L});
+ public static final BitSet FOLLOW_VT_ENTRY_KEY_in_key_section209 = new BitSet(new long[]{0x0000000000000004L});
+ public static final BitSet FOLLOW_key_sentence_in_key_section211 = new BitSet(new long[]{0x00000000000A8008L});
+ public static final BitSet FOLLOW_variable_definition_in_key_sentence229 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_LITERAL_in_key_sentence236 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_SPACE_in_key_sentence245 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_ENTRY_VAL_in_value_section264 = new BitSet(new long[]{0x0000000000000004L});
+ public static final BitSet FOLLOW_value_sentence_in_value_section266 = new BitSet(new long[]{0x00000000000B0008L});
+ public static final BitSet FOLLOW_variable_reference_in_value_sentence286 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_LITERAL_in_value_sentence293 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_SPACE_in_value_sentence301 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_LITERAL_in_literal321 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_VAR_DEF_in_variable_definition340 = new BitSet(new long[]{0x0000000000000004L});
+ public static final BitSet FOLLOW_LITERAL_in_variable_definition344 = new BitSet(new long[]{0x0000000000040008L});
+ public static final BitSet FOLLOW_VT_PATTERN_in_variable_definition348 = new BitSet(new long[]{0x0000000000000008L});
+ public static final BitSet FOLLOW_VT_VAR_REF_in_variable_reference370 = new BitSet(new long[]{0x0000000000000004L});
+ public static final BitSet FOLLOW_LITERAL_in_variable_reference374 = new BitSet(new long[]{0x0000000000000008L});
+ public static final BitSet FOLLOW_VT_CONDITION_in_condition_key392 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_CONSEQUENCE_in_consequence_key407 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_KEYWORD_in_keyword_key422 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VT_ANY_in_any_key437 = new BitSet(new long[]{0x0000000000000002L});
+
+}
\ No newline at end of file
Property changes on: labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLMapWalker.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLTokenizedMappingFile.java
===================================================================
--- labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLTokenizedMappingFile.java (rev 0)
+++ labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLTokenizedMappingFile.java 2008-05-19 20:48:40 UTC (rev 20067)
@@ -0,0 +1,61 @@
+package org.drools.lang.dsl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.LinkedList;
+import org.antlr.runtime.ANTLRReaderStream;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.RecognitionException;
+import org.antlr.runtime.tree.CommonTree;
+import org.antlr.runtime.tree.CommonTreeNodeStream;
+
+public class DSLTokenizedMappingFile extends DSLMappingFile {
+ public boolean parseAndLoad(final Reader dsl) throws IOException {
+ String line = null;
+ int linecounter = 0;
+ final BufferedReader dslFileReader = new BufferedReader( dsl );
+ this.mapping = new DefaultDSLMapping();
+ this.errors = new LinkedList();
+ //Note: Use a string builder for 1.5 targets
+ StringBuffer sb = new StringBuffer();
+ while ( (line = dslFileReader.readLine()) != null ) {
+ linecounter++;
+ String trimmedline = line.trim() + "\n"; //this can be more efficient, get rid of trim(), iterate-- over last chars only.
+ try{
+ final DSLMappingEntry entry = buildEntry(trimmedline);
+ if(entry != null) this.mapping.addEntry(entry);//will be null if a comment
+ }catch(Exception re){
+ final String error = "Error parsing mapping entry: " + line;
+ final DSLMappingParseException exception =
+ new DSLMappingParseException( error, linecounter );
+ this.errors.add( exception );
+ }
+ }
+ return this.errors.isEmpty();
+ }
+
+ private DSLMappingEntry buildEntry(String line) throws IOException, RecognitionException{
+ StringReader sr = new StringReader(line);
+ ANTLRReaderStream reader = new ANTLRReaderStream(sr);
+ DSLMapWalker walker = buildEntryWalker(reader);
+ DSLMappingEntry entry = walker.valid_entry();
+ return entry;
+ }
+
+ private DSLMapWalker buildEntryWalker(CharStream stream) throws RecognitionException{
+ DSLMapLexer lexer = new DSLMapLexer(stream);
+ CommonTokenStream tokens = new CommonTokenStream();
+ tokens.setTokenSource(lexer);
+ DSLMapParser parser = new DSLMapParser(tokens);
+ DSLMapParser.statement_return example = parser.statement();
+ CommonTree tree = (CommonTree) example.getTree();
+ System.out.println(tree.toStringTree());
+
+ CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree);
+ DSLMapWalker walker = new DSLMapWalker(nodes);
+ return walker;
+ }
+}
Property changes on: labs/jbossrules/branches/mattgeis/drools-compiler/src/main/java/org/drools/lang/dsl/DSLTokenizedMappingFile.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jboss-svn-commits
mailing list