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)
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)
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 use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra 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 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL