[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
- Stylistic changes to tree-sitter code, Po Lu, 2022/10/27
- Re: Stylistic changes to tree-sitter code, Robert Pluim, 2022/10/27
- Re: Stylistic changes to tree-sitter code, Po Lu, 2022/10/27
- Re: Stylistic changes to tree-sitter code, Yuan Fu, 2022/10/28
- Re: Stylistic changes to tree-sitter code, Robert Pluim, 2022/10/28
- Re: Stylistic changes to tree-sitter code, Po Lu, 2022/10/28
- Re: Stylistic changes to tree-sitter code, Po Lu, 2022/10/28
- Re: Stylistic changes to tree-sitter code,
Yuan Fu <=
- Re: Stylistic changes to tree-sitter code, Po Lu, 2022/10/29
- Re: Stylistic changes to tree-sitter code, Eli Zaretskii, 2022/10/29
- Re: Stylistic changes to tree-sitter code, Po Lu, 2022/10/29
- Re: Stylistic changes to tree-sitter code, Eli Zaretskii, 2022/10/29
- Re: Stylistic changes to tree-sitter code, Po Lu, 2022/10/29
- Re: Stylistic changes to tree-sitter code, Eli Zaretskii, 2022/10/29
- Re: Stylistic changes to tree-sitter code, Stefan Kangas, 2022/10/29