[jboss-svn-commits] JBL Code SVN: r18199 - in labs/jbossrules/trunk/drools-clips/src: main/resources/org/drools/cips and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jan 29 16:27:35 EST 2008
Author: mark.proctor at jboss.com
Date: 2008-01-29 16:27:34 -0500 (Tue, 29 Jan 2008)
New Revision: 18199
Added:
labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsLexer.java
labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsParser.java
labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Shell.java
labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/Clips.g
Removed:
labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CLPMVELLexer.java
labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CLPMVELParser.java
labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/CLPMVEL.g
Modified:
labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/mvel/TestMVEL.java
Log:
JBRULES-720 Clips Parser
-renamed from clp to clips
Deleted: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CLPMVELLexer.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CLPMVELLexer.java 2008-01-29 21:02:48 UTC (rev 18198)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CLPMVELLexer.java 2008-01-29 21:27:34 UTC (rev 18199)
@@ -1,2130 +0,0 @@
-// $ANTLR 3.0.1 C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g 2008-01-29 07:31:27
-
- package org.drools.clips;
-
-
-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 CLPMVELLexer extends Lexer {
- public static final int RIGHT_SQUARE=38;
- public static final int RIGHT_CURLY=40;
- public static final int EQUALS=23;
- public static final int FLOAT=24;
- public static final int SH_STYLE_SINGLE_LINE_COMMENT=35;
- public static final int SYMBOL_CHAR=34;
- public static final int NOT=14;
- public static final int AND=12;
- public static final int FIRST_SYMBOL_CHAR=43;
- public static final int EOF=-1;
- public static final int HexDigit=31;
- public static final int DEFFUNCTION=7;
- public static final int ASSIGN_OP=18;
- public static final int RIGHT_PAREN=6;
- public static final int NAME=5;
- public static final int EOL=27;
- public static final int DEFRULE=8;
- public static final int TILDE=21;
- public static final int PIPE=19;
- public static final int VAR=17;
- public static final int EXISTS=15;
- public static final int SYMBOL=42;
- public static final int NULL=26;
- public static final int BOOL=25;
- public static final int SALIENCE=10;
- public static final int AMPERSAND=20;
- public static final int INT=11;
- public static final int Tokens=46;
- public static final int MULTI_LINE_COMMENT=41;
- public static final int T45=45;
- public static final int T44=44;
- public static final int COLON=22;
- public static final int WS=28;
- public static final int UnicodeEscape=32;
- public static final int LEFT_CURLY=39;
- public static final int OR=13;
- public static final int TEST=16;
- public static final int LEFT_PAREN=4;
- public static final int DECLARE=29;
- public static final int LEFT_SQUARE=37;
- public static final int EscapeSequence=30;
- public static final int OctalEscape=33;
- public static final int C_STYLE_SINGLE_LINE_COMMENT=36;
- public static final int STRING=9;
- public CLPMVELLexer() {;}
- public CLPMVELLexer(CharStream input) {
- super(input);
- ruleMemo = new HashMap[44+1];
- }
- public String getGrammarFileName() { return "C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g"; }
-
- // $ANTLR start T44
- public final void mT44() throws RecognitionException {
- try {
- int _type = T44;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:6:5: ( 'import' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:6:7: 'import'
- {
- match("import"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end T44
-
- // $ANTLR start T45
- public final void mT45() throws RecognitionException {
- try {
- int _type = T45;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:7:5: ( '=>' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:7:7: '=>'
- {
- match("=>"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end T45
-
- // $ANTLR start WS
- public final void mWS() throws RecognitionException {
- try {
- int _type = WS;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:699:9: ( ( ' ' | '\\t' | '\\f' | EOL ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:699:17: ( ' ' | '\\t' | '\\f' | EOL )
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:699:17: ( ' ' | '\\t' | '\\f' | EOL )
- int alt1=4;
- switch ( input.LA(1) ) {
- case ' ':
- {
- alt1=1;
- }
- break;
- case '\t':
- {
- alt1=2;
- }
- break;
- case '\f':
- {
- alt1=3;
- }
- break;
- case '\n':
- case '\r':
- {
- alt1=4;
- }
- break;
- default:
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("699:17: ( ' ' | '\\t' | '\\f' | EOL )", 1, 0, input);
-
- throw nvae;
- }
-
- switch (alt1) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:699:19: ' '
- {
- match(' '); if (failed) return ;
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:700:19: '\\t'
- {
- match('\t'); if (failed) return ;
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:701:19: '\\f'
- {
- match('\f'); if (failed) return ;
-
- }
- break;
- case 4 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:702:19: EOL
- {
- mEOL(); if (failed) return ;
-
- }
- break;
-
- }
-
- if ( backtracking==0 ) {
- channel=HIDDEN;
- }
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end WS
-
- // $ANTLR start DEFRULE
- public final void mDEFRULE() throws RecognitionException {
- try {
- int _type = DEFRULE;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:707:10: ( 'defrule' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:707:12: 'defrule'
- {
- match("defrule"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end DEFRULE
-
- // $ANTLR start DEFFUNCTION
- public final void mDEFFUNCTION() throws RecognitionException {
- try {
- int _type = DEFFUNCTION;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:708:13: ( 'deffunction' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:708:15: 'deffunction'
- {
- match("deffunction"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end DEFFUNCTION
-
- // $ANTLR start OR
- public final void mOR() throws RecognitionException {
- try {
- int _type = OR;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:709:7: ( 'or' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:709:9: 'or'
- {
- match("or"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end OR
-
- // $ANTLR start AND
- public final void mAND() throws RecognitionException {
- try {
- int _type = AND;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:710:7: ( 'and' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:710:9: 'and'
- {
- match("and"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end AND
-
- // $ANTLR start NOT
- public final void mNOT() throws RecognitionException {
- try {
- int _type = NOT;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:711:7: ( 'not' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:711:9: 'not'
- {
- match("not"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end NOT
-
- // $ANTLR start EXISTS
- public final void mEXISTS() throws RecognitionException {
- try {
- int _type = EXISTS;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:712:10: ( 'exists' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:712:12: 'exists'
- {
- match("exists"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end EXISTS
-
- // $ANTLR start TEST
- public final void mTEST() throws RecognitionException {
- try {
- int _type = TEST;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:713:8: ( 'test' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:713:10: 'test'
- {
- match("test"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end TEST
-
- // $ANTLR start NULL
- public final void mNULL() throws RecognitionException {
- try {
- int _type = NULL;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:715:7: ( 'null' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:715:9: 'null'
- {
- match("null"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end NULL
-
- // $ANTLR start DECLARE
- public final void mDECLARE() throws RecognitionException {
- try {
- int _type = DECLARE;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:717:10: ( 'declare' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:717:12: 'declare'
- {
- match("declare"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end DECLARE
-
- // $ANTLR start SALIENCE
- public final void mSALIENCE() throws RecognitionException {
- try {
- int _type = SALIENCE;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:719:10: ( 'salience' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:719:12: 'salience'
- {
- match("salience"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end SALIENCE
-
- // $ANTLR start EOL
- public final void mEOL() throws RecognitionException {
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:724:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:725:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:725: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("725:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 2, 0, input);
-
- throw nvae;
- }
- switch (alt2) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:725:14: ( '\\r\\n' )=> '\\r\\n'
- {
- match("\r\n"); if (failed) return ;
-
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:726:25: '\\r'
- {
- match('\r'); if (failed) return ;
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:727:25: '\\n'
- {
- match('\n'); if (failed) return ;
-
- }
- break;
-
- }
-
-
- }
-
- }
- finally {
- }
- }
- // $ANTLR end EOL
-
- // $ANTLR start INT
- public final void mINT() throws RecognitionException {
- try {
- int _type = INT;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:732:2: ( ( '-' )? ( '0' .. '9' )+ )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:732:4: ( '-' )? ( '0' .. '9' )+
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:732:4: ( '-' )?
- int alt3=2;
- int LA3_0 = input.LA(1);
-
- if ( (LA3_0=='-') ) {
- alt3=1;
- }
- switch (alt3) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:732:5: '-'
- {
- match('-'); if (failed) return ;
-
- }
- break;
-
- }
-
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:732:10: ( '0' .. '9' )+
- int cnt4=0;
- loop4:
- do {
- int alt4=2;
- int LA4_0 = input.LA(1);
-
- if ( ((LA4_0>='0' && LA4_0<='9')) ) {
- alt4=1;
- }
-
-
- switch (alt4) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:732:11: '0' .. '9'
- {
- matchRange('0','9'); 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 INT
-
- // $ANTLR start FLOAT
- public final void mFLOAT() throws RecognitionException {
- try {
- int _type = FLOAT;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:736:2: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:736:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:736:4: ( '-' )?
- int alt5=2;
- int LA5_0 = input.LA(1);
-
- if ( (LA5_0=='-') ) {
- alt5=1;
- }
- switch (alt5) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:736:5: '-'
- {
- match('-'); if (failed) return ;
-
- }
- break;
-
- }
-
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:736:10: ( '0' .. '9' )+
- int cnt6=0;
- loop6:
- do {
- int alt6=2;
- int LA6_0 = input.LA(1);
-
- if ( ((LA6_0>='0' && LA6_0<='9')) ) {
- alt6=1;
- }
-
-
- switch (alt6) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:736:11: '0' .. '9'
- {
- matchRange('0','9'); if (failed) return ;
-
- }
- break;
-
- default :
- if ( cnt6 >= 1 ) break loop6;
- if (backtracking>0) {failed=true; return ;}
- EarlyExitException eee =
- new EarlyExitException(6, input);
- throw eee;
- }
- cnt6++;
- } while (true);
-
- match('.'); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:736:26: ( '0' .. '9' )+
- int cnt7=0;
- loop7:
- do {
- int alt7=2;
- int LA7_0 = input.LA(1);
-
- if ( ((LA7_0>='0' && LA7_0<='9')) ) {
- alt7=1;
- }
-
-
- switch (alt7) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:736:27: '0' .. '9'
- {
- matchRange('0','9'); if (failed) return ;
-
- }
- break;
-
- default :
- if ( cnt7 >= 1 ) break loop7;
- if (backtracking>0) {failed=true; return ;}
- EarlyExitException eee =
- new EarlyExitException(7, input);
- throw eee;
- }
- cnt7++;
- } while (true);
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end FLOAT
-
- // $ANTLR start STRING
- public final void mSTRING() throws RecognitionException {
- try {
- int _type = STRING;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:740:5: ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) )
- int alt10=2;
- int LA10_0 = input.LA(1);
-
- if ( (LA10_0=='\"') ) {
- alt10=1;
- }
- else if ( (LA10_0=='\'') ) {
- alt10=2;
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("739:1: STRING : ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) );", 10, 0, input);
-
- throw nvae;
- }
- switch (alt10) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:740:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:740:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:740:9: '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
- {
- match('\"'); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:740:13: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
- loop8:
- do {
- int alt8=3;
- int LA8_0 = input.LA(1);
-
- if ( (LA8_0=='\\') ) {
- alt8=1;
- }
- else if ( ((LA8_0>='\u0000' && LA8_0<='!')||(LA8_0>='#' && LA8_0<='[')||(LA8_0>=']' && LA8_0<='\uFFFE')) ) {
- alt8=2;
- }
-
-
- switch (alt8) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:740:15: EscapeSequence
- {
- mEscapeSequence(); if (failed) return ;
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:740:32: ~ ( '\\\\' | '\"' )
- {
- if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
- input.consume();
- failed=false;
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- MismatchedSetException mse =
- new MismatchedSetException(null,input);
- recover(mse); throw mse;
- }
-
-
- }
- break;
-
- default :
- break loop8;
- }
- } while (true);
-
- match('\"'); if (failed) return ;
-
- }
-
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:741:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:741:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:741:9: '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\''
- {
- match('\''); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:741:14: ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )*
- loop9:
- do {
- int alt9=3;
- int LA9_0 = input.LA(1);
-
- if ( (LA9_0=='\\') ) {
- alt9=1;
- }
- else if ( ((LA9_0>='\u0000' && LA9_0<='&')||(LA9_0>='(' && LA9_0<='[')||(LA9_0>=']' && LA9_0<='\uFFFE')) ) {
- alt9=2;
- }
-
-
- switch (alt9) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:741:16: EscapeSequence
- {
- mEscapeSequence(); if (failed) return ;
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:741:33: ~ ( '\\\\' | '\\'' )
- {
- if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
- input.consume();
- failed=false;
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- MismatchedSetException mse =
- new MismatchedSetException(null,input);
- recover(mse); throw mse;
- }
-
-
- }
- break;
-
- default :
- break loop9;
- }
- } while (true);
-
- match('\''); if (failed) return ;
-
- }
-
-
- }
- break;
-
- }
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end STRING
-
- // $ANTLR start HexDigit
- public final void mHexDigit() throws RecognitionException {
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:745:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:745:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )
- {
- if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||(input.LA(1)>='a' && input.LA(1)<='f') ) {
- input.consume();
- failed=false;
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- MismatchedSetException mse =
- new MismatchedSetException(null,input);
- recover(mse); throw mse;
- }
-
-
- }
-
- }
- finally {
- }
- }
- // $ANTLR end HexDigit
-
- // $ANTLR start EscapeSequence
- public final void mEscapeSequence() throws RecognitionException {
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:749:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape )
- int alt11=3;
- int LA11_0 = input.LA(1);
-
- if ( (LA11_0=='\\') ) {
- switch ( input.LA(2) ) {
- case '\"':
- case '\'':
- case '\\':
- case 'b':
- case 'f':
- case 'n':
- case 'r':
- case 't':
- {
- alt11=1;
- }
- break;
- case 'u':
- {
- alt11=2;
- }
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- alt11=3;
- }
- break;
- default:
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("747:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 11, 1, input);
-
- throw nvae;
- }
-
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("747:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 11, 0, input);
-
- throw nvae;
- }
- switch (alt11) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:749:9: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' )
- {
- match('\\'); if (failed) return ;
- if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) {
- input.consume();
- failed=false;
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- MismatchedSetException mse =
- new MismatchedSetException(null,input);
- recover(mse); throw mse;
- }
-
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:750:9: UnicodeEscape
- {
- mUnicodeEscape(); if (failed) return ;
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:751:9: OctalEscape
- {
- mOctalEscape(); if (failed) return ;
-
- }
- break;
-
- }
- }
- finally {
- }
- }
- // $ANTLR end EscapeSequence
-
- // $ANTLR start OctalEscape
- public final void mOctalEscape() throws RecognitionException {
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:756:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
- int alt12=3;
- int LA12_0 = input.LA(1);
-
- if ( (LA12_0=='\\') ) {
- int LA12_1 = input.LA(2);
-
- if ( ((LA12_1>='0' && LA12_1<='3')) ) {
- int LA12_2 = input.LA(3);
-
- if ( ((LA12_2>='0' && LA12_2<='7')) ) {
- int LA12_4 = input.LA(4);
-
- if ( ((LA12_4>='0' && LA12_4<='7')) ) {
- alt12=1;
- }
- else {
- alt12=2;}
- }
- else {
- alt12=3;}
- }
- else if ( ((LA12_1>='4' && LA12_1<='7')) ) {
- int LA12_3 = input.LA(3);
-
- if ( ((LA12_3>='0' && LA12_3<='7')) ) {
- alt12=2;
- }
- else {
- alt12=3;}
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("754:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 1, input);
-
- throw nvae;
- }
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("754:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 0, input);
-
- throw nvae;
- }
- switch (alt12) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:756:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
- {
- match('\\'); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:756:14: ( '0' .. '3' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:756:15: '0' .. '3'
- {
- matchRange('0','3'); if (failed) return ;
-
- }
-
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:756:25: ( '0' .. '7' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:756:26: '0' .. '7'
- {
- matchRange('0','7'); if (failed) return ;
-
- }
-
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:756:36: ( '0' .. '7' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:756:37: '0' .. '7'
- {
- matchRange('0','7'); if (failed) return ;
-
- }
-
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:757:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
- {
- match('\\'); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:757:14: ( '0' .. '7' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:757:15: '0' .. '7'
- {
- matchRange('0','7'); if (failed) return ;
-
- }
-
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:757:25: ( '0' .. '7' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:757:26: '0' .. '7'
- {
- matchRange('0','7'); if (failed) return ;
-
- }
-
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:758:9: '\\\\' ( '0' .. '7' )
- {
- match('\\'); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:758:14: ( '0' .. '7' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:758:15: '0' .. '7'
- {
- matchRange('0','7'); if (failed) return ;
-
- }
-
-
- }
- break;
-
- }
- }
- finally {
- }
- }
- // $ANTLR end OctalEscape
-
- // $ANTLR start UnicodeEscape
- public final void mUnicodeEscape() throws RecognitionException {
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:763:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:763:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
- {
- match('\\'); if (failed) return ;
- match('u'); if (failed) return ;
- mHexDigit(); if (failed) return ;
- mHexDigit(); if (failed) return ;
- mHexDigit(); if (failed) return ;
- mHexDigit(); if (failed) return ;
-
- }
-
- }
- finally {
- }
- }
- // $ANTLR end UnicodeEscape
-
- // $ANTLR start BOOL
- public final void mBOOL() throws RecognitionException {
- try {
- int _type = BOOL;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:767:2: ( ( 'true' | 'false' ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:767:4: ( 'true' | 'false' )
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:767:4: ( 'true' | 'false' )
- int alt13=2;
- int LA13_0 = input.LA(1);
-
- if ( (LA13_0=='t') ) {
- alt13=1;
- }
- else if ( (LA13_0=='f') ) {
- alt13=2;
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("767:4: ( 'true' | 'false' )", 13, 0, input);
-
- throw nvae;
- }
- switch (alt13) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:767:5: 'true'
- {
- match("true"); if (failed) return ;
-
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:767:12: 'false'
- {
- match("false"); if (failed) return ;
-
-
- }
- break;
-
- }
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end BOOL
-
- // $ANTLR start VAR
- public final void mVAR() throws RecognitionException {
- try {
- int _type = VAR;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:770:6: ( '?' ( SYMBOL_CHAR )+ )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:770:8: '?' ( SYMBOL_CHAR )+
- {
- match('?'); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:770:12: ( SYMBOL_CHAR )+
- int cnt14=0;
- loop14:
- do {
- int alt14=2;
- int LA14_0 = input.LA(1);
-
- if ( (LA14_0=='!'||(LA14_0>='#' && LA14_0<='%')||(LA14_0>='*' && LA14_0<=':')||(LA14_0>='=' && LA14_0<='_')||(LA14_0>='a' && LA14_0<='{')||LA14_0=='}') ) {
- alt14=1;
- }
-
-
- switch (alt14) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:770:12: SYMBOL_CHAR
- {
- mSYMBOL_CHAR(); if (failed) return ;
-
- }
- break;
-
- default :
- if ( cnt14 >= 1 ) break loop14;
- if (backtracking>0) {failed=true; return ;}
- EarlyExitException eee =
- new EarlyExitException(14, input);
- throw eee;
- }
- cnt14++;
- } while (true);
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end VAR
-
- // $ANTLR start SH_STYLE_SINGLE_LINE_COMMENT
- public final void mSH_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
- try {
- int _type = SH_STYLE_SINGLE_LINE_COMMENT;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:774:2: ( '#' ( options {greedy=false; } : . )* EOL )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:774:4: '#' ( options {greedy=false; } : . )* EOL
- {
- match('#'); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:774:8: ( options {greedy=false; } : . )*
- loop15:
- do {
- int alt15=2;
- int LA15_0 = input.LA(1);
-
- if ( (LA15_0=='\r') ) {
- alt15=2;
- }
- else if ( (LA15_0=='\n') ) {
- alt15=2;
- }
- else if ( ((LA15_0>='\u0000' && LA15_0<='\t')||(LA15_0>='\u000B' && LA15_0<='\f')||(LA15_0>='\u000E' && LA15_0<='\uFFFE')) ) {
- alt15=1;
- }
-
-
- switch (alt15) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:774:35: .
- {
- matchAny(); if (failed) return ;
-
- }
- break;
-
- default :
- break loop15;
- }
- } while (true);
-
- mEOL(); if (failed) return ;
- if ( backtracking==0 ) {
- channel=HIDDEN;
- }
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end SH_STYLE_SINGLE_LINE_COMMENT
-
- // $ANTLR start C_STYLE_SINGLE_LINE_COMMENT
- public final void mC_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
- try {
- int _type = C_STYLE_SINGLE_LINE_COMMENT;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:780:2: ( '//' ( options {greedy=false; } : . )* EOL )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:780:4: '//' ( options {greedy=false; } : . )* EOL
- {
- match("//"); if (failed) return ;
-
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:780:9: ( options {greedy=false; } : . )*
- loop16:
- do {
- int alt16=2;
- int LA16_0 = input.LA(1);
-
- if ( (LA16_0=='\r') ) {
- alt16=2;
- }
- else if ( (LA16_0=='\n') ) {
- alt16=2;
- }
- else if ( ((LA16_0>='\u0000' && LA16_0<='\t')||(LA16_0>='\u000B' && LA16_0<='\f')||(LA16_0>='\u000E' && LA16_0<='\uFFFE')) ) {
- alt16=1;
- }
-
-
- switch (alt16) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:780:36: .
- {
- matchAny(); if (failed) return ;
-
- }
- break;
-
- default :
- break loop16;
- }
- } while (true);
-
- mEOL(); if (failed) return ;
- if ( backtracking==0 ) {
- channel=HIDDEN;
- }
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end C_STYLE_SINGLE_LINE_COMMENT
-
- // $ANTLR start LEFT_PAREN
- public final void mLEFT_PAREN() throws RecognitionException {
- try {
- int _type = LEFT_PAREN;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:786:2: ( '(' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:786:4: '('
- {
- match('('); if (failed) return ;
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end LEFT_PAREN
-
- // $ANTLR start RIGHT_PAREN
- public final void mRIGHT_PAREN() throws RecognitionException {
- try {
- int _type = RIGHT_PAREN;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:790:2: ( ')' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:790:4: ')'
- {
- match(')'); if (failed) return ;
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end RIGHT_PAREN
-
- // $ANTLR start LEFT_SQUARE
- public final void mLEFT_SQUARE() throws RecognitionException {
- try {
- int _type = LEFT_SQUARE;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:794:2: ( '[' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:794:4: '['
- {
- 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;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:798:2: ( ']' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:798:4: ']'
- {
- 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;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:802:2: ( '{' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:802:4: '{'
- {
- 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;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:806:2: ( '}' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:806:4: '}'
- {
- match('}'); if (failed) return ;
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end RIGHT_CURLY
-
- // $ANTLR start TILDE
- public final void mTILDE() throws RecognitionException {
- try {
- int _type = TILDE;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:809:7: ( '~' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:809:9: '~'
- {
- match('~'); if (failed) return ;
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end TILDE
-
- // $ANTLR start AMPERSAND
- public final void mAMPERSAND() throws RecognitionException {
- try {
- int _type = AMPERSAND;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:813:2: ( '&' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:813:4: '&'
- {
- match('&'); if (failed) return ;
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end AMPERSAND
-
- // $ANTLR start PIPE
- public final void mPIPE() throws RecognitionException {
- try {
- int _type = PIPE;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:817:2: ( '|' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:817:4: '|'
- {
- match('|'); if (failed) return ;
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end PIPE
-
- // $ANTLR start ASSIGN_OP
- public final void mASSIGN_OP() throws RecognitionException {
- try {
- int _type = ASSIGN_OP;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:821:2: ( '<-' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:821:4: '<-'
- {
- match("<-"); if (failed) return ;
-
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end ASSIGN_OP
-
- // $ANTLR start COLON
- public final void mCOLON() throws RecognitionException {
- try {
- int _type = COLON;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:824:7: ( ':' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:824:9: ':'
- {
- match(':'); if (failed) return ;
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end COLON
-
- // $ANTLR start EQUALS
- public final void mEQUALS() throws RecognitionException {
- try {
- int _type = EQUALS;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:826:8: ( '=' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:826:10: '='
- {
- match('='); if (failed) return ;
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end EQUALS
-
- // $ANTLR start MULTI_LINE_COMMENT
- public final void mMULTI_LINE_COMMENT() throws RecognitionException {
- try {
- int _type = MULTI_LINE_COMMENT;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:829:2: ( '/*' ( options {greedy=false; } : . )* '*/' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:829:4: '/*' ( options {greedy=false; } : . )* '*/'
- {
- match("/*"); if (failed) return ;
-
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:829:9: ( options {greedy=false; } : . )*
- loop17:
- do {
- int alt17=2;
- int LA17_0 = input.LA(1);
-
- if ( (LA17_0=='*') ) {
- int LA17_1 = input.LA(2);
-
- if ( (LA17_1=='/') ) {
- alt17=2;
- }
- else if ( ((LA17_1>='\u0000' && LA17_1<='.')||(LA17_1>='0' && LA17_1<='\uFFFE')) ) {
- alt17=1;
- }
-
-
- }
- else if ( ((LA17_0>='\u0000' && LA17_0<=')')||(LA17_0>='+' && LA17_0<='\uFFFE')) ) {
- alt17=1;
- }
-
-
- switch (alt17) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:829:35: .
- {
- matchAny(); if (failed) return ;
-
- }
- break;
-
- default :
- break loop17;
- }
- } while (true);
-
- match("*/"); if (failed) return ;
-
- if ( backtracking==0 ) {
- channel=HIDDEN;
- }
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end MULTI_LINE_COMMENT
-
- // $ANTLR start NAME
- public final void mNAME() throws RecognitionException {
- try {
- int _type = NAME;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:833:6: ( SYMBOL )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:833:8: SYMBOL
- {
- mSYMBOL(); if (failed) return ;
-
- }
-
- this.type = _type;
- }
- finally {
- }
- }
- // $ANTLR end NAME
-
- // $ANTLR start SYMBOL
- public final void mSYMBOL() throws RecognitionException {
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:836:8: ( FIRST_SYMBOL_CHAR ( SYMBOL_CHAR )* )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:836:10: FIRST_SYMBOL_CHAR ( SYMBOL_CHAR )*
- {
- mFIRST_SYMBOL_CHAR(); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:836:28: ( SYMBOL_CHAR )*
- loop18:
- do {
- int alt18=2;
- int LA18_0 = input.LA(1);
-
- if ( (LA18_0=='!'||(LA18_0>='#' && LA18_0<='%')||(LA18_0>='*' && LA18_0<=':')||(LA18_0>='=' && LA18_0<='_')||(LA18_0>='a' && LA18_0<='{')||LA18_0=='}') ) {
- alt18=1;
- }
-
-
- switch (alt18) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:836:28: SYMBOL_CHAR
- {
- mSYMBOL_CHAR(); if (failed) return ;
-
- }
- break;
-
- default :
- break loop18;
- }
- } while (true);
-
-
- }
-
- }
- finally {
- }
- }
- // $ANTLR end SYMBOL
-
- // $ANTLR start FIRST_SYMBOL_CHAR
- public final void mFIRST_SYMBOL_CHAR() throws RecognitionException {
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:841:19: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | '<' | ',' | '.' | '[' | ']' | '{' | '}' ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:841:21: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | '<' | ',' | '.' | '[' | ']' | '{' | '}' )
- {
- 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)>='a' && 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 FIRST_SYMBOL_CHAR
-
- // $ANTLR start SYMBOL_CHAR
- public final void mSYMBOL_CHAR() throws RecognitionException {
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:846:13: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | ',' | '.' | '[' | ']' | '{' | '}' | '?' ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:846:15: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | ',' | '.' | '[' | ']' | '{' | '}' | '?' )
- {
- 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)>='a' && 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 SYMBOL_CHAR
-
- public void mTokens() throws RecognitionException {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:8: ( T44 | T45 | WS | DEFRULE | DEFFUNCTION | OR | AND | NOT | EXISTS | TEST | NULL | DECLARE | SALIENCE | INT | FLOAT | STRING | BOOL | VAR | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | TILDE | AMPERSAND | PIPE | ASSIGN_OP | COLON | EQUALS | MULTI_LINE_COMMENT | NAME )
- int alt19=34;
- alt19 = dfa19.predict(input);
- switch (alt19) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:10: T44
- {
- mT44(); if (failed) return ;
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:14: T45
- {
- mT45(); if (failed) return ;
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:18: WS
- {
- mWS(); if (failed) return ;
-
- }
- break;
- case 4 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:21: DEFRULE
- {
- mDEFRULE(); if (failed) return ;
-
- }
- break;
- case 5 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:29: DEFFUNCTION
- {
- mDEFFUNCTION(); if (failed) return ;
-
- }
- break;
- case 6 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:41: OR
- {
- mOR(); if (failed) return ;
-
- }
- break;
- case 7 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:44: AND
- {
- mAND(); if (failed) return ;
-
- }
- break;
- case 8 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:48: NOT
- {
- mNOT(); if (failed) return ;
-
- }
- break;
- case 9 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:52: EXISTS
- {
- mEXISTS(); if (failed) return ;
-
- }
- break;
- case 10 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:59: TEST
- {
- mTEST(); if (failed) return ;
-
- }
- break;
- case 11 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:64: NULL
- {
- mNULL(); if (failed) return ;
-
- }
- break;
- case 12 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:69: DECLARE
- {
- mDECLARE(); if (failed) return ;
-
- }
- break;
- case 13 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:77: SALIENCE
- {
- mSALIENCE(); if (failed) return ;
-
- }
- break;
- case 14 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:86: INT
- {
- mINT(); if (failed) return ;
-
- }
- break;
- case 15 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:90: FLOAT
- {
- mFLOAT(); if (failed) return ;
-
- }
- break;
- case 16 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:96: STRING
- {
- mSTRING(); if (failed) return ;
-
- }
- break;
- case 17 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:103: BOOL
- {
- mBOOL(); if (failed) return ;
-
- }
- break;
- case 18 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:108: VAR
- {
- mVAR(); if (failed) return ;
-
- }
- break;
- case 19 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:112: SH_STYLE_SINGLE_LINE_COMMENT
- {
- mSH_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
-
- }
- break;
- case 20 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:141: C_STYLE_SINGLE_LINE_COMMENT
- {
- mC_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
-
- }
- break;
- case 21 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:169: LEFT_PAREN
- {
- mLEFT_PAREN(); if (failed) return ;
-
- }
- break;
- case 22 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:180: RIGHT_PAREN
- {
- mRIGHT_PAREN(); if (failed) return ;
-
- }
- break;
- case 23 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:192: LEFT_SQUARE
- {
- mLEFT_SQUARE(); if (failed) return ;
-
- }
- break;
- case 24 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:204: RIGHT_SQUARE
- {
- mRIGHT_SQUARE(); if (failed) return ;
-
- }
- break;
- case 25 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:217: LEFT_CURLY
- {
- mLEFT_CURLY(); if (failed) return ;
-
- }
- break;
- case 26 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:228: RIGHT_CURLY
- {
- mRIGHT_CURLY(); if (failed) return ;
-
- }
- break;
- case 27 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:240: TILDE
- {
- mTILDE(); if (failed) return ;
-
- }
- break;
- case 28 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:246: AMPERSAND
- {
- mAMPERSAND(); if (failed) return ;
-
- }
- break;
- case 29 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:256: PIPE
- {
- mPIPE(); if (failed) return ;
-
- }
- break;
- case 30 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:261: ASSIGN_OP
- {
- mASSIGN_OP(); if (failed) return ;
-
- }
- break;
- case 31 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:271: COLON
- {
- mCOLON(); if (failed) return ;
-
- }
- break;
- case 32 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:277: EQUALS
- {
- mEQUALS(); if (failed) return ;
-
- }
- break;
- case 33 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:284: MULTI_LINE_COMMENT
- {
- mMULTI_LINE_COMMENT(); if (failed) return ;
-
- }
- break;
- case 34 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:1:303: NAME
- {
- mNAME(); if (failed) return ;
-
- }
- break;
-
- }
-
- }
-
- // $ANTLR start synpred1
- public final void synpred1_fragment() throws RecognitionException {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:725:14: ( '\\r\\n' )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:725: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;
- }
-
-
- protected DFA19 dfa19 = new DFA19(this);
- static final String DFA19_eotS =
- "\1\uffff\1\35\1\40\1\uffff\10\35\1\54\1\uffff\1\35\1\uffff\2\35"+
- "\2\uffff\1\62\1\63\1\64\1\65\3\uffff\1\35\1\67\1\uffff\1\35\1\71"+
- "\1\uffff\1\35\1\74\7\35\1\54\1\35\1\uffff\2\35\1\uffff\2\35\4\uffff"+
- "\1\113\1\uffff\1\35\1\uffff\2\35\1\uffff\1\120\1\35\1\122\4\35\1"+
- "\127\2\35\1\uffff\1\35\1\uffff\1\35\1\uffff\4\35\1\uffff\1\136\1"+
- "\uffff\1\35\1\140\1\141\1\35\1\uffff\1\35\1\111\4\35\1\uffff\1\35"+
- "\2\uffff\1\35\1\140\1\152\3\35\1\156\1\35\1\uffff\1\35\1\161\1\162"+
- "\1\uffff\2\35\2\uffff\1\165\1\35\1\uffff\1\35\1\170\1\uffff";
- static final String DFA19_eofS =
- "\171\uffff";
- static final String DFA19_minS =
- "\1\11\1\155\1\41\1\uffff\1\145\1\162\1\156\1\157\1\170\1\145\1\141"+
- "\1\60\1\41\1\uffff\1\141\1\uffff\1\0\1\52\2\uffff\4\41\3\uffff\1"+
- "\55\1\41\1\uffff\1\160\1\41\1\uffff\1\143\1\41\1\144\1\154\1\164"+
- "\1\151\1\165\1\163\1\154\1\41\1\60\1\uffff\1\154\1\0\1\uffff\2\0"+
- "\4\uffff\1\41\1\uffff\1\157\1\uffff\1\146\1\154\1\uffff\1\41\1\154"+
- "\1\41\1\163\1\145\1\164\1\151\1\41\1\163\1\0\1\uffff\1\0\1\uffff"+
- "\1\0\1\uffff\1\162\2\165\1\141\1\uffff\1\41\1\uffff\1\164\2\41\1"+
- "\145\1\uffff\1\145\1\41\1\164\1\156\1\154\1\162\1\uffff\1\163\2"+
- "\uffff\1\156\2\41\1\143\2\145\1\41\1\143\1\uffff\1\164\2\41\1\uffff"+
- "\1\145\1\151\2\uffff\1\41\1\157\1\uffff\1\156\1\41\1\uffff";
- static final String DFA19_maxS =
- "\1\176\1\155\1\175\1\uffff\1\145\1\162\1\156\1\165\1\170\1\162\1"+
- "\141\1\71\1\175\1\uffff\1\141\1\uffff\1\ufffe\1\57\2\uffff\4\175"+
- "\3\uffff\1\55\1\175\1\uffff\1\160\1\175\1\uffff\1\146\1\175\1\144"+
- "\1\154\1\164\1\151\1\165\1\163\1\154\1\175\1\71\1\uffff\1\154\1"+
- "\ufffe\1\uffff\2\ufffe\4\uffff\1\175\1\uffff\1\157\1\uffff\1\162"+
- "\1\154\1\uffff\1\175\1\154\1\175\1\163\1\145\1\164\1\151\1\175\1"+
- "\163\1\ufffe\1\uffff\1\ufffe\1\uffff\1\ufffe\1\uffff\1\162\2\165"+
- "\1\141\1\uffff\1\175\1\uffff\1\164\2\175\1\145\1\uffff\1\145\1\175"+
- "\1\164\1\156\1\154\1\162\1\uffff\1\163\2\uffff\1\156\2\175\1\143"+
- "\2\145\1\175\1\143\1\uffff\1\164\2\175\1\uffff\1\145\1\151\2\uffff"+
- "\1\175\1\157\1\uffff\1\156\1\175\1\uffff";
- static final String DFA19_acceptS =
- "\3\uffff\1\3\11\uffff\1\20\1\uffff\1\22\2\uffff\1\25\1\26\4\uffff"+
- "\1\33\1\34\1\35\2\uffff\1\42\2\uffff\1\40\13\uffff\1\16\2\uffff"+
- "\1\23\2\uffff\1\27\1\30\1\31\1\32\1\uffff\1\37\1\uffff\1\2\2\uffff"+
- "\1\6\12\uffff\1\24\1\uffff\1\41\1\uffff\1\36\4\uffff\1\7\1\uffff"+
- "\1\10\4\uffff\1\17\6\uffff\1\13\1\uffff\1\21\1\12\10\uffff\1\1\3"+
- "\uffff\1\11\2\uffff\1\4\1\14\2\uffff\1\15\2\uffff\1\5";
- static final String DFA19_specialS =
- "\171\uffff}>";
- static final String[] DFA19_transitionS = {
- "\2\3\1\uffff\2\3\22\uffff\1\3\1\35\1\15\1\20\2\35\1\31\1\15"+
- "\1\22\1\23\3\35\1\13\1\35\1\21\12\14\1\34\1\uffff\1\33\1\2\1"+
- "\35\1\17\33\35\1\24\1\35\1\25\2\35\1\uffff\1\6\2\35\1\4\1\10"+
- "\1\16\2\35\1\1\4\35\1\7\1\5\3\35\1\12\1\11\6\35\1\26\1\32\1"+
- "\27\1\30",
- "\1\36",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\1\35\1\37\41\35\1\uffff"+
- "\33\35\1\uffff\1\35",
- "",
- "\1\41",
- "\1\42",
- "\1\43",
- "\1\45\5\uffff\1\44",
- "\1\46",
- "\1\50\14\uffff\1\47",
- "\1\51",
- "\12\52",
- "\1\35\1\uffff\3\35\4\uffff\4\35\1\53\1\35\12\52\1\35\2\uffff"+
- "\43\35\1\uffff\33\35\1\uffff\1\35",
- "",
- "\1\55",
- "",
- "\41\57\1\56\1\57\3\56\4\57\21\56\2\57\43\56\1\57\33\56\1\57"+
- "\1\56\uff81\57",
- "\1\61\4\uffff\1\60",
- "",
- "",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "",
- "",
- "",
- "\1\66",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "",
- "\1\70",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "",
- "\1\73\2\uffff\1\72",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\75",
- "\1\76",
- "\1\77",
- "\1\100",
- "\1\101",
- "\1\102",
- "\1\103",
- "\1\35\1\uffff\3\35\4\uffff\4\35\1\53\1\35\12\52\1\35\2\uffff"+
- "\43\35\1\uffff\33\35\1\uffff\1\35",
- "\12\104",
- "",
- "\1\105",
- "\41\57\1\56\1\57\3\56\4\57\21\56\2\57\43\56\1\57\33\56\1\57"+
- "\1\56\uff81\57",
- "",
- "\41\107\1\106\1\107\3\106\4\107\21\106\2\107\43\106\1\107\33"+
- "\106\1\107\1\106\uff81\107",
- "\41\111\1\112\1\111\3\112\4\111\1\110\20\112\2\111\43\112\1"+
- "\111\33\112\1\111\1\112\uff81\111",
- "",
- "",
- "",
- "",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "",
- "\1\114",
- "",
- "\1\115\13\uffff\1\116",
- "\1\117",
- "",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\121",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\123",
- "\1\124",
- "\1\125",
- "\1\126",
- "\1\35\1\uffff\3\35\4\uffff\6\35\12\104\1\35\2\uffff\43\35\1"+
- "\uffff\33\35\1\uffff\1\35",
- "\1\130",
- "\41\107\1\106\1\107\3\106\4\107\21\106\2\107\43\106\1\107\33"+
- "\106\1\107\1\106\uff81\107",
- "",
- "\41\111\1\112\1\111\3\112\4\111\1\110\4\112\1\131\13\112\2\111"+
- "\43\112\1\111\33\112\1\111\1\112\uff81\111",
- "",
- "\41\111\1\112\1\111\3\112\4\111\1\110\20\112\2\111\43\112\1"+
- "\111\33\112\1\111\1\112\uff81\111",
- "",
- "\1\132",
- "\1\133",
- "\1\134",
- "\1\135",
- "",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "",
- "\1\137",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\142",
- "",
- "\1\143",
- "\1\112\1\uffff\3\112\4\uffff\1\110\20\112\2\uffff\43\112\1\uffff"+
- "\33\112\1\uffff\1\112",
- "\1\144",
- "\1\145",
- "\1\146",
- "\1\147",
- "",
- "\1\150",
- "",
- "",
- "\1\151",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\153",
- "\1\154",
- "\1\155",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\157",
- "",
- "\1\160",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "",
- "\1\163",
- "\1\164",
- "",
- "",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- "\1\166",
- "",
- "\1\167",
- "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
- "\1\uffff\1\35",
- ""
- };
-
- static final short[] DFA19_eot = DFA.unpackEncodedString(DFA19_eotS);
- static final short[] DFA19_eof = DFA.unpackEncodedString(DFA19_eofS);
- static final char[] DFA19_min = DFA.unpackEncodedStringToUnsignedChars(DFA19_minS);
- static final char[] DFA19_max = DFA.unpackEncodedStringToUnsignedChars(DFA19_maxS);
- static final short[] DFA19_accept = DFA.unpackEncodedString(DFA19_acceptS);
- static final short[] DFA19_special = DFA.unpackEncodedString(DFA19_specialS);
- static final short[][] DFA19_transition;
-
- static {
- int numStates = DFA19_transitionS.length;
- DFA19_transition = new short[numStates][];
- for (int i=0; i<numStates; i++) {
- DFA19_transition[i] = DFA.unpackEncodedString(DFA19_transitionS[i]);
- }
- }
-
- class DFA19 extends DFA {
-
- public DFA19(BaseRecognizer recognizer) {
- this.recognizer = recognizer;
- this.decisionNumber = 19;
- this.eot = DFA19_eot;
- this.eof = DFA19_eof;
- this.min = DFA19_min;
- this.max = DFA19_max;
- this.accept = DFA19_accept;
- this.special = DFA19_special;
- this.transition = DFA19_transition;
- }
- public String getDescription() {
- return "1:1: Tokens : ( T44 | T45 | WS | DEFRULE | DEFFUNCTION | OR | AND | NOT | EXISTS | TEST | NULL | DECLARE | SALIENCE | INT | FLOAT | STRING | BOOL | VAR | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | TILDE | AMPERSAND | PIPE | ASSIGN_OP | COLON | EQUALS | MULTI_LINE_COMMENT | NAME );";
- }
- }
-
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CLPMVELParser.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CLPMVELParser.java 2008-01-29 21:02:48 UTC (rev 18198)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/CLPMVELParser.java 2008-01-29 21:27:34 UTC (rev 18199)
@@ -1,2266 +0,0 @@
-// $ANTLR 3.0.1 C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g 2008-01-29 07:31:27
-
- package org.drools.clips;
-
- import org.drools.clips.*;
-import org.drools.clips.mvel.*;
-
- import java.util.List;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.HashMap;
- import java.util.Set;
- import java.util.HashSet;
- import java.util.StringTokenizer;
- import org.drools.lang.descr.*;
- import org.drools.lang.Location;
-
-
-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 CLPMVELParser extends Parser {
- public static final String[] tokenNames = new String[] {
- "<invalid>", "<EOR>", "<DOWN>", "<UP>", "LEFT_PAREN", "NAME", "RIGHT_PAREN", "DEFFUNCTION", "DEFRULE", "STRING", "SALIENCE", "INT", "AND", "OR", "NOT", "EXISTS", "TEST", "VAR", "ASSIGN_OP", "PIPE", "AMPERSAND", "TILDE", "COLON", "EQUALS", "FLOAT", "BOOL", "NULL", "EOL", "WS", "DECLARE", "EscapeSequence", "HexDigit", "UnicodeEscape", "OctalEscape", "SYMBOL_CHAR", "SH_STYLE_SINGLE_LINE_COMMENT", "C_STYLE_SINGLE_LINE_COMMENT", "LEFT_SQUARE", "RIGHT_SQUARE", "LEFT_CURLY", "RIGHT_CURLY", "MULTI_LINE_COMMENT", "SYMBOL", "FIRST_SYMBOL_CHAR", "'import'", "'=>'"
- };
- public static final int RIGHT_SQUARE=38;
- public static final int RIGHT_CURLY=40;
- public static final int EQUALS=23;
- public static final int FLOAT=24;
- public static final int NOT=14;
- public static final int SYMBOL_CHAR=34;
- public static final int SH_STYLE_SINGLE_LINE_COMMENT=35;
- public static final int AND=12;
- public static final int EOF=-1;
- public static final int FIRST_SYMBOL_CHAR=43;
- public static final int HexDigit=31;
- public static final int DEFFUNCTION=7;
- public static final int ASSIGN_OP=18;
- public static final int RIGHT_PAREN=6;
- public static final int NAME=5;
- public static final int EOL=27;
- public static final int DEFRULE=8;
- public static final int TILDE=21;
- public static final int PIPE=19;
- public static final int VAR=17;
- public static final int EXISTS=15;
- public static final int SYMBOL=42;
- public static final int NULL=26;
- public static final int BOOL=25;
- public static final int SALIENCE=10;
- public static final int AMPERSAND=20;
- public static final int INT=11;
- public static final int MULTI_LINE_COMMENT=41;
- public static final int COLON=22;
- public static final int WS=28;
- public static final int UnicodeEscape=32;
- public static final int LEFT_CURLY=39;
- public static final int OR=13;
- public static final int TEST=16;
- public static final int LEFT_PAREN=4;
- public static final int DECLARE=29;
- public static final int LEFT_SQUARE=37;
- public static final int EscapeSequence=30;
- public static final int OctalEscape=33;
- public static final int C_STYLE_SINGLE_LINE_COMMENT=36;
- public static final int STRING=9;
-
- public CLPMVELParser(TokenStream input) {
- super(input);
- ruleMemo = new HashMap[26+1];
- }
-
-
- public String[] getTokenNames() { return tokenNames; }
- public String getGrammarFileName() { return "C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g"; }
-
-
- private PackageDescr packageDescr;
- private List errors = new ArrayList();
- private String source = "unknown";
- private int lineOffset = 0;
- private DescrFactory factory = new DescrFactory();
- private MVELBuildContext context;
- private boolean parserDebug = false;
- private Location location = new Location( Location.LOCATION_UNKNOWN );
-
- public void setParserDebug(boolean parserDebug) {
- this.parserDebug = parserDebug;
- }
-
- public void debug(String message) {
- if ( parserDebug )
- System.err.println( "drl parser: " + message );
- }
-
- public void setSource(String source) {
- this.source = source;
- }
- public DescrFactory getFactory() {
- return factory;
- }
-
- public String getSource() {
- return this.source;
- }
-
- public PackageDescr getPackageDescr() {
- return packageDescr;
- }
-
- private int offset(int line) {
- return line + lineOffset;
- }
-
- /**
- * This will set the offset to record when reparsing. Normally is zero of course
- */
- public void setLineOffset(int i) {
- this.lineOffset = i;
- }
-
- private String getString(Token token) {
- String orig = token.getText();
- return orig.substring( 1, orig.length() -1 );
- }
-
- public void reportError(RecognitionException ex) {
- // if we've already reported an error and have not matched a token
- // yet successfully, don't report any errors.
- if ( errorRecovery ) {
- return;
- }
- errorRecovery = true;
-
- ex.line = offset(ex.line); //add the offset if there is one
- errors.add( ex );
- }
-
- /** return the raw RecognitionException errors */
- public List getErrors() {
- return errors;
- }
-
- /** Return a list of pretty strings summarising the errors */
- public List getErrorMessages() {
- List messages = new ArrayList();
- for ( Iterator errorIter = errors.iterator() ; errorIter.hasNext() ; ) {
- messages.add( createErrorMessage( (RecognitionException) errorIter.next() ) );
- }
- return messages;
- }
-
- /** return true if any parser errors were accumulated */
- public boolean hasErrors() {
- return ! errors.isEmpty();
- }
-
- /** This will take a RecognitionException, and create a sensible error message out of it */
- public String createErrorMessage(RecognitionException e)
- {
- StringBuffer message = new StringBuffer();
- message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
- if ( e instanceof MismatchedTokenException ) {
- MismatchedTokenException mte = (MismatchedTokenException)e;
- message.append("mismatched token: "+
- e.token+
- "; expecting type "+
- tokenNames[mte.expecting]);
- }
- else if ( e instanceof MismatchedTreeNodeException ) {
- MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e;
- message.append("mismatched tree node: "+
- //mtne.foundNode+ FIXME
- "; expecting type "+
- tokenNames[mtne.expecting]);
- }
- else if ( e instanceof NoViableAltException ) {
- NoViableAltException nvae = (NoViableAltException)e;
- message.append( "Unexpected token '" + e.token.getText() + "'" );
- /*
- message.append("decision=<<"+nvae.grammarDecisionDescription+">>"+
- " state "+nvae.stateNumber+
- " (decision="+nvae.decisionNumber+
- ") no viable alt; token="+
- e.token);
- */
- }
- else if ( e instanceof EarlyExitException ) {
- EarlyExitException eee = (EarlyExitException)e;
- message.append("required (...)+ loop (decision="+
- eee.decisionNumber+
- ") did not match anything; token="+
- e.token);
- }
- else if ( e instanceof MismatchedSetException ) {
- MismatchedSetException mse = (MismatchedSetException)e;
- message.append("mismatched token '"+
- e.token+
- "' expecting set "+mse.expecting);
- }
- else if ( e instanceof MismatchedNotSetException ) {
- MismatchedNotSetException mse = (MismatchedNotSetException)e;
- message.append("mismatched token '"+
- e.token+
- "' expecting set "+mse.expecting);
- }
- else if ( e instanceof FailedPredicateException ) {
- FailedPredicateException fpe = (FailedPredicateException)e;
- message.append("rule "+fpe.ruleName+" failed predicate: {"+
- fpe.predicateText+"}?");
- } else if (e instanceof GeneralParseException) {
- message.append(" " + e.getMessage());
- }
- return message.toString();
- }
-
- void checkTrailingSemicolon(String text, int line) {
- if (text.trim().endsWith( ";" ) ) {
- this.errors.add( new GeneralParseException( "Trailing semi-colon not allowed", offset(line) ) );
- }
- }
-
-
-
-
- // $ANTLR start eval
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:224:1: eval[ParserHandler handler, MVELBuildContext context] : (i= importDescr | f= deffunction | r= defrule | form= lisp_form ) ;
- public final void eval(ParserHandler handler, MVELBuildContext context) throws RecognitionException {
- ImportDescr i = null;
-
- FunctionDescr f = null;
-
- RuleDescr r = null;
-
- LispForm form = null;
-
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:225:2: ( (i= importDescr | f= deffunction | r= defrule | form= lisp_form ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:226:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )
- {
- if ( backtracking==0 ) {
- this.context = context;
- }
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:227:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )
- int alt1=4;
- int LA1_0 = input.LA(1);
-
- if ( (LA1_0==LEFT_PAREN) ) {
- switch ( input.LA(2) ) {
- case DEFFUNCTION:
- {
- alt1=2;
- }
- break;
- case 44:
- {
- alt1=1;
- }
- break;
- case DEFRULE:
- {
- alt1=3;
- }
- break;
- case NAME:
- case VAR:
- {
- alt1=4;
- }
- break;
- default:
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("227:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )", 1, 1, input);
-
- throw nvae;
- }
-
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("227:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )", 1, 0, input);
-
- throw nvae;
- }
- switch (alt1) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:227:7: i= importDescr
- {
- pushFollow(FOLLOW_importDescr_in_eval60);
- i=importDescr();
- _fsp--;
- if (failed) return ;
- if ( backtracking==0 ) {
- handler.importHandler( i );
- }
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:228:7: f= deffunction
- {
- pushFollow(FOLLOW_deffunction_in_eval71);
- f=deffunction();
- _fsp--;
- if (failed) return ;
- if ( backtracking==0 ) {
- handler.functionHandler( f );
- }
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:229:7: r= defrule
- {
- pushFollow(FOLLOW_defrule_in_eval84);
- r=defrule();
- _fsp--;
- if (failed) return ;
- if ( backtracking==0 ) {
- handler.ruleHandler( r );
- }
-
- }
- break;
- case 4 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:230:7: form= lisp_form
- {
- pushFollow(FOLLOW_lisp_form_in_eval96);
- form=lisp_form();
- _fsp--;
- if (failed) return ;
- if ( backtracking==0 ) {
- handler.lispFormHandler( form );
- }
-
- }
- break;
-
- }
-
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end eval
-
-
- // $ANTLR start importDescr
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:247:1: importDescr returns [ImportDescr importDescr] : LEFT_PAREN 'import' importName= NAME RIGHT_PAREN ;
- public final ImportDescr importDescr() throws RecognitionException {
- ImportDescr importDescr = null;
-
- Token importName=null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:248:2: ( LEFT_PAREN 'import' importName= NAME RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:248:4: LEFT_PAREN 'import' importName= NAME RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_importDescr123); if (failed) return importDescr;
- match(input,44,FOLLOW_44_in_importDescr125); if (failed) return importDescr;
- importName=(Token)input.LT(1);
- match(input,NAME,FOLLOW_NAME_in_importDescr129); if (failed) return importDescr;
- if ( backtracking==0 ) {
- importDescr = new ImportDescr( importName.getText() );
- }
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_importDescr133); if (failed) return importDescr;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return importDescr;
- }
- // $ANTLR end importDescr
-
-
- // $ANTLR start deffunction
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:296:1: deffunction returns [FunctionDescr functionDescr] : LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN ;
- public final FunctionDescr deffunction() throws RecognitionException {
- FunctionDescr functionDescr = null;
-
- Token t=null;
- SExpression name = null;
-
- LispForm params = null;
-
- LispForm form = null;
-
-
-
- List content = null;
- functionDescr = null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:301:2: ( LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:301:4: LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_deffunction168); if (failed) return functionDescr;
- t=(Token)input.LT(1);
- match(input,DEFFUNCTION,FOLLOW_DEFFUNCTION_in_deffunction178); if (failed) return functionDescr;
- pushFollow(FOLLOW_lisp_atom_in_deffunction188);
- name=lisp_atom();
- _fsp--;
- if (failed) return functionDescr;
- pushFollow(FOLLOW_lisp_form_in_deffunction198);
- params=lisp_form();
- _fsp--;
- if (failed) return functionDescr;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:305:3: (form= lisp_form )+
- int cnt2=0;
- loop2:
- do {
- int alt2=2;
- int LA2_0 = input.LA(1);
-
- if ( (LA2_0==LEFT_PAREN) ) {
- alt2=1;
- }
-
-
- switch (alt2) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:305:4: form= lisp_form
- {
- pushFollow(FOLLOW_lisp_form_in_deffunction207);
- form=lisp_form();
- _fsp--;
- if (failed) return functionDescr;
- if ( backtracking==0 ) {
- if ( content == null ) content = new ArrayList(); content.add( form );
- }
-
- }
- break;
-
- default :
- if ( cnt2 >= 1 ) break loop2;
- if (backtracking>0) {failed=true; return functionDescr;}
- EarlyExitException eee =
- new EarlyExitException(2, input);
- throw eee;
- }
- cnt2++;
- } while (true);
-
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_deffunction229); if (failed) return functionDescr;
- if ( backtracking==0 ) {
- functionDescr = FunctionHandlers.createFunctionDescr( name, params, content );
- }
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return functionDescr;
- }
- // $ANTLR end deffunction
-
-
- // $ANTLR start defrule
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:311:1: defrule returns [RuleDescr rule] : loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' t= lisp_form RIGHT_PAREN ;
- public final RuleDescr defrule() throws RecognitionException {
- RuleDescr rule = null;
-
- Token loc=null;
- Token ruleName=null;
- Token documentation=null;
- LispForm t = null;
-
-
-
- rule = null;
- AndDescr lhs = null;
- PatternDescr colum = null;
- AttributeDescr module = null;
- Set declarations = null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:319:2: (loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' t= lisp_form RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:319:4: loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' t= lisp_form RIGHT_PAREN
- {
- loc=(Token)input.LT(1);
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_defrule266); if (failed) return rule;
- match(input,DEFRULE,FOLLOW_DEFRULE_in_defrule274); if (failed) return rule;
- ruleName=(Token)input.LT(1);
- match(input,NAME,FOLLOW_NAME_in_defrule278); if (failed) return rule;
- if ( backtracking==0 ) {
-
- debug( "start rule: " + ruleName.getText() );
- String ruleStr = ruleName.getText();
-
- if ( ruleStr.indexOf("::") >= 0 ) {
- String mod = ruleStr.substring(0, ruleStr.indexOf("::"));
- ruleStr = ruleStr.substring(ruleStr.indexOf("::")+2);
- module = new AttributeDescr( "agenda-group", mod );
- module.setLocation( offset(ruleName.getLine()), ruleName.getCharPositionInLine() );
- module.setStartCharacter( ((CommonToken)ruleName).getStartIndex() );
- module.setEndCharacter( ((CommonToken)ruleName).getStopIndex() );
- }
-
- rule = new RuleDescr( ruleStr, null );
- if( module != null ) {
- rule.addAttribute( module );
- }
-
- rule.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
- rule.setStartCharacter( ((CommonToken)loc).getStartIndex() );
-
- // not sure how you define where a LHS starts in clips, so just putting it here for now
- lhs = new AndDescr();
- rule.setLhs( lhs );
- lhs.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
- lhs.setStartCharacter( ((CommonToken)loc).getStartIndex() );
-
- rule.addAttribute( new AttributeDescr( "dialect", "clips") );
-
- declarations = new HashSet();
-
- }
- documentation=(Token)input.LT(1);
- match(input,STRING,FOLLOW_STRING_in_defrule290); if (failed) return rule;
- if ( backtracking==0 ) {
-
- // do nothing here for now
-
- }
- pushFollow(FOLLOW_ruleAttribute_in_defrule296);
- ruleAttribute(rule);
- _fsp--;
- if (failed) return rule;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:358:3: ( ce[lhs, declarations] )*
- loop3:
- do {
- int alt3=2;
- int LA3_0 = input.LA(1);
-
- if ( (LA3_0==LEFT_PAREN||LA3_0==VAR) ) {
- alt3=1;
- }
-
-
- switch (alt3) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:358:3: ce[lhs, declarations]
- {
- pushFollow(FOLLOW_ce_in_defrule304);
- ce(lhs, declarations);
- _fsp--;
- if (failed) return rule;
-
- }
- break;
-
- default :
- break loop3;
- }
- } while (true);
-
- match(input,45,FOLLOW_45_in_defrule313); if (failed) return rule;
- pushFollow(FOLLOW_lisp_form_in_defrule322);
- t=lisp_form();
- _fsp--;
- if (failed) return rule;
- if ( backtracking==0 ) {
- rule.setConsequence( t );
- }
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_defrule331); if (failed) return rule;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return rule;
- }
- // $ANTLR end defrule
-
-
- // $ANTLR start ruleAttribute
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:368:1: ruleAttribute[RuleDescr rule] : ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? ;
- public final void ruleAttribute(RuleDescr rule) throws RecognitionException {
- AttributeDescr d = null;
-
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:369:2: ( ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:370:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:370:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
- int alt5=2;
- int LA5_0 = input.LA(1);
-
- if ( (LA5_0==LEFT_PAREN) ) {
- int LA5_1 = input.LA(2);
-
- if ( (LA5_1==DECLARE) ) {
- alt5=1;
- }
- }
- switch (alt5) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:370:5: LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute348); if (failed) return ;
- match(input,DECLARE,FOLLOW_DECLARE_in_ruleAttribute350); if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:371:4: ( LEFT_PAREN d= salience RIGHT_PAREN )?
- int alt4=2;
- int LA4_0 = input.LA(1);
-
- if ( (LA4_0==LEFT_PAREN) ) {
- alt4=1;
- }
- switch (alt4) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:371:6: LEFT_PAREN d= salience RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute357); if (failed) return ;
- pushFollow(FOLLOW_salience_in_ruleAttribute361);
- d=salience();
- _fsp--;
- if (failed) return ;
- if ( backtracking==0 ) {
- rule.addAttribute( d );
- }
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute365); if (failed) return ;
-
- }
- break;
-
- }
-
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute372); if (failed) return ;
-
- }
- break;
-
- }
-
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end ruleAttribute
-
-
- // $ANTLR start salience
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:375:1: salience returns [AttributeDescr d ] : loc= SALIENCE i= INT ;
- public final AttributeDescr salience() throws RecognitionException {
- AttributeDescr d = null;
-
- Token loc=null;
- Token i=null;
-
-
- d = null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:379:2: (loc= SALIENCE i= INT )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:380:3: loc= SALIENCE i= INT
- {
- loc=(Token)input.LT(1);
- match(input,SALIENCE,FOLLOW_SALIENCE_in_salience402); if (failed) return d;
- i=(Token)input.LT(1);
- match(input,INT,FOLLOW_INT_in_salience406); if (failed) return d;
- if ( backtracking==0 ) {
-
- d = new AttributeDescr( "salience", i.getText() );
- d.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
- d.setStartCharacter( ((CommonToken)loc).getStartIndex() );
- d.setEndCharacter( ((CommonToken)i).getStopIndex() );
-
- }
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return d;
- }
- // $ANTLR end salience
-
-
- // $ANTLR start ce
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:390:1: ce[ConditionalElementDescr in_ce, Set declarations] : ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] ) ;
- public final void ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:391:2: ( ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:391:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:391:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )
- int alt6=7;
- int LA6_0 = input.LA(1);
-
- if ( (LA6_0==LEFT_PAREN) ) {
- switch ( input.LA(2) ) {
- case NOT:
- {
- alt6=3;
- }
- break;
- case EXISTS:
- {
- alt6=4;
- }
- break;
- case OR:
- {
- alt6=2;
- }
- break;
- case AND:
- {
- alt6=1;
- }
- break;
- case NAME:
- {
- alt6=6;
- }
- break;
- case TEST:
- {
- alt6=5;
- }
- break;
- default:
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("391:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )", 6, 1, input);
-
- throw nvae;
- }
-
- }
- else if ( (LA6_0==VAR) ) {
- alt6=7;
- }
- else {
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("391:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )", 6, 0, input);
-
- throw nvae;
- }
- switch (alt6) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:391:8: and_ce[in_ce, declarations]
- {
- pushFollow(FOLLOW_and_ce_in_ce432);
- and_ce(in_ce, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:392:7: or_ce[in_ce, declarations]
- {
- pushFollow(FOLLOW_or_ce_in_ce442);
- or_ce(in_ce, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:393:7: not_ce[in_ce, declarations]
- {
- pushFollow(FOLLOW_not_ce_in_ce451);
- not_ce(in_ce, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
- case 4 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:394:7: exists_ce[in_ce, declarations]
- {
- pushFollow(FOLLOW_exists_ce_in_ce460);
- exists_ce(in_ce, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
- case 5 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:395:8: eval_ce[in_ce, declarations]
- {
- pushFollow(FOLLOW_eval_ce_in_ce474);
- eval_ce(in_ce, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
- case 6 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:396:7: normal_pattern[in_ce, declarations]
- {
- pushFollow(FOLLOW_normal_pattern_in_ce488);
- normal_pattern(in_ce, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
- case 7 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:397:7: bound_pattern[in_ce, declarations]
- {
- pushFollow(FOLLOW_bound_pattern_in_ce497);
- bound_pattern(in_ce, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
-
- }
-
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end ce
-
-
- // $ANTLR start and_ce
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:401:1: and_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN ;
- public final void and_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
-
- AndDescr andDescr= null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:405:2: ( LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:405:4: LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_and_ce524); if (failed) return ;
- match(input,AND,FOLLOW_AND_in_and_ce529); if (failed) return ;
- if ( backtracking==0 ) {
-
- andDescr = new AndDescr();
- in_ce.addDescr( andDescr );
-
- }
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:410:3: ( ce[andDescr, declarations] )+
- int cnt7=0;
- loop7:
- do {
- int alt7=2;
- int LA7_0 = input.LA(1);
-
- if ( (LA7_0==LEFT_PAREN||LA7_0==VAR) ) {
- alt7=1;
- }
-
-
- switch (alt7) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:410:3: ce[andDescr, declarations]
- {
- pushFollow(FOLLOW_ce_in_and_ce535);
- ce(andDescr, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
-
- default :
- if ( cnt7 >= 1 ) break loop7;
- if (backtracking>0) {failed=true; return ;}
- EarlyExitException eee =
- new EarlyExitException(7, input);
- throw eee;
- }
- cnt7++;
- } while (true);
-
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_and_ce544); if (failed) return ;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end and_ce
-
-
- // $ANTLR start or_ce
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:414:1: or_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN ;
- public final void or_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
-
- OrDescr orDescr= null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:418:2: ( LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:418:4: LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_or_ce572); if (failed) return ;
- match(input,OR,FOLLOW_OR_in_or_ce577); if (failed) return ;
- if ( backtracking==0 ) {
-
- orDescr = new OrDescr();
- in_ce.addDescr( orDescr );
-
- }
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:423:3: ( ce[orDescr, declarations] )+
- int cnt8=0;
- loop8:
- do {
- int alt8=2;
- int LA8_0 = input.LA(1);
-
- if ( (LA8_0==LEFT_PAREN||LA8_0==VAR) ) {
- alt8=1;
- }
-
-
- switch (alt8) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:423:3: ce[orDescr, declarations]
- {
- pushFollow(FOLLOW_ce_in_or_ce583);
- ce(orDescr, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
-
- default :
- if ( cnt8 >= 1 ) break loop8;
- if (backtracking>0) {failed=true; return ;}
- EarlyExitException eee =
- new EarlyExitException(8, input);
- throw eee;
- }
- cnt8++;
- } while (true);
-
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_or_ce592); if (failed) return ;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end or_ce
-
-
- // $ANTLR start not_ce
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:427:1: not_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN ;
- public final void not_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
-
- NotDescr notDescr= null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:431:2: ( LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:431:4: LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_not_ce620); if (failed) return ;
- match(input,NOT,FOLLOW_NOT_in_not_ce625); if (failed) return ;
- if ( backtracking==0 ) {
-
- notDescr = new NotDescr();
- in_ce.addDescr( notDescr );
-
- }
- pushFollow(FOLLOW_ce_in_not_ce631);
- ce(notDescr, declarations);
- _fsp--;
- if (failed) return ;
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_not_ce639); if (failed) return ;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end not_ce
-
-
- // $ANTLR start exists_ce
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:440:1: exists_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN ;
- public final void exists_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
-
- ExistsDescr existsDescr= null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:444:2: ( LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:444:4: LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_exists_ce668); if (failed) return ;
- match(input,EXISTS,FOLLOW_EXISTS_in_exists_ce673); if (failed) return ;
- if ( backtracking==0 ) {
-
- existsDescr = new ExistsDescr();
- in_ce.addDescr( existsDescr );
-
- }
- pushFollow(FOLLOW_ce_in_exists_ce679);
- ce(existsDescr, declarations);
- _fsp--;
- if (failed) return ;
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_exists_ce687); if (failed) return ;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end exists_ce
-
-
- // $ANTLR start eval_ce
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:453:1: eval_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN TEST t= lisp_form RIGHT_PAREN ;
- public final void eval_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
- LispForm t = null;
-
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:454:2: ( LEFT_PAREN TEST t= lisp_form RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:454:4: LEFT_PAREN TEST t= lisp_form RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_eval_ce706); if (failed) return ;
- match(input,TEST,FOLLOW_TEST_in_eval_ce711); if (failed) return ;
- pushFollow(FOLLOW_lisp_form_in_eval_ce718);
- t=lisp_form();
- _fsp--;
- if (failed) return ;
- if ( backtracking==0 ) {
- EvalDescr evalDescr = new EvalDescr(); evalDescr.setContent( t ); in_ce.addDescr( evalDescr );
- }
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_eval_ce728); if (failed) return ;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end eval_ce
-
-
- // $ANTLR start normal_pattern
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:460:1: normal_pattern[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN ;
- public final void normal_pattern(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
- Token name=null;
-
-
- PatternDescr pattern = null;
- ConditionalElementDescr top = null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:465:2: ( LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:465:4: LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_normal_pattern756); if (failed) return ;
- name=(Token)input.LT(1);
- match(input,NAME,FOLLOW_NAME_in_normal_pattern763); if (failed) return ;
- if ( backtracking==0 ) {
-
- pattern = new PatternDescr(name.getText());
- in_ce.addDescr( pattern );
- top = pattern.getConstraint();
-
-
- }
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:472:3: ( field_constriant[top, declarations] )*
- loop9:
- do {
- int alt9=2;
- int LA9_0 = input.LA(1);
-
- if ( (LA9_0==LEFT_PAREN) ) {
- alt9=1;
- }
-
-
- switch (alt9) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:472:3: field_constriant[top, declarations]
- {
- pushFollow(FOLLOW_field_constriant_in_normal_pattern769);
- field_constriant(top, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
-
- default :
- break loop9;
- }
- } while (true);
-
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_normal_pattern779); if (failed) return ;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end normal_pattern
-
-
- // $ANTLR start bound_pattern
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:478:1: bound_pattern[ConditionalElementDescr in_ce, Set declarations] : var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN ;
- public final void bound_pattern(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
- Token var=null;
- Token name=null;
-
-
- PatternDescr pattern = null;
- String identifier = null;
- ConditionalElementDescr top = null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:484:2: (var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:484:4: var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN
- {
- var=(Token)input.LT(1);
- match(input,VAR,FOLLOW_VAR_in_bound_pattern807); if (failed) return ;
- if ( backtracking==0 ) {
-
- identifier = var.getText();
-
- }
- match(input,ASSIGN_OP,FOLLOW_ASSIGN_OP_in_bound_pattern813); if (failed) return ;
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_bound_pattern815); if (failed) return ;
- name=(Token)input.LT(1);
- match(input,NAME,FOLLOW_NAME_in_bound_pattern819); if (failed) return ;
- if ( backtracking==0 ) {
-
- pattern = new PatternDescr(name.getText());
- pattern.setIdentifier( identifier );
- in_ce.addDescr( pattern );
- top = pattern.getConstraint();
-
- }
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:494:3: ( field_constriant[top, declarations] )*
- loop10:
- do {
- int alt10=2;
- int LA10_0 = input.LA(1);
-
- if ( (LA10_0==LEFT_PAREN) ) {
- alt10=1;
- }
-
-
- switch (alt10) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:494:3: field_constriant[top, declarations]
- {
- pushFollow(FOLLOW_field_constriant_in_bound_pattern828);
- field_constriant(top, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
-
- default :
- break loop10;
- }
- } while (true);
-
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_bound_pattern835); if (failed) return ;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end bound_pattern
-
-
- // $ANTLR start field_constriant
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:498:1: field_constriant[ConditionalElementDescr base, Set declarations] : LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN ;
- public final void field_constriant(ConditionalElementDescr base, Set declarations) throws RecognitionException {
- Token f=null;
-
-
- List list = new ArrayList();
- FieldBindingDescr fbd = null;
- FieldConstraintDescr fc = null;
- RestrictionConnectiveDescr top = null;
- String op = "==";
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:506:2: ( LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:507:3: LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_field_constriant866); if (failed) return ;
- f=(Token)input.LT(1);
- match(input,NAME,FOLLOW_NAME_in_field_constriant870); if (failed) return ;
- if ( backtracking==0 ) {
-
- fc = new FieldConstraintDescr(f.getText());
- fc.setLocation( offset(f.getLine()), f.getCharPositionInLine() );
- fc.setStartCharacter( ((CommonToken)f).getStartIndex() );
- base.addDescr( fc );
- top = fc.getRestriction();
-
- }
- pushFollow(FOLLOW_or_restr_connective_in_field_constriant885);
- or_restr_connective(top, base, fc, declarations);
- _fsp--;
- if (failed) return ;
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_field_constriant891); if (failed) return ;
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end field_constriant
-
-
- // $ANTLR start or_restr_connective
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:534:1: or_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] options {backtrack=true; } : and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )* ;
- public final void or_restr_connective(RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
-
- RestrictionConnectiveDescr or = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:541:2: ( and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )* )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:542:3: and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )*
- {
- pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective930);
- and_restr_connective(or, ceBase, fcBase, declarations);
- _fsp--;
- if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:543:3: ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )*
- loop11:
- do {
- int alt11=2;
- int LA11_0 = input.LA(1);
-
- if ( (LA11_0==PIPE) ) {
- alt11=1;
- }
-
-
- switch (alt11) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:545:6: PIPE and_restr_connective[or, ceBase, fcBase, declarations]
- {
- match(input,PIPE,FOLLOW_PIPE_in_or_restr_connective954); if (failed) return ;
- if ( backtracking==0 ) {
-
- location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
-
- }
- pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective964);
- and_restr_connective(or, ceBase, fcBase, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
-
- default :
- break loop11;
- }
- } while (true);
-
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
-
- if( or.getRestrictions().size() == 1 ) {
- rcBase.addOrMerge( (RestrictionDescr) or.getRestrictions().get( 0 ) );
- } else if ( or.getRestrictions().size() > 1 ) {
- rcBase.addRestriction( or );
- }
-
- }
- return ;
- }
- // $ANTLR end or_restr_connective
-
-
- // $ANTLR start and_restr_connective
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:560:1: and_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] : restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )* ;
- public final void and_restr_connective(RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
-
- RestrictionConnectiveDescr and = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:564:2: ( restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )* )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:565:3: restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
- {
- pushFollow(FOLLOW_restriction_in_and_restr_connective996);
- restriction(and, ceBase, fcBase, declarations);
- _fsp--;
- if (failed) return ;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:566:3: ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
- loop12:
- do {
- int alt12=2;
- int LA12_0 = input.LA(1);
-
- if ( (LA12_0==AMPERSAND) ) {
- alt12=1;
- }
-
-
- switch (alt12) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:566:5: AMPERSAND restriction[and, ceBase, fcBase, declarations]
- {
- match(input,AMPERSAND,FOLLOW_AMPERSAND_in_and_restr_connective1004); if (failed) return ;
- pushFollow(FOLLOW_restriction_in_and_restr_connective1006);
- restriction(and, ceBase, fcBase, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
-
- default :
- break loop12;
- }
- } while (true);
-
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
-
- if( and.getRestrictions().size() == 1) {
- rcBase.addOrMerge( (RestrictionDescr) and.getRestrictions().get( 0 ) );
- } else if ( and.getRestrictions().size() > 1 ) {
- rcBase.addRestriction( and );
- }
-
- }
- return ;
- }
- // $ANTLR end and_restr_connective
-
-
- // $ANTLR start restriction
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:585:1: restriction[RestrictionConnectiveDescr rc, ConditionalElementDescr base, FieldConstraintDescr fcBase, Set declarations ] : ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction ) ;
- public final void restriction(RestrictionConnectiveDescr rc, ConditionalElementDescr base, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
- String lc = null;
-
-
-
- String op = "==";
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:589:2: ( ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:589:4: ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:589:4: ( TILDE )?
- int alt13=2;
- int LA13_0 = input.LA(1);
-
- if ( (LA13_0==TILDE) ) {
- alt13=1;
- }
- switch (alt13) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:589:5: TILDE
- {
- match(input,TILDE,FOLLOW_TILDE_in_restriction1039); if (failed) return ;
- if ( backtracking==0 ) {
- op = "!=";
- }
-
- }
- break;
-
- }
-
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:590:3: ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )
- int alt14=4;
- switch ( input.LA(1) ) {
- case COLON:
- {
- alt14=1;
- }
- break;
- case EQUALS:
- {
- alt14=2;
- }
- break;
- case VAR:
- {
- alt14=3;
- }
- break;
- case NAME:
- case STRING:
- case INT:
- case FLOAT:
- case BOOL:
- case NULL:
- {
- alt14=4;
- }
- break;
- default:
- if (backtracking>0) {failed=true; return ;}
- NoViableAltException nvae =
- new NoViableAltException("590:3: ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )", 14, 0, input);
-
- throw nvae;
- }
-
- switch (alt14) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:590:5: predicate_constraint[rc, op, base]
- {
- pushFollow(FOLLOW_predicate_constraint_in_restriction1055);
- predicate_constraint(rc, op, base);
- _fsp--;
- if (failed) return ;
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:591:7: return_value_restriction[op, rc]
- {
- pushFollow(FOLLOW_return_value_restriction_in_restriction1071);
- return_value_restriction(op, rc);
- _fsp--;
- if (failed) return ;
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:592:7: variable_restriction[op, rc, base, fcBase, declarations]
- {
- pushFollow(FOLLOW_variable_restriction_in_restriction1080);
- variable_restriction(op, rc, base, fcBase, declarations);
- _fsp--;
- if (failed) return ;
-
- }
- break;
- case 4 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:593:8: lc= literal_restriction
- {
- pushFollow(FOLLOW_literal_restriction_in_restriction1092);
- lc=literal_restriction();
- _fsp--;
- if (failed) return ;
- if ( backtracking==0 ) {
-
- rc.addRestriction( new LiteralRestrictionDescr(op, lc) );
- op = "==";
-
- }
-
- }
- break;
-
- }
-
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end restriction
-
-
- // $ANTLR start predicate_constraint
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:600:1: predicate_constraint[RestrictionConnectiveDescr rc, String op, ConditionalElementDescr base] : COLON t= lisp_form ;
- public final void predicate_constraint(RestrictionConnectiveDescr rc, String op, ConditionalElementDescr base) throws RecognitionException {
- LispForm t = null;
-
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:601:2: ( COLON t= lisp_form )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:601:4: COLON t= lisp_form
- {
- match(input,COLON,FOLLOW_COLON_in_predicate_constraint1125); if (failed) return ;
- pushFollow(FOLLOW_lisp_form_in_predicate_constraint1131);
- t=lisp_form();
- _fsp--;
- if (failed) return ;
- if ( backtracking==0 ) {
- rc.addRestriction( new PredicateDescr( t ) );
- }
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end predicate_constraint
-
-
- // $ANTLR start return_value_restriction
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:607:1: return_value_restriction[String op, RestrictionConnectiveDescr rc] : EQUALS t= lisp_form ;
- public final void return_value_restriction(String op, RestrictionConnectiveDescr rc) throws RecognitionException {
- LispForm t = null;
-
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:608:2: ( EQUALS t= lisp_form )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:608:4: EQUALS t= lisp_form
- {
- match(input,EQUALS,FOLLOW_EQUALS_in_return_value_restriction1150); if (failed) return ;
- pushFollow(FOLLOW_lisp_form_in_return_value_restriction1157);
- t=lisp_form();
- _fsp--;
- if (failed) return ;
- if ( backtracking==0 ) {
- rc.addRestriction( new ReturnValueRestrictionDescr (op, t ) );
- }
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end return_value_restriction
-
-
- // $ANTLR start variable_restriction
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:613:1: variable_restriction[String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] : VAR ;
- public final void variable_restriction(String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
- Token VAR1=null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:614:2: ( VAR )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:614:4: VAR
- {
- VAR1=(Token)input.LT(1);
- match(input,VAR,FOLLOW_VAR_in_variable_restriction1176); if (failed) return ;
- if ( backtracking==0 ) {
-
- if ( declarations.contains( VAR1.getText() ) ) {
- rc.addRestriction( new VariableRestrictionDescr(op, VAR1.getText()) );
- } else {
- FieldBindingDescr fbd = new FieldBindingDescr();
- fbd.setIdentifier( VAR1.getText() );
- fbd.setFieldName( fcBase.getFieldName() );
- ceBase.insertBeforeLast( FieldConstraintDescr.class, fbd );
- declarations.add( VAR1.getText() );
- }
-
- }
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return ;
- }
- // $ANTLR end variable_restriction
-
-
- // $ANTLR start literal_restriction
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:628:1: literal_restriction returns [String text] : t= literal ;
- public final String literal_restriction() throws RecognitionException {
- String text = null;
-
- String t = null;
-
-
-
- text = null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:632:2: (t= literal )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:633:6: t= literal
- {
- pushFollow(FOLLOW_literal_in_literal_restriction1209);
- t=literal();
- _fsp--;
- if (failed) return text;
- if ( backtracking==0 ) {
-
- text = t;
-
- }
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return text;
- }
- // $ANTLR end literal_restriction
-
-
- // $ANTLR start lisp_form
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:650:1: lisp_form returns [LispForm lispForm] : LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN ;
- public final LispForm lisp_form() throws RecognitionException {
- LispForm lispForm = null;
-
- Token t=null;
- SExpression a = null;
-
- LispForm l = null;
-
-
-
- List list = new ArrayList();
- lispForm = null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:655:2: ( LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:655:4: LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN
- {
- match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lisp_form1237); if (failed) return lispForm;
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:657:3: (t= NAME | t= VAR )
- int alt15=2;
- int LA15_0 = input.LA(1);
-
- if ( (LA15_0==NAME) ) {
- alt15=1;
- }
- else if ( (LA15_0==VAR) ) {
- alt15=2;
- }
- else {
- if (backtracking>0) {failed=true; return lispForm;}
- NoViableAltException nvae =
- new NoViableAltException("657:3: (t= NAME | t= VAR )", 15, 0, input);
-
- throw nvae;
- }
- switch (alt15) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:658:7: t= NAME
- {
- t=(Token)input.LT(1);
- match(input,NAME,FOLLOW_NAME_in_lisp_form1254); if (failed) return lispForm;
- if ( backtracking==0 ) {
- list.add( new SymbolLispAtom( t.getText() ) );
- }
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:660:7: t= VAR
- {
- t=(Token)input.LT(1);
- match(input,VAR,FOLLOW_VAR_in_lisp_form1274); if (failed) return lispForm;
- if ( backtracking==0 ) {
- list.add( new VariableLispAtom( t.getText(), context ) );
- }
-
- }
- break;
-
- }
-
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:662:3: (a= lisp_atom | l= lisp_form )*
- loop16:
- do {
- int alt16=3;
- int LA16_0 = input.LA(1);
-
- if ( (LA16_0==NAME||LA16_0==STRING||LA16_0==INT||LA16_0==VAR||(LA16_0>=FLOAT && LA16_0<=NULL)) ) {
- alt16=1;
- }
- else if ( (LA16_0==LEFT_PAREN) ) {
- alt16=2;
- }
-
-
- switch (alt16) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:662:6: a= lisp_atom
- {
- pushFollow(FOLLOW_lisp_atom_in_lisp_form1297);
- a=lisp_atom();
- _fsp--;
- if (failed) return lispForm;
- if ( backtracking==0 ) {
- list.add( a );
- }
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:663:6: l= lisp_form
- {
- pushFollow(FOLLOW_lisp_form_in_lisp_form1308);
- l=lisp_form();
- _fsp--;
- if (failed) return lispForm;
- if ( backtracking==0 ) {
- list.add( l );
- }
-
- }
- break;
-
- default :
- break loop16;
- }
- } while (true);
-
- match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lisp_form1335); if (failed) return lispForm;
- if ( backtracking==0 ) {
- lispForm = new LispForm( (org.drools.clips.SExpression[] ) list.toArray( new SExpression[ list.size () ] ) );
- }
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return lispForm;
- }
- // $ANTLR end lisp_form
-
-
- // $ANTLR start lisp_atom
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:669:1: lisp_atom returns [SExpression sExpression] : (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME ) ;
- public final SExpression lisp_atom() throws RecognitionException {
- SExpression sExpression = null;
-
- Token t=null;
-
-
- sExpression = null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:673:2: ( (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:674:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:674:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )
- int alt17=7;
- switch ( input.LA(1) ) {
- case VAR:
- {
- alt17=1;
- }
- break;
- case STRING:
- {
- alt17=2;
- }
- break;
- case FLOAT:
- {
- alt17=3;
- }
- break;
- case INT:
- {
- alt17=4;
- }
- break;
- case BOOL:
- {
- alt17=5;
- }
- break;
- case NULL:
- {
- alt17=6;
- }
- break;
- case NAME:
- {
- alt17=7;
- }
- break;
- default:
- if (backtracking>0) {failed=true; return sExpression;}
- NoViableAltException nvae =
- new NoViableAltException("674:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )", 17, 0, input);
-
- throw nvae;
- }
-
- switch (alt17) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:675:6: t= VAR
- {
- t=(Token)input.LT(1);
- match(input,VAR,FOLLOW_VAR_in_lisp_atom1379); if (failed) return sExpression;
- if ( backtracking==0 ) {
- sExpression = new VariableLispAtom( t.getText(), context );
- }
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:676:6: t= STRING
- {
- t=(Token)input.LT(1);
- match(input,STRING,FOLLOW_STRING_in_lisp_atom1391); if (failed) return sExpression;
- if ( backtracking==0 ) {
- sExpression = new StringLispAtom( getString( t ) );
- }
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:677:6: t= FLOAT
- {
- t=(Token)input.LT(1);
- match(input,FLOAT,FOLLOW_FLOAT_in_lisp_atom1413); if (failed) return sExpression;
- if ( backtracking==0 ) {
- sExpression = new FloatLispAtom( t.getText() );
- }
-
- }
- break;
- case 4 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:678:6: t= INT
- {
- t=(Token)input.LT(1);
- match(input,INT,FOLLOW_INT_in_lisp_atom1425); if (failed) return sExpression;
- if ( backtracking==0 ) {
- sExpression = new IntLispAtom( t.getText() );
- }
-
- }
- break;
- case 5 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:679:7: t= BOOL
- {
- t=(Token)input.LT(1);
- match(input,BOOL,FOLLOW_BOOL_in_lisp_atom1438); if (failed) return sExpression;
- if ( backtracking==0 ) {
- sExpression = new BoolLispAtom( t.getText() );
- }
-
- }
- break;
- case 6 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:680:7: t= NULL
- {
- t=(Token)input.LT(1);
- match(input,NULL,FOLLOW_NULL_in_lisp_atom1454); if (failed) return sExpression;
- if ( backtracking==0 ) {
- sExpression = new NullLispAtom( null );
- }
-
- }
- break;
- case 7 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:681:14: t= NAME
- {
- t=(Token)input.LT(1);
- match(input,NAME,FOLLOW_NAME_in_lisp_atom1480); if (failed) return sExpression;
- if ( backtracking==0 ) {
- sExpression = new SymbolLispAtom( "\"" +t.getText() + "\"");
- }
-
- }
- break;
-
- }
-
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return sExpression;
- }
- // $ANTLR end lisp_atom
-
-
- // $ANTLR start literal
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:686:1: literal returns [String text] : (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
- public final String literal() throws RecognitionException {
- String text = null;
-
- Token t=null;
-
-
- text = null;
-
- try {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:690:2: ( (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:690:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
- {
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:690:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
- int alt18=6;
- switch ( input.LA(1) ) {
- case STRING:
- {
- alt18=1;
- }
- break;
- case NAME:
- {
- alt18=2;
- }
- break;
- case INT:
- {
- alt18=3;
- }
- break;
- case FLOAT:
- {
- alt18=4;
- }
- break;
- case BOOL:
- {
- alt18=5;
- }
- break;
- case NULL:
- {
- alt18=6;
- }
- break;
- default:
- if (backtracking>0) {failed=true; return text;}
- NoViableAltException nvae =
- new NoViableAltException("690:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )", 18, 0, input);
-
- throw nvae;
- }
-
- switch (alt18) {
- case 1 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:690:8: t= STRING
- {
- t=(Token)input.LT(1);
- match(input,STRING,FOLLOW_STRING_in_literal1524); if (failed) return text;
- if ( backtracking==0 ) {
- text = getString( t );
- }
-
- }
- break;
- case 2 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:691:7: t= NAME
- {
- t=(Token)input.LT(1);
- match(input,NAME,FOLLOW_NAME_in_literal1537); if (failed) return text;
- if ( backtracking==0 ) {
- text = t.getText();
- }
-
- }
- break;
- case 3 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:692:7: t= INT
- {
- t=(Token)input.LT(1);
- match(input,INT,FOLLOW_INT_in_literal1553); if (failed) return text;
- if ( backtracking==0 ) {
- text = t.getText();
- }
-
- }
- break;
- case 4 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:693:7: t= FLOAT
- {
- t=(Token)input.LT(1);
- match(input,FLOAT,FOLLOW_FLOAT_in_literal1568); if (failed) return text;
- if ( backtracking==0 ) {
- text = t.getText();
- }
-
- }
- break;
- case 5 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:694:7: t= BOOL
- {
- t=(Token)input.LT(1);
- match(input,BOOL,FOLLOW_BOOL_in_literal1581); if (failed) return text;
- if ( backtracking==0 ) {
- text = t.getText();
- }
-
- }
- break;
- case 6 :
- // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\clp\\CLPMVEL.g:695:7: t= NULL
- {
- t=(Token)input.LT(1);
- match(input,NULL,FOLLOW_NULL_in_literal1595); if (failed) return text;
- if ( backtracking==0 ) {
- text = null;
- }
-
- }
- break;
-
- }
-
-
- }
-
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- }
- return text;
- }
- // $ANTLR end literal
-
-
-
-
- public static final BitSet FOLLOW_importDescr_in_eval60 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_deffunction_in_eval71 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_defrule_in_eval84 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_lisp_form_in_eval96 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_importDescr123 = new BitSet(new long[]{0x0000100000000000L});
- public static final BitSet FOLLOW_44_in_importDescr125 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_NAME_in_importDescr129 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_importDescr133 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_deffunction168 = new BitSet(new long[]{0x0000000000000080L});
- public static final BitSet FOLLOW_DEFFUNCTION_in_deffunction178 = new BitSet(new long[]{0x0000000007020A20L});
- public static final BitSet FOLLOW_lisp_atom_in_deffunction188 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_lisp_form_in_deffunction198 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_lisp_form_in_deffunction207 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_deffunction229 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_defrule266 = new BitSet(new long[]{0x0000000000000100L});
- public static final BitSet FOLLOW_DEFRULE_in_defrule274 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_NAME_in_defrule278 = new BitSet(new long[]{0x0000000000000200L});
- public static final BitSet FOLLOW_STRING_in_defrule290 = new BitSet(new long[]{0x0000200000020010L});
- public static final BitSet FOLLOW_ruleAttribute_in_defrule296 = new BitSet(new long[]{0x0000200000020010L});
- public static final BitSet FOLLOW_ce_in_defrule304 = new BitSet(new long[]{0x0000200000020010L});
- public static final BitSet FOLLOW_45_in_defrule313 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_lisp_form_in_defrule322 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_defrule331 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute348 = new BitSet(new long[]{0x0000000020000000L});
- public static final BitSet FOLLOW_DECLARE_in_ruleAttribute350 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute357 = new BitSet(new long[]{0x0000000000000400L});
- public static final BitSet FOLLOW_salience_in_ruleAttribute361 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute365 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute372 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_SALIENCE_in_salience402 = new BitSet(new long[]{0x0000000000000800L});
- public static final BitSet FOLLOW_INT_in_salience406 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_and_ce_in_ce432 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_or_ce_in_ce442 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_not_ce_in_ce451 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_exists_ce_in_ce460 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_eval_ce_in_ce474 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_normal_pattern_in_ce488 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_bound_pattern_in_ce497 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_and_ce524 = new BitSet(new long[]{0x0000000000001000L});
- public static final BitSet FOLLOW_AND_in_and_ce529 = new BitSet(new long[]{0x0000000000020010L});
- public static final BitSet FOLLOW_ce_in_and_ce535 = new BitSet(new long[]{0x0000000000020050L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_and_ce544 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_or_ce572 = new BitSet(new long[]{0x0000000000002000L});
- public static final BitSet FOLLOW_OR_in_or_ce577 = new BitSet(new long[]{0x0000000000020010L});
- public static final BitSet FOLLOW_ce_in_or_ce583 = new BitSet(new long[]{0x0000000000020050L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_or_ce592 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_not_ce620 = new BitSet(new long[]{0x0000000000004000L});
- public static final BitSet FOLLOW_NOT_in_not_ce625 = new BitSet(new long[]{0x0000000000020010L});
- public static final BitSet FOLLOW_ce_in_not_ce631 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_not_ce639 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_exists_ce668 = new BitSet(new long[]{0x0000000000008000L});
- public static final BitSet FOLLOW_EXISTS_in_exists_ce673 = new BitSet(new long[]{0x0000000000020010L});
- public static final BitSet FOLLOW_ce_in_exists_ce679 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_exists_ce687 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_eval_ce706 = new BitSet(new long[]{0x0000000000010000L});
- public static final BitSet FOLLOW_TEST_in_eval_ce711 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_lisp_form_in_eval_ce718 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_eval_ce728 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_normal_pattern756 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_NAME_in_normal_pattern763 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_field_constriant_in_normal_pattern769 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_normal_pattern779 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_VAR_in_bound_pattern807 = new BitSet(new long[]{0x0000000000040000L});
- public static final BitSet FOLLOW_ASSIGN_OP_in_bound_pattern813 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_bound_pattern815 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_NAME_in_bound_pattern819 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_field_constriant_in_bound_pattern828 = new BitSet(new long[]{0x0000000000000050L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_bound_pattern835 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_field_constriant866 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_NAME_in_field_constriant870 = new BitSet(new long[]{0x0000000007E20A20L});
- public static final BitSet FOLLOW_or_restr_connective_in_field_constriant885 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_field_constriant891 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective930 = new BitSet(new long[]{0x0000000000080002L});
- public static final BitSet FOLLOW_PIPE_in_or_restr_connective954 = new BitSet(new long[]{0x0000000007E20A20L});
- public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective964 = new BitSet(new long[]{0x0000000000080002L});
- public static final BitSet FOLLOW_restriction_in_and_restr_connective996 = new BitSet(new long[]{0x0000000000100002L});
- public static final BitSet FOLLOW_AMPERSAND_in_and_restr_connective1004 = new BitSet(new long[]{0x0000000007E20A20L});
- public static final BitSet FOLLOW_restriction_in_and_restr_connective1006 = new BitSet(new long[]{0x0000000000100002L});
- public static final BitSet FOLLOW_TILDE_in_restriction1039 = new BitSet(new long[]{0x0000000007C20A20L});
- public static final BitSet FOLLOW_predicate_constraint_in_restriction1055 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_return_value_restriction_in_restriction1071 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_variable_restriction_in_restriction1080 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_literal_restriction_in_restriction1092 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_COLON_in_predicate_constraint1125 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_lisp_form_in_predicate_constraint1131 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_EQUALS_in_return_value_restriction1150 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_lisp_form_in_return_value_restriction1157 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_VAR_in_variable_restriction1176 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_literal_in_literal_restriction1209 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LEFT_PAREN_in_lisp_form1237 = new BitSet(new long[]{0x0000000000020020L});
- public static final BitSet FOLLOW_NAME_in_lisp_form1254 = new BitSet(new long[]{0x0000000007020A70L});
- public static final BitSet FOLLOW_VAR_in_lisp_form1274 = new BitSet(new long[]{0x0000000007020A70L});
- public static final BitSet FOLLOW_lisp_atom_in_lisp_form1297 = new BitSet(new long[]{0x0000000007020A70L});
- public static final BitSet FOLLOW_lisp_form_in_lisp_form1308 = new BitSet(new long[]{0x0000000007020A70L});
- public static final BitSet FOLLOW_RIGHT_PAREN_in_lisp_form1335 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_VAR_in_lisp_atom1379 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRING_in_lisp_atom1391 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_FLOAT_in_lisp_atom1413 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_INT_in_lisp_atom1425 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_BOOL_in_lisp_atom1438 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_NULL_in_lisp_atom1454 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_NAME_in_lisp_atom1480 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRING_in_literal1524 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_NAME_in_literal1537 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_INT_in_literal1553 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_FLOAT_in_literal1568 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_BOOL_in_literal1581 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_NULL_in_literal1595 = new BitSet(new long[]{0x0000000000000002L});
-
-}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsLexer.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsLexer.java (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsLexer.java 2008-01-29 21:27:34 UTC (rev 18199)
@@ -0,0 +1,2130 @@
+// $ANTLR 3.0.1 C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g 2008-01-29 21:18:01
+
+ package org.drools.clips;
+
+
+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 ClipsLexer extends Lexer {
+ public static final int RIGHT_SQUARE=38;
+ public static final int RIGHT_CURLY=40;
+ public static final int EQUALS=23;
+ public static final int FLOAT=24;
+ public static final int SH_STYLE_SINGLE_LINE_COMMENT=35;
+ public static final int SYMBOL_CHAR=34;
+ public static final int NOT=14;
+ public static final int AND=12;
+ public static final int FIRST_SYMBOL_CHAR=43;
+ public static final int EOF=-1;
+ public static final int HexDigit=31;
+ public static final int DEFFUNCTION=7;
+ public static final int ASSIGN_OP=18;
+ public static final int RIGHT_PAREN=6;
+ public static final int NAME=5;
+ public static final int EOL=27;
+ public static final int DEFRULE=8;
+ public static final int TILDE=21;
+ public static final int PIPE=19;
+ public static final int VAR=17;
+ public static final int EXISTS=15;
+ public static final int SYMBOL=42;
+ public static final int NULL=26;
+ public static final int BOOL=25;
+ public static final int SALIENCE=10;
+ public static final int AMPERSAND=20;
+ public static final int INT=11;
+ public static final int Tokens=46;
+ public static final int MULTI_LINE_COMMENT=41;
+ public static final int T45=45;
+ public static final int T44=44;
+ public static final int COLON=22;
+ public static final int WS=28;
+ public static final int UnicodeEscape=32;
+ public static final int LEFT_CURLY=39;
+ public static final int OR=13;
+ public static final int TEST=16;
+ public static final int LEFT_PAREN=4;
+ public static final int DECLARE=29;
+ public static final int LEFT_SQUARE=37;
+ public static final int EscapeSequence=30;
+ public static final int OctalEscape=33;
+ public static final int C_STYLE_SINGLE_LINE_COMMENT=36;
+ public static final int STRING=9;
+ public ClipsLexer() {;}
+ public ClipsLexer(CharStream input) {
+ super(input);
+ ruleMemo = new HashMap[44+1];
+ }
+ public String getGrammarFileName() { return "C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g"; }
+
+ // $ANTLR start T44
+ public final void mT44() throws RecognitionException {
+ try {
+ int _type = T44;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:6:5: ( 'import' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:6:7: 'import'
+ {
+ match("import"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end T44
+
+ // $ANTLR start T45
+ public final void mT45() throws RecognitionException {
+ try {
+ int _type = T45;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:7:5: ( '=>' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:7:7: '=>'
+ {
+ match("=>"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end T45
+
+ // $ANTLR start WS
+ public final void mWS() throws RecognitionException {
+ try {
+ int _type = WS;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:698:9: ( ( ' ' | '\\t' | '\\f' | EOL ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:698:17: ( ' ' | '\\t' | '\\f' | EOL )
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:698:17: ( ' ' | '\\t' | '\\f' | EOL )
+ int alt1=4;
+ switch ( input.LA(1) ) {
+ case ' ':
+ {
+ alt1=1;
+ }
+ break;
+ case '\t':
+ {
+ alt1=2;
+ }
+ break;
+ case '\f':
+ {
+ alt1=3;
+ }
+ break;
+ case '\n':
+ case '\r':
+ {
+ alt1=4;
+ }
+ break;
+ default:
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("698:17: ( ' ' | '\\t' | '\\f' | EOL )", 1, 0, input);
+
+ throw nvae;
+ }
+
+ switch (alt1) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:698:19: ' '
+ {
+ match(' '); if (failed) return ;
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:699:19: '\\t'
+ {
+ match('\t'); if (failed) return ;
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:700:19: '\\f'
+ {
+ match('\f'); if (failed) return ;
+
+ }
+ break;
+ case 4 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:701:19: EOL
+ {
+ mEOL(); if (failed) return ;
+
+ }
+ break;
+
+ }
+
+ if ( backtracking==0 ) {
+ channel=HIDDEN;
+ }
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end WS
+
+ // $ANTLR start DEFRULE
+ public final void mDEFRULE() throws RecognitionException {
+ try {
+ int _type = DEFRULE;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:706:10: ( 'defrule' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:706:12: 'defrule'
+ {
+ match("defrule"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end DEFRULE
+
+ // $ANTLR start DEFFUNCTION
+ public final void mDEFFUNCTION() throws RecognitionException {
+ try {
+ int _type = DEFFUNCTION;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:707:13: ( 'deffunction' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:707:15: 'deffunction'
+ {
+ match("deffunction"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end DEFFUNCTION
+
+ // $ANTLR start OR
+ public final void mOR() throws RecognitionException {
+ try {
+ int _type = OR;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:708:7: ( 'or' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:708:9: 'or'
+ {
+ match("or"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end OR
+
+ // $ANTLR start AND
+ public final void mAND() throws RecognitionException {
+ try {
+ int _type = AND;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:709:7: ( 'and' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:709:9: 'and'
+ {
+ match("and"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end AND
+
+ // $ANTLR start NOT
+ public final void mNOT() throws RecognitionException {
+ try {
+ int _type = NOT;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:710:7: ( 'not' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:710:9: 'not'
+ {
+ match("not"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end NOT
+
+ // $ANTLR start EXISTS
+ public final void mEXISTS() throws RecognitionException {
+ try {
+ int _type = EXISTS;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:711:10: ( 'exists' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:711:12: 'exists'
+ {
+ match("exists"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end EXISTS
+
+ // $ANTLR start TEST
+ public final void mTEST() throws RecognitionException {
+ try {
+ int _type = TEST;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:712:8: ( 'test' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:712:10: 'test'
+ {
+ match("test"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end TEST
+
+ // $ANTLR start NULL
+ public final void mNULL() throws RecognitionException {
+ try {
+ int _type = NULL;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:714:7: ( 'null' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:714:9: 'null'
+ {
+ match("null"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end NULL
+
+ // $ANTLR start DECLARE
+ public final void mDECLARE() throws RecognitionException {
+ try {
+ int _type = DECLARE;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:716:10: ( 'declare' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:716:12: 'declare'
+ {
+ match("declare"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end DECLARE
+
+ // $ANTLR start SALIENCE
+ public final void mSALIENCE() throws RecognitionException {
+ try {
+ int _type = SALIENCE;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:718:10: ( 'salience' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:718:12: 'salience'
+ {
+ match("salience"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end SALIENCE
+
+ // $ANTLR start EOL
+ public final void mEOL() throws RecognitionException {
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:723:6: ( ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724: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("724:6: ( ( '\\r\\n' )=> '\\r\\n' | '\\r' | '\\n' )", 2, 0, input);
+
+ throw nvae;
+ }
+ switch (alt2) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724:14: ( '\\r\\n' )=> '\\r\\n'
+ {
+ match("\r\n"); if (failed) return ;
+
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:725:25: '\\r'
+ {
+ match('\r'); if (failed) return ;
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:726:25: '\\n'
+ {
+ match('\n'); if (failed) return ;
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ }
+ finally {
+ }
+ }
+ // $ANTLR end EOL
+
+ // $ANTLR start INT
+ public final void mINT() throws RecognitionException {
+ try {
+ int _type = INT;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:2: ( ( '-' )? ( '0' .. '9' )+ )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:4: ( '-' )? ( '0' .. '9' )+
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:4: ( '-' )?
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+
+ if ( (LA3_0=='-') ) {
+ alt3=1;
+ }
+ switch (alt3) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:5: '-'
+ {
+ match('-'); if (failed) return ;
+
+ }
+ break;
+
+ }
+
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:10: ( '0' .. '9' )+
+ int cnt4=0;
+ loop4:
+ do {
+ int alt4=2;
+ int LA4_0 = input.LA(1);
+
+ if ( ((LA4_0>='0' && LA4_0<='9')) ) {
+ alt4=1;
+ }
+
+
+ switch (alt4) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:731:11: '0' .. '9'
+ {
+ matchRange('0','9'); 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 INT
+
+ // $ANTLR start FLOAT
+ public final void mFLOAT() throws RecognitionException {
+ try {
+ int _type = FLOAT;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:2: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:4: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:4: ( '-' )?
+ int alt5=2;
+ int LA5_0 = input.LA(1);
+
+ if ( (LA5_0=='-') ) {
+ alt5=1;
+ }
+ switch (alt5) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:5: '-'
+ {
+ match('-'); if (failed) return ;
+
+ }
+ break;
+
+ }
+
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:10: ( '0' .. '9' )+
+ int cnt6=0;
+ loop6:
+ do {
+ int alt6=2;
+ int LA6_0 = input.LA(1);
+
+ if ( ((LA6_0>='0' && LA6_0<='9')) ) {
+ alt6=1;
+ }
+
+
+ switch (alt6) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:11: '0' .. '9'
+ {
+ matchRange('0','9'); if (failed) return ;
+
+ }
+ break;
+
+ default :
+ if ( cnt6 >= 1 ) break loop6;
+ if (backtracking>0) {failed=true; return ;}
+ EarlyExitException eee =
+ new EarlyExitException(6, input);
+ throw eee;
+ }
+ cnt6++;
+ } while (true);
+
+ match('.'); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:26: ( '0' .. '9' )+
+ int cnt7=0;
+ loop7:
+ do {
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+
+ if ( ((LA7_0>='0' && LA7_0<='9')) ) {
+ alt7=1;
+ }
+
+
+ switch (alt7) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:735:27: '0' .. '9'
+ {
+ matchRange('0','9'); if (failed) return ;
+
+ }
+ break;
+
+ default :
+ if ( cnt7 >= 1 ) break loop7;
+ if (backtracking>0) {failed=true; return ;}
+ EarlyExitException eee =
+ new EarlyExitException(7, input);
+ throw eee;
+ }
+ cnt7++;
+ } while (true);
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end FLOAT
+
+ // $ANTLR start STRING
+ public final void mSTRING() throws RecognitionException {
+ try {
+ int _type = STRING;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:5: ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) )
+ int alt10=2;
+ int LA10_0 = input.LA(1);
+
+ if ( (LA10_0=='\"') ) {
+ alt10=1;
+ }
+ else if ( (LA10_0=='\'') ) {
+ alt10=2;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("738:1: STRING : ( ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) | ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' ) );", 10, 0, input);
+
+ throw nvae;
+ }
+ switch (alt10) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:8: ( '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:9: '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
+ {
+ match('\"'); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:13: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
+ loop8:
+ do {
+ int alt8=3;
+ int LA8_0 = input.LA(1);
+
+ if ( (LA8_0=='\\') ) {
+ alt8=1;
+ }
+ else if ( ((LA8_0>='\u0000' && LA8_0<='!')||(LA8_0>='#' && LA8_0<='[')||(LA8_0>=']' && LA8_0<='\uFFFE')) ) {
+ alt8=2;
+ }
+
+
+ switch (alt8) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:15: EscapeSequence
+ {
+ mEscapeSequence(); if (failed) return ;
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:739:32: ~ ( '\\\\' | '\"' )
+ {
+ if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
+ input.consume();
+ failed=false;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ MismatchedSetException mse =
+ new MismatchedSetException(null,input);
+ recover(mse); throw mse;
+ }
+
+
+ }
+ break;
+
+ default :
+ break loop8;
+ }
+ } while (true);
+
+ match('\"'); if (failed) return ;
+
+ }
+
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:8: ( '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\'' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:9: '\\'' ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )* '\\''
+ {
+ match('\''); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:14: ( EscapeSequence | ~ ( '\\\\' | '\\'' ) )*
+ loop9:
+ do {
+ int alt9=3;
+ int LA9_0 = input.LA(1);
+
+ if ( (LA9_0=='\\') ) {
+ alt9=1;
+ }
+ else if ( ((LA9_0>='\u0000' && LA9_0<='&')||(LA9_0>='(' && LA9_0<='[')||(LA9_0>=']' && LA9_0<='\uFFFE')) ) {
+ alt9=2;
+ }
+
+
+ switch (alt9) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:16: EscapeSequence
+ {
+ mEscapeSequence(); if (failed) return ;
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:740:33: ~ ( '\\\\' | '\\'' )
+ {
+ if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
+ input.consume();
+ failed=false;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ MismatchedSetException mse =
+ new MismatchedSetException(null,input);
+ recover(mse); throw mse;
+ }
+
+
+ }
+ break;
+
+ default :
+ break loop9;
+ }
+ } while (true);
+
+ match('\''); if (failed) return ;
+
+ }
+
+
+ }
+ break;
+
+ }
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end STRING
+
+ // $ANTLR start HexDigit
+ public final void mHexDigit() throws RecognitionException {
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:744:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:744:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )
+ {
+ if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||(input.LA(1)>='a' && input.LA(1)<='f') ) {
+ input.consume();
+ failed=false;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ MismatchedSetException mse =
+ new MismatchedSetException(null,input);
+ recover(mse); throw mse;
+ }
+
+
+ }
+
+ }
+ finally {
+ }
+ }
+ // $ANTLR end HexDigit
+
+ // $ANTLR start EscapeSequence
+ public final void mEscapeSequence() throws RecognitionException {
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:748:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape )
+ int alt11=3;
+ int LA11_0 = input.LA(1);
+
+ if ( (LA11_0=='\\') ) {
+ switch ( input.LA(2) ) {
+ case '\"':
+ case '\'':
+ case '\\':
+ case 'b':
+ case 'f':
+ case 'n':
+ case 'r':
+ case 't':
+ {
+ alt11=1;
+ }
+ break;
+ case 'u':
+ {
+ alt11=2;
+ }
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ alt11=3;
+ }
+ break;
+ default:
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("746:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 11, 1, input);
+
+ throw nvae;
+ }
+
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("746:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UnicodeEscape | OctalEscape );", 11, 0, input);
+
+ throw nvae;
+ }
+ switch (alt11) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:748:9: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' )
+ {
+ match('\\'); if (failed) return ;
+ if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) {
+ input.consume();
+ failed=false;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ MismatchedSetException mse =
+ new MismatchedSetException(null,input);
+ recover(mse); throw mse;
+ }
+
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:749:9: UnicodeEscape
+ {
+ mUnicodeEscape(); if (failed) return ;
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:750:9: OctalEscape
+ {
+ mOctalEscape(); if (failed) return ;
+
+ }
+ break;
+
+ }
+ }
+ finally {
+ }
+ }
+ // $ANTLR end EscapeSequence
+
+ // $ANTLR start OctalEscape
+ public final void mOctalEscape() throws RecognitionException {
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
+ int alt12=3;
+ int LA12_0 = input.LA(1);
+
+ if ( (LA12_0=='\\') ) {
+ int LA12_1 = input.LA(2);
+
+ if ( ((LA12_1>='0' && LA12_1<='3')) ) {
+ int LA12_2 = input.LA(3);
+
+ if ( ((LA12_2>='0' && LA12_2<='7')) ) {
+ int LA12_4 = input.LA(4);
+
+ if ( ((LA12_4>='0' && LA12_4<='7')) ) {
+ alt12=1;
+ }
+ else {
+ alt12=2;}
+ }
+ else {
+ alt12=3;}
+ }
+ else if ( ((LA12_1>='4' && LA12_1<='7')) ) {
+ int LA12_3 = input.LA(3);
+
+ if ( ((LA12_3>='0' && LA12_3<='7')) ) {
+ alt12=2;
+ }
+ else {
+ alt12=3;}
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("753:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 1, input);
+
+ throw nvae;
+ }
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("753:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 12, 0, input);
+
+ throw nvae;
+ }
+ switch (alt12) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+ {
+ match('\\'); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:14: ( '0' .. '3' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:15: '0' .. '3'
+ {
+ matchRange('0','3'); if (failed) return ;
+
+ }
+
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:25: ( '0' .. '7' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:26: '0' .. '7'
+ {
+ matchRange('0','7'); if (failed) return ;
+
+ }
+
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:36: ( '0' .. '7' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:755:37: '0' .. '7'
+ {
+ matchRange('0','7'); if (failed) return ;
+
+ }
+
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
+ {
+ match('\\'); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:14: ( '0' .. '7' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:15: '0' .. '7'
+ {
+ matchRange('0','7'); if (failed) return ;
+
+ }
+
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:25: ( '0' .. '7' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:756:26: '0' .. '7'
+ {
+ matchRange('0','7'); if (failed) return ;
+
+ }
+
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:757:9: '\\\\' ( '0' .. '7' )
+ {
+ match('\\'); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:757:14: ( '0' .. '7' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:757:15: '0' .. '7'
+ {
+ matchRange('0','7'); if (failed) return ;
+
+ }
+
+
+ }
+ break;
+
+ }
+ }
+ finally {
+ }
+ }
+ // $ANTLR end OctalEscape
+
+ // $ANTLR start UnicodeEscape
+ public final void mUnicodeEscape() throws RecognitionException {
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:762:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
+ {
+ match('\\'); if (failed) return ;
+ match('u'); if (failed) return ;
+ mHexDigit(); if (failed) return ;
+ mHexDigit(); if (failed) return ;
+ mHexDigit(); if (failed) return ;
+ mHexDigit(); if (failed) return ;
+
+ }
+
+ }
+ finally {
+ }
+ }
+ // $ANTLR end UnicodeEscape
+
+ // $ANTLR start BOOL
+ public final void mBOOL() throws RecognitionException {
+ try {
+ int _type = BOOL;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:2: ( ( 'true' | 'false' ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:4: ( 'true' | 'false' )
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:4: ( 'true' | 'false' )
+ int alt13=2;
+ int LA13_0 = input.LA(1);
+
+ if ( (LA13_0=='t') ) {
+ alt13=1;
+ }
+ else if ( (LA13_0=='f') ) {
+ alt13=2;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("766:4: ( 'true' | 'false' )", 13, 0, input);
+
+ throw nvae;
+ }
+ switch (alt13) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:5: 'true'
+ {
+ match("true"); if (failed) return ;
+
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:766:12: 'false'
+ {
+ match("false"); if (failed) return ;
+
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end BOOL
+
+ // $ANTLR start VAR
+ public final void mVAR() throws RecognitionException {
+ try {
+ int _type = VAR;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:6: ( '?' ( SYMBOL_CHAR )+ )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:8: '?' ( SYMBOL_CHAR )+
+ {
+ match('?'); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:12: ( SYMBOL_CHAR )+
+ int cnt14=0;
+ loop14:
+ do {
+ int alt14=2;
+ int LA14_0 = input.LA(1);
+
+ if ( (LA14_0=='!'||(LA14_0>='#' && LA14_0<='%')||(LA14_0>='*' && LA14_0<=':')||(LA14_0>='=' && LA14_0<='_')||(LA14_0>='a' && LA14_0<='{')||LA14_0=='}') ) {
+ alt14=1;
+ }
+
+
+ switch (alt14) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:769:12: SYMBOL_CHAR
+ {
+ mSYMBOL_CHAR(); if (failed) return ;
+
+ }
+ break;
+
+ default :
+ if ( cnt14 >= 1 ) break loop14;
+ if (backtracking>0) {failed=true; return ;}
+ EarlyExitException eee =
+ new EarlyExitException(14, input);
+ throw eee;
+ }
+ cnt14++;
+ } while (true);
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end VAR
+
+ // $ANTLR start SH_STYLE_SINGLE_LINE_COMMENT
+ public final void mSH_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
+ try {
+ int _type = SH_STYLE_SINGLE_LINE_COMMENT;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:2: ( '#' ( options {greedy=false; } : . )* EOL )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:4: '#' ( options {greedy=false; } : . )* EOL
+ {
+ match('#'); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:8: ( options {greedy=false; } : . )*
+ loop15:
+ do {
+ int alt15=2;
+ int LA15_0 = input.LA(1);
+
+ if ( (LA15_0=='\r') ) {
+ alt15=2;
+ }
+ else if ( (LA15_0=='\n') ) {
+ alt15=2;
+ }
+ else if ( ((LA15_0>='\u0000' && LA15_0<='\t')||(LA15_0>='\u000B' && LA15_0<='\f')||(LA15_0>='\u000E' && LA15_0<='\uFFFE')) ) {
+ alt15=1;
+ }
+
+
+ switch (alt15) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:773:35: .
+ {
+ matchAny(); if (failed) return ;
+
+ }
+ break;
+
+ default :
+ break loop15;
+ }
+ } while (true);
+
+ mEOL(); if (failed) return ;
+ if ( backtracking==0 ) {
+ channel=HIDDEN;
+ }
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end SH_STYLE_SINGLE_LINE_COMMENT
+
+ // $ANTLR start C_STYLE_SINGLE_LINE_COMMENT
+ public final void mC_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
+ try {
+ int _type = C_STYLE_SINGLE_LINE_COMMENT;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:779:2: ( '//' ( options {greedy=false; } : . )* EOL )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:779:4: '//' ( options {greedy=false; } : . )* EOL
+ {
+ match("//"); if (failed) return ;
+
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:779:9: ( options {greedy=false; } : . )*
+ loop16:
+ do {
+ int alt16=2;
+ int LA16_0 = input.LA(1);
+
+ if ( (LA16_0=='\r') ) {
+ alt16=2;
+ }
+ else if ( (LA16_0=='\n') ) {
+ alt16=2;
+ }
+ else if ( ((LA16_0>='\u0000' && LA16_0<='\t')||(LA16_0>='\u000B' && LA16_0<='\f')||(LA16_0>='\u000E' && LA16_0<='\uFFFE')) ) {
+ alt16=1;
+ }
+
+
+ switch (alt16) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:779:36: .
+ {
+ matchAny(); if (failed) return ;
+
+ }
+ break;
+
+ default :
+ break loop16;
+ }
+ } while (true);
+
+ mEOL(); if (failed) return ;
+ if ( backtracking==0 ) {
+ channel=HIDDEN;
+ }
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end C_STYLE_SINGLE_LINE_COMMENT
+
+ // $ANTLR start LEFT_PAREN
+ public final void mLEFT_PAREN() throws RecognitionException {
+ try {
+ int _type = LEFT_PAREN;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:785:2: ( '(' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:785:4: '('
+ {
+ match('('); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end LEFT_PAREN
+
+ // $ANTLR start RIGHT_PAREN
+ public final void mRIGHT_PAREN() throws RecognitionException {
+ try {
+ int _type = RIGHT_PAREN;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:789:2: ( ')' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:789:4: ')'
+ {
+ match(')'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end RIGHT_PAREN
+
+ // $ANTLR start LEFT_SQUARE
+ public final void mLEFT_SQUARE() throws RecognitionException {
+ try {
+ int _type = LEFT_SQUARE;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:793:2: ( '[' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:793:4: '['
+ {
+ 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;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:797:2: ( ']' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:797:4: ']'
+ {
+ 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;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:801:2: ( '{' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:801:4: '{'
+ {
+ 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;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:805:2: ( '}' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:805:4: '}'
+ {
+ match('}'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end RIGHT_CURLY
+
+ // $ANTLR start TILDE
+ public final void mTILDE() throws RecognitionException {
+ try {
+ int _type = TILDE;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:808:7: ( '~' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:808:9: '~'
+ {
+ match('~'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end TILDE
+
+ // $ANTLR start AMPERSAND
+ public final void mAMPERSAND() throws RecognitionException {
+ try {
+ int _type = AMPERSAND;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:812:2: ( '&' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:812:4: '&'
+ {
+ match('&'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end AMPERSAND
+
+ // $ANTLR start PIPE
+ public final void mPIPE() throws RecognitionException {
+ try {
+ int _type = PIPE;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:816:2: ( '|' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:816:4: '|'
+ {
+ match('|'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end PIPE
+
+ // $ANTLR start ASSIGN_OP
+ public final void mASSIGN_OP() throws RecognitionException {
+ try {
+ int _type = ASSIGN_OP;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:820:2: ( '<-' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:820:4: '<-'
+ {
+ match("<-"); if (failed) return ;
+
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end ASSIGN_OP
+
+ // $ANTLR start COLON
+ public final void mCOLON() throws RecognitionException {
+ try {
+ int _type = COLON;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:823:7: ( ':' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:823:9: ':'
+ {
+ match(':'); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end COLON
+
+ // $ANTLR start EQUALS
+ public final void mEQUALS() throws RecognitionException {
+ try {
+ int _type = EQUALS;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:825:8: ( '=' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:825:10: '='
+ {
+ match('='); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end EQUALS
+
+ // $ANTLR start MULTI_LINE_COMMENT
+ public final void mMULTI_LINE_COMMENT() throws RecognitionException {
+ try {
+ int _type = MULTI_LINE_COMMENT;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:828:2: ( '/*' ( options {greedy=false; } : . )* '*/' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:828:4: '/*' ( options {greedy=false; } : . )* '*/'
+ {
+ match("/*"); if (failed) return ;
+
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:828:9: ( options {greedy=false; } : . )*
+ loop17:
+ do {
+ int alt17=2;
+ int LA17_0 = input.LA(1);
+
+ if ( (LA17_0=='*') ) {
+ int LA17_1 = input.LA(2);
+
+ if ( (LA17_1=='/') ) {
+ alt17=2;
+ }
+ else if ( ((LA17_1>='\u0000' && LA17_1<='.')||(LA17_1>='0' && LA17_1<='\uFFFE')) ) {
+ alt17=1;
+ }
+
+
+ }
+ else if ( ((LA17_0>='\u0000' && LA17_0<=')')||(LA17_0>='+' && LA17_0<='\uFFFE')) ) {
+ alt17=1;
+ }
+
+
+ switch (alt17) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:828:35: .
+ {
+ matchAny(); if (failed) return ;
+
+ }
+ break;
+
+ default :
+ break loop17;
+ }
+ } while (true);
+
+ match("*/"); if (failed) return ;
+
+ if ( backtracking==0 ) {
+ channel=HIDDEN;
+ }
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end MULTI_LINE_COMMENT
+
+ // $ANTLR start NAME
+ public final void mNAME() throws RecognitionException {
+ try {
+ int _type = NAME;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:832:6: ( SYMBOL )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:832:8: SYMBOL
+ {
+ mSYMBOL(); if (failed) return ;
+
+ }
+
+ this.type = _type;
+ }
+ finally {
+ }
+ }
+ // $ANTLR end NAME
+
+ // $ANTLR start SYMBOL
+ public final void mSYMBOL() throws RecognitionException {
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:8: ( FIRST_SYMBOL_CHAR ( SYMBOL_CHAR )* )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:10: FIRST_SYMBOL_CHAR ( SYMBOL_CHAR )*
+ {
+ mFIRST_SYMBOL_CHAR(); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:28: ( SYMBOL_CHAR )*
+ loop18:
+ do {
+ int alt18=2;
+ int LA18_0 = input.LA(1);
+
+ if ( (LA18_0=='!'||(LA18_0>='#' && LA18_0<='%')||(LA18_0>='*' && LA18_0<=':')||(LA18_0>='=' && LA18_0<='_')||(LA18_0>='a' && LA18_0<='{')||LA18_0=='}') ) {
+ alt18=1;
+ }
+
+
+ switch (alt18) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:835:28: SYMBOL_CHAR
+ {
+ mSYMBOL_CHAR(); if (failed) return ;
+
+ }
+ break;
+
+ default :
+ break loop18;
+ }
+ } while (true);
+
+
+ }
+
+ }
+ finally {
+ }
+ }
+ // $ANTLR end SYMBOL
+
+ // $ANTLR start FIRST_SYMBOL_CHAR
+ public final void mFIRST_SYMBOL_CHAR() throws RecognitionException {
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:840:19: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | '<' | ',' | '.' | '[' | ']' | '{' | '}' ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:840:21: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | '<' | ',' | '.' | '[' | ']' | '{' | '}' )
+ {
+ 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)>='a' && 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 FIRST_SYMBOL_CHAR
+
+ // $ANTLR start SYMBOL_CHAR
+ public final void mSYMBOL_CHAR() throws RecognitionException {
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:845:13: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | ',' | '.' | '[' | ']' | '{' | '}' | '?' ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:845:15: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '!' | '$' | '%' | '^' | '*' | '_' | '-' | '+' | '=' | '\\\\' | '/' | '@' | '#' | ':' | '>' | ',' | '.' | '[' | ']' | '{' | '}' | '?' )
+ {
+ 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)>='a' && 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 SYMBOL_CHAR
+
+ public void mTokens() throws RecognitionException {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:8: ( T44 | T45 | WS | DEFRULE | DEFFUNCTION | OR | AND | NOT | EXISTS | TEST | NULL | DECLARE | SALIENCE | INT | FLOAT | STRING | BOOL | VAR | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | TILDE | AMPERSAND | PIPE | ASSIGN_OP | COLON | EQUALS | MULTI_LINE_COMMENT | NAME )
+ int alt19=34;
+ alt19 = dfa19.predict(input);
+ switch (alt19) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:10: T44
+ {
+ mT44(); if (failed) return ;
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:14: T45
+ {
+ mT45(); if (failed) return ;
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:18: WS
+ {
+ mWS(); if (failed) return ;
+
+ }
+ break;
+ case 4 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:21: DEFRULE
+ {
+ mDEFRULE(); if (failed) return ;
+
+ }
+ break;
+ case 5 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:29: DEFFUNCTION
+ {
+ mDEFFUNCTION(); if (failed) return ;
+
+ }
+ break;
+ case 6 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:41: OR
+ {
+ mOR(); if (failed) return ;
+
+ }
+ break;
+ case 7 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:44: AND
+ {
+ mAND(); if (failed) return ;
+
+ }
+ break;
+ case 8 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:48: NOT
+ {
+ mNOT(); if (failed) return ;
+
+ }
+ break;
+ case 9 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:52: EXISTS
+ {
+ mEXISTS(); if (failed) return ;
+
+ }
+ break;
+ case 10 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:59: TEST
+ {
+ mTEST(); if (failed) return ;
+
+ }
+ break;
+ case 11 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:64: NULL
+ {
+ mNULL(); if (failed) return ;
+
+ }
+ break;
+ case 12 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:69: DECLARE
+ {
+ mDECLARE(); if (failed) return ;
+
+ }
+ break;
+ case 13 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:77: SALIENCE
+ {
+ mSALIENCE(); if (failed) return ;
+
+ }
+ break;
+ case 14 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:86: INT
+ {
+ mINT(); if (failed) return ;
+
+ }
+ break;
+ case 15 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:90: FLOAT
+ {
+ mFLOAT(); if (failed) return ;
+
+ }
+ break;
+ case 16 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:96: STRING
+ {
+ mSTRING(); if (failed) return ;
+
+ }
+ break;
+ case 17 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:103: BOOL
+ {
+ mBOOL(); if (failed) return ;
+
+ }
+ break;
+ case 18 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:108: VAR
+ {
+ mVAR(); if (failed) return ;
+
+ }
+ break;
+ case 19 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:112: SH_STYLE_SINGLE_LINE_COMMENT
+ {
+ mSH_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
+
+ }
+ break;
+ case 20 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:141: C_STYLE_SINGLE_LINE_COMMENT
+ {
+ mC_STYLE_SINGLE_LINE_COMMENT(); if (failed) return ;
+
+ }
+ break;
+ case 21 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:169: LEFT_PAREN
+ {
+ mLEFT_PAREN(); if (failed) return ;
+
+ }
+ break;
+ case 22 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:180: RIGHT_PAREN
+ {
+ mRIGHT_PAREN(); if (failed) return ;
+
+ }
+ break;
+ case 23 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:192: LEFT_SQUARE
+ {
+ mLEFT_SQUARE(); if (failed) return ;
+
+ }
+ break;
+ case 24 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:204: RIGHT_SQUARE
+ {
+ mRIGHT_SQUARE(); if (failed) return ;
+
+ }
+ break;
+ case 25 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:217: LEFT_CURLY
+ {
+ mLEFT_CURLY(); if (failed) return ;
+
+ }
+ break;
+ case 26 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:228: RIGHT_CURLY
+ {
+ mRIGHT_CURLY(); if (failed) return ;
+
+ }
+ break;
+ case 27 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:240: TILDE
+ {
+ mTILDE(); if (failed) return ;
+
+ }
+ break;
+ case 28 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:246: AMPERSAND
+ {
+ mAMPERSAND(); if (failed) return ;
+
+ }
+ break;
+ case 29 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:256: PIPE
+ {
+ mPIPE(); if (failed) return ;
+
+ }
+ break;
+ case 30 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:261: ASSIGN_OP
+ {
+ mASSIGN_OP(); if (failed) return ;
+
+ }
+ break;
+ case 31 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:271: COLON
+ {
+ mCOLON(); if (failed) return ;
+
+ }
+ break;
+ case 32 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:277: EQUALS
+ {
+ mEQUALS(); if (failed) return ;
+
+ }
+ break;
+ case 33 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:284: MULTI_LINE_COMMENT
+ {
+ mMULTI_LINE_COMMENT(); if (failed) return ;
+
+ }
+ break;
+ case 34 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:1:303: NAME
+ {
+ mNAME(); if (failed) return ;
+
+ }
+ break;
+
+ }
+
+ }
+
+ // $ANTLR start synpred1
+ public final void synpred1_fragment() throws RecognitionException {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724:14: ( '\\r\\n' )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:724: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;
+ }
+
+
+ protected DFA19 dfa19 = new DFA19(this);
+ static final String DFA19_eotS =
+ "\1\uffff\1\35\1\40\1\uffff\10\35\1\54\1\uffff\1\35\1\uffff\2\35"+
+ "\2\uffff\1\62\1\63\1\64\1\65\3\uffff\1\35\1\67\1\uffff\1\35\1\71"+
+ "\1\uffff\1\35\1\74\7\35\1\54\1\35\1\uffff\2\35\1\uffff\2\35\4\uffff"+
+ "\1\113\1\uffff\1\35\1\uffff\2\35\1\uffff\1\120\1\35\1\122\4\35\1"+
+ "\127\2\35\1\uffff\1\35\1\uffff\1\35\1\uffff\4\35\1\uffff\1\136\1"+
+ "\uffff\1\35\1\140\1\141\1\35\1\uffff\1\35\1\111\4\35\1\uffff\1\35"+
+ "\2\uffff\1\35\1\140\1\152\3\35\1\156\1\35\1\uffff\1\35\1\161\1\162"+
+ "\1\uffff\2\35\2\uffff\1\165\1\35\1\uffff\1\35\1\170\1\uffff";
+ static final String DFA19_eofS =
+ "\171\uffff";
+ static final String DFA19_minS =
+ "\1\11\1\155\1\41\1\uffff\1\145\1\162\1\156\1\157\1\170\1\145\1\141"+
+ "\1\60\1\41\1\uffff\1\141\1\uffff\1\0\1\52\2\uffff\4\41\3\uffff\1"+
+ "\55\1\41\1\uffff\1\160\1\41\1\uffff\1\143\1\41\1\144\1\154\1\164"+
+ "\1\151\1\165\1\163\1\154\1\41\1\60\1\uffff\1\154\1\0\1\uffff\2\0"+
+ "\4\uffff\1\41\1\uffff\1\157\1\uffff\1\146\1\154\1\uffff\1\41\1\154"+
+ "\1\41\1\163\1\145\1\164\1\151\1\41\1\163\1\0\1\uffff\1\0\1\uffff"+
+ "\1\0\1\uffff\1\162\2\165\1\141\1\uffff\1\41\1\uffff\1\164\2\41\1"+
+ "\145\1\uffff\1\145\1\41\1\164\1\156\1\154\1\162\1\uffff\1\163\2"+
+ "\uffff\1\156\2\41\1\143\2\145\1\41\1\143\1\uffff\1\164\2\41\1\uffff"+
+ "\1\145\1\151\2\uffff\1\41\1\157\1\uffff\1\156\1\41\1\uffff";
+ static final String DFA19_maxS =
+ "\1\176\1\155\1\175\1\uffff\1\145\1\162\1\156\1\165\1\170\1\162\1"+
+ "\141\1\71\1\175\1\uffff\1\141\1\uffff\1\ufffe\1\57\2\uffff\4\175"+
+ "\3\uffff\1\55\1\175\1\uffff\1\160\1\175\1\uffff\1\146\1\175\1\144"+
+ "\1\154\1\164\1\151\1\165\1\163\1\154\1\175\1\71\1\uffff\1\154\1"+
+ "\ufffe\1\uffff\2\ufffe\4\uffff\1\175\1\uffff\1\157\1\uffff\1\162"+
+ "\1\154\1\uffff\1\175\1\154\1\175\1\163\1\145\1\164\1\151\1\175\1"+
+ "\163\1\ufffe\1\uffff\1\ufffe\1\uffff\1\ufffe\1\uffff\1\162\2\165"+
+ "\1\141\1\uffff\1\175\1\uffff\1\164\2\175\1\145\1\uffff\1\145\1\175"+
+ "\1\164\1\156\1\154\1\162\1\uffff\1\163\2\uffff\1\156\2\175\1\143"+
+ "\2\145\1\175\1\143\1\uffff\1\164\2\175\1\uffff\1\145\1\151\2\uffff"+
+ "\1\175\1\157\1\uffff\1\156\1\175\1\uffff";
+ static final String DFA19_acceptS =
+ "\3\uffff\1\3\11\uffff\1\20\1\uffff\1\22\2\uffff\1\25\1\26\4\uffff"+
+ "\1\33\1\34\1\35\2\uffff\1\42\2\uffff\1\40\13\uffff\1\16\2\uffff"+
+ "\1\23\2\uffff\1\27\1\30\1\31\1\32\1\uffff\1\37\1\uffff\1\2\2\uffff"+
+ "\1\6\12\uffff\1\24\1\uffff\1\41\1\uffff\1\36\4\uffff\1\7\1\uffff"+
+ "\1\10\4\uffff\1\17\6\uffff\1\13\1\uffff\1\21\1\12\10\uffff\1\1\3"+
+ "\uffff\1\11\2\uffff\1\4\1\14\2\uffff\1\15\2\uffff\1\5";
+ static final String DFA19_specialS =
+ "\171\uffff}>";
+ static final String[] DFA19_transitionS = {
+ "\2\3\1\uffff\2\3\22\uffff\1\3\1\35\1\15\1\20\2\35\1\31\1\15"+
+ "\1\22\1\23\3\35\1\13\1\35\1\21\12\14\1\34\1\uffff\1\33\1\2\1"+
+ "\35\1\17\33\35\1\24\1\35\1\25\2\35\1\uffff\1\6\2\35\1\4\1\10"+
+ "\1\16\2\35\1\1\4\35\1\7\1\5\3\35\1\12\1\11\6\35\1\26\1\32\1"+
+ "\27\1\30",
+ "\1\36",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\1\35\1\37\41\35\1\uffff"+
+ "\33\35\1\uffff\1\35",
+ "",
+ "\1\41",
+ "\1\42",
+ "\1\43",
+ "\1\45\5\uffff\1\44",
+ "\1\46",
+ "\1\50\14\uffff\1\47",
+ "\1\51",
+ "\12\52",
+ "\1\35\1\uffff\3\35\4\uffff\4\35\1\53\1\35\12\52\1\35\2\uffff"+
+ "\43\35\1\uffff\33\35\1\uffff\1\35",
+ "",
+ "\1\55",
+ "",
+ "\41\57\1\56\1\57\3\56\4\57\21\56\2\57\43\56\1\57\33\56\1\57"+
+ "\1\56\uff81\57",
+ "\1\61\4\uffff\1\60",
+ "",
+ "",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "",
+ "",
+ "",
+ "\1\66",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "",
+ "\1\70",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "",
+ "\1\73\2\uffff\1\72",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\75",
+ "\1\76",
+ "\1\77",
+ "\1\100",
+ "\1\101",
+ "\1\102",
+ "\1\103",
+ "\1\35\1\uffff\3\35\4\uffff\4\35\1\53\1\35\12\52\1\35\2\uffff"+
+ "\43\35\1\uffff\33\35\1\uffff\1\35",
+ "\12\104",
+ "",
+ "\1\105",
+ "\41\57\1\56\1\57\3\56\4\57\21\56\2\57\43\56\1\57\33\56\1\57"+
+ "\1\56\uff81\57",
+ "",
+ "\41\107\1\106\1\107\3\106\4\107\21\106\2\107\43\106\1\107\33"+
+ "\106\1\107\1\106\uff81\107",
+ "\41\111\1\112\1\111\3\112\4\111\1\110\20\112\2\111\43\112\1"+
+ "\111\33\112\1\111\1\112\uff81\111",
+ "",
+ "",
+ "",
+ "",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "",
+ "\1\114",
+ "",
+ "\1\115\13\uffff\1\116",
+ "\1\117",
+ "",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\121",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\123",
+ "\1\124",
+ "\1\125",
+ "\1\126",
+ "\1\35\1\uffff\3\35\4\uffff\6\35\12\104\1\35\2\uffff\43\35\1"+
+ "\uffff\33\35\1\uffff\1\35",
+ "\1\130",
+ "\41\107\1\106\1\107\3\106\4\107\21\106\2\107\43\106\1\107\33"+
+ "\106\1\107\1\106\uff81\107",
+ "",
+ "\41\111\1\112\1\111\3\112\4\111\1\110\4\112\1\131\13\112\2\111"+
+ "\43\112\1\111\33\112\1\111\1\112\uff81\111",
+ "",
+ "\41\111\1\112\1\111\3\112\4\111\1\110\20\112\2\111\43\112\1"+
+ "\111\33\112\1\111\1\112\uff81\111",
+ "",
+ "\1\132",
+ "\1\133",
+ "\1\134",
+ "\1\135",
+ "",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "",
+ "\1\137",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\142",
+ "",
+ "\1\143",
+ "\1\112\1\uffff\3\112\4\uffff\1\110\20\112\2\uffff\43\112\1\uffff"+
+ "\33\112\1\uffff\1\112",
+ "\1\144",
+ "\1\145",
+ "\1\146",
+ "\1\147",
+ "",
+ "\1\150",
+ "",
+ "",
+ "\1\151",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\153",
+ "\1\154",
+ "\1\155",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\157",
+ "",
+ "\1\160",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "",
+ "\1\163",
+ "\1\164",
+ "",
+ "",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ "\1\166",
+ "",
+ "\1\167",
+ "\1\35\1\uffff\3\35\4\uffff\21\35\2\uffff\43\35\1\uffff\33\35"+
+ "\1\uffff\1\35",
+ ""
+ };
+
+ static final short[] DFA19_eot = DFA.unpackEncodedString(DFA19_eotS);
+ static final short[] DFA19_eof = DFA.unpackEncodedString(DFA19_eofS);
+ static final char[] DFA19_min = DFA.unpackEncodedStringToUnsignedChars(DFA19_minS);
+ static final char[] DFA19_max = DFA.unpackEncodedStringToUnsignedChars(DFA19_maxS);
+ static final short[] DFA19_accept = DFA.unpackEncodedString(DFA19_acceptS);
+ static final short[] DFA19_special = DFA.unpackEncodedString(DFA19_specialS);
+ static final short[][] DFA19_transition;
+
+ static {
+ int numStates = DFA19_transitionS.length;
+ DFA19_transition = new short[numStates][];
+ for (int i=0; i<numStates; i++) {
+ DFA19_transition[i] = DFA.unpackEncodedString(DFA19_transitionS[i]);
+ }
+ }
+
+ class DFA19 extends DFA {
+
+ public DFA19(BaseRecognizer recognizer) {
+ this.recognizer = recognizer;
+ this.decisionNumber = 19;
+ this.eot = DFA19_eot;
+ this.eof = DFA19_eof;
+ this.min = DFA19_min;
+ this.max = DFA19_max;
+ this.accept = DFA19_accept;
+ this.special = DFA19_special;
+ this.transition = DFA19_transition;
+ }
+ public String getDescription() {
+ return "1:1: Tokens : ( T44 | T45 | WS | DEFRULE | DEFFUNCTION | OR | AND | NOT | EXISTS | TEST | NULL | DECLARE | SALIENCE | INT | FLOAT | STRING | BOOL | VAR | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | TILDE | AMPERSAND | PIPE | ASSIGN_OP | COLON | EQUALS | MULTI_LINE_COMMENT | NAME );";
+ }
+ }
+
+
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsParser.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsParser.java (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/ClipsParser.java 2008-01-29 21:27:34 UTC (rev 18199)
@@ -0,0 +1,2265 @@
+// $ANTLR 3.0.1 C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g 2008-01-29 21:18:01
+
+ package org.drools.clips;
+
+ import org.drools.clips.*;
+
+ import java.util.List;
+ import java.util.ArrayList;
+ import java.util.Iterator;
+ import java.util.HashMap;
+ import java.util.Set;
+ import java.util.HashSet;
+ import java.util.StringTokenizer;
+ import org.drools.lang.descr.*;
+ import org.drools.lang.Location;
+
+
+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 ClipsParser extends Parser {
+ public static final String[] tokenNames = new String[] {
+ "<invalid>", "<EOR>", "<DOWN>", "<UP>", "LEFT_PAREN", "NAME", "RIGHT_PAREN", "DEFFUNCTION", "DEFRULE", "STRING", "SALIENCE", "INT", "AND", "OR", "NOT", "EXISTS", "TEST", "VAR", "ASSIGN_OP", "PIPE", "AMPERSAND", "TILDE", "COLON", "EQUALS", "FLOAT", "BOOL", "NULL", "EOL", "WS", "DECLARE", "EscapeSequence", "HexDigit", "UnicodeEscape", "OctalEscape", "SYMBOL_CHAR", "SH_STYLE_SINGLE_LINE_COMMENT", "C_STYLE_SINGLE_LINE_COMMENT", "LEFT_SQUARE", "RIGHT_SQUARE", "LEFT_CURLY", "RIGHT_CURLY", "MULTI_LINE_COMMENT", "SYMBOL", "FIRST_SYMBOL_CHAR", "'import'", "'=>'"
+ };
+ public static final int RIGHT_SQUARE=38;
+ public static final int RIGHT_CURLY=40;
+ public static final int EQUALS=23;
+ public static final int FLOAT=24;
+ public static final int NOT=14;
+ public static final int SYMBOL_CHAR=34;
+ public static final int SH_STYLE_SINGLE_LINE_COMMENT=35;
+ public static final int AND=12;
+ public static final int EOF=-1;
+ public static final int FIRST_SYMBOL_CHAR=43;
+ public static final int HexDigit=31;
+ public static final int DEFFUNCTION=7;
+ public static final int ASSIGN_OP=18;
+ public static final int RIGHT_PAREN=6;
+ public static final int NAME=5;
+ public static final int EOL=27;
+ public static final int DEFRULE=8;
+ public static final int TILDE=21;
+ public static final int PIPE=19;
+ public static final int VAR=17;
+ public static final int EXISTS=15;
+ public static final int SYMBOL=42;
+ public static final int NULL=26;
+ public static final int BOOL=25;
+ public static final int SALIENCE=10;
+ public static final int AMPERSAND=20;
+ public static final int INT=11;
+ public static final int MULTI_LINE_COMMENT=41;
+ public static final int COLON=22;
+ public static final int WS=28;
+ public static final int UnicodeEscape=32;
+ public static final int LEFT_CURLY=39;
+ public static final int OR=13;
+ public static final int TEST=16;
+ public static final int LEFT_PAREN=4;
+ public static final int DECLARE=29;
+ public static final int LEFT_SQUARE=37;
+ public static final int EscapeSequence=30;
+ public static final int OctalEscape=33;
+ public static final int C_STYLE_SINGLE_LINE_COMMENT=36;
+ public static final int STRING=9;
+
+ public ClipsParser(TokenStream input) {
+ super(input);
+ ruleMemo = new HashMap[26+1];
+ }
+
+
+ public String[] getTokenNames() { return tokenNames; }
+ public String getGrammarFileName() { return "C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g"; }
+
+
+ private PackageDescr packageDescr;
+ private List errors = new ArrayList();
+ private String source = "unknown";
+ private int lineOffset = 0;
+ private DescrFactory factory = new DescrFactory();
+ private MVELBuildContext context;
+ private boolean parserDebug = false;
+ private Location location = new Location( Location.LOCATION_UNKNOWN );
+
+ public void setParserDebug(boolean parserDebug) {
+ this.parserDebug = parserDebug;
+ }
+
+ public void debug(String message) {
+ if ( parserDebug )
+ System.err.println( "drl parser: " + message );
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+ public DescrFactory getFactory() {
+ return factory;
+ }
+
+ public String getSource() {
+ return this.source;
+ }
+
+ public PackageDescr getPackageDescr() {
+ return packageDescr;
+ }
+
+ private int offset(int line) {
+ return line + lineOffset;
+ }
+
+ /**
+ * This will set the offset to record when reparsing. Normally is zero of course
+ */
+ public void setLineOffset(int i) {
+ this.lineOffset = i;
+ }
+
+ private String getString(Token token) {
+ String orig = token.getText();
+ return orig.substring( 1, orig.length() -1 );
+ }
+
+ public void reportError(RecognitionException ex) {
+ // if we've already reported an error and have not matched a token
+ // yet successfully, don't report any errors.
+ if ( errorRecovery ) {
+ return;
+ }
+ errorRecovery = true;
+
+ ex.line = offset(ex.line); //add the offset if there is one
+ errors.add( ex );
+ }
+
+ /** return the raw RecognitionException errors */
+ public List getErrors() {
+ return errors;
+ }
+
+ /** Return a list of pretty strings summarising the errors */
+ public List getErrorMessages() {
+ List messages = new ArrayList();
+ for ( Iterator errorIter = errors.iterator() ; errorIter.hasNext() ; ) {
+ messages.add( createErrorMessage( (RecognitionException) errorIter.next() ) );
+ }
+ return messages;
+ }
+
+ /** return true if any parser errors were accumulated */
+ public boolean hasErrors() {
+ return ! errors.isEmpty();
+ }
+
+ /** This will take a RecognitionException, and create a sensible error message out of it */
+ public String createErrorMessage(RecognitionException e)
+ {
+ StringBuffer message = new StringBuffer();
+ message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
+ if ( e instanceof MismatchedTokenException ) {
+ MismatchedTokenException mte = (MismatchedTokenException)e;
+ message.append("mismatched token: "+
+ e.token+
+ "; expecting type "+
+ tokenNames[mte.expecting]);
+ }
+ else if ( e instanceof MismatchedTreeNodeException ) {
+ MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e;
+ message.append("mismatched tree node: "+
+ //mtne.foundNode+ FIXME
+ "; expecting type "+
+ tokenNames[mtne.expecting]);
+ }
+ else if ( e instanceof NoViableAltException ) {
+ NoViableAltException nvae = (NoViableAltException)e;
+ message.append( "Unexpected token '" + e.token.getText() + "'" );
+ /*
+ message.append("decision=<<"+nvae.grammarDecisionDescription+">>"+
+ " state "+nvae.stateNumber+
+ " (decision="+nvae.decisionNumber+
+ ") no viable alt; token="+
+ e.token);
+ */
+ }
+ else if ( e instanceof EarlyExitException ) {
+ EarlyExitException eee = (EarlyExitException)e;
+ message.append("required (...)+ loop (decision="+
+ eee.decisionNumber+
+ ") did not match anything; token="+
+ e.token);
+ }
+ else if ( e instanceof MismatchedSetException ) {
+ MismatchedSetException mse = (MismatchedSetException)e;
+ message.append("mismatched token '"+
+ e.token+
+ "' expecting set "+mse.expecting);
+ }
+ else if ( e instanceof MismatchedNotSetException ) {
+ MismatchedNotSetException mse = (MismatchedNotSetException)e;
+ message.append("mismatched token '"+
+ e.token+
+ "' expecting set "+mse.expecting);
+ }
+ else if ( e instanceof FailedPredicateException ) {
+ FailedPredicateException fpe = (FailedPredicateException)e;
+ message.append("rule "+fpe.ruleName+" failed predicate: {"+
+ fpe.predicateText+"}?");
+ } else if (e instanceof GeneralParseException) {
+ message.append(" " + e.getMessage());
+ }
+ return message.toString();
+ }
+
+ void checkTrailingSemicolon(String text, int line) {
+ if (text.trim().endsWith( ";" ) ) {
+ this.errors.add( new GeneralParseException( "Trailing semi-colon not allowed", offset(line) ) );
+ }
+ }
+
+
+
+
+ // $ANTLR start eval
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:223:1: eval[ParserHandler handler, MVELBuildContext context] : (i= importDescr | f= deffunction | r= defrule | form= lisp_form ) ;
+ public final void eval(ParserHandler handler, MVELBuildContext context) throws RecognitionException {
+ ImportDescr i = null;
+
+ FunctionDescr f = null;
+
+ RuleDescr r = null;
+
+ LispForm form = null;
+
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:224:2: ( (i= importDescr | f= deffunction | r= defrule | form= lisp_form ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:225:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )
+ {
+ if ( backtracking==0 ) {
+ this.context = context;
+ }
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:226:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )
+ int alt1=4;
+ int LA1_0 = input.LA(1);
+
+ if ( (LA1_0==LEFT_PAREN) ) {
+ switch ( input.LA(2) ) {
+ case DEFFUNCTION:
+ {
+ alt1=2;
+ }
+ break;
+ case 44:
+ {
+ alt1=1;
+ }
+ break;
+ case DEFRULE:
+ {
+ alt1=3;
+ }
+ break;
+ case NAME:
+ case VAR:
+ {
+ alt1=4;
+ }
+ break;
+ default:
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("226:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )", 1, 1, input);
+
+ throw nvae;
+ }
+
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("226:2: (i= importDescr | f= deffunction | r= defrule | form= lisp_form )", 1, 0, input);
+
+ throw nvae;
+ }
+ switch (alt1) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:226:7: i= importDescr
+ {
+ pushFollow(FOLLOW_importDescr_in_eval60);
+ i=importDescr();
+ _fsp--;
+ if (failed) return ;
+ if ( backtracking==0 ) {
+ handler.importHandler( i );
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:227:7: f= deffunction
+ {
+ pushFollow(FOLLOW_deffunction_in_eval71);
+ f=deffunction();
+ _fsp--;
+ if (failed) return ;
+ if ( backtracking==0 ) {
+ handler.functionHandler( f );
+ }
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:228:7: r= defrule
+ {
+ pushFollow(FOLLOW_defrule_in_eval84);
+ r=defrule();
+ _fsp--;
+ if (failed) return ;
+ if ( backtracking==0 ) {
+ handler.ruleHandler( r );
+ }
+
+ }
+ break;
+ case 4 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:229:7: form= lisp_form
+ {
+ pushFollow(FOLLOW_lisp_form_in_eval96);
+ form=lisp_form();
+ _fsp--;
+ if (failed) return ;
+ if ( backtracking==0 ) {
+ handler.lispFormHandler( form );
+ }
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end eval
+
+
+ // $ANTLR start importDescr
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:246:1: importDescr returns [ImportDescr importDescr] : LEFT_PAREN 'import' importName= NAME RIGHT_PAREN ;
+ public final ImportDescr importDescr() throws RecognitionException {
+ ImportDescr importDescr = null;
+
+ Token importName=null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:247:2: ( LEFT_PAREN 'import' importName= NAME RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:247:4: LEFT_PAREN 'import' importName= NAME RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_importDescr123); if (failed) return importDescr;
+ match(input,44,FOLLOW_44_in_importDescr125); if (failed) return importDescr;
+ importName=(Token)input.LT(1);
+ match(input,NAME,FOLLOW_NAME_in_importDescr129); if (failed) return importDescr;
+ if ( backtracking==0 ) {
+ importDescr = new ImportDescr( importName.getText() );
+ }
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_importDescr133); if (failed) return importDescr;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return importDescr;
+ }
+ // $ANTLR end importDescr
+
+
+ // $ANTLR start deffunction
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:295:1: deffunction returns [FunctionDescr functionDescr] : LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN ;
+ public final FunctionDescr deffunction() throws RecognitionException {
+ FunctionDescr functionDescr = null;
+
+ Token t=null;
+ SExpression name = null;
+
+ LispForm params = null;
+
+ LispForm form = null;
+
+
+
+ List content = null;
+ functionDescr = null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:300:2: ( LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:300:4: LEFT_PAREN t= DEFFUNCTION name= lisp_atom params= lisp_form (form= lisp_form )+ RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_deffunction168); if (failed) return functionDescr;
+ t=(Token)input.LT(1);
+ match(input,DEFFUNCTION,FOLLOW_DEFFUNCTION_in_deffunction178); if (failed) return functionDescr;
+ pushFollow(FOLLOW_lisp_atom_in_deffunction188);
+ name=lisp_atom();
+ _fsp--;
+ if (failed) return functionDescr;
+ pushFollow(FOLLOW_lisp_form_in_deffunction198);
+ params=lisp_form();
+ _fsp--;
+ if (failed) return functionDescr;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:304:3: (form= lisp_form )+
+ int cnt2=0;
+ loop2:
+ do {
+ int alt2=2;
+ int LA2_0 = input.LA(1);
+
+ if ( (LA2_0==LEFT_PAREN) ) {
+ alt2=1;
+ }
+
+
+ switch (alt2) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:304:4: form= lisp_form
+ {
+ pushFollow(FOLLOW_lisp_form_in_deffunction207);
+ form=lisp_form();
+ _fsp--;
+ if (failed) return functionDescr;
+ if ( backtracking==0 ) {
+ if ( content == null ) content = new ArrayList(); content.add( form );
+ }
+
+ }
+ break;
+
+ default :
+ if ( cnt2 >= 1 ) break loop2;
+ if (backtracking>0) {failed=true; return functionDescr;}
+ EarlyExitException eee =
+ new EarlyExitException(2, input);
+ throw eee;
+ }
+ cnt2++;
+ } while (true);
+
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_deffunction229); if (failed) return functionDescr;
+ if ( backtracking==0 ) {
+ functionDescr = FunctionHandlers.createFunctionDescr( name, params, content );
+ }
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return functionDescr;
+ }
+ // $ANTLR end deffunction
+
+
+ // $ANTLR start defrule
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:310:1: defrule returns [RuleDescr rule] : loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' t= lisp_form RIGHT_PAREN ;
+ public final RuleDescr defrule() throws RecognitionException {
+ RuleDescr rule = null;
+
+ Token loc=null;
+ Token ruleName=null;
+ Token documentation=null;
+ LispForm t = null;
+
+
+
+ rule = null;
+ AndDescr lhs = null;
+ PatternDescr colum = null;
+ AttributeDescr module = null;
+ Set declarations = null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:318:2: (loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' t= lisp_form RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:318:4: loc= LEFT_PAREN DEFRULE ruleName= NAME documentation= STRING ruleAttribute[rule] ( ce[lhs, declarations] )* '=>' t= lisp_form RIGHT_PAREN
+ {
+ loc=(Token)input.LT(1);
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_defrule266); if (failed) return rule;
+ match(input,DEFRULE,FOLLOW_DEFRULE_in_defrule274); if (failed) return rule;
+ ruleName=(Token)input.LT(1);
+ match(input,NAME,FOLLOW_NAME_in_defrule278); if (failed) return rule;
+ if ( backtracking==0 ) {
+
+ debug( "start rule: " + ruleName.getText() );
+ String ruleStr = ruleName.getText();
+
+ if ( ruleStr.indexOf("::") >= 0 ) {
+ String mod = ruleStr.substring(0, ruleStr.indexOf("::"));
+ ruleStr = ruleStr.substring(ruleStr.indexOf("::")+2);
+ module = new AttributeDescr( "agenda-group", mod );
+ module.setLocation( offset(ruleName.getLine()), ruleName.getCharPositionInLine() );
+ module.setStartCharacter( ((CommonToken)ruleName).getStartIndex() );
+ module.setEndCharacter( ((CommonToken)ruleName).getStopIndex() );
+ }
+
+ rule = new RuleDescr( ruleStr, null );
+ if( module != null ) {
+ rule.addAttribute( module );
+ }
+
+ rule.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
+ rule.setStartCharacter( ((CommonToken)loc).getStartIndex() );
+
+ // not sure how you define where a LHS starts in clips, so just putting it here for now
+ lhs = new AndDescr();
+ rule.setLhs( lhs );
+ lhs.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
+ lhs.setStartCharacter( ((CommonToken)loc).getStartIndex() );
+
+ rule.addAttribute( new AttributeDescr( "dialect", "clips") );
+
+ declarations = new HashSet();
+
+ }
+ documentation=(Token)input.LT(1);
+ match(input,STRING,FOLLOW_STRING_in_defrule290); if (failed) return rule;
+ if ( backtracking==0 ) {
+
+ // do nothing here for now
+
+ }
+ pushFollow(FOLLOW_ruleAttribute_in_defrule296);
+ ruleAttribute(rule);
+ _fsp--;
+ if (failed) return rule;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:357:3: ( ce[lhs, declarations] )*
+ loop3:
+ do {
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+
+ if ( (LA3_0==LEFT_PAREN||LA3_0==VAR) ) {
+ alt3=1;
+ }
+
+
+ switch (alt3) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:357:3: ce[lhs, declarations]
+ {
+ pushFollow(FOLLOW_ce_in_defrule304);
+ ce(lhs, declarations);
+ _fsp--;
+ if (failed) return rule;
+
+ }
+ break;
+
+ default :
+ break loop3;
+ }
+ } while (true);
+
+ match(input,45,FOLLOW_45_in_defrule313); if (failed) return rule;
+ pushFollow(FOLLOW_lisp_form_in_defrule322);
+ t=lisp_form();
+ _fsp--;
+ if (failed) return rule;
+ if ( backtracking==0 ) {
+ rule.setConsequence( t );
+ }
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_defrule331); if (failed) return rule;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return rule;
+ }
+ // $ANTLR end defrule
+
+
+ // $ANTLR start ruleAttribute
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:367:1: ruleAttribute[RuleDescr rule] : ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? ;
+ public final void ruleAttribute(RuleDescr rule) throws RecognitionException {
+ AttributeDescr d = null;
+
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:368:2: ( ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )? )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:369:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:369:3: ( LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN )?
+ int alt5=2;
+ int LA5_0 = input.LA(1);
+
+ if ( (LA5_0==LEFT_PAREN) ) {
+ int LA5_1 = input.LA(2);
+
+ if ( (LA5_1==DECLARE) ) {
+ alt5=1;
+ }
+ }
+ switch (alt5) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:369:5: LEFT_PAREN 'declare' ( LEFT_PAREN d= salience RIGHT_PAREN )? RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute348); if (failed) return ;
+ match(input,DECLARE,FOLLOW_DECLARE_in_ruleAttribute350); if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:370:4: ( LEFT_PAREN d= salience RIGHT_PAREN )?
+ int alt4=2;
+ int LA4_0 = input.LA(1);
+
+ if ( (LA4_0==LEFT_PAREN) ) {
+ alt4=1;
+ }
+ switch (alt4) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:370:6: LEFT_PAREN d= salience RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_ruleAttribute357); if (failed) return ;
+ pushFollow(FOLLOW_salience_in_ruleAttribute361);
+ d=salience();
+ _fsp--;
+ if (failed) return ;
+ if ( backtracking==0 ) {
+ rule.addAttribute( d );
+ }
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute365); if (failed) return ;
+
+ }
+ break;
+
+ }
+
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_ruleAttribute372); if (failed) return ;
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end ruleAttribute
+
+
+ // $ANTLR start salience
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:374:1: salience returns [AttributeDescr d ] : loc= SALIENCE i= INT ;
+ public final AttributeDescr salience() throws RecognitionException {
+ AttributeDescr d = null;
+
+ Token loc=null;
+ Token i=null;
+
+
+ d = null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:378:2: (loc= SALIENCE i= INT )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:379:3: loc= SALIENCE i= INT
+ {
+ loc=(Token)input.LT(1);
+ match(input,SALIENCE,FOLLOW_SALIENCE_in_salience402); if (failed) return d;
+ i=(Token)input.LT(1);
+ match(input,INT,FOLLOW_INT_in_salience406); if (failed) return d;
+ if ( backtracking==0 ) {
+
+ d = new AttributeDescr( "salience", i.getText() );
+ d.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
+ d.setStartCharacter( ((CommonToken)loc).getStartIndex() );
+ d.setEndCharacter( ((CommonToken)i).getStopIndex() );
+
+ }
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return d;
+ }
+ // $ANTLR end salience
+
+
+ // $ANTLR start ce
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:389:1: ce[ConditionalElementDescr in_ce, Set declarations] : ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] ) ;
+ public final void ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:390:2: ( ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:390:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:390:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )
+ int alt6=7;
+ int LA6_0 = input.LA(1);
+
+ if ( (LA6_0==LEFT_PAREN) ) {
+ switch ( input.LA(2) ) {
+ case NOT:
+ {
+ alt6=3;
+ }
+ break;
+ case EXISTS:
+ {
+ alt6=4;
+ }
+ break;
+ case OR:
+ {
+ alt6=2;
+ }
+ break;
+ case AND:
+ {
+ alt6=1;
+ }
+ break;
+ case NAME:
+ {
+ alt6=6;
+ }
+ break;
+ case TEST:
+ {
+ alt6=5;
+ }
+ break;
+ default:
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("390:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )", 6, 1, input);
+
+ throw nvae;
+ }
+
+ }
+ else if ( (LA6_0==VAR) ) {
+ alt6=7;
+ }
+ else {
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("390:4: ( and_ce[in_ce, declarations] | or_ce[in_ce, declarations] | not_ce[in_ce, declarations] | exists_ce[in_ce, declarations] | eval_ce[in_ce, declarations] | normal_pattern[in_ce, declarations] | bound_pattern[in_ce, declarations] )", 6, 0, input);
+
+ throw nvae;
+ }
+ switch (alt6) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:390:8: and_ce[in_ce, declarations]
+ {
+ pushFollow(FOLLOW_and_ce_in_ce432);
+ and_ce(in_ce, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:391:7: or_ce[in_ce, declarations]
+ {
+ pushFollow(FOLLOW_or_ce_in_ce442);
+ or_ce(in_ce, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:392:7: not_ce[in_ce, declarations]
+ {
+ pushFollow(FOLLOW_not_ce_in_ce451);
+ not_ce(in_ce, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+ case 4 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:393:7: exists_ce[in_ce, declarations]
+ {
+ pushFollow(FOLLOW_exists_ce_in_ce460);
+ exists_ce(in_ce, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+ case 5 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:394:8: eval_ce[in_ce, declarations]
+ {
+ pushFollow(FOLLOW_eval_ce_in_ce474);
+ eval_ce(in_ce, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+ case 6 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:395:7: normal_pattern[in_ce, declarations]
+ {
+ pushFollow(FOLLOW_normal_pattern_in_ce488);
+ normal_pattern(in_ce, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+ case 7 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:396:7: bound_pattern[in_ce, declarations]
+ {
+ pushFollow(FOLLOW_bound_pattern_in_ce497);
+ bound_pattern(in_ce, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end ce
+
+
+ // $ANTLR start and_ce
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:400:1: and_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN ;
+ public final void and_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
+
+ AndDescr andDescr= null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:404:2: ( LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:404:4: LEFT_PAREN AND ( ce[andDescr, declarations] )+ RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_and_ce524); if (failed) return ;
+ match(input,AND,FOLLOW_AND_in_and_ce529); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ andDescr = new AndDescr();
+ in_ce.addDescr( andDescr );
+
+ }
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:409:3: ( ce[andDescr, declarations] )+
+ int cnt7=0;
+ loop7:
+ do {
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+
+ if ( (LA7_0==LEFT_PAREN||LA7_0==VAR) ) {
+ alt7=1;
+ }
+
+
+ switch (alt7) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:409:3: ce[andDescr, declarations]
+ {
+ pushFollow(FOLLOW_ce_in_and_ce535);
+ ce(andDescr, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+
+ default :
+ if ( cnt7 >= 1 ) break loop7;
+ if (backtracking>0) {failed=true; return ;}
+ EarlyExitException eee =
+ new EarlyExitException(7, input);
+ throw eee;
+ }
+ cnt7++;
+ } while (true);
+
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_and_ce544); if (failed) return ;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end and_ce
+
+
+ // $ANTLR start or_ce
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:413:1: or_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN ;
+ public final void or_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
+
+ OrDescr orDescr= null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:417:2: ( LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:417:4: LEFT_PAREN OR ( ce[orDescr, declarations] )+ RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_or_ce572); if (failed) return ;
+ match(input,OR,FOLLOW_OR_in_or_ce577); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ orDescr = new OrDescr();
+ in_ce.addDescr( orDescr );
+
+ }
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:422:3: ( ce[orDescr, declarations] )+
+ int cnt8=0;
+ loop8:
+ do {
+ int alt8=2;
+ int LA8_0 = input.LA(1);
+
+ if ( (LA8_0==LEFT_PAREN||LA8_0==VAR) ) {
+ alt8=1;
+ }
+
+
+ switch (alt8) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:422:3: ce[orDescr, declarations]
+ {
+ pushFollow(FOLLOW_ce_in_or_ce583);
+ ce(orDescr, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+
+ default :
+ if ( cnt8 >= 1 ) break loop8;
+ if (backtracking>0) {failed=true; return ;}
+ EarlyExitException eee =
+ new EarlyExitException(8, input);
+ throw eee;
+ }
+ cnt8++;
+ } while (true);
+
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_or_ce592); if (failed) return ;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end or_ce
+
+
+ // $ANTLR start not_ce
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:426:1: not_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN ;
+ public final void not_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
+
+ NotDescr notDescr= null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:430:2: ( LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:430:4: LEFT_PAREN NOT ce[notDescr, declarations] RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_not_ce620); if (failed) return ;
+ match(input,NOT,FOLLOW_NOT_in_not_ce625); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ notDescr = new NotDescr();
+ in_ce.addDescr( notDescr );
+
+ }
+ pushFollow(FOLLOW_ce_in_not_ce631);
+ ce(notDescr, declarations);
+ _fsp--;
+ if (failed) return ;
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_not_ce639); if (failed) return ;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end not_ce
+
+
+ // $ANTLR start exists_ce
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:439:1: exists_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN ;
+ public final void exists_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
+
+ ExistsDescr existsDescr= null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:443:2: ( LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:443:4: LEFT_PAREN EXISTS ce[existsDescr, declarations] RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_exists_ce668); if (failed) return ;
+ match(input,EXISTS,FOLLOW_EXISTS_in_exists_ce673); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ existsDescr = new ExistsDescr();
+ in_ce.addDescr( existsDescr );
+
+ }
+ pushFollow(FOLLOW_ce_in_exists_ce679);
+ ce(existsDescr, declarations);
+ _fsp--;
+ if (failed) return ;
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_exists_ce687); if (failed) return ;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end exists_ce
+
+
+ // $ANTLR start eval_ce
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:452:1: eval_ce[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN TEST t= lisp_form RIGHT_PAREN ;
+ public final void eval_ce(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
+ LispForm t = null;
+
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:453:2: ( LEFT_PAREN TEST t= lisp_form RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:453:4: LEFT_PAREN TEST t= lisp_form RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_eval_ce706); if (failed) return ;
+ match(input,TEST,FOLLOW_TEST_in_eval_ce711); if (failed) return ;
+ pushFollow(FOLLOW_lisp_form_in_eval_ce718);
+ t=lisp_form();
+ _fsp--;
+ if (failed) return ;
+ if ( backtracking==0 ) {
+ EvalDescr evalDescr = new EvalDescr(); evalDescr.setContent( t ); in_ce.addDescr( evalDescr );
+ }
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_eval_ce728); if (failed) return ;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end eval_ce
+
+
+ // $ANTLR start normal_pattern
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:459:1: normal_pattern[ConditionalElementDescr in_ce, Set declarations] : LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN ;
+ public final void normal_pattern(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
+ Token name=null;
+
+
+ PatternDescr pattern = null;
+ ConditionalElementDescr top = null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:464:2: ( LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:464:4: LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_normal_pattern756); if (failed) return ;
+ name=(Token)input.LT(1);
+ match(input,NAME,FOLLOW_NAME_in_normal_pattern763); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ pattern = new PatternDescr(name.getText());
+ in_ce.addDescr( pattern );
+ top = pattern.getConstraint();
+
+
+ }
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:471:3: ( field_constriant[top, declarations] )*
+ loop9:
+ do {
+ int alt9=2;
+ int LA9_0 = input.LA(1);
+
+ if ( (LA9_0==LEFT_PAREN) ) {
+ alt9=1;
+ }
+
+
+ switch (alt9) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:471:3: field_constriant[top, declarations]
+ {
+ pushFollow(FOLLOW_field_constriant_in_normal_pattern769);
+ field_constriant(top, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+
+ default :
+ break loop9;
+ }
+ } while (true);
+
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_normal_pattern779); if (failed) return ;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end normal_pattern
+
+
+ // $ANTLR start bound_pattern
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:477:1: bound_pattern[ConditionalElementDescr in_ce, Set declarations] : var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN ;
+ public final void bound_pattern(ConditionalElementDescr in_ce, Set declarations) throws RecognitionException {
+ Token var=null;
+ Token name=null;
+
+
+ PatternDescr pattern = null;
+ String identifier = null;
+ ConditionalElementDescr top = null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:483:2: (var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:483:4: var= VAR ASSIGN_OP LEFT_PAREN name= NAME ( field_constriant[top, declarations] )* RIGHT_PAREN
+ {
+ var=(Token)input.LT(1);
+ match(input,VAR,FOLLOW_VAR_in_bound_pattern807); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ identifier = var.getText();
+
+ }
+ match(input,ASSIGN_OP,FOLLOW_ASSIGN_OP_in_bound_pattern813); if (failed) return ;
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_bound_pattern815); if (failed) return ;
+ name=(Token)input.LT(1);
+ match(input,NAME,FOLLOW_NAME_in_bound_pattern819); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ pattern = new PatternDescr(name.getText());
+ pattern.setIdentifier( identifier );
+ in_ce.addDescr( pattern );
+ top = pattern.getConstraint();
+
+ }
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:493:3: ( field_constriant[top, declarations] )*
+ loop10:
+ do {
+ int alt10=2;
+ int LA10_0 = input.LA(1);
+
+ if ( (LA10_0==LEFT_PAREN) ) {
+ alt10=1;
+ }
+
+
+ switch (alt10) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:493:3: field_constriant[top, declarations]
+ {
+ pushFollow(FOLLOW_field_constriant_in_bound_pattern828);
+ field_constriant(top, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+
+ default :
+ break loop10;
+ }
+ } while (true);
+
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_bound_pattern835); if (failed) return ;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end bound_pattern
+
+
+ // $ANTLR start field_constriant
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:497:1: field_constriant[ConditionalElementDescr base, Set declarations] : LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN ;
+ public final void field_constriant(ConditionalElementDescr base, Set declarations) throws RecognitionException {
+ Token f=null;
+
+
+ List list = new ArrayList();
+ FieldBindingDescr fbd = null;
+ FieldConstraintDescr fc = null;
+ RestrictionConnectiveDescr top = null;
+ String op = "==";
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:505:2: ( LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:506:3: LEFT_PAREN f= NAME or_restr_connective[top, base, fc, declarations] RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_field_constriant866); if (failed) return ;
+ f=(Token)input.LT(1);
+ match(input,NAME,FOLLOW_NAME_in_field_constriant870); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ fc = new FieldConstraintDescr(f.getText());
+ fc.setLocation( offset(f.getLine()), f.getCharPositionInLine() );
+ fc.setStartCharacter( ((CommonToken)f).getStartIndex() );
+ base.addDescr( fc );
+ top = fc.getRestriction();
+
+ }
+ pushFollow(FOLLOW_or_restr_connective_in_field_constriant885);
+ or_restr_connective(top, base, fc, declarations);
+ _fsp--;
+ if (failed) return ;
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_field_constriant891); if (failed) return ;
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end field_constriant
+
+
+ // $ANTLR start or_restr_connective
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:533:1: or_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] options {backtrack=true; } : and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )* ;
+ public final void or_restr_connective(RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
+
+ RestrictionConnectiveDescr or = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:540:2: ( and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )* )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:541:3: and_restr_connective[or, ceBase, fcBase, declarations] ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )*
+ {
+ pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective930);
+ and_restr_connective(or, ceBase, fcBase, declarations);
+ _fsp--;
+ if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:542:3: ( options {backtrack=true; } : PIPE and_restr_connective[or, ceBase, fcBase, declarations] )*
+ loop11:
+ do {
+ int alt11=2;
+ int LA11_0 = input.LA(1);
+
+ if ( (LA11_0==PIPE) ) {
+ alt11=1;
+ }
+
+
+ switch (alt11) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:544:6: PIPE and_restr_connective[or, ceBase, fcBase, declarations]
+ {
+ match(input,PIPE,FOLLOW_PIPE_in_or_restr_connective954); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+
+ }
+ pushFollow(FOLLOW_and_restr_connective_in_or_restr_connective964);
+ and_restr_connective(or, ceBase, fcBase, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+
+ default :
+ break loop11;
+ }
+ } while (true);
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+
+ if( or.getRestrictions().size() == 1 ) {
+ rcBase.addOrMerge( (RestrictionDescr) or.getRestrictions().get( 0 ) );
+ } else if ( or.getRestrictions().size() > 1 ) {
+ rcBase.addRestriction( or );
+ }
+
+ }
+ return ;
+ }
+ // $ANTLR end or_restr_connective
+
+
+ // $ANTLR start and_restr_connective
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:559:1: and_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] : restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )* ;
+ public final void and_restr_connective(RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
+
+ RestrictionConnectiveDescr and = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:563:2: ( restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )* )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:564:3: restriction[and, ceBase, fcBase, declarations] ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
+ {
+ pushFollow(FOLLOW_restriction_in_and_restr_connective996);
+ restriction(and, ceBase, fcBase, declarations);
+ _fsp--;
+ if (failed) return ;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:565:3: ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
+ loop12:
+ do {
+ int alt12=2;
+ int LA12_0 = input.LA(1);
+
+ if ( (LA12_0==AMPERSAND) ) {
+ alt12=1;
+ }
+
+
+ switch (alt12) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:565:5: AMPERSAND restriction[and, ceBase, fcBase, declarations]
+ {
+ match(input,AMPERSAND,FOLLOW_AMPERSAND_in_and_restr_connective1004); if (failed) return ;
+ pushFollow(FOLLOW_restriction_in_and_restr_connective1006);
+ restriction(and, ceBase, fcBase, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+
+ default :
+ break loop12;
+ }
+ } while (true);
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+
+ if( and.getRestrictions().size() == 1) {
+ rcBase.addOrMerge( (RestrictionDescr) and.getRestrictions().get( 0 ) );
+ } else if ( and.getRestrictions().size() > 1 ) {
+ rcBase.addRestriction( and );
+ }
+
+ }
+ return ;
+ }
+ // $ANTLR end and_restr_connective
+
+
+ // $ANTLR start restriction
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:584:1: restriction[RestrictionConnectiveDescr rc, ConditionalElementDescr base, FieldConstraintDescr fcBase, Set declarations ] : ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction ) ;
+ public final void restriction(RestrictionConnectiveDescr rc, ConditionalElementDescr base, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
+ String lc = null;
+
+
+
+ String op = "==";
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:588:2: ( ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:588:4: ( TILDE )? ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:588:4: ( TILDE )?
+ int alt13=2;
+ int LA13_0 = input.LA(1);
+
+ if ( (LA13_0==TILDE) ) {
+ alt13=1;
+ }
+ switch (alt13) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:588:5: TILDE
+ {
+ match(input,TILDE,FOLLOW_TILDE_in_restriction1039); if (failed) return ;
+ if ( backtracking==0 ) {
+ op = "!=";
+ }
+
+ }
+ break;
+
+ }
+
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:589:3: ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )
+ int alt14=4;
+ switch ( input.LA(1) ) {
+ case COLON:
+ {
+ alt14=1;
+ }
+ break;
+ case EQUALS:
+ {
+ alt14=2;
+ }
+ break;
+ case VAR:
+ {
+ alt14=3;
+ }
+ break;
+ case NAME:
+ case STRING:
+ case INT:
+ case FLOAT:
+ case BOOL:
+ case NULL:
+ {
+ alt14=4;
+ }
+ break;
+ default:
+ if (backtracking>0) {failed=true; return ;}
+ NoViableAltException nvae =
+ new NoViableAltException("589:3: ( predicate_constraint[rc, op, base] | return_value_restriction[op, rc] | variable_restriction[op, rc, base, fcBase, declarations] | lc= literal_restriction )", 14, 0, input);
+
+ throw nvae;
+ }
+
+ switch (alt14) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:589:5: predicate_constraint[rc, op, base]
+ {
+ pushFollow(FOLLOW_predicate_constraint_in_restriction1055);
+ predicate_constraint(rc, op, base);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:590:7: return_value_restriction[op, rc]
+ {
+ pushFollow(FOLLOW_return_value_restriction_in_restriction1071);
+ return_value_restriction(op, rc);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:591:7: variable_restriction[op, rc, base, fcBase, declarations]
+ {
+ pushFollow(FOLLOW_variable_restriction_in_restriction1080);
+ variable_restriction(op, rc, base, fcBase, declarations);
+ _fsp--;
+ if (failed) return ;
+
+ }
+ break;
+ case 4 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:592:8: lc= literal_restriction
+ {
+ pushFollow(FOLLOW_literal_restriction_in_restriction1092);
+ lc=literal_restriction();
+ _fsp--;
+ if (failed) return ;
+ if ( backtracking==0 ) {
+
+ rc.addRestriction( new LiteralRestrictionDescr(op, lc) );
+ op = "==";
+
+ }
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end restriction
+
+
+ // $ANTLR start predicate_constraint
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:599:1: predicate_constraint[RestrictionConnectiveDescr rc, String op, ConditionalElementDescr base] : COLON t= lisp_form ;
+ public final void predicate_constraint(RestrictionConnectiveDescr rc, String op, ConditionalElementDescr base) throws RecognitionException {
+ LispForm t = null;
+
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:600:2: ( COLON t= lisp_form )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:600:4: COLON t= lisp_form
+ {
+ match(input,COLON,FOLLOW_COLON_in_predicate_constraint1125); if (failed) return ;
+ pushFollow(FOLLOW_lisp_form_in_predicate_constraint1131);
+ t=lisp_form();
+ _fsp--;
+ if (failed) return ;
+ if ( backtracking==0 ) {
+ rc.addRestriction( new PredicateDescr( t ) );
+ }
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end predicate_constraint
+
+
+ // $ANTLR start return_value_restriction
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:606:1: return_value_restriction[String op, RestrictionConnectiveDescr rc] : EQUALS t= lisp_form ;
+ public final void return_value_restriction(String op, RestrictionConnectiveDescr rc) throws RecognitionException {
+ LispForm t = null;
+
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:607:2: ( EQUALS t= lisp_form )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:607:4: EQUALS t= lisp_form
+ {
+ match(input,EQUALS,FOLLOW_EQUALS_in_return_value_restriction1150); if (failed) return ;
+ pushFollow(FOLLOW_lisp_form_in_return_value_restriction1157);
+ t=lisp_form();
+ _fsp--;
+ if (failed) return ;
+ if ( backtracking==0 ) {
+ rc.addRestriction( new ReturnValueRestrictionDescr (op, t ) );
+ }
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end return_value_restriction
+
+
+ // $ANTLR start variable_restriction
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:612:1: variable_restriction[String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ] : VAR ;
+ public final void variable_restriction(String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations) throws RecognitionException {
+ Token VAR1=null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:613:2: ( VAR )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:613:4: VAR
+ {
+ VAR1=(Token)input.LT(1);
+ match(input,VAR,FOLLOW_VAR_in_variable_restriction1176); if (failed) return ;
+ if ( backtracking==0 ) {
+
+ if ( declarations.contains( VAR1.getText() ) ) {
+ rc.addRestriction( new VariableRestrictionDescr(op, VAR1.getText()) );
+ } else {
+ FieldBindingDescr fbd = new FieldBindingDescr();
+ fbd.setIdentifier( VAR1.getText() );
+ fbd.setFieldName( fcBase.getFieldName() );
+ ceBase.insertBeforeLast( FieldConstraintDescr.class, fbd );
+ declarations.add( VAR1.getText() );
+ }
+
+ }
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return ;
+ }
+ // $ANTLR end variable_restriction
+
+
+ // $ANTLR start literal_restriction
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:627:1: literal_restriction returns [String text] : t= literal ;
+ public final String literal_restriction() throws RecognitionException {
+ String text = null;
+
+ String t = null;
+
+
+
+ text = null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:631:2: (t= literal )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:632:6: t= literal
+ {
+ pushFollow(FOLLOW_literal_in_literal_restriction1209);
+ t=literal();
+ _fsp--;
+ if (failed) return text;
+ if ( backtracking==0 ) {
+
+ text = t;
+
+ }
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return text;
+ }
+ // $ANTLR end literal_restriction
+
+
+ // $ANTLR start lisp_form
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:649:1: lisp_form returns [LispForm lispForm] : LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN ;
+ public final LispForm lisp_form() throws RecognitionException {
+ LispForm lispForm = null;
+
+ Token t=null;
+ SExpression a = null;
+
+ LispForm l = null;
+
+
+
+ List list = new ArrayList();
+ lispForm = null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:654:2: ( LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:654:4: LEFT_PAREN (t= NAME | t= VAR ) (a= lisp_atom | l= lisp_form )* RIGHT_PAREN
+ {
+ match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_lisp_form1237); if (failed) return lispForm;
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:656:3: (t= NAME | t= VAR )
+ int alt15=2;
+ int LA15_0 = input.LA(1);
+
+ if ( (LA15_0==NAME) ) {
+ alt15=1;
+ }
+ else if ( (LA15_0==VAR) ) {
+ alt15=2;
+ }
+ else {
+ if (backtracking>0) {failed=true; return lispForm;}
+ NoViableAltException nvae =
+ new NoViableAltException("656:3: (t= NAME | t= VAR )", 15, 0, input);
+
+ throw nvae;
+ }
+ switch (alt15) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:657:7: t= NAME
+ {
+ t=(Token)input.LT(1);
+ match(input,NAME,FOLLOW_NAME_in_lisp_form1254); if (failed) return lispForm;
+ if ( backtracking==0 ) {
+ list.add( new SymbolLispAtom( t.getText() ) );
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:659:7: t= VAR
+ {
+ t=(Token)input.LT(1);
+ match(input,VAR,FOLLOW_VAR_in_lisp_form1274); if (failed) return lispForm;
+ if ( backtracking==0 ) {
+ list.add( new VariableLispAtom( t.getText(), context ) );
+ }
+
+ }
+ break;
+
+ }
+
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:661:3: (a= lisp_atom | l= lisp_form )*
+ loop16:
+ do {
+ int alt16=3;
+ int LA16_0 = input.LA(1);
+
+ if ( (LA16_0==NAME||LA16_0==STRING||LA16_0==INT||LA16_0==VAR||(LA16_0>=FLOAT && LA16_0<=NULL)) ) {
+ alt16=1;
+ }
+ else if ( (LA16_0==LEFT_PAREN) ) {
+ alt16=2;
+ }
+
+
+ switch (alt16) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:661:6: a= lisp_atom
+ {
+ pushFollow(FOLLOW_lisp_atom_in_lisp_form1297);
+ a=lisp_atom();
+ _fsp--;
+ if (failed) return lispForm;
+ if ( backtracking==0 ) {
+ list.add( a );
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:662:6: l= lisp_form
+ {
+ pushFollow(FOLLOW_lisp_form_in_lisp_form1308);
+ l=lisp_form();
+ _fsp--;
+ if (failed) return lispForm;
+ if ( backtracking==0 ) {
+ list.add( l );
+ }
+
+ }
+ break;
+
+ default :
+ break loop16;
+ }
+ } while (true);
+
+ match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_lisp_form1335); if (failed) return lispForm;
+ if ( backtracking==0 ) {
+ lispForm = new LispForm( ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ) );
+ }
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return lispForm;
+ }
+ // $ANTLR end lisp_form
+
+
+ // $ANTLR start lisp_atom
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:668:1: lisp_atom returns [SExpression sExpression] : (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME ) ;
+ public final SExpression lisp_atom() throws RecognitionException {
+ SExpression sExpression = null;
+
+ Token t=null;
+
+
+ sExpression = null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:672:2: ( (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:673:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:673:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )
+ int alt17=7;
+ switch ( input.LA(1) ) {
+ case VAR:
+ {
+ alt17=1;
+ }
+ break;
+ case STRING:
+ {
+ alt17=2;
+ }
+ break;
+ case FLOAT:
+ {
+ alt17=3;
+ }
+ break;
+ case INT:
+ {
+ alt17=4;
+ }
+ break;
+ case BOOL:
+ {
+ alt17=5;
+ }
+ break;
+ case NULL:
+ {
+ alt17=6;
+ }
+ break;
+ case NAME:
+ {
+ alt17=7;
+ }
+ break;
+ default:
+ if (backtracking>0) {failed=true; return sExpression;}
+ NoViableAltException nvae =
+ new NoViableAltException("673:3: (t= VAR | t= STRING | t= FLOAT | t= INT | t= BOOL | t= NULL | t= NAME )", 17, 0, input);
+
+ throw nvae;
+ }
+
+ switch (alt17) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:674:6: t= VAR
+ {
+ t=(Token)input.LT(1);
+ match(input,VAR,FOLLOW_VAR_in_lisp_atom1379); if (failed) return sExpression;
+ if ( backtracking==0 ) {
+ sExpression = new VariableLispAtom( t.getText(), context );
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:675:6: t= STRING
+ {
+ t=(Token)input.LT(1);
+ match(input,STRING,FOLLOW_STRING_in_lisp_atom1391); if (failed) return sExpression;
+ if ( backtracking==0 ) {
+ sExpression = new StringLispAtom( getString( t ) );
+ }
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:676:6: t= FLOAT
+ {
+ t=(Token)input.LT(1);
+ match(input,FLOAT,FOLLOW_FLOAT_in_lisp_atom1413); if (failed) return sExpression;
+ if ( backtracking==0 ) {
+ sExpression = new FloatLispAtom( t.getText() );
+ }
+
+ }
+ break;
+ case 4 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:677:6: t= INT
+ {
+ t=(Token)input.LT(1);
+ match(input,INT,FOLLOW_INT_in_lisp_atom1425); if (failed) return sExpression;
+ if ( backtracking==0 ) {
+ sExpression = new IntLispAtom( t.getText() );
+ }
+
+ }
+ break;
+ case 5 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:678:7: t= BOOL
+ {
+ t=(Token)input.LT(1);
+ match(input,BOOL,FOLLOW_BOOL_in_lisp_atom1438); if (failed) return sExpression;
+ if ( backtracking==0 ) {
+ sExpression = new BoolLispAtom( t.getText() );
+ }
+
+ }
+ break;
+ case 6 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:679:7: t= NULL
+ {
+ t=(Token)input.LT(1);
+ match(input,NULL,FOLLOW_NULL_in_lisp_atom1454); if (failed) return sExpression;
+ if ( backtracking==0 ) {
+ sExpression = new NullLispAtom( null );
+ }
+
+ }
+ break;
+ case 7 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:680:14: t= NAME
+ {
+ t=(Token)input.LT(1);
+ match(input,NAME,FOLLOW_NAME_in_lisp_atom1480); if (failed) return sExpression;
+ if ( backtracking==0 ) {
+ sExpression = new SymbolLispAtom( "\"" +t.getText() + "\"");
+ }
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return sExpression;
+ }
+ // $ANTLR end lisp_atom
+
+
+ // $ANTLR start literal
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:685:1: literal returns [String text] : (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) ;
+ public final String literal() throws RecognitionException {
+ String text = null;
+
+ Token t=null;
+
+
+ text = null;
+
+ try {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:689:2: ( (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL ) )
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:689:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
+ {
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:689:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )
+ int alt18=6;
+ switch ( input.LA(1) ) {
+ case STRING:
+ {
+ alt18=1;
+ }
+ break;
+ case NAME:
+ {
+ alt18=2;
+ }
+ break;
+ case INT:
+ {
+ alt18=3;
+ }
+ break;
+ case FLOAT:
+ {
+ alt18=4;
+ }
+ break;
+ case BOOL:
+ {
+ alt18=5;
+ }
+ break;
+ case NULL:
+ {
+ alt18=6;
+ }
+ break;
+ default:
+ if (backtracking>0) {failed=true; return text;}
+ NoViableAltException nvae =
+ new NoViableAltException("689:4: (t= STRING | t= NAME | t= INT | t= FLOAT | t= BOOL | t= NULL )", 18, 0, input);
+
+ throw nvae;
+ }
+
+ switch (alt18) {
+ case 1 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:689:8: t= STRING
+ {
+ t=(Token)input.LT(1);
+ match(input,STRING,FOLLOW_STRING_in_literal1524); if (failed) return text;
+ if ( backtracking==0 ) {
+ text = getString( t );
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:690:7: t= NAME
+ {
+ t=(Token)input.LT(1);
+ match(input,NAME,FOLLOW_NAME_in_literal1537); if (failed) return text;
+ if ( backtracking==0 ) {
+ text = t.getText();
+ }
+
+ }
+ break;
+ case 3 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:691:7: t= INT
+ {
+ t=(Token)input.LT(1);
+ match(input,INT,FOLLOW_INT_in_literal1553); if (failed) return text;
+ if ( backtracking==0 ) {
+ text = t.getText();
+ }
+
+ }
+ break;
+ case 4 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:692:7: t= FLOAT
+ {
+ t=(Token)input.LT(1);
+ match(input,FLOAT,FOLLOW_FLOAT_in_literal1568); if (failed) return text;
+ if ( backtracking==0 ) {
+ text = t.getText();
+ }
+
+ }
+ break;
+ case 5 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:693:7: t= BOOL
+ {
+ t=(Token)input.LT(1);
+ match(input,BOOL,FOLLOW_BOOL_in_literal1581); if (failed) return text;
+ if ( backtracking==0 ) {
+ text = t.getText();
+ }
+
+ }
+ break;
+ case 6 :
+ // C:\\dev\\drools\\trunk\\drools-clips\\src\\main\\resources\\org\\drools\\cips\\Clips.g:694:7: t= NULL
+ {
+ t=(Token)input.LT(1);
+ match(input,NULL,FOLLOW_NULL_in_literal1595); if (failed) return text;
+ if ( backtracking==0 ) {
+ text = null;
+ }
+
+ }
+ break;
+
+ }
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return text;
+ }
+ // $ANTLR end literal
+
+
+
+
+ public static final BitSet FOLLOW_importDescr_in_eval60 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_deffunction_in_eval71 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_defrule_in_eval84 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_lisp_form_in_eval96 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_importDescr123 = new BitSet(new long[]{0x0000100000000000L});
+ public static final BitSet FOLLOW_44_in_importDescr125 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_NAME_in_importDescr129 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_importDescr133 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_deffunction168 = new BitSet(new long[]{0x0000000000000080L});
+ public static final BitSet FOLLOW_DEFFUNCTION_in_deffunction178 = new BitSet(new long[]{0x0000000007020A20L});
+ public static final BitSet FOLLOW_lisp_atom_in_deffunction188 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_lisp_form_in_deffunction198 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_lisp_form_in_deffunction207 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_deffunction229 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_defrule266 = new BitSet(new long[]{0x0000000000000100L});
+ public static final BitSet FOLLOW_DEFRULE_in_defrule274 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_NAME_in_defrule278 = new BitSet(new long[]{0x0000000000000200L});
+ public static final BitSet FOLLOW_STRING_in_defrule290 = new BitSet(new long[]{0x0000200000020010L});
+ public static final BitSet FOLLOW_ruleAttribute_in_defrule296 = new BitSet(new long[]{0x0000200000020010L});
+ public static final BitSet FOLLOW_ce_in_defrule304 = new BitSet(new long[]{0x0000200000020010L});
+ public static final BitSet FOLLOW_45_in_defrule313 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_lisp_form_in_defrule322 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_defrule331 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute348 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_DECLARE_in_ruleAttribute350 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_ruleAttribute357 = new BitSet(new long[]{0x0000000000000400L});
+ public static final BitSet FOLLOW_salience_in_ruleAttribute361 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute365 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_ruleAttribute372 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_SALIENCE_in_salience402 = new BitSet(new long[]{0x0000000000000800L});
+ public static final BitSet FOLLOW_INT_in_salience406 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_and_ce_in_ce432 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_or_ce_in_ce442 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_not_ce_in_ce451 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_exists_ce_in_ce460 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_eval_ce_in_ce474 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_normal_pattern_in_ce488 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_bound_pattern_in_ce497 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_and_ce524 = new BitSet(new long[]{0x0000000000001000L});
+ public static final BitSet FOLLOW_AND_in_and_ce529 = new BitSet(new long[]{0x0000000000020010L});
+ public static final BitSet FOLLOW_ce_in_and_ce535 = new BitSet(new long[]{0x0000000000020050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_and_ce544 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_or_ce572 = new BitSet(new long[]{0x0000000000002000L});
+ public static final BitSet FOLLOW_OR_in_or_ce577 = new BitSet(new long[]{0x0000000000020010L});
+ public static final BitSet FOLLOW_ce_in_or_ce583 = new BitSet(new long[]{0x0000000000020050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_or_ce592 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_not_ce620 = new BitSet(new long[]{0x0000000000004000L});
+ public static final BitSet FOLLOW_NOT_in_not_ce625 = new BitSet(new long[]{0x0000000000020010L});
+ public static final BitSet FOLLOW_ce_in_not_ce631 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_not_ce639 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_exists_ce668 = new BitSet(new long[]{0x0000000000008000L});
+ public static final BitSet FOLLOW_EXISTS_in_exists_ce673 = new BitSet(new long[]{0x0000000000020010L});
+ public static final BitSet FOLLOW_ce_in_exists_ce679 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_exists_ce687 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_eval_ce706 = new BitSet(new long[]{0x0000000000010000L});
+ public static final BitSet FOLLOW_TEST_in_eval_ce711 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_lisp_form_in_eval_ce718 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_eval_ce728 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_normal_pattern756 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_NAME_in_normal_pattern763 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_field_constriant_in_normal_pattern769 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_normal_pattern779 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VAR_in_bound_pattern807 = new BitSet(new long[]{0x0000000000040000L});
+ public static final BitSet FOLLOW_ASSIGN_OP_in_bound_pattern813 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_bound_pattern815 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_NAME_in_bound_pattern819 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_field_constriant_in_bound_pattern828 = new BitSet(new long[]{0x0000000000000050L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_bound_pattern835 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_field_constriant866 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_NAME_in_field_constriant870 = new BitSet(new long[]{0x0000000007E20A20L});
+ public static final BitSet FOLLOW_or_restr_connective_in_field_constriant885 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_field_constriant891 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective930 = new BitSet(new long[]{0x0000000000080002L});
+ public static final BitSet FOLLOW_PIPE_in_or_restr_connective954 = new BitSet(new long[]{0x0000000007E20A20L});
+ public static final BitSet FOLLOW_and_restr_connective_in_or_restr_connective964 = new BitSet(new long[]{0x0000000000080002L});
+ public static final BitSet FOLLOW_restriction_in_and_restr_connective996 = new BitSet(new long[]{0x0000000000100002L});
+ public static final BitSet FOLLOW_AMPERSAND_in_and_restr_connective1004 = new BitSet(new long[]{0x0000000007E20A20L});
+ public static final BitSet FOLLOW_restriction_in_and_restr_connective1006 = new BitSet(new long[]{0x0000000000100002L});
+ public static final BitSet FOLLOW_TILDE_in_restriction1039 = new BitSet(new long[]{0x0000000007C20A20L});
+ public static final BitSet FOLLOW_predicate_constraint_in_restriction1055 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_return_value_restriction_in_restriction1071 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_variable_restriction_in_restriction1080 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_literal_restriction_in_restriction1092 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_COLON_in_predicate_constraint1125 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_lisp_form_in_predicate_constraint1131 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_EQUALS_in_return_value_restriction1150 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_lisp_form_in_return_value_restriction1157 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VAR_in_variable_restriction1176 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_literal_in_literal_restriction1209 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LEFT_PAREN_in_lisp_form1237 = new BitSet(new long[]{0x0000000000020020L});
+ public static final BitSet FOLLOW_NAME_in_lisp_form1254 = new BitSet(new long[]{0x0000000007020A70L});
+ public static final BitSet FOLLOW_VAR_in_lisp_form1274 = new BitSet(new long[]{0x0000000007020A70L});
+ public static final BitSet FOLLOW_lisp_atom_in_lisp_form1297 = new BitSet(new long[]{0x0000000007020A70L});
+ public static final BitSet FOLLOW_lisp_form_in_lisp_form1308 = new BitSet(new long[]{0x0000000007020A70L});
+ public static final BitSet FOLLOW_RIGHT_PAREN_in_lisp_form1335 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VAR_in_lisp_atom1379 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRING_in_lisp_atom1391 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_FLOAT_in_lisp_atom1413 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_INT_in_lisp_atom1425 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_BOOL_in_lisp_atom1438 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_NULL_in_lisp_atom1454 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_NAME_in_lisp_atom1480 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRING_in_literal1524 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_NAME_in_literal1537 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_INT_in_literal1553 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_FLOAT_in_literal1568 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_BOOL_in_literal1581 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_NULL_in_literal1595 = new BitSet(new long[]{0x0000000000000002L});
+
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Shell.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Shell.java (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/java/org/drools/clips/Shell.java 2008-01-29 21:27:34 UTC (rev 18199)
@@ -0,0 +1,200 @@
+/**
+ *
+ */
+package org.drools.clips;
+
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.antlr.runtime.ANTLRReaderStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.mvel.MVEL;
+import org.mvel.ast.Function;
+import org.mvel.compiler.CompiledExpression;
+import org.mvel.compiler.ExpressionCompiler;
+import org.mvel.util.CompilerTools;
+
+public class Shell
+ implements
+ ParserHandler,
+ VariableContext,
+ FunctionContext,
+ PrintRouterContext,
+ MVELBuildContext {
+ private Map<String, Object> vars;
+ private Map<String, String> varNameMap;
+
+ public Shell() {
+ this.vars = new HashMap<String, Object>();
+ this.varNameMap = new HashMap<String, String>();
+ }
+
+ public void functionHandler(FunctionDescr ruleDescr) {
+ Appendable builder = new StringBuilderAppendable();
+
+ // strip lead/trailing quotes
+ String name = ruleDescr.getName().trim();
+ if ( name.charAt( 0 ) == '"' ) {
+ name = name.substring( 1 );
+ }
+
+ if ( name.charAt( name.length() - 1 ) == '"' ) {
+ name = name.substring( 0,
+ name.length() - 1 );
+ }
+ builder.append( "function " + name + "(" );
+
+ for ( int i = 0, length = ruleDescr.getParameterNames().size(); i < length; i++ ) {
+ builder.append( ruleDescr.getParameterNames().get( i ) );
+ if ( i < length - 1 ) {
+ builder.append( ", " );
+ }
+ }
+
+ builder.append( ") {\n" );
+ List list = (List) ruleDescr.getContent();
+ for ( Iterator it = list.iterator(); it.hasNext(); ) {
+ FunctionHandlers.dump( (LispForm) it.next(),
+ builder,
+ this );
+ }
+ builder.append( "}" );
+
+ ExpressionCompiler compiler = new ExpressionCompiler( builder.toString() );
+ Serializable s1 = compiler.compile();
+ Map<String, org.mvel.ast.Function> map = CompilerTools.extractAllDeclaredFunctions( (CompiledExpression) s1 );
+ for ( org.mvel.ast.Function function : map.values() ) {
+ addFunction( function );
+ }
+
+ }
+
+ public void importHandler(ImportDescr descr) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void lispFormHandler(LispForm lispForm) {
+ StringBuilderAppendable appendable = new StringBuilderAppendable();
+ FunctionHandlers.dump( lispForm,
+ appendable,
+ this );
+ MVEL.eval( appendable.toString(),
+ this.vars );
+
+ }
+
+ public void ruleHandler(RuleDescr ruleDescr) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void eval(String string) {
+ eval( new StringReader( string ) );
+ }
+
+ public void eval(Reader reader) {
+ ClipsParser parser;
+ try {
+ parser = new ClipsParser( new CommonTokenStream( new ClipsLexer( new ANTLRReaderStream( reader ) ) ) );
+ parser.eval( this,
+ this );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ public void addFunction(Function function) {
+ this.vars.put( function.getAbsoluteName(),
+ function );
+ }
+
+ public boolean removeFunction(String functionName) {
+ return (this.vars.remove( functionName ) != null);
+ }
+
+ public Map<String, Function> getFunctions() {
+ Map<String, Function> map = new HashMap<String, Function>();
+ for ( Iterator it = this.vars.entrySet().iterator(); it.hasNext(); ) {
+ Entry entry = (Entry) it.next();
+ if ( entry.getValue() instanceof Function ) {
+ map.put( (String) entry.getKey(),
+ (Function) entry.getValue() );
+ }
+ }
+ return map;
+ }
+
+ public void addRouter(String name,
+ PrintStream out) {
+
+ Map routers = (Map) this.vars.get( "printrouters" );
+ if ( routers == null ) {
+ routers = new HashMap();
+ this.vars.put( "printrouters",
+ routers );
+ }
+ routers.put( name,
+ out );
+
+ }
+
+ public boolean removeRouter(String name) {
+ return (this.vars.remove( name ) != null);
+ }
+
+ public Map<String, PrintStream> getRouters() {
+ Map<String, PrintStream> map = new HashMap<String, PrintStream>();
+ for ( Iterator it = this.vars.entrySet().iterator(); it.hasNext(); ) {
+ Entry entry = (Entry) it.next();
+ if ( entry.getValue() instanceof Function ) {
+ map.put( (String) entry.getKey(),
+ (PrintStream) entry.getValue() );
+ }
+ }
+ return map;
+ }
+
+ public void addVariable(String name,
+ Object value) {
+ String temp = this.varNameMap.get( name );
+ if ( temp == null ) {
+ temp = makeValid( name );
+ if ( !temp.equals( name ) ) {
+ this.varNameMap.put( name,
+ temp );
+ }
+ }
+ this.vars.put( temp,
+ value );
+ }
+
+ public void removeVariable(String name) {
+ String temp = this.varNameMap.get( name );
+ if ( temp != null ) {
+ name = temp;
+ }
+ this.vars.remove( name );
+ }
+
+ public Map<String, String> getVariableNameMap() {
+ return this.varNameMap;
+ }
+
+ public String makeValid(String var) {
+ var = var.replaceAll( "\\?",
+ "_Q_" );
+ return var;
+ }
+
+}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/CLPMVEL.g
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/CLPMVEL.g 2008-01-29 21:02:48 UTC (rev 18198)
+++ labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/CLPMVEL.g 2008-01-29 21:27:34 UTC (rev 18199)
@@ -1,849 +0,0 @@
-grammar CLPMVEL;
-
- at parser::header {
- package org.drools.clp;
-
- import org.drools.clp.*;
- import org.drools.clp.mvel.*;
-
- import java.util.List;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.HashMap;
- import java.util.Set;
- import java.util.HashSet;
- import java.util.StringTokenizer;
- import org.drools.lang.descr.*;
- import org.drools.lang.Location;
-}
-
- at parser::members {
- private PackageDescr packageDescr;
- private List errors = new ArrayList();
- private String source = "unknown";
- private int lineOffset = 0;
- private DescrFactory factory = new DescrFactory();
- private MVELBuildContext context;
- private boolean parserDebug = false;
- private Location location = new Location( Location.LOCATION_UNKNOWN );
-
- public void setParserDebug(boolean parserDebug) {
- this.parserDebug = parserDebug;
- }
-
- public void debug(String message) {
- if ( parserDebug )
- System.err.println( "drl parser: " + message );
- }
-
- public void setSource(String source) {
- this.source = source;
- }
- public DescrFactory getFactory() {
- return factory;
- }
-
- public String getSource() {
- return this.source;
- }
-
- public PackageDescr getPackageDescr() {
- return packageDescr;
- }
-
- private int offset(int line) {
- return line + lineOffset;
- }
-
- /**
- * This will set the offset to record when reparsing. Normally is zero of course
- */
- public void setLineOffset(int i) {
- this.lineOffset = i;
- }
-
- private String getString(Token token) {
- String orig = token.getText();
- return orig.substring( 1, orig.length() -1 );
- }
-
- public void reportError(RecognitionException ex) {
- // if we've already reported an error and have not matched a token
- // yet successfully, don't report any errors.
- if ( errorRecovery ) {
- return;
- }
- errorRecovery = true;
-
- ex.line = offset(ex.line); //add the offset if there is one
- errors.add( ex );
- }
-
- /** return the raw RecognitionException errors */
- public List getErrors() {
- return errors;
- }
-
- /** Return a list of pretty strings summarising the errors */
- public List getErrorMessages() {
- List messages = new ArrayList();
- for ( Iterator errorIter = errors.iterator() ; errorIter.hasNext() ; ) {
- messages.add( createErrorMessage( (RecognitionException) errorIter.next() ) );
- }
- return messages;
- }
-
- /** return true if any parser errors were accumulated */
- public boolean hasErrors() {
- return ! errors.isEmpty();
- }
-
- /** This will take a RecognitionException, and create a sensible error message out of it */
- public String createErrorMessage(RecognitionException e)
- {
- StringBuffer message = new StringBuffer();
- message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
- if ( e instanceof MismatchedTokenException ) {
- MismatchedTokenException mte = (MismatchedTokenException)e;
- message.append("mismatched token: "+
- e.token+
- "; expecting type "+
- tokenNames[mte.expecting]);
- }
- else if ( e instanceof MismatchedTreeNodeException ) {
- MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e;
- message.append("mismatched tree node: "+
- //mtne.foundNode+ FIXME
- "; expecting type "+
- tokenNames[mtne.expecting]);
- }
- else if ( e instanceof NoViableAltException ) {
- NoViableAltException nvae = (NoViableAltException)e;
- message.append( "Unexpected token '" + e.token.getText() + "'" );
- /*
- message.append("decision=<<"+nvae.grammarDecisionDescription+">>"+
- " state "+nvae.stateNumber+
- " (decision="+nvae.decisionNumber+
- ") no viable alt; token="+
- e.token);
- */
- }
- else if ( e instanceof EarlyExitException ) {
- EarlyExitException eee = (EarlyExitException)e;
- message.append("required (...)+ loop (decision="+
- eee.decisionNumber+
- ") did not match anything; token="+
- e.token);
- }
- else if ( e instanceof MismatchedSetException ) {
- MismatchedSetException mse = (MismatchedSetException)e;
- message.append("mismatched token '"+
- e.token+
- "' expecting set "+mse.expecting);
- }
- else if ( e instanceof MismatchedNotSetException ) {
- MismatchedNotSetException mse = (MismatchedNotSetException)e;
- message.append("mismatched token '"+
- e.token+
- "' expecting set "+mse.expecting);
- }
- else if ( e instanceof FailedPredicateException ) {
- FailedPredicateException fpe = (FailedPredicateException)e;
- message.append("rule "+fpe.ruleName+" failed predicate: {"+
- fpe.predicateText+"}?");
- } else if (e instanceof GeneralParseException) {
- message.append(" " + e.getMessage());
- }
- return message.toString();
- }
-
- void checkTrailingSemicolon(String text, int line) {
- if (text.trim().endsWith( ";" ) ) {
- this.errors.add( new GeneralParseException( "Trailing semi-colon not allowed", offset(line) ) );
- }
- }
-
-}
-
- at lexer::header {
- package org.drools.clp;
-}
-
-/*
-opt_semicolon
- : ';'?
- ;
-
-
-compilation_unit
- :
- ( statement )+
- ;
-*/
-/*
-statement
- :
- //later we add the other possible statements here
- ( //do something with the returned rule here )
- ;
-*/
-/* prolog
- @init {
- String packageName = "";
- }
- : ( n=package_statement { packageName = n; } )?
- {
- this.packageDescr = factory.createPackage( packageName );
- }
- ;
-
-statement
- :
- ( import_statement
- | function_import_statement
- | global
- | function
- | t=template {this.packageDescr.addFactTemplate( t ); }
- | r=rule { if( r != null ) this.packageDescr.addRule( r ); }
- | q=query { if( q != null ) this.packageDescr.addRule( q ); }
- )
- ;
-
-package_statement returns [String packageName]
- @init{
- packageName = null;
- }
- :
- PACKAGE n=dotted_name[null] opt_semicolon
- {
- packageName = n;
- }
- ;
-*/
-
-eval[ParserHandler handler, MVELBuildContext context]
- :
- { this.context = context; }
- ( i=importDescr{ handler.importHandler( i ); }
- | f=deffunction { handler.functionHandler( f ); }
- | r=defrule { handler.ruleHandler( r ); }
- | form=lisp_form { handler.lispFormHandler( form ); }
- )
- ;
-
- /*
-eval_sExpressions[MVELClipsContext context] returns[List<SExpression> list]
- @init {
- list = new ArrayList<SExpression>();
- }
- :
- ( a=lisp_list { list.add( a ); }
- | a=deffunction { FunctionHandlers.dump(a, null, context); }
- )*
-// { sExpressions = ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ); }
- ;
- */
-
-importDescr returns[ImportDescr importDescr]
- : LEFT_PAREN 'import' importName=NAME { importDescr = new ImportDescr( importName.getText() ); } RIGHT_PAREN
- ;
-/*
-
-execution_list returns[ExecutionEngine engine]
- @init {
- engine = new BlockExecutionEngine();
- BuildContext context = new ExecutionBuildContext( engine, functionRegistry );
- }
-
- :
- (fc=lisp_list[context, new LispForm(context) ] { context.addFunction( (FunctionCaller) fc ); })
- ;
-*/
-
-/*
-deffunction returns[Deffunction function]
- @init {
- BuildContext context = null;
- }
- : loc=LEFT_PAREN
- DEFFUNCTION
- ruleName=NAME {
- function = new Deffunction( ruleName.getText() );
- functionRegistry.addFunction( function );
- context = new ExecutionBuildContext( function, functionRegistry );
- }
- loc=LEFT_PAREN
- (v=VAR {
- context.addVariable( function.addParameter( v.getText() ) );
- })*
- RIGHT_PAREN
- (fc=lisp_list[context, new LispForm(context) ] { context.addFunction( (FunctionCaller) fc ); })*
- RIGHT_PAREN
- ;
-*/
-
-/*
-deffunction_params[BuildContext context]
- : loc=LEFT_PAREN
- (v=VAR {
- // this creates a parameter on the underlying function
- context.createLocalVariable( v.getText() );
- })*
- RIGHT_PAREN
- ;
-*/
-
-deffunction returns[FunctionDescr functionDescr]
- @init {
- List content = null;
- functionDescr = null;
- }
- : LEFT_PAREN
- t=DEFFUNCTION //{ list.add( new SymbolLispAtom( t.getText() ) ); } //deffunction
- name=lisp_atom //name
- params=lisp_form // params
- (form=lisp_form { if ( content == null ) content = new ArrayList(); content.add( form ); } )+
- RIGHT_PAREN
- { functionDescr = FunctionHandlers.createFunctionDescr( name, params, content ); }
- //{ sExpression = new LispForm( ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ) ); }
- ;
-
-defrule returns [RuleDescr rule]
- @init {
- rule = null;
- AndDescr lhs = null;
- PatternDescr colum = null;
- AttributeDescr module = null;
- Set declarations = null;
- }
- : loc=LEFT_PAREN
-
- DEFRULE ruleName=NAME
- {
- debug( "start rule: " + ruleName.getText() );
- String ruleStr = ruleName.getText();
-
- if ( ruleStr.indexOf("::") >= 0 ) {
- String mod = ruleStr.substring(0, ruleStr.indexOf("::"));
- ruleStr = ruleStr.substring(ruleStr.indexOf("::")+2);
- module = new AttributeDescr( "agenda-group", mod );
- module.setLocation( offset(ruleName.getLine()), ruleName.getCharPositionInLine() );
- module.setStartCharacter( ((CommonToken)ruleName).getStartIndex() );
- module.setEndCharacter( ((CommonToken)ruleName).getStopIndex() );
- }
-
- rule = new RuleDescr( ruleStr, null );
- if( module != null ) {
- rule.addAttribute( module );
- }
-
- rule.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
- rule.setStartCharacter( ((CommonToken)loc).getStartIndex() );
-
- // not sure how you define where a LHS starts in clips, so just putting it here for now
- lhs = new AndDescr();
- rule.setLhs( lhs );
- lhs.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
- lhs.setStartCharacter( ((CommonToken)loc).getStartIndex() );
-
- rule.addAttribute( new AttributeDescr( "dialect", "clips") );
-
- declarations = new HashSet();
- }
- documentation=STRING {
- // do nothing here for now
- }
- ruleAttribute[rule]
-
- ce[lhs, declarations]*
-
- '=>'
-
- t=lisp_form { rule.setConsequence( t ); }
-
- RIGHT_PAREN
- ;
-
-
-ruleAttribute[RuleDescr rule]
- :
- ( LEFT_PAREN 'declare'
- ( LEFT_PAREN d=salience { rule.addAttribute( d ); } RIGHT_PAREN )?
- RIGHT_PAREN )?
- ;
-
-salience returns [AttributeDescr d ]
- @init {
- d = null;
- }
- :
- loc=SALIENCE i=INT
- {
- d = new AttributeDescr( "salience", i.getText() );
- d.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
- d.setStartCharacter( ((CommonToken)loc).getStartIndex() );
- d.setEndCharacter( ((CommonToken)i).getStopIndex() );
- }
- ;
-
-
-ce[ConditionalElementDescr in_ce, Set declarations]
- : ( and_ce[in_ce, declarations]
- | or_ce[in_ce, declarations]
- | not_ce[in_ce, declarations]
- | exists_ce[in_ce, declarations]
- | eval_ce[in_ce, declarations]
- | normal_pattern[in_ce, declarations]
- | bound_pattern[in_ce, declarations]
- )
- ;
-
-and_ce[ConditionalElementDescr in_ce, Set declarations]
- @init {
- AndDescr andDescr= null;
- }
- : LEFT_PAREN
- AND {
- andDescr = new AndDescr();
- in_ce.addDescr( andDescr );
- }
- ce[andDescr, declarations]+
- RIGHT_PAREN
- ;
-
-or_ce[ConditionalElementDescr in_ce, Set declarations]
- @init {
- OrDescr orDescr= null;
- }
- : LEFT_PAREN
- OR {
- orDescr = new OrDescr();
- in_ce.addDescr( orDescr );
- }
- ce[orDescr, declarations]+
- RIGHT_PAREN
- ;
-
-not_ce[ConditionalElementDescr in_ce, Set declarations]
- @init {
- NotDescr notDescr= null;
- }
- : LEFT_PAREN
- NOT {
- notDescr = new NotDescr();
- in_ce.addDescr( notDescr );
- }
- ce[notDescr, declarations]
- RIGHT_PAREN
- ;
-
-exists_ce[ConditionalElementDescr in_ce, Set declarations]
- @init {
- ExistsDescr existsDescr= null;
- }
- : LEFT_PAREN
- EXISTS {
- existsDescr = new ExistsDescr();
- in_ce.addDescr( existsDescr );
- }
- ce[existsDescr, declarations]
- RIGHT_PAREN
- ;
-
-eval_ce[ConditionalElementDescr in_ce, Set declarations]
- : LEFT_PAREN
- TEST
- t=lisp_form { EvalDescr evalDescr = new EvalDescr(); evalDescr.setContent( t ); in_ce.addDescr( evalDescr ); }
- RIGHT_PAREN
- ;
-
-normal_pattern[ConditionalElementDescr in_ce, Set declarations]
- @init {
- PatternDescr pattern = null;
- ConditionalElementDescr top = null;
- }
- : LEFT_PAREN
- name=NAME {
- pattern = new PatternDescr(name.getText());
- in_ce.addDescr( pattern );
- top = pattern.getConstraint();
-
- }
- field_constriant[top, declarations]*
- RIGHT_PAREN
- ;
-
-
-
-bound_pattern[ConditionalElementDescr in_ce, Set declarations]
- @init {
- PatternDescr pattern = null;
- String identifier = null;
- ConditionalElementDescr top = null;
- }
- : var=VAR {
- identifier = var.getText();
- }
- ASSIGN_OP LEFT_PAREN name=NAME
- {
- pattern = new PatternDescr(name.getText());
- pattern.setIdentifier( identifier );
- in_ce.addDescr( pattern );
- top = pattern.getConstraint();
- }
- field_constriant[top, declarations]*
- RIGHT_PAREN
- ;
-
-field_constriant[ConditionalElementDescr base, Set declarations]
- @init {
- List list = new ArrayList();
- FieldBindingDescr fbd = null;
- FieldConstraintDescr fc = null;
- RestrictionConnectiveDescr top = null;
- String op = "==";
- }
- :
- LEFT_PAREN f=NAME
- {
- fc = new FieldConstraintDescr(f.getText());
- fc.setLocation( offset(f.getLine()), f.getCharPositionInLine() );
- fc.setStartCharacter( ((CommonToken)f).getStartIndex() );
- base.addDescr( fc );
- top = fc.getRestriction();
- }
-
- or_restr_connective[top, base, fc, declarations]
- RIGHT_PAREN
- ;
-/*
-connected_constraint[RestrictionConnectiveDescr rc, ConditionalElementDescr base]
- :
- restriction[rc, base]
- (
- AMPERSAND { rc.addRestriction(new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND)); }
- connected_constraint[rc, base]
- |
- PIPE {rc.addRestriction(new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR)); }
- connected_constraint[rc, base]
- )?
- ;
-*/
-
-
-or_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ]
- options {
- backtrack=true;
- }
- @init {
- RestrictionConnectiveDescr or = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
- }
- :
- and_restr_connective[or, ceBase, fcBase, declarations]
- (
- options {backtrack=true;}
- : PIPE
- {
- location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
- }
- and_restr_connective[or, ceBase, fcBase, declarations]
- )*
- ;
- finally {
- if( or.getRestrictions().size() == 1 ) {
- $rcBase.addOrMerge( (RestrictionDescr) or.getRestrictions().get( 0 ) );
- } else if ( or.getRestrictions().size() > 1 ) {
- $rcBase.addRestriction( or );
- }
- }
-
-and_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ]
- @init {
- RestrictionConnectiveDescr and = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
- }
- :
- restriction[and, ceBase, fcBase, declarations]
- ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
- /*
- ( options {backtrack=true;}
- : t=AMPERSAND
- {
- location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
- }
- restriction[and, ceBase]
- )*
- */
- ;
- finally {
- if( and.getRestrictions().size() == 1) {
- $rcBase.addOrMerge( (RestrictionDescr) and.getRestrictions().get( 0 ) );
- } else if ( and.getRestrictions().size() > 1 ) {
- $rcBase.addRestriction( and );
- }
- }
-
-restriction[RestrictionConnectiveDescr rc, ConditionalElementDescr base, FieldConstraintDescr fcBase, Set declarations ]
- @init {
- String op = "==";
- }
- : (TILDE{op = "!=";})?
- ( predicate_constraint[rc, op, base]
- | return_value_restriction[op, rc]
- | variable_restriction[op, rc, base, fcBase, declarations]
- | lc=literal_restriction {
- rc.addRestriction( new LiteralRestrictionDescr(op, lc) );
- op = "==";
- }
- )
- ;
-
-predicate_constraint[RestrictionConnectiveDescr rc, String op, ConditionalElementDescr base]
- : COLON
- t=lisp_form { $rc.addRestriction( new PredicateDescr( t ) ); }
-
- ;
-
-
-return_value_restriction[String op, RestrictionConnectiveDescr rc]
- : EQUALS
- t=lisp_form {rc.addRestriction( new ReturnValueRestrictionDescr (op, t ) ); }
- ;
-
-//will add a declaration field binding, if this is the first time the name is used
-variable_restriction[String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ]
- : VAR {
- if ( declarations.contains( $VAR.text ) ) {
- rc.addRestriction( new VariableRestrictionDescr(op, $VAR.text) );
- } else {
- FieldBindingDescr fbd = new FieldBindingDescr();
- fbd.setIdentifier( $VAR.text );
- fbd.setFieldName( fcBase.getFieldName() );
- ceBase.insertBeforeLast( FieldConstraintDescr.class, fbd );
- declarations.add( $VAR.text );
- }
- }
- ;
-
-
-literal_restriction returns [String text]
- @init {
- text = null;
- }
- :
- t=literal {
- text = t;
- }
- ;
-
-/*
-eval_sExpressions[MVELClipsContext context] returns[List<SExpression> list]
- @init {
- list = new ArrayList<SExpression>();
- }
- :
- ( a=lisp_list { list.add( a ); }
- | a=deffunction { FunctionHandlers.dump(a, null, context); }
- )*
-// { sExpressions = ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ); }
- ;
-*/
-lisp_form returns[LispForm lispForm]
- @init {
- List list = new ArrayList();
- lispForm = null;
- }
- : LEFT_PAREN
-
- (
- t=NAME { list.add( new SymbolLispAtom( t.getText() ) ); }
- |
- t=VAR { list.add( new VariableLispAtom( t.getText(), context ) ); }
- )
- ( a=lisp_atom { list.add( a ); }
- | l=lisp_form { list.add( l ); }
- )*
- RIGHT_PAREN
- { lispForm = new LispForm( ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ) ); }
- ;
-
-lisp_atom returns[SExpression sExpression]
- @init {
- sExpression = null;
- }
- :
- (
- t=VAR { sExpression = new VariableLispAtom( t.getText(), context ); }
- | t=STRING { sExpression = new StringLispAtom( getString( t ) ); }
- | t=FLOAT { sExpression = new FloatLispAtom( t.getText() ); }
- | t=INT { sExpression = new IntLispAtom( t.getText() ); }
- | t=BOOL { sExpression = new BoolLispAtom( t.getText() ); }
- | t=NULL { sExpression = new NullLispAtom( null ); }
- | t=NAME { sExpression = new SymbolLispAtom( "\"" +t.getText() + "\""); }
-
- )
- ;
-
-literal returns [String text]
- @init {
- text = null;
- }
- : ( t=STRING { text = getString( t ); }
- | t=NAME { text = t.getText(); }
- | t=INT { text = t.getText(); }
- | t=FLOAT { text = t.getText(); }
- | t=BOOL { text = t.getText(); }
- | t=NULL { text = null; }
- )
- ;
-
-WS : ( ' '
- | '\t'
- | '\f'
- | EOL
- )
- { $channel=HIDDEN; }
- ;
-
-DEFRULE : 'defrule';
-DEFFUNCTION : 'deffunction';
-OR : 'or';
-AND : 'and';
-NOT : 'not';
-EXISTS : 'exists';
-TEST : 'test';
-
-NULL : 'null';
-
-DECLARE : 'declare';
-
-SALIENCE : 'salience';
-
-//MODIFY : 'modify';
-
-fragment
-EOL :
- ( ( '\r\n' )=> '\r\n' // Evil DOS
- | '\r' // Macintosh
- | '\n' // Unix (the right way)
- )
- ;
-
-INT
- : ('-')?('0'..'9')+
- ;
-
-FLOAT
- : ('-')?('0'..'9')+ '.' ('0'..'9')+
- ;
-
-STRING
- : ('"' ( EscapeSequence | ~('\\'|'"') )* '"')
- | ('\'' ( EscapeSequence | ~('\\'|'\'') )* '\'')
- ;
-
-fragment
-HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
-
-fragment
-EscapeSequence
- : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
- | UnicodeEscape
- | OctalEscape
- ;
-
-fragment
-OctalEscape
- : '\\' ('0'..'3') ('0'..'7') ('0'..'7')
- | '\\' ('0'..'7') ('0'..'7')
- | '\\' ('0'..'7')
- ;
-
-fragment
-UnicodeEscape
- : '\\' 'u' HexDigit HexDigit HexDigit HexDigit
- ;
-
-BOOL
- : ('true'|'false')
- ;
-
-VAR : '?' SYMBOL_CHAR+
- ;
-
-SH_STYLE_SINGLE_LINE_COMMENT
- : '#' ( options{greedy=false;} : .)* EOL /* ('\r')? '\n' */
- { $channel=HIDDEN; }
- ;
-
-
-C_STYLE_SINGLE_LINE_COMMENT
- : '//' ( options{greedy=false;} : .)* EOL // ('\r')? '\n'
- { $channel=HIDDEN; }
- ;
-
-
-LEFT_PAREN
- : '('
- ;
-
-RIGHT_PAREN
- : ')'
- ;
-
-LEFT_SQUARE
- : '['
- ;
-
-RIGHT_SQUARE
- : ']'
- ;
-
-LEFT_CURLY
- : '{'
- ;
-
-RIGHT_CURLY
- : '}'
- ;
-
-TILDE : '~'
- ;
-
-AMPERSAND
- : '&'
- ;
-
-PIPE
- : '|'
- ;
-
-ASSIGN_OP
- : '<-'
- ;
-
-COLON : ':';
-
-EQUALS : '=';
-
-MULTI_LINE_COMMENT
- : '/*' (options{greedy=false;} : .)* '*/'
- { $channel=HIDDEN; }
- ;
-
-NAME : SYMBOL ;
-
-fragment
-SYMBOL : FIRST_SYMBOL_CHAR SYMBOL_CHAR* ;
-
-// allowed <
-// not allowed ?
-fragment
-FIRST_SYMBOL_CHAR : ('a'..'z'|'A'..'Z'|'0'..'9'|'!'|'$'|'%'|'^'|'*'|'_'|'-'|'+'|'='|'\\'|'/'|'@'|'#'|':'|'>'|'<'|','|'.'|'['|']'|'{'|'}');
-
-// allowed ?
-// not allowed <
-fragment
-SYMBOL_CHAR : ('a'..'z'|'A'..'Z'|'0'..'9'|'!'|'$'|'%'|'^'|'*'|'_'|'-'|'+'|'='|'\\'|'/'|'@'|'#'|':'|'>'|','|'.'|'['|']'|'{'|'}'|'?');
-
-
-
Copied: labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/Clips.g (from rev 18198, labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/CLPMVEL.g)
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/Clips.g (rev 0)
+++ labs/jbossrules/trunk/drools-clips/src/main/resources/org/drools/cips/Clips.g 2008-01-29 21:27:34 UTC (rev 18199)
@@ -0,0 +1,848 @@
+grammar Clips;
+
+ at parser::header {
+ package org.drools.clips;
+
+ import org.drools.clips.*;
+
+ import java.util.List;
+ import java.util.ArrayList;
+ import java.util.Iterator;
+ import java.util.HashMap;
+ import java.util.Set;
+ import java.util.HashSet;
+ import java.util.StringTokenizer;
+ import org.drools.lang.descr.*;
+ import org.drools.lang.Location;
+}
+
+ at parser::members {
+ private PackageDescr packageDescr;
+ private List errors = new ArrayList();
+ private String source = "unknown";
+ private int lineOffset = 0;
+ private DescrFactory factory = new DescrFactory();
+ private MVELBuildContext context;
+ private boolean parserDebug = false;
+ private Location location = new Location( Location.LOCATION_UNKNOWN );
+
+ public void setParserDebug(boolean parserDebug) {
+ this.parserDebug = parserDebug;
+ }
+
+ public void debug(String message) {
+ if ( parserDebug )
+ System.err.println( "drl parser: " + message );
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+ public DescrFactory getFactory() {
+ return factory;
+ }
+
+ public String getSource() {
+ return this.source;
+ }
+
+ public PackageDescr getPackageDescr() {
+ return packageDescr;
+ }
+
+ private int offset(int line) {
+ return line + lineOffset;
+ }
+
+ /**
+ * This will set the offset to record when reparsing. Normally is zero of course
+ */
+ public void setLineOffset(int i) {
+ this.lineOffset = i;
+ }
+
+ private String getString(Token token) {
+ String orig = token.getText();
+ return orig.substring( 1, orig.length() -1 );
+ }
+
+ public void reportError(RecognitionException ex) {
+ // if we've already reported an error and have not matched a token
+ // yet successfully, don't report any errors.
+ if ( errorRecovery ) {
+ return;
+ }
+ errorRecovery = true;
+
+ ex.line = offset(ex.line); //add the offset if there is one
+ errors.add( ex );
+ }
+
+ /** return the raw RecognitionException errors */
+ public List getErrors() {
+ return errors;
+ }
+
+ /** Return a list of pretty strings summarising the errors */
+ public List getErrorMessages() {
+ List messages = new ArrayList();
+ for ( Iterator errorIter = errors.iterator() ; errorIter.hasNext() ; ) {
+ messages.add( createErrorMessage( (RecognitionException) errorIter.next() ) );
+ }
+ return messages;
+ }
+
+ /** return true if any parser errors were accumulated */
+ public boolean hasErrors() {
+ return ! errors.isEmpty();
+ }
+
+ /** This will take a RecognitionException, and create a sensible error message out of it */
+ public String createErrorMessage(RecognitionException e)
+ {
+ StringBuffer message = new StringBuffer();
+ message.append( source + ":"+e.line+":"+e.charPositionInLine+" ");
+ if ( e instanceof MismatchedTokenException ) {
+ MismatchedTokenException mte = (MismatchedTokenException)e;
+ message.append("mismatched token: "+
+ e.token+
+ "; expecting type "+
+ tokenNames[mte.expecting]);
+ }
+ else if ( e instanceof MismatchedTreeNodeException ) {
+ MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e;
+ message.append("mismatched tree node: "+
+ //mtne.foundNode+ FIXME
+ "; expecting type "+
+ tokenNames[mtne.expecting]);
+ }
+ else if ( e instanceof NoViableAltException ) {
+ NoViableAltException nvae = (NoViableAltException)e;
+ message.append( "Unexpected token '" + e.token.getText() + "'" );
+ /*
+ message.append("decision=<<"+nvae.grammarDecisionDescription+">>"+
+ " state "+nvae.stateNumber+
+ " (decision="+nvae.decisionNumber+
+ ") no viable alt; token="+
+ e.token);
+ */
+ }
+ else if ( e instanceof EarlyExitException ) {
+ EarlyExitException eee = (EarlyExitException)e;
+ message.append("required (...)+ loop (decision="+
+ eee.decisionNumber+
+ ") did not match anything; token="+
+ e.token);
+ }
+ else if ( e instanceof MismatchedSetException ) {
+ MismatchedSetException mse = (MismatchedSetException)e;
+ message.append("mismatched token '"+
+ e.token+
+ "' expecting set "+mse.expecting);
+ }
+ else if ( e instanceof MismatchedNotSetException ) {
+ MismatchedNotSetException mse = (MismatchedNotSetException)e;
+ message.append("mismatched token '"+
+ e.token+
+ "' expecting set "+mse.expecting);
+ }
+ else if ( e instanceof FailedPredicateException ) {
+ FailedPredicateException fpe = (FailedPredicateException)e;
+ message.append("rule "+fpe.ruleName+" failed predicate: {"+
+ fpe.predicateText+"}?");
+ } else if (e instanceof GeneralParseException) {
+ message.append(" " + e.getMessage());
+ }
+ return message.toString();
+ }
+
+ void checkTrailingSemicolon(String text, int line) {
+ if (text.trim().endsWith( ";" ) ) {
+ this.errors.add( new GeneralParseException( "Trailing semi-colon not allowed", offset(line) ) );
+ }
+ }
+
+}
+
+ at lexer::header {
+ package org.drools.clips;
+}
+
+/*
+opt_semicolon
+ : ';'?
+ ;
+
+
+compilation_unit
+ :
+ ( statement )+
+ ;
+*/
+/*
+statement
+ :
+ //later we add the other possible statements here
+ ( //do something with the returned rule here )
+ ;
+*/
+/* prolog
+ @init {
+ String packageName = "";
+ }
+ : ( n=package_statement { packageName = n; } )?
+ {
+ this.packageDescr = factory.createPackage( packageName );
+ }
+ ;
+
+statement
+ :
+ ( import_statement
+ | function_import_statement
+ | global
+ | function
+ | t=template {this.packageDescr.addFactTemplate( t ); }
+ | r=rule { if( r != null ) this.packageDescr.addRule( r ); }
+ | q=query { if( q != null ) this.packageDescr.addRule( q ); }
+ )
+ ;
+
+package_statement returns [String packageName]
+ @init{
+ packageName = null;
+ }
+ :
+ PACKAGE n=dotted_name[null] opt_semicolon
+ {
+ packageName = n;
+ }
+ ;
+*/
+
+eval[ParserHandler handler, MVELBuildContext context]
+ :
+ { this.context = context; }
+ ( i=importDescr{ handler.importHandler( i ); }
+ | f=deffunction { handler.functionHandler( f ); }
+ | r=defrule { handler.ruleHandler( r ); }
+ | form=lisp_form { handler.lispFormHandler( form ); }
+ )
+ ;
+
+ /*
+eval_sExpressions[MVELClipsContext context] returns[List<SExpression> list]
+ @init {
+ list = new ArrayList<SExpression>();
+ }
+ :
+ ( a=lisp_list { list.add( a ); }
+ | a=deffunction { FunctionHandlers.dump(a, null, context); }
+ )*
+// { sExpressions = ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ); }
+ ;
+ */
+
+importDescr returns[ImportDescr importDescr]
+ : LEFT_PAREN 'import' importName=NAME { importDescr = new ImportDescr( importName.getText() ); } RIGHT_PAREN
+ ;
+/*
+
+execution_list returns[ExecutionEngine engine]
+ @init {
+ engine = new BlockExecutionEngine();
+ BuildContext context = new ExecutionBuildContext( engine, functionRegistry );
+ }
+
+ :
+ (fc=lisp_list[context, new LispForm(context) ] { context.addFunction( (FunctionCaller) fc ); })
+ ;
+*/
+
+/*
+deffunction returns[Deffunction function]
+ @init {
+ BuildContext context = null;
+ }
+ : loc=LEFT_PAREN
+ DEFFUNCTION
+ ruleName=NAME {
+ function = new Deffunction( ruleName.getText() );
+ functionRegistry.addFunction( function );
+ context = new ExecutionBuildContext( function, functionRegistry );
+ }
+ loc=LEFT_PAREN
+ (v=VAR {
+ context.addVariable( function.addParameter( v.getText() ) );
+ })*
+ RIGHT_PAREN
+ (fc=lisp_list[context, new LispForm(context) ] { context.addFunction( (FunctionCaller) fc ); })*
+ RIGHT_PAREN
+ ;
+*/
+
+/*
+deffunction_params[BuildContext context]
+ : loc=LEFT_PAREN
+ (v=VAR {
+ // this creates a parameter on the underlying function
+ context.createLocalVariable( v.getText() );
+ })*
+ RIGHT_PAREN
+ ;
+*/
+
+deffunction returns[FunctionDescr functionDescr]
+ @init {
+ List content = null;
+ functionDescr = null;
+ }
+ : LEFT_PAREN
+ t=DEFFUNCTION //{ list.add( new SymbolLispAtom( t.getText() ) ); } //deffunction
+ name=lisp_atom //name
+ params=lisp_form // params
+ (form=lisp_form { if ( content == null ) content = new ArrayList(); content.add( form ); } )+
+ RIGHT_PAREN
+ { functionDescr = FunctionHandlers.createFunctionDescr( name, params, content ); }
+ //{ sExpression = new LispForm( ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ) ); }
+ ;
+
+defrule returns [RuleDescr rule]
+ @init {
+ rule = null;
+ AndDescr lhs = null;
+ PatternDescr colum = null;
+ AttributeDescr module = null;
+ Set declarations = null;
+ }
+ : loc=LEFT_PAREN
+
+ DEFRULE ruleName=NAME
+ {
+ debug( "start rule: " + ruleName.getText() );
+ String ruleStr = ruleName.getText();
+
+ if ( ruleStr.indexOf("::") >= 0 ) {
+ String mod = ruleStr.substring(0, ruleStr.indexOf("::"));
+ ruleStr = ruleStr.substring(ruleStr.indexOf("::")+2);
+ module = new AttributeDescr( "agenda-group", mod );
+ module.setLocation( offset(ruleName.getLine()), ruleName.getCharPositionInLine() );
+ module.setStartCharacter( ((CommonToken)ruleName).getStartIndex() );
+ module.setEndCharacter( ((CommonToken)ruleName).getStopIndex() );
+ }
+
+ rule = new RuleDescr( ruleStr, null );
+ if( module != null ) {
+ rule.addAttribute( module );
+ }
+
+ rule.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
+ rule.setStartCharacter( ((CommonToken)loc).getStartIndex() );
+
+ // not sure how you define where a LHS starts in clips, so just putting it here for now
+ lhs = new AndDescr();
+ rule.setLhs( lhs );
+ lhs.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
+ lhs.setStartCharacter( ((CommonToken)loc).getStartIndex() );
+
+ rule.addAttribute( new AttributeDescr( "dialect", "clips") );
+
+ declarations = new HashSet();
+ }
+ documentation=STRING {
+ // do nothing here for now
+ }
+ ruleAttribute[rule]
+
+ ce[lhs, declarations]*
+
+ '=>'
+
+ t=lisp_form { rule.setConsequence( t ); }
+
+ RIGHT_PAREN
+ ;
+
+
+ruleAttribute[RuleDescr rule]
+ :
+ ( LEFT_PAREN 'declare'
+ ( LEFT_PAREN d=salience { rule.addAttribute( d ); } RIGHT_PAREN )?
+ RIGHT_PAREN )?
+ ;
+
+salience returns [AttributeDescr d ]
+ @init {
+ d = null;
+ }
+ :
+ loc=SALIENCE i=INT
+ {
+ d = new AttributeDescr( "salience", i.getText() );
+ d.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
+ d.setStartCharacter( ((CommonToken)loc).getStartIndex() );
+ d.setEndCharacter( ((CommonToken)i).getStopIndex() );
+ }
+ ;
+
+
+ce[ConditionalElementDescr in_ce, Set declarations]
+ : ( and_ce[in_ce, declarations]
+ | or_ce[in_ce, declarations]
+ | not_ce[in_ce, declarations]
+ | exists_ce[in_ce, declarations]
+ | eval_ce[in_ce, declarations]
+ | normal_pattern[in_ce, declarations]
+ | bound_pattern[in_ce, declarations]
+ )
+ ;
+
+and_ce[ConditionalElementDescr in_ce, Set declarations]
+ @init {
+ AndDescr andDescr= null;
+ }
+ : LEFT_PAREN
+ AND {
+ andDescr = new AndDescr();
+ in_ce.addDescr( andDescr );
+ }
+ ce[andDescr, declarations]+
+ RIGHT_PAREN
+ ;
+
+or_ce[ConditionalElementDescr in_ce, Set declarations]
+ @init {
+ OrDescr orDescr= null;
+ }
+ : LEFT_PAREN
+ OR {
+ orDescr = new OrDescr();
+ in_ce.addDescr( orDescr );
+ }
+ ce[orDescr, declarations]+
+ RIGHT_PAREN
+ ;
+
+not_ce[ConditionalElementDescr in_ce, Set declarations]
+ @init {
+ NotDescr notDescr= null;
+ }
+ : LEFT_PAREN
+ NOT {
+ notDescr = new NotDescr();
+ in_ce.addDescr( notDescr );
+ }
+ ce[notDescr, declarations]
+ RIGHT_PAREN
+ ;
+
+exists_ce[ConditionalElementDescr in_ce, Set declarations]
+ @init {
+ ExistsDescr existsDescr= null;
+ }
+ : LEFT_PAREN
+ EXISTS {
+ existsDescr = new ExistsDescr();
+ in_ce.addDescr( existsDescr );
+ }
+ ce[existsDescr, declarations]
+ RIGHT_PAREN
+ ;
+
+eval_ce[ConditionalElementDescr in_ce, Set declarations]
+ : LEFT_PAREN
+ TEST
+ t=lisp_form { EvalDescr evalDescr = new EvalDescr(); evalDescr.setContent( t ); in_ce.addDescr( evalDescr ); }
+ RIGHT_PAREN
+ ;
+
+normal_pattern[ConditionalElementDescr in_ce, Set declarations]
+ @init {
+ PatternDescr pattern = null;
+ ConditionalElementDescr top = null;
+ }
+ : LEFT_PAREN
+ name=NAME {
+ pattern = new PatternDescr(name.getText());
+ in_ce.addDescr( pattern );
+ top = pattern.getConstraint();
+
+ }
+ field_constriant[top, declarations]*
+ RIGHT_PAREN
+ ;
+
+
+
+bound_pattern[ConditionalElementDescr in_ce, Set declarations]
+ @init {
+ PatternDescr pattern = null;
+ String identifier = null;
+ ConditionalElementDescr top = null;
+ }
+ : var=VAR {
+ identifier = var.getText();
+ }
+ ASSIGN_OP LEFT_PAREN name=NAME
+ {
+ pattern = new PatternDescr(name.getText());
+ pattern.setIdentifier( identifier );
+ in_ce.addDescr( pattern );
+ top = pattern.getConstraint();
+ }
+ field_constriant[top, declarations]*
+ RIGHT_PAREN
+ ;
+
+field_constriant[ConditionalElementDescr base, Set declarations]
+ @init {
+ List list = new ArrayList();
+ FieldBindingDescr fbd = null;
+ FieldConstraintDescr fc = null;
+ RestrictionConnectiveDescr top = null;
+ String op = "==";
+ }
+ :
+ LEFT_PAREN f=NAME
+ {
+ fc = new FieldConstraintDescr(f.getText());
+ fc.setLocation( offset(f.getLine()), f.getCharPositionInLine() );
+ fc.setStartCharacter( ((CommonToken)f).getStartIndex() );
+ base.addDescr( fc );
+ top = fc.getRestriction();
+ }
+
+ or_restr_connective[top, base, fc, declarations]
+ RIGHT_PAREN
+ ;
+/*
+connected_constraint[RestrictionConnectiveDescr rc, ConditionalElementDescr base]
+ :
+ restriction[rc, base]
+ (
+ AMPERSAND { rc.addRestriction(new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND)); }
+ connected_constraint[rc, base]
+ |
+ PIPE {rc.addRestriction(new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR)); }
+ connected_constraint[rc, base]
+ )?
+ ;
+*/
+
+
+or_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ]
+ options {
+ backtrack=true;
+ }
+ @init {
+ RestrictionConnectiveDescr or = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.OR);
+ }
+ :
+ and_restr_connective[or, ceBase, fcBase, declarations]
+ (
+ options {backtrack=true;}
+ : PIPE
+ {
+ location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+ }
+ and_restr_connective[or, ceBase, fcBase, declarations]
+ )*
+ ;
+ finally {
+ if( or.getRestrictions().size() == 1 ) {
+ $rcBase.addOrMerge( (RestrictionDescr) or.getRestrictions().get( 0 ) );
+ } else if ( or.getRestrictions().size() > 1 ) {
+ $rcBase.addRestriction( or );
+ }
+ }
+
+and_restr_connective[ RestrictionConnectiveDescr rcBase, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ]
+ @init {
+ RestrictionConnectiveDescr and = new RestrictionConnectiveDescr(RestrictionConnectiveDescr.AND);
+ }
+ :
+ restriction[and, ceBase, fcBase, declarations]
+ ( AMPERSAND restriction[and, ceBase, fcBase, declarations] )*
+ /*
+ ( options {backtrack=true;}
+ : t=AMPERSAND
+ {
+ location.setType(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
+ }
+ restriction[and, ceBase]
+ )*
+ */
+ ;
+ finally {
+ if( and.getRestrictions().size() == 1) {
+ $rcBase.addOrMerge( (RestrictionDescr) and.getRestrictions().get( 0 ) );
+ } else if ( and.getRestrictions().size() > 1 ) {
+ $rcBase.addRestriction( and );
+ }
+ }
+
+restriction[RestrictionConnectiveDescr rc, ConditionalElementDescr base, FieldConstraintDescr fcBase, Set declarations ]
+ @init {
+ String op = "==";
+ }
+ : (TILDE{op = "!=";})?
+ ( predicate_constraint[rc, op, base]
+ | return_value_restriction[op, rc]
+ | variable_restriction[op, rc, base, fcBase, declarations]
+ | lc=literal_restriction {
+ rc.addRestriction( new LiteralRestrictionDescr(op, lc) );
+ op = "==";
+ }
+ )
+ ;
+
+predicate_constraint[RestrictionConnectiveDescr rc, String op, ConditionalElementDescr base]
+ : COLON
+ t=lisp_form { $rc.addRestriction( new PredicateDescr( t ) ); }
+
+ ;
+
+
+return_value_restriction[String op, RestrictionConnectiveDescr rc]
+ : EQUALS
+ t=lisp_form {rc.addRestriction( new ReturnValueRestrictionDescr (op, t ) ); }
+ ;
+
+//will add a declaration field binding, if this is the first time the name is used
+variable_restriction[String op, RestrictionConnectiveDescr rc, ConditionalElementDescr ceBase, FieldConstraintDescr fcBase, Set declarations ]
+ : VAR {
+ if ( declarations.contains( $VAR.text ) ) {
+ rc.addRestriction( new VariableRestrictionDescr(op, $VAR.text) );
+ } else {
+ FieldBindingDescr fbd = new FieldBindingDescr();
+ fbd.setIdentifier( $VAR.text );
+ fbd.setFieldName( fcBase.getFieldName() );
+ ceBase.insertBeforeLast( FieldConstraintDescr.class, fbd );
+ declarations.add( $VAR.text );
+ }
+ }
+ ;
+
+
+literal_restriction returns [String text]
+ @init {
+ text = null;
+ }
+ :
+ t=literal {
+ text = t;
+ }
+ ;
+
+/*
+eval_sExpressions[MVELClipsContext context] returns[List<SExpression> list]
+ @init {
+ list = new ArrayList<SExpression>();
+ }
+ :
+ ( a=lisp_list { list.add( a ); }
+ | a=deffunction { FunctionHandlers.dump(a, null, context); }
+ )*
+// { sExpressions = ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ); }
+ ;
+*/
+lisp_form returns[LispForm lispForm]
+ @init {
+ List list = new ArrayList();
+ lispForm = null;
+ }
+ : LEFT_PAREN
+
+ (
+ t=NAME { list.add( new SymbolLispAtom( t.getText() ) ); }
+ |
+ t=VAR { list.add( new VariableLispAtom( t.getText(), context ) ); }
+ )
+ ( a=lisp_atom { list.add( a ); }
+ | l=lisp_form { list.add( l ); }
+ )*
+ RIGHT_PAREN
+ { lispForm = new LispForm( ( SExpression[] ) list.toArray( new SExpression[ list.size () ] ) ); }
+ ;
+
+lisp_atom returns[SExpression sExpression]
+ @init {
+ sExpression = null;
+ }
+ :
+ (
+ t=VAR { sExpression = new VariableLispAtom( t.getText(), context ); }
+ | t=STRING { sExpression = new StringLispAtom( getString( t ) ); }
+ | t=FLOAT { sExpression = new FloatLispAtom( t.getText() ); }
+ | t=INT { sExpression = new IntLispAtom( t.getText() ); }
+ | t=BOOL { sExpression = new BoolLispAtom( t.getText() ); }
+ | t=NULL { sExpression = new NullLispAtom( null ); }
+ | t=NAME { sExpression = new SymbolLispAtom( "\"" +t.getText() + "\""); }
+
+ )
+ ;
+
+literal returns [String text]
+ @init {
+ text = null;
+ }
+ : ( t=STRING { text = getString( t ); }
+ | t=NAME { text = t.getText(); }
+ | t=INT { text = t.getText(); }
+ | t=FLOAT { text = t.getText(); }
+ | t=BOOL { text = t.getText(); }
+ | t=NULL { text = null; }
+ )
+ ;
+
+WS : ( ' '
+ | '\t'
+ | '\f'
+ | EOL
+ )
+ { $channel=HIDDEN; }
+ ;
+
+DEFRULE : 'defrule';
+DEFFUNCTION : 'deffunction';
+OR : 'or';
+AND : 'and';
+NOT : 'not';
+EXISTS : 'exists';
+TEST : 'test';
+
+NULL : 'null';
+
+DECLARE : 'declare';
+
+SALIENCE : 'salience';
+
+//MODIFY : 'modify';
+
+fragment
+EOL :
+ ( ( '\r\n' )=> '\r\n' // Evil DOS
+ | '\r' // Macintosh
+ | '\n' // Unix (the right way)
+ )
+ ;
+
+INT
+ : ('-')?('0'..'9')+
+ ;
+
+FLOAT
+ : ('-')?('0'..'9')+ '.' ('0'..'9')+
+ ;
+
+STRING
+ : ('"' ( EscapeSequence | ~('\\'|'"') )* '"')
+ | ('\'' ( EscapeSequence | ~('\\'|'\'') )* '\'')
+ ;
+
+fragment
+HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
+
+fragment
+EscapeSequence
+ : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
+ | UnicodeEscape
+ | OctalEscape
+ ;
+
+fragment
+OctalEscape
+ : '\\' ('0'..'3') ('0'..'7') ('0'..'7')
+ | '\\' ('0'..'7') ('0'..'7')
+ | '\\' ('0'..'7')
+ ;
+
+fragment
+UnicodeEscape
+ : '\\' 'u' HexDigit HexDigit HexDigit HexDigit
+ ;
+
+BOOL
+ : ('true'|'false')
+ ;
+
+VAR : '?' SYMBOL_CHAR+
+ ;
+
+SH_STYLE_SINGLE_LINE_COMMENT
+ : '#' ( options{greedy=false;} : .)* EOL /* ('\r')? '\n' */
+ { $channel=HIDDEN; }
+ ;
+
+
+C_STYLE_SINGLE_LINE_COMMENT
+ : '//' ( options{greedy=false;} : .)* EOL // ('\r')? '\n'
+ { $channel=HIDDEN; }
+ ;
+
+
+LEFT_PAREN
+ : '('
+ ;
+
+RIGHT_PAREN
+ : ')'
+ ;
+
+LEFT_SQUARE
+ : '['
+ ;
+
+RIGHT_SQUARE
+ : ']'
+ ;
+
+LEFT_CURLY
+ : '{'
+ ;
+
+RIGHT_CURLY
+ : '}'
+ ;
+
+TILDE : '~'
+ ;
+
+AMPERSAND
+ : '&'
+ ;
+
+PIPE
+ : '|'
+ ;
+
+ASSIGN_OP
+ : '<-'
+ ;
+
+COLON : ':';
+
+EQUALS : '=';
+
+MULTI_LINE_COMMENT
+ : '/*' (options{greedy=false;} : .)* '*/'
+ { $channel=HIDDEN; }
+ ;
+
+NAME : SYMBOL ;
+
+fragment
+SYMBOL : FIRST_SYMBOL_CHAR SYMBOL_CHAR* ;
+
+// allowed <
+// not allowed ?
+fragment
+FIRST_SYMBOL_CHAR : ('a'..'z'|'A'..'Z'|'0'..'9'|'!'|'$'|'%'|'^'|'*'|'_'|'-'|'+'|'='|'\\'|'/'|'@'|'#'|':'|'>'|'<'|','|'.'|'['|']'|'{'|'}');
+
+// allowed ?
+// not allowed <
+fragment
+SYMBOL_CHAR : ('a'..'z'|'A'..'Z'|'0'..'9'|'!'|'$'|'%'|'^'|'*'|'_'|'-'|'+'|'='|'\\'|'/'|'@'|'#'|':'|'>'|','|'.'|'['|']'|'{'|'}'|'?');
+
+
+
Modified: labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/mvel/TestMVEL.java
===================================================================
--- labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/mvel/TestMVEL.java 2008-01-29 21:02:48 UTC (rev 18198)
+++ labs/jbossrules/trunk/drools-clips/src/test/java/org/drools/clips/mvel/TestMVEL.java 2008-01-29 21:27:34 UTC (rev 18199)
@@ -3,32 +3,15 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
-import java.io.Reader;
-import java.io.Serializable;
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
import junit.framework.TestCase;
-import org.antlr.runtime.ANTLRReaderStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.drools.clips.Appendable;
import org.drools.clips.CLPMVELLexer;
import org.drools.clips.CLPMVELParser;
import org.drools.clips.CreateListFunction;
import org.drools.clips.EqFunction;
-import org.drools.clips.FunctionContext;
import org.drools.clips.FunctionHandlers;
-import org.drools.clips.LispForm;
-import org.drools.clips.MVELBuildContext;
-import org.drools.clips.ParserHandler;
-import org.drools.clips.PrintRouterContext;
-import org.drools.clips.StringBuilderAppendable;
-import org.drools.clips.VariableContext;
+import org.drools.clips.Shell;
import org.drools.clips.functions.IfFunction;
import org.drools.clips.functions.LessThanFunction;
import org.drools.clips.functions.ModifyFunction;
@@ -39,14 +22,6 @@
import org.drools.clips.functions.PrognFunction;
import org.drools.clips.functions.ReturnFunction;
import org.drools.clips.functions.SwitchFunction;
-import org.drools.lang.descr.FunctionDescr;
-import org.drools.lang.descr.ImportDescr;
-import org.drools.lang.descr.RuleDescr;
-import org.mvel.MVEL;
-import org.mvel.ast.Function;
-import org.mvel.compiler.CompiledExpression;
-import org.mvel.compiler.ExpressionCompiler;
-import org.mvel.util.CompilerTools;
public class TestMVEL extends TestCase {
private ByteArrayOutputStream baos;
@@ -159,179 +134,4 @@
new String( baos.toByteArray() ) );
}
- public static class Shell
- implements
- ParserHandler,
- VariableContext,
- FunctionContext,
- PrintRouterContext,
- MVELBuildContext {
- private Map<String, Object> vars;
- private Map<String, String> varNameMap;
-
- public Shell() {
- this.vars = new HashMap<String, Object>();
- this.varNameMap = new HashMap<String, String>();
- }
-
- public void functionHandler(FunctionDescr ruleDescr) {
- Appendable builder = new StringBuilderAppendable();
-
- // strip lead/trailing quotes
- String name = ruleDescr.getName().trim();
- if ( name.charAt( 0 ) == '"' ) {
- name = name.substring( 1 );
- }
-
- if ( name.charAt( name.length() - 1 ) == '"' ) {
- name = name.substring( 0,
- name.length() - 1 );
- }
- builder.append( "function " + name + "(" );
-
- for ( int i = 0, length = ruleDescr.getParameterNames().size(); i < length; i++ ) {
- builder.append( ruleDescr.getParameterNames().get( i ) );
- if ( i < length - 1 ) {
- builder.append( ", " );
- }
- }
-
- builder.append( ") {\n" );
- List list = (List) ruleDescr.getContent();
- for ( Iterator it = list.iterator(); it.hasNext(); ) {
- FunctionHandlers.dump( (LispForm) it.next(),
- builder,
- this );
- }
- builder.append( "}" );
-
- ExpressionCompiler compiler = new ExpressionCompiler( builder.toString() );
- Serializable s1 = compiler.compile();
- Map<String, org.mvel.ast.Function> map = CompilerTools.extractAllDeclaredFunctions( (CompiledExpression) s1 );
- for ( org.mvel.ast.Function function : map.values() ) {
- addFunction( function );
- }
-
- }
-
- public void importHandler(ImportDescr descr) {
- // TODO Auto-generated method stub
-
- }
-
- public void lispFormHandler(LispForm lispForm) {
- StringBuilderAppendable appendable = new StringBuilderAppendable();
- FunctionHandlers.dump( lispForm,
- appendable,
- this );
- MVEL.eval( appendable.toString(),
- this.vars );
-
- }
-
- public void ruleHandler(RuleDescr ruleDescr) {
- // TODO Auto-generated method stub
-
- }
-
- public void eval(String string) {
- eval( new StringReader( string ) );
- }
-
- public void eval(Reader reader) {
- CLPMVELParser parser;
- try {
- parser = new CLPMVELParser( new CommonTokenStream( new CLPMVELLexer( new ANTLRReaderStream( reader ) ) ) );
- parser.eval( this,
- this );
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- }
-
- public void addFunction(Function function) {
- this.vars.put( function.getAbsoluteName(),
- function );
- }
-
- public boolean removeFunction(String functionName) {
- return (this.vars.remove( functionName ) != null);
- }
-
- public Map<String, Function> getFunctions() {
- Map<String, Function> map = new HashMap<String, Function>();
- for ( Iterator it = this.vars.entrySet().iterator(); it.hasNext(); ) {
- Entry entry = (Entry) it.next();
- if ( entry.getValue() instanceof Function ) {
- map.put( (String) entry.getKey(),
- (Function) entry.getValue() );
- }
- }
- return map;
- }
-
- public void addRouter(String name,
- PrintStream out) {
-
- Map routers = (Map) this.vars.get( "printrouters" );
- if ( routers == null ) {
- routers = new HashMap();
- this.vars.put( "printrouters",
- routers );
- }
- routers.put( name,
- out );
-
- }
-
- public boolean removeRouter(String name) {
- return (this.vars.remove( name ) != null);
- }
-
- public Map<String, PrintStream> getRouters() {
- Map<String, PrintStream> map = new HashMap<String, PrintStream>();
- for ( Iterator it = this.vars.entrySet().iterator(); it.hasNext(); ) {
- Entry entry = (Entry) it.next();
- if ( entry.getValue() instanceof Function ) {
- map.put( (String) entry.getKey(),
- (PrintStream) entry.getValue() );
- }
- }
- return map;
- }
-
- public void addVariable(String name,
- Object value) {
- String temp = this.varNameMap.get( name );
- if ( temp == null ) {
- temp = makeValid( name );
- if ( !temp.equals( name ) ) {
- this.varNameMap.put( name,
- temp );
- }
- }
- this.vars.put( temp,
- value );
- }
-
- public void removeVariable(String name) {
- String temp = this.varNameMap.get( name );
- if ( temp != null ) {
- name = temp;
- }
- this.vars.remove( name );
- }
-
- public Map<String, String> getVariableNameMap() {
- return this.varNameMap;
- }
-
- public String makeValid(String var) {
- var = var.replaceAll( "\\?",
- "_Q_" );
- return var;
- }
-
- }
-
}
More information about the jboss-svn-commits
mailing list