MCPcopy Create free account
hub / github.com/SpartanJ/eepp / matchbracketclass

Function matchbracketclass

src/eepp/system/lua-str.cpp:152–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152static int matchbracketclass( int c, const char* p, const char* ec ) {
153 int sig = 1;
154 if ( *( p + 1 ) == '^' ) {
155 sig = 0;
156 p++; /* skip the `^' */
157 }
158 while ( ++p < ec ) {
159 if ( *p == L_ESC ) {
160 p++;
161 if ( match_class( c, uchar( *p ) ) )
162 return sig;
163 } else if ( ( *( p + 1 ) == '-' ) && ( p + 2 < ec ) ) {
164 p += 2;
165 if ( uchar( *( p - 2 ) ) <= c && c <= uchar( *p ) )
166 return sig;
167 } else if ( uchar( *p ) == c )
168 return sig;
169 }
170 return !sig;
171}
172
173static int singlematch( MatchState* ms, const char* s, const char* p, const char* ep ) {
174 if ( s >= ms->src_end )

Callers 2

singlematchFunction · 0.85
matchFunction · 0.85

Calls 1

match_classFunction · 0.85

Tested by

no test coverage detected