From patchwork Fri Mar 29 17:14:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Zupka X-Patchwork-Id: 2366201 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 371C93FD8C for ; Fri, 29 Mar 2013 17:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756069Ab3C2ROY (ORCPT ); Fri, 29 Mar 2013 13:14:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34851 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756013Ab3C2ROX (ORCPT ); Fri, 29 Mar 2013 13:14:23 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2THEMiR005016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 29 Mar 2013 13:14:22 -0400 Received: from jzupka-pc.local.com (vpn1-6-43.ams2.redhat.com [10.36.6.43]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2THEDM0032179; Fri, 29 Mar 2013 13:14:20 -0400 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=BDupka?= To: virt-test-devel@redhat.com, kvm@vger.kernel.org, kvm-autotest@redhat.com, lmr@redhat.com, ldoktor@redhat.com, jzupka@redhat.com, ehabkost@redhat.com, pbonzini@redhat.com Subject: [virt-test][PATCH 3/7] virt: Adds formal definition for Cartesian config Date: Fri, 29 Mar 2013 18:14:06 +0100 Message-Id: <1364577250-2637-4-git-send-email-jzupka@redhat.com> In-Reply-To: <1364577250-2637-1-git-send-email-jzupka@redhat.com> References: <1364577250-2637-1-git-send-email-jzupka@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Ji?í Župka --- virttest/cartesian_config.py | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/virttest/cartesian_config.py b/virttest/cartesian_config.py index 092e88d..ef91051 100755 --- a/virttest/cartesian_config.py +++ b/virttest/cartesian_config.py @@ -25,6 +25,91 @@ Cartesian configuration format file parser. : The last one starts a conditional block. + +Formal definition: + +regexp from python http://docs.python.org/2/library/re.html +Not deterministic but more readable for people. +Spaces between terminals and nontermials are only for better +reading of definitions. + +E={\n, #, :, "-", =, +=, <=, ?=, ?+=, ?<=, !, < , del, @, variants, include, only, no, name, value, exclude} +N={S, DEL, FILTER, FILTER_NAME, FILTER_GROUP, PN_FILTER_GROUP, STAT, VARIANT, VAR-TYPE, VAR-NAME, VAR-NAME-F, VAR, COMMENT, TEXT, DEPS, DEPS-NAME-F, EXCLUDE} + +I = I^n | n in N // indentation from start of line where n is indentation length. +I = I^n+x | n,x in N // indentation with shift +start symbol = S +end symbol = eps + +S -> I^0+x STATV | eps + +# +#I^n STATV +#I^n STATV +# + +I^n STATV -> I^n STATV \n I^n STATV | I^n STAT | I^n variants VARIANT + +I^n STAT -> I^n STAT \n I^n STAT | I^n COMMENT | I^n include INC +I^n STAT -> I^n del DEL | I^n FILTER | I^n EXCLUDE + +DEL -> name \n + +I^n STAT -> I^n name = VALUE | I^n name += VALUE | I^n name <= VALUE +I^n STAT -> I^n name ?= VALUE | I^n name ?+= VALUE | I^n name ?<= VALUE + +VALUE -> TEXT \n | 'TEXT' \n | "TEXT" \n + +COMMENT_BLOCK -> #TEXT | //TEXT +COMMENT -> COMMENT_BLOCK\n +COMMENT -> COMMENT_BLOCK\n + +TEXT = [^\n] TEXT //python format regexp + +# +#I^n variant VAR #comments: add possibility for comment +#I^n+x VAR-NAME: DEPS +#I^n+x+x2 STATV +#I^n VAR-NAME: +# + +VARIANT -> VAR COMMENT_BLOCK\n I^n+x VAR-NAME +VAR -> VAR-TYPE : | : // Named | unnamed variant + +VAR-TYPE -> VAR-TYPE,VAR-TYPE | name=VAR-NAME-F | with_default + +I^n VAR-NAME -> I^n VAR-NAME \n I^n VAR-NAME | I^n VAR-NAME-N \n I^n+x STATV +VAR-NAME-N -> - @VAR-NAME-F: DEPS | - VAR-NAME-F: DEPS +VAR-NAME-F -> [a-zA-Z0-9\._-]+ // Python regexp + +DEPS -> DEPS-NAME-F | DEPS-NAME-F,DEPS +DEPS-NAME-F -> [a-zA-Z0-9\._- ]+ // Python regexp + +INC -> name \n + +# +# FILTER_GROUP: STAT +# STAT +# +I^n STAT -> I^n PN_FILTER_GROUP | I^n ! PN_FILTER_GROUP + +PN_FILTER_GROUP -> FILTER_GROUP: \n I^n+x STAT | FILTER_GROUP: STAT \n I^n+x STAT + +# +# only FILTER_GROUP +# no FILTER_GROUP + +FILTER -> only FILTER_GROUP \n | no FILTER_GROUP \n + +FILTER_GROUP -> FILTER_NAME +FILTER_GROUP -> FILTER_GROUP..FILTER_GROUP +FILTER_GROUP -> FILTER_GROUP,FILTER_GROUP + +FILTER_NAME -> FILTER_NAME.FILTER_NAME +FILTER_NAME -> VAR-NAME-F | VAR-NAME-F=VAR-NAME-F + +EXCLUDE -> exclude FILTER + @copyright: Red Hat 2008-2011 """