Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for method(\t syntax for operators #1

Merged
merged 4 commits into from
Sep 26, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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