Juan Hernandez has submitted this change and it was merged.
Change subject: cli: No regular expression for IP, UUID or number
......................................................................
cli: No regular expression for IP, UUID or number
Currently the command line lexer uses regular expressions to match IP
addresses, UUIDs and numbers. But in the parser grammar there is no
production that accepts those terminal symbols and doesn't accept also
plain words. The only special treatment is that numeric values are
converted to "int".
This behaviour means that some words that happen to start like IP
addresses, UUIDS or numbers are split into two tokens. For example, the
following command line:
update host 10.10.10.10a --name 10.10.10.10
Will be split into the following tokens:
WORD: update
WORD: host
IPADDR: 10.10.10.10
WORD: a
OPTION: --name
IPADDR: 10.10.10.10
But it should have been as follows:
WORD: update
WORD: host
WORD: 10.10.10.10a
OPTION: --name
IPADDR: 10.10.10.10
To avoid this issue, and simplify the lexer, this patch removes these
regular expressions for IP addresses, UUIDs and numbers, and replaces
them with a single expression that matches words. The action for this
expression will check if the value is actually an integer and convert it
to "int".
Change-Id: If670144751fdb9564380a12fb73596ecbaa47ee9
Bug-Url:
https://bugzilla.redhat.com/1110366
Signed-off-by: Juan Hernandez <juan.hernandez(a)redhat.com>
(cherry picked from commit e160c941231e84638253fae0e90df4dc976ad980)
---
M src/cli/parser.py
1 file changed, 17 insertions(+), 24 deletions(-)
Approvals:
Juan Hernandez: Verified; Looks good to me, approved
--
To view, visit
http://gerrit.ovirt.org/31710
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If670144751fdb9564380a12fb73596ecbaa47ee9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: cli_3.5
Gerrit-Owner: Juan Hernandez <juan.hernandez(a)redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org