summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliquidaty <info@liquidaty.com>2023-07-09 22:22:20 -0700
committerMattias Wadman <mattias.wadman@gmail.com>2024-02-24 18:58:53 +0100
commit334d15c49d5c62137ef3f9da16b01092b6ee5c05 (patch)
tree4525ed73181ab39ece183dd19f3752b07a784347
parent8b479ca229665d26a2f192289388c12a5f749a24 (diff)
update scanner to, while scanning comments, return 0 instead of OK
-rw-r--r--src/jv_parse.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/jv_parse.c b/src/jv_parse.c
index 2f88181f..5f9375b0 100644
--- a/src/jv_parse.c
+++ b/src/jv_parse.c
@@ -649,7 +649,7 @@ static int stream_is_top_num(struct jv_parser* p) {
static pfunc scan_line_comment(struct jv_parser* p, char ch, jv* out) {
if(ch == '\n')
p->scan = scan_json;
- return OK;
+ return 0;
}
static pfunc scan_c_comment_close(struct jv_parser* p, char ch, jv* out) {
@@ -658,24 +658,24 @@ static pfunc scan_c_comment_close(struct jv_parser* p, char ch, jv* out) {
} else {
p->scan = scan_c_comment;
}
- return OK;
+ return 0;
}
static pfunc scan_c_comment(struct jv_parser* p, char ch, jv* out) {
if(ch == '*') {
p->scan = scan_c_comment_close;
}
- return OK;
+ return 0;
}
static pfunc scan_slash_comment(struct jv_parser* p, char ch, jv* out) {
if(ch == '/') {
p->scan = scan_line_comment;
- return OK;
+ return 0;
}
if(ch == '*') {
p->scan = scan_c_comment;
- return OK;
+ return 0;
}
return "Incomplete comment token; slash must be followed by another slash or asterisk";
}
@@ -704,7 +704,7 @@ static pfunc scan_json(struct jv_parser* p, char ch, jv* out) {
if (p->st == JV_PARSER_NORMAL) {
if(ch == '/' && (p->flags & JV_PARSE_STRIP_COMMENTS)) {
p->scan = scan_slash_comment;
- return OK;
+ return answer;
}
chclass cls = classify(ch);