This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
embed.fnc: Add inline function capability
[perl5.git] / dquote_static.c
CommitLineData
04e98a4d
AD
1/* dquote_static.c
2 *
3 * This file contains static inline functions that are related to
4 * parsing double-quotish expressions, but are used in more than
5 * one file.
6 *
7 * It is currently #included by regcomp.c and toke.c.
8*/
9
10/*
11 - regcurly - a little FSA that accepts {\d+,?\d*}
12 Pulled from regcomp.c.
13 */
14
15/* embed.pl doesn't yet know how to handle static inline functions, so
16 manually decorate it here with gcc-style attributes.
17*/
18PERL_STATIC_INLINE I32
19regcurly(register const char *s)
20 __attribute__warn_unused_result__
21 __attribute__pure__
22 __attribute__nonnull__(1);
23
24PERL_STATIC_INLINE I32
25regcurly(register const char *s)
26{
27 assert(s);
28
29 if (*s++ != '{')
30 return FALSE;
31 if (!isDIGIT(*s))
32 return FALSE;
33 while (isDIGIT(*s))
34 s++;
2ec31dd9 35 if (*s == ',') {
04e98a4d 36 s++;
2ec31dd9
KW
37 while (isDIGIT(*s))
38 s++;
39 }
04e98a4d
AD
40 if (*s != '}')
41 return FALSE;
42 return TRUE;
43}
44/*
45 * Local variables:
46 * c-indentation-style: bsd
47 * c-basic-offset: 4
48 * indent-tabs-mode: t
49 * End:
50 *
51 * ex: set ts=8 sts=4 sw=4 noet:
52 */