diff --git a/client/space_lua/lua.grammar b/client/space_lua/lua.grammar index 99b8435c..519b9dee 100644 --- a/client/space_lua/lua.grammar +++ b/client/space_lua/lua.grammar @@ -98,7 +98,7 @@ QueryClause { LimitClause } -FromClause { ckw<"from"> (Name "=")? exp } +FromClause { ckw<"from"> (Name ("=" | kw<"in">))? exp } WhereClause { ckw<"where"> exp } LimitClause { ckw<"limit"> exp ("," exp)? } OrderByClause { ckw<"order"> ckw<"by"> list } diff --git a/client/space_lua/parse-lua.js b/client/space_lua/parse-lua.js index 28273805..ee029cca 100644 --- a/client/space_lua/parse-lua.js +++ b/client/space_lua/parse-lua.js @@ -1,15 +1,15 @@ // This file was generated by lezer-generator. You probably shouldn't edit it. import {LRParser} from "@lezer/lr" -const spec_identifier = {__proto__:null,break:16, goto:20, do:24, end:26, while:30, nil:32, true:34, false:36, or:80, and:82, not:104, function:114, query:122, from:129, where:133, order:137, by:139, desc:143, select:147, limit:151, repeat:154, until:156, if:160, then:162, elseif:164, else:166, for:170, in:178, local:188, return:204} +const spec_identifier = {__proto__:null,break:16, goto:20, do:24, end:26, while:30, nil:32, true:34, false:36, or:80, and:82, not:104, function:114, query:122, from:129, in:130, where:135, order:139, by:141, desc:145, select:149, limit:153, repeat:156, until:158, if:162, then:164, elseif:166, else:168, for:172, local:188, return:204} export const parser = LRParser.deserialize({ version: 14, - states: "EUO!ZQPOOOOQO'#Cc'#CcO!UQPO'#CaO!bQPOOOOQO'#E{'#E{O!vQQO'#CwO$]QPO'#EzOOQO'#Ez'#EzO$gQPO'#EzOOQO'#E`'#E`O%vQPO'#E_OOQO'#Ev'#EvOOQO'#Eg'#EgO%{QPO'#C_OOQO'#C_'#C_QOQPOOO!UQPO'#CeO&`QPO'#CgO!vQQO'#CjO&gQPO'#DzO!vQQO'#D}O!UQPO'#ESO!UQPO'#EZO&nQPO'#EaO&vQQO'#EeO'^QPO,58{OOQO'#Cq'#CqO!UQPO,59^O!vQQO,59`O(gQQO'#C|O(nQQO'#FQOOQ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h%|&cQsTQ!SbQ!UdY!bhn}#d#oQ!hlW!lm#v%U%oQ#UwQ#u!kQ#y&kQ#|!{Q#}!|Q$O!}Q$P#OQ$Q#PQ$R#QQ$S#RQ$T#SQ$U#TQ$e#_Q$g#aQ$u#pQ$w#tQ$y&mQ$z&oQ${&qQ$|&sQ$}&uQ%O&wQ%P&yQ%Q&{Q%R&}Q%^$^Q%_$_Q%a$aQ%c$bS%u%`&UQ%y&lQ%}%fQ&P%iQ&Q%mQ&S%tQ&W&nQ&X&pQ&Y&rQ&Z&tQ&[&vQ&]&xQ&^&zQ&_&|Q&`'OQ&a%xR&j&elRO]ac{#V#^#`#e%W%Y%h%|&c!UrTbdhlnw}!k!{!|!}#O#P#Q#R#S#T#_#a#d#o#p%f%i&ez!im#t#v$^$_$a%U%m%o%t%x&k&m&o&q&s&u&w&y&{&}k%b$b%`&U&l&n&p&r&t&v&x&z&|'OfUO]ac#^#`#e%Y%h%|&c#lVTbdhlmnw}!k!{!|!}#O#P#Q#R#S#T#_#a#d#o#p#t#v$^$_$a$b%U%`%f%i%m%o%t%x&U&e&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z&{&|&}'OQ#Y{Q$V#VR%p%WWpRr!i%bR#{!rQ!omV%S#v%U%oZoRr!i!r%bW!ch}#d#oR!qnR$X#VR%w%`R!WegXO]ac#^#`#e%Y%h%|&cR!_g", - nodeNames: "⚠ Comment Chunk Block ; Label :: Name break Goto goto Scope do end WhileStatement while nil true false Ellipsis Number LiteralString Property . MemberExpression [ ] Parens ( ) FunctionCall : TableConstructor { FieldDynamic FieldProp FieldExp } , BinaryExpression or and CompareOp BitOp BitOp BitOp BitOp Concat ArithOp ArithOp ArithOp UnaryExpression not ArithOp BitOp LenOp FunctionDef function FuncBody ArgList Query query QueryClause FromClause from WhereClause where OrderByClause order by OrderBy desc SelectClause select LimitClause limit RepeatStatement repeat until IfStatement if then elseif else ForStatement for ForNumeric ForGeneric NameList in ExpList Function FuncName LocalFunction local Assign VarList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$X#VR%w%`R!WegXO]ac#^#`#e%Y%h%|&cR!_g", + nodeNames: "⚠ Comment Chunk Block ; Label :: Name break Goto goto Scope do end WhileStatement while nil true false Ellipsis Number LiteralString Property . MemberExpression [ ] Parens ( ) FunctionCall : TableConstructor { FieldDynamic FieldProp FieldExp } , BinaryExpression or and CompareOp BitOp BitOp BitOp BitOp Concat ArithOp ArithOp ArithOp UnaryExpression not ArithOp BitOp LenOp FunctionDef function FuncBody ArgList Query query QueryClause FromClause from in WhereClause where OrderByClause order by OrderBy desc SelectClause select LimitClause limit RepeatStatement repeat until IfStatement if then elseif else ForStatement for ForNumeric ForGeneric NameList ExpList Function FuncName LocalFunction local Assign VarList Local AttNameList AttName Attrib ReturnStatement return", maxTerm: 151, nodeProps: [ - ["group", -14,4,5,8,9,11,14,30,76,79,84,91,93,95,97,"Statement",-3,34,35,36,"Field"] + ["group", -14,4,5,8,9,11,14,30,77,80,85,91,93,95,97,"Statement",-3,34,35,36,"Field"] ], skippedNodes: [0,1], repeatNodeCount: 11, @@ -18,5 +18,5 @@ export const parser = LRParser.deserialize({ topRules: {"Chunk":[0,2]}, dynamicPrecedences: {"128":1}, specialized: [{term: 119, get: (value) => spec_identifier[value] || -1}], - tokenPrec: 3779 + tokenPrec: 3782 }) diff --git a/client/space_lua/parse-lua.terms.js b/client/space_lua/parse-lua.terms.js index 2c088b0b..87ecf3ca 100644 --- a/client/space_lua/parse-lua.terms.js +++ b/client/space_lua/parse-lua.terms.js @@ -17,16 +17,16 @@ export const Query = 60, QueryClause = 62, FromClause = 63, - WhereClause = 65, - OrderByClause = 67, - OrderBy = 70, - SelectClause = 72, - LimitClause = 74, - IfStatement = 79, - ForStatement = 84, - ForNumeric = 86, - ForGeneric = 87, - NameList = 88, + WhereClause = 66, + OrderByClause = 68, + OrderBy = 71, + SelectClause = 73, + LimitClause = 75, + IfStatement = 80, + ForStatement = 85, + ForNumeric = 87, + ForGeneric = 88, + NameList = 89, ExpList = 90, FuncName = 92, VarList = 96, diff --git a/libraries/Library/Std/Editor/Lua.md b/libraries/Library/Std/Editor/Lua.md index 8bad9806..e55bc011 100644 --- a/libraries/Library/Std/Editor/Lua.md +++ b/libraries/Library/Std/Editor/Lua.md @@ -10,7 +10,7 @@ Features: # Code complete support ```space-lua -- priority: 10 -local LUA_KEYWORDS = {"do", "if", "then", "for", "else", "end", "function", "local", "return"} +local LUA_KEYWORDS = {"do", "if", "then", "for", "else", "end", "function", "local", "return", "in"} -- Are we in a comment? local function inComment(line) diff --git a/website/API/table.md b/website/API/table.md index cc9cc0ab..591740ce 100644 --- a/website/API/table.md +++ b/website/API/table.md @@ -121,7 +121,7 @@ Returns a new table from an old one, only with selected keys. Example: ${query[[ - from p = index.tag "page" + from p in index.tag "page" limit 3 select table.select(p, "name", "lastModified") ]]} \ No newline at end of file diff --git a/website/Space Lua/Lua Integrated Query.md b/website/Space Lua/Lua Integrated Query.md index 849aa01e..8c15aec4 100644 --- a/website/Space Lua/Lua Integrated Query.md +++ b/website/Space Lua/Lua Integrated Query.md @@ -7,22 +7,22 @@ However, in [[Space Lua]] it interpreted as an SQL (and [LINQ](https://learn.mic General syntax: query[[ - from = + from in where order by limit , select ]] -LIQ can operate on any Lua collection. +LIQ operates on any Lua collection. For instance, to sort a list of numbers in descending order: -${query[[from n = {1, 2, 3} order by n desc]]} +${query[[from n in {1, 2, 3} order by n desc]]} However, in most cases you’ll use it in conjunction with [[API/index#index.tag(name)]]. Here’s an example querying the 3 pages that were last modified: ${query[[ - from p = index.tag "page" + from p in index.tag "page" order by p.lastModified desc select p.name limit 3 @@ -41,50 +41,68 @@ Here are the clauses that are currently supported: ## from The `from` clause specifies the source of your data. There are two syntactic variants: -With explicit variable binding: +**Recommended:** With explicit variable binding: + + from v in <> + +or from v = <> binding each item to the variable `v`. -And the shorter: +However, there is also the more concise: from <> -implicitly binding each item to the variable `_` as well as making all attributes directly available as variables. +implicitly binding each item to the variable `_` as well as making all attributes directly available as variables. The latter, while shorter, is less performant and will block future optimizations, so the variable-binding variant is preferred. + +> **warning** Warning +> When you use a `from` clause without explicit variable binding (so without thee `v in` syntax), note that any attribute of the object you’re iterating over will shadow global variables. For instance, if you have an object with a `table` attribute, regular `table` APIs will become inaccessible within the query. +> +> **Recommendation:** Use the explicit variable binding syntax Example without variable binding: ${query[[from {1, 2, 3} select _]]} With variable binding: -${query[[from n = {1, 2, 3} select n]]} +${query[[from n in {1, 2, 3} select n]]} A more realistic example using `index.tag`: -${query[[from index.tag "page" order by lastModified select name limit 3]]} +${query[[from p in index.tag "page" order by p.lastModified select p.name limit 3]]} ## where The `where` clause allows you to filter data. When the expression evaluated to a truthy value, the item is included in the result. Example: -${query[[from {1, 2, 3, 4, 5} where _ > 2]]} +${query[[from n in {1, 2, 3, 4, 5} where n > 2]]} -Or to select all pages tagged with `#meta`: +Or to select 5 pages tagged with `#meta`: -${query[[from index.tag "page" where table.includes(tags, "meta")]]} +${query[[from p in index.tag "page" where table.includes(p.tags, "meta") limit 5]]} Or select based on name (including folder) and a [[API/string|string function]] -${query[[from index.tag "page" where name:startsWith("Person")]]} +${query[[from p in index.tag "page" where p.name:startsWith("Person")]]} ## order by [desc] The `order by` clause allows you to sort data, when `desc` is specified it reverts the sort order. As an example, the last 3 modified pages: ${query[[ - from index.tag "page" - order by lastModified desc - select name + from p in index.tag "page" + order by p.lastModified desc + select p.name + limit 3 +]]} + +You can order based on multiple expressions by specifying multiple expressions separated by commas: + +${query[[ + from p in index.tag "page" + order by p.lastModified desc, p.name + select p.name limit 3 ]]} @@ -107,28 +125,21 @@ The `select` clause allows you to transform each item in the result set. If omit Some examples: Double each number: -${query[[from {1, 2, 3} select _ * 2]]} +${query[[from n in {1, 2, 3} select n * 2]]} -Extract just the name from pages: -${query[[from index.tag "page" select _.name limit 3]]} - -You can also return tables or other complex values: +It is convenient to combine it with the [[API/table#table.select(table, keys...)]] API: ${query[[ - from p = index.tag "page" - select { - name = p.name, - modified = p.lastModified - } + from p in index.tag "page" + select table.select(p, "name", "lastModified") limit 3 ]]} ## Rendering the output - To render the output as a template, you can rely on the fact that queries return Lua tables. For example, to apply a template to render every page as a link: ${template.each(query[[ - from index.tag "page" - order by lastModified desc + from p in index.tag "page" + order by p.lastModified desc limit 3 ]], templates.pageItem)}