Class AntlrDnParser
- java.lang.Object
-
- antlr.Parser
-
- antlr.LLkParser
-
- org.apache.directory.api.ldap.model.name.AntlrDnParser
-
- All Implemented Interfaces:
AntlrDnTokenTypes
public class AntlrDnParser extends antlr.LLkParser implements AntlrDnTokenTypes
An antlr generated Dn parser.- Author:
- Apache Directory Project
-
-
Field Summary
Fields Modifier and Type Field Description static String[]_tokenNamesstatic antlr.collections.impl.BitSet_tokenSet_0static antlr.collections.impl.BitSet_tokenSet_1static antlr.collections.impl.BitSet_tokenSet_2static antlr.collections.impl.BitSet_tokenSet_3static antlr.collections.impl.BitSet_tokenSet_4static antlr.collections.impl.BitSet_tokenSet_5-
Fields inherited from class antlr.Parser
astFactory, inputState, returnAST, tokenNames, tokenTypeToASTClassMap, traceDepth
-
Fields inherited from interface org.apache.directory.api.ldap.model.name.AntlrDnTokenTypes
ALPHA, CHAR_REST, COMMA, DIGIT, DOT, DQUOTE, EOF, EQUALS, ESC, ESCESC, ESCSHARP, HEX, HEXPAIR, HEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC, HEXVALUE, HEXVALUE_OR_SHARP, HYPHEN, LANGLE, LDIGIT, NULL_TREE_LOOKAHEAD, NUMBER, NUMERICOID, NUMERICOID_OR_ALPHA_OR_DIGIT, PLUS, RANGLE, SEMI, SHARP, SPACE, UNDERSCORE, UTFMB
-
-
Constructor Summary
Constructors Modifier Constructor Description AntlrDnParser(antlr.ParserSharedInputState state)AntlrDnParser(antlr.TokenBuffer tokenBuf)protectedAntlrDnParser(antlr.TokenBuffer tokenBuf, int k)AntlrDnParser(antlr.TokenStream lexer)protectedAntlrDnParser(antlr.TokenStream lexer, int k)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringattributeType()RFC 4514 Section 3StringattributeTypeAndValue(SchemaManager schemaManager, Rdn rdn)RFC 4514, Section 3voidattributeValue(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value)RFC 4514, Section 3Stringdescr()RFC 4512 Section 1.4voiddistinguishedName(SchemaManager schemaManager, Dn dn)Parses a Dn string.voidhexstring(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value)RFC 4514 Section 3voidlutf1(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value)RFC 4514, Section 3:Stringnumericoid()RFC 4512 Section 1.4voidpair(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value)RFC 4514, Section 3voidquotestring(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value)RFC 2253, Section 3voidrelativeDistinguishedName(SchemaManager schemaManager, Rdn rdn)Parses a Rdn string.StringrelativeDistinguishedNames(SchemaManager schemaManager, List<Rdn> rdns)Parses a Dn string.charspecial()RFC 4514 Section 3voidstring(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value)RFC 4514 Section 3voidsutf1(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value)RFC 4514, Section 3:voidutfmb(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value)Process a UTFMB char-
Methods inherited from class antlr.Parser
addMessageListener, addParserListener, addParserMatchListener, addParserTokenListener, addSemanticPredicateListener, addSyntacticPredicateListener, addTraceListener, consumeUntil, consumeUntil, defaultDebuggingSetup, getAST, getASTFactory, getFilename, getInputState, getTokenName, getTokenNames, getTokenTypeToASTClassMap, isDebugMode, mark, match, match, matchNot, panic, recover, removeMessageListener, removeParserListener, removeParserMatchListener, removeParserTokenListener, removeSemanticPredicateListener, removeSyntacticPredicateListener, removeTraceListener, reportError, reportError, reportWarning, rewind, setASTFactory, setASTNodeClass, setASTNodeType, setDebugMode, setFilename, setIgnoreInvalidDebugCalls, setInputState, setTokenBuffer, traceIndent
-
-
-
-
Field Detail
-
_tokenNames
public static final String[] _tokenNames
-
_tokenSet_0
public static final antlr.collections.impl.BitSet _tokenSet_0
-
_tokenSet_1
public static final antlr.collections.impl.BitSet _tokenSet_1
-
_tokenSet_2
public static final antlr.collections.impl.BitSet _tokenSet_2
-
_tokenSet_3
public static final antlr.collections.impl.BitSet _tokenSet_3
-
_tokenSet_4
public static final antlr.collections.impl.BitSet _tokenSet_4
-
_tokenSet_5
public static final antlr.collections.impl.BitSet _tokenSet_5
-
-
Constructor Detail
-
AntlrDnParser
protected AntlrDnParser(antlr.TokenBuffer tokenBuf, int k)
-
AntlrDnParser
public AntlrDnParser(antlr.TokenBuffer tokenBuf)
-
AntlrDnParser
protected AntlrDnParser(antlr.TokenStream lexer, int k)
-
AntlrDnParser
public AntlrDnParser(antlr.TokenStream lexer)
-
AntlrDnParser
public AntlrDnParser(antlr.ParserSharedInputState state)
-
-
Method Detail
-
distinguishedName
public final void distinguishedName(SchemaManager schemaManager, Dn dn) throws antlr.RecognitionException, antlr.TokenStreamException
Parses a Dn string. RFC 4514, Section 3distinguishedName = [ relativeDistinguishedName *( COMMA relativeDistinguishedName ) ]RFC 2253, Section 3distinguishedName = [name] name = name-component *("," name-component)RFC 1779, Section 2.3<name> ::= <name-component> ( <spaced-separator> ) | <name-component> <spaced-separator> <name> <spaced-separator> ::= <optional-space> <separator> <optional-space> <separator> ::= "," | ";" <optional-space> ::= ( <CR> ) *( " " )- Parameters:
schemaManager- The SchemaManagerdn- The Dn to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
relativeDistinguishedName
public final void relativeDistinguishedName(SchemaManager schemaManager, Rdn rdn) throws antlr.RecognitionException, antlr.TokenStreamException
Parses a Rdn string. RFC 4514, Section 3relativeDistinguishedName = attributeTypeAndValue *( PLUS attributeTypeAndValue )RFC 2253, Section 3name-component = attributeTypeAndValue *("+" attributeTypeAndValue)RFC 1779, Section 2.3<name-component> ::= <attribute> | <attribute> <optional-space> "+" <optional-space> <name-component>- Parameters:
schemaManager- The SchemaManagerrdn- The Rdn to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
relativeDistinguishedNames
public final String relativeDistinguishedNames(SchemaManager schemaManager, List<Rdn> rdns) throws antlr.RecognitionException, antlr.TokenStreamException
Parses a Dn string. RFC 4514, Section 3distinguishedName = [ relativeDistinguishedName *( COMMA relativeDistinguishedName ) ]RFC 2253, Section 3distinguishedName = [name] name = name-component *("," name-component)RFC 1779, Section 2.3<name> ::= <name-component> ( <spaced-separator> ) | <name-component> <spaced-separator> <name> <spaced-separator> ::= <optional-space> <separator> <optional-space> <separator> ::= "," | ";" <optional-space> ::= ( <CR> ) *( " " )- Parameters:
schemaManager- The SchemaManagerrdns- The list of Rdns to update- Returns:
- The normalized Dn
- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
attributeTypeAndValue
public final String attributeTypeAndValue(SchemaManager schemaManager, Rdn rdn) throws antlr.RecognitionException, antlr.TokenStreamException
RFC 4514, Section 3attributeTypeAndValue = attributeType EQUALS attributeValue
RFC 2253, Section 3attributeTypeAndValue = attributeType "=" attributeValue
- Parameters:
schemaManager- The SchemaManagerrdn- The Rdn to update- Returns:
- The user provided Ava
- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
attributeType
public final String attributeType() throws antlr.RecognitionException, antlr.TokenStreamException
RFC 4514 Section 3attributeType = descr / numericoid
- Returns:
- The AttributeType
- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
attributeValue
public final void attributeValue(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value) throws antlr.RecognitionException, antlr.TokenStreamExceptionRFC 4514, Section 3attributeValue = string / hexstring
RFC 2253, Section 3attributeValue = string string = *( stringchar / pair ) / "#" hexstring / QUOTATION *( quotechar / pair ) QUOTATION ; only from v2 We still accept both forms, which means we can have a value surrounded by '"'- Parameters:
value- The value to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
descr
public final String descr() throws antlr.RecognitionException, antlr.TokenStreamException
RFC 4512 Section 1.4descr = keystring keystring = leadkeychar *keychar leadkeychar = ALPHA keychar = ALPHA / DIGIT / HYPHEN
We additionally add UNDERSCORE because some servers allow them.- Returns:
- The description
- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
numericoid
public final String numericoid() throws antlr.RecognitionException, antlr.TokenStreamException
RFC 4512 Section 1.4numericoid = number 1*( DOT number ) number = DIGIT / ( LDIGIT 1*DIGIT ) DIGIT = %x30 / LDIGIT ; "0"-"9" LDIGIT = %x31-39 ; "1"-"9"
- Returns:
- The numeric OID
- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
quotestring
public final void quotestring(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value) throws antlr.RecognitionException, antlr.TokenStreamExceptionRFC 2253, Section 3/ QUOTATION *( quotechar / pair ) QUOTATION ; only from v2 quotechar = <any character except "\" or QUOTATION >- Parameters:
value- The value to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
string
public final void string(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value) throws antlr.RecognitionException, antlr.TokenStreamExceptionRFC 4514 Section 3; The following characters are to be escaped when they appear ; in the value to be encoded: ESC, one of <escaped>, <leading> ; SHARP or SPACE, trailing SPACE, and NULL. string = [ ( leadchar / pair ) [ *( stringchar / pair ) ( trailchar / pair ) ] ] leadchar = LUTF1 | UTFMB stringchar = SUTF1 / UTFMB trailchar = TUTF1 / UTFMB
- Parameters:
value- The value to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
hexstring
public final void hexstring(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value) throws antlr.RecognitionException, antlr.TokenStreamExceptionRFC 4514 Section 3hexstring = SHARP 1*hexpair If in <hexstring> form, a BER representation can be obtained from converting each <hexpair> of the <hexstring> to the octet indicated by the <hexpair>.
- Parameters:
value- The value to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
pair
public final void pair(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value) throws antlr.RecognitionException, antlr.TokenStreamExceptionRFC 4514, Section 3pair = ESC ( ESC / special / hexpair ) special = escaped / SPACE / SHARP / EQUALS escaped = DQUOTE / PLUS / COMMA / SEMI / LANGLE / RANGLE hexpair = HEX HEX If in <string> form, a LDAP string representation asserted value can be obtained by replacing (left to right, non-recursively) each <pair> appearing in the <string> as follows: replace <ESC><ESC> with <ESC>; replace <ESC><special> with <special>; replace <ESC><hexpair> with the octet indicated by the <hexpair>.
RFC 2253, Section 3pair = "\" ( special / "\" / QUOTATION / hexpair ) special = "," / "=" / "+" / "<" / ">" / "#" / ";"
RFC 1779, Section 2.3<pair> ::= "\" ( <special> | "\" | '"') <special> ::= "," | "=" | <CR> | "+" | "<" | ">" | "#" | ";"- Parameters:
value- The value to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
lutf1
public final void lutf1(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value) throws antlr.RecognitionException, antlr.TokenStreamExceptionRFC 4514, Section 3:LUTF1 = %x01-1F / %x21 / %x24-2A / %x2D-3A / %x3D / %x3F-5B / %x5D-7F The rule CHAR_REST doesn't contain the following charcters, so we must check them additionally EQUALS (0x3D) HYPHEN (0x2D) UNDERSCORE (0x5F) DIGIT (0x30-0x39) ALPHA (0x41-0x5A and 0x61-0x7A)- Parameters:
value- The value to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
utfmb
public final void utfmb(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value) throws antlr.RecognitionException, antlr.TokenStreamExceptionProcess a UTFMB char- Parameters:
value- The value to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
sutf1
public final void sutf1(org.apache.directory.api.ldap.model.name.AntlrDnParser.UpAndNormValue value) throws antlr.RecognitionException, antlr.TokenStreamExceptionRFC 4514, Section 3:SUTF1 = %x01-21 / %x23-2A / %x2D-3A / %x3D / %x3F-5B / %x5D-7F The rule CHAR_REST doesn't contain the following charcters, so we must check them additionally EQUALS (0x3D) HYPHEN (0x2D) UNDERSCORE (0x5F) DIGIT (0x30-0x39) ALPHA (0x41-0x5A and 0x61-0x7A) SHARP (0x23) SPACE (0x20)- Parameters:
value- The value to update- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
special
public final char special() throws antlr.RecognitionException, antlr.TokenStreamExceptionRFC 4514 Section 3special = escaped / SPACE / SHARP / EQUALS escaped = DQUOTE / PLUS / COMMA / SEMI / LANGLE / RANGLE
- Returns:
- The special char
- Throws:
antlr.RecognitionException- If the token is invalidantlr.TokenStreamException- When we weren't able to fetch a token
-
-