SLRE(Super Light Regular Expression library) Unit Test Code.

Dependencies:   mbed

Committer:
monpetit
Date:
Thu Jul 28 08:10:30 2016 +0000
Revision:
0:3ca3835f816e
initial commit: unit tests are passed.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
monpetit 0:3ca3835f816e 1 /*
monpetit 0:3ca3835f816e 2 * Copyright (c) 2004-2013 Sergey Lyubka <valenok@gmail.com>
monpetit 0:3ca3835f816e 3 * Copyright (c) 2013 Cesanta Software Limited
monpetit 0:3ca3835f816e 4 * All rights reserved
monpetit 0:3ca3835f816e 5 *
monpetit 0:3ca3835f816e 6 * This library is dual-licensed: you can redistribute it and/or modify
monpetit 0:3ca3835f816e 7 * it under the terms of the GNU General Public License version 2 as
monpetit 0:3ca3835f816e 8 * published by the Free Software Foundation. For the terms of this
monpetit 0:3ca3835f816e 9 * license, see <http://www.gnu.org/licenses/>.
monpetit 0:3ca3835f816e 10 *
monpetit 0:3ca3835f816e 11 * You are free to use this library under the terms of the GNU General
monpetit 0:3ca3835f816e 12 * Public License, but WITHOUT ANY WARRANTY; without even the implied
monpetit 0:3ca3835f816e 13 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
monpetit 0:3ca3835f816e 14 * See the GNU General Public License for more details.
monpetit 0:3ca3835f816e 15 *
monpetit 0:3ca3835f816e 16 * Alternatively, you can license this library under a commercial
monpetit 0:3ca3835f816e 17 * license, as set out in <http://cesanta.com/products.html>.
monpetit 0:3ca3835f816e 18 */
monpetit 0:3ca3835f816e 19
monpetit 0:3ca3835f816e 20 /*
monpetit 0:3ca3835f816e 21 * This is a regular expression library that implements a subset of Perl RE.
monpetit 0:3ca3835f816e 22 * Please refer to README.md for a detailed reference.
monpetit 0:3ca3835f816e 23 */
monpetit 0:3ca3835f816e 24
monpetit 0:3ca3835f816e 25 #ifndef CS_SLRE_SLRE_H_
monpetit 0:3ca3835f816e 26 #define CS_SLRE_SLRE_H_
monpetit 0:3ca3835f816e 27
monpetit 0:3ca3835f816e 28 #ifdef __cplusplus
monpetit 0:3ca3835f816e 29 extern "C" {
monpetit 0:3ca3835f816e 30 #endif
monpetit 0:3ca3835f816e 31
monpetit 0:3ca3835f816e 32 struct slre_cap {
monpetit 0:3ca3835f816e 33 const char *ptr;
monpetit 0:3ca3835f816e 34 int len;
monpetit 0:3ca3835f816e 35 };
monpetit 0:3ca3835f816e 36
monpetit 0:3ca3835f816e 37
monpetit 0:3ca3835f816e 38 int slre_match(const char *regexp, const char *buf, int buf_len,
monpetit 0:3ca3835f816e 39 struct slre_cap *caps, int num_caps, int flags);
monpetit 0:3ca3835f816e 40
monpetit 0:3ca3835f816e 41 /* Possible flags for slre_match() */
monpetit 0:3ca3835f816e 42 enum { SLRE_IGNORE_CASE = 1 };
monpetit 0:3ca3835f816e 43
monpetit 0:3ca3835f816e 44
monpetit 0:3ca3835f816e 45 /* slre_match() failure codes */
monpetit 0:3ca3835f816e 46 #define SLRE_NO_MATCH -1
monpetit 0:3ca3835f816e 47 #define SLRE_UNEXPECTED_QUANTIFIER -2
monpetit 0:3ca3835f816e 48 #define SLRE_UNBALANCED_BRACKETS -3
monpetit 0:3ca3835f816e 49 #define SLRE_INTERNAL_ERROR -4
monpetit 0:3ca3835f816e 50 #define SLRE_INVALID_CHARACTER_SET -5
monpetit 0:3ca3835f816e 51 #define SLRE_INVALID_METACHARACTER -6
monpetit 0:3ca3835f816e 52 #define SLRE_CAPS_ARRAY_TOO_SMALL -7
monpetit 0:3ca3835f816e 53 #define SLRE_TOO_MANY_BRANCHES -8
monpetit 0:3ca3835f816e 54 #define SLRE_TOO_MANY_BRACKETS -9
monpetit 0:3ca3835f816e 55
monpetit 0:3ca3835f816e 56 #ifdef __cplusplus
monpetit 0:3ca3835f816e 57 }
monpetit 0:3ca3835f816e 58 #endif
monpetit 0:3ca3835f816e 59
monpetit 0:3ca3835f816e 60 #endif /* CS_SLRE_SLRE_H_ */