cow_parse.hrl (3315B)
1 %% Copyright (c) 2015-2018, Loïc Hoguin <essen@ninenines.eu> 2 %% 3 %% Permission to use, copy, modify, and/or distribute this software for any 4 %% purpose with or without fee is hereby granted, provided that the above 5 %% copyright notice and this permission notice appear in all copies. 6 %% 7 %% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 %% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 %% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 %% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 %% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 %% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 15 -ifndef(COW_PARSE_HRL). 16 -define(COW_PARSE_HRL, 1). 17 18 -define(IS_ALPHA(C), 19 (C =:= $a) or (C =:= $b) or (C =:= $c) or (C =:= $d) or (C =:= $e) or 20 (C =:= $f) or (C =:= $g) or (C =:= $h) or (C =:= $i) or (C =:= $j) or 21 (C =:= $k) or (C =:= $l) or (C =:= $m) or (C =:= $n) or (C =:= $o) or 22 (C =:= $p) or (C =:= $q) or (C =:= $r) or (C =:= $s) or (C =:= $t) or 23 (C =:= $u) or (C =:= $v) or (C =:= $w) or (C =:= $x) or (C =:= $y) or 24 (C =:= $z) or 25 (C =:= $A) or (C =:= $B) or (C =:= $C) or (C =:= $D) or (C =:= $E) or 26 (C =:= $F) or (C =:= $G) or (C =:= $H) or (C =:= $I) or (C =:= $J) or 27 (C =:= $K) or (C =:= $L) or (C =:= $M) or (C =:= $N) or (C =:= $O) or 28 (C =:= $P) or (C =:= $Q) or (C =:= $R) or (C =:= $S) or (C =:= $T) or 29 (C =:= $U) or (C =:= $V) or (C =:= $W) or (C =:= $X) or (C =:= $Y) or 30 (C =:= $Z) 31 ). 32 33 -define(IS_ALPHANUM(C), ?IS_ALPHA(C) or ?IS_DIGIT(C)). 34 -define(IS_CHAR(C), C > 0, C < 128). 35 36 -define(IS_DIGIT(C), 37 (C =:= $0) or (C =:= $1) or (C =:= $2) or (C =:= $3) or (C =:= $4) or 38 (C =:= $5) or (C =:= $6) or (C =:= $7) or (C =:= $8) or (C =:= $9)). 39 40 -define(IS_ETAGC(C), C =:= 16#21; C >= 16#23, C =/= 16#7f). 41 42 -define(IS_HEX(C), 43 ?IS_DIGIT(C) or 44 (C =:= $a) or (C =:= $b) or (C =:= $c) or 45 (C =:= $d) or (C =:= $e) or (C =:= $f) or 46 (C =:= $A) or (C =:= $B) or (C =:= $C) or 47 (C =:= $D) or (C =:= $E) or (C =:= $F)). 48 49 -define(IS_LHEX(C), 50 ?IS_DIGIT(C) or 51 (C =:= $a) or (C =:= $b) or (C =:= $c) or 52 (C =:= $d) or (C =:= $e) or (C =:= $f)). 53 54 -define(IS_TOKEN(C), 55 ?IS_ALPHA(C) or ?IS_DIGIT(C) or 56 (C =:= $!) or (C =:= $#) or (C =:= $$) or (C =:= $%) or (C =:= $&) or 57 (C =:= $') or (C =:= $*) or (C =:= $+) or (C =:= $-) or (C =:= $.) or 58 (C =:= $^) or (C =:= $_) or (C =:= $`) or (C =:= $|) or (C =:= $~)). 59 60 -define(IS_TOKEN68(C), 61 ?IS_ALPHA(C) or ?IS_DIGIT(C) or 62 (C =:= $-) or (C =:= $.) or (C =:= $_) or 63 (C =:= $~) or (C =:= $+) or (C =:= $/)). 64 65 -define(IS_URI_UNRESERVED(C), 66 ?IS_ALPHA(C) or ?IS_DIGIT(C) or 67 (C =:= $-) or (C =:= $.) or (C =:= $_) or (C =:= $~)). 68 69 -define(IS_URI_GEN_DELIMS(C), 70 (C =:= $:) or (C =:= $/) or (C =:= $?) or (C =:= $#) or 71 (C =:= $[) or (C =:= $]) or (C =:= $@)). 72 73 -define(IS_URI_SUB_DELIMS(C), 74 (C =:= $!) or (C =:= $$) or (C =:= $&) or (C =:= $') or 75 (C =:= $() or (C =:= $)) or (C =:= $*) or (C =:= $+) or 76 (C =:= $,) or (C =:= $;) or (C =:= $=)). 77 78 -define(IS_VCHAR(C), C =:= $\t; C > 31, C < 127). 79 -define(IS_VCHAR_OBS(C), C =:= $\t; C > 31, C =/= 127). 80 -define(IS_WS(C), (C =:= $\s) or (C =:= $\t)). 81 -define(IS_WS_COMMA(C), ?IS_WS(C) or (C =:= $,)). 82 83 -endif.