throw new Exception("Line #{$line_no} of input is invalid. Expected five or six " . "space-delimited fields: maybe symbol context, symbol name, symbol " . "type, symbol language, line number, path. " . "For example:\n\n" . "idx function php 13 /path/to/some/file.php\n\n" . "Actual line was:\n\n" . "{$line}"); } if (empty($matches['context'])) { $matches['context'] = ''; } $context = $matches['context']; $name = $matches['name']; $type = $matches['type']; $lang = $matches['lang']; $line_number = $matches['line']; $path = $matches['path']; check_string_value($context, 'Symbol context', $line_no, 128); check_string_value($name, 'Symbol name', $line_no, 128); check_string_value($type, 'Symbol type', $line_no, 12); check_string_value($lang, 'Symbol language', $line_no, 32); check_string_value($path, 'Path', $line_no, 512); if (!strlen($path) || $path[0] != '/') { throw new Exception("Path '{$path}' defined on line #{$line_no} is invalid. Paths should " . "begin with '/' and specify a path from the root of the project, like " . "'/src/utils/utils.php'."); } $symbols[] = array('ctxt' => $context, 'name' => $name, 'type' => $type, 'lang' => $lang, 'line' => $line_number, 'path' => $path); } catch (Exception $e) { if ($args->getArg('ignore-errors')) { continue; } else { throw $e; } } if (count($symbols) >= $args->getArg('max-transaction')) { try { echo "Committing {$args->getArg('max-transaction')} symbols....\n"; commit_symbols($symbols, $project, $no_purge);
throw new Exception(pht("Line #%d of input is invalid. Expected five or six space-delimited " . "fields: maybe symbol context, symbol name, symbol type, symbol " . "language, line number, path. For example:\n\n%s\n\n" . "Actual line was:\n\n%s", $line_no, 'idx function php 13 /path/to/some/file.php', $line)); } if (empty($matches['context'])) { $matches['context'] = ''; } $context = $matches['context']; $name = $matches['name']; $type = $matches['type']; $lang = $matches['lang']; $line_number = $matches['line']; $path = $matches['path']; check_string_value($context, pht('Symbol context'), $line_no, 128); check_string_value($name, pht('Symbol name'), $line_no, 128); check_string_value($type, pht('Symbol type'), $line_no, 12); check_string_value($lang, pht('Symbol language'), $line_no, 32); check_string_value($path, pht('Path'), $line_no, 512); if (!strlen($path) || $path[0] != '/') { throw new Exception(pht("Path '%s' defined on line #%d is invalid. Paths should begin with " . "'%s' and specify a path from the root of the project, like '%s'.", $path, $line_no, '/', '/src/utils/utils.php')); } $symbols[] = array('ctxt' => $context, 'name' => $name, 'type' => $type, 'lang' => $lang, 'line' => $line_number, 'path' => $path); } catch (Exception $e) { if ($args->getArg('ignore-errors')) { continue; } else { throw $e; } } if (count($symbols) >= $args->getArg('max-transaction')) { try { echo pht("Committing %s symbols...\n", new PhutilNumber($args->getArg('max-transaction'))); commit_symbols($symbols, $repository, $no_purge);