30 #include <readline/readline.h>
31 #include <readline/history.h>
41 #if RL_READLINE_VERSION >= 0x0500
42 #define completion_matches rl_completion_matches
61 static char** AttemptedCompletion(
const char* text,
int start,
int end);
62 static char* CompletionGenerator(
const char* text,
int state);
63 static char kWordBreakCharacters[];
68 char ReadLineEditor::kWordBreakCharacters[] = {
' ',
'\t',
'\n',
'"',
69 '\\',
'\'',
'`',
'@',
'.',
'>',
'<',
'=',
';',
'|',
'&',
'{',
'(',
79 rl_attempted_completion_function = AttemptedCompletion;
80 rl_completer_word_break_characters = kWordBreakCharacters;
81 rl_bind_key(
'\t', rl_complete);
97 result = readline(prompt);
110 if (strlen(str) == 0)
return;
112 history_set_pos(history_length-1);
113 if (current_history()) {
115 if (strcmp(current_history()->line, str) == 0) {
116 remove_history(where_history());
119 }
while (previous_history());
125 char** ReadLineEditor::AttemptedCompletion(
const char* text,
128 char** result = completion_matches(text, CompletionGenerator);
129 rl_attempted_completion_over =
true;
134 char* ReadLineEditor::CompletionGenerator(
const char* text,
int state) {
135 static unsigned current_index;
136 static Persistent<Array> current_completions;
139 Local<String> full_text =
String::New(rl_line_buffer, rl_point);
140 Handle<Array> completions =
145 if (current_index < current_completions->Length()) {
148 Handle<Value> str_obj = current_completions->Get(index);
150 String::Utf8Value str(str_obj);
153 current_completions.Dispose();
154 current_completions.Clear();
static Isolate * GetCurrent()
static Handle< Array > GetCompletions(Handle< String > text, Handle< String > full)
virtual void AddHistory(const char *str)
static V8EXPORT Local< String > New(const char *data, int length=-1)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
static const char * kHistoryFileName
virtual Handle< String > Prompt(const char *prompt)
static Persistent< T > New(Handle< T > that)
static const int kMaxHistoryEntries
static V8EXPORT Local< Integer > New(int32_t value)