mirror of https://gitlab.com/basile.b/dexed.git
dastworx, upstream fix, patch AST error for pascal streaming
This commit is contained in:
parent
94e5e8c81a
commit
736c4bb5b2
|
@ -193,31 +193,52 @@ private void fillBadVersions()
|
|||
/**
|
||||
* Make a D string compatible with an Object Pascal string literal.
|
||||
*/
|
||||
string patchPascalString(string value)
|
||||
string patchPascalString(size_t lenLimit = 0)(string value)
|
||||
{
|
||||
Appender!string app;
|
||||
app.reserve(value.length);
|
||||
static if (lenLimit)
|
||||
const size_t len = value.length > 100 ? 100 : value.length;
|
||||
else
|
||||
const size_t len = value.length;
|
||||
app.reserve(len);
|
||||
bool skip;
|
||||
foreach (immutable i; 0..value.length)
|
||||
L: foreach (immutable i; 0..value.length)
|
||||
{
|
||||
const char c = value[i];
|
||||
if (c > 0x7F)
|
||||
switch (c)
|
||||
{
|
||||
app ~= value[i];
|
||||
skip = true;
|
||||
}
|
||||
else if (c == '\'')
|
||||
{
|
||||
if (skip)
|
||||
case 0x80: .. case 0xFF:
|
||||
{
|
||||
app ~= value[i];
|
||||
else
|
||||
app ~= "'#39'";
|
||||
skip = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
app ~= value[i];
|
||||
skip = false;
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
case '\'':
|
||||
{
|
||||
if (skip)
|
||||
app ~= value[i];
|
||||
else
|
||||
app ~= "'#39'";
|
||||
skip = false;
|
||||
break;
|
||||
}
|
||||
case '\r': case '\n':
|
||||
{
|
||||
if (skip)
|
||||
app ~= value[i];
|
||||
else
|
||||
app ~= "'#10'";
|
||||
skip = false;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
app ~= value[i];
|
||||
skip = false;
|
||||
static if (lenLimit)
|
||||
if (app.data.length >= len)
|
||||
break L;
|
||||
}
|
||||
}
|
||||
}
|
||||
return app.data;
|
||||
|
|
|
@ -104,7 +104,7 @@ class SymbolListBuilder(ListFmt Fmt): ASTVisitor
|
|||
pasStream.put("\ritem\r");
|
||||
pasStream.put(format("line=%d\r", error.line));
|
||||
pasStream.put(format("col=%d\r", error.column));
|
||||
pasStream.put(format("name='%s'\r", patchPascalString(error.message)));
|
||||
pasStream.put(format("name='%s'\r", patchPascalString!100(error.message)));
|
||||
pasStream.put(format("symType=%s\r", type));
|
||||
pasStream.put("end");
|
||||
}
|
||||
|
|
|
@ -482,6 +482,10 @@ procedure TCETodoListWidget.toolTerminated(Sender: TObject);
|
|||
begin
|
||||
fToolProc.OutputStack.Position := 0;
|
||||
fTodos.loadFromTxtStream(fToolProc.OutputStack);
|
||||
|
||||
// TODO-cmaintenance: remove this from version 3 gold
|
||||
tryRaiseFromStdErr(fToolProc);
|
||||
|
||||
fillTodoList;
|
||||
fToolProc.OnTerminate := nil;
|
||||
end;
|
||||
|
|
Loading…
Reference in New Issue