started mini notation highlighting
currently deactivated by addMiniLocations flag
This commit is contained in:
parent
358ba0101e
commit
acd07c31ff
5 changed files with 75 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import * as krill from '../krill-parser';
|
||||
import * as strudel from '../../strudel.mjs';
|
||||
import { Scale, Note, Interval } from '@tonaljs/tonal';
|
||||
import { addMiniLocations } from './shapeshifter';
|
||||
|
||||
const { pure, Pattern, Fraction, stack, slowcat, sequence, timeCat, silence } = strudel;
|
||||
|
||||
|
|
@ -91,7 +92,18 @@ export function patternifyAST(ast: any): any {
|
|||
return silence;
|
||||
}
|
||||
if (typeof ast.source_ !== 'object') {
|
||||
return ast.source_;
|
||||
if (!addMiniLocations) {
|
||||
return ast.source_;
|
||||
}
|
||||
if (!ast.location_) {
|
||||
console.warn('no location for', ast);
|
||||
return ast.source_;
|
||||
}
|
||||
const { start, end } = ast.location_;
|
||||
// return ast.source_;
|
||||
// the following line expects the shapeshifter to wrap this in withLocationOffset
|
||||
// because location_ is only relative to the mini string, but we need it relative to whole code
|
||||
return pure(ast.source_).withLocation({ start, end });
|
||||
}
|
||||
return patternifyAST(ast.source_);
|
||||
case 'stretch':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue