summaryrefslogtreecommitdiff
path: root/upb/json/parser.rl
diff options
context:
space:
mode:
Diffstat (limited to 'upb/json/parser.rl')
-rw-r--r--upb/json/parser.rl22
1 files changed, 13 insertions, 9 deletions
diff --git a/upb/json/parser.rl b/upb/json/parser.rl
index f5e1634..92a1566 100644
--- a/upb/json/parser.rl
+++ b/upb/json/parser.rl
@@ -46,13 +46,13 @@ static upb_selector_t getsel(upb_json_parser *p) {
p, upb_handlers_getprimitivehandlertype(p->top->f));
}
-static void start_member(upb_json_parser *p, const char *ptr) {
+static void start_member(upb_json_parser *p) {
assert(!p->top->f);
assert(!p->accumulated);
p->accumulated_len = 0;
}
-static bool end_member(upb_json_parser *p, const char *ptr) {
+static bool end_member(upb_json_parser *p) {
// TODO(haberman): support keys that span buffers or have escape sequences.
assert(!p->top->f);
assert(p->accumulated);
@@ -305,7 +305,7 @@ static bool end_text(upb_json_parser *p, const char *ptr) {
return true;
}
-static bool start_stringval(upb_json_parser *p, const char *ptr) {
+static bool start_stringval(upb_json_parser *p) {
assert(p->top->f);
if (!upb_fielddef_isstring(p->top->f)) {
@@ -327,7 +327,7 @@ static bool start_stringval(upb_json_parser *p, const char *ptr) {
return true;
}
-static void end_stringval(upb_json_parser *p, const char *ptr) {
+static void end_stringval(upb_json_parser *p) {
p->top--;
upb_selector_t sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR);
upb_sink_endstr(&p->top->sink, sel);
@@ -439,7 +439,7 @@ static void start_hex(upb_json_parser *p, const char *ptr) {
static void hex(upb_json_parser *p, const char *end) {
const char *start = p->text_begin;
- assert(end - start == 4);
+ UPB_ASSERT_VAR(end, end - start == 4);
uint16_t codepoint =
(hexdigit(start[0]) << 12) |
(hexdigit(start[1]) << 8) |
@@ -516,8 +516,8 @@ static void hex(upb_json_parser *p, const char *end) {
member =
ws
string
- >{ start_member(parser, p); }
- %{ CHECK_RETURN_TOP(end_member(parser, p)); }
+ >{ start_member(parser); }
+ %{ CHECK_RETURN_TOP(end_member(parser)); }
ws ":" ws
value2
%{ clear_member(parser); }
@@ -547,8 +547,8 @@ static void hex(upb_json_parser *p, const char *end) {
>{ start_number(parser, p); }
%{ end_number(parser, p); }
| string
- >{ CHECK_RETURN_TOP(start_stringval(parser, p)); }
- %{ end_stringval(parser, p); }
+ >{ CHECK_RETURN_TOP(start_stringval(parser)); }
+ %{ end_stringval(parser); }
| "true"
%{ CHECK_RETURN_TOP(putbool(parser, true)); }
| "false"
@@ -571,6 +571,8 @@ static void hex(upb_json_parser *p, const char *end) {
size_t parse(void *closure, const void *hd, const char *buf, size_t size,
const upb_bufhandle *handle) {
+ UPB_UNUSED(hd);
+ UPB_UNUSED(handle);
upb_json_parser *parser = closure;
// Variables used by Ragel's generated code.
@@ -596,6 +598,8 @@ error:
}
bool end(void *closure, const void *hd) {
+ UPB_UNUSED(closure);
+ UPB_UNUSED(hd);
return true;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback