summaryrefslogtreecommitdiffstats
path: root/discover/grub2
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-09-24 13:55:57 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-09-24 13:55:57 +0800
commit07fe1662d2a49f4e9e3c5b0451d141f69328262d (patch)
tree24c63eee2a56691229946ae5e3cad697786cb02a /discover/grub2
parent6e14e1404f36f7706016531e4e19e5e6025a846a (diff)
downloadtalos-petitboot-07fe1662d2a49f4e9e3c5b0451d141f69328262d.tar.gz
talos-petitboot-07fe1662d2a49f4e9e3c5b0451d141f69328262d.zip
discover/grub2: Allow both delimiters and EOLs after a "then" reserved word
Putting an if-statement on one line should be possible: if true; then echo "true"; else echo "false"; fi To do this, we'll need to allow both EOLs and TOKEN_DELIM after then and else. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/grub2')
-rw-r--r--discover/grub2/parser.y6
1 files changed, 4 insertions, 2 deletions
diff --git a/discover/grub2/parser.y b/discover/grub2/parser.y
index 6d3ff21..02ca7b2 100644
--- a/discover/grub2/parser.y
+++ b/discover/grub2/parser.y
@@ -84,7 +84,9 @@ statements: /* empty */ {
$$ = $1;
}
-conditional: statement TOKEN_EOL "then" TOKEN_EOL statements {
+sep: TOKEN_DELIM | TOKEN_EOL;
+
+conditional: statement TOKEN_EOL "then" sep statements {
$$ = create_statement_conditional(parser, $1, $5);
}
@@ -112,7 +114,7 @@ statement:
}
| "if" TOKEN_DELIM conditional
elifs
- "else" TOKEN_EOL
+ "else" sep
statements
"fi" {
$$ = create_statement_if(parser, $3, $4, $7);
OpenPOWER on IntegriCloud