-
Ignores insignificant whitespace; including line endings [img]
-
Individual partial words matching, on top of classic whole word matching on/off modes [img]
stat nlin boo==static inline bool -
Linguistic folding, diacritics and case insensitivity of tokens through Windows API NLS [img]
-
Entering query (or part) as
/*comment*/or"string"searches (that part) within comments/strings only [img]- orthogonal mode will search code only within code [img]
-
Matching of
camelCaseandsnake_caseidentifiers [img] -
Matching different numeric notations [img]
0x007B,0173,0b0'0111'1011all match123
0x7BuLLmatches123.0funless the option to match integers and floats is turned off -
Matching specific language tokens to their numeric values [img]
trueandfalsematch 0/1NULLandnullptrmatch 0
-
Matching semantically similar constructs user may not care for when searching
class abcwill findstruct abcas well,template<typenamewill findtemplate<class: zzzwill find all derived from zzz, even: virtual public zzzshort a;will find alsoshort int unsigned a;(shortmust be first in this version)
-
Option to ignore keyboard accelerator hints (&, Win32 GUI feature) in strings [img]
-
Options to ignore all syntactic tokens, or braces, brackets or parentheses in particular [img]
- For commas or semicolons it's either all or trailing only
-
Matching digraphs, trigraphs and ISO646 alternative tokens to primary tokens they represent [img]
-
Removes
*and/decorations from comments before searching [img]
- SearchTest.exe (x64)
- start the program, load any short C++ file, and try searching; mind interferences between options
- colorized variant of the code on the right shows the internal pattern (for debugging purposes)
#include "agsearch.h"
struct search : public agsearch {
std::vector <std::pair <location, location>> results;
std::size_t find (std::wstring_view needle) {
this->results.clear ();
return this->agsearch::find (needle);
}
private:
bool found (std::wstring_view needle, std::size_t i, location begin, location end) override {
this->results.push_back ({ begin, end });
return true;
}
} search;
int main () {
// ...
search.parameters.whole_words = false; // configure the engine
search.load (text); // 'text' is container of std::wstring_view
search.append (line); // 'line' is single line of code std::wstring_view
// ...
search.find (needle); // 'needle' is code to be searched for
search.results; // contains pair of 'location' for every found instance
// ...
}Notes:
- whole text must be reloaded when any of the
agsearch::parameterschange agsearch::locationcontainsrowandcolumnmembers, and both are 0-based- return false from
foundvirtual callback to stop search
- better approach to different notations for the same type
"unsigned int" == "int unsigned"== "std::uint32_t"(configurable plaftorm assumptions)- ignoring redundant
- match different order of declaration qualifiers, e.g.:
"static inline" == "inline static" - match
int main(???)toauto main(???) -> int - match
()and(void) - text string search
- match different forms of escapes, e.g.:
\n == \013 - match escaped characters to actual characters
- right now string contents are tokenized too
- also do string literal combining
- match different forms of escapes, e.g.:
- wildcard
*matching anything in between two code segments - match reinterpret_cast/static_cast to C-style cast
- improve memory usage of token
- union switched on type to merge exlusive members
alternativeallocated only when necessary