Skip to content

Parser ignores RegEx in Alternation with RegEx and FixedString #133

@anna-riesch

Description

@anna-riesch

Describe the bug

  • Alternation with RegEx and FixedString
  • Tabcompletion only completes Fixed string

Example for completing ./gwhisper <Tab>:

-h
--complete
--rpcTimeoutMilliseconds=<FixedString>
...

To Reproduce
Add an Alternation-GrammarElement in GrammarConstruction.cpp, containing a FixedString and a RegEx, e.g.:

GrammarElement *timeout = f_grammarPool.createElement<Concatenation>(); timeout->addChild(f_grammarPool.createElement<FixedString>("--rpcTimeoutMilliseconds=", "rpcTimeout"));
GrammarElement *timeoutTime = f_grammarPool.createElement<Alternation>();
 timeout->addChild(timeoutTime);
timeoutTime->addChild(f_grammarPool.createElement<RegEx>("[0-9]+", "rpcTimeoutInMs"));
timeoutTime->addChild(f_grammarPool.createElement<FixedString>("None", "manualInfiniteTimeout"));
optionsalt->addChild(timeout);

Expected behavior
When completing, all options of an alternation are shown, allowing the user to choose between using the FixedString or his own input.
e.g.
./gwhisper --rpcTimeoutMilliseconds=<Tab>
returns

-h
--complete
--rpcTimeoutMilliseconds=
...

and then typing
./gwhisper --rpcTimeoutMilliseconds=<Tab>
should return the options:
--rpcTimeoutMilliseconds=<RegEx> --rpcTimeoutMilliseconds=<FixedString>

Provide details about your environment

  • Operating System version: Fedora 35
  • gwhisper --version output: v4.0.0-9
  • gRPC/protobuf version:
  • Compiler version (if related to build):
  • CMake version (if related to build):

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions