still don't have modules. instead will load all source in /cg/ dir, in alpha filename order

master
Dustin Swan 3 weeks ago
parent 0deb8f6307
commit 559191c65e
Signed by: dustinswan
GPG Key ID: 30D46587E2100467

@ -23,7 +23,7 @@ flattened = flatten [[1, 2, 3], [4, 5, 6]];
contains3 = contains 3 list;
findEven = find isEven list;
{
stdlibTestResult = {
filtered = filtered,
summed = summed,
listLen = listLen,
@ -40,4 +40,4 @@ findEven = find isEven list;
flattened = flattened,
contains3 = contains3,
findEven = findEven
}
};

@ -1,46 +0,0 @@
init = {};
testApp = {
email = "",
password = "",
combinedText = email & " " & password
};
update = state event \ event
| _ \ state;
view = state viewport \
Positioned {
x = 30,
y = 30,
child = Column {
gap = 10,
children = [
textInput {
key = "email",
initialValue = testApp.email,
initialFocus = True,
w = 300,
h = 40,
onChange = text \ testApp.email := text
},
textInput {
key = "password",
initialValue = testApp.password,
initialFocus = False,
w = 300,
h = 40,
onChange = text \ testApp.password := text
},
Text { content = "Username: " & testApp.email, x = 8, y = 16 },
Text { content = "Password: " & testApp.password, x = 8, y = 16 },
Text { content = "Combined: " & testApp.combinedText, x = 8, y = 16 },
Column {
gap = 10,
children = map (t \ Text { content = t, x = 8, y = 16 }) (storeSearch "")
}
]
}
};
os = { init = init, update = update, view = view }

@ -1,7 +1,7 @@
import type { AST, Pattern, Definition } from './ast';
import { _rt, store } from './runtime-js';
const definitions: Map<string, AST> = new Map();
export const definitions: Map<string, AST> = new Map();
const dependencies: Map<string, Set<string>> = new Map();
const dependents: Map<string, Set<string>> = new Map();

@ -4,19 +4,15 @@ import { Parser } from './parser'
import { runAppCompiled } from './runtime-compiled'
import { _rt } from './runtime-js'
import stdlibCode from './cg/stdlib.cg?raw';
import designTokensCode from './cg/design-tokens.cg?raw';
import uiComponentsCode from './cg/ui-components.cg?raw';
import osCode from './cg/os.cg?raw';
const modules = import.meta.glob('./cg/*.cg', { as: 'raw', eager: true });
const cgCode = Object.keys(modules)
.sort()
.map(key => modules[key])
.join('\n');
const canvas = document.createElement('canvas') as HTMLCanvasElement;
document.body.appendChild(canvas);
const cgCode = stdlibCode + '\n' +
designTokensCode + '\n' +
uiComponentsCode + '\n' +
osCode + '\n'
try {
const tokens = tokenize(cgCode);
const parser = new Parser(tokens, cgCode);

Loading…
Cancel
Save