This program implements a format for searching texts with the following grammar:
Quotkey:
" any string without `"` "
QuotkeySeq:
(Quotkey \s*)* Quotkey
Fuzykey:
nonempty trimed string which is not Set, has no white spaces, has no `"` pair
FuzykeySeq:
(Fuzykey \s+)* Fuzykey
Key:
(QuotkeySeq | FuzykeySeq)+
Ids:
(priid \s*)* priid
Rel:
(Key | Ids | \* | \?) \s* > \s*
(Key | Ids | \* | \?) \s* > \s*
(Key | Ids | \* | \?)
Substract:
Set \s* \ \s* Set
Intersect:
Set \s* ∩ \s* Set
Union:
Set \s* ∪ \s* Set
UnparenthesizedSet:
Intersect | Substract | Union | Rel | Key | Ids
ParenthesizedSet:
\( \s* UnparenthesizedSet \s* \)
Set:
UnparenthesizedSet | PparenthesizedSet
For example, searching videos about TypeScript or JavaScript unrelated to Deno can be
video > contain > ? ∩ (typescript ∪ javascript) \ deno
This program uses a compiling mechanism, i.e., compile while editing. It finds the smallest dirty node, and recompiles that node only, reusing unrelated nodes within the dirty node. So it is very efficient for editing.
cd /path_to/set.ts
# deno 2.7.9
deno test # 2 passed (17 steps)