diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-06-11 14:32:22 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-06-16 17:47:19 -0700 |
commit | 7f491b0bdf8e206458d284938efa8a0890c9d352 (patch) | |
tree | d102cc7abad2628771a26dc35a26a577f0f524cd /src/parser.h | |
parent | ef77d908553bfdd37b83ae4832d7e6ff36874f24 (diff) |
Preliminary changes for new tab handling.
We no longer preprocess tabs to spaces before parsing.
Instead, we keep track of both the byte offset and
the (virtual) column as we parse block starts.
This allows us to handle tabs without converting
to spaces first. Tabs are left as tabs in the output.
Added `column` and `first_nonspace_column` fields to `parser`.
Added utility function to advance the offset, computing
the virtual column too.
Note that we don't need to deal with UTF-8 here at all.
Only ASCII occurs in block starts.
Significant performance improvement due to the fact that
we're not doing UTF-8 validation -- though we might want
to add that back in.
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/parser.h b/src/parser.h index 6e18c67..01a7aeb 100644 --- a/src/parser.h +++ b/src/parser.h @@ -17,7 +17,9 @@ struct cmark_parser { struct cmark_node* current; int line_number; bufsize_t offset; + bufsize_t column; bufsize_t first_nonspace; + bufsize_t first_nonspace_column; int indent; bool blank; cmark_strbuf *curline; |