Fix issue with frontier patterns #3

This commit is contained in:
Enyby
2018-09-16 15:02:29 +03:00
committed by GitHub
parent 12aded74ca
commit 0a5cccc50f

View File

@@ -1075,9 +1075,10 @@ public class StringLib extends TwoArgFunction {
error("Missing [ after %f in pattern"); error("Missing [ after %f in pattern");
} }
int ep = classend( poffset ); int ep = classend( poffset );
int previous = ( soffset == 0 ) ? -1 : s.luaByte( soffset - 1 ); int previous = ( soffset == 0 ) ? '\0' : s.luaByte( soffset - 1 );
int next = ( soffset == s.length() ) ? '\0' : s.luaByte( soffset );
if ( matchbracketclass( previous, poffset, ep - 1 ) || if ( matchbracketclass( previous, poffset, ep - 1 ) ||
matchbracketclass( s.luaByte( soffset ), poffset, ep - 1 ) ) !matchbracketclass( next, poffset, ep - 1 ) )
return -1; return -1;
poffset = ep; poffset = ep;
continue; continue;