directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 56803 - incubator/directory/ldap/trunk/common/src/antlr
Date Sun, 07 Nov 2004 03:07:44 GMT
Author: akarasulu
Date: Sat Nov  6 19:07:43 2004
New Revision: 56803

Modified:
   incubator/directory/ldap/trunk/common/src/antlr/filter-lexer.g
   incubator/directory/ldap/trunk/common/src/antlr/filter-parser.g
Log:
There's a nasty little bug in ANTLR it seems when you use stream 
multiplexing with a selector.  Basically what happens is lookahead
is all messed up and you can get stuck in the wrong lexer.  What
was happening here for the third alternative of extensible matches
is we were looking past the := in the main filter lexer and reading
the valueencoding as an attributedescription.  By moving this up
in the call stack we were able to correct the problem. 

Also note that I removed some bogus one line comments for the WS 
choice in the filter lexer.  This had nothing to do with the problem
above.



Modified: incubator/directory/ldap/trunk/common/src/antlr/filter-lexer.g
==============================================================================
--- incubator/directory/ldap/trunk/common/src/antlr/filter-lexer.g	(original)
+++ incubator/directory/ldap/trunk/common/src/antlr/filter-lexer.g	Sat Nov  6 19:07:43 2004
@@ -64,8 +64,7 @@
 // ----------------------------------------------------------------------------
 
 
-WS  :   (   '#' (~'\n')* '\n' { newline(); }
-        |    ' '
+WS  :   (   ' '
         |   '\t'
         |   '\r' '\n' { newline(); }
         |   '\n'      { newline(); }

Modified: incubator/directory/ldap/trunk/common/src/antlr/filter-parser.g
==============================================================================
--- incubator/directory/ldap/trunk/common/src/antlr/filter-parser.g	(original)
+++ incubator/directory/ldap/trunk/common/src/antlr/filter-parser.g	Sat Nov  6 19:07:43 2004
@@ -233,7 +233,15 @@
 {
     node = null;
 }
-    : node=simple | node=extensible;
+    : node=simple | node=extensible |
+    ( COLONEQUALS
+        {
+            selector.select( valueLexer );
+            String value = ( ( String ) valueParser.value( null ) ).trim();
+            node = new ExtensibleNode( null, value, null, false );
+        }
+    )
+    ;
 
 
 /**
@@ -351,13 +359,6 @@
                     throw new RecognitionException( msg, matchingRule, 0, idx );
                 }
             }
-        COLONEQUALS
-        {
-            selector.select( valueLexer );
-            value = ( ( String ) valueParser.value( attribute ) ).trim();
-        }
-    |
-        // A L T E R N A T I V E   3 :
         COLONEQUALS
         {
             selector.select( valueLexer );

Mime
View raw message