Skip to content

Commit

Permalink
backport upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Feb 27, 2023
1 parent 68c81be commit 861eada
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public final class StateStack implements IStateStack {
@NonNullByDefault({}) // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/233
record Frame(
RuleId ruleId,
int enterPos,
int anchorPos,
@Nullable Integer enterPos,
@Nullable Integer anchorPos,
boolean beginRuleCapturedEOL,
@Nullable String endRule,
List<AttributedScopeStack.Frame> nameScopesList,
Expand Down Expand Up @@ -263,8 +263,7 @@ private void _writeString(final List<String> res) {
if (parent != null) {
parent._writeString(res);
}
// , TODO-${this.nameScopesList}, TODO-${this.contentNameScopesList})`;
res.add("(" + ruleId + ")");
res.add("(" + ruleId + ", " + this.nameScopesList + ", " + this.contentNameScopesList + ")");
}

StateStack withContentNameScopesList(final @Nullable AttributedScopeStack contentNameScopesList) {
Expand Down Expand Up @@ -315,8 +314,8 @@ public Frame toStateStackFrame() {
final var parent = this.parent;
return new Frame(
this.ruleId,
this._enterPos,
this._anchorPos,
null,
null,
this.beginRuleCapturedEOL,
this.endRule,
nameScopesList != null
Expand All @@ -330,11 +329,13 @@ public Frame toStateStackFrame() {
public static StateStack pushFrame(@Nullable final StateStack self, final Frame frame) {
final var namesScopeList = AttributedScopeStack.fromExtension(self == null ? null : self.nameScopesList,
frame.nameScopesList);
final var enterPos = frame.enterPos;
final var anchorPos = frame.anchorPos;
return new StateStack(
self,
frame.ruleId,
frame.enterPos,
frame.anchorPos,
enterPos == null ? -1 : enterPos,
anchorPos == null ? -1 : anchorPos,
frame.beginRuleCapturedEOL,
frame.endRule,
namesScopeList,
Expand Down

0 comments on commit 861eada

Please sign in to comment.