Code

Merged branch 'master' of git://git.tokkee.org/sysdb.
authorSebastian Harl <sh@tokkee.org>
Sun, 27 Jul 2014 17:09:01 +0000 (19:09 +0200)
committerSebastian Harl <sh@tokkee.org>
Sun, 27 Jul 2014 17:09:01 +0000 (19:09 +0200)
Conflicts:
src/frontend/grammar.y

1  2 
src/frontend/grammar.y

diff --combined src/frontend/grammar.y
index 74e28dd837f7e8eb7a819e1a0a4ed2ebda032ffb,a607ee0aba96bd0698147b81e0d441ab55182451..e0d8e7ecc46136b01cb84546ba1d3e11d7fb9e2b
@@@ -81,7 -81,7 +81,7 @@@ sdb_fe_yyerror(YYLTYPE *lval, sdb_fe_yy
  
  %token SCANNER_ERROR
  
 -%token AND OR IS NOT WHERE
 +%token AND OR IS NOT MATCHING
  %token CMP_EQUAL CMP_NEQUAL CMP_REGEX CMP_NREGEX
  %token CMP_LT CMP_LE CMP_GE CMP_GT
  
        fetch_statement
        list_statement
        lookup_statement
-       expression
+       condition
  
  %type <m> matcher
        compare_matcher
@@@ -131,7 -131,7 +131,7 @@@ statements
                        if (parser_mode != SDB_PARSE_DEFAULT) {
                                sdb_fe_yyerror(&yylloc, scanner,
                                                YY_("syntax error, unexpected statement, "
-                                                       "expecting expression"));
+                                                       "expecting condition"));
                                sdb_object_deref(SDB_OBJ($3));
                                YYABORT;
                        }
                        if (parser_mode != SDB_PARSE_DEFAULT) {
                                sdb_fe_yyerror(&yylloc, scanner,
                                                YY_("syntax error, unexpected statement, "
-                                                       "expecting expression"));
+                                                       "expecting condition"));
                                sdb_object_deref(SDB_OBJ($1));
                                YYABORT;
                        }
                        }
                }
        |
-       expression
+       condition
                {
-                       /* only accept this in expression parse mode */
-                       if (! (parser_mode & SDB_PARSE_EXPR)) {
+                       /* only accept this in condition parse mode */
+                       if (! (parser_mode & SDB_PARSE_COND)) {
                                sdb_fe_yyerror(&yylloc, scanner,
-                                               YY_("syntax error, unexpected expression, "
+                                               YY_("syntax error, unexpected condition, "
                                                        "expecting statement"));
                                sdb_object_deref(SDB_OBJ($1));
                                YYABORT;
@@@ -221,12 -221,12 +221,12 @@@ list_statement
        ;
  
  /*
-  * LOOKUP <type> MATCHING <expression>;
 - * LOOKUP <type> WHERE <condition>;
++ * LOOKUP <type> MATCHING <condition>;
   *
-  * Returns detailed information about <type> matching expression.
+  * Returns detailed information about <type> matching condition.
   */
  lookup_statement:
-       LOOKUP IDENTIFIER MATCHING expression
 -      LOOKUP IDENTIFIER WHERE condition
++      LOOKUP IDENTIFIER MATCHING condition
                {
                        /* TODO: support other types as well */
                        if (strcasecmp($2, "hosts")) {
                }
        ;
  
expression:
condition:
        matcher
                {
                        if (! $1) {
                                /* TODO: improve error reporting */
                                sdb_fe_yyerror(&yylloc, scanner,
-                                               YY_("syntax error, invalid expression"));
+                                               YY_("syntax error, invalid condition"));
                                YYABORT;
                        }