19#define ES expressions::Scope
20#define DS dynamic_cast<DXLScope&>(scope)
22#define VAL (*DS.Xlink)
23#define NODE VAL.Result().Node
24#define INTARG0 int(begin->Unbox<integer>())
25Box linkString(ES& scope, AI, AI) {
return DS.Xlink->LinkString; }
26Box display (ES& scope, AI, AI) {
return DS.Xlink->Display; }
27Box linkDisplay(ES& scope, AI, AI) {
return DS.Xlink->DisplayOriginalPos
28 ? DS.Xlink->LinkString.Substring(DS.Xlink->DisplayOriginalPos)
30Box linkTarget(ES& scope, AI, AI) {
return DS.Xlink->DisplayOriginalPos
31 ? DS.Xlink->LinkString.Substring(0, DS.Xlink->DisplayOriginalPos-1)
32 : DS.Xlink->LinkString; }
35Box kindSpec (ES& scope, AI, AI) {
return VAL.KindSpec; }
37Box target (ES& scope, AI,AI) {
38 return DS.Xlink->IsResolved() ? DS.Xlink->Result().Node
42Box isScannedFile(ES& scope, AI,AI) {
return VAL.IsResolved() && DS.Xlink->Result().LinksToAScannedHTMLFile; }
43Box isIndSource (ES& scope, AI,AI) {
return VAL.IsResolved() && DS.Xlink->Result().IsIndirectLinkToScannedHTMLSourceFile; }
44Box isIndInherit (ES& scope, AI,AI) {
return VAL.IsResolved() && DS.Xlink->Result().IsIndirectByInheritance; }
45Box isIndTDMem (ES& scope, AI,AI) {
return VAL.IsResolved() && DS.Xlink->Result().IsIndirectByTypeDef; }
46Box isIndTypeDef (ES& scope, AI,AI) {
return VAL.IsResolved() && DS.Xlink->Result().IsResolvedTypeDef; }
48Box name(ES& scope, AI begin, AI end) {
52 if ( DS.Xlink->IsResolved())
53 node= DS.Xlink->Result().Node;
58 if (node.IsInvalid() || node.IsRoot() )
63Box path (ES& scope, AI begin, AI end) {
67 if ( DS.Path.IsNull() ) {
68 if (!VAL.IsResolved() )
80 auto node= begin->Unbox<
Index::Node>();
81 if (node.IsInvalid() || node.IsRoot() )
84 ALIB_LOCK_SHARED_WITH(node.
Index().SLock)
86 return
String(scope.Allocator, path);
89Box parent (ES& scope, AI begin, AI end) {
92 if ( !DS.Xlink->IsResolved())
94 return DS.Xlink->Result().Node.Parent();
99 auto node= begin->Unbox<Index::Node>();
100 if (node.IsInvalid() || node.IsRoot() )
101 return Index::Node();
102 return node.Parent();
106 if ( !DS.Xlink->IsResolved())
109 auto node = DS.Xlink->Result().Node;
110 while (depth>0 && !node.IsRoot()) {
117Box isGood (ES& scope, AI,AI) {
return DS.Xlink->IsGood (
false); }
118Box isResolved(ES& scope, AI,AI) {
return DS.Xlink->IsResolved (); }
119Box hasError (ES& scope, AI,AI) {
return DS.Xlink->HasErrors (); }
120Box hasWarning(ES& scope, AI,AI) {
return DS.Xlink->HasWarnings(
false); }
121Box errorCode (ES& scope, AI,AI) {
return DS.Xlink->Error; }
123Box countSrcLocs( ES& scope, AI,AI) {
return integer(DS.Xlink->SourceLocations.size()); }
124Box countHTMLLocs(ES& scope, AI,AI) {
return integer(DS.Xlink->HTMLLocations .size()); }
126Box countScpHnts (ES& scope, AI,AI) {
return DS.Xlink->HintsSize(); }
127Box scopeHint (ES& scope, AI begin,AI) {
129 return idx>= 0 && idx< DS.Xlink->HintsSize() ? DS.Xlink->Hint(idx)
132Box countScope (ES& scope, AI,AI) {
return DS.Xlink->ScopeSize() - 1; }
133Box scope (ES& scope, AI begin,AI) {
135 return idx>= 0 && idx< DS.Xlink->ScopeSize() ? DS.Xlink->Scope( DS.Xlink->ScopeSize() - idx - 1)
138Box identifier (ES& scope, AI,AI) {
139 return DS.Xlink->ScopeSize() > 0 ? DS.Xlink->Scope( DS.Xlink->ScopeSize() - 1)
143Box countParams (ES& scope, AI begin,AI end) {
145 return DS.Xlink->Args ? DS.Xlink->Args->Count : -1;
150 return args ? args->Count : -1;
153Box params (ES& scope, AI begin,AI end) {
155 if ( begin == end ) {
156 args= DS.Xlink->Args;
167 return String(scope.Allocator, buf);
170Box countTParams (ES& scope, AI begin,AI end) {
172 return DS.Xlink->TemplateArgs ? DS.Xlink->TemplateArgs->Count : -1;
177 return args ? args->Count : -1;
180Box tParams (ES& scope, AI begin,AI end) {
182 if ( begin == end ) {
183 args= DS.Xlink->TemplateArgs;
194 return String(scope.Allocator, buf);
197Box countTSParams (ES& scope, AI begin,AI end) {
199 return DS.Xlink->SpecializationArgs ? DS.Xlink->SpecializationArgs->Count : -1;
204 return args ? args->Count : -1;
207Box tSParams (ES& scope, AI begin,AI end) {
209 if ( begin == end ) {
210 args= DS.Xlink->SpecializationArgs;
221 return String(scope.Allocator, buf);
224Box depth (ES& scope, AI begin,AI end) {
226 if ( begin == end ) {
227 if ( !DS.Xlink->IsResolved())
229 node= DS.Xlink->Result().Node;
233 if (node.IsInvalid() || node.IsRoot() )
237 return node.AsCursor().Depth();
240Box tagFilePath (ES& scope, AI begin,AI end) {
242 if ( begin == end ) {
243 if ( !DS.Xlink->IsResolved())
245 node= DS.Xlink->Result().Node;
249 if (node.IsInvalid() || node.IsRoot() )
252 return node.
Index().FilePath;
255Box tagFileName (ES& scope, AI begin,AI end) {
257 if ( begin == end ) {
258 if ( !DS.Xlink->IsResolved())
260 node= DS.Xlink->Result().Node;
264 if (node.IsInvalid() || node.IsRoot() )
270Box tagFileLine (ES& scope, AI begin,AI end) {
272 if ( begin == end ) {
273 if ( !DS.Xlink->IsResolved())
275 node= DS.Xlink->Result().Node;
279 if (node.IsInvalid() || node.IsRoot() )
285Box htmlFile (ES& scope, AI begin,AI end) {
287 if ( begin == end ) {
288 if ( !DS.Xlink->IsResolved())
290 node= DS.Xlink->Result().Node;
294 if (node.IsInvalid() || node.IsRoot() )
300Box htmlAnchor (ES& scope, AI begin,AI end) {
302 if ( begin == end ) {
303 if ( !DS.Xlink->IsResolved())
305 node= DS.Xlink->Result().Node;
309 if (node.IsInvalid() || node.IsRoot() )
325extern Box constDir ;
Box constDir ;
326extern Box constFile ;
Box constFile ;
327extern Box constPage ;
Box constPage ;
328extern Box constGroup ;
Box constGroup ;
329extern Box constDocAnchor ;
Box constDocAnchor ;
330extern Box constNameSpace ;
Box constNameSpace ;
331extern Box constStruct ;
Box constStruct ;
332extern Box constClass ;
Box constClass ;
333extern Box constUnion ;
Box constUnion ;
334extern Box constConcept ;
Box constConcept ;
335extern Box constMacro ;
Box constMacro ;
336extern Box constTypedef ;
Box constTypedef ;
337extern Box constVariable ;
Box constVariable ;
338extern Box constFunction ;
Box constFunction ;
339extern Box constEnumeration ;
Box constEnumeration ;
340extern Box constEnumElement ;
Box constEnumElement ;
341extern Box constGenericMember ;
Box constGenericMember ;
342extern Box constRecord ;
Box constRecord ;
343extern Box constUnspecified ;
Box constUnspecified ;
345extern Box TypeNode ;
Box TypeNode ;
346extern Box TypeKind ;
Box TypeKind ;
348extern Box* SigNode[1] ;
Box* SigNode[1]= { &TypeNode };
356struct Plugin : plugins::Calculus {
382 TypeNode = Index::Node();
390 constexpr int tableSize= 58;
391 Token functionNames[tableSize];
394 Token* descriptor= functionNames;
397 ConstantIdentifiers= {
398 { *descriptor++, constDir },
399 { *descriptor++, constFile },
400 { *descriptor++, constPage },
401 { *descriptor++, constGroup },
402 { *descriptor++, constDocAnchor },
403 { *descriptor++, constNameSpace },
404 { *descriptor++, constStruct },
405 { *descriptor++, constClass },
406 { *descriptor++, constUnion },
407 { *descriptor++, constConcept },
408 { *descriptor++, constMacro },
409 { *descriptor++, constTypedef },
410 { *descriptor++, constVariable },
411 { *descriptor++, constFunction },
412 { *descriptor++, constEnumeration },
413 { *descriptor++, constEnumElement },
414 { *descriptor++, constGenericMember },
415 { *descriptor++, constRecord },
416 { *descriptor++, constUnspecified },
487expressions::Compiler* theCompiler=
nullptr;
488Plugin* thePlugin=
nullptr;
506 thePlugin =
new Plugin(*theCompiler);
507 theCompiler->SetupDefaults();
508 theCompiler->InsertPlugin( thePlugin );
512 expression= theCompiler->Compile( expressionString );
524 scope->Xlink = xLink;
526 return result.
IsType<
bool>() ? result.
Unbox<
bool>()
#define ALIB_LOCK_SHARED_WITH(lock)
void AddType(Type sample, const NString &name)
const String & GetResource(const NString &name)
DXLScope * scope
The scope used with this filter.
~DXLExpression()
Destructor.
bool Includes(XLink *xLink)
DXLExpression(const alib::String &expressionString)
alib::expressions::Expression expression
The compiled expression.
alib::system::PathString FileName
The base name component of FilePath.
@ Struct
Denotes a struct.
@ Function
Denotes a namespace- or member-function.
@ Variable
Denotes a namespace- or member-variable.
@ UNSPECIFIED
Used with the field #"XLink::KindSpec;2".
@ Typedef
Denotes a type definition.
@ File
Denotes a source file.
@ EnumElement
Denotes an enumeration element.
@ UNRESOLVED
The kind attached to the root node of the tree.
@ Concept
Denotes a C++20 concept.
@ Macro
Denotes a preprocessor definition.
@ GenericMember
An unknown or uninteresting group member type.
@ Dir
Denotes a source folder.
@ Enumeration
Denotes an enumeration.
@ Namespace
Denotes a namespace.
@ DocAnchor
Denotes a preprocessor definition.
@ RECORD
Mask to identify records types.
#define CALCULUS_DEFAULT_AUTOCAST
#define CALCULUS_CALLBACK(func)
#define CALCULUS_SIGNATURE(BoxPointerArray)
void LoadResourcedTokens(camp::Camp &module, const NString &resourceName, strings::util::Token *target, int dbgSizeVerifier, character outerSeparator=',', character innerSeparator=' ')
constexpr const String EMPTY_STRING
expressions::Compiler Compiler
strings::TString< character > String
app::AppCliCamp APPCLI_CAMP
LocalString< 256 > String256
strings::util::Token Token
expressions::plugins::Calculus Calculus
const TGT * Cast(const Index::Node &node)
Scope(const Scope &)=delete
The cursor type of the #"StringTree".
const alib::String & HTMLFile() const