Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Wed, 08 Jan 2025 12:37:49 UTC Commit: 573b8e158b0459c1023ed9da2371828910ce2368 https://github.com/geany/geany/commit/573b8e158b0459c1023ed9da2371828910ce23...
Log Message: ----------- iniconf: some adjustments for parsing TOML
This patch:
- allows . and - in keys - improve parsing of TOML [[arrays_of_tables]] - adds support for 'single quoted keys' = true and "double quoted keys" = true
See https://github.com/universal-ctags/ctags/pull/4099
Modified Paths: -------------- ctags/parsers/iniconf.c
Modified: ctags/parsers/iniconf.c 10 lines changed, 7 insertions(+), 3 deletions(-) =================================================================== @@ -32,10 +32,13 @@ #include "subparser.h" #include "vstring.h"
+#define TOML_QUOTED_KEY_CHAR(c) ( (c) == '"' || (c) == ''' ) + static bool isIdentifier (int c) { - /* allow whitespace within keys and sections */ - return (bool)(isalnum (c) || isspace (c) || c == '_'); + /* allow whitespace within keys and sections */ + return (bool)(isalnum (c) || isspace (c) || c == '_' || c == '-' || c == '.' + || TOML_QUOTED_KEY_CHAR(c)); }
static bool isValue (int c) @@ -130,7 +133,8 @@ static void findIniconfTags (void) if (*cp == '[') { ++cp; - while (*cp != '\0' && *cp != ']') + /* look for the final ] to support TOML [[arrays.of.tables]] */ + while (*cp != '\0' && (*cp != ']' || *(cp+1) == ']')) { vStringPut (name, *cp); ++cp;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).