emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stylistic changes to tree-sitter code


From: Yuan Fu
Subject: Re: Stylistic changes to tree-sitter code
Date: Fri, 28 Oct 2022 21:19:19 -0700

Ah, yes, the patch compiles fine, though there is a segfault: I believe you 
forgot to initialized the tem variable.

@@ -449,21 +453,28 @@ treesit_symbol_to_c_name (char *symbol_name)
 treesit_find_override_name (Lisp_Object language_symbol, Lisp_Object *name,
                            Lisp_Object *c_symbol)
 {
+  Lisp_Object tem;
+
   CHECK_LIST (Vtreesit_load_name_override_list);
-  for (Lisp_Object list = Vtreesit_load_name_override_list;
-       !NILP (list); list = XCDR (list))
+
+  FOR_EACH_TAIL (tem)
     {
-      Lisp_Object lang = XCAR (XCAR (list));
+      Lisp_Object lang = XCAR (XCAR (tem));
       CHECK_SYMBOL (lang);
+
       if (EQ (lang, language_symbol))
        {
-         *name = Fnth (make_fixnum (1), XCAR (list));
+         *name = Fnth (make_fixnum (1), XCAR (tem));
          CHECK_STRING (*name);
-         *c_symbol = Fnth (make_fixnum (2), XCAR (list));
+         *c_symbol = Fnth (make_fixnum (2), XCAR (tem));
          CHECK_STRING (*c_symbol);
+
          return true;
        }
     }
+
+  CHECK_LIST_END (tem, Vtreesit_load_name_override_list);
+
   return false;
 }
 
Also, out of curiosity, I thought active voice is good and passive voice is 
bad? Though the subject here doesn’t add any useful information, I recon.

-   - It doesn't expose a syntax tree.  We put the syntax tree in the
-     parser object, and updating the tree is handled on the C level.
+   - It doesn't expose a syntax tree.  The syntax tree is placed in
+     the parser object, and updating the tree is handled at the C
+     level.
 
-   - We don't expose tree cursor either.  I think Lisp is slow enough
-     to nullify any performance advantage of using a cursor, though I
-     don't have evidence.  Also I want to minimize the number of new
-     types we introduce.  Currently we only add parser and node type.
+   - The tree cursor is not exposed either.  I think Lisp is slow
+     enough to nullify any performance advantage of using a cursor,
+     though I don't have evidence.  Also I want to minimize the number
+     of new types we introduce.  Currently we only add parser and node
+     type.


Yuan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]