def replace_vars(m):
 var = m.group(1)
 default = m.group(2)
 if (not re.match('\\w+$', var)):
  raise UnsupportedVariableExpression(var)
 translate_vars = {'TM_PHP_OPEN_TAG_WITH_ECHO': 'g:UltiSnipsOpenTagWithEcho', 'TM_PHP_OPEN_TAG': 'g:UltiSnipsOpenTag', 'PHPDOC_AUTHOR': 'g:snips_author'}
 if (var in translate_vars):
  newvar = translate_vars[var]
 else:
  raise UnknownVariable(var)
 return ("`!v exists('%s') ? %s : '%s'`" % (newvar, newvar, default))

def replace_vars ( m ) : var = m . group ( 1 ) default = m . group ( 2 ) if ( not re . match ( '\\w+$' , var ) ) : raise UnsupportedVariableExpression ( var ) translate_vars = { 'TM_PHP_OPEN_TAG_WITH_ECHO' : 'g:UltiSnipsOpenTagWithEcho' , 'TM_PHP_OPEN_TAG' : 'g:UltiSnipsOpenTag' , 'PHPDOC_AUTHOR' : 'g:snips_author' } if ( var in translate_vars ) : newvar = translate_vars [ var ] else : raise UnknownVariable ( var ) return ( "`!v exists('%s') ? %s : '%s'`" % ( newvar , newvar , default ) )
replace vars in content portion .