Skip to content

implement parser_fork.c#578

Closed
Lakr233 wants to merge 2 commits intocommonmark:masterfrom
Lakr233:add-parser-fork
Closed

implement parser_fork.c#578
Lakr233 wants to merge 2 commits intocommonmark:masterfrom
Lakr233:add-parser-fork

Conversation

@Lakr233
Copy link
Copy Markdown

@Lakr233 Lakr233 commented May 27, 2025

This pull request introduces a new feature to support deep copying of cmark_parser objects, enabling the creation of independent parser forks. This is particularly useful for scenarios like streaming mode, where a parser's state needs to be duplicated without affecting the original. The changes include the implementation of the cmark_parser_fork function, along with its declaration and supporting utilities.

New Feature: Parser Forking

  • Addition of cmark_parser_fork function: Implements the logic to create a deep copy of a cmark_parser object, including its document tree, reference map, and other stateful properties. The function ensures that the forked parser operates independently while sharing the same memory allocator and configuration. (src/parser_fork.c)
  • Declaration of cmark_parser_fork: Adds the function declaration to the public API in src/cmark.h and introduces a new header file, src/parser_fork.h, to encapsulate the related functionality. (src/cmark.h, src/parser_fork.h) [1] [2]

@Lakr233 Lakr233 force-pushed the add-parser-fork branch from 2810e28 to c86c7f2 Compare May 27, 2025 06:27
Comment thread src/parser_fork.c Outdated
Co-authored-by: Kyle <kyle201817146@gmail.com>
@Lakr233
Copy link
Copy Markdown
Author

Lakr233 commented May 27, 2025

It looks like I need make PR to GitHub/cmark-gfm.

@Lakr233 Lakr233 closed this May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants