directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r663616 - in /directory/shared/trunk/ldap/src: main/antlr/schema-value.g main/antlr/schema.g test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java
Date Thu, 05 Jun 2008 14:08:55 GMT
Author: seelmann
Date: Thu Jun  5 07:08:54 2008
New Revision: 663616

URL: http://svn.apache.org/viewvc?rev=663616&view=rev
Log:
Fix for DIRSHARED-8:
o allow a name for SYNTAX in attribute types 
o fixed nondeterminism between lexer rules AUX and AUXILIARY



Modified:
    directory/shared/trunk/ldap/src/main/antlr/schema-value.g
    directory/shared/trunk/ldap/src/main/antlr/schema.g
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java

Modified: directory/shared/trunk/ldap/src/main/antlr/schema-value.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/schema-value.g?rev=663616&r1=663615&r2=663616&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/schema-value.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/schema-value.g Thu Jun  5 07:08:54 2008
@@ -142,7 +142,11 @@
         (LPAR)?
         (WHSP)?
         (QUOTE)?
-        o:NUMERICOID { noidlen.noid = o.getText(); } 
+        (
+            ( d4:DESCR { noidlen.noid = d4.getText(); } )
+            |
+            ( n2:NUMERICOID { noidlen.noid = n2.getText(); } )
+        )
         (QUOTE)?
         (WHSP)?
         (RPAR)?
@@ -152,7 +156,6 @@
             (WHSP)?
             (RPAR)?
         )?
-        
     )
     ;
 
@@ -167,27 +170,25 @@
     }
     :
     (
+        (LPAR)?
         (WHSP)?
+        (QUOTE)?
         (
-            ( QUOTE q1:QUIRKS_DESCR { noidlen.noid = q1.getText(); } QUOTE )
-            |
             ( q2:QUIRKS_DESCR { noidlen.noid = q2.getText(); } )
             |
-            ( QUOTE d3:DESCR { noidlen.noid = d3.getText(); } QUOTE )
-            |
             ( d4:DESCR { noidlen.noid = d4.getText(); } )
             |
-            ( QUOTE n1:NUMERICOID { noidlen.noid = n1.getText(); } QUOTE  )
-            |
             ( n2:NUMERICOID { noidlen.noid = n2.getText(); } )
         )
+        (QUOTE)?
+        (WHSP)?
+        (RPAR)?
         (
             l:LEN { noidlen.len = Integer.parseInt(l.getText()); }
             (QUOTE)?
             (WHSP)?
             (RPAR)?
-        )?
-        
+        )?    
     )
     ;
 

Modified: directory/shared/trunk/ldap/src/main/antlr/schema.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/schema.g?rev=663616&r1=663615&r2=663616&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/schema.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/schema.g Thu Jun  5 07:08:54 2008
@@ -80,7 +80,7 @@
 OBSOLETE : ( "obsolete" (WHSP)? ) ;
 ABSTRACT : ( "abstract" (WHSP)? ) ;
 STRUCTURAL : ( "structural" (WHSP)? ) ;
-AUXILIARY : ( "auxiliary" (WHSP)? ) ;
+protected AUXILIARY : ( "auxiliary" (WHSP)? ) ;
 
 OBJECTCLASS : ( "objectclass" (WHSP)? ) ;
 ATTRIBUTETYPE : ( "attributetype" (WHSP)? ) ;
@@ -91,7 +91,7 @@
 SUP : ( "sup" (options {greedy=true;} : WHSP)? sup:VALUES ) { setText(sup.getText().trim());
} ;
 MUST : ( "must" (options {greedy=true;} : WHSP)? must:VALUES ) { setText(must.getText().trim());
} ;
 MAY : ( "may" (options {greedy=true;} : WHSP)? may:VALUES ) { setText(may.getText()); } ;
-AUX : ( "aux" (options {greedy=true;} : WHSP)? aux:VALUES ) { setText(aux.getText()); } ;
+protected AUX : ( "aux" (options {greedy=true;} : WHSP)? aux:VALUES ) { setText(aux.getText());
} ;
 NOT : ( "not" (options {greedy=true;} : WHSP)? not:VALUES ) { setText(not.getText()); } ;
 FORM : ( "form" (options {greedy=true;} : WHSP)? form:VALUES ) { setText(form.getText());
} ;
 OC : ( "oc" (options {greedy=true;} : WHSP)? oc:VALUES ) { setText(oc.getText()); } ;
@@ -104,6 +104,12 @@
 FQCN : ( "fqcn" (options {greedy=true;} : WHSP)? fqcn:FQCN_VALUE ) { setText(fqcn.getText().trim());
} ;
 BYTECODE : ( "bytecode" (options {greedy=true;} : WHSP)? bytecode:BYTECODE_VALUE ) { setText(bytecode.getText().trim());
} ;
 
+AUX_OR_AUXILIARY :
+    ( AUXILIARY ) => AUXILIARY { $setType( AUXILIARY ); }
+    |
+    ( AUX ) { $setType( AUX ); }
+    ;
+
 protected VALUES : ( VALUE | LPAR  VALUE ( (DOLLAR)? VALUE )* RPAR ) ;
 protected VALUE : (WHSP)? ( QUOTED_STRING | UNQUOTED_STRING ) (options {greedy=true;}: WHSP)?
;
 protected UNQUOTED_STRING : (options{greedy=true;}: 'a'..'z' | '0'..'9' | '-' | '_' | ';'
| '.' )+ ;

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java?rev=663616&r1=663615&r2=663616&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java
Thu Jun  5 07:08:54 2008
@@ -328,12 +328,18 @@
         assertNull( atd.getSyntax() );
         assertEquals( 0, atd.getSyntaxLength() );
 
+        // SYNTAX string
+        value = "( 1.1 SYNTAX IA5String )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "IA5String", atd.getSyntax() );
+        assertEquals( 0, atd.getSyntaxLength() );
+
         // SYNTAX numericoid
         value = "( 1.1 SYNTAX 1.2.3.4567.8.9.0 )";
         atd = parser.parseAttributeTypeDescription( value );
         assertEquals( "1.2.3.4567.8.9.0", atd.getSyntax() );
         assertEquals( 0, atd.getSyntaxLength() );
-
+        
         // quoted numericoid
         value = "( 1.1 SYNTAX '1.2.3.4567.8.9.0' )";
         atd = parser.parseAttributeTypeDescription( value );
@@ -960,6 +966,7 @@
             testEquality();
             testOrdering();
             testSubstring();
+            testSyntax();
             testSingleValue();
             testCollective();
             testNoUserModification();



Mime
View raw message