mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add support for here-string
This commit is contained in:
@@ -177,6 +177,11 @@ OPTIONS
|
||||
/// </summary>
|
||||
private string partialLine = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// To keep track of here-strings
|
||||
/// </summary>
|
||||
private bool hereString = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the host application
|
||||
/// should exit.
|
||||
@@ -391,15 +396,24 @@ OPTIONS
|
||||
catch (IncompleteParseException e)
|
||||
{
|
||||
incompleteLine = true;
|
||||
cmd = cmd.Trim();
|
||||
partialLine += cmd;
|
||||
|
||||
while (partialLine[partialLine.Length - 1] == '`')
|
||||
{
|
||||
Console.WriteLine("Trimming...");
|
||||
partialLine = partialLine.Remove(partialLine.Length - 1);
|
||||
}
|
||||
|
||||
partialLine += " ";
|
||||
if (hereString || cmd.EndsWith("@\"") || cmd.EndsWith("@\'"))
|
||||
{
|
||||
hereString = true;
|
||||
|
||||
partialLine += System.Environment.NewLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (partialLine[partialLine.Length - 1] == '`')
|
||||
{
|
||||
partialLine = partialLine.Remove(partialLine.Length - 1);
|
||||
}
|
||||
|
||||
partialLine += " ";
|
||||
}
|
||||
}
|
||||
|
||||
finally
|
||||
@@ -416,6 +430,7 @@ OPTIONS
|
||||
if (!incompleteLine)
|
||||
{
|
||||
partialLine = string.Empty;
|
||||
hereString = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user