Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if ( Terminal.osc[ num ] ) { Terminal.osc[ num ].call( this , sequence.slice( index + 1 ) ) ; }
else { console.error( 'Not implemented: OSC "' + num + '" (sequence: ' + sequence.slice( index + 1 ) + '")' ) ; }
}
else
{
console.log( "Trouble: NaN!" ) ;
}
}
return sequence.length + 2 + ( chunk[ i ] === 0x07 ? 1 : 2 ) ; // ESC + ] + sequence + Bell/ST
}
sequence += char ;
}
console.log( "Trouble: " + string.escape.control( chunk.toString() ) ) ;
// We should never reach here, except if the buffer was too short
return null ;
} ;
break ;
}
else if ( this.rKeymapStarter[ i ] && this.rKeymapStarter[ i ][ keymapStartCode ] ) {
// Then test pattern sequences
keymapList = this.rKeymapStarter[ i ][ keymapStartCode ] ;
//console.log( 'for i:' , keymapList ) ;
for ( j = 0 ; j < keymapList.length ; j ++ ) {
keymap = keymapList[ j ] ;
if ( keymap.altEnder ) {
regexp = '^' +
string.escape.regExp( keymap.starter ) +
'([ -~]*)' + // [ -~] match only all ASCII non-control character
'(' + string.escape.regExp( keymap.ender ) + '|' + string.escape.regExp( keymap.altEnder ) + ')' ;
}
else {
regexp = '^' +
string.escape.regExp( keymap.starter ) +
'([ -~]*)' + // [ -~] match only all ASCII non-control character
string.escape.regExp( keymap.ender ) ;
}
matches = keymapCode.match( new RegExp( regexp ) , 'g' ) ;
//console.log( 'for j:' , keymap , regexp , matches ) ;
if ( matches ) {
found = true ;
}
else if ( this.rKeymapStarter[ i ] && this.rKeymapStarter[ i ][ keymapStartCode ] ) {
// Then test pattern sequences
keymapList = this.rKeymapStarter[ i ][ keymapStartCode ] ;
//console.log( 'for i:' , keymapList ) ;
for ( j = 0 ; j < keymapList.length ; j ++ ) {
keymap = keymapList[ j ] ;
if ( keymap.altEnder ) {
regexp = '^' +
string.escape.regExp( keymap.starter ) +
'([ -~]*)' + // [ -~] match only all ASCII non-control character
'(' + string.escape.regExp( keymap.ender ) + '|' + string.escape.regExp( keymap.altEnder ) + ')' ;
}
else {
regexp = '^' +
string.escape.regExp( keymap.starter ) +
'([ -~]*)' + // [ -~] match only all ASCII non-control character
string.escape.regExp( keymap.ender ) ;
}
matches = keymapCode.match( new RegExp( regexp ) , 'g' ) ;
//console.log( 'for j:' , keymap , regexp , matches ) ;
if ( matches ) {
found = true ;
handlerResult = keymap.handler.call( this , keymap.name , matches[ 1 ] ) ;
builtin.RegExp = function regex( v ) {
var str , delimiter , escDelimiter , fixDelimiterRegex ;
delimiter = v.delimiter || '/' ;
escDelimiter = string.escape.regExp( delimiter ) ;
fixDelimiterRegex = new RegExp( escDelimiter , 'g' ) ;
str = delimiter + v.source.replace( fixDelimiterRegex , '\\$&' ) ;
if ( typeof v.substitution === 'string' ) {
str += delimiter + v.substitution.replace( fixDelimiterRegex , '\\$&' ) ;
}
str += delimiter ;
if ( v.global ) { str += 'g' ; }
if ( v.ignoreCase ) { str += 'i' ; }
if ( v.multiline ) { str += 'm' ; }
return str ;
} ;
builtin.Regex = builtin.regex = builtin.RegExp = builtin.Regexp = builtin.regexp = v => {
var delimiter , escDelimiter , partRegex , fixDelimiterRegex , match ;
//var regex_ ;
if ( ! v || typeof v !== 'string' ) { throw new SyntaxError( "Bad Regular Expression: not a string or empty string" ) ; }
delimiter = v[ 0 ] ;
escDelimiter = string.escape.regExp( delimiter ) ;
try {
partRegex = new RegExp(
"^" + escDelimiter + "((?:\\\\" + escDelimiter + "|[^" + escDelimiter + "])+)" +
"(?:" + escDelimiter + "((?:\\\\" + escDelimiter + "|[^" + escDelimiter + "])+))?" +
escDelimiter + "([a-z])*$"
) ;
fixDelimiterRegex = new RegExp( "\\\\(" + escDelimiter + ")" , 'g' ) ;
match = v.match( partRegex ) ;
}
catch ( error ) {
throw new SyntaxError( "Bad Regular Expression: " + v ) ;
}