You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2006/12/18 18:32:09 UTC
svn commit: r488355 [7/10] - in /directory/sandbox/pamarcelot/ldapstudio:
ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/
ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/
ldapstudio-browse...
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaLexer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaLexer.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaLexer.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaLexer.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,1651 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+
+// $ANTLR 2.7.5 (20050128): "schema.g" -> "SchemaLexer.java"$
+package org.apache.directory.ldapstudio.browser.core.model.schema.parser;
+
+
+import java.io.*;
+import java.util.*;
+
+import java.io.InputStream;
+import antlr.TokenStreamException;
+import antlr.TokenStreamIOException;
+import antlr.TokenStreamRecognitionException;
+import antlr.CharStreamException;
+import antlr.CharStreamIOException;
+import antlr.ANTLRException;
+import java.io.Reader;
+import java.util.Hashtable;
+
+import org.apache.directory.ldapstudio.browser.core.model.schema.*;
+
+import antlr.CharScanner;
+import antlr.InputBuffer;
+import antlr.ByteBuffer;
+import antlr.CharBuffer;
+import antlr.Token;
+import antlr.CommonToken;
+import antlr.RecognitionException;
+import antlr.NoViableAltForCharException;
+import antlr.MismatchedCharException;
+import antlr.TokenStream;
+import antlr.ANTLRHashString;
+import antlr.LexerSharedInputState;
+import antlr.collections.impl.BitSet;
+import antlr.SemanticException;
+
+
+public class SchemaLexer extends antlr.CharScanner implements SchemaTokenTypes, TokenStream
+{
+ public SchemaLexer( InputStream in )
+ {
+ this( new ByteBuffer( in ) );
+ }
+
+
+ public SchemaLexer( Reader in )
+ {
+ this( new CharBuffer( in ) );
+ }
+
+
+ public SchemaLexer( InputBuffer ib )
+ {
+ this( new LexerSharedInputState( ib ) );
+ }
+
+
+ public SchemaLexer( LexerSharedInputState state )
+ {
+ super( state );
+ caseSensitiveLiterals = true;
+ setCaseSensitive( false );
+ literals = new Hashtable();
+ }
+
+
+ public Token nextToken() throws TokenStreamException
+ {
+ Token theRetToken = null;
+ tryAgain: for ( ;; )
+ {
+ Token _token = null;
+ int _ttype = Token.INVALID_TYPE;
+ resetText();
+ try
+ { // for char stream error handling
+ try
+ { // for lexical error handling
+ switch ( LA( 1 ) )
+ {
+ case ' ':
+ {
+ mWHSP( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case ')':
+ {
+ mRPAR( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case '\'':
+ {
+ mQUOTE( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case '$':
+ {
+ mDOLLAR( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case '}':
+ {
+ mRBRACKET( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case 'e':
+ {
+ mEQUALITY( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case 'x':
+ {
+ mX( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case 'c':
+ {
+ mCOLLECTIVE( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ default:
+ if ( ( LA( 1 ) == 'u' ) && ( LA( 2 ) == 's' ) && ( LA( 3 ) == 'e' ) )
+ {
+ mUSAGE_USERAPPLICATIONS( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'd' ) && ( LA( 2 ) == 'i' ) && ( LA( 3 ) == 'r' ) )
+ {
+ mUSAGE_DIRECTORYOPERATION( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'd' ) && ( LA( 2 ) == 'i' ) && ( LA( 3 ) == 's' ) )
+ {
+ mUSAGE_DISTRIBUTEDOPERATION( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 's' ) && ( LA( 2 ) == 'u' ) && ( LA( 3 ) == 'p' ) )
+ {
+ mSUP( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 's' ) && ( LA( 2 ) == 'u' ) && ( LA( 3 ) == 'b' ) )
+ {
+ mSUBSTR( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'u' ) && ( LA( 2 ) == 's' ) && ( LA( 3 ) == 'a' ) )
+ {
+ mUSAGE( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == '{' ) && ( ( LA( 2 ) >= '0' && LA( 2 ) <= '9' ) ) )
+ {
+ mLEN( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'd' ) && ( LA( 2 ) == 's' ) )
+ {
+ mUSAGE_DSAOPERATION( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == '(' ) && ( _tokenSet_0.member( LA( 2 ) ) ) )
+ {
+ mSTARTNUMERICOID( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'n' ) && ( LA( 2 ) == 'a' ) )
+ {
+ mNAME( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'd' ) && ( LA( 2 ) == 'e' ) )
+ {
+ mDESC( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'm' ) && ( LA( 2 ) == 'u' ) )
+ {
+ mMUST( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'm' ) && ( LA( 2 ) == 'a' ) )
+ {
+ mMAY( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'o' ) && ( LA( 2 ) == 'r' ) )
+ {
+ mORDERING( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 's' ) && ( LA( 2 ) == 'y' ) )
+ {
+ mSYNTAX( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'a' ) && ( LA( 2 ) == 'p' ) )
+ {
+ mAPPLIES( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 's' ) && ( LA( 2 ) == 'i' ) )
+ {
+ mSINGLE_VALUE( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'n' ) && ( LA( 2 ) == 'o' ) )
+ {
+ mNO_USER_MODIFICATION( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'o' ) && ( LA( 2 ) == 'b' ) )
+ {
+ mOBSOLETE( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'a' ) && ( LA( 2 ) == 'b' ) )
+ {
+ mABSTRACT( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 's' ) && ( LA( 2 ) == 't' ) )
+ {
+ mSTRUCTURAL( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == 'a' ) && ( LA( 2 ) == 'u' ) )
+ {
+ mAUXILIARY( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == '(' ) && ( true ) )
+ {
+ mLPAR( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == '{' ) && ( true ) )
+ {
+ mLBRACKET( true );
+ theRetToken = _returnToken;
+ }
+ else
+ {
+ if ( LA( 1 ) == EOF_CHAR )
+ {
+ uponEOF();
+ _returnToken = makeToken( Token.EOF_TYPE );
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(),
+ getColumn() );
+ }
+ }
+ }
+ if ( _returnToken == null )
+ continue tryAgain; // found SKIP token
+ _ttype = _returnToken.getType();
+ _ttype = testLiteralsTable( _ttype );
+ _returnToken.setType( _ttype );
+ return _returnToken;
+ }
+ catch ( RecognitionException e )
+ {
+ throw new TokenStreamRecognitionException( e );
+ }
+ }
+ catch ( CharStreamException cse )
+ {
+ if ( cse instanceof CharStreamIOException )
+ {
+ throw new TokenStreamIOException( ( ( CharStreamIOException ) cse ).io );
+ }
+ else
+ {
+ throw new TokenStreamException( cse.getMessage() );
+ }
+ }
+ }
+ }
+
+
+ public final void mWHSP( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = WHSP;
+ int _saveIndex;
+
+ {
+ int _cnt3 = 0;
+ _loop3: do
+ {
+ if ( ( LA( 1 ) == ' ' ) && ( true ) && ( true ) && ( true ) && ( true ) )
+ {
+ match( ' ' );
+ }
+ else
+ {
+ if ( _cnt3 >= 1 )
+ {
+ break _loop3;
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(), getColumn() );
+ }
+ }
+
+ _cnt3++;
+ }
+ while ( true );
+ }
+ _ttype = Token.SKIP;
+ 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 mLPAR( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = LPAR;
+ 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 mRPAR( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = RPAR;
+ 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 mQUOTE( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = QUOTE;
+ 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 mDOLLAR( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = DOLLAR;
+ 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 mLBRACKET( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = LBRACKET;
+ 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 mRBRACKET( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = RBRACKET;
+ 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 mLEN( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = LEN;
+ int _saveIndex;
+
+ mLBRACKET( false );
+ {
+ int _cnt12 = 0;
+ _loop12: do
+ {
+ if ( ( ( LA( 1 ) >= '0' && LA( 1 ) <= '9' ) ) )
+ {
+ matchRange( '0', '9' );
+ }
+ else
+ {
+ if ( _cnt12 >= 1 )
+ {
+ break _loop12;
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(), getColumn() );
+ }
+ }
+
+ _cnt12++;
+ }
+ while ( true );
+ }
+ mRBRACKET( false );
+ 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 mUSAGE_USERAPPLICATIONS( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = USAGE_USERAPPLICATIONS;
+ int _saveIndex;
+
+ match( "userapplications" );
+ 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 mUSAGE_DIRECTORYOPERATION( boolean _createToken ) throws RecognitionException,
+ CharStreamException, TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = USAGE_DIRECTORYOPERATION;
+ int _saveIndex;
+
+ match( "directoryoperation" );
+ 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 mUSAGE_DISTRIBUTEDOPERATION( boolean _createToken ) throws RecognitionException,
+ CharStreamException, TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = USAGE_DISTRIBUTEDOPERATION;
+ int _saveIndex;
+
+ match( "distributedoperation" );
+ 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 mUSAGE_DSAOPERATION( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = USAGE_DSAOPERATION;
+ int _saveIndex;
+
+ match( "dsaoperation" );
+ 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 mSTARTNUMERICOID( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = STARTNUMERICOID;
+ int _saveIndex;
+ Token numericoid = null;
+
+ {
+ mLPAR( false );
+ {
+ mVALUE( true );
+ numericoid = _returnToken;
+ }
+ }
+ setText( numericoid.getText().trim() );
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ protected final void mVALUE( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = VALUE;
+ int _saveIndex;
+
+ {
+ switch ( LA( 1 ) )
+ {
+ case ' ':
+ {
+ mWHSP( false );
+ break;
+ }
+ case '\'':
+ case '-':
+ case '.':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case ';':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ {
+ break;
+ }
+ default:
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(), getColumn() );
+ }
+ }
+ }
+ {
+ switch ( LA( 1 ) )
+ {
+ case '\'':
+ {
+ mQUOTED_STRING( false );
+ break;
+ }
+ case '-':
+ case '.':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case ';':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ {
+ mUNQUOTED_STRING( false );
+ break;
+ }
+ default:
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(), getColumn() );
+ }
+ }
+ }
+ {
+ if ( ( LA( 1 ) == ' ' ) && ( true ) && ( true ) && ( true ) && ( true ) )
+ {
+ mWHSP( false );
+ }
+ else
+ {
+ }
+
+ }
+ 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 mNAME( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = NAME;
+ int _saveIndex;
+ Token qdstrings = null;
+
+ {
+ match( "name" );
+ mWHSP( false );
+ mVALUES( true );
+ qdstrings = _returnToken;
+ }
+ setText( qdstrings.getText().trim() );
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ protected final void mVALUES( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = VALUES;
+ int _saveIndex;
+
+ {
+ switch ( LA( 1 ) )
+ {
+ case ' ':
+ case '\'':
+ case '-':
+ case '.':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case ';':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ {
+ mVALUE( false );
+ break;
+ }
+ case '(':
+ {
+ mLPAR( false );
+ mVALUE( false );
+ {
+ _loop72: do
+ {
+ if ( ( _tokenSet_1.member( LA( 1 ) ) ) )
+ {
+ {
+ switch ( LA( 1 ) )
+ {
+ case '$':
+ {
+ mDOLLAR( false );
+ break;
+ }
+ case ' ':
+ case '\'':
+ case '-':
+ case '.':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case ';':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ {
+ break;
+ }
+ default:
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(),
+ getLine(), getColumn() );
+ }
+ }
+ }
+ mVALUE( false );
+ }
+ else
+ {
+ break _loop72;
+ }
+
+ }
+ while ( true );
+ }
+ mRPAR( false );
+ break;
+ }
+ default:
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(), getColumn() );
+ }
+ }
+ }
+ 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 mDESC( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = DESC;
+ int _saveIndex;
+ Token qdstring = null;
+
+ {
+ match( "desc" );
+ mWHSP( false );
+ mVALUES( true );
+ qdstring = _returnToken;
+ }
+ setText( qdstring.getText().trim() );
+ 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 mSUP( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = SUP;
+ int _saveIndex;
+ Token sup = null;
+
+ {
+ match( "sup" );
+ mWHSP( false );
+ mVALUES( true );
+ sup = _returnToken;
+ }
+ setText( sup.getText().trim() );
+ 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 mMUST( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = MUST;
+ int _saveIndex;
+ Token must = null;
+
+ {
+ match( "must" );
+ mWHSP( false );
+ mVALUES( true );
+ must = _returnToken;
+ }
+ setText( must.getText().trim() );
+ 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 mMAY( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = MAY;
+ int _saveIndex;
+ Token may = null;
+
+ {
+ match( "may" );
+ mWHSP( false );
+ mVALUES( true );
+ may = _returnToken;
+ }
+ setText( may.getText() );
+ 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 mEQUALITY( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = EQUALITY;
+ int _saveIndex;
+ Token equality = null;
+
+ {
+ match( "equality" );
+ mWHSP( false );
+ mVALUES( true );
+ equality = _returnToken;
+ }
+ setText( equality.getText().trim() );
+ 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 mORDERING( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = ORDERING;
+ int _saveIndex;
+ Token ordering = null;
+
+ {
+ match( "ordering" );
+ mWHSP( false );
+ mVALUES( true );
+ ordering = _returnToken;
+ }
+ setText( ordering.getText().trim() );
+ 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 mSUBSTR( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = SUBSTR;
+ int _saveIndex;
+ Token substr = null;
+
+ {
+ match( "substr" );
+ mWHSP( false );
+ mVALUES( true );
+ substr = _returnToken;
+ }
+ setText( substr.getText().trim() );
+ 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 mSYNTAX( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = SYNTAX;
+ int _saveIndex;
+ Token syntax = null;
+ Token len = null;
+
+ {
+ match( "syntax" );
+ mWHSP( false );
+ mVALUES( true );
+ syntax = _returnToken;
+ {
+ if ( ( LA( 1 ) == '{' ) )
+ {
+ mLEN( true );
+ len = _returnToken;
+ }
+ else
+ {
+ }
+
+ }
+ }
+ setText( syntax.getText().trim() + ( len != null ? len.getText().trim() : "" ) );
+ 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 mUSAGE( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = USAGE;
+ int _saveIndex;
+ Token op = null;
+
+ {
+ match( "usage" );
+ mWHSP( false );
+ mVALUES( true );
+ op = _returnToken;
+ }
+ setText( op.getText().trim() );
+ 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 mAPPLIES( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = APPLIES;
+ int _saveIndex;
+ Token applies = null;
+
+ {
+ match( "applies" );
+ mWHSP( false );
+ mVALUES( true );
+ applies = _returnToken;
+ }
+ setText( applies.getText().trim() );
+ 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 mX( boolean _createToken ) throws RecognitionException, CharStreamException, TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = X;
+ int _saveIndex;
+
+ {
+ match( "x-" );
+ {
+ int _cnt46 = 0;
+ _loop46: do
+ {
+ switch ( LA( 1 ) )
+ {
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ {
+ matchRange( 'a', 'z' );
+ break;
+ }
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ matchRange( '0', '9' );
+ break;
+ }
+ case '-':
+ {
+ match( '-' );
+ break;
+ }
+ case '_':
+ {
+ match( '_' );
+ break;
+ }
+ default:
+ {
+ if ( _cnt46 >= 1 )
+ {
+ break _loop46;
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(),
+ getColumn() );
+ }
+ }
+ }
+ _cnt46++;
+ }
+ while ( true );
+ }
+ mWHSP( false );
+ mVALUES( false );
+ }
+ _ttype = Token.SKIP;
+ 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 mSINGLE_VALUE( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = SINGLE_VALUE;
+ int _saveIndex;
+
+ {
+ match( "single-value" );
+ {
+ if ( ( LA( 1 ) == ' ' ) )
+ {
+ mWHSP( false );
+ }
+ else
+ {
+ }
+
+ }
+ }
+ 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 mCOLLECTIVE( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = COLLECTIVE;
+ int _saveIndex;
+
+ {
+ match( "collective" );
+ {
+ if ( ( LA( 1 ) == ' ' ) )
+ {
+ mWHSP( false );
+ }
+ else
+ {
+ }
+
+ }
+ }
+ 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 mNO_USER_MODIFICATION( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = NO_USER_MODIFICATION;
+ int _saveIndex;
+
+ {
+ match( "no-user-modification" );
+ {
+ if ( ( LA( 1 ) == ' ' ) )
+ {
+ mWHSP( false );
+ }
+ else
+ {
+ }
+
+ }
+ }
+ 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 mOBSOLETE( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = OBSOLETE;
+ int _saveIndex;
+
+ {
+ match( "obsolete" );
+ {
+ if ( ( LA( 1 ) == ' ' ) )
+ {
+ mWHSP( false );
+ }
+ else
+ {
+ }
+
+ }
+ }
+ 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 mABSTRACT( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = ABSTRACT;
+ int _saveIndex;
+
+ {
+ match( "abstract" );
+ {
+ if ( ( LA( 1 ) == ' ' ) )
+ {
+ mWHSP( false );
+ }
+ else
+ {
+ }
+
+ }
+ }
+ 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 mSTRUCTURAL( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = STRUCTURAL;
+ int _saveIndex;
+
+ {
+ match( "structural" );
+ {
+ if ( ( LA( 1 ) == ' ' ) )
+ {
+ mWHSP( false );
+ }
+ else
+ {
+ }
+
+ }
+ }
+ 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 mAUXILIARY( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = AUXILIARY;
+ int _saveIndex;
+
+ {
+ match( "auxiliary" );
+ {
+ if ( ( LA( 1 ) == ' ' ) )
+ {
+ mWHSP( false );
+ }
+ else
+ {
+ }
+
+ }
+ }
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ protected final void mQUOTED_STRING( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = QUOTED_STRING;
+ int _saveIndex;
+
+ {
+ mQUOTE( false );
+ {
+ _loop83: do
+ {
+ if ( ( _tokenSet_2.member( LA( 1 ) ) ) )
+ {
+ matchNot( '\'' );
+ }
+ else
+ {
+ break _loop83;
+ }
+
+ }
+ while ( true );
+ }
+ mQUOTE( false );
+ }
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ protected final void mUNQUOTED_STRING( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = UNQUOTED_STRING;
+ int _saveIndex;
+
+ {
+ int _cnt79 = 0;
+ _loop79: do
+ {
+ if ( ( ( LA( 1 ) >= 'a' && LA( 1 ) <= 'z' ) ) && ( true ) && ( true ) && ( true ) && ( true ) )
+ {
+ matchRange( 'a', 'z' );
+ }
+ else if ( ( ( LA( 1 ) >= '0' && LA( 1 ) <= '9' ) ) && ( true ) && ( true ) && ( true ) && ( true ) )
+ {
+ matchRange( '0', '9' );
+ }
+ else if ( ( LA( 1 ) == '-' ) && ( true ) && ( true ) && ( true ) && ( true ) )
+ {
+ match( '-' );
+ }
+ else if ( ( LA( 1 ) == ';' ) && ( true ) && ( true ) && ( true ) && ( true ) )
+ {
+ match( ';' );
+ }
+ else if ( ( LA( 1 ) == '.' ) && ( true ) && ( true ) && ( true ) && ( true ) )
+ {
+ match( '.' );
+ }
+ else
+ {
+ if ( _cnt79 >= 1 )
+ {
+ break _loop79;
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(), getColumn() );
+ }
+ }
+
+ _cnt79++;
+ }
+ while ( true );
+ }
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ private static final long[] mk_tokenSet_0()
+ {
+ long[] data =
+ { 864515760645472256L, 576460743713488896L, 0L, 0L, 0L };
+ return data;
+ }
+
+ public static final BitSet _tokenSet_0 = new BitSet( mk_tokenSet_0() );
+
+
+ private static final long[] mk_tokenSet_1()
+ {
+ long[] data =
+ { 864515829364948992L, 576460743713488896L, 0L, 0L, 0L };
+ return data;
+ }
+
+ public static final BitSet _tokenSet_1 = new BitSet( mk_tokenSet_1() );
+
+
+ private static final long[] mk_tokenSet_2()
+ {
+ long[] data = new long[8];
+ data[0] = -549755813896L;
+ for ( int i = 1; i <= 3; i++ )
+ {
+ data[i] = -1L;
+ }
+ return data;
+ }
+
+ public static final BitSet _tokenSet_2 = new BitSet( mk_tokenSet_2() );
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaParser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaParser.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaParser.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaParser.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,635 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+
+// $ANTLR 2.7.5 (20050128): "schema.g" -> "SchemaParser.java"$
+package org.apache.directory.ldapstudio.browser.core.model.schema.parser;
+
+
+import java.io.*;
+import java.util.*;
+
+import org.apache.directory.ldapstudio.browser.core.model.schema.*;
+
+import antlr.TokenBuffer;
+import antlr.TokenStreamException;
+import antlr.TokenStreamIOException;
+import antlr.ANTLRException;
+import antlr.LLkParser;
+import antlr.Token;
+import antlr.TokenStream;
+import antlr.RecognitionException;
+import antlr.NoViableAltException;
+import antlr.MismatchedTokenException;
+import antlr.SemanticException;
+import antlr.ParserSharedInputState;
+import antlr.collections.impl.BitSet;
+
+
+public class SchemaParser extends antlr.LLkParser implements SchemaTokenTypes
+{
+
+ public static final void main( String[] args )
+ {
+ try
+ {
+
+ // "( 11.222.333.4444 NAME ( 'test1' 'test2' ) DESC 'a b c'
+ // OBSOLETE SUP top ABSTRACT MUST ( cn ) may ( givenName $ sn)
+ // )"
+ // "( 2.5.4.11 NAME ( 'ou' 'organizationalUnitName' ) DESC
+ // 'RFC2256: organizational unit this object belongs to' SUP
+ // name EQUALITY caseIgnoreMatch SYNTAX 1.2.3.4.5{32} COLLECTIVE
+ // USAGE userApplications )"
+ // "( 2.5.4.11 DESC 'a b c' )"
+ // "( 1.3.6.1.4.1.4203.1.2.1 NAME 'caseExactIA5SubstringsMatch'
+ // SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )"
+ // "( 2.5.13.0 NAME 'objectIdentifierMatch' APPLIES (
+ // supportedApplicationContext $ supportedFeatures $
+ // supportedExtension $ supportedControl ) )"
+ // "( 1.2.840.113548.3.1.4.11110 NAME 'ciscoccnatPAUserPIN' DESC
+ // 'User Defined Attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+ // SINGLE-VALUE X-ORIGIN ( 'Cisco AVVID' 'user defined' ) )"
+ SchemaLexer mainLexer = new SchemaLexer( new StringReader(
+ "( 1.3.6.1.4.1.1466.115.121.1.48 NAME 'Supplier And Consumer' )" ) );
+
+ SchemaParser parser = new SchemaParser( mainLexer );
+ // ObjectClassDescription d = parser.objectClassDescription();
+ // AttributeTypeDescription d =
+ // parser.attributeTypeDescription();
+ LdapSyntaxDescription d = parser.syntaxDescription();
+ // MatchingRuleDescription d = parser.matchingRuleDescription();
+ // MatchingRuleUseDescription d =
+ // parser.matchingRuleUseDescription();
+ System.out.println( d.toString() );
+ }
+ catch ( Exception e )
+ {
+ System.err.println( "exception: " + e );
+ e.printStackTrace();
+ }
+ }
+
+
+ protected SchemaParser( TokenBuffer tokenBuf, int k )
+ {
+ super( tokenBuf, k );
+ tokenNames = _tokenNames;
+ }
+
+
+ public SchemaParser( TokenBuffer tokenBuf )
+ {
+ this( tokenBuf, 3 );
+ }
+
+
+ protected SchemaParser( TokenStream lexer, int k )
+ {
+ super( lexer, k );
+ tokenNames = _tokenNames;
+ }
+
+
+ public SchemaParser( TokenStream lexer )
+ {
+ this( lexer, 3 );
+ }
+
+
+ public SchemaParser( ParserSharedInputState state )
+ {
+ super( state, 3 );
+ tokenNames = _tokenNames;
+ }
+
+
+ public final ObjectClassDescription objectClassDescription() throws RecognitionException, TokenStreamException
+ {
+ ObjectClassDescription ocd = new ObjectClassDescription();
+
+ Token oid = null;
+ Token name = null;
+ Token desc = null;
+ Token sup = null;
+ Token must = null;
+ Token may = null;
+
+ {
+ oid = LT( 1 );
+ match( STARTNUMERICOID );
+ ocd.setNumericOID( oid.getText() );
+ }
+ {
+ _loop94: do
+ {
+ switch ( LA( 1 ) )
+ {
+ case NAME:
+ {
+ {
+ name = LT( 1 );
+ match( NAME );
+ ocd.setNames( qdescrs( name.getText() ) );
+ }
+ break;
+ }
+ case DESC:
+ {
+ {
+ desc = LT( 1 );
+ match( DESC );
+ ocd.setDesc( qdstring( desc.getText() ) );
+ }
+ break;
+ }
+ case OBSOLETE:
+ {
+ {
+ match( OBSOLETE );
+ ocd.setObsolete( true );
+ }
+ break;
+ }
+ case SUP:
+ {
+ {
+ sup = LT( 1 );
+ match( SUP );
+ ocd.setSuperiorObjectClassDescriptionNames( oids( sup.getText() ) );
+ }
+ break;
+ }
+ case ABSTRACT:
+ case STRUCTURAL:
+ case AUXILIARY:
+ {
+ {
+ switch ( LA( 1 ) )
+ {
+ case ABSTRACT:
+ {
+ match( ABSTRACT );
+ ocd.setAbstract( true );
+ break;
+ }
+ case STRUCTURAL:
+ {
+ match( STRUCTURAL );
+ ocd.setStructural( true );
+ break;
+ }
+ case AUXILIARY:
+ {
+ match( AUXILIARY );
+ ocd.setAuxiliary( true );
+ break;
+ }
+ default:
+ {
+ throw new NoViableAltException( LT( 1 ), getFilename() );
+ }
+ }
+ }
+ break;
+ }
+ case MUST:
+ {
+ {
+ must = LT( 1 );
+ match( MUST );
+ ocd.setMustAttributeTypeDescriptionNames( oids( must.getText() ) );
+ }
+ break;
+ }
+ case MAY:
+ {
+ {
+ may = LT( 1 );
+ match( MAY );
+ ocd.setMayAttributeTypeDescriptionNames( oids( may.getText() ) );
+ }
+ break;
+ }
+ default:
+ {
+ break _loop94;
+ }
+ }
+ }
+ while ( true );
+ }
+ match( RPAR );
+ return ocd;
+ }
+
+
+ public final AttributeTypeDescription attributeTypeDescription() throws RecognitionException, TokenStreamException
+ {
+ AttributeTypeDescription atd = new AttributeTypeDescription();
+
+ Token oid = null;
+ Token name = null;
+ Token desc = null;
+ Token sup = null;
+ Token equality = null;
+ Token ordering = null;
+ Token substr = null;
+ Token syntax = null;
+ Token usage = null;
+
+ {
+ oid = LT( 1 );
+ match( STARTNUMERICOID );
+ atd.setNumericOID( oid.getText() );
+ }
+ {
+ _loop110: do
+ {
+ switch ( LA( 1 ) )
+ {
+ case NAME:
+ {
+ {
+ name = LT( 1 );
+ match( NAME );
+ atd.setNames( qdescrs( name.getText() ) );
+ }
+ break;
+ }
+ case DESC:
+ {
+ {
+ desc = LT( 1 );
+ match( DESC );
+ atd.setDesc( qdstring( desc.getText() ) );
+ }
+ break;
+ }
+ case OBSOLETE:
+ {
+ {
+ match( OBSOLETE );
+ atd.setObsolete( true );
+ }
+ break;
+ }
+ case SUP:
+ {
+ {
+ sup = LT( 1 );
+ match( SUP );
+ atd.setSuperiorAttributeTypeDescriptionName( oid( sup.getText() ) );
+ }
+ break;
+ }
+ case EQUALITY:
+ {
+ {
+ equality = LT( 1 );
+ match( EQUALITY );
+ atd.setEqualityMatchingRuleDescriptionOID( oid( equality.getText() ) );
+ }
+ break;
+ }
+ case ORDERING:
+ {
+ {
+ ordering = LT( 1 );
+ match( ORDERING );
+ atd.setOrderingMatchingRuleDescriptionOID( oid( ordering.getText() ) );
+ }
+ break;
+ }
+ case SUBSTR:
+ {
+ {
+ substr = LT( 1 );
+ match( SUBSTR );
+ atd.setSubstringMatchingRuleDescriptionOID( oid( substr.getText() ) );
+ }
+ break;
+ }
+ case SYNTAX:
+ {
+ {
+ syntax = LT( 1 );
+ match( SYNTAX );
+ atd.setSyntaxDescriptionNumericOIDPlusLength( qdstring( syntax.getText() ) );
+ }
+ break;
+ }
+ case SINGLE_VALUE:
+ {
+ {
+ match( SINGLE_VALUE );
+ atd.setSingleValued( true );
+ }
+ break;
+ }
+ case COLLECTIVE:
+ {
+ {
+ match( COLLECTIVE );
+ atd.setCollective( true );
+ }
+ break;
+ }
+ case NO_USER_MODIFICATION:
+ {
+ {
+ match( NO_USER_MODIFICATION );
+ atd.setNoUserModification( true );
+ }
+ break;
+ }
+ case USAGE:
+ {
+ {
+ usage = LT( 1 );
+ match( USAGE );
+ atd.setUsage( usage.getText() );
+ }
+ break;
+ }
+ default:
+ {
+ break _loop110;
+ }
+ }
+ }
+ while ( true );
+ }
+ match( RPAR );
+ return atd;
+ }
+
+
+ public final LdapSyntaxDescription syntaxDescription() throws RecognitionException, TokenStreamException
+ {
+ LdapSyntaxDescription lsd = new LdapSyntaxDescription();
+
+ Token oid = null;
+ Token desc = null;
+ Token name = null;
+
+ {
+ oid = LT( 1 );
+ match( STARTNUMERICOID );
+ lsd.setNumericOID( oid.getText() );
+ }
+ {
+ _loop116: do
+ {
+ switch ( LA( 1 ) )
+ {
+ case DESC:
+ {
+ {
+ desc = LT( 1 );
+ match( DESC );
+ lsd.setDesc( qdstring( desc.getText() ) );
+ }
+ break;
+ }
+ case NAME:
+ {
+ {
+ name = LT( 1 );
+ match( NAME );
+ lsd.setDesc( qdstring( name.getText() ) );
+ }
+ break;
+ }
+ default:
+ {
+ break _loop116;
+ }
+ }
+ }
+ while ( true );
+ }
+ match( RPAR );
+ return lsd;
+ }
+
+
+ public final MatchingRuleDescription matchingRuleDescription() throws RecognitionException, TokenStreamException
+ {
+ MatchingRuleDescription mrd = new MatchingRuleDescription();
+
+ Token oid = null;
+ Token name = null;
+ Token desc = null;
+ Token syntax = null;
+
+ {
+ oid = LT( 1 );
+ match( STARTNUMERICOID );
+ mrd.setNumericOID( oid.getText() );
+ }
+ {
+ _loop124: do
+ {
+ switch ( LA( 1 ) )
+ {
+ case NAME:
+ {
+ {
+ name = LT( 1 );
+ match( NAME );
+ mrd.setNames( qdescrs( name.getText() ) );
+ }
+ break;
+ }
+ case DESC:
+ {
+ {
+ desc = LT( 1 );
+ match( DESC );
+ mrd.setDesc( qdstring( desc.getText() ) );
+ }
+ break;
+ }
+ case OBSOLETE:
+ {
+ {
+ match( OBSOLETE );
+ mrd.setObsolete( true );
+ }
+ break;
+ }
+ case SYNTAX:
+ {
+ {
+ syntax = LT( 1 );
+ match( SYNTAX );
+ mrd.setSyntaxDescriptionNumericOID( syntax.getText() );
+ }
+ break;
+ }
+ default:
+ {
+ break _loop124;
+ }
+ }
+ }
+ while ( true );
+ }
+ match( RPAR );
+ return mrd;
+ }
+
+
+ public final MatchingRuleUseDescription matchingRuleUseDescription() throws RecognitionException,
+ TokenStreamException
+ {
+ MatchingRuleUseDescription mrud = new MatchingRuleUseDescription();
+
+ Token oid = null;
+ Token name = null;
+ Token desc = null;
+ Token applies = null;
+
+ {
+ oid = LT( 1 );
+ match( STARTNUMERICOID );
+ mrud.setNumericOID( oid.getText() );
+ }
+ {
+ _loop132: do
+ {
+ switch ( LA( 1 ) )
+ {
+ case NAME:
+ {
+ {
+ name = LT( 1 );
+ match( NAME );
+ mrud.setNames( qdescrs( name.getText() ) );
+ }
+ break;
+ }
+ case DESC:
+ {
+ {
+ desc = LT( 1 );
+ match( DESC );
+ mrud.setDesc( qdstring( desc.getText() ) );
+ }
+ break;
+ }
+ case OBSOLETE:
+ {
+ {
+ match( OBSOLETE );
+ mrud.setObsolete( true );
+ }
+ break;
+ }
+ case APPLIES:
+ {
+ {
+ applies = LT( 1 );
+ match( APPLIES );
+ mrud.setAppliesAttributeTypeDescriptionOIDs( oids( applies.getText() ) );
+ }
+ break;
+ }
+ default:
+ {
+ break _loop132;
+ }
+ }
+ }
+ while ( true );
+ }
+ match( RPAR );
+ return mrud;
+ }
+
+
+ public final String oid( String s ) throws RecognitionException, TokenStreamException
+ {
+ String oid;
+
+ SchemaValueLexer lexer = new SchemaValueLexer( new StringReader( s ) );
+ SchemaValueParser parser = new SchemaValueParser( lexer );
+ oid = parser.oid();
+
+ return oid;
+ }
+
+
+ public final String[] oids( String s ) throws RecognitionException, TokenStreamException
+ {
+ String[] oids;
+
+ SchemaValueLexer lexer = new SchemaValueLexer( new StringReader( s ) );
+ SchemaValueParser parser = new SchemaValueParser( lexer );
+ oids = parser.oids();
+
+ return oids;
+ }
+
+
+ public final String[] qdescrs( String s ) throws RecognitionException, TokenStreamException
+ {
+ String[] qdescrs;
+
+ SchemaValueLexer lexer = new SchemaValueLexer( new StringReader( s ) );
+ SchemaValueParser parser = new SchemaValueParser( lexer );
+ qdescrs = parser.qdescrs();
+
+ return qdescrs;
+ }
+
+
+ public final String qdstring( String s ) throws RecognitionException, TokenStreamException
+ {
+ String qdstring;
+
+ if ( s == null )
+ {
+ qdstring = null;
+ }
+ else
+ {
+ if ( s.startsWith( "'" ) )
+ {
+ s = s.substring( 1, s.length() );
+ }
+ if ( s.endsWith( "'" ) )
+ {
+ s = s.substring( 0, s.length() - 1 );
+ }
+ qdstring = s;
+ }
+
+ return qdstring;
+ }
+
+ public static final String[] _tokenNames =
+ { "<0>", "EOF", "<2>", "NULL_TREE_LOOKAHEAD", "WHSP", "LPAR", "RPAR", "QUOTE", "DOLLAR", "LBRACKET",
+ "RBRACKET", "LEN", "USAGE_USERAPPLICATIONS", "USAGE_DIRECTORYOPERATION", "USAGE_DISTRIBUTEDOPERATION",
+ "USAGE_DSAOPERATION", "STARTNUMERICOID", "NAME", "DESC", "SUP", "MUST", "MAY", "EQUALITY", "ORDERING",
+ "SUBSTR", "SYNTAX", "USAGE", "APPLIES", "X", "SINGLE_VALUE", "COLLECTIVE", "NO_USER_MODIFICATION",
+ "OBSOLETE", "ABSTRACT", "STRUCTURAL", "AUXILIARY", "VALUES", "VALUE", "UNQUOTED_STRING", "QUOTED_STRING" };
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+
+// $ANTLR 2.7.5 (20050128): "schema.g" -> "SchemaParser.java"$
+package org.apache.directory.ldapstudio.browser.core.model.schema.parser;
+
+
+import java.io.*;
+import java.util.*;
+
+import org.apache.directory.ldapstudio.browser.core.model.schema.*;
+
+
+public interface SchemaTokenTypes
+{
+ int EOF = 1;
+
+ int NULL_TREE_LOOKAHEAD = 3;
+
+ int WHSP = 4;
+
+ int LPAR = 5;
+
+ int RPAR = 6;
+
+ int QUOTE = 7;
+
+ int DOLLAR = 8;
+
+ int LBRACKET = 9;
+
+ int RBRACKET = 10;
+
+ int LEN = 11;
+
+ int USAGE_USERAPPLICATIONS = 12;
+
+ int USAGE_DIRECTORYOPERATION = 13;
+
+ int USAGE_DISTRIBUTEDOPERATION = 14;
+
+ int USAGE_DSAOPERATION = 15;
+
+ int STARTNUMERICOID = 16;
+
+ int NAME = 17;
+
+ int DESC = 18;
+
+ int SUP = 19;
+
+ int MUST = 20;
+
+ int MAY = 21;
+
+ int EQUALITY = 22;
+
+ int ORDERING = 23;
+
+ int SUBSTR = 24;
+
+ int SYNTAX = 25;
+
+ int USAGE = 26;
+
+ int APPLIES = 27;
+
+ int X = 28;
+
+ int SINGLE_VALUE = 29;
+
+ int COLLECTIVE = 30;
+
+ int NO_USER_MODIFICATION = 31;
+
+ int OBSOLETE = 32;
+
+ int ABSTRACT = 33;
+
+ int STRUCTURAL = 34;
+
+ int AUXILIARY = 35;
+
+ int VALUES = 36;
+
+ int VALUE = 37;
+
+ int UNQUOTED_STRING = 38;
+
+ int QUOTED_STRING = 39;
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.txt
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.txt?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.txt (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.txt Mon Dec 18 09:32:03 2006
@@ -0,0 +1,38 @@
+// $ANTLR 2.7.5 (20050128): schema.g -> SchemaTokenTypes.txt$
+Schema // output token vocab name
+WHSP=4
+LPAR=5
+RPAR=6
+QUOTE=7
+DOLLAR=8
+LBRACKET=9
+RBRACKET=10
+LEN=11
+USAGE_USERAPPLICATIONS=12
+USAGE_DIRECTORYOPERATION=13
+USAGE_DISTRIBUTEDOPERATION=14
+USAGE_DSAOPERATION=15
+STARTNUMERICOID=16
+NAME=17
+DESC=18
+SUP=19
+MUST=20
+MAY=21
+EQUALITY=22
+ORDERING=23
+SUBSTR=24
+SYNTAX=25
+USAGE=26
+APPLIES=27
+X=28
+SINGLE_VALUE=29
+COLLECTIVE=30
+NO_USER_MODIFICATION=31
+OBSOLETE=32
+ABSTRACT=33
+STRUCTURAL=34
+AUXILIARY=35
+VALUES=36
+VALUE=37
+UNQUOTED_STRING=38
+QUOTED_STRING=39