Skip to content

Commit 5a450d0

Browse files
committed
TOML,Cargo: disable the parsers temporarily
See #4096. The TOML parser is broken. I replaced '|' in ABNF with '/' in PEG without enough consideration when importing the ABNF definition from https://github.com/toml-lang/toml/blob/main/toml.abnf. I kept the code because many test cases depend on the TOML parser. In addition, the design of the kind definition of the parser is still valuable The Cargo subparser is also disabled. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
1 parent e082e57 commit 5a450d0

File tree

12 files changed

+45
-3
lines changed

12 files changed

+45
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
--languages=-TOML
2+
--languages=+Cargo
3+
24
--map-Cargo=.cargo
35
--sort=no
46
--fields=+lK
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
--languages=+TOML
2+
13
--extras=+g
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
--languages=+TOML
2+
13
--extras=+g
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--languages=+TOML
2+
13
--extras=+g
24
--sort=no
35
--fields=+lne
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--languages=+TOML
2+
13
--extras=+g
24
--sort=no
35
--fields=+lne
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--languages=+TOML
2+
13
--sort=no
24
--fields=+ne
35
--extras=+g
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--languages=+TOML
2+
13
--sort=no
24
--fields=+ne
35
--extras=+g
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
--languages=+TOML
2+
13
--sort=no
24
--fields=+K{nth}{end}{line}

docs/news/HEAD.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ Parser related changes
4040
New parsers
4141
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4242

43-
* TOML *peg/packcc*
44-
* Cargo *TOML based subparser*
4543
* SELinuxIntefae *M4 based subparser*
4644
* SELinuxTypeEnforcement *optlib*
4745
* PythonEntryPoints *subparser*
4846

47+
.. note:: We added a TOML as a new parser in this version. However,
48+
after adding it, we learned its implementation didn't work
49+
entirely. So we deleted the TOML parser, and Cargo subparser
50+
runs on the TOML parser from this "New parsers" list.
51+
See `TOML: infinite loop <https://github.com/universal-ctags/ctags/issues/4096>`__
52+
about how it doesn't work.
53+
4954
Changes about parser specific kinds, roles, fields, and extras
5055
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5156

main/parse.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,6 +1813,22 @@ extern void enableLanguage (const langType language, const bool state)
18131813
{
18141814
Assert (0 <= language && language < (int) LanguageCount);
18151815
LanguageTable [language].def->enabled = state;
1816+
1817+
static bool warned_toml;
1818+
static bool warned_cargo;
1819+
1820+
/* See #4096 */
1821+
if (!warned_toml && strcmp (LanguageTable [language].def->name, "TOML") == 0)
1822+
{
1823+
warned_toml = true;
1824+
error (WARNING, "The current implementation of the TOML parser is broken.");
1825+
}
1826+
1827+
if (!warned_cargo && strcmp (LanguageTable [language].def->name, "Cargo") == 0)
1828+
{
1829+
warned_cargo = true;
1830+
error (WARNING, "Enabling Cargo subparser may enable TOML parser.");
1831+
}
18161832
}
18171833

18181834
#ifdef DO_TRACING

parsers/cargo.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,8 @@ extern parserDefinition* CargoParser (void)
136136
def->patterns = patterns;
137137
def->parser = findCargoTags;
138138
def->useCork = CORK_QUEUE;
139+
140+
def->enabled = false; /* The base parser, TOML parser doesn't work well. */
141+
139142
return def;
140143
}

peg/toml_post.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ extern parserDefinition* TomlParser (void)
243243
def->extensions = extensions;
244244
def->parser = findTomlTags;
245245
def->useCork = true;
246-
def->enabled = true;
247246
def->requestAutomaticFQTag = false;
247+
248+
def->enabled = false; /* This parser is broken. */
249+
248250
return def;
249251
}

0 commit comments

Comments
 (0)