From 2516f6922d625ec11c16b82e10852980c05fa11f Mon Sep 17 00:00:00 2001 From: anon Date: Sat, 14 Sep 2024 02:32:01 +0200 Subject: [PATCH] bring README up to date with the code --- README.md | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 2f24cc4..dcbccaf 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,7 @@ Modelled half after the original, half after Flex/Bison. ### Rule section ``` -enter { <...> } // code to run when tree-sitter node-type is encountered -close { <...> } // code to run when tree-sitter node-type is poped from +[enter|close]+ { <...> } // code to run when tree-sitter node-type is encountered/popped from ``` ### Code @@ -53,28 +52,19 @@ int tbtraverse(const char * const code); // master function; rules are evalua ``` #### In tbtraverse ```C -char * tbtext; // copy of the current nodes text value (not ts_node_string); XXX: this could be much optimized -int tblen; // string lenght of tbtext +GET_TBTEXT; // macro that returns a `char *` to the current node's text value (not ts_node_string); its the programmers responsibility to free() it +int tblen; // string lenght of tbtext; XXX probably broken? // XXX: these should probably be renamed -TSNode current_node; // node corresponding to the rule in enter rules -TSNode previous_node; // node corresponding to the rule in close rules +TSNode current_node; // node corresponding to the rule +// XXX need a macro bool for leave/enter ``` -### TODO -+ port "backend" to C (from C++) -+ port from python (can wait) - - optimize the allocation of tbtext - - optimize from strcmp() - ### Thinking area ```C // This should be allowed to mean 'a' or 'b' enter a b { <...> } -// This should be allowed to mean 'enter' or 'leave' -enter leave a { <...> } - -// In node type blobbing should probably be allowed, however regex sounds like overkill +// In the node type, blobbing should probably be allowed, however regex sounds like overkill /* A query language should also exist * $0->