Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement parsing extensions #123

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b8af879
Implement and expose block parsing API.
MathieuDuponchelle Feb 28, 2016
f2e9eff
[API]: parser: Expose 'setter' methods in cmark_parser.
MathieuDuponchelle Feb 28, 2016
96f966e
[API]: node: implement and expose cmark_node_set_type.
MathieuDuponchelle Feb 28, 2016
8075d64
[API]: node: implement and expose cmark_node_set_user_data_free_func.
MathieuDuponchelle Feb 28, 2016
0839b4b
[API]: node: Expose string_content.
MathieuDuponchelle Feb 28, 2016
19ffd43
[API]: node: set and get code blocks fenced state.
MathieuDuponchelle Mar 6, 2016
9d8a9dc
Check in and expose a linked list.
MathieuDuponchelle Feb 27, 2016
d2f829f
Define syntax extensions
MathieuDuponchelle Apr 27, 2016
1bc58d0
Implement plugin loading and discovery
MathieuDuponchelle Apr 27, 2016
e707529
cmark executable: add extension switches
MathieuDuponchelle Feb 27, 2016
fe08f83
Define blocks constituting a table.
MathieuDuponchelle Feb 28, 2016
634833c
Extensions: implement an example "core extension"
MathieuDuponchelle Feb 27, 2016
228be72
Check in extension scanners separately
MathieuDuponchelle Feb 27, 2016
c174e30
inlines: Expose inline parser
MathieuDuponchelle Mar 4, 2016
315f477
inline extension draft
MathieuDuponchelle Mar 5, 2016
5f64582
Define a strikethrough inline node type.
MathieuDuponchelle Mar 5, 2016
7fbb2e6
Example inline extension: strikethrough text
MathieuDuponchelle Mar 4, 2016
44b2d76
cmark_parser: improve lifecycle management.
MathieuDuponchelle Mar 6, 2016
cf19502
syntax-extension: add "priv" field.
MathieuDuponchelle Apr 2, 2016
389216b
cmark_parser: implement and expose reentrant feed function.
MathieuDuponchelle Apr 2, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_
option(CMARK_TESTS "Build cmark tests and enable testing" ON)

add_subdirectory(src)
add_subdirectory(extensions)
if(CMARK_TESTS)
add_subdirectory(api_test)
endif()
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SRCDIR=src
EXTDIR=extensions
DATADIR=data
BUILDDIR?=build
GENERATOR?=Unix Makefiles
Expand Down Expand Up @@ -115,6 +116,19 @@ $(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
--encoding-policy substitute -o $@ $<
clang-format -style llvm -i $@

# We include scanners.c in the repository, so this shouldn't
# normally need to be generated.
$(EXTDIR)/ext_scanners.c: $(EXTDIR)/ext_scanners.re
@case "$$(re2c -v)" in \
*\ 0.13.*|*\ 0.14|*\ 0.14.1) \
echo "re2c >= 0.14.2 is required"; \
false; \
;; \
esac
re2c --case-insensitive -b -i --no-generation-date -8 \
--encoding-policy substitute -o $@ $<
clang-format -style llvm -i $@

# We include entities.inc in the repository, so normally this
# doesn't need to be regenerated:
$(SRCDIR)/entities.inc: tools/make_entities_inc.py
Expand Down
2 changes: 1 addition & 1 deletion api_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include_directories(
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src
)
target_link_libraries(api_test libcmark)
target_link_libraries(api_test libcmark ${CMAKE_DL_LIBS})

# Compiler flags
if(MSVC)
Expand Down
32 changes: 32 additions & 0 deletions extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 2.8)
set(LIBRARY "cmarkextensions")
set(LIBRARY_SOURCES
${PROJECT_SOURCE_DIR}/src/buffer.c
${PROJECT_SOURCE_DIR}/src/cmark_ctype.c
core-extensions.c
ext_scanners.c
ext_scanners.h
)

include_directories(
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src
)

# We make LIB_INSTALL_DIR configurable rather than
# hard-coding lib, because on some OSes different locations
# are used for different architectures (e.g. /usr/lib64 on
# 64-bit Fedora).
if(NOT LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR "lib" CACHE STRING
"Set the installation directory for libraries." FORCE)
endif(NOT LIB_INSTALL_DIR)

include_directories(. ${CMAKE_CURRENT_BINARY_DIR})

set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE} -pg")
set(CMAKE_LINKER_PROFILE "${CMAKE_LINKER_FLAGS_RELEASE} -pg")

add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES})

target_link_libraries(cmarkextensions libcmark)
Loading