kconfig: allow use of relations other than (in)equality
[carl9170fw.git] / config / zconf.l
index a2b289519df6139ca2f029e50dba256d2f3b57b3..020c099a3a6568190a5584db7245e8f53a1f3760 100644 (file)
@@ -27,8 +27,8 @@ static char *text;
 static int text_size, text_asize;
 
 struct buffer {
-        struct buffer *parent;
-        YY_BUFFER_STATE state;
+       struct buffer *parent;
+       YY_BUFFER_STATE state;
 };
 
 struct buffer *current_buf;
@@ -40,7 +40,7 @@ static void zconf_endfile(void);
 
 static void new_string(void)
 {
-       text = malloc(START_STRSIZE);
+       text = xmalloc(START_STRSIZE);
        text_asize = START_STRSIZE;
        text_size = 0;
        *text = 0;
@@ -62,13 +62,12 @@ static void append_string(const char *str, int size)
 
 static void alloc_string(const char *str, int size)
 {
-       text = malloc(size + 1);
+       text = xmalloc(size + 1);
        memcpy(text, str, size);
        text[size] = 0;
 }
 %}
 
-ws     [ \n\t]
 n      [A-Za-z0-9_]
 
 %%
@@ -123,6 +122,10 @@ n  [A-Za-z0-9_]
        "!"     return T_NOT;
        "="     return T_EQUAL;
        "!="    return T_UNEQUAL;
+       "<="    return T_LESS_EQUAL;
+       ">="    return T_GREATER_EQUAL;
+       "<"     return T_LESS;
+       ">"     return T_GREATER;
        \"|\'   {
                str = yytext[0];
                new_string();
@@ -142,7 +145,12 @@ n  [A-Za-z0-9_]
        }
        #.*     /* comment */
        \\\n    current_file->lineno++;
-       .
+       [[:blank:]]+
+       .       {
+               fprintf(stderr,
+                       "%s:%d:warning: ignoring unsupported character '%c'\n",
+                       zconf_curname(), zconf_lineno(), *yytext);
+       }
        <<EOF>> {
                BEGIN(INITIAL);
        }
@@ -288,7 +296,7 @@ void zconf_initscan(const char *name)
                exit(1);
        }
 
-       current_buf = malloc(sizeof(*current_buf));
+       current_buf = xmalloc(sizeof(*current_buf));
        memset(current_buf, 0, sizeof(*current_buf));
 
        current_file = file_lookup(name);
@@ -299,7 +307,7 @@ void zconf_nextfile(const char *name)
 {
        struct file *iter;
        struct file *file = file_lookup(name);
-       struct buffer *buf = malloc(sizeof(*buf));
+       struct buffer *buf = xmalloc(sizeof(*buf));
        memset(buf, 0, sizeof(*buf));
 
        current_buf->state = YY_CURRENT_BUFFER;