Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r src/parser.c /home/danilak/test/src/gumbo-parser/src/parser.c
- 578d577
- <
- diff -r src/tokenizer.c /home/danilak/test/src/gumbo-parser/src/tokenizer.c
- 2847,2849c2847,2849
- < int c = utf8iterator_current(&tokenizer->_input);
- < gumbo_debug(
- < "Lexing character '%c' (%d) in state %d.\n", c, c, tokenizer->_state);
- ---
- > int c = tokenizer->_input._current;
- > // gumbo_debug(
- > // "Lexing character '%c' (%d) in state %d.\n", c, c, tokenizer->_state);
- diff -r src/utf8.c /home/danilak/test/src/gumbo-parser/src/utf8.c
- 127c127
- < static void read_char(Utf8Iterator* iter) {
- ---
- > void read_char(Utf8Iterator* iter) {
- 183,195d182
- < static void update_position(Utf8Iterator* iter) {
- < iter->_pos.offset += iter->_width;
- < if (iter->_current == '\n') {
- < ++iter->_pos.line;
- < iter->_pos.column = 1;
- < } else if (iter->_current == '\t') {
- < int tab_stop = iter->_parser->_options->tab_stop;
- < iter->_pos.column = ((iter->_pos.column / tab_stop) + 1) * tab_stop;
- < } else if (iter->_current != -1) {
- < ++iter->_pos.column;
- < }
- < }
- <
- 215,223d201
- < void utf8iterator_next(Utf8Iterator* iter) {
- < // We update positions based on the *last* character read, so that the first
- < // character following a newline is at column 1 in the next line.
- < update_position(iter);
- < iter->_start += iter->_width;
- < read_char(iter);
- < }
- <
- < int utf8iterator_current(const Utf8Iterator* iter) { return iter->_current; }
- diff -r src/utf8.h /home/danilak/test/src/gumbo-parser/src/utf8.h
- 37a38
- > #include "parser.h"
- 45d45
- < struct GumboInternalParser;
- 86a87,101
- > static inline void update_position(Utf8Iterator* iter) {
- > iter->_pos.offset += iter->_width;
- > if (iter->_current == '\n') {
- > ++iter->_pos.line;
- > iter->_pos.column = 1;
- > } else if (iter->_current == '\t') {
- > int tab_stop = iter->_parser->_options->tab_stop;
- > iter->_pos.column = ((iter->_pos.column / tab_stop) + 1) * tab_stop;
- > } else if (iter->_current != -1) {
- > ++iter->_pos.column;
- > }
- > }
- >
- > void read_char(Utf8Iterator* iter);
- >
- 88c103,109
- < void utf8iterator_next(Utf8Iterator* iter);
- ---
- > static __attribute__((always_inline)) inline void utf8iterator_next(Utf8Iterator* iter) {
- > // We update positions based on the *last* character read, so that the first
- > // character following a newline is at column 1 in the next line.
- > update_position(iter);
- > iter->_start += iter->_width;
- > read_char(iter);
- > }
- 91c112
- < int utf8iterator_current(const Utf8Iterator* iter);
- ---
- > static inline int utf8iterator_current(const Utf8Iterator* iter) { return iter->_current; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement