on master help sign in
#7, rename peekAt to peek_at, for consistency
539ba4eNeil Mitchell
cbits/hexml.c+8−8
@@ -249,8 +249,8 @@ static inline bool is_space(char c) { return is(c, tag_space); }
249/////////////////////////////////////////////////////////////////////
249/////////////////////////////////////////////////////////////////////
250// PARSER COMBINATORS
250// PARSER COMBINATORS
251
251
252−static inline char peekAt(const document* d, int i) { return d->cursor[i]; }
252+static inline char peek_at(const document* d, int i) { return d->cursor[i]; }
253−static inline char peek(const document* d) { return peekAt(d, 0); }
253+static inline char peek(const document* d) { return peek_at(d, 0); }
254static inline void skip(document* d, int i) { d->cursor += i; }
254static inline void skip(document* d, int i) { d->cursor += i; }
255static inline char get(document* d) { char c = peek(d); skip(d, 1); return c; }
255static inline char get(document* d) { char c = peek(d); skip(d, 1); return c; }
256
256
@@ -405,7 +405,7 @@ static inline void parse_tag(document* d)
405 if (d->error_message != NULL) return;
405 if (d->error_message != NULL) return;
406
406
407 c = peek(d);
407 c = peek(d);
408− if ((c == '/' || c == '?') && peekAt(d, 1) == '>')
408+ if ((c == '/' || c == '?') && peek_at(d, 1) == '>')
409 {
409 {
410 skip(d, 2);
410 skip(d, 2);
411 me->nodes = start_length(0, 0);
411 me->nodes = start_length(0, 0);
@@ -429,7 +429,7 @@ static inline void parse_tag(document* d)
429 me->inner.length = start_end(me->inner.start, doc_position(d)).length;
429 me->inner.length = start_end(me->inner.start, doc_position(d)).length;
430
430
431 if (d->error_message != NULL) return;
431 if (d->error_message != NULL) return;
432− if (peek(d) == '<' && peekAt(d, 1) == '/')
432+ if (peek(d) == '<' && peek_at(d, 1) == '/')
433 {
433 {
434 skip(d, 2);
434 skip(d, 2);
435 if (d->end - d->cursor >= me->name.length &&
435 if (d->end - d->cursor >= me->name.length &&
@@ -461,16 +461,16 @@ static str parse_content(document* d)
461 {
461 {
462 break;
462 break;
463 }
463 }
464− else if (peekAt(d, 1) == '/')
464+ else if (peek_at(d, 1) == '/')
465 {
465 {
466 // have found a </
466 // have found a </
467 break;
467 break;
468 }
468 }
469− else if (peekAt(d, 1) == '!' && peekAt(d, 2) == '-' && peekAt(d, 3) == '-')
469+ else if (peek_at(d, 1) == '!' && peek_at(d, 2) == '-' && peek_at(d, 3) == '-')
470 {
470 {
471 skip(d, 3);
471 skip(d, 3);
472 // you can't reuse the two '-' characters for the closing as well
472 // you can't reuse the two '-' characters for the closing as well
473− if (peekAt(d, 0) == '\0' || peekAt(d, 1) == '\0')
473+ if (peek_at(d, 0) == '\0' || peek_at(d, 1) == '\0')
474 {
474 {
475 set_error(d, "Didn't get a closing comment");
475 set_error(d, "Didn't get a closing comment");
476 return start_end(0, 0);
476 return start_end(0, 0);
@@ -484,7 +484,7 @@ static str parse_content(document* d)
484 return start_end(0, 0);
484 return start_end(0, 0);
485 }
485 }
486 skip(d, 1);
486 skip(d, 1);
487− if (peekAt(d, -3) == '-' && peekAt(d, -2))
487+ if (peek_at(d, -3) == '-' && peek_at(d, -2))
488 break;
488 break;
489 }
489 }
490 }
490 }