Improvements to new parser. All functions and completions now parse.

This commit is contained in:
ridiculousfish
2013-07-22 18:26:15 -07:00
parent 77b6b0a9b2
commit 3e3eefc2dc
13 changed files with 1080 additions and 879 deletions

View File

@@ -245,10 +245,10 @@ void parse_util_cmdsubst_extent(const wchar_t *buff, size_t cursor_pos, const wc
const wchar_t * const cursor = buff + cursor_pos;
CHECK(buff,);
const size_t bufflen = wcslen(buff);
assert(cursor_pos <= bufflen);
/* ap and bp are the beginning and end of the tightest command substitition found so far */
const wchar_t *ap = buff, *bp = buff + bufflen;
const wchar_t *pos = buff;
@@ -260,13 +260,13 @@ void parse_util_cmdsubst_extent(const wchar_t *buff, size_t cursor_pos, const wc
/* No subshell found, all done */
break;
}
/* Intrepret NULL to mean the end */
if (end == NULL)
{
end = const_cast<wchar_t *>(buff) + bufflen;
}
if (begin < cursor && end >= cursor)
{
/* This command substitution surrounds the cursor, so it's a tighter fit */
@@ -288,7 +288,7 @@ void parse_util_cmdsubst_extent(const wchar_t *buff, size_t cursor_pos, const wc
assert(pos <= buff + bufflen);
}
}
if (a != NULL) *a = ap;
if (b != NULL) *b = bp;
}