From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH 2/2] hxtool: Add syntax error detection
Date: Thu, 20 May 2010 09:16:33 +0200 [thread overview]
Message-ID: <4BF4E1D1.1010507@web.de> (raw)
In-Reply-To: <4BF4E1A9.9010405@web.de>
From: Jan Kiszka <jan.kiszka@siemens.com>
Add basic imbalance detection for STEXT/ETEXI.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hxtool | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/hxtool b/hxtool
index 0fdbc64..8f65532 100644
--- a/hxtool
+++ b/hxtool
@@ -19,11 +19,24 @@ hxtoh()
hxtotexi()
{
flag=0
+ line=1
while read -r str; do
case "$str" in
HXCOMM*)
;;
- STEXI*|ETEXI*) flag=$(($flag^1))
+ STEXI*)
+ if test $flag -eq 1 ; then
+ echo "line $line: syntax error: expected ETEXI, found $str" >&2
+ exit 1
+ fi
+ flag=1
+ ;;
+ ETEXI*)
+ if test $flag -ne 1 ; then
+ echo "line $line: syntax error: expected STEXI, found $str" >&2
+ exit 1
+ fi
+ flag=0
;;
DEFHEADING*)
echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
@@ -32,6 +45,7 @@ hxtotexi()
test $flag -eq 1 && echo "$str"
;;
esac
+ line=$((line+1))
done
}
--
1.6.0.2
next parent reply other threads:[~2010-05-20 8:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4BF4E1A9.9010405@web.de>
2010-05-20 7:16 ` Jan Kiszka [this message]
2010-05-22 9:27 ` [Qemu-devel] [PATCH 2/2] hxtool: Add syntax error detection Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BF4E1D1.1010507@web.de \
--to=jan.kiszka@web.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).