Skip to content
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

Parser ignores RegEx in Alternation with RegEx and FixedString #133

Open
anna-riesch opened this issue Feb 15, 2022 · 0 comments
Open

Parser ignores RegEx in Alternation with RegEx and FixedString #133

anna-riesch opened this issue Feb 15, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@anna-riesch
Copy link
Contributor

anna-riesch commented Feb 15, 2022

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.

@anna-riesch anna-riesch added the bug Something isn't working label Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant