directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r267328 - in /directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name: ReusableAntlrNameParser.java ReusableAntlrTypeLexer.java ReusableAntlrValueLexer.java
Date Fri, 02 Sep 2005 21:43:53 GMT
Author: elecharny
Date: Fri Sep  2 14:43:49 2005
New Revision: 267328

URL: http://svn.apache.org/viewcvs?rev=267328&view=rev
Log:
Added those three files which have been created in the trunk

Added:
    directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrNameParser.java
    directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrTypeLexer.java
    directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrValueLexer.java

Added: directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrNameParser.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrNameParser.java?rev=267328&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrNameParser.java
(added)
+++ directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrNameParser.java
Fri Sep  2 14:43:49 2005
@@ -0,0 +1,58 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+
+package org.apache.ldap.common.name;
+
+
+import antlr.TokenStreamSelector;
+
+
+/**
+ * A reusable parser class extended from antlr generated parser for an LDAP
+ * subtree specification as defined by <a href="http://www.faqs.org/rfcs/rfc3672.html">
+ * RFC 3672</a>.  This class enables the reuse of the antlr parser without having to
+ * recreate the it every time as stated in 
+ * <a href="http://www.antlr.org:8080/pipermail/antlr-interest/2003-April/003631.html">
+ * a Antlr Interest Group mail</a> .
+ *
+ * @see <a href="http://www.faqs.org/rfcs/rfc3672.html">RFC 3672</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+class ReusableAntlrNameParser extends antlrNameParser
+{
+    /**
+     * Creates a ReusableAntlrNameParser instance.
+     */
+    public ReusableAntlrNameParser( TokenStreamSelector selector )
+    {
+        super( selector );
+    }
+
+    
+    /**
+     * Resets the state of an antlr parser.
+     */
+    public void resetState()
+    {
+        // no set method for this protected field.
+        this.traceDepth = 0;
+        
+        this.getInputState().reset();
+    }
+}

Added: directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrTypeLexer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrTypeLexer.java?rev=267328&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrTypeLexer.java
(added)
+++ directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrTypeLexer.java
Fri Sep  2 14:43:49 2005
@@ -0,0 +1,68 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+
+package org.apache.ldap.common.name;
+
+
+import java.io.Reader;
+
+import antlr.CharBuffer;
+import antlr.LexerSharedInputState;
+
+
+/**
+ * A reusable lexer class extended from antlr generated antlrTypelexer
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ReusableAntlrTypeLexer extends antlrTypeLexer
+{
+    private boolean savedCaseSensitive;
+    private boolean savedCaseSensitiveLiterals;
+
+    /**
+     * Creates a ReusableAntlrValueLexer instance.
+     *
+     * @param in the input to the lexer
+     */
+    public ReusableAntlrTypeLexer( Reader in )
+    {
+        super( in );
+        savedCaseSensitive = getCaseSensitive();
+        savedCaseSensitiveLiterals = getCaseSensitiveLiterals();
+    }
+
+
+    /**
+     * Resets the state of an antlr lexer and initializes it with new input.
+     *
+     * @param in the input to the lexer
+     */
+    public void prepareNextInput( Reader in )
+    {
+        CharBuffer buf = new CharBuffer( in );
+        LexerSharedInputState state = new LexerSharedInputState( buf );
+        this.setInputState(state);
+        
+        this.setCaseSensitive(savedCaseSensitive);
+        
+        // no set method for this protected field.
+        this.caseSensitiveLiterals = savedCaseSensitiveLiterals;
+    }
+}

Added: directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrValueLexer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrValueLexer.java?rev=267328&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrValueLexer.java
(added)
+++ directory/shared/ldap/branches/new-codec-integration/common/src/java/org/apache/ldap/common/name/ReusableAntlrValueLexer.java
Fri Sep  2 14:43:49 2005
@@ -0,0 +1,63 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+
+package org.apache.ldap.common.name;
+
+
+import antlr.LexerSharedInputState;
+
+
+/**
+ * A reusable lexer class extended from antlr generated antlrValueLexer
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ReusableAntlrValueLexer extends antlrValueLexer
+{
+    private boolean savedCaseSensitive;
+    private boolean savedCaseSensitiveLiterals;
+
+    /**
+     * Creates a ReusableAntlrValueLexer instance.
+     *
+     * @param in the input to the lexer
+     */
+    public ReusableAntlrValueLexer( LexerSharedInputState inputState )
+    {
+        super( inputState );
+        savedCaseSensitive = getCaseSensitive();
+        savedCaseSensitiveLiterals = getCaseSensitiveLiterals();
+    }
+
+
+    /**
+     * Resets the state of an antlr lexer and initializes it with new input.
+     *
+     * @param in the input to the lexer
+     */
+    public void prepareNextInput( LexerSharedInputState inputState )
+    {
+        this.setInputState( inputState );
+        
+        this.setCaseSensitive(savedCaseSensitive);
+        
+        // no set method for this protected field.
+        this.caseSensitiveLiterals = savedCaseSensitiveLiterals;
+    }
+}



Mime
View raw message