def language_callback(lexer, match):
 l = None
 m = language_re.match(lexer.text[match.end():(match.end() + 100)])
 if (m is not None):
  l = lexer._get_lexer(m.group(1))
 else:
  m = list(language_re.finditer(lexer.text[max(0, (match.start() - 100)):match.start()]))
  if m:
   l = lexer._get_lexer(m[(-1)].group(1))
 if l:
  (yield (match.start(1), String, match.group(1)))
  for x in l.get_tokens_unprocessed(match.group(2)):
   (yield x)
  (yield (match.start(3), String, match.group(3)))
 else:
  (yield (match.start(), String, match.group()))

def language_callback ( lexer , match ) : l = None m = language_re . match ( lexer . text [ match . end ( ) : ( match . end ( ) + 100 ) ] ) if ( m is not None ) : l = lexer . _get_lexer ( m . group ( 1 ) ) else : m = list ( language_re . finditer ( lexer . text [ max ( 0 , ( match . start ( ) - 100 ) ) : match . start ( ) ] ) ) if m : l = lexer . _get_lexer ( m [ ( - 1 ) ] . group ( 1 ) ) if l : ( yield ( match . start ( 1 ) , String , match . group ( 1 ) ) ) for x in l . get_tokens_unprocessed ( match . group ( 2 ) ) : ( yield x ) ( yield ( match . start ( 3 ) , String , match . group ( 3 ) ) ) else : ( yield ( match . start ( ) , String , match . group ( ) ) )
parse the content of a $-string using a lexer the lexer is chosen looking for a nearby language .