aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-05-20 23:00:43 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-05-21 13:19:47 +0200
commit7e8bfbf9b952915f9c1c4bb58081b45620714e3f (patch)
tree0970febae5bd17f1f8610feae03361fbcb1e415e
parent5307d24315760121756871e9b82f08a4263e4be7 (diff)
downloadell-7e8bfbf9b952915f9c1c4bb58081b45620714e3f.tar.gz
ell-7e8bfbf9b952915f9c1c4bb58081b45620714e3f.tar.xz
ell-7e8bfbf9b952915f9c1c4bb58081b45620714e3f.zip
Make ; a synonym for a newline
-rwxr-xr-xell.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ell.c b/ell.c
index e245958..0e6b550 100755
--- a/ell.c
+++ b/ell.c
@@ -247,7 +247,7 @@ lexer_free (struct lexer *self) {
static bool lexer_is_ignored (int c) { return strchr (" \t", c); }
static bool lexer_is_word_char (int c) {
- return !lexer_is_ignored (c) && !strchr ("()[]{}\n@#'", c);
+ return !lexer_is_ignored (c) && !strchr ("()[]{}\n;@#'", c);
}
static int
@@ -354,6 +354,7 @@ lexer_next (struct lexer *self, const char **e) {
case '{': lexer_advance (self); return T_LBRACE;
case '}': lexer_advance (self); return T_RBRACE;
case '\n': lexer_advance (self); return T_NEWLINE;
+ case ';': lexer_advance (self); return T_NEWLINE;
case '@': lexer_advance (self); return T_AT;
case '#':
@@ -1065,9 +1066,8 @@ init_runtime_library (struct context *ctx) {
const char *definition; ///< The defining script
} functions[] = {
// TODO: try to think of something useful
- // XXX: should we add a ';' token to substitute newlines?
// FIXME: this "unless" is probably not going to work
- { "unless", "arg cond body\nif (not (eval @cond)) @body" },
+ { "unless", "arg cond body; if (not (eval @cond)) @body" },
};
for (size_t i = 0; i < N_ELEMENTS (functions); i++) {