fix: adaptive highlighting
- transpiler now uses m function with globalOffset - patternifyAST now accepts global offset - patternifyAST now calls .withLoc with global leaf location - .withLoc replaces .withLocation + .withMiniLocation - simple locs (offsets) are now used everywhere - some tests fail, seems some haps have reordered... - wip: Repl still uses hardcoded updateMiniLocations - todo: find way to call updateMiniLocations dynamically
This commit is contained in:
parent
08abec8fd5
commit
0b5d905120
9 changed files with 108 additions and 110 deletions
|
|
@ -472,6 +472,25 @@ export class Pattern {
|
|||
/**
|
||||
* Returns a new pattern with the given location information added to the
|
||||
* context of every hap.
|
||||
* @param {Number} start start offset
|
||||
* @param {Number} end end offset
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
*/
|
||||
withLoc(start, end) {
|
||||
const location = {
|
||||
start,
|
||||
end,
|
||||
};
|
||||
return this.withContext((context) => {
|
||||
const locations = (context.locations || []).concat([location]);
|
||||
return { ...context, locations };
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated: Returns a new pattern with the given location information added to the
|
||||
* context of every hap.
|
||||
* @param {Number} start
|
||||
* @param {Number} end
|
||||
* @returns Pattern
|
||||
|
|
@ -488,6 +507,7 @@ export class Pattern {
|
|||
});
|
||||
}
|
||||
|
||||
// DEPRECATED:
|
||||
withMiniLocation(start, end) {
|
||||
const offset = {
|
||||
start: { line: start[0], column: start[1], offset: start[2] },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue