10 more change sets for review

Jim Meyering jim at meyering.net
Wed Oct 20 10:17:20 UTC 2010


I've just pushed the following to the temporary branch named "cleanup":

      automatically generate man page
      qparser: remove dead code
      remove decls of unused variables
      mark unused parameters as such
      remove final "static" state variable from the parser
      mark more unused parameters
      simplify parser: T_NE
      simplify parser: T_EQ
      simplify parser: <, >, >=, <=
      query parser: avoid 25 reduce/reduce conflicts

While 10 c-sets may look like a lot, don't be put off.
Most of these are small and easy to review.

The only one that might be controversial is the last one,
since it changes the grammar to accept "$ a", treating it
like "$a", rather than rejecting it.  I think I could have preserved
the existing semantics, but that would have been a much more
invasive change, and I doubt it's worth the effort.

The man-page-generating one is almost identical to what I posted
yesterday.  The only change is the addition to the spec file
to handle the added file installed in $mandir.

The next remove warnings exposed by running the brand new "make rpm" rule.

The final four avoid the 25 reduce/reduce conflicts in the parser.
In most a reduce/reduce conflict is an error and/or easily avoided.
Here's the intro to that chapter in "info bison":

    A reduce/reduce conflict occurs if there are two or more rules that
    apply to the same sequence of input.  This usually indicates a serious
    error in the grammar.

>From af7f9208dcded36890f0fb9940439d38756c6155 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 19 Oct 2010 18:27:52 +0200
Subject: [PATCH 01/10] automatically generate man page

* configure.ac (AC_CONFIG_FILES): Add man/Makefile.
Check for help2man.
* Makefile.am (SUBDIRS): Add "." and man.
* man/Makefile.am: New file.
* .gitignore: Ignore new artifacts and anchor patterns.
* iwhd.spec.in (%files): Add man page file name.
---
 .gitignore      |   37 +++++++++++++++++++------------------
 Makefile.am     |    2 +-
 configure.ac    |    7 ++++++-
 iwhd.spec.in    |    1 +
 man/Makefile.am |   26 ++++++++++++++++++++++++++
 5 files changed, 53 insertions(+), 20 deletions(-)
 create mode 100644 man/Makefile.am

diff --git a/.gitignore b/.gitignore
index e85dc40..6fbf252 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,25 +2,26 @@
 *~
 .\#*
 .deps
+/aclocal.m4
+/autom4te.cache/
+/build-aux
+/config.h
+/config.hin
+/config.log
+/config.status
+/configure
+/iwhd
+/iwhd-*.tar.gz
+/iwhd-qparser.c
+/iwhd-qparser.h
+/iwhd.spec
+/man/iwhd.8
+/qlexer.c
+/stamp-h1
+/t/*.log
+/t/parser
+/t/parser.c
 ChangeLog
 Makefile
 Makefile.in
 \#*\#
-aclocal.m4
-autom4te.cache/
-build-aux
-config.h
-config.hin
-config.log
-config.status
-configure
-iwhd
-iwhd-*.tar.gz
-iwhd-qparser.c
-iwhd-qparser.h
-iwhd.spec
-qlexer.c
-stamp-h1
-t/*.log
-t/parser
-t/parser.c
diff --git a/Makefile.am b/Makefile.am
index 5510cf1..44ff506 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,7 +20,7 @@ AM_CPPFLAGS	= -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include

 iwhd_YFLAGS = -d

-SUBDIRS = t
+SUBDIRS = . t man
 ACLOCAL_AMFLAGS = -I ax

 # iwhd is short for Image WareHouse Daemon.
diff --git a/configure.ac b/configure.ac
index afbe4c3..78eb70b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@ AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_YACC
 AC_PROG_LEX
+AM_MISSING_PROG([HELP2MAN], [help2man])

 AC_CHECK_LIB([curl], [curl_easy_init],
 	[CURL_LIB=-lcurl],
@@ -88,5 +89,9 @@ AC_FUNC_MALLOC
 AC_FUNC_REALLOC
 AC_CHECK_FUNCS([gettimeofday memmove memset strcasecmp strdup strndup strtoul])

-AC_CONFIG_FILES([Makefile t/Makefile])
+AC_CONFIG_FILES([
+Makefile
+t/Makefile
+man/Makefile
+])
 AC_OUTPUT
diff --git a/iwhd.spec.in b/iwhd.spec.in
index 282370e..2b28b53 100644
--- a/iwhd.spec.in
+++ b/iwhd.spec.in
@@ -57,6 +57,7 @@ rm -rf %{buildroot}
 %defattr(-,root,root,-)
 %doc AUTHORS COPYING README NEWS
 %{_bindir}/iwhd
+%{_mandir}/man8/iwhd.8*

 %changelog
 * Wed Oct  7 2010 Jim Meyering <meyering at redhat.com> - 0.90-1
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..7399460
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,26 @@
+# Automakefile for GNU diffutils man pages
+
+# Copyright (C) 2002, 2009-2010 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+dist_man8_MANS = iwhd.8
+MAINTAINERCLEANFILES = $(dist_man8_MANS)
+
+# Depend on configure.ac to get version number changes.
+iwhd.8: $(top_srcdir)/configure.ac $(top_srcdir)/rest.c
+	$(AM_V_GEN) \
+	  (echo '[NAME]' && sed 's@/\* *@@; s/-/\\-/; q' $S/rest.c) | \
+	  $(HELP2MAN) -i - -S '$(PACKAGE) $(VERSION)' ../iwhd | \
+	  sed 's/^\.B info .*/.B info FIXME/' > $@-t && mv $@-t $@
-- 
1.7.3.1.216.g329be


>From cc4972ea5ad864db65cc69e8db34a6c8b4c19807 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 20 Oct 2010 09:13:39 +0200
Subject: [PATCH 02/10] qparser: remove dead code

* qparser.y (make_link): Remove now-useless test;
xmalloc never returns NULL.
---
 qparser.y |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/qparser.y b/qparser.y
index e5bd1ad..182926f 100644
--- a/qparser.y
+++ b/qparser.y
@@ -138,9 +138,6 @@ make_link (value_t *left, const char *right)

 	copy = xstrdup(right);
 	free ((void *) right);
-	if (!copy) {
-		return NULL;
-	}

 	return make_tree(T_LINK,left,(value_t *)copy);
 }
-- 
1.7.3.1.216.g329be


>From f1f8ba5a3338fe94c3adccae737b4d30d34fbb45 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 20 Oct 2010 09:25:33 +0200
Subject: [PATCH 03/10] remove decls of unused variables

---
 backend.c |   10 +++-------
 meta.cpp  |    3 ---
 replica.c |    1 -
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/backend.c b/backend.c
index 502ce14..8d3547c 100644
--- a/backend.c
+++ b/backend.c
@@ -868,7 +868,6 @@ cf_add_token (struct curl_slist *in_slist, const char *token)
 {
 	int		 	chars;
 	char		 	auth_hdr[HEADER_SIZE];
-	struct curl_slist	*out_slist;

 	if (!token) {
 		return in_slist;
@@ -887,10 +886,9 @@ static void
 cf_init (provider_t *prov)
 {
 	CURL			*curl;
-	char	 		 addr[ADDR_SIZE];
-	char	 		 auth_user[HEADER_SIZE];
-	char	 		 auth_key[HEADER_SIZE];
-	char			*token;
+	char			 addr[ADDR_SIZE];
+	char			 auth_user[HEADER_SIZE];
+	char			 auth_key[HEADER_SIZE];
 	struct curl_slist	*slist;
 	int			 chars;

@@ -1084,8 +1082,6 @@ cf_bcreate (const provider_t *prov, const char *bucket)
 {
 	char			 fixed[1024];
 	CURL			*curl;
-	int		 	 chars;
-	char		 	 auth_hdr[HEADER_SIZE];
 	long			 rc;
 	struct curl_slist	*slist	= NULL;

diff --git a/meta.cpp b/meta.cpp
index de9dfa2..d467c1e 100644
--- a/meta.cpp
+++ b/meta.cpp
@@ -644,10 +644,7 @@ RepoMeta::GetAttrList (const char *bucket, const char *key)
 {
 	auto_ptr<DBClientCursor>	curs;
 	Query				q;
-	AttrList *			poc;
 	BSONObj				bo;
-	const char *			name;
-	const char *			value;

 	q = QUERY("bucket"<<bucket<<"key"<<key);
 	curs = GetCursor(q);
diff --git a/replica.c b/replica.c
index 4376d0a..9487c33 100644
--- a/replica.c
+++ b/replica.c
@@ -93,7 +93,6 @@ proxy_repl_cons (void *ctx)
 	repl_item		*item	= ctx;
 	my_state		*ms	= item->ms;
 	pipe_private		*pp;
-	void			*rc;

 	pp = pipe_init_private(&ms->pipe);
 	if (!pp) {
-- 
1.7.3.1.216.g329be


>From a573c2d19dfd41e6dc3af8e2f5f6f3df6cf48cff Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 20 Oct 2010 10:20:33 +0200
Subject: [PATCH 04/10] mark unused parameters as such

---
 backend.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/backend.c b/backend.c
index 8d3547c..6795ef9 100644
--- a/backend.c
+++ b/backend.c
@@ -1035,13 +1035,13 @@ cf_put_child (void * ctx)
 }

 static int
-cf_delete (const provider_t *prov, const char *bucket, const char *key,
-	     const char *url)
+cf_delete (const provider_t *prov,
+	   const char *bucket ATTRIBUTE_UNUSED,
+	   const char *key ATTRIBUTE_UNUSED,
+	   const char *url)
 {
 	CURL			*curl;
 	char			 fixed[1024];
-	int		 	 chars;
-	char		 	 auth_hdr[HEADER_SIZE];
 	long			 rc;
 	struct curl_slist	*slist	= NULL;

@@ -1072,7 +1072,10 @@ cf_delete (const provider_t *prov, const char *bucket, const char *key,
 }

 static size_t
-cf_null_reader (void *ptr, size_t size, size_t nmemb, void *stream)
+cf_null_reader (void *ptr ATTRIBUTE_UNUSED,
+		size_t size ATTRIBUTE_UNUSED,
+		size_t nmemb ATTRIBUTE_UNUSED,
+		void *stream ATTRIBUTE_UNUSED)
 {
 	return 0;
 }
-- 
1.7.3.1.216.g329be


>From 601d9ff306989b4c9e79aa81bd07af712d2ff0bb Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 20 Oct 2010 09:43:03 +0200
Subject: [PATCH 05/10] remove final "static" state variable from the parser

* qparser.y: Remove "syntax_error" decl.
(yyerror): Adjust.  Make this function static, too.
<policy>: Adjust the sole rule that used it.
---
 qparser.y |   24 ++++--------------------
 1 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/qparser.y b/qparser.y
index 182926f..3455c42 100644
--- a/qparser.y
+++ b/qparser.y
@@ -19,6 +19,8 @@
 #include <string.h>
 #include <ctype.h>

+#include "iwh.h"
+
 #define YY_DECL int yylex(YYSTYPE *, void *scanner);
 YY_DECL

@@ -142,22 +144,9 @@ make_link (value_t *left, const char *right)
 	return make_tree(T_LINK,left,(value_t *)copy);
 }

-/*
- * IMO it's wrong for us to get into the bbool_expr=policy rule when there's
- * a syntax error, but we do.  The good news is that it's easy to free the
- * erroneous tree properly this way.  The bad news is that we need to wait
- * until yyparse is done, then check this flag (which we have to maintain
- * ourselves) to figure out whether we got a valid tree or not.
- * No, yynerrs doesn't seem to give the right answer.
- */
-static int syntax_error = 0;
-
-void
+static void
 yyerror (void *scanner, value_t **result, const char *msg)
 {
-  // error (0, 0, "parse error: %s\n", msg);
-  // FIXME do this via param, not file-global
-  syntax_error = 1;
 }

 %}
@@ -178,12 +167,7 @@ yyerror (void *scanner, value_t **result, const char *msg)

 policy:
 	bbool_expr {
-		if (syntax_error) {
-			printf("bad policy!\n");
-		}
-		else {
-			*result = $1;
-		}
+		*result = $1;
 	};

 bbool_expr:
-- 
1.7.3.1.216.g329be


>From f8f366e1a856be5e95f8bb8ace348865e4ff735b Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 20 Oct 2010 11:14:53 +0200
Subject: [PATCH 06/10] mark more unused parameters

---
 qparser.y |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/qparser.y b/qparser.y
index 3455c42..0ff2e7b 100644
--- a/qparser.y
+++ b/qparser.y
@@ -145,8 +145,11 @@ make_link (value_t *left, const char *right)
 }

 static void
-yyerror (void *scanner, value_t **result, const char *msg)
+yyerror (void *scanner ATTRIBUTE_UNUSED,
+	 value_t **result ATTRIBUTE_UNUSED,
+	 const char *msg ATTRIBUTE_UNUSED)
 {
+	/* empty */
 }

 %}
-- 
1.7.3.1.216.g329be


>From a8d1ea65e6d513e25f148c2dda2b9a41901dfe41 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 20 Oct 2010 11:32:59 +0200
Subject: [PATCH 07/10] simplify parser: T_NE

---
 qlexer.l  |    1 +
 qparser.y |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/qlexer.l b/qlexer.l
index 5f354df..5d0e488 100644
--- a/qlexer.l
+++ b/qlexer.l
@@ -26,6 +26,7 @@
 [a-z_]+		{ yylval_param->str = strdup(yytext);
 		  return yylval_param->str ? T_ID : T_INVALID; }
 [=$#()<>.]	{ return yytext[0]; }
+!=		{ return T_NE; }
 !		{ return T_NOT; }
 &&		{ return T_AND; }
 \|\|		{ return T_OR; }
diff --git a/qparser.y b/qparser.y
index 0ff2e7b..9b9efce 100644
--- a/qparser.y
+++ b/qparser.y
@@ -159,7 +159,7 @@ yyerror (void *scanner ATTRIBUTE_UNUSED,
 %parse-param { value_t **result }

 %token <str> T_STRING T_COMP T_DATE T_ID T_LINK T_NUMBER T_OFIELD T_SFIELD
-%token T_NOT T_AND T_OR T_SPACE T_INVALID
+%token T_NE T_NOT T_AND T_OR T_SPACE T_INVALID

 %type <val> atom bbool_expr comp_expr field
 %type <val> link_field literal paren_expr ubool_expr
@@ -225,9 +225,9 @@ comp_expr:
 		// printf("found EQUAL expression\n");
 		$$ = make_comp(C_EQUAL,$1,$4);
 	}|
-	atom T_NOT '=' atom {
+	atom T_NE atom {
 		// printf("found NOT EQUAL expression\n");
-		$$ = make_comp(C_DIFFERENT,$1,$4);
+		$$ = make_comp(C_DIFFERENT,$1,$3);
 	}|
 	atom '>' '=' atom {
 		// printf("found GREATER OR EQUAL expression\n");
-- 
1.7.3.1.216.g329be


>From 37e06749f1331723d5a9c7e99c9ffe812be5743a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 20 Oct 2010 11:34:00 +0200
Subject: [PATCH 08/10] simplify parser: T_EQ

---
 qlexer.l  |    1 +
 qparser.y |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/qlexer.l b/qlexer.l
index 5d0e488..6bb82f4 100644
--- a/qlexer.l
+++ b/qlexer.l
@@ -26,6 +26,7 @@
 [a-z_]+		{ yylval_param->str = strdup(yytext);
 		  return yylval_param->str ? T_ID : T_INVALID; }
 [=$#()<>.]	{ return yytext[0]; }
+==		{ return T_EQ; }
 !=		{ return T_NE; }
 !		{ return T_NOT; }
 &&		{ return T_AND; }
diff --git a/qparser.y b/qparser.y
index 9b9efce..abd0d15 100644
--- a/qparser.y
+++ b/qparser.y
@@ -159,7 +159,7 @@ yyerror (void *scanner ATTRIBUTE_UNUSED,
 %parse-param { value_t **result }

 %token <str> T_STRING T_COMP T_DATE T_ID T_LINK T_NUMBER T_OFIELD T_SFIELD
-%token T_NE T_NOT T_AND T_OR T_SPACE T_INVALID
+%token T_EQ T_NE T_NOT T_AND T_OR T_SPACE T_INVALID

 %type <val> atom bbool_expr comp_expr field
 %type <val> link_field literal paren_expr ubool_expr
@@ -221,9 +221,9 @@ comp_expr:
 		// printf("found LESS OR EQUAL expression\n");
 		$$ = make_comp(C_LESSOREQ,$1,$4);
 	}|
-	atom '=' '=' atom {
+	atom T_EQ atom {
 		// printf("found EQUAL expression\n");
-		$$ = make_comp(C_EQUAL,$1,$4);
+		$$ = make_comp(C_EQUAL,$1,$3);
 	}|
 	atom T_NE atom {
 		// printf("found NOT EQUAL expression\n");
-- 
1.7.3.1.216.g329be


>From 9bf769abd180bc4502457371840830694997a0c5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 20 Oct 2010 11:37:18 +0200
Subject: [PATCH 09/10] simplify parser: <, >, >=, <=

---
 qlexer.l  |    6 +++++-
 qparser.y |   13 +++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/qlexer.l b/qlexer.l
index 6bb82f4..59c6fb1 100644
--- a/qlexer.l
+++ b/qlexer.l
@@ -25,7 +25,11 @@
 		  return yylval_param->str ? T_NUMBER : T_INVALID; }
 [a-z_]+		{ yylval_param->str = strdup(yytext);
 		  return yylval_param->str ? T_ID : T_INVALID; }
-[=$#()<>.]	{ return yytext[0]; }
+[$#().]		{ return yytext[0]; }
+[<]		{ return T_LT; }
+[<]=		{ return T_LE; }
+>		{ return T_GT; }
+>=		{ return T_GE; }
 ==		{ return T_EQ; }
 !=		{ return T_NE; }
 !		{ return T_NOT; }
diff --git a/qparser.y b/qparser.y
index abd0d15..961ccbc 100644
--- a/qparser.y
+++ b/qparser.y
@@ -160,6 +160,7 @@ yyerror (void *scanner ATTRIBUTE_UNUSED,

 %token <str> T_STRING T_COMP T_DATE T_ID T_LINK T_NUMBER T_OFIELD T_SFIELD
 %token T_EQ T_NE T_NOT T_AND T_OR T_SPACE T_INVALID
+%token T_LT T_GT T_LE T_GE

 %type <val> atom bbool_expr comp_expr field
 %type <val> link_field literal paren_expr ubool_expr
@@ -213,13 +214,13 @@ comp_expr:
 		// printf("promoting atom to comp_expr\n");
 		$$ = $1;
 	}|
-	atom '<' atom {
+	atom T_LT atom {
 		// printf("found LESS THAN expression\n");
 		$$ = make_comp(C_LESSTHAN,$1,$3);
 	}|
-	atom '<' '=' atom {
+	atom T_LE atom {
 		// printf("found LESS OR EQUAL expression\n");
-		$$ = make_comp(C_LESSOREQ,$1,$4);
+		$$ = make_comp(C_LESSOREQ,$1,$3);
 	}|
 	atom T_EQ atom {
 		// printf("found EQUAL expression\n");
@@ -229,11 +230,11 @@ comp_expr:
 		// printf("found NOT EQUAL expression\n");
 		$$ = make_comp(C_DIFFERENT,$1,$3);
 	}|
-	atom '>' '=' atom {
+	atom T_GE atom {
 		// printf("found GREATER OR EQUAL expression\n");
-		$$ = make_comp(C_GREATEROREQ,$1,$4);
+		$$ = make_comp(C_GREATEROREQ,$1,$3);
 	}|
-	atom '>' atom {
+	atom T_GT atom {
 		// printf("found GREATER THAN expression\n");
 		$$ = make_comp(C_GREATERTHAN,$1,$3);
 	}|
-- 
1.7.3.1.216.g329be


>From 579fbe2eb103e80401fcaaaebebc9060fa2517b5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 20 Oct 2010 12:03:30 +0200
Subject: [PATCH 10/10] query parser: avoid 25 reduce/reduce conflicts

* qparser.y (T_SPACE): Remove token and all related rules.
* qlexer.l: Ignore white space rather than returning T_SPACE.
* t/parser-test: Adjust sole failing test: "$ a" was rejected before,
due to ignored white space; now it's interpreted as "$a".
Add one more: "$.a" that does still fail.
---
 qlexer.l      |    2 +-
 qparser.y     |   22 +---------------------
 t/parser-test |    8 ++++++--
 3 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/qlexer.l b/qlexer.l
index 59c6fb1..976939b 100644
--- a/qlexer.l
+++ b/qlexer.l
@@ -35,7 +35,7 @@
 !		{ return T_NOT; }
 &&		{ return T_AND; }
 \|\|		{ return T_OR; }
-[ \t\n\r]+	{ return T_SPACE; }
+[ \t\n\r]+	{ }
 .		{ return T_INVALID; }

 <<EOF>>		{ yyterminate (); /* aka return 0; */ }
diff --git a/qparser.y b/qparser.y
index 961ccbc..07f0501 100644
--- a/qparser.y
+++ b/qparser.y
@@ -159,7 +159,7 @@ yyerror (void *scanner ATTRIBUTE_UNUSED,
 %parse-param { value_t **result }

 %token <str> T_STRING T_COMP T_DATE T_ID T_LINK T_NUMBER T_OFIELD T_SFIELD
-%token T_EQ T_NE T_NOT T_AND T_OR T_SPACE T_INVALID
+%token T_EQ T_NE T_NOT T_AND T_OR T_INVALID
 %token T_LT T_GT T_LE T_GE

 %type <val> atom bbool_expr comp_expr field
@@ -186,11 +186,6 @@ bbool_expr:
 	bbool_expr T_OR ubool_expr {
 		// printf("found OR expression\n");
 		$$ = make_tree(T_OR,$1,$3);
-	}|
-	bbool_expr T_SPACE {
-		$$ = $1;
-	}| T_SPACE bbool_expr {
-		$$ = $2;
 	};

 ubool_expr:
@@ -201,11 +196,6 @@ ubool_expr:
 	T_NOT comp_expr {
 		// printf("found NOT expression\n");
 		$$ = make_tree(T_NOT,$2,NULL);
-	}|
-	ubool_expr T_SPACE {
-		$$ = $1;
-	}| T_SPACE ubool_expr {
-		$$ = $2;
 	};


@@ -237,11 +227,6 @@ comp_expr:
 	atom T_GT atom {
 		// printf("found GREATER THAN expression\n");
 		$$ = make_comp(C_GREATERTHAN,$1,$3);
-	}|
-	comp_expr T_SPACE {
-		$$ = $1;
-	}| T_SPACE comp_expr {
-		$$ = $2;
 	};

 atom:
@@ -256,11 +241,6 @@ atom:
 	paren_expr {
 		// printf("promoting paren_expr to atom\n");
 		$$ = $1;
-	}|
-	atom T_SPACE {
-		$$ = $1;
-	}| T_SPACE atom {
-		$$ = $2;
 	};

 link_field:
diff --git a/t/parser-test b/t/parser-test
index cf006c6..0daead1 100755
--- a/t/parser-test
+++ b/t/parser-test
@@ -27,8 +27,12 @@ parser '#a == "fubar" && ! ( $b.c.d < 3)' > white-space 2> err || fail=1
 compare white-space f.exp || fail=1
 compare /dev/null err || fail=1

-parser '$ a' > e1.out 2>&1; test $? = 1 || fail=1
-printf "could not parse '$ a'\n" > e1.exp
+parser '$ a' > a.out 2>&1 || fail=1
+printf "OBJECT FIELD a (2)\ns= 2\n" > a.exp
+compare a.out a.exp || fail=1
+
+parser '$.a' > e1.out 2>&1; test $? = 1 || fail=1
+printf "could not parse '$.a'\n" > e1.exp
 compare e1.exp e1.out || fail=1

 parser '1 = = 1' > e2.out 2>&1; test $? = 1 || fail=1
-- 
1.7.3.1.216.g329be


More information about the iwhd-devel mailing list