summaryrefslogtreecommitdiff
path: root/src/blocks.c
AgeCommit message (Collapse)Author
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-28Avoid potential memory leak.John MacFarlane
Previously, if malloc failed to allocate 'newstack', the function would return without freeing 'stack'. Pointed out by clang static analyzer.
2014-11-28Removed unnecessary assignment.John MacFarlane
Clang static analyzer pointed out that the value assigned to 'pos' is never read.
2014-11-28Use prefixed names for symbols from references.hNick Wellnhofer
2014-11-28Use prefixed names for symbols from inlines.hNick Wellnhofer
2014-11-24Cast void* for MSVC compatibilityNick Wellnhofer
2014-11-23Added 'fenced' flag to cmark_code struct, renamed from cmark_fenced_code.John MacFarlane
Technically we could do without this, since we can check for cmark_fence_length > 0. But it makes the code clearer and doesn't really increase the size of the node struct (because the size of the union is set by the data for lists).
2014-11-23Added internal flag to distinguish setext from atx headers.John MacFarlane
2014-11-23Do not distinguish btw fenced and indented code in AST.John MacFarlane
Use a single CMARK_NODE_CODE_BLOCK tag for both. Distinguish them when needed for parsing by looking at the fence_length attribute, which is 0 for indented blocks.
2014-11-23Revert "Revert "Remove distinction btw atx and setext header in AST.""John MacFarlane
This reverts commit 4570eb2bff2e1b71fa5b6408abbc69c98ff5ff24.
2014-11-23Fix segfault on docs without trailing newlineNick Wellnhofer
2014-11-22Revert "Remove distinction btw atx and setext header in AST."John MacFarlane
This reverts commit a71423f6ee1b77d9f79d42599ea00b4ca99f5da0. Not quite sure about this change, so reverting for now. Note that we still have a distinction between fenced and indented code blocks in the AST. These two distinctions seem to stand or fall together.
2014-11-22Remove distinction btw atx and setext header in AST.John MacFarlane
Now we just have 'header' -- Setext and ATX are just two ways of forming these; it's not a semantic difference that should remain in the AST.
2014-11-22Renamed NODE_BQUOTE -> NODE_BLOCK_QUOTE.John MacFarlane
2014-11-22Fixed #192.John MacFarlane
The C and JS implementations were not registering blank lines after atx headers for purposes of tight/loose list calculation. Exmaple: * item * # block1 ## block2
2014-11-22Updated JS and C implementations for #209.John MacFarlane
A setext header was being treated a if it were a blank line for purposes of tight/loose list determination. Closes #209.
2014-11-22Make parser accept a char*Nick Wellnhofer
2014-11-22Fix and test node_checkNick Wellnhofer
2014-11-17Make parse_inlines add directly to parent.John MacFarlane
Previously parse_inlines returned a list of parsed inlines. This had to be added to the parent, and fix_parents had to be called to manually add the 'parent' links to the children, and the 'last_child' link to the parent. Now parse_inlines takes the parent block as a parameter, and uses cmark_node_append_child to add the children, so that the pointers should be properly managed. This avoids the need for the fix_parents pass.
2014-11-17Set prev, parent and last_child for inlinesNick Wellnhofer
2014-11-17Rename ast.h to parser.hNick Wellnhofer
2014-11-17Switch cmark_node_inl over to cmark_nodeNick Wellnhofer
2014-11-17Switch cmark_node_block over to cmark_nodeNick Wellnhofer
2014-11-16Moved refmap from the top-level block node to the doc_parser.John MacFarlane
2014-11-16Export enums for inline, block types, list and list delim types.John MacFarlane
Also switched from `bullet`, `ordered`, `parens`, `period` to `CMARK_BULLET_LIST`, `CMARK_ORDERED_LIST`, `CMARK_PAREN_DELIM`, `CMARK_PERIOD_DELIM`.
2014-11-16Removed CMARK_CODE_INDENT, CODE_INDENT from public header.John MacFarlane
Now it's in blocks.c, the only module that uses it.
2014-11-16Probe for stdbool.hNick Wellnhofer
Let cmake create a cmark_config.h file to deal with platforms missing stdbool.h.
2014-11-16Use named enum typesNick Wellnhofer
Needed for C++ compatibility.
2014-11-16Cast void pointers explicitlyNick Wellnhofer
Needed for C++ compatibility.
2014-11-16Moved AST details from public header cmark.h to private ast.h.John MacFarlane
2014-11-15Expose lower-level parsing API.John MacFarlane
The new functions cmark_new_doc_parser, cmark_free_doc_parser, cmark_process_line, and cmark_finish allow you to feed lines one by one (possibly from several files) to the parser and call finish when you're done. This is now used in main for mulitple files.
2014-11-14Added some includes of buffer.hJohn MacFarlane
2014-11-13Moved the timing macros to get finer-grained information.John MacFarlane
2014-11-13Added ast.[c,h] for AST definitions and AST-manipulating functions.John MacFarlane
2014-11-12Mark some functions as staticNick Wellnhofer
2014-11-06Use non-recursive algorithm for process_inlines.John MacFarlane
Closes #187.
2014-11-06Reformatted code consistently.John MacFarlane
2014-11-05Made block-freeing slightly more efficient by using last_child.John MacFarlane
2014-11-05Made cmark_free_nodes non-recursive.John MacFarlane
See #187.
2014-10-26Require space before closing # sequence in ATX header.John MacFarlane
Closes #169.
2014-10-24Renamed c program and library stmd -> cmark.John MacFarlane
Also renamed internal library functions accordingly.
2014-10-24Add a newline to a line that doesn't end with one.John MacFarlane
Closes #115.
2014-10-24Merge branch 'master' of https://github.com/tchetch/stmd into tchetch-masterJohn MacFarlane
Conflicts: src/inlines.c
2014-10-24Use unsigned char, not char, throughout.John MacFarlane
Closes #43.
2014-10-18Reindented c sources.John MacFarlane
2014-10-06- Use of calloc instead of malloctchetch
- Test for NULL after allocation
2014-09-17Better handle trailing backslashes in ATX-style headersJordan Milne
Previously something like '# `\' would hang the parser while it waited for an extra character that wasn't there.
2014-09-15Cleanup external APIsVicent Marti
2014-09-10Cleanup reference implementationVicent Marti