Platform SDK: Active Directory, ADSI, and Directory Services

PARSE.CPP

In the example provider component, an example of the directory service path name parser is in parse.cpp. The path name parser is a key component in ADs provider components. It checks the syntactic validity of an ADs path name passed in to this provider. If the syntax is valid, an OBJECTINFO structure is constructed, which contains a componentized version of the ADs pathname for this object.

Note that all that is being done is a syntax check. Rather than special-case every nuance new to path names, all path checking must conform to the grammar rules laid out by the parser.

Called from GetObjectW in getobj.cpp.

ADsObject
Parses the ADs pathname passed to it. This function follows the following grammar rules:

<ADsObject> -> <ProviderName> <SampleDSObject>

SampleDSObject
Parses the following grammar rules:

<SampleDSObject> -> "\\" <identifier> "\" <SampleDSObject>

ProviderName
Adds in the syntactically correct provider name if not there.
DsPathName
Parses the following grammar rules:

<Pathname> -> <Component> "\\" <Pathname> OR

<Pathname> -> <Component>

Component
Parses the following grammar rules:

<Identifier> OR

<Identifier> "=" <Identifier>

CLexer::CLexer
Standard constructor.
CLexer::~CLexer
Standard destructor.
CLexer::GetNextToken
Tokenizer.
CLexer::NextChar
Retrieves next single character.
CLexer::PushBackToken
Backs up to beginning of last token.
CLexer::PushbackChar
Backs up one character.
CLexer::IsKeyword
Checks keyword list (defined in globals.h).
CLexer::AddComponent
Adds this component to the component array.
AddProviderName
Adds a syntactically correct provider name into the string to be parsed.
AddRootRDN
Adds the syntactically correct root relative distinguished name (RDN) ]name into the string to be parsed