Skip to content

Commit 351e5cb

Browse files
committed
Fix to make it build on Swift 4.2
1 parent 79805a7 commit 351e5cb

File tree

6 files changed

+410
-2
lines changed

6 files changed

+410
-2
lines changed

Package@swift-4.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// swift-tools-version:4.0
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "cmark",
7+
products: [
8+
.library(name: "cmark", targets: ["cmark"]),
9+
],
10+
targets: [
11+
.target(name: "cmark")
12+
]
13+
)
14+

Sources/cmark/ext_scanners.re

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#include <stdlib.h>
2+
#include "ext_scanners.h"
3+
4+
bufsize_t _ext_scan_at(bufsize_t (*scanner)(const unsigned char *), unsigned char *ptr, int len, bufsize_t offset)
5+
{
6+
bufsize_t res;
7+
8+
if (ptr == NULL || offset > len) {
9+
return 0;
10+
} else {
11+
unsigned char lim = ptr[len];
12+
13+
ptr[len] = '\0';
14+
res = scanner(ptr + offset);
15+
ptr[len] = lim;
16+
}
17+
18+
return res;
19+
}
20+
21+
/*!re2c
22+
re2c:define:YYCTYPE = "unsigned char";
23+
re2c:define:YYCURSOR = p;
24+
re2c:define:YYMARKER = marker;
25+
re2c:define:YYCTXMARKER = marker;
26+
re2c:yyfill:enable = 0;
27+
28+
spacechar = [ \t\v\f];
29+
newline = [\r]?[\n];
30+
escaped_char = [\\][|!"#$%&'()*+,./:;<=>?@[\\\]^_`{}~-];
31+
32+
table_marker = (spacechar*[:]?[-]+[:]?spacechar*);
33+
table_cell = (escaped_char|[^|\r\n])*;
34+
*/
35+
36+
bufsize_t _scan_table_start(const unsigned char *p)
37+
{
38+
const unsigned char *marker = NULL;
39+
const unsigned char *start = p;
40+
/*!re2c
41+
[|]? table_marker ([|] table_marker)* [|]? spacechar* newline { return (bufsize_t)(p - start); }
42+
.? { return 0; }
43+
*/
44+
}
45+
46+
bufsize_t _scan_table_cell(const unsigned char *p)
47+
{
48+
const unsigned char *marker = NULL;
49+
const unsigned char *start = p;
50+
/*!re2c
51+
table_cell { return (bufsize_t)(p - start); }
52+
.? { return 0; }
53+
*/
54+
}
55+
56+
bufsize_t _scan_table_cell_end(const unsigned char *p)
57+
{
58+
const unsigned char *marker = NULL;
59+
const unsigned char *start = p;
60+
/*!re2c
61+
[|] spacechar* newline? { return (bufsize_t)(p - start); }
62+
.? { return 0; }
63+
*/
64+
}
65+
66+
bufsize_t _scan_table_row_end(const unsigned char *p)
67+
{
68+
const unsigned char *marker = NULL;
69+
const unsigned char *start = p;
70+
/*!re2c
71+
spacechar* newline { return (bufsize_t)(p - start); }
72+
.? { return 0; }
73+
*/
74+
}

Sources/cmark/include/cmark.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#define CMARK_CMARK_H
33

44
#include <stdio.h>
5-
#include "../cmark_export.h"
6-
#include "../cmark_version.h"
5+
#include "cmark_export.h"
6+
#include "cmark_version.h"
77

88
#ifdef __cplusplus
99
extern "C" {

0 commit comments

Comments
 (0)