Skip to content

Commit

Permalink
Merge pull request #197 from microsoft/hediet/respective-bedbug
Browse files Browse the repository at this point in the history
Resolved conversations from PR.
  • Loading branch information
hediet authored Feb 15, 2023
2 parents 6260f71 + 5c3f08b commit e5658be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions src/grammar/grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export class Grammar implements IGrammar, IRuleFactoryHelper, IOnigLib {
this,
this._grammar.repository
);
// This ensures ids are deterministic, and thus equal in renderer and webworker.
this.getInjections();
}

Expand Down Expand Up @@ -461,7 +462,7 @@ export class AttributedScopeStack {
}

public toString() {
return this.getScopeNames().join('.');
return this.getScopeNames().join(' ');
}

public equals(other: AttributedScopeStack): boolean {
Expand Down Expand Up @@ -599,8 +600,8 @@ export class StateStackImpl implements StateStack {
0,
false,
null,
null!,
null!
null,
null
);

/**
Expand Down Expand Up @@ -799,10 +800,9 @@ export class StateStackImpl implements StateStack {
outIndex = this.parent._writeString(res, outIndex);
}

// TODO@alexdima why is this "TODO-"?
res[
outIndex++
] = `(${this.ruleId}, TODO-${this.nameScopesList?.toString()}, TODO-${this.contentNameScopesList?.toString()})`;
] = `(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`;

return outIndex;
}
Expand Down Expand Up @@ -855,8 +855,6 @@ export class StateStackImpl implements StateStack {
public toStateStackFrame(): StateStackFrame {
return {
ruleId: ruleIdToNumber(this.ruleId),
enterPos: this._enterPos,
anchorPos: this._anchorPos,
beginRuleCapturedEOL: this.beginRuleCapturedEOL,
endRule: this.endRule,
nameScopesList: this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList ?? null)! ?? [],
Expand All @@ -869,8 +867,8 @@ export class StateStackImpl implements StateStack {
return new StateStackImpl(
self,
ruleIdFromNumber(frame.ruleId),
frame.enterPos,
frame.anchorPos,
frame.enterPos ?? -1,
frame.anchorPos ?? -1,
frame.beginRuleCapturedEOL,
frame.endRule,
namesScopeList,
Expand All @@ -881,8 +879,8 @@ export class StateStackImpl implements StateStack {

export interface StateStackFrame {
ruleId: number;
enterPos: number;
anchorPos: number;
enterPos?: number;
anchorPos?: number;
beginRuleCapturedEOL: boolean;
endRule: string | null;
nameScopesList: AttributedScopeStackFrame[];
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/

import { BalancedBracketSelectors, StateStackFrame, StateStackImpl as StackElementImpl } from './grammar';
import { BalancedBracketSelectors, StateStackImpl as StackElementImpl } from './grammar';
import * as grammarReader from './parseRawGrammar';
import { IOnigLib } from './onigLib';
import { IRawGrammar } from './rawGrammar';
Expand Down

0 comments on commit e5658be

Please sign in to comment.