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.17.9 ext/commonmarker/cmark_ctype.c
commonmarker-0.17.8 ext/commonmarker/cmark_ctype.c
commonmarker-0.17.7.1 ext/commonmarker/cmark_ctype.c
commonmarker-0.17.7 ext/commonmarker/cmark-upstream/src/cmark_ctype.c
commonmarker-0.17.7 ext/commonmarker/cmark_ctype.c
commonmarker-0.17.6 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.17.5 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.17.4 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.17.2 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.17.1 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.17.0 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.16.8 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.16.7 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.16.6 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.16.5 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.16.4 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.16.1 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.16.2 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.16.3 ext/commonmarker/cmark/src/cmark_ctype.c
commonmarker-0.16.0 ext/commonmarker/cmark/src/cmark_ctype.c