What is the intended mechanism to deal with quote characters in values?
- Dominant language
- Python
- Stars
- 23
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
The textual representation of KGCL needs a way to cope with the possibility that a textual value associated with a change (e.g., the old or new value of a label, definition, synonym, etc.) may contain quote characters.
There are several possible options:
* C-style escape sequences, e.g., `create related synonym 'poor man\'s synonym' for EX:0001`;
* alternating between single- and double-quotes as needed (use single-quotes if the value contains a double-quote and vice-versa) – this does not allow a value to contain both single- and double-quotes simultaneously;
* Python-style triple-quoting, e.g. `create related synonym '''poor man's synonym''' for EX:0001`.
Currently, the Python implementation of KGCL [seems to opt for triple-quoting](https://github.com/INCATools/kgcl/blob/06eaad8a3ceeab2d07be3f3f2147a7b8e5f3de84/src/kgcl_schema/grammar/render_operations.py#L52) when rendering, but the [Lark grammar](https://github.com/INCATools/kgcl/blob/main/src/kgcl_schema/grammar/kgcl.lark) does not allow that for most literal values: synonyms, labels, and definitions are all ultimately expected to be `SINGLE_QUOTE_LITERAL`, i.e. can only be enclosed in `'...'`.
Contributor guide
Research direction
Start by comparing src/kgcl_schema/grammar/render_operations.py with src/kgcl_schema/grammar/kgcl.lark, focusing on how quoted labels, definitions, synonyms, and other literal values are rendered and parsed. Resolve which quoting mechanism KGCL intends to support, then align the renderer and grammar so values containing quote characters are accepted consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100