Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backwards merging #400

Merged
merged 28 commits into from
Dec 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
93eae2f
Merge pull request #396 from Luthetus/beta
Luthetus Dec 20, 2024
b609d37
Merge pull request #57 from Luthetus/staging
huntercfreeman Dec 20, 2024
73f00dc
Update versions
huntercfreeman Dec 20, 2024
d4edd25
Lex: BangEqualsToken, CloseAngleBracketEqualsToken, OpenAngleBracketE…
huntercfreeman Dec 21, 2024
ba2b3e9
This isn't ambiguous between 'GenericParametersListingNode' and a 'le…
huntercfreeman Dec 21, 2024
a82d09f
Identifiers as binary expression operands is fixed BUT this breaks va…
huntercfreeman Dec 22, 2024
a64cbc2
Fix: variable declaration as a statement with generic parameters
huntercfreeman Dec 22, 2024
d3ae6ea
if (parserModel.TokenWalker.Current.SyntaxKind != SyntaxKind.OpenAngl…
huntercfreeman Dec 22, 2024
afd6846
throw new NotImplementedException();
huntercfreeman Dec 22, 2024
f52118f
Lex: EqualsCloseAngleBracketToken
huntercfreeman Dec 22, 2024
560166c
Fix: EqualsCloseAngleBracketToken wrong cast
huntercfreeman Dec 22, 2024
ec9b3a9
Populate FindAll search if opened while focused on the text editor an…
huntercfreeman Dec 22, 2024
54d5a55
Populate code search with text editor selection if there is one and k…
huntercfreeman Dec 22, 2024
8905b63
FindOverlayDisplay fix bug if already open select then keybind wasn't…
huntercfreeman Dec 22, 2024
df9defa
Update IdeInfoDisplay.razor
huntercfreeman Dec 22, 2024
bed78b9
Show scope of lambda expression
huntercfreeman Dec 23, 2024
683077e
Bind lambda expression variables within its scope
huntercfreeman Dec 23, 2024
153f4ab
SkipLambdaExpressionStatements(...) progress
huntercfreeman Dec 23, 2024
2a497b8
Fix: brace deliminated lambda expressions
huntercfreeman Dec 23, 2024
853ff6a
Fix: is / is not pattern matching 'oldEvent is not RedundantTextEdito…
huntercfreeman Dec 23, 2024
0687eb5
Fix: 'out' syntax
huntercfreeman Dec 23, 2024
26a63a3
DiscardSymbol
huntercfreeman Dec 23, 2024
b166a53
Expression discard
huntercfreeman Dec 23, 2024
78df264
isQuestionMarkMemberAccessToken
huntercfreeman Dec 23, 2024
8c9ce4b
Merge pull request #397 from huntercfreeman/optimizations
Luthetus Dec 23, 2024
1c58eb0
Update IdeInfoDisplay.razor
huntercfreeman Dec 23, 2024
23e3a95
Merge pull request #398 from huntercfreeman/optimizations
Luthetus Dec 23, 2024
8c7a292
Merge pull request #399 from Luthetus/staging
Luthetus Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SkipLambdaExpressionStatements(...) progress
  • Loading branch information
huntercfreeman committed Dec 23, 2024
commit 153f4ab034bda98823208dd86d698d9b4a7b3ffa
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ public IExpressionNode AmbiguousIdentifierMergeToken(
{
parserModel.ExpressionList.Add((SyntaxKind.CloseBraceToken, lambdaExpressionNode));
OpenLambdaExpressionScope(lambdaExpressionNode, (OpenBraceToken)parserModel.TokenWalker.Next, compilationUnit, ref parserModel);
SkipLambdaExpressionStatements(lambdaExpressionNode, compilationUnit, ref parserModel);
}
else
{
Expand Down Expand Up @@ -1864,4 +1865,54 @@ public void CloseLambdaExpressionScope(LambdaExpressionNode lambdaExpressionNode

compilationUnit.Binder.CloseScope(closeBraceToken.TextSpan, compilationUnit, ref parserModel);
}

/// <summary>
/// TODO: Parse the lambda expression's statements...
/// ...This sounds quite complicated because we went
/// from the statement-loop to the expression-loop
/// and now have to run the statement-loop again
/// but not lose the state of any active loops.
/// For now skip tokens until the close brace token is matched in order to
/// preserve the other features of the text editor.
/// (rather than lambda expression statements clobbering the entire syntax highlighting of the file).
/// </summary>
public void SkipLambdaExpressionStatements(LambdaExpressionNode lambdaExpressionNode, CSharpCompilationUnit compilationUnit, ref CSharpParserModel parserModel)
{
#if DEBUG
parserModel.TokenWalker.SuppressProtectedSyntaxKindConsumption = true;
#endif

parserModel.TokenWalker.Consume(); // Skip the EqualsCloseAngleBracketToken

var openBraceToken = (OpenBraceToken)parserModel.TokenWalker.Consume();

var openBraceCounter = 1;

while (true)
{
if (parserModel.TokenWalker.IsEof)
break;

if (parserModel.TokenWalker.Current.SyntaxKind == SyntaxKind.OpenBraceToken)
{
++openBraceCounter;
}
else if (parserModel.TokenWalker.Current.SyntaxKind == SyntaxKind.CloseBraceToken)
{
if (--openBraceCounter <= 0)
break;
}

_ = parserModel.TokenWalker.Consume();
}

CloseLambdaExpressionScope(lambdaExpressionNode, compilationUnit, ref parserModel);

var closeTokenIndex = parserModel.TokenWalker.Index;
var closeBraceToken = (CloseBraceToken)parserModel.TokenWalker.Match(SyntaxKind.CloseBraceToken);

#if DEBUG
parserModel.TokenWalker.SuppressProtectedSyntaxKindConsumption = false;
#endif
}
}