You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2006/11/26 19:27:21 UTC

svn commit: r479393 - in /directory/sandbox/ersiner/ldapschema: ./ src/ src/main/ src/main/antlr/ src/main/java/

Author: ersiner
Date: Sun Nov 26 10:27:20 2006
New Revision: 479393

URL: http://svn.apache.org/viewvc?view=rev&rev=479393
Log:
Adding parsers for new schema subsystem.
I had writen these a few months ago. They are not complete yet.
I use the new version of the maven antlr plugin which supports grammar inheritance.

Added:
    directory/sandbox/ersiner/ldapschema/
    directory/sandbox/ersiner/ldapschema/pom.xml
    directory/sandbox/ersiner/ldapschema/src/
    directory/sandbox/ersiner/ldapschema/src/main/
    directory/sandbox/ersiner/ldapschema/src/main/antlr/
    directory/sandbox/ersiner/ldapschema/src/main/antlr/AttributeTypeDescriptionParser.g
    directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseLexer.g
    directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseParser.g
    directory/sandbox/ersiner/ldapschema/src/main/antlr/ObjectClassDescriptionParser.g
    directory/sandbox/ersiner/ldapschema/src/main/java/

Added: directory/sandbox/ersiner/ldapschema/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/ldapschema/pom.xml?view=auto&rev=479393
==============================================================================
--- directory/sandbox/ersiner/ldapschema/pom.xml (added)
+++ directory/sandbox/ersiner/ldapschema/pom.xml Sun Nov 26 10:27:20 2006
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.directory.shared.ldap.schema</groupId>
+  <artifactId>directory-shared-ldap-schema</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <name>Apache Directory Ldap Schema Definitions Parsers</name>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache.snapshots</id>
+      <name>Apache Snapshot Plugins</name>
+      <url>http://minotaur.apache.org/maven-snapshot-repository</url>
+    </pluginRepository>
+  </pluginRepositories>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>nlog4j</artifactId>
+      <version>1.2.25</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>antlr</groupId>
+      <artifactId>antlr</artifactId>
+      <version>2.7.6</version>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+
+    <plugins>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antlr-plugin</artifactId>
+        <version>2.0-beta-2-SNAPSHOT</version>
+        <configuration>
+          <grammarDefs>
+            <grammar>
+              <name>LdapSchemaDefinitionsBaseLexer.g</name>
+            </grammar>
+            <grammar>
+              <name>LdapSchemaDefinitionsBaseParser.g</name>
+            </grammar>
+            <grammar>
+              <name>ObjectClassDescriptionParser.g</name>
+              <glib>LdapSchemaDefinitionsBaseParser.g</glib>
+            </grammar>
+            <grammar>
+              <name>AttributeTypeDescriptionParser.g</name>
+              <glib>LdapSchemaDefinitionsBaseParser.g</glib>
+            </grammar>
+          </grammarDefs>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+    </plugins>
+
+  </build>
+
+</project>
+

Added: directory/sandbox/ersiner/ldapschema/src/main/antlr/AttributeTypeDescriptionParser.g
URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/ldapschema/src/main/antlr/AttributeTypeDescriptionParser.g?view=auto&rev=479393
==============================================================================
--- directory/sandbox/ersiner/ldapschema/src/main/antlr/AttributeTypeDescriptionParser.g (added)
+++ directory/sandbox/ersiner/ldapschema/src/main/antlr/AttributeTypeDescriptionParser.g Sun Nov 26 10:27:20 2006
@@ -0,0 +1,48 @@
+header {
+    package org.apache.directory.shared.ldap.schema;
+}
+
+class AttributeTypeDescriptionParser extends LdapSchemaDefinitionsBaseParser;
+
+options {
+    k=2;
+}
+
+attributeTypeDescription
+    :
+    LPAREN ( SPACE )*
+    numericoid
+    ( options { greedy=true; } : ( SPACE )+ ID_NAME ( SPACE )+ qdescrs )?
+    ( options { greedy=true; } : ( SPACE )+ ID_DESC ( SPACE )+ qdstring )?
+    ( options { greedy=true; } : ( SPACE )+ ID_OBSOLETE )?
+    ( options { greedy=true; } : ( SPACE )+ ID_SUP ( SPACE )+ oid )?
+    ( options { greedy=true; } : ( SPACE )+ ID_EQUALITY ( SPACE )+ oid )?
+    ( options { greedy=true; } : ( SPACE )+ ID_ORDERING ( SPACE )+ oid )?
+    ( options { greedy=true; } : ( SPACE )+ ID_SUBSTR ( SPACE )+ oid )?
+    ( options { greedy=true; } : ( SPACE )+ ID_SYNTAX ( SPACE )+ noidlen )?
+    ( options { greedy=true; } : ( SPACE )+ ID_SINGLE_VALUE )?
+    ( options { greedy=true; } : ( SPACE )+ ID_COLLECTIVE )?
+    ( options { greedy=true; } : ( SPACE )+ ID_NO_USER_MODIFICATION )?
+    ( options { greedy=true; } : ( SPACE )+ ID_USAGE ( SPACE )+ usage )?
+    extensions ( SPACE )* RPAREN
+    ;
+
+usage
+    :
+    ID_USER_APPLICATIONS |
+    ID_DIRECTORY_OPERATION |
+    ID_DISTRIBUTED_OPERATION |
+    ID_DSA_OPERATION
+    ;
+
+class AttributeTypeDescriptionLexer extends LdapSchemaDefinitionsBaseLexer;
+
+options
+{
+    k=3;
+}
+
+ID_USER_APPLICATIONS : "userApplications";
+ID_DIRECTORY_OPERATION : "directoryOperation";
+ID_DISTRIBUTED_OPERATION : "distributedOperation";
+ID_DSA_OPERATION : "dSAOperation";

Added: directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseLexer.g
URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseLexer.g?view=auto&rev=479393
==============================================================================
--- directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseLexer.g (added)
+++ directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseLexer.g Sun Nov 26 10:27:20 2006
@@ -0,0 +1,52 @@
+header {
+package org.apache.directory.shared.ldap.schema;
+}
+
+class LdapSchemaDefinitionsBaseLexer extends Lexer;
+
+options
+{
+    k=2;
+}
+
+ALPHA : ( 'A' .. 'Z' ) | ( 'a' .. 'z' );
+
+Zero : '0';
+
+OneToNine : '1' .. '9';
+
+SPACE : ' ';
+
+DQUOTE : '\"';
+
+DOLLAR : '$';
+
+SQUOTE : '\'';
+
+LPAREN : '(';
+
+RPAREN : ')';
+
+HYPHEN : '-';
+
+DOT : '.';
+
+SEMI : ';';
+
+ESC : '\\';
+
+USCORE : '_';
+
+LCURLY : '{';
+
+RCURLY : '}';
+
+protected OCTET : '\u0000'..'\uffff';
+
+UTF8 : DQUOTE OCTET DQUOTE;
+
+QQ : ESC '2' '7';
+
+QS : ESC '5' ( 'C' | 'c' );
+
+XHYPHEN : 'X' HYPHEN;

Added: directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseParser.g
URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseParser.g?view=auto&rev=479393
==============================================================================
--- directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseParser.g (added)
+++ directory/sandbox/ersiner/ldapschema/src/main/antlr/LdapSchemaDefinitionsBaseParser.g Sun Nov 26 10:27:20 2006
@@ -0,0 +1,40 @@
+header {
+    package org.apache.directory.shared.ldap.schema;
+}
+
+class LdapSchemaDefinitionsBaseParser extends Parser;
+
+options {
+    importVocab=LdapSchemaDefinitionsBaseLexer;
+    k=1;
+}
+
+keystring : ALPHA ( ALPHA | ( Zero | OneToNine ) | HYPHEN )*;
+
+number : Zero | OneToNine ( Zero | OneToNine  )*;
+
+numericoid : number ( DOT number )+;
+
+descr : keystring;
+
+oid : numericoid | keystring;
+
+noidlen : numericoid ( LCURLY number RCURLY )?;
+
+oids : oid | ( LPAREN ( SPACE )* oid ( SPACE )* ( DOLLAR ( SPACE )* oid ( SPACE ) )* RPAREN );
+
+extensions : ( options { greedy=true; } : ( SPACE )+ xstring ( SPACE )+ qdstrings )*;
+
+xstring : XHYPHEN ( ALPHA | HYPHEN | USCORE )+;
+
+/* qdescrs : qdescr | ( LPAREN ( SPACE )* ( qdescr ( ( SPACE )+ qdescr )* ( SPACE )* )? RPAREN ); */
+
+qdescrs : qdescr | ( LPAREN ( SPACE )* ( qdescr ( qdescr ( SPACE )+ )*  )? RPAREN );
+
+qdescr : SQUOTE descr SQUOTE;
+
+/* qdstrings : qdstring | ( LPAREN ( SPACE )* ( qdstring ( ( SPACE )+ qdstring )* ( SPACE )* )? RPAREN ); */
+
+qdstrings : qdstring | ( LPAREN ( SPACE )* ( qdstring ( qdstring ( SPACE )+ )* )? RPAREN );
+
+qdstring : SQUOTE ( QS | QQ | UTF8 )+ SQUOTE;

Added: directory/sandbox/ersiner/ldapschema/src/main/antlr/ObjectClassDescriptionParser.g
URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/ldapschema/src/main/antlr/ObjectClassDescriptionParser.g?view=auto&rev=479393
==============================================================================
--- directory/sandbox/ersiner/ldapschema/src/main/antlr/ObjectClassDescriptionParser.g (added)
+++ directory/sandbox/ersiner/ldapschema/src/main/antlr/ObjectClassDescriptionParser.g Sun Nov 26 10:27:20 2006
@@ -0,0 +1,37 @@
+header {
+    package org.apache.directory.shared.ldap.schema;
+}
+
+class ObjectClassDescriptionParser extends LdapSchemaDefinitionsBaseParser;
+
+options {
+    k=5;
+}
+
+objectClassDescription
+    :
+    LPAREN ( SPACE )*
+    numericoid
+    ( options { greedy=true; } : ( SPACE )+ ID_NAME ( SPACE )+ qdescr )?
+    ( options { greedy=true; } : ( SPACE )+ ID_DESC ( SPACE )+ qdstring )?
+    ( options { greedy=true; } : ( SPACE )+ ID_OBSOLUTE )?
+    ( options { greedy=true; } : ( SPACE )+ ID_SUP ( SPACE )+ oids )?
+    ( options { greedy=true; } : ( SPACE )+ kind )?
+    ( options { greedy=true; } : ( SPACE )+ ID_MUST ( SPACE )+ oids )?
+    ( options { greedy=true; } : ( SPACE )+ ID_MAY ( SPACE )+ oids )?
+    extensions ( SPACE )* RPAREN
+    ;
+
+kind
+    :
+    ( ID_ABSTRACT
+    | ID_STRUCTURAL
+    | ID_AUXILARY
+    )
+    ;
+
+class ObjectClassDescriptionLexer extends LdapSchemaDefinitionsBaseLexer;
+
+ID_ABSRACT : "ABSTRACT";
+ID_SRUCTURAL : "STRUCTURAL";
+ID_AUXILARY : "AUXILARY";