aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-11-19 17:08:03 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-11-19 17:08:03 +0100
commit7f8a0d96dd3ab34b4f8ec233fd243f53a01a4e6a (patch)
treee710aa9ab288bef3bc8a6a3a6e6c52baece3e1b3
parentfd13d0211f33a134a4c73882f1f2eaa423f1794a (diff)
Accessors for start_line, start_column, end_line
These are read-only as they're only metadata returned by the parser.
-rw-r--r--src/cmark.h9
-rw-r--r--src/node.c15
2 files changed, 24 insertions, 0 deletions
diff --git a/src/cmark.h b/src/cmark.h
index 2b42486..a74fe93 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -138,6 +138,15 @@ cmark_node_get_title(cmark_node *node);
CMARK_EXPORT int
cmark_node_set_title(cmark_node *node, const char *title);
+CMARK_EXPORT int
+cmark_node_get_start_line(cmark_node *node);
+
+CMARK_EXPORT int
+cmark_node_get_start_column(cmark_node *node);
+
+CMARK_EXPORT int
+cmark_node_get_end_line(cmark_node *node);
+
// Tree manipulation
CMARK_EXPORT void
diff --git a/src/node.c b/src/node.c
index f2649e9..8b8b988 100644
--- a/src/node.c
+++ b/src/node.c
@@ -303,6 +303,21 @@ cmark_node_set_title(cmark_node *node, const char *title) {
return 0;
}
+int
+cmark_node_get_start_line(cmark_node *node) {
+ return node->start_line;
+}
+
+int
+cmark_node_get_start_column(cmark_node *node) {
+ return node->start_column;
+}
+
+int
+cmark_node_get_end_line(cmark_node *node) {
+ return node->end_line;
+}
+
static inline bool
S_is_block(cmark_node *node) {
return node->type >= CMARK_NODE_FIRST_BLOCK