]> git.ozlabs.org Git - petitboot/blobdiff - discover/grub2/lexer.l
discover/grub2: Add linux16 command
[petitboot] / discover / grub2 / lexer.l
index ab26f4be2e1b465e5522d02299b3703ef3465e5e..aca474af3e96e286deed352230d557e3d246d808 100644 (file)
@@ -6,11 +6,13 @@
 %}
 
 %option nounput noinput
+%option batch never-interactive
 %option warn
 %option noyywrap
 %option stack noyy_top_state
 %option reentrant
 %option bison-bridge
+%option yylineno
 %option noyyalloc noyyfree noyyrealloc
 %option extra-type="struct grub2_parser *"
 %option header-file="lexer.h"
@@ -19,7 +21,7 @@
 %x sqstring
 %x dqstring
 
-WORD   [^{}|&$;<> \t\n'"]+
+WORD   [^{}|&$;<> \t\n'"#]+
 VARNAME ([[:alpha:]][_[:alnum:]]*|[0-9]|[\?@\*#])
 
 %%
@@ -36,6 +38,7 @@ VARNAME ([[:alpha:]][_[:alnum:]]*|[0-9]|[\?@\*#])
 "do"         return TOKEN_DO;
 "done"       return TOKEN_DONE;
 "elif"       return TOKEN_ELIF;
+"else"       return TOKEN_ELSE;
 "esac"       return TOKEN_ESAC;
 "fi"         return TOKEN_FI;
 "for"        return TOKEN_FOR;
@@ -44,6 +47,7 @@ VARNAME ([[:alpha:]][_[:alnum:]]*|[0-9]|[\?@\*#])
 "in"         return TOKEN_IN;
 "menuentry"  return TOKEN_MENUENTRY;
 "select"     return TOKEN_SELECT;
+"submenu"    return TOKEN_SUBMENU;
 "then"       return TOKEN_THEN;
 "time"       return TOKEN_TIME;
 "until"      return TOKEN_UTIL;
@@ -112,8 +116,7 @@ VARNAME ([[:alpha:]][_[:alnum:]]*|[0-9]|[\?@\*#])
 [ \t]*(;|\n)[ \t]*     return TOKEN_EOL;
 
  /* strip comments */
-#.*$   ;
-
+#.*    ;
 
 .      printf("unknown token '%s'\n", yytext); exit(1);