mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 01:48:32 +02:00
note. prefix also separates fulltext tokens from expression tokens
This commit is contained in:
parent
20b4b059e3
commit
d037420acb
@ -75,6 +75,19 @@ describe("Lexer expression", () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("note. prefix also separates fulltext from expression", () => {
|
||||||
|
expect(lex(`hello fulltext note.labels.capital = Prague`).expressionTokens.map(t => t.token))
|
||||||
|
.toEqual(["note", ".", "labels", ".", "capital", "=", "prague"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("note. prefix in quotes will note start expression", () => {
|
||||||
|
expect(lex(`hello fulltext "note.txt"`).expressionTokens.map(t => t.token))
|
||||||
|
.toEqual([]);
|
||||||
|
|
||||||
|
expect(lex(`hello fulltext "note.txt"`).fulltextTokens.map(t => t.token))
|
||||||
|
.toEqual(["hello", "fulltext", "note.txt"]);
|
||||||
|
});
|
||||||
|
|
||||||
it("complex expressions with and, or and parenthesis", () => {
|
it("complex expressions with and, or and parenthesis", () => {
|
||||||
expect(lex(`# (#label=text OR #second=text) AND ~relation`).expressionTokens.map(t => t.token))
|
expect(lex(`# (#label=text OR #second=text) AND ~relation`).expressionTokens.map(t => t.token))
|
||||||
.toEqual(["#", "(", "#label", "=", "text", "or", "#second", "=", "text", ")", "and", "~relation"]);
|
.toEqual(["#", "(", "#label", "=", "text", "or", "#second", "=", "text", ")", "and", "~relation"]);
|
||||||
|
@ -83,6 +83,10 @@ function lex(str) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!quotes) {
|
else if (!quotes) {
|
||||||
|
if (!fulltextEnded && currentWord === 'note' && chr === '.') {
|
||||||
|
fulltextEnded = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (chr === '#' || chr === '~') {
|
if (chr === '#' || chr === '~') {
|
||||||
if (!fulltextEnded) {
|
if (!fulltextEnded) {
|
||||||
fulltextEnded = true;
|
fulltextEnded = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user