r6992 - dumbhippo/trunk/server/src/com/dumbhippo/dm/parser



Author: otaylor
Date: 2007-12-07 16:34:47 -0600 (Fri, 07 Dec 2007)
New Revision: 6992

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchLexer.java
   dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchParser.g
   dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchParser.java
Log:
Fix a bug parsing fetch strings with multiple attributes in them

Modified: dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchLexer.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchLexer.java	2007-12-07 21:37:52 UTC (rev 6991)
+++ dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchLexer.java	2007-12-07 22:34:47 UTC (rev 6992)
@@ -103,6 +103,12 @@
 					theRetToken=_returnToken;
 					break;
 				}
+				case ',':
+				{
+					mCOMMA(true);
+					theRetToken=_returnToken;
+					break;
+				}
 				case ';':
 				{
 					mSEMICOLON(true);
@@ -254,6 +260,19 @@
 		_returnToken = _token;
 	}
 	
+	public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = COMMA;
+		int _saveIndex;
+		
+		match(",");
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
 	public final void mSEMICOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = SEMICOLON;
@@ -321,7 +340,7 @@
 		}
 		}
 		{
-		_loop33:
+		_loop112:
 		do {
 			switch ( LA(1)) {
 			case 'a':  case 'b':  case 'c':  case 'd':
@@ -360,7 +379,7 @@
 			}
 			default:
 			{
-				break _loop33;
+				break _loop112;
 			}
 			}
 		} while (true);
@@ -378,17 +397,17 @@
 		int _saveIndex;
 		
 		{
-		int _cnt36=0;
-		_loop36:
+		int _cnt115=0;
+		_loop115:
 		do {
 			if (((LA(1) >= '0' && LA(1) <= '9'))) {
 				matchRange('0','9');
 			}
 			else {
-				if ( _cnt36>=1 ) { break _loop36; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
+				if ( _cnt115>=1 ) { break _loop115; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
 			}
 			
-			_cnt36++;
+			_cnt115++;
 		} while (true);
 		}
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {

Modified: dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchParser.g
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchParser.g	2007-12-07 21:37:52 UTC (rev 6991)
+++ dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchParser.g	2007-12-07 22:34:47 UTC (rev 6992)
@@ -138,6 +138,7 @@
 LPAREN : "(" ;
 RPAREN : ")" ;
 PLUS : "+" ;
+COMMA : "," ;
 SEMICOLON : ";" ;
 STAR : "*" ;
 NAME : ('a' .. 'z' | 'A' .. 'Z' | '_') ('a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_')* ;

Modified: dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchParser.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchParser.java	2007-12-07 21:37:52 UTC (rev 6991)
+++ dumbhippo/trunk/server/src/com/dumbhippo/dm/parser/FetchParser.java	2007-12-07 22:34:47 UTC (rev 6992)
@@ -111,7 +111,7 @@
 			p=propertyFetch();
 			props.add(p);
 			{
-			_loop5:
+			_loop83:
 			do {
 				if ((LA(1)==SEMICOLON)) {
 					match(SEMICOLON);
@@ -119,7 +119,7 @@
 					props.add(p);
 				}
 				else {
-					break _loop5;
+					break _loop83;
 				}
 				
 			} while (true);
@@ -272,7 +272,7 @@
 			a=attribute();
 			attrs.add(a);
 			{
-			_loop14:
+			_loop92:
 			do {
 				if ((LA(1)==COMMA)) {
 					match(COMMA);
@@ -280,7 +280,7 @@
 					attrs.add(a);
 				}
 				else {
-					break _loop14;
+					break _loop92;
 				}
 				
 			} while (true);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]