Skip to content

Commit

Permalink
Merge pull request #1 from ivarne/methods2
Browse files Browse the repository at this point in the history
Added support for method(\t syntax for operators
  • Loading branch information
simonster committed Sep 26, 2013
2 parents ad4b77c + 3315f19 commit 25becac
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions ui/repl-readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,24 @@ int complete_method_table() {
// extract the token preceding the (
int tokenstart = rl_point-2;

while (tokenstart>=0 && (jl_word_char(rl_line_buffer[tokenstart]) ||
rl_line_buffer[tokenstart] == '!')) {
tokenstart--;
// check for special operators
if (strchr("\\><=|&+-*/%^~", rl_line_buffer[tokenstart])){
while (tokenstart>0 && strchr("<>=!", rl_line_buffer[tokenstart-1])){
tokenstart--;
}
}
else{
// check for functions that might contain ! but not start with !
while (tokenstart>=0 && (jl_word_char(rl_line_buffer[tokenstart]) ||
rl_line_buffer[tokenstart] == '!')) {
tokenstart--;
}
tokenstart++;
// ! can't be the first character of a function, unless it's the only character
if (tokenstart != rl_point-2 && rl_line_buffer[tokenstart] == '!'){
tokenstart ++;
}
}
tokenstart++;
tokenstart += rl_line_buffer[tokenstart] == '!';

jl_value_t* result = call_jl_function_with_string("repl_methods",
&rl_line_buffer[tokenstart],
Expand Down

0 comments on commit 25becac

Please sign in to comment.