示例#1
0
String highlight_code(CStrRef source, int line /* = 0 */,
                      int lineFocus0 /* = 0 */, int charFocus0 /* = 0 */,
                      int lineFocus1 /* = 0 */, int charFocus1 /* = 0 */) {
  String prepended = "<?php\n";
  prepended += source;
  String highlighted = highlight_php(prepended, line, lineFocus0, charFocus0,
                                     lineFocus1, charFocus1);
  int pos = highlighted.find("\n");
  return highlighted.substr(pos + 1);
}
示例#2
0
文件: cmd_list.cpp 项目: bd808/hhvm
// If there is no current file, print the desired range of eval code
// or give an error message if the debugger is not currently performing
// an eval command.
void CmdList::listEvalCode(DebuggerClient &client) {
  assert(m_file.empty());

  std::string evalCode = client.getCode();
  if (evalCode.empty()) {
    client.error("There is no current source file.");
  } else {
    client.print(highlight_php(evalCode));
  }
}