Change in ovirt-engine-cli[master]: cli: No regular expression for IP, UUID or number

juan.hernandez at redhat.com juan.hernandez at redhat.com
Wed Aug 20 12:55:02 UTC 2014


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 at redhat.com>
---
M src/cli/parser.py
1 file changed, 17 insertions(+), 24 deletions(-)

Approvals:
  Michael Pasternak: Looks good to me, approved
  Ravi Nori: Looks good to me, but someone else must approve
  Juan Hernandez: Verified
  Ilia Meerovich: Looks good to me, but someone else must approve



-- 
To view, visit http://gerrit.ovirt.org/29722
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If670144751fdb9564380a12fb73596ecbaa47ee9
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Barak Azulay <bazulay at redhat.com>
Gerrit-Reviewer: Ilia Meerovich <imeerovi at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Michael Pasternak <mishka8520 at yahoo.com>
Gerrit-Reviewer: Ravi Nori <rnori at redhat.com>
Gerrit-Reviewer: automation at ovirt.org



More information about the Engine-commits mailing list