Fixing pretty print ast. adding a few more builtins :( getting further with inspector
This commit is contained in:
parent
30234875fe
commit
8bc05efa1e
9 changed files with 272 additions and 82 deletions
|
|
@ -51,8 +51,14 @@ export const _rt = {
|
|||
rerender: { _tag: 'Rerender' },
|
||||
focus: (key: string) => ({ _tag: 'Focus', _0: key }),
|
||||
|
||||
len: (list: any[]) => list.length,
|
||||
nth: (i: number) => (xs: any[] | string) => i >= 0 && i < xs.length
|
||||
? { _tag: 'Some', _0: xs[i] }
|
||||
: { _tag: 'None' },
|
||||
len: (xs: any[] | string) => xs.length,
|
||||
str: (x: any) => String(x),
|
||||
chars: (s: string) => s.split(''),
|
||||
join: (delim: string) => (xs: string[]) => xs.join(delim),
|
||||
split: (delim: string) => (xs: string) => xs.split(delim),
|
||||
slice: (s: string | any[]) => (start: number) => (end: number) => s.slice(start, end),
|
||||
debug: (label: string) => (value: any) => { console.log(label, value); return value; },
|
||||
fuzzyMatch: (query: string) => (target: string) => {
|
||||
|
|
@ -70,7 +76,8 @@ export const _rt = {
|
|||
getSource: (name: string) => {
|
||||
const ast = definitions.get(name);
|
||||
if (!ast) return "";
|
||||
return prettyPrint(ast);
|
||||
const printed = prettyPrint(ast);
|
||||
return printed;
|
||||
},
|
||||
rebind: (name: string, pathOrValue: any, maybeValue?: any) => {
|
||||
if (maybeValue === undefined) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue