diff --git a/common/markdown_parser/parse-expression.js b/common/markdown_parser/parse-expression.js index 609ac4b9..6fc3208a 100644 --- a/common/markdown_parser/parse-expression.js +++ b/common/markdown_parser/parse-expression.js @@ -10,7 +10,7 @@ export const parser = LRParser.deserialize({ maxTerm: 85, skippedNodes: [0,1], repeatNodeCount: 5, - tokenData: "=h~R!RX^$[pq$[qr%Prs%fst&Tuv&lwx&qxy'Zyz'`z{'e{|'j|}'o}!O't!O!P'y!P!Q(O!Q![*g![!]*o!^!_*t!_!`+R!`!a+`!a!b+m!b!c+z!c!},i!}#O-k#P#Q.h#S#T.m#T#U/[#U#W,i#W#X1X#X#Y,i#Y#Z1x#Z#],i#]#^5S#^#b,i#b#c6`#c#d8]#d#h,i#h#i;|#i#o,i#o#p=^#q#r=c#y#z$[$f$g$[#BY#BZ$[$IS$I_$[$I|$JO$[$JT$JU$[$KV$KW$[&FU&FV$[~$aY!Y~X^$[pq$[#y#z$[$f$g$[#BY#BZ$[$IS$I_$[$I|$JO$[$JT$JU$[$KV$KW$[&FU&FV$[R%UP!fP!_!`%XQ%^P!kQ#r#s%aQ%fO!oQ~%iTOr%frs%xs;'S%f;'S;=`%}<%lO%f~%}OU~~&QP;=`<%l%f~&YSP~OY&TZ;'S&T;'S;=`&f<%lO&T~&iP;=`<%l&T~&qO!r~~&tTOw&qwx%xx;'S&q;'S;=`'T<%lO&q~'WP;=`<%l&q~'`O!`~~'eO!a~~'jO!p~~'oO!s~~'tO!]~~'yO!g~~(OO!_~R(TW!qQOY(mZ](m^!P(m!Q#O(m#O#P)b#P;'S(m;'S;=`*a<%lO(mP(pXOY(mZ](m^!P(m!P!Q)]!Q#O(m#O#P)b#P;'S(m;'S;=`*a<%lO(mP)bOXPP)eRO;'S(m;'S;=`)n;=`O(mP)qYOY(mZ](m^!P(m!P!Q)]!Q#O(m#O#P)b#P;'S(m;'S;=`*a;=`<%l(m<%lO(mP*dP;=`<%l(m~*lPT~!Q![*g~*tO!v~~*yP!h~!_!`*|~+R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,iV7yUfSzPYR}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#o,iV8dWfSYR}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#f,i#f#g8|#g#o,iV9TWfSYR}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#W,i#W#X9m#X#o,iV9tWfSYR}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#X,i#X#Y:^#Y#o,iV:eWfSYR}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#f,i#f#g:}#g#o,iV;UVfSYRpq;k}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#o,iR;nP#U#V;qR;tP#m#n;wR;|OlRV spec_Identifier[value] || -1}], diff --git a/common/markdown_parser/parse-query.js b/common/markdown_parser/parse-query.js index e605e82e..d1374a96 100644 --- a/common/markdown_parser/parse-query.js +++ b/common/markdown_parser/parse-query.js @@ -10,7 +10,7 @@ export const parser = LRParser.deserialize({ maxTerm: 85, skippedNodes: [0,1], repeatNodeCount: 5, - tokenData: "=h~R!RX^$[pq$[qr%Prs%fst&Tuv&lwx&qxy'Zyz'`z{'e{|'j|}'o}!O't!O!P'y!P!Q(O!Q![*g![!]*o!^!_*t!_!`+R!`!a+`!a!b+m!b!c+z!c!},i!}#O-k#P#Q.h#S#T.m#T#U/[#U#W,i#W#X1X#X#Y,i#Y#Z1x#Z#],i#]#^5S#^#b,i#b#c6`#c#d8]#d#h,i#h#i;|#i#o,i#o#p=^#q#r=c#y#z$[$f$g$[#BY#BZ$[$IS$I_$[$I|$JO$[$JT$JU$[$KV$KW$[&FU&FV$[~$aY!Y~X^$[pq$[#y#z$[$f$g$[#BY#BZ$[$IS$I_$[$I|$JO$[$JT$JU$[$KV$KW$[&FU&FV$[U%UP!dQ!_!`%XS%^P!iS#r#s%aS%fO!mS~%iTOr%frs%xs;'S%f;'S;=`%}<%lO%f~%}OZ~~&QP;=`<%l%f~&YSP~OY&TZ;'S&T;'S;=`&f<%lO&T~&iP;=`<%l&T~&qO!p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i!P!Q-S!Q![,i!c!},i#R#S,i#T#g,i#g#h3v#h#o,iV3}WSPUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#X,i#X#Y4g#Y#o,iV4pUSP]QUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#o,iV5ZWSPUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#b,i#b#c5s#c#o,iV5|USPlSUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#o,iV6gWSPUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#c,i#c#d7P#d#o,iV7WWSPUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#h,i#h#i7p#i#o,iV7yUSPjQUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#o,iV8dWSPUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#f,i#f#g8|#g#o,iV9TWSPUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#W,i#W#X9m#X#o,iV9tWSPUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#X,i#X#Y:^#Y#o,iV:eWSPUU}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#f,i#f#g:}#g#o,iV;UVSPUUpq;k}!O,i!P!Q-S!Q![,i!c!},i#R#S,i#T#o,iU;nP#U#V;qU;tP#m#n;wU;|OuUV spec_Identifier[value] || -1}], diff --git a/common/markdown_parser/query.grammar b/common/markdown_parser/query.grammar index 6f7f7efb..93aba2fe 100644 --- a/common/markdown_parser/query.grammar +++ b/common/markdown_parser/query.grammar @@ -141,7 +141,7 @@ Bool { Order { "order by" } Regex { "/" ( ![/\\\n\r] | "\\" _ )+ "/" } - Number { std.digit+ } + Number { std.digit+ | std.digit+ "." std.digit+ } BooleanKW { "true" | "false" } diff --git a/plug-api/lib/parser-query.test.ts b/plug-api/lib/parser-query.test.ts index ab8e1503..aa281fff 100644 --- a/plug-api/lib/parser-query.test.ts +++ b/plug-api/lib/parser-query.test.ts @@ -436,4 +436,24 @@ Deno.test("Test query parser", () => { filter: ["*", ["number", 1], ["-", ["number", 2]]], }, ); + + assertEquals( + astToKvQuery( + wrapQueryParse(`page where 10.2`)!, + ), + { + querySource: "page", + filter: ["number", 10.2], + }, + ); + + assertEquals( + astToKvQuery( + wrapQueryParse(`page where 10.2 > 2.2`)!, + ), + { + querySource: "page", + filter: [">", ["number", 10.2], ["number", 2.2]], + }, + ); });