summaryrefslogtreecommitdiff
path: root/src/parser.h
AgeCommit message (Collapse)Author
2020-01-23Rearrange struct cmark_nodeNick Wellnhofer
Introduce multi-purpose data/len members in struct cmark_node. This is mainly used to store literal text for inlines, code and HTML blocks. Move the content strbuf for blocks from cmark_node to cmark_parser. When finalizing nodes that allow inlines (paragraphs and headings), detach the strbuf and store the block content in the node's data/len members. Free the block content after processing inlines. Reduces size of struct cmark_node by 8 bytes.
2019-03-28Remove leftover includes of memory.h.John MacFarlane
Closes #290.
2019-03-22Include references.h in parser.hJohn MacFarlane
Closes #287.
2019-03-17Use hand-rolled scanner for thematic break.John MacFarlane
Keep track of the last position where a thematic break failed to match on a line, to avoid rescanning unnecessarily. See commonmark/cmark#284.
2017-01-03Revert "More sourcepos! (#169)"John MacFarlane
This reverts commit 9e643720ec903f3b448bd2589a0c02c2514805ae.
2017-01-03Revert "Change types for source map offsets (#174)"John MacFarlane
This reverts commit 4fbe344df43ed7f60a3d3a53981088334cb709fc.
2016-12-30Change types for source map offsets (#174)Nick Wellnhofer
* Improve strbuf guarantees Introduce BUFSIZE_MAX macro and make sure that the strbuf implementation can handle strings up to this size. * Abort early if document size exceeds internal limit * Change types for source map offsets Switch to size_t for the public API, making the public headers C89-compatible again. Switch to bufsize_t internally, reducing memory usage and improving performance on 32-bit platforms. * Make parser return NULL on internal index overflow Make S_parser_feed set an error and ignore subsequent chunks if the total input document size exceeds an internal limit. Make cmark_parser_finish return NULL if an error was encountered. Add public API functions to retrieve error code and error message. strbuf overflow in renderers and OOM in parser or renderers still cause an abort.
2016-12-20More sourcepos! (#169)Mathieu Duponchelle
* open_new_blocks: always create child before advancing offset * Source map * Extent's typology * In-depth python bindings
2016-06-06msvc: Fix warnings and errorsVicent Marti
2016-06-06cmark: Implement support for custom allocatorsVicent Marti
2016-03-26Handle buffer split across a CRLF line ending (closes #117).John MacFarlane
Adds an internal field to the parser struct to keep track of last_buffer_ended_with_cr.
2016-02-05Added partially_consumed_tab to parser.John MacFarlane
This keeps track of when we have gotten partway through a tab when consuming initial indentation.
2015-07-27Use clang-format, llvm style, for formatting.John MacFarlane
* Reformatted all source files. * Added 'format' target to Makefile. * Removed 'astyle' target. * Updated .editorconfig.
2015-06-16Preliminary changes for new tab handling.John MacFarlane
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.
2015-06-07Convert code base to strbuf_tNick Wellnhofer
There are probably a couple of places I missed. But this will only be a problem if we use a 64-bit bufsize_t at some point. Then, we'll get warnings from -Wshorten-64-to-32.
2015-06-06Factored out `S_find_first_nonspace` in `S_proces_line`.John MacFarlane
Added fields `offset`, `first_nonspace`, `indent`, and `blank` to `cmark_parser` struct. This just removes some repetition in the code.
2015-02-16Made 'options' an int rather than a long.John MacFarlane
For consistency with the API.
2015-02-15Added options parameter to cmark_parse_document, cmark_parse_file.John MacFarlane
Also to some non-exported functions in blocks and inlines.
2014-12-28Added end_column to cmark_node struct.John MacFarlane
API exports cmark_node_get_column. XML writer indicates start and end line and column for block-level nodes.
2014-12-15Re-added cmark_ prefix to strbuf and chunk.John MacFarlane
Reverts 225d720.
2014-12-13Removed cmark_ prefix on chunk and strbuf.John MacFarlane
This isn't needed any more since we don't expose these in the API.
2014-11-29Push parser interfaceNick Wellnhofer
Replace cmark_parser_process_line with cmark_parser_push that takes arbitrary chunks of data. Also fixes #211.
2014-11-28Renamed identifiers in public API:John MacFarlane
cmark_doc_parser => cmark_parser cmark_new_doc_parser => cmark_parser_new cmark_free_doc_parser => cmark_parser_free cmark_finish => cmark_parser_finish cmark_process_line => cmark_parser_process_line cmark_node_destroy => cmark_node_free Closes #223.
2014-11-28Use prefixed names for symbols from references.hNick Wellnhofer
2014-11-17Rename ast.h to parser.hNick Wellnhofer