virtual tokens between cursor
This commit is contained in:
+29
-20
@@ -580,7 +580,31 @@ abstract class Cpp2BeefGenerator
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
for (let token in tokens)
|
for (let token in tokens)
|
||||||
{
|
{
|
||||||
bool isWritingQueuedToken = false;
|
if (!FilterTokensBetweenCursors(token, let isWritingQueuedToken))
|
||||||
|
continue;
|
||||||
|
if (isWritingQueuedToken && fileInfo.queuedTokens == .None)
|
||||||
|
block = @block;
|
||||||
|
let location = Clang.GetTokenLocation(unit, token);
|
||||||
|
Clang.GetFileLocation(location, ?, let startLine, ?, ?);
|
||||||
|
WriteLinesUntil!(startLine, location);
|
||||||
|
if (!isWritingQueuedToken)
|
||||||
|
{
|
||||||
|
if (first) Block();
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
WriteToken(token);
|
||||||
|
for (let c in GetTokenSpelling!(token))
|
||||||
|
if (c == '\n')
|
||||||
|
line++;
|
||||||
|
Flush();
|
||||||
|
}
|
||||||
|
WriteLinesUntil!(curLine, writeUntil);
|
||||||
|
if (@block.HasValue) WriteBlock(@block.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual bool FilterTokensBetweenCursors(CXToken token, out bool isWritingQueuedToken)
|
||||||
|
{
|
||||||
|
isWritingQueuedToken = false;
|
||||||
switch (Clang.GetTokenKind(token))
|
switch (Clang.GetTokenKind(token))
|
||||||
{
|
{
|
||||||
case .Comment:
|
case .Comment:
|
||||||
@@ -599,26 +623,11 @@ abstract class Cpp2BeefGenerator
|
|||||||
if (!fileInfo.queuedTokens.HasFlag(.RSquirly))
|
if (!fileInfo.queuedTokens.HasFlag(.RSquirly))
|
||||||
QueuedToken!(decltype(fileInfo.queuedTokens).Semicolon, ";");
|
QueuedToken!(decltype(fileInfo.queuedTokens).Semicolon, ";");
|
||||||
|
|
||||||
if (!isWritingQueuedToken) continue;
|
if (!isWritingQueuedToken) return false;
|
||||||
if (fileInfo.queuedTokens == .None) block = @block;
|
default:
|
||||||
default: continue;
|
return false;
|
||||||
}
|
}
|
||||||
let location = Clang.GetTokenLocation(unit, token);
|
return true;
|
||||||
Clang.GetFileLocation(location, ?, let startLine, ?, ?);
|
|
||||||
WriteLinesUntil!(startLine, location);
|
|
||||||
if (!isWritingQueuedToken)
|
|
||||||
{
|
|
||||||
if (first) Block();
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
WriteToken(token);
|
|
||||||
for (let c in GetTokenSpelling!(token))
|
|
||||||
if (c == '\n')
|
|
||||||
line++;
|
|
||||||
Flush();
|
|
||||||
}
|
|
||||||
WriteLinesUntil!(curLine, writeUntil);
|
|
||||||
if (@block.HasValue) WriteBlock(@block.Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected enum TypeParamMode { None, InParam, OutParam }
|
protected enum TypeParamMode { None, InParam, OutParam }
|
||||||
|
|||||||
Reference in New Issue
Block a user