Skip to content

Commit

Permalink
Fix to make it build on Swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTim committed Sep 19, 2018
1 parent 79805a7 commit 351e5cb
Show file tree
Hide file tree
Showing 6 changed files with 410 additions and 2 deletions.
14 changes: 14 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// swift-tools-version:4.0

import PackageDescription

let package = Package(
name: "cmark",
products: [
.library(name: "cmark", targets: ["cmark"]),
],
targets: [
.target(name: "cmark")
]
)

74 changes: 74 additions & 0 deletions Sources/cmark/ext_scanners.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include <stdlib.h>
#include "ext_scanners.h"

bufsize_t _ext_scan_at(bufsize_t (*scanner)(const unsigned char *), unsigned char *ptr, int len, bufsize_t offset)
{
bufsize_t res;

if (ptr == NULL || offset > len) {
return 0;
} else {
unsigned char lim = ptr[len];

ptr[len] = '\0';
res = scanner(ptr + offset);
ptr[len] = lim;
}

return res;
}

/*!re2c
re2c:define:YYCTYPE = "unsigned char";
re2c:define:YYCURSOR = p;
re2c:define:YYMARKER = marker;
re2c:define:YYCTXMARKER = marker;
re2c:yyfill:enable = 0;
spacechar = [ \t\v\f];
newline = [\r]?[\n];
escaped_char = [\\][|!"#$%&'()*+,./:;<=>?@[\\\]^_`{}~-];
table_marker = (spacechar*[:]?[-]+[:]?spacechar*);
table_cell = (escaped_char|[^|\r\n])*;
*/

bufsize_t _scan_table_start(const unsigned char *p)
{
const unsigned char *marker = NULL;
const unsigned char *start = p;
/*!re2c
[|]? table_marker ([|] table_marker)* [|]? spacechar* newline { return (bufsize_t)(p - start); }
.? { return 0; }
*/
}

bufsize_t _scan_table_cell(const unsigned char *p)
{
const unsigned char *marker = NULL;
const unsigned char *start = p;
/*!re2c
table_cell { return (bufsize_t)(p - start); }
.? { return 0; }
*/
}

bufsize_t _scan_table_cell_end(const unsigned char *p)
{
const unsigned char *marker = NULL;
const unsigned char *start = p;
/*!re2c
[|] spacechar* newline? { return (bufsize_t)(p - start); }
.? { return 0; }
*/
}

bufsize_t _scan_table_row_end(const unsigned char *p)
{
const unsigned char *marker = NULL;
const unsigned char *start = p;
/*!re2c
spacechar* newline { return (bufsize_t)(p - start); }
.? { return 0; }
*/
}
4 changes: 2 additions & 2 deletions Sources/cmark/include/cmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define CMARK_CMARK_H

#include <stdio.h>
#include "../cmark_export.h"
#include "../cmark_version.h"
#include "cmark_export.h"
#include "cmark_version.h"

#ifdef __cplusplus
extern "C" {
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 351e5cb

Please sign in to comment.