Skip to content

Commit 3042b52

Browse files
committed
1 parent e79549a commit 3042b52

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/main/c/yarp/src/prism.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6913,6 +6913,15 @@ typedef struct {
69136913
const uint8_t *cursor;
69146914
} pm_token_buffer_t;
69156915

6916+
static inline bool
6917+
pm_token_buffer_init(pm_token_buffer_t *token_buffer) {
6918+
if (!pm_buffer_init(&token_buffer->buffer)) {
6919+
return false;
6920+
}
6921+
token_buffer->cursor = NULL;
6922+
return true;
6923+
}
6924+
69166925
// Push the given byte into the token buffer.
69176926
static inline void
69186927
pm_token_buffer_push(pm_token_buffer_t *token_buffer, uint8_t byte) {
@@ -8213,7 +8222,8 @@ parser_lex(pm_parser_t *parser) {
82138222

82148223
// If we haven't found an escape yet, then this buffer will be
82158224
// unallocated since we can refer directly to the source string.
8216-
pm_token_buffer_t token_buffer = { 0 };
8225+
pm_token_buffer_t token_buffer;
8226+
pm_token_buffer_init(&token_buffer);
82178227

82188228
while (breakpoint != NULL) {
82198229
// If we hit a null byte, skip directly past it.
@@ -8389,7 +8399,8 @@ parser_lex(pm_parser_t *parser) {
83898399
// characters.
83908400
const uint8_t *breakpoints = lex_mode->as.regexp.breakpoints;
83918401
const uint8_t *breakpoint = pm_strpbrk(parser, parser->current.end, breakpoints, parser->end - parser->current.end);
8392-
pm_token_buffer_t token_buffer = { 0 };
8402+
pm_token_buffer_t token_buffer;
8403+
pm_token_buffer_init(&token_buffer);
83938404

83948405
while (breakpoint != NULL) {
83958406
// If we hit a null byte, skip directly past it.
@@ -8578,7 +8589,8 @@ parser_lex(pm_parser_t *parser) {
85788589

85798590
// If we haven't found an escape yet, then this buffer will be
85808591
// unallocated since we can refer directly to the source string.
8581-
pm_token_buffer_t token_buffer = { 0 };
8592+
pm_token_buffer_t token_buffer;
8593+
pm_token_buffer_init(&token_buffer);
85828594

85838595
while (breakpoint != NULL) {
85848596
// If we hit the incrementor, then we'll increment then nesting and
@@ -8839,7 +8851,8 @@ parser_lex(pm_parser_t *parser) {
88398851
}
88408852

88418853
const uint8_t *breakpoint = pm_strpbrk(parser, parser->current.end, breakpoints, parser->end - parser->current.end);
8842-
pm_token_buffer_t token_buffer = { 0 };
8854+
pm_token_buffer_t token_buffer;
8855+
pm_token_buffer_init(&token_buffer);
88438856
bool was_escaped_newline = false;
88448857

88458858
while (breakpoint != NULL) {

src/yarp/java/org/prism/ParseResult.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.prism;
22

3+
// @formatter:off
34
public final class ParseResult {
45

56
public enum CommentType {
@@ -67,3 +68,4 @@ public ParseResult(Nodes.Node value, Comment[] comments, MagicComment[] magicCom
6768
this.warnings = warnings;
6869
}
6970
}
71+
// @formatter:on

0 commit comments

Comments
 (0)