mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:25:11 +00:00
[MOD] Fix quotes a bit
This commit is contained in:
parent
cb0e77e7a4
commit
b7d2ea8a43
3 changed files with 64 additions and 39 deletions
|
|
@ -115,24 +115,28 @@ StrFullRect(char **split)
|
|||
}
|
||||
|
||||
char
|
||||
StrGet(StringRect rect, int line, int col)
|
||||
StrGet(StringRect *rect, int line, int col)
|
||||
{
|
||||
int actual_line, actual_col;
|
||||
char *linep;
|
||||
if (!rect.source_lines)
|
||||
if (!rect || !rect->source_lines)
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
|
||||
actual_line = rect.start_line + line;
|
||||
actual_col = rect.start_char + col;
|
||||
actual_line = rect->start_line + line;
|
||||
actual_col = rect->start_char + col;
|
||||
|
||||
if (actual_line > rect.end_line)
|
||||
if (actual_line > rect->end_line)
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
if (actual_line >= StrLines(rect->source_lines))
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
|
||||
if (!(linep = rect.source_lines[actual_line]))
|
||||
if (!(linep = rect->source_lines[actual_line]))
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
|
|
@ -168,27 +172,34 @@ StrViewChars(StringRect rect, int line)
|
|||
}
|
||||
|
||||
StringRect
|
||||
StrGetl(StringRect rect, int line, bool extend)
|
||||
StrGetl(StringRect *rect, int line, bool extend)
|
||||
{
|
||||
int actual_line;
|
||||
if (!rect.source_lines)
|
||||
StringRect ret;
|
||||
if (!rect->source_lines)
|
||||
{
|
||||
return StrFullRect(NULL);
|
||||
}
|
||||
|
||||
ret = *rect;
|
||||
|
||||
actual_line = rect->start_line + line;
|
||||
|
||||
if (actual_line > rect->end_line)
|
||||
{
|
||||
return StrFullRect(NULL);
|
||||
}
|
||||
if (actual_line >= StrLines(rect->source_lines))
|
||||
{
|
||||
return StrFullRect(NULL);
|
||||
}
|
||||
|
||||
actual_line = rect.start_line + line;
|
||||
|
||||
if (actual_line > rect.end_line)
|
||||
{
|
||||
return StrFullRect(NULL);
|
||||
}
|
||||
|
||||
rect.start_line = actual_line;
|
||||
ret.start_line = actual_line;
|
||||
if (!extend)
|
||||
{
|
||||
rect.end_line = actual_line;
|
||||
ret.end_line = actual_line;
|
||||
}
|
||||
return rect;
|
||||
return ret;
|
||||
}
|
||||
StringRect
|
||||
StrShift(StringRect rect, int n)
|
||||
|
|
@ -229,7 +240,7 @@ PrintRect(StringRect rect)
|
|||
char cbuf[2] = { 0, '\0' };
|
||||
size_t chi = 0;
|
||||
|
||||
while ((*cbuf = StrGet(rect, i, chi)) != '\0' &&
|
||||
while ((*cbuf = StrGet(&rect, i, chi)) != '\0' &&
|
||||
chi++ <= StrViewChars(rect, i))
|
||||
{
|
||||
tmp = line;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue