openalgo-script 0.1.0-alpha.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1249 -0
- package/README.md +288 -255
- package/dist/adapters/charts/alerts.d.ts +70 -0
- package/dist/adapters/charts/alerts.d.ts.map +1 -0
- package/dist/adapters/charts/alerts.js +52 -0
- package/dist/adapters/charts/alerts.js.map +1 -0
- package/dist/adapters/charts/bars.d.ts +39 -0
- package/dist/adapters/charts/bars.d.ts.map +1 -0
- package/dist/adapters/charts/bars.js +32 -0
- package/dist/adapters/charts/bars.js.map +1 -0
- package/dist/adapters/charts/candles.d.ts +40 -0
- package/dist/adapters/charts/candles.d.ts.map +1 -0
- package/dist/adapters/charts/candles.js +85 -0
- package/dist/adapters/charts/candles.js.map +1 -0
- package/dist/adapters/charts/colours.d.ts +47 -0
- package/dist/adapters/charts/colours.d.ts.map +1 -0
- package/dist/adapters/charts/colours.js +80 -0
- package/dist/adapters/charts/colours.js.map +1 -0
- package/dist/adapters/charts/columns.d.ts +37 -0
- package/dist/adapters/charts/columns.d.ts.map +1 -0
- package/dist/adapters/charts/columns.js +56 -0
- package/dist/adapters/charts/columns.js.map +1 -0
- package/dist/adapters/charts/contract.d.ts +278 -0
- package/dist/adapters/charts/contract.d.ts.map +1 -0
- package/dist/adapters/charts/contract.js +2 -0
- package/dist/adapters/charts/contract.js.map +1 -0
- package/dist/adapters/charts/descriptor.d.ts +48 -0
- package/dist/adapters/charts/descriptor.d.ts.map +1 -0
- package/dist/adapters/charts/descriptor.js +111 -0
- package/dist/adapters/charts/descriptor.js.map +1 -0
- package/dist/adapters/charts/drawings.d.ts +43 -0
- package/dist/adapters/charts/drawings.d.ts.map +1 -0
- package/dist/adapters/charts/drawings.js +172 -0
- package/dist/adapters/charts/drawings.js.map +1 -0
- package/dist/adapters/charts/errors.d.ts +28 -0
- package/dist/adapters/charts/errors.d.ts.map +1 -0
- package/dist/adapters/charts/errors.js +21 -0
- package/dist/adapters/charts/errors.js.map +1 -0
- package/dist/adapters/charts/fields.d.ts +33 -0
- package/dist/adapters/charts/fields.d.ts.map +1 -0
- package/dist/adapters/charts/fields.js +51 -0
- package/dist/adapters/charts/fields.js.map +1 -0
- package/dist/adapters/charts/fills.d.ts +23 -0
- package/dist/adapters/charts/fills.d.ts.map +1 -0
- package/dist/adapters/charts/fills.js +48 -0
- package/dist/adapters/charts/fills.js.map +1 -0
- package/dist/adapters/charts/index.d.ts +37 -0
- package/dist/adapters/charts/index.d.ts.map +1 -0
- package/dist/adapters/charts/index.js +33 -0
- package/dist/adapters/charts/index.js.map +1 -0
- package/dist/adapters/charts/levels.d.ts +39 -0
- package/dist/adapters/charts/levels.d.ts.map +1 -0
- package/dist/adapters/charts/levels.js +61 -0
- package/dist/adapters/charts/levels.js.map +1 -0
- package/dist/adapters/charts/markers.d.ts +41 -0
- package/dist/adapters/charts/markers.d.ts.map +1 -0
- package/dist/adapters/charts/markers.js +75 -0
- package/dist/adapters/charts/markers.js.map +1 -0
- package/dist/adapters/charts/paint.d.ts +61 -0
- package/dist/adapters/charts/paint.d.ts.map +1 -0
- package/dist/adapters/charts/paint.js +47 -0
- package/dist/adapters/charts/paint.js.map +1 -0
- package/dist/adapters/charts/plots.d.ts +39 -0
- package/dist/adapters/charts/plots.d.ts.map +1 -0
- package/dist/adapters/charts/plots.js +117 -0
- package/dist/adapters/charts/plots.js.map +1 -0
- package/dist/adapters/charts/produced.d.ts +57 -0
- package/dist/adapters/charts/produced.d.ts.map +1 -0
- package/dist/adapters/charts/produced.js +11 -0
- package/dist/adapters/charts/produced.js.map +1 -0
- package/dist/adapters/charts/requests.d.ts +114 -0
- package/dist/adapters/charts/requests.d.ts.map +1 -0
- package/dist/adapters/charts/requests.js +277 -0
- package/dist/adapters/charts/requests.js.map +1 -0
- package/dist/adapters/charts/run.d.ts +147 -0
- package/dist/adapters/charts/run.d.ts.map +1 -0
- package/dist/adapters/charts/run.js +148 -0
- package/dist/adapters/charts/run.js.map +1 -0
- package/dist/adapters/charts/settings.d.ts +78 -0
- package/dist/adapters/charts/settings.d.ts.map +1 -0
- package/dist/adapters/charts/settings.js +225 -0
- package/dist/adapters/charts/settings.js.map +1 -0
- package/dist/adapters/charts/surfaces.d.ts +204 -0
- package/dist/adapters/charts/surfaces.d.ts.map +1 -0
- package/dist/adapters/charts/surfaces.js +2 -0
- package/dist/adapters/charts/surfaces.js.map +1 -0
- package/dist/adapters/charts/tables.d.ts +65 -0
- package/dist/adapters/charts/tables.d.ts.map +1 -0
- package/dist/adapters/charts/tables.js +84 -0
- package/dist/adapters/charts/tables.js.map +1 -0
- package/dist/core/catalogue/catalogue.generated.d.ts +98 -10
- package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
- package/dist/core/catalogue/catalogue.generated.js +17 -9
- package/dist/core/catalogue/catalogue.generated.js.map +1 -1
- package/dist/core/catalogue/values.generated.d.ts +25 -0
- package/dist/core/catalogue/values.generated.d.ts.map +1 -1
- package/dist/core/check/arguments.d.ts +41 -0
- package/dist/core/check/arguments.d.ts.map +1 -0
- package/dist/core/check/arguments.js +84 -0
- package/dist/core/check/arguments.js.map +1 -0
- package/dist/core/check/call-sites.d.ts +22 -0
- package/dist/core/check/call-sites.d.ts.map +1 -0
- package/dist/core/check/call-sites.js +329 -0
- package/dist/core/check/call-sites.js.map +1 -0
- package/dist/core/check/call-warmup.d.ts +37 -0
- package/dist/core/check/call-warmup.d.ts.map +1 -0
- package/dist/core/check/call-warmup.js +97 -0
- package/dist/core/check/call-warmup.js.map +1 -0
- package/dist/core/check/calls.d.ts +33 -0
- package/dist/core/check/calls.d.ts.map +1 -0
- package/dist/core/check/calls.js +348 -0
- package/dist/core/check/calls.js.map +1 -0
- package/dist/core/check/check.d.ts +23 -0
- package/dist/core/check/check.d.ts.map +1 -0
- package/dist/core/check/check.js +163 -0
- package/dist/core/check/check.js.map +1 -0
- package/dist/core/check/checked.d.ts +198 -0
- package/dist/core/check/checked.d.ts.map +1 -0
- package/dist/core/check/checked.js +19 -0
- package/dist/core/check/checked.js.map +1 -0
- package/dist/core/check/checker.d.ts +182 -0
- package/dist/core/check/checker.d.ts.map +1 -0
- package/dist/core/check/checker.js +280 -0
- package/dist/core/check/checker.js.map +1 -0
- package/dist/core/check/conditional.d.ts +35 -0
- package/dist/core/check/conditional.d.ts.map +1 -0
- package/dist/core/check/conditional.js +100 -0
- package/dist/core/check/conditional.js.map +1 -0
- package/dist/core/check/constant.d.ts +47 -0
- package/dist/core/check/constant.d.ts.map +1 -0
- package/dist/core/check/constant.js +101 -0
- package/dist/core/check/constant.js.map +1 -0
- package/dist/core/check/declaration.d.ts +33 -0
- package/dist/core/check/declaration.d.ts.map +1 -0
- package/dist/core/check/declaration.js +181 -0
- package/dist/core/check/declaration.js.map +1 -0
- package/dist/core/check/expressions.d.ts +36 -0
- package/dist/core/check/expressions.d.ts.map +1 -0
- package/dist/core/check/expressions.js +398 -0
- package/dist/core/check/expressions.js.map +1 -0
- package/dist/core/check/functions.d.ts +31 -0
- package/dist/core/check/functions.d.ts.map +1 -0
- package/dist/core/check/functions.js +238 -0
- package/dist/core/check/functions.js.map +1 -0
- package/dist/core/check/handles.d.ts +48 -0
- package/dist/core/check/handles.d.ts.map +1 -0
- package/dist/core/check/handles.js +43 -0
- package/dist/core/check/handles.js.map +1 -0
- package/dist/core/check/index.d.ts +30 -0
- package/dist/core/check/index.d.ts.map +1 -0
- package/dist/core/check/index.js +26 -0
- package/dist/core/check/index.js.map +1 -0
- package/dist/core/check/library-bars.d.ts +7 -0
- package/dist/core/check/library-bars.d.ts.map +1 -0
- package/dist/core/check/library-bars.js +181 -0
- package/dist/core/check/library-bars.js.map +1 -0
- package/dist/core/check/library-orders.d.ts +5 -0
- package/dist/core/check/library-orders.d.ts.map +1 -0
- package/dist/core/check/library-orders.js +250 -0
- package/dist/core/check/library-orders.js.map +1 -0
- package/dist/core/check/library-output.d.ts +7 -0
- package/dist/core/check/library-output.d.ts.map +1 -0
- package/dist/core/check/library-output.js +195 -0
- package/dist/core/check/library-output.js.map +1 -0
- package/dist/core/check/library-series.d.ts +3 -0
- package/dist/core/check/library-series.d.ts.map +1 -0
- package/dist/core/check/library-series.js +415 -0
- package/dist/core/check/library-series.js.map +1 -0
- package/dist/core/check/library.d.ts +204 -0
- package/dist/core/check/library.d.ts.map +1 -0
- package/dist/core/check/library.js +198 -0
- package/dist/core/check/library.js.map +1 -0
- package/dist/core/check/literals.d.ts +19 -0
- package/dist/core/check/literals.d.ts.map +1 -0
- package/dist/core/check/literals.js +22 -0
- package/dist/core/check/literals.js.map +1 -0
- package/dist/core/check/outputs.d.ts +31 -0
- package/dist/core/check/outputs.d.ts.map +1 -0
- package/dist/core/check/outputs.js +113 -0
- package/dist/core/check/outputs.js.map +1 -0
- package/dist/core/check/statements.d.ts +25 -0
- package/dist/core/check/statements.d.ts.map +1 -0
- package/dist/core/check/statements.js +377 -0
- package/dist/core/check/statements.js.map +1 -0
- package/dist/core/check/suggest.d.ts +25 -0
- package/dist/core/check/suggest.d.ts.map +1 -0
- package/dist/core/check/suggest.js +61 -0
- package/dist/core/check/suggest.js.map +1 -0
- package/dist/core/check/surface.d.ts +38 -0
- package/dist/core/check/surface.d.ts.map +1 -0
- package/dist/core/check/surface.js +100 -0
- package/dist/core/check/surface.js.map +1 -0
- package/dist/core/check/tags.d.ts +4 -0
- package/dist/core/check/tags.d.ts.map +1 -0
- package/dist/core/check/tags.js +54 -0
- package/dist/core/check/tags.js.map +1 -0
- package/dist/core/check/types.d.ts +153 -0
- package/dist/core/check/types.d.ts.map +1 -0
- package/dist/core/check/types.js +221 -0
- package/dist/core/check/types.js.map +1 -0
- package/dist/core/check/warmup.d.ts +73 -0
- package/dist/core/check/warmup.d.ts.map +1 -0
- package/dist/core/check/warmup.js +62 -0
- package/dist/core/check/warmup.js.map +1 -0
- package/dist/core/diagnostics/collector.d.ts +12 -0
- package/dist/core/diagnostics/collector.d.ts.map +1 -1
- package/dist/core/diagnostics/collector.js +27 -1
- package/dist/core/diagnostics/collector.js.map +1 -1
- package/dist/core/emit/calls.d.ts +38 -0
- package/dist/core/emit/calls.d.ts.map +1 -0
- package/dist/core/emit/calls.js +347 -0
- package/dist/core/emit/calls.js.map +1 -0
- package/dist/core/emit/canonical.d.ts +39 -0
- package/dist/core/emit/canonical.d.ts.map +1 -0
- package/dist/core/emit/canonical.js +71 -0
- package/dist/core/emit/canonical.js.map +1 -0
- package/dist/core/emit/channels.d.ts +28 -0
- package/dist/core/emit/channels.d.ts.map +1 -0
- package/dist/core/emit/channels.js +110 -0
- package/dist/core/emit/channels.js.map +1 -0
- package/dist/core/emit/code.d.ts +75 -0
- package/dist/core/emit/code.d.ts.map +1 -0
- package/dist/core/emit/code.js +104 -0
- package/dist/core/emit/code.js.map +1 -0
- package/dist/core/emit/colours.d.ts +35 -0
- package/dist/core/emit/colours.d.ts.map +1 -0
- package/dist/core/emit/colours.js +50 -0
- package/dist/core/emit/colours.js.map +1 -0
- package/dist/core/emit/context.d.ts +271 -0
- package/dist/core/emit/context.d.ts.map +1 -0
- package/dist/core/emit/context.js +358 -0
- package/dist/core/emit/context.js.map +1 -0
- package/dist/core/emit/defaults.d.ts +45 -0
- package/dist/core/emit/defaults.d.ts.map +1 -0
- package/dist/core/emit/defaults.js +116 -0
- package/dist/core/emit/defaults.js.map +1 -0
- package/dist/core/emit/emit.d.ts +13 -0
- package/dist/core/emit/emit.d.ts.map +1 -0
- package/dist/core/emit/emit.js +281 -0
- package/dist/core/emit/emit.js.map +1 -0
- package/dist/core/emit/events.d.ts +21 -0
- package/dist/core/emit/events.d.ts.map +1 -0
- package/dist/core/emit/events.js +112 -0
- package/dist/core/emit/events.js.map +1 -0
- package/dist/core/emit/expressions.d.ts +23 -0
- package/dist/core/emit/expressions.d.ts.map +1 -0
- package/dist/core/emit/expressions.js +253 -0
- package/dist/core/emit/expressions.js.map +1 -0
- package/dist/core/emit/functions.d.ts +30 -0
- package/dist/core/emit/functions.d.ts.map +1 -0
- package/dist/core/emit/functions.js +171 -0
- package/dist/core/emit/functions.js.map +1 -0
- package/dist/core/emit/gaps.d.ts +34 -0
- package/dist/core/emit/gaps.d.ts.map +1 -0
- package/dist/core/emit/gaps.js +16 -0
- package/dist/core/emit/gaps.js.map +1 -0
- package/dist/core/emit/index.d.ts +29 -0
- package/dist/core/emit/index.d.ts.map +1 -0
- package/dist/core/emit/index.js +23 -0
- package/dist/core/emit/index.js.map +1 -0
- package/dist/core/emit/inputs.d.ts +47 -0
- package/dist/core/emit/inputs.d.ts.map +1 -0
- package/dist/core/emit/inputs.js +150 -0
- package/dist/core/emit/inputs.js.map +1 -0
- package/dist/core/emit/layout.d.ts +73 -0
- package/dist/core/emit/layout.d.ts.map +1 -0
- package/dist/core/emit/layout.js +126 -0
- package/dist/core/emit/layout.js.map +1 -0
- package/dist/core/emit/meta.d.ts +14 -0
- package/dist/core/emit/meta.d.ts.map +1 -0
- package/dist/core/emit/meta.js +68 -0
- package/dist/core/emit/meta.js.map +1 -0
- package/dist/core/emit/opcodes.d.ts +28 -0
- package/dist/core/emit/opcodes.d.ts.map +1 -0
- package/dist/core/emit/opcodes.js +137 -0
- package/dist/core/emit/opcodes.js.map +1 -0
- package/dist/core/emit/outputs.d.ts +67 -0
- package/dist/core/emit/outputs.d.ts.map +1 -0
- package/dist/core/emit/outputs.js +293 -0
- package/dist/core/emit/outputs.js.map +1 -0
- package/dist/core/emit/pool.d.ts +33 -0
- package/dist/core/emit/pool.d.ts.map +1 -0
- package/dist/core/emit/pool.js +79 -0
- package/dist/core/emit/pool.js.map +1 -0
- package/dist/core/emit/program.d.ts +333 -0
- package/dist/core/emit/program.d.ts.map +1 -0
- package/dist/core/emit/program.js +15 -0
- package/dist/core/emit/program.js.map +1 -0
- package/dist/core/emit/registers.d.ts +35 -0
- package/dist/core/emit/registers.d.ts.map +1 -0
- package/dist/core/emit/registers.js +170 -0
- package/dist/core/emit/registers.js.map +1 -0
- package/dist/core/emit/request-scope.d.ts +36 -0
- package/dist/core/emit/request-scope.d.ts.map +1 -0
- package/dist/core/emit/request-scope.js +41 -0
- package/dist/core/emit/request-scope.js.map +1 -0
- package/dist/core/emit/requests.d.ts +69 -0
- package/dist/core/emit/requests.d.ts.map +1 -0
- package/dist/core/emit/requests.js +230 -0
- package/dist/core/emit/requests.js.map +1 -0
- package/dist/core/emit/requires.d.ts +4 -0
- package/dist/core/emit/requires.d.ts.map +1 -0
- package/dist/core/emit/requires.js +71 -0
- package/dist/core/emit/requires.js.map +1 -0
- package/dist/core/emit/sha256.d.ts +24 -0
- package/dist/core/emit/sha256.d.ts.map +1 -0
- package/dist/core/emit/sha256.js +109 -0
- package/dist/core/emit/sha256.js.map +1 -0
- package/dist/core/emit/statements.d.ts +20 -0
- package/dist/core/emit/statements.d.ts.map +1 -0
- package/dist/core/emit/statements.js +393 -0
- package/dist/core/emit/statements.js.map +1 -0
- package/dist/core/emit/values.d.ts +80 -0
- package/dist/core/emit/values.d.ts.map +1 -0
- package/dist/core/emit/values.js +242 -0
- package/dist/core/emit/values.js.map +1 -0
- package/dist/core/engine/alerts.d.ts +66 -0
- package/dist/core/engine/alerts.d.ts.map +1 -0
- package/dist/core/engine/alerts.js +119 -0
- package/dist/core/engine/alerts.js.map +1 -0
- package/dist/core/engine/arithmetic.d.ts +82 -0
- package/dist/core/engine/arithmetic.d.ts.map +1 -0
- package/dist/core/engine/arithmetic.js +141 -0
- package/dist/core/engine/arithmetic.js.map +1 -0
- package/dist/core/engine/bars.d.ts +95 -0
- package/dist/core/engine/bars.d.ts.map +1 -0
- package/dist/core/engine/bars.js +133 -0
- package/dist/core/engine/bars.js.map +1 -0
- package/dist/core/engine/budget.d.ts +162 -0
- package/dist/core/engine/budget.d.ts.map +1 -0
- package/dist/core/engine/budget.js +188 -0
- package/dist/core/engine/budget.js.map +1 -0
- package/dist/core/engine/channels.d.ts +106 -0
- package/dist/core/engine/channels.d.ts.map +1 -0
- package/dist/core/engine/channels.js +99 -0
- package/dist/core/engine/channels.js.map +1 -0
- package/dist/core/engine/drawings.d.ts +64 -0
- package/dist/core/engine/drawings.d.ts.map +1 -0
- package/dist/core/engine/drawings.js +67 -0
- package/dist/core/engine/drawings.js.map +1 -0
- package/dist/core/engine/engine.d.ts +140 -0
- package/dist/core/engine/engine.d.ts.map +1 -0
- package/dist/core/engine/engine.js +405 -0
- package/dist/core/engine/engine.js.map +1 -0
- package/dist/core/engine/errors.d.ts +64 -0
- package/dist/core/engine/errors.d.ts.map +1 -0
- package/dist/core/engine/errors.js +63 -0
- package/dist/core/engine/errors.js.map +1 -0
- package/dist/core/engine/frames.d.ts +48 -0
- package/dist/core/engine/frames.d.ts.map +1 -0
- package/dist/core/engine/frames.js +41 -0
- package/dist/core/engine/frames.js.map +1 -0
- package/dist/core/engine/grids.d.ts +25 -0
- package/dist/core/engine/grids.d.ts.map +1 -0
- package/dist/core/engine/grids.js +77 -0
- package/dist/core/engine/grids.js.map +1 -0
- package/dist/core/engine/guard.d.ts +4 -0
- package/dist/core/engine/guard.d.ts.map +1 -0
- package/dist/core/engine/guard.js +46 -0
- package/dist/core/engine/guard.js.map +1 -0
- package/dist/core/engine/host.d.ts +219 -0
- package/dist/core/engine/host.d.ts.map +1 -0
- package/dist/core/engine/host.js +38 -0
- package/dist/core/engine/host.js.map +1 -0
- package/dist/core/engine/index.d.ts +49 -0
- package/dist/core/engine/index.d.ts.map +1 -0
- package/dist/core/engine/index.js +33 -0
- package/dist/core/engine/index.js.map +1 -0
- package/dist/core/engine/inputs.d.ts +77 -0
- package/dist/core/engine/inputs.d.ts.map +1 -0
- package/dist/core/engine/inputs.js +205 -0
- package/dist/core/engine/inputs.js.map +1 -0
- package/dist/core/engine/ledger/call.d.ts +63 -0
- package/dist/core/engine/ledger/call.d.ts.map +1 -0
- package/dist/core/engine/ledger/call.js +136 -0
- package/dist/core/engine/ledger/call.js.map +1 -0
- package/dist/core/engine/ledger/closable.d.ts +155 -0
- package/dist/core/engine/ledger/closable.d.ts.map +1 -0
- package/dist/core/engine/ledger/closable.js +173 -0
- package/dist/core/engine/ledger/closable.js.map +1 -0
- package/dist/core/engine/ledger/holdings.d.ts +194 -0
- package/dist/core/engine/ledger/holdings.d.ts.map +1 -0
- package/dist/core/engine/ledger/holdings.js +237 -0
- package/dist/core/engine/ledger/holdings.js.map +1 -0
- package/dist/core/engine/ledger/index.d.ts +19 -0
- package/dist/core/engine/ledger/index.d.ts.map +1 -0
- package/dist/core/engine/ledger/index.js +2 -0
- package/dist/core/engine/ledger/index.js.map +1 -0
- package/dist/core/engine/ledger/intent.d.ts +106 -0
- package/dist/core/engine/ledger/intent.d.ts.map +1 -0
- package/dist/core/engine/ledger/intent.js +21 -0
- package/dist/core/engine/ledger/intent.js.map +1 -0
- package/dist/core/engine/ledger/ledger.d.ts +143 -0
- package/dist/core/engine/ledger/ledger.d.ts.map +1 -0
- package/dist/core/engine/ledger/ledger.js +237 -0
- package/dist/core/engine/ledger/ledger.js.map +1 -0
- package/dist/core/engine/ledger/place.d.ts +75 -0
- package/dist/core/engine/ledger/place.d.ts.map +1 -0
- package/dist/core/engine/ledger/place.js +174 -0
- package/dist/core/engine/ledger/place.js.map +1 -0
- package/dist/core/engine/ledger/positions.d.ts +68 -0
- package/dist/core/engine/ledger/positions.d.ts.map +1 -0
- package/dist/core/engine/ledger/positions.js +114 -0
- package/dist/core/engine/ledger/positions.js.map +1 -0
- package/dist/core/engine/ledger/refuse.d.ts +43 -0
- package/dist/core/engine/ledger/refuse.d.ts.map +1 -0
- package/dist/core/engine/ledger/refuse.js +329 -0
- package/dist/core/engine/ledger/refuse.js.map +1 -0
- package/dist/core/engine/ledger/row.d.ts +176 -0
- package/dist/core/engine/ledger/row.d.ts.map +1 -0
- package/dist/core/engine/ledger/row.js +169 -0
- package/dist/core/engine/ledger/row.js.map +1 -0
- package/dist/core/engine/ledger/sizing.d.ts +142 -0
- package/dist/core/engine/ledger/sizing.d.ts.map +1 -0
- package/dist/core/engine/ledger/sizing.js +223 -0
- package/dist/core/engine/ledger/sizing.js.map +1 -0
- package/dist/core/engine/library/arrays.d.ts +14 -0
- package/dist/core/engine/library/arrays.d.ts.map +1 -0
- package/dist/core/engine/library/arrays.js +285 -0
- package/dist/core/engine/library/arrays.js.map +1 -0
- package/dist/core/engine/library/averages.d.ts +9 -0
- package/dist/core/engine/library/averages.d.ts.map +1 -0
- package/dist/core/engine/library/averages.js +41 -0
- package/dist/core/engine/library/averages.js.map +1 -0
- package/dist/core/engine/library/binding.d.ts +230 -0
- package/dist/core/engine/library/binding.d.ts.map +1 -0
- package/dist/core/engine/library/binding.js +109 -0
- package/dist/core/engine/library/binding.js.map +1 -0
- package/dist/core/engine/library/chart.d.ts +3 -0
- package/dist/core/engine/library/chart.d.ts.map +1 -0
- package/dist/core/engine/library/chart.js +83 -0
- package/dist/core/engine/library/chart.js.map +1 -0
- package/dist/core/engine/library/colours.d.ts +26 -0
- package/dist/core/engine/library/colours.d.ts.map +1 -0
- package/dist/core/engine/library/colours.js +81 -0
- package/dist/core/engine/library/colours.js.map +1 -0
- package/dist/core/engine/library/dates.d.ts +3 -0
- package/dist/core/engine/library/dates.d.ts.map +1 -0
- package/dist/core/engine/library/dates.js +75 -0
- package/dist/core/engine/library/dates.js.map +1 -0
- package/dist/core/engine/library/index.d.ts +13 -0
- package/dist/core/engine/library/index.d.ts.map +1 -0
- package/dist/core/engine/library/index.js +86 -0
- package/dist/core/engine/library/index.js.map +1 -0
- package/dist/core/engine/library/maths.d.ts +3 -0
- package/dist/core/engine/library/maths.d.ts.map +1 -0
- package/dist/core/engine/library/maths.js +89 -0
- package/dist/core/engine/library/maths.js.map +1 -0
- package/dist/core/engine/library/objects.d.ts +3 -0
- package/dist/core/engine/library/objects.d.ts.map +1 -0
- package/dist/core/engine/library/objects.js +199 -0
- package/dist/core/engine/library/objects.js.map +1 -0
- package/dist/core/engine/library/oscillators.d.ts +3 -0
- package/dist/core/engine/library/oscillators.d.ts.map +1 -0
- package/dist/core/engine/library/oscillators.js +29 -0
- package/dist/core/engine/library/oscillators.js.map +1 -0
- package/dist/core/engine/library/ranges.d.ts +3 -0
- package/dist/core/engine/library/ranges.d.ts.map +1 -0
- package/dist/core/engine/library/ranges.js +23 -0
- package/dist/core/engine/library/ranges.js.map +1 -0
- package/dist/core/engine/library/series.d.ts +3 -0
- package/dist/core/engine/library/series.d.ts.map +1 -0
- package/dist/core/engine/library/series.js +46 -0
- package/dist/core/engine/library/series.js.map +1 -0
- package/dist/core/engine/library/state.d.ts +35 -0
- package/dist/core/engine/library/state.d.ts.map +1 -0
- package/dist/core/engine/library/state.js +19 -0
- package/dist/core/engine/library/state.js.map +1 -0
- package/dist/core/engine/library/studies.d.ts +3 -0
- package/dist/core/engine/library/studies.d.ts.map +1 -0
- package/dist/core/engine/library/studies.js +35 -0
- package/dist/core/engine/library/studies.js.map +1 -0
- package/dist/core/engine/library/text.d.ts +6 -0
- package/dist/core/engine/library/text.d.ts.map +1 -0
- package/dist/core/engine/library/text.js +280 -0
- package/dist/core/engine/library/text.js.map +1 -0
- package/dist/core/engine/library/trend.d.ts +3 -0
- package/dist/core/engine/library/trend.d.ts.map +1 -0
- package/dist/core/engine/library/trend.js +29 -0
- package/dist/core/engine/library/trend.js.map +1 -0
- package/dist/core/engine/library/volume.d.ts +3 -0
- package/dist/core/engine/library/volume.d.ts.map +1 -0
- package/dist/core/engine/library/volume.js +51 -0
- package/dist/core/engine/library/volume.js.map +1 -0
- package/dist/core/engine/load.d.ts +45 -0
- package/dist/core/engine/load.d.ts.map +1 -0
- package/dist/core/engine/load.js +60 -0
- package/dist/core/engine/load.js.map +1 -0
- package/dist/core/engine/machine.d.ts +107 -0
- package/dist/core/engine/machine.d.ts.map +1 -0
- package/dist/core/engine/machine.js +337 -0
- package/dist/core/engine/machine.js.map +1 -0
- package/dist/core/engine/memory.d.ts +60 -0
- package/dist/core/engine/memory.d.ts.map +1 -0
- package/dist/core/engine/memory.js +92 -0
- package/dist/core/engine/memory.js.map +1 -0
- package/dist/core/engine/operations.d.ts +62 -0
- package/dist/core/engine/operations.d.ts.map +1 -0
- package/dist/core/engine/operations.js +149 -0
- package/dist/core/engine/operations.js.map +1 -0
- package/dist/core/engine/orders.d.ts +56 -0
- package/dist/core/engine/orders.d.ts.map +1 -0
- package/dist/core/engine/orders.js +83 -0
- package/dist/core/engine/orders.js.map +1 -0
- package/dist/core/engine/registers.d.ts +50 -0
- package/dist/core/engine/registers.d.ts.map +1 -0
- package/dist/core/engine/registers.js +85 -0
- package/dist/core/engine/registers.js.map +1 -0
- package/dist/core/engine/request-body.d.ts +138 -0
- package/dist/core/engine/request-body.d.ts.map +1 -0
- package/dist/core/engine/request-body.js +227 -0
- package/dist/core/engine/request-body.js.map +1 -0
- package/dist/core/engine/request-plan.d.ts +79 -0
- package/dist/core/engine/request-plan.d.ts.map +1 -0
- package/dist/core/engine/request-plan.js +228 -0
- package/dist/core/engine/request-plan.js.map +1 -0
- package/dist/core/engine/requests.d.ts +105 -0
- package/dist/core/engine/requests.d.ts.map +1 -0
- package/dist/core/engine/requests.js +260 -0
- package/dist/core/engine/requests.js.map +1 -0
- package/dist/core/engine/results.d.ts +40 -0
- package/dist/core/engine/results.d.ts.map +1 -0
- package/dist/core/engine/results.js +2 -0
- package/dist/core/engine/results.js.map +1 -0
- package/dist/core/engine/series.d.ts +61 -0
- package/dist/core/engine/series.d.ts.map +1 -0
- package/dist/core/engine/series.js +41 -0
- package/dist/core/engine/series.js.map +1 -0
- package/dist/core/engine/session/hours.d.ts +49 -0
- package/dist/core/engine/session/hours.d.ts.map +1 -0
- package/dist/core/engine/session/hours.js +31 -0
- package/dist/core/engine/session/hours.js.map +1 -0
- package/dist/core/engine/session/index.d.ts +17 -0
- package/dist/core/engine/session/index.d.ts.map +1 -0
- package/dist/core/engine/session/index.js +3 -0
- package/dist/core/engine/session/index.js.map +1 -0
- package/dist/core/engine/session/record.d.ts +56 -0
- package/dist/core/engine/session/record.d.ts.map +1 -0
- package/dist/core/engine/session/record.js +165 -0
- package/dist/core/engine/session/record.js.map +1 -0
- package/dist/core/engine/session/spec.d.ts +19 -0
- package/dist/core/engine/session/spec.d.ts.map +1 -0
- package/dist/core/engine/session/spec.js +31 -0
- package/dist/core/engine/session/spec.js.map +1 -0
- package/dist/core/engine/timeframe.d.ts +59 -0
- package/dist/core/engine/timeframe.d.ts.map +1 -0
- package/dist/core/engine/timeframe.js +140 -0
- package/dist/core/engine/timeframe.js.map +1 -0
- package/dist/core/engine/types.d.ts +15 -0
- package/dist/core/engine/types.d.ts.map +1 -0
- package/dist/core/engine/types.js +2 -0
- package/dist/core/engine/types.js.map +1 -0
- package/dist/core/engine/values/heap.d.ts +134 -0
- package/dist/core/engine/values/heap.d.ts.map +1 -0
- package/dist/core/engine/values/heap.js +230 -0
- package/dist/core/engine/values/heap.js.map +1 -0
- package/dist/core/engine/values/index.d.ts +13 -0
- package/dist/core/engine/values/index.d.ts.map +1 -0
- package/dist/core/engine/values/index.js +3 -0
- package/dist/core/engine/values/index.js.map +1 -0
- package/dist/core/engine/values/value.d.ts +82 -0
- package/dist/core/engine/values/value.d.ts.map +1 -0
- package/dist/core/engine/values/value.js +134 -0
- package/dist/core/engine/values/value.js.map +1 -0
- package/dist/core/engine/verify-budgets.d.ts +35 -0
- package/dist/core/engine/verify-budgets.d.ts.map +1 -0
- package/dist/core/engine/verify-budgets.js +172 -0
- package/dist/core/engine/verify-budgets.js.map +1 -0
- package/dist/core/engine/verify-code.d.ts +32 -0
- package/dist/core/engine/verify-code.d.ts.map +1 -0
- package/dist/core/engine/verify-code.js +278 -0
- package/dist/core/engine/verify-code.js.map +1 -0
- package/dist/core/engine/verify-requests.d.ts +44 -0
- package/dist/core/engine/verify-requests.d.ts.map +1 -0
- package/dist/core/engine/verify-requests.js +220 -0
- package/dist/core/engine/verify-requests.js.map +1 -0
- package/dist/core/engine/verify-shape.d.ts +46 -0
- package/dist/core/engine/verify-shape.d.ts.map +1 -0
- package/dist/core/engine/verify-shape.js +147 -0
- package/dist/core/engine/verify-shape.js.map +1 -0
- package/dist/core/engine/verify-tables.d.ts +19 -0
- package/dist/core/engine/verify-tables.d.ts.map +1 -0
- package/dist/core/engine/verify-tables.js +171 -0
- package/dist/core/engine/verify-tables.js.map +1 -0
- package/dist/core/engine/verify.d.ts +19 -0
- package/dist/core/engine/verify.d.ts.map +1 -0
- package/dist/core/engine/verify.js +309 -0
- package/dist/core/engine/verify.js.map +1 -0
- package/dist/core/index.d.ts +62 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +49 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/parse/expressions.js +1 -1
- package/dist/core/parse/expressions.js.map +1 -1
- package/dist/core/parse/names.d.ts +7 -1
- package/dist/core/parse/names.d.ts.map +1 -1
- package/dist/core/parse/names.js +28 -2
- package/dist/core/parse/names.js.map +1 -1
- package/dist/core/stdlib/averages/exponential.d.ts +51 -0
- package/dist/core/stdlib/averages/exponential.d.ts.map +1 -0
- package/dist/core/stdlib/averages/exponential.js +72 -0
- package/dist/core/stdlib/averages/exponential.js.map +1 -0
- package/dist/core/stdlib/averages/index.d.ts +7 -0
- package/dist/core/stdlib/averages/index.d.ts.map +1 -0
- package/dist/core/stdlib/averages/index.js +5 -0
- package/dist/core/stdlib/averages/index.js.map +1 -0
- package/dist/core/stdlib/averages/select.d.ts +35 -0
- package/dist/core/stdlib/averages/select.d.ts.map +1 -0
- package/dist/core/stdlib/averages/select.js +43 -0
- package/dist/core/stdlib/averages/select.js.map +1 -0
- package/dist/core/stdlib/averages/shaped.d.ts +61 -0
- package/dist/core/stdlib/averages/shaped.d.ts.map +1 -0
- package/dist/core/stdlib/averages/shaped.js +126 -0
- package/dist/core/stdlib/averages/shaped.js.map +1 -0
- package/dist/core/stdlib/averages/simple.d.ts +58 -0
- package/dist/core/stdlib/averages/simple.d.ts.map +1 -0
- package/dist/core/stdlib/averages/simple.js +92 -0
- package/dist/core/stdlib/averages/simple.js.map +1 -0
- package/dist/core/stdlib/calendar/civil.d.ts +56 -0
- package/dist/core/stdlib/calendar/civil.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/civil.js +70 -0
- package/dist/core/stdlib/calendar/civil.js.map +1 -0
- package/dist/core/stdlib/calendar/fields.d.ts +36 -0
- package/dist/core/stdlib/calendar/fields.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/fields.js +93 -0
- package/dist/core/stdlib/calendar/fields.js.map +1 -0
- package/dist/core/stdlib/calendar/format.d.ts +19 -0
- package/dist/core/stdlib/calendar/format.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/format.js +51 -0
- package/dist/core/stdlib/calendar/format.js.map +1 -0
- package/dist/core/stdlib/calendar/index.d.ts +7 -0
- package/dist/core/stdlib/calendar/index.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/index.js +5 -0
- package/dist/core/stdlib/calendar/index.js.map +1 -0
- package/dist/core/stdlib/calendar/zone.d.ts +53 -0
- package/dist/core/stdlib/calendar/zone.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/zone.js +138 -0
- package/dist/core/stdlib/calendar/zone.js.map +1 -0
- package/dist/core/stdlib/index.d.ts +57 -0
- package/dist/core/stdlib/index.d.ts.map +1 -0
- package/dist/core/stdlib/index.js +51 -0
- package/dist/core/stdlib/index.js.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts +38 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.js +66 -0
- package/dist/core/stdlib/maths/arithmetic.js.map +1 -0
- package/dist/core/stdlib/maths/elementary.d.ts +65 -0
- package/dist/core/stdlib/maths/elementary.d.ts.map +1 -0
- package/dist/core/stdlib/maths/elementary.js +93 -0
- package/dist/core/stdlib/maths/elementary.js.map +1 -0
- package/dist/core/stdlib/maths/index.d.ts +4 -0
- package/dist/core/stdlib/maths/index.d.ts.map +1 -0
- package/dist/core/stdlib/maths/index.js +4 -0
- package/dist/core/stdlib/maths/index.js.map +1 -0
- package/dist/core/stdlib/maths/rounding.d.ts +43 -0
- package/dist/core/stdlib/maths/rounding.d.ts.map +1 -0
- package/dist/core/stdlib/maths/rounding.js +62 -0
- package/dist/core/stdlib/maths/rounding.js.map +1 -0
- package/dist/core/stdlib/momentum/convergence.d.ts +36 -0
- package/dist/core/stdlib/momentum/convergence.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/convergence.js +48 -0
- package/dist/core/stdlib/momentum/convergence.js.map +1 -0
- package/dist/core/stdlib/momentum/index.d.ts +6 -0
- package/dist/core/stdlib/momentum/index.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/index.js +6 -0
- package/dist/core/stdlib/momentum/index.js.map +1 -0
- package/dist/core/stdlib/momentum/pressure.d.ts +43 -0
- package/dist/core/stdlib/momentum/pressure.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/pressure.js +103 -0
- package/dist/core/stdlib/momentum/pressure.js.map +1 -0
- package/dist/core/stdlib/momentum/rates.d.ts +74 -0
- package/dist/core/stdlib/momentum/rates.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rates.js +134 -0
- package/dist/core/stdlib/momentum/rates.js.map +1 -0
- package/dist/core/stdlib/momentum/rsi.d.ts +21 -0
- package/dist/core/stdlib/momentum/rsi.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rsi.js +30 -0
- package/dist/core/stdlib/momentum/rsi.js.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts +44 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.js +97 -0
- package/dist/core/stdlib/momentum/stochastic.js.map +1 -0
- package/dist/core/stdlib/series/changes.d.ts +59 -0
- package/dist/core/stdlib/series/changes.d.ts.map +1 -0
- package/dist/core/stdlib/series/changes.js +129 -0
- package/dist/core/stdlib/series/changes.js.map +1 -0
- package/dist/core/stdlib/series/conditions.d.ts +34 -0
- package/dist/core/stdlib/series/conditions.d.ts.map +1 -0
- package/dist/core/stdlib/series/conditions.js +52 -0
- package/dist/core/stdlib/series/conditions.js.map +1 -0
- package/dist/core/stdlib/series/extremes.d.ts +29 -0
- package/dist/core/stdlib/series/extremes.d.ts.map +1 -0
- package/dist/core/stdlib/series/extremes.js +62 -0
- package/dist/core/stdlib/series/extremes.js.map +1 -0
- package/dist/core/stdlib/series/index.d.ts +9 -0
- package/dist/core/stdlib/series/index.d.ts.map +1 -0
- package/dist/core/stdlib/series/index.js +7 -0
- package/dist/core/stdlib/series/index.js.map +1 -0
- package/dist/core/stdlib/series/pivots.d.ts +25 -0
- package/dist/core/stdlib/series/pivots.d.ts.map +1 -0
- package/dist/core/stdlib/series/pivots.js +42 -0
- package/dist/core/stdlib/series/pivots.js.map +1 -0
- package/dist/core/stdlib/series/statistics.d.ts +64 -0
- package/dist/core/stdlib/series/statistics.d.ts.map +1 -0
- package/dist/core/stdlib/series/statistics.js +148 -0
- package/dist/core/stdlib/series/statistics.js.map +1 -0
- package/dist/core/stdlib/series/totals.d.ts +68 -0
- package/dist/core/stdlib/series/totals.d.ts.map +1 -0
- package/dist/core/stdlib/series/totals.js +115 -0
- package/dist/core/stdlib/series/totals.js.map +1 -0
- package/dist/core/stdlib/trend/directional.d.ts +69 -0
- package/dist/core/stdlib/trend/directional.d.ts.map +1 -0
- package/dist/core/stdlib/trend/directional.js +151 -0
- package/dist/core/stdlib/trend/directional.js.map +1 -0
- package/dist/core/stdlib/trend/index.d.ts +4 -0
- package/dist/core/stdlib/trend/index.d.ts.map +1 -0
- package/dist/core/stdlib/trend/index.js +4 -0
- package/dist/core/stdlib/trend/index.js.map +1 -0
- package/dist/core/stdlib/trend/psar.d.ts +33 -0
- package/dist/core/stdlib/trend/psar.d.ts.map +1 -0
- package/dist/core/stdlib/trend/psar.js +86 -0
- package/dist/core/stdlib/trend/psar.js.map +1 -0
- package/dist/core/stdlib/trend/supertrend.d.ts +30 -0
- package/dist/core/stdlib/trend/supertrend.d.ts.map +1 -0
- package/dist/core/stdlib/trend/supertrend.js +65 -0
- package/dist/core/stdlib/trend/supertrend.js.map +1 -0
- package/dist/core/stdlib/values/bar.d.ts +39 -0
- package/dist/core/stdlib/values/bar.d.ts.map +1 -0
- package/dist/core/stdlib/values/bar.js +33 -0
- package/dist/core/stdlib/values/bar.js.map +1 -0
- package/dist/core/stdlib/values/index.d.ts +11 -0
- package/dist/core/stdlib/values/index.d.ts.map +1 -0
- package/dist/core/stdlib/values/index.js +6 -0
- package/dist/core/stdlib/values/index.js.map +1 -0
- package/dist/core/stdlib/values/lookback.d.ts +83 -0
- package/dist/core/stdlib/values/lookback.d.ts.map +1 -0
- package/dist/core/stdlib/values/lookback.js +134 -0
- package/dist/core/stdlib/values/lookback.js.map +1 -0
- package/dist/core/stdlib/values/region.d.ts +55 -0
- package/dist/core/stdlib/values/region.d.ts.map +1 -0
- package/dist/core/stdlib/values/region.js +73 -0
- package/dist/core/stdlib/values/region.js.map +1 -0
- package/dist/core/stdlib/values/tail.d.ts +44 -0
- package/dist/core/stdlib/values/tail.d.ts.map +1 -0
- package/dist/core/stdlib/values/tail.js +23 -0
- package/dist/core/stdlib/values/tail.js.map +1 -0
- package/dist/core/stdlib/values/value.d.ts +64 -0
- package/dist/core/stdlib/values/value.d.ts.map +1 -0
- package/dist/core/stdlib/values/value.js +61 -0
- package/dist/core/stdlib/values/value.js.map +1 -0
- package/dist/core/stdlib/volatility/bands.d.ts +50 -0
- package/dist/core/stdlib/volatility/bands.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/bands.js +101 -0
- package/dist/core/stdlib/volatility/bands.js.map +1 -0
- package/dist/core/stdlib/volatility/deviation.d.ts +43 -0
- package/dist/core/stdlib/volatility/deviation.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/deviation.js +75 -0
- package/dist/core/stdlib/volatility/deviation.js.map +1 -0
- package/dist/core/stdlib/volatility/index.d.ts +6 -0
- package/dist/core/stdlib/volatility/index.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/index.js +5 -0
- package/dist/core/stdlib/volatility/index.js.map +1 -0
- package/dist/core/stdlib/volatility/measures.d.ts +48 -0
- package/dist/core/stdlib/volatility/measures.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/measures.js +73 -0
- package/dist/core/stdlib/volatility/measures.js.map +1 -0
- package/dist/core/stdlib/volatility/range.d.ts +69 -0
- package/dist/core/stdlib/volatility/range.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/range.js +86 -0
- package/dist/core/stdlib/volatility/range.js.map +1 -0
- package/dist/core/stdlib/volume/accumulation.d.ts +61 -0
- package/dist/core/stdlib/volume/accumulation.d.ts.map +1 -0
- package/dist/core/stdlib/volume/accumulation.js +127 -0
- package/dist/core/stdlib/volume/accumulation.js.map +1 -0
- package/dist/core/stdlib/volume/flow.d.ts +60 -0
- package/dist/core/stdlib/volume/flow.d.ts.map +1 -0
- package/dist/core/stdlib/volume/flow.js +125 -0
- package/dist/core/stdlib/volume/flow.js.map +1 -0
- package/dist/core/stdlib/volume/index.d.ts +5 -0
- package/dist/core/stdlib/volume/index.d.ts.map +1 -0
- package/dist/core/stdlib/volume/index.js +4 -0
- package/dist/core/stdlib/volume/index.js.map +1 -0
- package/dist/core/stdlib/volume/weighted.d.ts +52 -0
- package/dist/core/stdlib/volume/weighted.d.ts.map +1 -0
- package/dist/core/stdlib/volume/weighted.js +64 -0
- package/dist/core/stdlib/volume/weighted.js.map +1 -0
- package/dist/core/version/index.d.ts +2 -0
- package/dist/core/version/index.d.ts.map +1 -0
- package/dist/core/version/index.js +2 -0
- package/dist/core/version/index.js.map +1 -0
- package/dist/core/version/version.generated.d.ts +10 -0
- package/dist/core/version/version.generated.d.ts.map +1 -0
- package/dist/core/version/version.generated.js +14 -0
- package/dist/core/version/version.generated.js.map +1 -0
- package/package.json +88 -52
- package/spec/errors.json +3403 -3204
- package/src/adapters/charts/alerts.ts +116 -0
- package/src/adapters/charts/bars.ts +63 -0
- package/src/adapters/charts/candles.ts +137 -0
- package/src/adapters/charts/colours.ts +113 -0
- package/src/adapters/charts/columns.ts +99 -0
- package/src/adapters/charts/contract.ts +320 -0
- package/src/adapters/charts/descriptor.ts +199 -0
- package/src/adapters/charts/drawings.ts +213 -0
- package/src/adapters/charts/errors.ts +45 -0
- package/src/adapters/charts/fields.ts +74 -0
- package/src/adapters/charts/fills.ts +71 -0
- package/src/adapters/charts/index.ts +78 -0
- package/src/adapters/charts/levels.ts +92 -0
- package/src/adapters/charts/markers.ts +119 -0
- package/src/adapters/charts/paint.ts +101 -0
- package/src/adapters/charts/plots.ts +185 -0
- package/src/adapters/charts/produced.ts +68 -0
- package/src/adapters/charts/requests.ts +357 -0
- package/src/adapters/charts/run.ts +327 -0
- package/src/adapters/charts/settings.ts +273 -0
- package/src/adapters/charts/surfaces.ts +238 -0
- package/src/adapters/charts/tables.ts +155 -0
- package/src/core/catalogue/catalogue.generated.ts +17 -9
- package/src/core/catalogue/values.generated.ts +8 -0
- package/src/core/check/arguments.ts +126 -0
- package/src/core/check/call-sites.ts +385 -0
- package/src/core/check/call-warmup.ts +121 -0
- package/src/core/check/calls.ts +412 -0
- package/src/core/check/check.ts +183 -0
- package/src/core/check/checked.ts +228 -0
- package/src/core/check/checker.ts +393 -0
- package/src/core/check/conditional.ts +143 -0
- package/src/core/check/constant.ts +127 -0
- package/src/core/check/declaration.ts +230 -0
- package/src/core/check/expressions.ts +471 -0
- package/src/core/check/functions.ts +283 -0
- package/src/core/check/handles.ts +75 -0
- package/src/core/check/index.ts +67 -0
- package/src/core/check/library-bars.ts +194 -0
- package/src/core/check/library-orders.ts +290 -0
- package/src/core/check/library-output.ts +241 -0
- package/src/core/check/library-series.ts +457 -0
- package/src/core/check/library.ts +374 -0
- package/src/core/check/literals.ts +35 -0
- package/src/core/check/outputs.ts +152 -0
- package/src/core/check/statements.ts +465 -0
- package/src/core/check/suggest.ts +63 -0
- package/src/core/check/surface.ts +115 -0
- package/src/core/check/tags.ts +94 -0
- package/src/core/check/types.ts +260 -0
- package/src/core/check/warmup.ts +100 -0
- package/src/core/diagnostics/collector.ts +27 -1
- package/src/core/emit/calls.ts +415 -0
- package/src/core/emit/canonical.ts +81 -0
- package/src/core/emit/channels.ts +144 -0
- package/src/core/emit/code.ts +155 -0
- package/src/core/emit/colours.ts +75 -0
- package/src/core/emit/context.ts +461 -0
- package/src/core/emit/defaults.ts +150 -0
- package/src/core/emit/emit.ts +313 -0
- package/src/core/emit/events.ts +141 -0
- package/src/core/emit/expressions.ts +292 -0
- package/src/core/emit/functions.ts +195 -0
- package/src/core/emit/gaps.ts +44 -0
- package/src/core/emit/index.ts +74 -0
- package/src/core/emit/inputs.ts +179 -0
- package/src/core/emit/layout.ts +165 -0
- package/src/core/emit/meta.ts +104 -0
- package/src/core/emit/opcodes.ts +160 -0
- package/src/core/emit/outputs.ts +357 -0
- package/src/core/emit/pool.ts +102 -0
- package/src/core/emit/program.ts +385 -0
- package/src/core/emit/registers.ts +179 -0
- package/src/core/emit/request-scope.ts +52 -0
- package/src/core/emit/requests.ts +258 -0
- package/src/core/emit/requires.ts +91 -0
- package/src/core/emit/sha256.ts +119 -0
- package/src/core/emit/statements.ts +438 -0
- package/src/core/emit/values.ts +284 -0
- package/src/core/engine/alerts.ts +152 -0
- package/src/core/engine/arithmetic.ts +165 -0
- package/src/core/engine/bars.ts +224 -0
- package/src/core/engine/budget.ts +284 -0
- package/src/core/engine/channels.ts +171 -0
- package/src/core/engine/drawings.ts +127 -0
- package/src/core/engine/engine.ts +498 -0
- package/src/core/engine/errors.ts +100 -0
- package/src/core/engine/frames.ts +85 -0
- package/src/core/engine/grids.ts +98 -0
- package/src/core/engine/guard.ts +71 -0
- package/src/core/engine/host.ts +251 -0
- package/src/core/engine/index.ts +93 -0
- package/src/core/engine/inputs.ts +263 -0
- package/src/core/engine/ledger/call.ts +218 -0
- package/src/core/engine/ledger/closable.ts +269 -0
- package/src/core/engine/ledger/holdings.ts +354 -0
- package/src/core/engine/ledger/index.ts +28 -0
- package/src/core/engine/ledger/intent.ts +112 -0
- package/src/core/engine/ledger/ledger.ts +314 -0
- package/src/core/engine/ledger/place.ts +277 -0
- package/src/core/engine/ledger/positions.ts +123 -0
- package/src/core/engine/ledger/refuse.ts +378 -0
- package/src/core/engine/ledger/row.ts +318 -0
- package/src/core/engine/ledger/sizing.ts +292 -0
- package/src/core/engine/library/arrays.ts +316 -0
- package/src/core/engine/library/averages.ts +97 -0
- package/src/core/engine/library/binding.ts +325 -0
- package/src/core/engine/library/chart.ts +115 -0
- package/src/core/engine/library/colours.ts +111 -0
- package/src/core/engine/library/dates.ts +109 -0
- package/src/core/engine/library/index.ts +103 -0
- package/src/core/engine/library/maths.ts +134 -0
- package/src/core/engine/library/objects.ts +265 -0
- package/src/core/engine/library/oscillators.ts +124 -0
- package/src/core/engine/library/ranges.ts +51 -0
- package/src/core/engine/library/series.ts +236 -0
- package/src/core/engine/library/state.ts +47 -0
- package/src/core/engine/library/studies.ts +150 -0
- package/src/core/engine/library/text.ts +303 -0
- package/src/core/engine/library/trend.ts +79 -0
- package/src/core/engine/library/volume.ts +101 -0
- package/src/core/engine/load.ts +104 -0
- package/src/core/engine/machine.ts +446 -0
- package/src/core/engine/memory.ts +129 -0
- package/src/core/engine/operations.ts +171 -0
- package/src/core/engine/orders.ts +121 -0
- package/src/core/engine/registers.ts +104 -0
- package/src/core/engine/request-body.ts +328 -0
- package/src/core/engine/request-plan.ts +270 -0
- package/src/core/engine/requests.ts +382 -0
- package/src/core/engine/results.ts +41 -0
- package/src/core/engine/series.ts +82 -0
- package/src/core/engine/session/hours.ts +86 -0
- package/src/core/engine/session/index.ts +17 -0
- package/src/core/engine/session/record.ts +191 -0
- package/src/core/engine/session/spec.ts +45 -0
- package/src/core/engine/timeframe.ts +161 -0
- package/src/core/engine/types.ts +47 -0
- package/src/core/engine/values/heap.ts +295 -0
- package/src/core/engine/values/index.ts +34 -0
- package/src/core/engine/values/value.ts +158 -0
- package/src/core/engine/verify-budgets.ts +202 -0
- package/src/core/engine/verify-code.ts +332 -0
- package/src/core/engine/verify-requests.ts +255 -0
- package/src/core/engine/verify-shape.ts +164 -0
- package/src/core/engine/verify-tables.ts +176 -0
- package/src/core/engine/verify.ts +341 -0
- package/src/core/index.ts +129 -6
- package/src/core/parse/expressions.ts +1 -1
- package/src/core/parse/functions.ts +109 -109
- package/src/core/parse/names.ts +29 -2
- package/src/core/parse/switches.ts +105 -105
- package/src/core/stdlib/averages/exponential.ts +119 -0
- package/src/core/stdlib/averages/index.ts +45 -0
- package/src/core/stdlib/averages/select.ts +71 -0
- package/src/core/stdlib/averages/shaped.ts +161 -0
- package/src/core/stdlib/averages/simple.ts +139 -0
- package/src/core/stdlib/calendar/civil.ts +89 -0
- package/src/core/stdlib/calendar/fields.ts +124 -0
- package/src/core/stdlib/calendar/format.ts +71 -0
- package/src/core/stdlib/calendar/index.ts +15 -0
- package/src/core/stdlib/calendar/zone.ts +161 -0
- package/src/core/stdlib/index.ts +400 -0
- package/src/core/stdlib/maths/arithmetic.ts +74 -0
- package/src/core/stdlib/maths/elementary.ts +124 -0
- package/src/core/stdlib/maths/index.ts +43 -0
- package/src/core/stdlib/maths/rounding.ts +78 -0
- package/src/core/stdlib/momentum/convergence.ts +82 -0
- package/src/core/stdlib/momentum/index.ts +47 -0
- package/src/core/stdlib/momentum/pressure.ts +141 -0
- package/src/core/stdlib/momentum/rates.ts +188 -0
- package/src/core/stdlib/momentum/rsi.ts +49 -0
- package/src/core/stdlib/momentum/stochastic.ts +147 -0
- package/src/core/stdlib/series/changes.ts +177 -0
- package/src/core/stdlib/series/conditions.ts +74 -0
- package/src/core/stdlib/series/extremes.ts +92 -0
- package/src/core/stdlib/series/index.ts +83 -0
- package/src/core/stdlib/series/pivots.ts +63 -0
- package/src/core/stdlib/series/statistics.ts +207 -0
- package/src/core/stdlib/series/totals.ts +164 -0
- package/src/core/stdlib/trend/directional.ts +196 -0
- package/src/core/stdlib/trend/index.ts +13 -0
- package/src/core/stdlib/trend/psar.ts +131 -0
- package/src/core/stdlib/trend/supertrend.ts +100 -0
- package/src/core/stdlib/values/bar.ts +54 -0
- package/src/core/stdlib/values/index.ts +14 -0
- package/src/core/stdlib/values/lookback.ts +198 -0
- package/src/core/stdlib/values/region.ts +86 -0
- package/src/core/stdlib/values/tail.ts +58 -0
- package/src/core/stdlib/values/value.ts +82 -0
- package/src/core/stdlib/volatility/bands.ts +178 -0
- package/src/core/stdlib/volatility/deviation.ts +111 -0
- package/src/core/stdlib/volatility/index.ts +48 -0
- package/src/core/stdlib/volatility/measures.ts +96 -0
- package/src/core/stdlib/volatility/range.ts +143 -0
- package/src/core/stdlib/volume/accumulation.ts +152 -0
- package/src/core/stdlib/volume/flow.ts +173 -0
- package/src/core/stdlib/volume/index.ts +43 -0
- package/src/core/stdlib/volume/weighted.ts +101 -0
- package/src/core/version/index.ts +1 -0
- package/src/core/version/version.generated.ts +15 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The checked tree: what the checker hands the code generator.
|
|
3
|
+
*
|
|
4
|
+
* The syntax tree is not rebuilt. Every answer the checker worked out is
|
|
5
|
+
* recorded against the node it is about, so the generator walks the same tree
|
|
6
|
+
* the parser produced and looks up what it needs. The alternative, a second
|
|
7
|
+
* tree of parallel nodes, would double the shapes anyone has to learn and would
|
|
8
|
+
* put the spans one edit away from disagreeing with the source.
|
|
9
|
+
*
|
|
10
|
+
* What is here is chosen so the generator re-derives nothing. It does not have
|
|
11
|
+
* to work out which declaration a name means, what type an expression has, how
|
|
12
|
+
* many bars a value needs, whether a name lives in a slot, a cell or a series
|
|
13
|
+
* register, which call sites need a state region, or which reads repaint. Each
|
|
14
|
+
* of those is a question the checker already had to answer to report its own
|
|
15
|
+
* diagnostics, and asking it twice is how two stages come to disagree.
|
|
16
|
+
*
|
|
17
|
+
* `compiled-program.md` sections 2.6 to 2.13 name the arrays a program carries.
|
|
18
|
+
* The lists below are in the same order the program's are, so the generator
|
|
19
|
+
* writes them out rather than sorting anything.
|
|
20
|
+
*/
|
|
21
|
+
import type {
|
|
22
|
+
Argument,
|
|
23
|
+
Call,
|
|
24
|
+
Expression,
|
|
25
|
+
FunctionDeclaration,
|
|
26
|
+
Name,
|
|
27
|
+
NameReference,
|
|
28
|
+
Script,
|
|
29
|
+
ScriptDeclaration,
|
|
30
|
+
} from '../ast/index.js';
|
|
31
|
+
import type { Span } from '../span/index.js';
|
|
32
|
+
import type { LibraryEntry } from './library.js';
|
|
33
|
+
import type { HandleKind, Type } from './types.js';
|
|
34
|
+
import type { Warmup } from './warmup.js';
|
|
35
|
+
|
|
36
|
+
/** Where a name was introduced, which decides what may be done to it. */
|
|
37
|
+
export type BindingKind = 'file' | 'block' | 'parameter' | 'loop' | 'library' | 'function';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Where the value lives between bars, `compiled-program.md` 2.10 and 2.11.
|
|
41
|
+
*
|
|
42
|
+
* A register is allocated only for a top-level name whose history the program
|
|
43
|
+
* reads, which is the rule that section states; everything else that is not
|
|
44
|
+
* persistent is a slot, and a `var` is a cell.
|
|
45
|
+
*/
|
|
46
|
+
export type Storage = 'slot' | 'cell' | 'register' | 'none';
|
|
47
|
+
|
|
48
|
+
export interface Binding {
|
|
49
|
+
readonly id: number;
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly kind: BindingKind;
|
|
52
|
+
/** `var` and `live var` survive the bar; `live` opts out of rollback. */
|
|
53
|
+
readonly persistence: 'none' | 'var' | 'live';
|
|
54
|
+
readonly type: Type;
|
|
55
|
+
readonly warmup: Warmup;
|
|
56
|
+
readonly storage: Storage;
|
|
57
|
+
/** The name as it was written, which is what OS2002 and OS8010 point at. */
|
|
58
|
+
readonly declaredAt: Span;
|
|
59
|
+
/** Whether any line reads this name's past, which is what allocates a register. */
|
|
60
|
+
readonly readsHistory: boolean;
|
|
61
|
+
/** Whether any line reads it at all. False is OS8010. */
|
|
62
|
+
readonly isRead: boolean;
|
|
63
|
+
/** The input this name holds, when its value came from `input()`. */
|
|
64
|
+
readonly input: number | undefined;
|
|
65
|
+
/** The declaration handle this name holds, when it came from `plot` or `level`. */
|
|
66
|
+
readonly handle: HandleKind | undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The control a host builds for one `input()`, `compiled-program.md` 2.6. */
|
|
70
|
+
export type InputKind =
|
|
71
|
+
| 'number'
|
|
72
|
+
| 'bool'
|
|
73
|
+
| 'string'
|
|
74
|
+
| 'select'
|
|
75
|
+
| 'color'
|
|
76
|
+
| 'source'
|
|
77
|
+
| 'interval'
|
|
78
|
+
| 'time';
|
|
79
|
+
|
|
80
|
+
export interface CheckedInput {
|
|
81
|
+
readonly id: number;
|
|
82
|
+
readonly call: Call;
|
|
83
|
+
/** The name the value was assigned to, or an empty string where it was not. */
|
|
84
|
+
readonly name: string;
|
|
85
|
+
readonly title: string;
|
|
86
|
+
/**
|
|
87
|
+
* A title was written as a string literal, which an empty one still is.
|
|
88
|
+
*
|
|
89
|
+
* `title` cannot carry that on its own: a call with no title argument, a call
|
|
90
|
+
* whose title is an expression rather than a literal, and a call whose title
|
|
91
|
+
* is `""` all leave it empty, and the three are three different mistakes with
|
|
92
|
+
* three different fixes. The first two are OS3021 and the third is OS3024,
|
|
93
|
+
* whose message and fix have to be true of the program in front of the reader.
|
|
94
|
+
*/
|
|
95
|
+
readonly titleWritten: boolean;
|
|
96
|
+
readonly kind: InputKind;
|
|
97
|
+
readonly type: Type;
|
|
98
|
+
readonly span: Span;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** One entry of the study's fixed shape, `compiled-program.md` 2.8. */
|
|
102
|
+
export interface CheckedOutput {
|
|
103
|
+
readonly id: number;
|
|
104
|
+
readonly form: 'plot' | 'plotCandles' | 'fill' | 'level' | 'table';
|
|
105
|
+
readonly title: string;
|
|
106
|
+
readonly call: Call;
|
|
107
|
+
/** The first bar this column can draw on, which is what OS8009 reads. */
|
|
108
|
+
readonly warmup: Warmup;
|
|
109
|
+
readonly span: Span;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface CheckedFunction {
|
|
113
|
+
readonly id: number;
|
|
114
|
+
readonly declaration: FunctionDeclaration;
|
|
115
|
+
readonly parameters: readonly Binding[];
|
|
116
|
+
readonly returns: Type;
|
|
117
|
+
readonly warmup: Warmup;
|
|
118
|
+
/** Holds a `var` or calls something that does, so its call sites need state. */
|
|
119
|
+
readonly stateful: boolean;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* One call site, resolved.
|
|
124
|
+
*
|
|
125
|
+
* `arguments` is in the callee's parameter order with a hole where the default
|
|
126
|
+
* applies, rather than in the order they were written, so the generator emits
|
|
127
|
+
* them without matching labels a second time. What each default is belongs to
|
|
128
|
+
* the library manifest (`compiled-program.md` 2.5) and is not copied here.
|
|
129
|
+
*/
|
|
130
|
+
export interface CheckedCall {
|
|
131
|
+
readonly call: Call;
|
|
132
|
+
readonly name: string;
|
|
133
|
+
readonly target: 'library' | 'user' | 'unresolved';
|
|
134
|
+
readonly entry: LibraryEntry | undefined;
|
|
135
|
+
/** The index into `functions` when the callee is a user function. */
|
|
136
|
+
readonly fn: number | undefined;
|
|
137
|
+
readonly arguments: readonly (Argument | undefined)[];
|
|
138
|
+
readonly returns: Type;
|
|
139
|
+
readonly warmup: Warmup;
|
|
140
|
+
readonly stateful: boolean;
|
|
141
|
+
/** The per-call-site state region, `compiled-program.md` 2.11. */
|
|
142
|
+
readonly stateId: number | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* The arguments whose per-bar values this call site has to retain.
|
|
145
|
+
*
|
|
146
|
+
* A user function that reads `src[1]` reads the history of whatever the
|
|
147
|
+
* caller passed, so the caller writes that expression to a series register
|
|
148
|
+
* before the call (`compiled-program.md` 2.10 and 2.12). These are the
|
|
149
|
+
* parameter positions that need one.
|
|
150
|
+
*/
|
|
151
|
+
readonly seriesArguments: readonly number[];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** What a higher timeframe read is allowed to know, `stdlib.md` 15.3. */
|
|
155
|
+
export type RequestMode = 'confirmed' | 'developing' | 'lookahead' | 'unknown';
|
|
156
|
+
|
|
157
|
+
export interface CheckedRequest {
|
|
158
|
+
readonly id: number;
|
|
159
|
+
readonly call: Call;
|
|
160
|
+
readonly name: string;
|
|
161
|
+
readonly mode: RequestMode;
|
|
162
|
+
/** The timeframe as the source writes it: a literal, or the name that holds it. */
|
|
163
|
+
readonly timeframe: string;
|
|
164
|
+
readonly repaints: boolean;
|
|
165
|
+
readonly span: Span;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface CheckedDeclaration {
|
|
169
|
+
readonly node: ScriptDeclaration;
|
|
170
|
+
readonly form: 'study' | 'strategy';
|
|
171
|
+
readonly title: string;
|
|
172
|
+
/** Every option that was given, by name, with the expression it was given. */
|
|
173
|
+
readonly options: ReadonlyMap<string, Expression>;
|
|
174
|
+
readonly overlay: boolean;
|
|
175
|
+
/** Signals and orders may act on a bar that is still moving, language.md 7.5. */
|
|
176
|
+
readonly onUnconfirmed: boolean;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* A file, checked.
|
|
181
|
+
*
|
|
182
|
+
* `types` and `warmups` hold an answer for every expression the checker
|
|
183
|
+
* reached, including the ones it reported a diagnostic about, where the type is
|
|
184
|
+
* `unknown` so that nothing above them reports a second time.
|
|
185
|
+
*/
|
|
186
|
+
export interface CheckedScript {
|
|
187
|
+
readonly script: Script;
|
|
188
|
+
readonly declaration: CheckedDeclaration | undefined;
|
|
189
|
+
readonly inputs: readonly CheckedInput[];
|
|
190
|
+
readonly outputs: readonly CheckedOutput[];
|
|
191
|
+
readonly functions: readonly CheckedFunction[];
|
|
192
|
+
readonly bindings: readonly Binding[];
|
|
193
|
+
readonly calls: readonly CheckedCall[];
|
|
194
|
+
readonly requests: readonly CheckedRequest[];
|
|
195
|
+
/** Whether any read in the file shows a bar values from the future. */
|
|
196
|
+
readonly repaints: boolean;
|
|
197
|
+
/** How many state regions the program needs, `compiled-program.md` 2.11. */
|
|
198
|
+
readonly stateCount: number;
|
|
199
|
+
readonly types: ReadonlyMap<Expression, Type>;
|
|
200
|
+
readonly warmups: ReadonlyMap<Expression, Warmup>;
|
|
201
|
+
/** Every name used as a value, bound to the declaration it means. */
|
|
202
|
+
readonly references: ReadonlyMap<NameReference, Binding>;
|
|
203
|
+
/** Every name that introduces or updates one: a target, a `var`, a loop variable. */
|
|
204
|
+
readonly targets: ReadonlyMap<Name, Binding>;
|
|
205
|
+
readonly callSites: ReadonlyMap<Call, CheckedCall>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** The checker's own working copy of a record the tree publishes as read-only. */
|
|
209
|
+
export type Mutable<T> = { -readonly [K in keyof T]: T[K] };
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* The input a name stands for, which is not the input it was given.
|
|
213
|
+
*
|
|
214
|
+
* `len = input(14, "Length")` makes the name a second spelling of the setting:
|
|
215
|
+
* it is the input's own slot, it folds to the input's key where a declaration
|
|
216
|
+
* option wants a constant, and a read's expression resolves it to the setting
|
|
217
|
+
* (`compiled-program.md` 2.3, 2.6 and 2.16). `var len = input(14, "Length")`
|
|
218
|
+
* declares a cell a later assignment may change (`language.md` 8.2), so it
|
|
219
|
+
* holds the setting on the first bar and whatever it is given after that, and
|
|
220
|
+
* not one of those three is true of it.
|
|
221
|
+
*
|
|
222
|
+
* `input` stays set on both, because the input is the row either spelling
|
|
223
|
+
* declares and a row nothing reads is OS8018 either way. This is the narrower
|
|
224
|
+
* question, asked in one place so that three passes cannot answer it twice.
|
|
225
|
+
*/
|
|
226
|
+
export function inputHeldBy(binding: Binding): number | undefined {
|
|
227
|
+
return binding.persistence === 'none' ? binding.input : undefined;
|
|
228
|
+
}
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The checker's working state: scopes, bindings, and the answers as they are
|
|
3
|
+
* worked out.
|
|
4
|
+
*
|
|
5
|
+
* Everything mutable in the check lives here and nowhere else, so the passes
|
|
6
|
+
* over the tree are ordinary functions that take this and a node. The state is
|
|
7
|
+
* handed out as a `CheckedScript` at the end and is not touched again.
|
|
8
|
+
*
|
|
9
|
+
* Nothing in this file decides a rule of the language. It holds what the rules
|
|
10
|
+
* are decided from: which names are in scope here, what the source said, and
|
|
11
|
+
* where to put an answer once one of the passes has it.
|
|
12
|
+
*/
|
|
13
|
+
import type {
|
|
14
|
+
Call,
|
|
15
|
+
Expression,
|
|
16
|
+
FunctionDeclaration,
|
|
17
|
+
Name,
|
|
18
|
+
NameReference,
|
|
19
|
+
Script,
|
|
20
|
+
} from '../ast/index.js';
|
|
21
|
+
import type { DiagnosticCode, DiagnosticValues } from '../catalogue/index.js';
|
|
22
|
+
import type { DiagnosticSink } from '../diagnostics/index.js';
|
|
23
|
+
import type { SourceFile } from '../source/index.js';
|
|
24
|
+
import type { Span } from '../span/index.js';
|
|
25
|
+
import type {
|
|
26
|
+
Binding,
|
|
27
|
+
BindingKind,
|
|
28
|
+
CheckedCall,
|
|
29
|
+
CheckedDeclaration,
|
|
30
|
+
CheckedFunction,
|
|
31
|
+
CheckedInput,
|
|
32
|
+
CheckedOutput,
|
|
33
|
+
CheckedRequest,
|
|
34
|
+
CheckedScript,
|
|
35
|
+
Mutable,
|
|
36
|
+
Storage,
|
|
37
|
+
} from './checked.js';
|
|
38
|
+
import { conditionalCalls } from './conditional.js';
|
|
39
|
+
import { libraryNames } from './surface.js';
|
|
40
|
+
import { closestName } from './suggest.js';
|
|
41
|
+
import type { Type } from './types.js';
|
|
42
|
+
import { UNKNOWN } from './types.js';
|
|
43
|
+
import type { Warmup } from './warmup.js';
|
|
44
|
+
import { BAR_ZERO } from './warmup.js';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* One nesting of names, `language.md` 12.1.
|
|
48
|
+
*
|
|
49
|
+
* The global scope is not one of these: the library is a lookup of its own,
|
|
50
|
+
* consulted after every scope has been tried, because it holds three hundred
|
|
51
|
+
* names that never change and copying them into a map per compile would be the
|
|
52
|
+
* most expensive thing the checker does.
|
|
53
|
+
*/
|
|
54
|
+
export interface Scope {
|
|
55
|
+
readonly kind: 'file' | 'block' | 'function';
|
|
56
|
+
readonly names: Map<string, Mutable<Binding>>;
|
|
57
|
+
readonly parent: Scope | undefined;
|
|
58
|
+
/** The loop variable this scope introduced, which OS2006 refuses assignment to. */
|
|
59
|
+
readonly loopVariable: string | undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* What surrounds the statement being checked, for OS3006.
|
|
64
|
+
*
|
|
65
|
+
* Whether the thing being checked runs on every bar is deliberately not here.
|
|
66
|
+
* It is a fact about a node rather than about the path the pass took to reach
|
|
67
|
+
* it, and half of what makes a call conditional is an operator rather than a
|
|
68
|
+
* statement, so `conditional.ts` answers it from the tree and this carries only
|
|
69
|
+
* what a pass can know.
|
|
70
|
+
*/
|
|
71
|
+
export interface Placement {
|
|
72
|
+
/** True only for a statement written directly in the file, `language.md` 15.3. */
|
|
73
|
+
readonly topLevel: boolean;
|
|
74
|
+
/** The enclosing construct, named in OS3006's message. */
|
|
75
|
+
readonly construct: string | undefined;
|
|
76
|
+
/** Inside a `for` or `while` body, where `break` and `continue` are legal. */
|
|
77
|
+
readonly inLoop: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const TOP_LEVEL: Placement = {
|
|
81
|
+
topLevel: true,
|
|
82
|
+
construct: undefined,
|
|
83
|
+
inLoop: false,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export class Checker {
|
|
87
|
+
readonly file: SourceFile;
|
|
88
|
+
readonly sink: DiagnosticSink;
|
|
89
|
+
readonly script: Script;
|
|
90
|
+
|
|
91
|
+
/** The file scope, which is also where a `fn` puts its name. */
|
|
92
|
+
readonly fileScope: Scope;
|
|
93
|
+
scope: Scope;
|
|
94
|
+
|
|
95
|
+
declaration: CheckedDeclaration | undefined = undefined;
|
|
96
|
+
readonly inputs: Mutable<CheckedInput>[] = [];
|
|
97
|
+
readonly outputs: CheckedOutput[] = [];
|
|
98
|
+
readonly functions: Mutable<CheckedFunction>[] = [];
|
|
99
|
+
readonly bindings: Mutable<Binding>[] = [];
|
|
100
|
+
readonly calls: CheckedCall[] = [];
|
|
101
|
+
readonly requests: CheckedRequest[] = [];
|
|
102
|
+
|
|
103
|
+
readonly types = new Map<Expression, Type>();
|
|
104
|
+
readonly warmups = new Map<Expression, Warmup>();
|
|
105
|
+
/**
|
|
106
|
+
* The expressions a declaration handle is allowed to stand in, 5.4.
|
|
107
|
+
*
|
|
108
|
+
* `handles.ts` holds the rule and fills this. It is a set of permissions
|
|
109
|
+
* rather than a flag on the pass, because the permission belongs to one
|
|
110
|
+
* written expression: `fill(upper, lower)` may name a handle, and an
|
|
111
|
+
* expression inside one of those arguments may not.
|
|
112
|
+
*/
|
|
113
|
+
readonly handleSites = new Set<Expression>();
|
|
114
|
+
readonly references = new Map<NameReference, Binding>();
|
|
115
|
+
readonly targets = new Map<Name, Binding>();
|
|
116
|
+
readonly callSites = new Map<Call, CheckedCall>();
|
|
117
|
+
/**
|
|
118
|
+
* The multi-output call a name holds, by binding, for `m[1]`.
|
|
119
|
+
*
|
|
120
|
+
* A warmup is recorded against an expression, and an element's warmup is not
|
|
121
|
+
* a fact about the array expression: it is a fact about the call the name was
|
|
122
|
+
* given, which `m[1]` has to reach two statements later. Only the calls whose
|
|
123
|
+
* outputs warm up at different bars are kept, because for every other one the
|
|
124
|
+
* array's warmup is already the element's.
|
|
125
|
+
*/
|
|
126
|
+
private readonly multiOutputs = new Map<number, CheckedCall>();
|
|
127
|
+
|
|
128
|
+
/** The declarations of every `fn`, collected before any body is checked. */
|
|
129
|
+
readonly functionsByName = new Map<string, number>();
|
|
130
|
+
readonly functionNodes = new Map<string, FunctionDeclaration>();
|
|
131
|
+
/** Bodies already checked, and the ones being checked, so a cycle stops. */
|
|
132
|
+
readonly checkedFunctions = new Set<number>();
|
|
133
|
+
readonly checkingFunctions = new Set<number>();
|
|
134
|
+
|
|
135
|
+
repaints = false;
|
|
136
|
+
stateCount = 0;
|
|
137
|
+
/** How deep inside a `req` expression the pass is, `stdlib.md` 15.4. */
|
|
138
|
+
requestDepth = 0;
|
|
139
|
+
/** The function whose body is being checked, for its own statefulness. */
|
|
140
|
+
currentFunction: Mutable<CheckedFunction> | undefined = undefined;
|
|
141
|
+
/** What the body being checked returns, gathered as the `return`s are met. */
|
|
142
|
+
pendingReturns: { readonly type: Type; readonly warmup: Warmup }[] = [];
|
|
143
|
+
|
|
144
|
+
/** Every call site a bar can pass without evaluating, `language.md` 11.4. */
|
|
145
|
+
private readonly conditional: ReadonlySet<Call>;
|
|
146
|
+
|
|
147
|
+
constructor(file: SourceFile, script: Script, sink: DiagnosticSink) {
|
|
148
|
+
this.file = file;
|
|
149
|
+
this.script = script;
|
|
150
|
+
this.sink = sink;
|
|
151
|
+
this.fileScope = { kind: 'file', names: new Map(), parent: undefined, loopVariable: undefined };
|
|
152
|
+
this.scope = this.fileScope;
|
|
153
|
+
this.conditional = conditionalCalls(script);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Whether this call site can be skipped on a bar, which is what OS8001 asks.
|
|
158
|
+
*
|
|
159
|
+
* Asked of the call rather than of the pass that reached it, so the answer is
|
|
160
|
+
* the same wherever the call was written: inside an `if`, in a ternary arm,
|
|
161
|
+
* or on the right of an `and` that short-circuited.
|
|
162
|
+
*/
|
|
163
|
+
isConditional(call: Call): boolean {
|
|
164
|
+
return this.conditional.has(call);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
report<Code extends DiagnosticCode>(
|
|
168
|
+
code: Code,
|
|
169
|
+
span: Span,
|
|
170
|
+
values: DiagnosticValues[Code],
|
|
171
|
+
): void {
|
|
172
|
+
this.sink.report(code, span, values);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** The source text a span covers, for the codes that quote what was written. */
|
|
176
|
+
textOf(span: Span): string {
|
|
177
|
+
return this.file.text.slice(span.offset, span.offset + span.length).trim();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Opens a scope, runs the body in it, and closes it however the body ends. */
|
|
181
|
+
inScope<T>(kind: Scope['kind'], loopVariable: string | undefined, body: () => T): T {
|
|
182
|
+
const parent = this.scope;
|
|
183
|
+
this.scope = { kind, names: new Map(), parent, loopVariable };
|
|
184
|
+
try {
|
|
185
|
+
return body();
|
|
186
|
+
} finally {
|
|
187
|
+
this.scope = parent;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The declaration a name means here, and whether a function body stands
|
|
193
|
+
* between the two.
|
|
194
|
+
*
|
|
195
|
+
* A plain assignment updates an enclosing name (`language.md` 12.2), and a
|
|
196
|
+
* function body is the one place that does not hold: 12.3's own example makes
|
|
197
|
+
* an assignment to a file-scope name from inside a `fn` OS2002.
|
|
198
|
+
*/
|
|
199
|
+
lookupAcross(name: string): {
|
|
200
|
+
readonly binding: Mutable<Binding> | undefined;
|
|
201
|
+
readonly crossedFunction: boolean;
|
|
202
|
+
} {
|
|
203
|
+
let crossedFunction = false;
|
|
204
|
+
for (let scope: Scope | undefined = this.scope; scope !== undefined; scope = scope.parent) {
|
|
205
|
+
const found = scope.names.get(name);
|
|
206
|
+
if (found !== undefined) return { binding: found, crossedFunction };
|
|
207
|
+
if (scope.kind === 'function') crossedFunction = true;
|
|
208
|
+
}
|
|
209
|
+
return { binding: undefined, crossedFunction };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** The declaration a name means here, or nothing when no scope holds it. */
|
|
213
|
+
lookup(name: string): Mutable<Binding> | undefined {
|
|
214
|
+
for (let scope: Scope | undefined = this.scope; scope !== undefined; scope = scope.parent) {
|
|
215
|
+
const found = scope.names.get(name);
|
|
216
|
+
if (found !== undefined) return found;
|
|
217
|
+
}
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** Whether an enclosing scope already holds the name, which is OS2002. */
|
|
222
|
+
enclosing(name: string): Mutable<Binding> | undefined {
|
|
223
|
+
for (
|
|
224
|
+
let scope: Scope | undefined = this.scope.parent;
|
|
225
|
+
scope !== undefined;
|
|
226
|
+
scope = scope.parent
|
|
227
|
+
) {
|
|
228
|
+
const found = scope.names.get(name);
|
|
229
|
+
if (found !== undefined) return found;
|
|
230
|
+
}
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Whether the name belongs to the loop being executed, `language.md` 10.3. */
|
|
235
|
+
loopVariableNamed(name: string): boolean {
|
|
236
|
+
for (let scope: Scope | undefined = this.scope; scope !== undefined; scope = scope.parent) {
|
|
237
|
+
if (scope.loopVariable === name) return true;
|
|
238
|
+
if (scope.names.has(name)) return false;
|
|
239
|
+
}
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** Declares a name in the current scope and records it in the checked tree. */
|
|
244
|
+
declare(
|
|
245
|
+
name: Name,
|
|
246
|
+
kind: BindingKind,
|
|
247
|
+
type: Type,
|
|
248
|
+
warmup: Warmup,
|
|
249
|
+
persistence: Binding['persistence'] = 'none',
|
|
250
|
+
): Mutable<Binding> {
|
|
251
|
+
const binding: Mutable<Binding> = {
|
|
252
|
+
id: this.bindings.length,
|
|
253
|
+
name: name.text,
|
|
254
|
+
kind,
|
|
255
|
+
persistence,
|
|
256
|
+
type,
|
|
257
|
+
warmup,
|
|
258
|
+
storage: storageFor(kind, persistence),
|
|
259
|
+
declaredAt: name.span,
|
|
260
|
+
readsHistory: false,
|
|
261
|
+
isRead: false,
|
|
262
|
+
input: undefined,
|
|
263
|
+
handle: undefined,
|
|
264
|
+
};
|
|
265
|
+
this.bindings.push(binding);
|
|
266
|
+
this.scope.names.set(name.text, binding);
|
|
267
|
+
this.targets.set(name, binding);
|
|
268
|
+
return binding;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Remembers, or forgets, the multi-output call a name was just given.
|
|
273
|
+
*
|
|
274
|
+
* Forgetting on a reassignment rather than keeping the first call is what
|
|
275
|
+
* stops `m[1]` from being answered about a call the name no longer holds:
|
|
276
|
+
* the array's own warmup is the fallback, and it is a floor for every
|
|
277
|
+
* element.
|
|
278
|
+
*/
|
|
279
|
+
holdsMultiOutput(binding: number, call: CheckedCall | undefined): void {
|
|
280
|
+
if (call === undefined || call.entry === undefined || call.entry.elements.length === 0) {
|
|
281
|
+
this.multiOutputs.delete(binding);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
this.multiOutputs.set(binding, call);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** The multi-output call this name holds here, when it holds one. */
|
|
288
|
+
multiOutputOf(name: string): CheckedCall | undefined {
|
|
289
|
+
const binding = this.lookup(name);
|
|
290
|
+
return binding === undefined ? undefined : this.multiOutputs.get(binding.id);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
record(expression: Expression, type: Type, warmup: Warmup): Type {
|
|
294
|
+
this.types.set(expression, type);
|
|
295
|
+
this.warmups.set(expression, warmup);
|
|
296
|
+
return type;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
typeOf(expression: Expression): Type {
|
|
300
|
+
return this.types.get(expression) ?? UNKNOWN;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
warmupOf(expression: Expression): Warmup {
|
|
304
|
+
return this.warmups.get(expression) ?? BAR_ZERO;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Every name a reader could have meant here: the scopes, then the library. */
|
|
308
|
+
namesInScope(): readonly string[] {
|
|
309
|
+
const names = new Set<string>();
|
|
310
|
+
for (let scope: Scope | undefined = this.scope; scope !== undefined; scope = scope.parent) {
|
|
311
|
+
for (const name of scope.names.keys()) names.add(name);
|
|
312
|
+
}
|
|
313
|
+
for (const name of libraryNames()) names.add(name);
|
|
314
|
+
return [...names];
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
suggestionFor(written: string): string {
|
|
318
|
+
return closestName(written, this.namesInScope());
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** A state region for one call site, `compiled-program.md` 2.11. */
|
|
322
|
+
takeStateId(): number {
|
|
323
|
+
const id = this.stateCount;
|
|
324
|
+
this.stateCount += 1;
|
|
325
|
+
return id;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
finish(): CheckedScript {
|
|
329
|
+
return {
|
|
330
|
+
script: this.script,
|
|
331
|
+
declaration: this.declaration,
|
|
332
|
+
inputs: this.inputs,
|
|
333
|
+
outputs: this.outputs,
|
|
334
|
+
functions: this.functions,
|
|
335
|
+
bindings: this.bindings,
|
|
336
|
+
calls: this.calls,
|
|
337
|
+
requests: this.requests,
|
|
338
|
+
repaints: this.repaints,
|
|
339
|
+
stateCount: this.stateCount,
|
|
340
|
+
types: this.types,
|
|
341
|
+
warmups: this.warmups,
|
|
342
|
+
references: this.references,
|
|
343
|
+
targets: this.targets,
|
|
344
|
+
callSites: this.callSites,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* OS7001: a name the library gives only to a file declared with `strategy()`.
|
|
351
|
+
*
|
|
352
|
+
* The message names the line of the `study()` declaration rather than the call,
|
|
353
|
+
* because that is the line the reader has to change: the call is what they
|
|
354
|
+
* meant, and the declaration is what refuses it.
|
|
355
|
+
*/
|
|
356
|
+
export function reportStrategyOnly(
|
|
357
|
+
checker: Checker,
|
|
358
|
+
name: string,
|
|
359
|
+
span: Span,
|
|
360
|
+
strategyOnly: boolean,
|
|
361
|
+
): void {
|
|
362
|
+
const declaration = checker.declaration;
|
|
363
|
+
if (!strategyOnly || declaration === undefined || declaration.form === 'strategy') return;
|
|
364
|
+
checker.report('OS7001', span, { name, line: declaration.node.span.line });
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Where a name's value lives between bars.
|
|
369
|
+
*
|
|
370
|
+
* A top-level name starts in a slot and is moved to a register only when the
|
|
371
|
+
* program turns out to read its history, which the checker knows by the end and
|
|
372
|
+
* `finaliseStorage` applies. Everything below the top level is a slot, and a
|
|
373
|
+
* `var` is a cell whatever scope it was written in.
|
|
374
|
+
*/
|
|
375
|
+
function storageFor(kind: BindingKind, persistence: Binding['persistence']): Storage {
|
|
376
|
+
if (persistence !== 'none') return 'cell';
|
|
377
|
+
return kind === 'library' || kind === 'function' ? 'none' : 'slot';
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Promotes the top-level names whose history is read to series registers.
|
|
382
|
+
*
|
|
383
|
+
* `compiled-program.md` 2.10 allocates a register only for a name the program
|
|
384
|
+
* reads the past of, and this is the one place that decides it, once every read
|
|
385
|
+
* in the file has been seen.
|
|
386
|
+
*/
|
|
387
|
+
export function finaliseStorage(checker: Checker): void {
|
|
388
|
+
for (const binding of checker.bindings) {
|
|
389
|
+
if (binding.readsHistory && binding.kind === 'file' && binding.persistence === 'none') {
|
|
390
|
+
binding.storage = 'register';
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|