Skip to content

[Query] Id Map

github-actions[bot] edited this page Nov 8, 2026 · 1 revision

Generated from 'wiki-query.ts' on 2026-11-08, 09:20:49 UTC (v2.17.4), do not edit directly.

Id-Map Query [overview]

Returns the id-map of the normalized AST of the given code.
This query is requested with the type id-map.

This query provides access to all nodes in the normalized AST as a mapping from their id to the node itself.

Using the example code x + 1, the following query returns all nodes from the code:

[ { "type": "id-map" } ]

(This can be shortened to @id-map when used with the REPL command :query).

Results (prettified and summarized):

Query: id-map (2 ms)
   ╰ Id List: {0, 1, 2, 3}

Show Detailed Results as Json

The analysis ran (including parsing and normalization and the query) within the generation environment.

The JSON contains the ids of the nodes in question (see the Interface wiki page).

{"id-map":{".meta":{},"idMap":{"k2v":[[0,{"type":"RSymbol","location":[1,1,1,1],"content":"x","lexeme":"x","info":{"fullRange":[1,1,1,1],"adToks":[],"id":0,"parent":2,"role":"bin-l","index":0,"nest":0}}],[1,{"location":[1,5,1,5],"lexeme":"1","info":{"fullRange":[1,5,1,5],"adToks":[],"id":1,"parent":2,"role":"bin-r","index":1,"nest":0},"type":"RNumber","content":{"num":1,"complexNumber":false,"markedAsInt":false}}],[2,{"type":"RBinaryOp","location":[1,3,1,3],"lhs":{"type":"RSymbol","location":[1,1,1,1],"content":"x","lexeme":"x","info":{"fullRange":[1,1,1,1],"adToks":[],"id":0,"parent":2,"role":"bin-l","index":0,"nest":0}},"rhs":{"location":[1,5,1,5],"lexeme":"1","info":{"fullRange":[1,5,1,5],"adToks":[],"id":1,"parent":2,"role":"bin-r","index":1,"nest":0},"type":"RNumber","content":{"num":1,"complexNumber":false,"markedAsInt":false}},"operator":"+","lexeme":"+","info":{"fullRange":[1,1,1,5],"adToks":[],"id":2,"parent":3,"nest":0,"index":0,"role":"el-c"}}],[3,{"type":"RExpressionList","children":[{"type":"RBinaryOp","location":[1,3,1,3],"lhs":{"type":"RSymbol","location":[1,1,1,1],"content":"x","lexeme":"x","info":{"fullRange":[1,1,1,1],"adToks":[],"id":0,"parent":2,"role":"bin-l","index":0,"nest":0}},"rhs":{"location":[1,5,1,5],"lexeme":"1","info":{"fullRange":[1,5,1,5],"adToks":[],"id":1,"parent":2,"role":"bin-r","index":1,"nest":0},"type":"RNumber","content":{"num":1,"complexNumber":false,"markedAsInt":false}},"operator":"+","lexeme":"+","info":{"fullRange":[1,1,1,5],"adToks":[],"id":2,"parent":3,"nest":0,"index":0,"role":"el-c"}}],"info":{"adToks":[],"id":3,"nest":0,"role":"root","index":0}}]],"eager":false}},".meta":{}}
Original Code
x + 1
Implementation Details

The Id-Map Query is executed by executeIdMapQuery.

Clone this wiki locally

⌂ 换网址