Sha256: 556d662fa2f1513630bc1d76023e1e17bb8c185eab1b6936c14e59af0c3c3148

Contents?: true

Size: 1.7 KB

Versions: 101

Compression:

Stored size: 1.7 KB

Contents

#include <stdint.h>

#include "cmark_ctype.h"

/** 1 = space, 2 = punct, 3 = digit, 4 = alpha, 0 = other
 */
static const uint8_t cmark_ctype_class[256] = {
    /*      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f */
    /* 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
    /* 1 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    /* 2 */ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    /* 3 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2,
    /* 4 */ 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    /* 5 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2,
    /* 6 */ 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    /* 7 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0,
    /* 8 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    /* 9 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    /* a */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    /* b */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    /* c */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    /* d */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    /* e */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    /* f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

/**
 * Returns 1 if c is a "whitespace" character as defined by the spec.
 */
int cmark_isspace(char c) { return cmark_ctype_class[(uint8_t)c] == 1; }

/**
 * Returns 1 if c is an ascii punctuation character.
 */
int cmark_ispunct(char c) { return cmark_ctype_class[(uint8_t)c] == 2; }

int cmark_isalnum(char c) {
  uint8_t result;
  result = cmark_ctype_class[(uint8_t)c];
  return (result == 3 || result == 4);
}

int cmark_isdigit(char c) { return cmark_ctype_class[(uint8_t)c] == 3; }

int cmark_isalpha(char c) { return cmark_ctype_class[(uint8_t)c] == 4; }

Version data entries

101 entries across 100 versions & 5 rubygems

Version Path
commonmarker-0.23.11 ext/commonmarker/cmark_ctype.c
markly-0.12.1 ext/markly/cmark_ctype.c
markly-0.12.0 ext/markly/cmark_ctype.c
markly-0.11.0 ext/markly/cmark_ctype.c
markly-0.10.0 ext/markly/cmark_ctype.c
markly-0.9.1 ext/markly/cmark_ctype.c
commonmarker-0.23.10 ext/commonmarker/cmark_ctype.c
markly-0.9.0 ext/markly/cmark_ctype.c
markly-0.8.1 ext/markly/cmark_ctype.c
markly-0.8.0 ext/markly/cmark_ctype.c
qiita_marker-0.23.9.0 ext/qiita_marker/cmark_ctype.c
commonmarker-0.23.9 ext/commonmarker/cmark_ctype.c
commonmarker-0.23.8 ext/commonmarker/cmark_ctype.c
commonmarker-0.23.7 ext/commonmarker/cmark_ctype.c
qiita_marker-0.23.6.2 ext/qiita_marker/cmark_ctype.c
commonmarker-0.23.7.pre1 ext/commonmarker/cmark_ctype.c
qiita_marker-0.23.6.1 ext/qiita_marker/cmark_ctype.c
qiita_marker-0.23.6.0 ext/qiita_marker/cmark_ctype.c
commonmarker-0.23.6 ext/commonmarker/cmark_ctype.c
qiita_marker-0.23.5.1 ext/qiita_marker/cmark_ctype.c