* [Qemu-devel] [PATCH 2/2] hxtool: Add syntax error detection
[not found] <4BF4E1A9.9010405@web.de>
@ 2010-05-20 7:16 ` Jan Kiszka
2010-05-22 9:27 ` Blue Swirl
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2010-05-20 7:16 UTC (permalink / raw)
To: qemu-devel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] hxtool: Add syntax error detection
2010-05-20 7:16 ` [Qemu-devel] [PATCH 2/2] hxtool: Add syntax error detection Jan Kiszka
@ 2010-05-22 9:27 ` Blue Swirl
0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2010-05-22 9:27 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel
Thanks, applied.
On Thu, May 20, 2010 at 7:16 AM, Jan Kiszka <jan.kiszka@web.de> wrote:
> 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
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-22 9:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4BF4E1A9.9010405@web.de>
2010-05-20 7:16 ` [Qemu-devel] [PATCH 2/2] hxtool: Add syntax error detection Jan Kiszka
2010-05-22 9:27 ` Blue Swirl
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).