mirror of
https://github.com/janet-lang/janet
synced 2025-01-27 07:34:44 +00:00
Update changelog and make arg to peg's error optional.
This commit is contained in:
parent
776ce586bc
commit
d76f671d37
@ -2,6 +2,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## Unreleased - ???
|
## Unreleased - ???
|
||||||
|
- Backtick delimited strings and buffers are now reindented based on the column of the
|
||||||
|
opening delimiter. WHitespace in columns to the left of the starting column is ignored unless
|
||||||
|
there are non-space/non-newline characters in that region, in which case the old behavior is preserved.
|
||||||
|
- Argument to `(error)` combinator in PEGs is now optional.
|
||||||
|
- Add `(line)` and `(column)` combinators to PEGs to capture source line and column.
|
||||||
|
This should make error reporting a bit easier.
|
||||||
- During installation and release, merge janetconf.h into janet.h for easier install.
|
- During installation and release, merge janetconf.h into janet.h for easier install.
|
||||||
- Add `upscope` special form.
|
- Add `upscope` special form.
|
||||||
- `os/execute` and `os/spawn` can take streams for redirecting IO.
|
- `os/execute` and `os/spawn` can take streams for redirecting IO.
|
||||||
|
@ -488,8 +488,9 @@ tail:
|
|||||||
} else {
|
} else {
|
||||||
/* Throw generic error */
|
/* Throw generic error */
|
||||||
int32_t start = (int32_t)(text - s->text_start);
|
int32_t start = (int32_t)(text - s->text_start);
|
||||||
|
LineCol lc = get_linecol_from_position(s, start);
|
||||||
int32_t end = (int32_t)(result - s->text_start);
|
int32_t end = (int32_t)(result - s->text_start);
|
||||||
janet_panicf("match error in range (%d:%d)", start, end);
|
janet_panicf("match error at line %d, column %d", lc.line, lc.col);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -898,8 +899,14 @@ static void spec_not(Builder *b, int32_t argc, const Janet *argv) {
|
|||||||
spec_onerule(b, argc, argv, RULE_NOT);
|
spec_onerule(b, argc, argv, RULE_NOT);
|
||||||
}
|
}
|
||||||
static void spec_error(Builder *b, int32_t argc, const Janet *argv) {
|
static void spec_error(Builder *b, int32_t argc, const Janet *argv) {
|
||||||
|
if (argc == 0) {
|
||||||
|
Reserve r = reserve(b, 2);
|
||||||
|
uint32_t rule = peg_compile1(b, janet_wrap_number(0));
|
||||||
|
emit_1(r, RULE_ERROR, rule);
|
||||||
|
} else {
|
||||||
spec_onerule(b, argc, argv, RULE_ERROR);
|
spec_onerule(b, argc, argv, RULE_ERROR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
static void spec_drop(Builder *b, int32_t argc, const Janet *argv) {
|
static void spec_drop(Builder *b, int32_t argc, const Janet *argv) {
|
||||||
spec_onerule(b, argc, argv, RULE_DROP);
|
spec_onerule(b, argc, argv, RULE_DROP);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user