summaryrefslogtreecommitdiff
path: root/dquote_static.c
blob: c6d22e2dd02b6d6e2d17b9b66c3ffc1c1edff0f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*    dquote_static.c
 *
 * This file contains static inline functions that are related to
 * parsing double-quotish expressions, but are used in more than
 * one file.
 *
 * It is currently #included by regcomp.c and toke.c.
*/

/*
 - regcurly - a little FSA that accepts {\d+,?\d*}
    Pulled from regcomp.c.
 */

/* embed.pl doesn't yet know how to handle static inline functions, so
   manually decorate it here with gcc-style attributes.
*/
PERL_STATIC_INLINE I32
regcurly(register const char *s)
    __attribute__warn_unused_result__
    __attribute__pure__
    __attribute__nonnull__(1);

PERL_STATIC_INLINE I32
regcurly(register const char *s)
{
    assert(s);

    if (*s++ != '{')
	return FALSE;
    if (!isDIGIT(*s))
	return FALSE;
    while (isDIGIT(*s))
	s++;
    if (*s == ',')
	s++;
    while (isDIGIT(*s))
	s++;
    if (*s != '}')
	return FALSE;
    return TRUE;
}
/*
 * Local variables:
 * c-indentation-style: bsd
 * c-basic-offset: 4
 * indent-tabs-mode: t
 * End:
 *
 * ex: set ts=8 sts=4 sw=4 noet:
 */