-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String escapes #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! 😁
There seems to be some errors produced when parsing the standard models though:
$ ./scripts/test-parsing-yang-modules.sh
Total parses: 368; successful parses: 363; failed parses: 5; success percentage: 98.64%
Could you check that out?
Oh, interesting. Looks like the problematic files have
But according to 6.1.3:
which would make that double-quoted pattern completely not OK. 9.4.5 says:
Not too sure how these parts of the spec can be reconciled, except perhaps by interpreting a "regular expression string" to be somehow outside of the normal rules for strings. Or perhaps we have discovered that these modules really are faulty. Awkward! |
YangModels/yang#366 suggests that the parser is right and the models are wrong. |
So I think probably the way to resolve this is to exclude those faulty models from that test. What do you think? |
One thing I'm not entirely clear on, is the string argument for In any case I'm fine with excluding them as you have done. One thing though, if I pull this branch and run
Did you generate the parser before you committed? Or is there something environmental that gives us different C output? diff --git a/src/parser.c b/src/parser.c
index fefc9e0..409ef25 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -179,7 +179,7 @@ enum {
alias_sym_enum_value = 152,
};
-static const char *ts_symbol_names[] = {
+static const char * const ts_symbol_names[] = {
[ts_builtin_sym_end] = "end",
[sym__word] = "_word",
[anon_sym_module] = "module",
@@ -1113,7 +1113,7 @@ enum {
field_submodule_name = 4,
};
-static const char *ts_field_names[] = {
+static const char * const ts_field_names[] = {
[0] = NULL,
[field_module_block] = "module_block",
[field_module_name] = "module_name",
diff --git a/src/tree_sitter/parser.h b/src/tree_sitter/parser.h
index a3a87bd..cbbc7b4 100644
--- a/src/tree_sitter/parser.h
+++ b/src/tree_sitter/parser.h
@@ -102,8 +102,8 @@ struct TSLanguage {
const uint16_t *small_parse_table;
const uint32_t *small_parse_table_map;
const TSParseActionEntry *parse_actions;
- const char **symbol_names;
- const char **field_names;
+ const char * const *symbol_names;
+ const char * const *field_names;
const TSFieldMapSlice *field_map_slices;
const TSFieldMapEntry *field_map_entries;
const TSSymbolMetadata *symbol_metadata; |
I can't see any justification for treating Presumably we have slightly different versions of tree-sitter CLI. I am usuing v0.20.0, which I have compiled locally. The other idea I had re fixing up the testing of parsing standard YANG modules was that we could patch them to be correct before testing. Slightly more trouble than excluding the bad models completely, but maybe better? |
Thanks for the contribution! |
Some comments
TSError
.