Refactor source ranges into a generic node type (#4350)
* WIP Signed-off-by: Nick Cameron <nrc@ncameron.org> * Fix formatting * Fix yarn build:wasm * Fix ts_rs bindings * Fix tsc errors * Fix wasm TS types * Add minimal failing test * Rename field to avoid name collisions * Remove node wrapper around NonCodeMeta Trying to fix TS unit test errors deserializing JSON AST in Rust. * Rename Node to BoxNode * Fix lints * Fix lint by boxing literals * Rename UnboxedNode to Node * Look at this (photo)Graph *in the voice of Nickelback* * Update docs * Update snapshots * initial trait Signed-off-by: Jess Frazelle <github@jessfraz.com> * update docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * gross hack for TagNode Signed-off-by: Jess Frazelle <github@jessfraz.com> * extend gross hack Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix EnvRef bullshit Signed-off-by: Jess Frazelle <github@jessfraz.com> * Fix to fail parsing when a tag declarator matches a stdlib function name * Fix test errors after merging main * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * Confirm * Change to use simpler map_err * Add comment --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
14964
docs/kcl/std.json
14964
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
@ -23,11 +23,11 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `Literal`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |[`LiteralValue`](/docs/kcl/types/LiteralValue)| | No |
|
||||
| `raw` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -43,10 +43,10 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -62,12 +62,12 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `BinaryExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `operator` |[`BinaryOperator`](/docs/kcl/types/BinaryOperator)| | No |
|
||||
| `left` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| | No |
|
||||
| `right` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -83,12 +83,12 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `CallExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `callee` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `arguments` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||
| `optional` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -104,11 +104,11 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `UnaryExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `operator` |[`UnaryOperator`](/docs/kcl/types/UnaryOperator)| | No |
|
||||
| `argument` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -124,12 +124,12 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `MemberExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `object` |[`MemberObject`](/docs/kcl/types/MemberObject)| | No |
|
||||
| `property` |[`LiteralIdentifier`](/docs/kcl/types/LiteralIdentifier)| | No |
|
||||
| `computed` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -145,13 +145,13 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `IfExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `cond` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `then_val` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||
| `else_ifs` |`[` [`ElseIf`](/docs/kcl/types/ElseIf) `]`| | No |
|
||||
| `final_else` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -23,12 +23,12 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `ImportStatement`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `items` |`[` [`ImportItem`](/docs/kcl/types/ImportItem) `]`| | No |
|
||||
| `path` |`string`| | No |
|
||||
| `raw_path` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -44,10 +44,10 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `ExpressionStatement`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `expression` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -63,12 +63,12 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `VariableDeclaration`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `declarations` |`[` [`VariableDeclarator`](/docs/kcl/types/VariableDeclarator) `]`| | No |
|
||||
| `visibility` |[`ItemVisibility`](/docs/kcl/types/ItemVisibility)| | No |
|
||||
| `kind` |[`VariableKind`](/docs/kcl/types/VariableKind)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -84,10 +84,10 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `ReturnStatement`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `argument` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -15,10 +15,10 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `cond` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `then_val` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
|
@ -16,6 +16,6 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `bindings` |`object`| | No |
|
||||
| `parent` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `parent` |`integer`| | No |
|
||||
|
||||
|
||||
|
@ -24,11 +24,11 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `Literal`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |[`LiteralValue`](/docs/kcl/types/LiteralValue)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `raw` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -44,10 +44,10 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -63,10 +63,10 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -82,12 +82,12 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `BinaryExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `operator` |[`BinaryOperator`](/docs/kcl/types/BinaryOperator)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `left` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `right` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -103,11 +103,11 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`FunctionExpression`](/docs/kcl/types/FunctionExpression)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `params` |`[` [`Parameter`](/docs/kcl/types/Parameter) `]`| | No |
|
||||
| `body` |[`Program`](/docs/kcl/types/Program)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -123,12 +123,12 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `CallExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `callee` |[`Identifier`](/docs/kcl/types/Identifier)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `arguments` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||
| `optional` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -144,11 +144,11 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `PipeExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `body` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -164,9 +164,9 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `PipeSubstitution`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -182,11 +182,11 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `ArrayExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `elements` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -202,12 +202,12 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `ArrayRangeExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `startElement` |[`Expr`](/docs/kcl/types/Expr)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `endElement` |[`Expr`](/docs/kcl/types/Expr)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `endInclusive` |`boolean`| Is the `end_element` included in the range? | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -223,11 +223,11 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `ObjectExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `properties` |`[` [`ObjectProperty`](/docs/kcl/types/ObjectProperty) `]`| | No |
|
||||
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -243,12 +243,12 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `MemberExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `object` |[`MemberObject`](/docs/kcl/types/MemberObject)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `property` |[`LiteralIdentifier`](/docs/kcl/types/LiteralIdentifier)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `computed` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -264,11 +264,11 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `UnaryExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `operator` |[`UnaryOperator`](/docs/kcl/types/UnaryOperator)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `argument` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -284,13 +284,13 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `IfExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `cond` |[`Expr`](/docs/kcl/types/Expr)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `then_val` |[`Program`](/docs/kcl/types/Program)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `else_ifs` |`[` [`ElseIf`](/docs/kcl/types/ElseIf) `]`| | No |
|
||||
| `final_else` |[`Program`](/docs/kcl/types/Program)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -307,8 +307,8 @@ KCL value for an optional parameter which was not given an argument. (remember,
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `None`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -15,10 +15,10 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `params` |`[` [`Parameter`](/docs/kcl/types/Parameter) `]`| | No |
|
||||
| `body` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
|
@ -15,9 +15,9 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
|
@ -17,8 +17,8 @@ layout: manual
|
||||
|----------|------|-------------|----------|
|
||||
| `name` |[`Identifier`](/docs/kcl/types/Identifier)| Name of the item to import. | No |
|
||||
| `alias` |[`Identifier`](/docs/kcl/types/Identifier)| Rename the item using an identifier after "as". | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
|
@ -59,10 +59,10 @@ Any KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -23,10 +23,10 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -42,11 +42,11 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `Literal`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |[`LiteralValue`](/docs/kcl/types/LiteralValue)| | No |
|
||||
| `raw` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -23,12 +23,12 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `MemberExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `object` |[`MemberObject`](/docs/kcl/types/MemberObject)| | No |
|
||||
| `property` |[`LiteralIdentifier`](/docs/kcl/types/LiteralIdentifier)| | No |
|
||||
| `computed` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -44,10 +44,10 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -16,7 +16,7 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `nonCodeNodes` |`object`| | No |
|
||||
| `start` |`[` [`NonCodeNode`](/docs/kcl/types/NonCodeNode) `]`| | No |
|
||||
| `startNodes` |`[` [`NonCodeNode`](/docs/kcl/types/NonCodeNode) `]`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
|
@ -15,9 +15,9 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |[`NonCodeValue`](/docs/kcl/types/NonCodeValue)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
|
@ -15,10 +15,10 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `key` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `value` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
|
@ -16,10 +16,10 @@ A KCL program top level, or function body.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `body` |`[` [`BodyItem`](/docs/kcl/types/BodyItem) `]`| | No |
|
||||
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| A KCL program top level, or function body. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `environments` |`[` [`Environment`](/docs/kcl/types/Environment) `]`| | No |
|
||||
| `currentEnv` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `currentEnv` |`integer`| | No |
|
||||
| `return` |[`KclValue`](/docs/kcl/types/KclValue)| | No |
|
||||
|
||||
|
||||
|
@ -15,10 +15,10 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `id` |[`Identifier`](/docs/kcl/types/Identifier)| The identifier of the variable. | No |
|
||||
| `init` |[`Expr`](/docs/kcl/types/Expr)| The value of the variable. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
| `start` |`integer`| | No |
|
||||
| `end` |`integer`| | No |
|
||||
|
||||
|
||||
|
@ -34,6 +34,11 @@
|
||||
"title": "Car Wheel Assembly",
|
||||
"description": "A car wheel assembly with a rotor, tire, and lug nuts."
|
||||
},
|
||||
{
|
||||
"file": "dodecahedron.kcl",
|
||||
"title": "Hollow Dodecahedron",
|
||||
"description": "A regular dodecahedron or pentagonal dodecahedron is a dodecahedron composed of regular pentagonal faces, three meeting at each vertex. This example shows constructing the individual faces of the dodecahedron and extruding inwards."
|
||||
},
|
||||
{
|
||||
"file": "enclosure.kcl",
|
||||
"title": "Enclosure",
|
||||
@ -54,6 +59,11 @@
|
||||
"title": "A mounting bracket for the Focusrite Scarlett Solo audio interface",
|
||||
"description": "This is a bracket that holds an audio device underneath a desk or shelf. The audio device has dimensions of 144mm wide, 80mm length and 45mm depth with fillets of 6mm. This mounting bracket is designed to be 3D printed with PLA material"
|
||||
},
|
||||
{
|
||||
"file": "food-service-spatula.kcl",
|
||||
"title": "Food Service Spatula",
|
||||
"description": "Use these spatulas for mixing, flipping, and scraping."
|
||||
},
|
||||
{
|
||||
"file": "french-press.kcl",
|
||||
"title": "French Press",
|
||||
@ -61,7 +71,7 @@
|
||||
},
|
||||
{
|
||||
"file": "gear.kcl",
|
||||
"title": "Gear",
|
||||
"title": "Spur Gear",
|
||||
"description": "A rotating machine part having cut teeth or, in the case of a cogwheel, inserted teeth (called cogs), which mesh with another toothed part to transmit torque. Geared devices can change the speed, torque, and direction of a power source. The two elements that define a gear are its circular shape and the teeth that are integrated into its outer edge, which are designed to fit into the teeth of another gear."
|
||||
},
|
||||
{
|
||||
|
@ -44,6 +44,7 @@ import {
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { useCommandsContext } from 'hooks/useCommandsContext'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
|
||||
const [isCamMoving, setIsCamMoving] = useState(false)
|
||||
@ -201,7 +202,7 @@ const Overlay = ({
|
||||
let xAlignment = overlay.angle < 0 ? '0%' : '-100%'
|
||||
let yAlignment = overlay.angle < -90 || overlay.angle >= 90 ? '0%' : '-100%'
|
||||
|
||||
const _node1 = getNodeFromPath<CallExpression>(
|
||||
const _node1 = getNodeFromPath<Node<CallExpression>>(
|
||||
kclManager.ast,
|
||||
overlay.pathToNode,
|
||||
'CallExpression'
|
||||
@ -381,7 +382,7 @@ export async function deleteSegment({
|
||||
pathToNode: PathToNode
|
||||
sketchDetails: SketchDetails | null
|
||||
}) {
|
||||
let modifiedAst: Program | Error = kclManager.ast
|
||||
let modifiedAst: Node<Program> | Error = kclManager.ast
|
||||
const dependentRanges = findUsesOfTagInPipe(modifiedAst, pathToNode)
|
||||
|
||||
const shouldContinueSegDelete = dependentRanges.length
|
||||
|
@ -92,6 +92,7 @@ import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||
import { Point3d } from 'wasm-lib/kcl/bindings/Point3d'
|
||||
import { SegmentInputs } from 'lang/std/stdTypes'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
type DraftSegment = 'line' | 'tangentialArcTo'
|
||||
|
||||
@ -374,14 +375,14 @@ export class SceneEntities {
|
||||
selectionRanges,
|
||||
}: {
|
||||
sketchPathToNode: PathToNode
|
||||
maybeModdedAst: Program
|
||||
maybeModdedAst: Node<Program>
|
||||
draftExpressionsIndices?: { start: number; end: number }
|
||||
forward: [number, number, number]
|
||||
up: [number, number, number]
|
||||
position?: [number, number, number]
|
||||
selectionRanges?: Selections
|
||||
}): Promise<{
|
||||
truncatedAst: Program
|
||||
truncatedAst: Node<Program>
|
||||
programMemoryOverride: ProgramMemory
|
||||
sketch: Sketch
|
||||
variableDeclarationName: string
|
||||
@ -566,7 +567,7 @@ export class SceneEntities {
|
||||
}
|
||||
updateAstAndRejigSketch = async (
|
||||
sketchPathToNode: PathToNode,
|
||||
modifiedAst: Program | Error,
|
||||
modifiedAst: Node<Program> | Error,
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
origin: [number, number, number]
|
||||
@ -1202,7 +1203,7 @@ export class SceneEntities {
|
||||
}
|
||||
prepareTruncatedMemoryAndAst = (
|
||||
sketchPathToNode: PathToNode,
|
||||
ast?: Program,
|
||||
ast?: Node<Program>,
|
||||
draftSegment?: DraftSegment
|
||||
) =>
|
||||
prepareTruncatedMemoryAndAst(
|
||||
@ -1223,7 +1224,7 @@ export class SceneEntities {
|
||||
sketchPathToNode: PathToNode
|
||||
intersects: Intersection<Object3D<Object3DEventMap>>[]
|
||||
draftInfo?: {
|
||||
truncatedAst: Program
|
||||
truncatedAst: Node<Program>
|
||||
programMemoryOverride: ProgramMemory
|
||||
variableDeclarationName: string
|
||||
}
|
||||
@ -1259,7 +1260,7 @@ export class SceneEntities {
|
||||
const dragTo: [number, number] = [intersection2d.x, intersection2d.y]
|
||||
let modifiedAst = draftInfo ? draftInfo.truncatedAst : { ...kclManager.ast }
|
||||
|
||||
const _node = getNodeFromPath<CallExpression>(
|
||||
const _node = getNodeFromPath<Node<CallExpression>>(
|
||||
modifiedAst,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
@ -1271,7 +1272,7 @@ export class SceneEntities {
|
||||
|
||||
let modded:
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
| Error
|
||||
@ -1566,7 +1567,7 @@ export class SceneEntities {
|
||||
if (parent?.userData?.pathToNode) {
|
||||
const updatedAst = parse(recast(kclManager.ast))
|
||||
if (trap(updatedAst)) return
|
||||
const _node = getNodeFromPath<CallExpression>(
|
||||
const _node = getNodeFromPath<Node<CallExpression>>(
|
||||
updatedAst,
|
||||
parent.userData.pathToNode,
|
||||
'CallExpression'
|
||||
@ -1701,12 +1702,12 @@ export type DefaultPlaneStr = 'XY' | 'XZ' | 'YZ' | '-XY' | '-XZ' | '-YZ'
|
||||
|
||||
function prepareTruncatedMemoryAndAst(
|
||||
sketchPathToNode: PathToNode,
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
programMemory: ProgramMemory,
|
||||
draftSegment?: DraftSegment
|
||||
):
|
||||
| {
|
||||
truncatedAst: Program
|
||||
truncatedAst: Node<Program>
|
||||
programMemoryOverride: ProgramMemory
|
||||
variableDeclarationName: string
|
||||
}
|
||||
@ -1714,7 +1715,7 @@ function prepareTruncatedMemoryAndAst(
|
||||
const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0
|
||||
const _ast = structuredClone(ast)
|
||||
|
||||
const _node = getNodeFromPath<VariableDeclaration>(
|
||||
const _node = getNodeFromPath<Node<VariableDeclaration>>(
|
||||
_ast,
|
||||
sketchPathToNode || [],
|
||||
'VariableDeclaration'
|
||||
@ -1764,15 +1765,15 @@ function prepareTruncatedMemoryAndAst(
|
||||
).body.slice(-1)[0].start = lastPipeItem.start
|
||||
|
||||
_ast.end = lastPipeItem.end
|
||||
const varDec = _ast.body[bodyIndex] as VariableDeclaration
|
||||
const varDec = _ast.body[bodyIndex] as Node<VariableDeclaration>
|
||||
varDec.end = lastPipeItem.end
|
||||
const declarator = varDec.declarations[0]
|
||||
declarator.end = lastPipeItem.end
|
||||
const init = declarator.init as PipeExpression
|
||||
const init = declarator.init as Node<PipeExpression>
|
||||
init.end = lastPipeItem.end
|
||||
init.body.slice(-1)[0].end = lastPipeItem.end
|
||||
}
|
||||
const truncatedAst: Program = {
|
||||
const truncatedAst: Node<Program> = {
|
||||
..._ast,
|
||||
body: [structuredClone(_ast.body[bodyIndex])],
|
||||
}
|
||||
|
@ -91,6 +91,7 @@ import { submitAndAwaitTextToKcl } from 'lib/textToCad'
|
||||
import { useFileContext } from 'hooks/useFileContext'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import { IndexLoaderData } from 'lib/types'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
type MachineContext<T extends AnyStateMachine> = {
|
||||
state: StateFrom<T>
|
||||
@ -971,7 +972,7 @@ export const ModelingMachineProvider = ({
|
||||
})
|
||||
let parsed = parse(recast(kclManager.ast))
|
||||
if (trap(parsed)) return Promise.reject(parsed)
|
||||
parsed = parsed as Program
|
||||
parsed = parsed as Node<Program>
|
||||
|
||||
const { modifiedAst: _modifiedAst, pathToReplacedNode } =
|
||||
moveValueIntoNewVariablePath(
|
||||
@ -982,7 +983,7 @@ export const ModelingMachineProvider = ({
|
||||
)
|
||||
parsed = parse(recast(_modifiedAst))
|
||||
if (trap(parsed)) return Promise.reject(parsed)
|
||||
parsed = parsed as Program
|
||||
parsed = parsed as Node<Program>
|
||||
if (!pathToReplacedNode)
|
||||
return Promise.reject(new Error('No path to replaced node'))
|
||||
|
||||
|
@ -14,6 +14,7 @@ import {
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
export function setEqualLengthInfo({
|
||||
selectionRanges,
|
||||
@ -86,7 +87,7 @@ export function applyConstraintEqualLength({
|
||||
selectionRanges: Selections
|
||||
}):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -13,6 +13,7 @@ import {
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
export function horzVertInfo(
|
||||
selectionRanges: Selections,
|
||||
@ -55,11 +56,11 @@ export function horzVertInfo(
|
||||
export function applyConstraintHorzVert(
|
||||
selectionRanges: Selections,
|
||||
horOrVert: 'vertical' | 'horizontal',
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
programMemory: ProgramMemory
|
||||
):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -19,6 +19,7 @@ import { createVariableDeclaration } from '../../lang/modifyAst'
|
||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
const getModalInfo = createInfoModal(GetInfoModal)
|
||||
|
||||
@ -136,7 +137,7 @@ export async function applyConstraintIntersect({
|
||||
}: {
|
||||
selectionRanges: Selections
|
||||
}): Promise<{
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}> {
|
||||
const info = intersectInfo({
|
||||
|
@ -13,6 +13,7 @@ import {
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
export function removeConstrainingValuesInfo({
|
||||
selectionRanges,
|
||||
@ -77,7 +78,7 @@ export function applyRemoveConstrainingValues({
|
||||
pathToNodes?: Array<PathToNode>
|
||||
}):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -23,6 +23,7 @@ import {
|
||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
|
||||
|
||||
@ -161,7 +162,7 @@ export function applyConstraintAxisAlign({
|
||||
constraint: 'snapToYAxis' | 'snapToXAxis'
|
||||
}):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -18,6 +18,7 @@ import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { cleanErrs, err } from 'lib/trap'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
const getModalInfo = createInfoModal(GetInfoModal)
|
||||
|
||||
@ -185,7 +186,7 @@ export function applyConstraintHorzVertAlign({
|
||||
constraint: 'setHorzDistance' | 'setVertDistance'
|
||||
}):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -21,9 +21,10 @@ import {
|
||||
import { getNodeFromPath } from './queryAst'
|
||||
import { codeManager, editorManager, sceneInfra } from 'lib/singletons'
|
||||
import { Diagnostic } from '@codemirror/lint'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
interface ExecuteArgs {
|
||||
ast?: Program
|
||||
ast?: Node<Program>
|
||||
zoomToFit?: boolean
|
||||
executionId?: number
|
||||
zoomOnRangeAndType?: {
|
||||
@ -33,13 +34,13 @@ interface ExecuteArgs {
|
||||
}
|
||||
|
||||
export class KclManager {
|
||||
private _ast: Program = {
|
||||
private _ast: Node<Program> = {
|
||||
body: [],
|
||||
start: 0,
|
||||
end: 0,
|
||||
nonCodeMeta: {
|
||||
nonCodeNodes: {},
|
||||
start: [],
|
||||
startNodes: [],
|
||||
},
|
||||
}
|
||||
private _execState: ExecState = emptyExecState()
|
||||
@ -55,7 +56,7 @@ export class KclManager {
|
||||
engineCommandManager: EngineCommandManager
|
||||
|
||||
private _isExecutingCallback: (arg: boolean) => void = () => {}
|
||||
private _astCallBack: (arg: Program) => void = () => {}
|
||||
private _astCallBack: (arg: Node<Program>) => void = () => {}
|
||||
private _programMemoryCallBack: (arg: ProgramMemory) => void = () => {}
|
||||
private _logsCallBack: (arg: string[]) => void = () => {}
|
||||
private _kclErrorsCallBack: (arg: KCLError[]) => void = () => {}
|
||||
@ -181,7 +182,7 @@ export class KclManager {
|
||||
setWasmInitFailed,
|
||||
}: {
|
||||
setProgramMemory: (arg: ProgramMemory) => void
|
||||
setAst: (arg: Program) => void
|
||||
setAst: (arg: Node<Program>) => void
|
||||
setLogs: (arg: string[]) => void
|
||||
setKclErrors: (arg: KCLError[]) => void
|
||||
setIsExecuting: (arg: boolean) => void
|
||||
@ -205,12 +206,12 @@ export class KclManager {
|
||||
end: 0,
|
||||
nonCodeMeta: {
|
||||
nonCodeNodes: {},
|
||||
start: [],
|
||||
startNodes: [],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
safeParse(code: string): Program | null {
|
||||
safeParse(code: string): Node<Program> | null {
|
||||
const ast = parse(code)
|
||||
this.lints = []
|
||||
this.kclErrors = []
|
||||
@ -377,7 +378,7 @@ export class KclManager {
|
||||
Array.from(this.engineCommandManager.artifactGraph).forEach(
|
||||
([commandId, artifact]) => {
|
||||
if (!('codeRef' in artifact)) return
|
||||
const _node1 = getNodeFromPath<CallExpression>(
|
||||
const _node1 = getNodeFromPath<Node<CallExpression>>(
|
||||
this.ast,
|
||||
artifact.codeRef.pathToNode,
|
||||
'CallExpression'
|
||||
@ -441,7 +442,7 @@ export class KclManager {
|
||||
// but should probably have think about which of the function to keep
|
||||
// This always updates the code state and editor and writes to the file system.
|
||||
async updateAst(
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
execute: boolean,
|
||||
optionalParams?: {
|
||||
focusPath?: Array<PathToNode>
|
||||
@ -452,7 +453,7 @@ export class KclManager {
|
||||
}
|
||||
}
|
||||
): Promise<{
|
||||
newAst: Program
|
||||
newAst: Node<Program>
|
||||
selections?: Selections
|
||||
}> {
|
||||
const newCode = recast(ast)
|
||||
@ -588,7 +589,7 @@ export class KclManager {
|
||||
}
|
||||
|
||||
// Determines if there is no KCL code which means it is executing a blank KCL file
|
||||
_isAstEmpty(ast: Program) {
|
||||
_isAstEmpty(ast: Node<Program>) {
|
||||
return ast.start === 0 && ast.end === 0 && ast.body.length === 0
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import { EngineCommandManager } from 'lang/std/engineConnection'
|
||||
import { KCLError } from 'lang/errors'
|
||||
import { Diagnostic } from '@codemirror/lint'
|
||||
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
export type ToolTip =
|
||||
| 'lineTo'
|
||||
@ -52,7 +53,7 @@ export async function executeAst({
|
||||
programMemoryOverride,
|
||||
idGenerator,
|
||||
}: {
|
||||
ast: Program
|
||||
ast: Node<Program>
|
||||
engineCommandManager: EngineCommandManager
|
||||
useFakeExecutor?: boolean
|
||||
programMemoryOverride?: ProgramMemory
|
||||
|
@ -21,6 +21,7 @@ import { enginelessExecutor } from '../lib/testHelpers'
|
||||
import { findUsesOfTagInPipe, getNodePathFromSourceRange } from './queryAst'
|
||||
import { err } from 'lib/trap'
|
||||
import { SimplifiedArgDetails } from './std/stdTypes'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
beforeAll(async () => {
|
||||
await initPromise
|
||||
@ -109,7 +110,7 @@ describe('Testing findUniqueName', () => {
|
||||
{ type: 'Identifier', name: 'yo07', start: 0, end: 0 },
|
||||
{ type: 'Identifier', name: 'yo08', start: 0, end: 0 },
|
||||
{ type: 'Identifier', name: 'yo09', start: 0, end: 0 },
|
||||
] satisfies Identifier[]),
|
||||
] satisfies Node<Identifier>[]),
|
||||
'yo',
|
||||
2
|
||||
)
|
||||
@ -123,7 +124,7 @@ describe('Testing addSketchTo', () => {
|
||||
body: [],
|
||||
start: 0,
|
||||
end: 0,
|
||||
nonCodeMeta: { nonCodeNodes: {}, start: [] },
|
||||
nonCodeMeta: { nonCodeNodes: {}, startNodes: [] },
|
||||
},
|
||||
'yz'
|
||||
)
|
||||
|
@ -42,12 +42,13 @@ import { SimplifiedArgDetails } from './std/stdTypes'
|
||||
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
||||
import { Models } from '@kittycad/lib'
|
||||
import { ExtrudeFacePlane } from 'machines/modelingMachine'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
export function startSketchOnDefault(
|
||||
node: Program,
|
||||
node: Node<Program>,
|
||||
axis: DefaultPlaneStr,
|
||||
name = ''
|
||||
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
||||
): { modifiedAst: Node<Program>; id: string; pathToNode: PathToNode } {
|
||||
const _node = { ...node }
|
||||
const _name =
|
||||
name || findUniqueName(node, KCL_DEFAULT_CONSTANT_PREFIXES.SKETCH)
|
||||
@ -76,10 +77,10 @@ export function startSketchOnDefault(
|
||||
}
|
||||
|
||||
export function addStartProfileAt(
|
||||
node: Program,
|
||||
node: Node<Program>,
|
||||
pathToNode: PathToNode,
|
||||
at: [number, number]
|
||||
): { modifiedAst: Program; pathToNode: PathToNode } | Error {
|
||||
): { modifiedAst: Node<Program>; pathToNode: PathToNode } | Error {
|
||||
const _node1 = getNodeFromPath<VariableDeclaration>(
|
||||
node,
|
||||
pathToNode,
|
||||
@ -114,7 +115,7 @@ export function addStartProfileAt(
|
||||
}
|
||||
|
||||
export function addSketchTo(
|
||||
node: Program,
|
||||
node: Node<Program>,
|
||||
axis: 'xy' | 'xz' | 'yz',
|
||||
name = ''
|
||||
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
||||
@ -210,7 +211,7 @@ export function mutateArrExp(node: Expr, updateWith: ArrayExpression): boolean {
|
||||
|
||||
export function mutateObjExpProp(
|
||||
node: Expr,
|
||||
updateWith: Literal | ArrayExpression,
|
||||
updateWith: Node<Literal> | Node<ArrayExpression>,
|
||||
key: string
|
||||
): boolean {
|
||||
if (node.type === 'ObjectExpression') {
|
||||
@ -248,13 +249,13 @@ export function mutateObjExpProp(
|
||||
}
|
||||
|
||||
export function extrudeSketch(
|
||||
node: Program,
|
||||
node: Node<Program>,
|
||||
pathToNode: PathToNode,
|
||||
shouldPipe = false,
|
||||
distance: Expr = createLiteral(4)
|
||||
):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNode: PathToNode
|
||||
pathToExtrudeArg: PathToNode
|
||||
}
|
||||
@ -343,13 +344,13 @@ export function extrudeSketch(
|
||||
}
|
||||
|
||||
export function revolveSketch(
|
||||
node: Program,
|
||||
node: Node<Program>,
|
||||
pathToNode: PathToNode,
|
||||
shouldPipe = false,
|
||||
angle: Expr = createLiteral(4)
|
||||
):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNode: PathToNode
|
||||
pathToRevolveArg: PathToNode
|
||||
}
|
||||
@ -439,7 +440,7 @@ export function revolveSketch(
|
||||
}
|
||||
|
||||
export function sketchOnExtrudedFace(
|
||||
node: Program,
|
||||
node: Node<Program>,
|
||||
sketchPathToNode: PathToNode,
|
||||
extrudePathToNode: PathToNode,
|
||||
info: ExtrudeFacePlane['faceInfo'] = { type: 'wall' }
|
||||
@ -571,7 +572,7 @@ export function splitPathAtPipeExpression(pathToNode: PathToNode): {
|
||||
return splitPathAtPipeExpression(pathToNode.slice(0, -1))
|
||||
}
|
||||
|
||||
export function createLiteral(value: string | number): Literal {
|
||||
export function createLiteral(value: string | number): Node<Literal> {
|
||||
return {
|
||||
type: 'Literal',
|
||||
start: 0,
|
||||
@ -581,7 +582,7 @@ export function createLiteral(value: string | number): Literal {
|
||||
}
|
||||
}
|
||||
|
||||
export function createTagDeclarator(value: string): TagDeclarator {
|
||||
export function createTagDeclarator(value: string): Node<TagDeclarator> {
|
||||
return {
|
||||
type: 'TagDeclarator',
|
||||
start: 0,
|
||||
@ -591,7 +592,7 @@ export function createTagDeclarator(value: string): TagDeclarator {
|
||||
}
|
||||
}
|
||||
|
||||
export function createIdentifier(name: string): Identifier {
|
||||
export function createIdentifier(name: string): Node<Identifier> {
|
||||
return {
|
||||
type: 'Identifier',
|
||||
start: 0,
|
||||
@ -601,7 +602,7 @@ export function createIdentifier(name: string): Identifier {
|
||||
}
|
||||
}
|
||||
|
||||
export function createPipeSubstitution(): PipeSubstitution {
|
||||
export function createPipeSubstitution(): Node<PipeSubstitution> {
|
||||
return {
|
||||
type: 'PipeSubstitution',
|
||||
start: 0,
|
||||
@ -612,7 +613,7 @@ export function createPipeSubstitution(): PipeSubstitution {
|
||||
export function createCallExpressionStdLib(
|
||||
name: string,
|
||||
args: CallExpression['arguments']
|
||||
): CallExpression {
|
||||
): Node<CallExpression> {
|
||||
return {
|
||||
type: 'CallExpression',
|
||||
start: 0,
|
||||
@ -632,7 +633,7 @@ export function createCallExpressionStdLib(
|
||||
export function createCallExpression(
|
||||
name: string,
|
||||
args: CallExpression['arguments']
|
||||
): CallExpression {
|
||||
): Node<CallExpression> {
|
||||
return {
|
||||
type: 'CallExpression',
|
||||
start: 0,
|
||||
@ -651,7 +652,7 @@ export function createCallExpression(
|
||||
|
||||
export function createArrayExpression(
|
||||
elements: ArrayExpression['elements']
|
||||
): ArrayExpression {
|
||||
): Node<ArrayExpression> {
|
||||
return {
|
||||
type: 'ArrayExpression',
|
||||
start: 0,
|
||||
@ -664,7 +665,7 @@ export function createArrayExpression(
|
||||
|
||||
export function createPipeExpression(
|
||||
body: PipeExpression['body']
|
||||
): PipeExpression {
|
||||
): Node<PipeExpression> {
|
||||
return {
|
||||
type: 'PipeExpression',
|
||||
start: 0,
|
||||
@ -680,7 +681,7 @@ export function createVariableDeclaration(
|
||||
init: VariableDeclarator['init'],
|
||||
visibility: VariableDeclaration['visibility'] = 'default',
|
||||
kind: VariableDeclaration['kind'] = 'const'
|
||||
): VariableDeclaration {
|
||||
): Node<VariableDeclaration> {
|
||||
return {
|
||||
type: 'VariableDeclaration',
|
||||
start: 0,
|
||||
@ -703,7 +704,7 @@ export function createVariableDeclaration(
|
||||
|
||||
export function createObjectExpression(properties: {
|
||||
[key: string]: Expr
|
||||
}): ObjectExpression {
|
||||
}): Node<ObjectExpression> {
|
||||
return {
|
||||
type: 'ObjectExpression',
|
||||
start: 0,
|
||||
@ -724,7 +725,7 @@ export function createObjectExpression(properties: {
|
||||
export function createUnaryExpression(
|
||||
argument: UnaryExpression['argument'],
|
||||
operator: UnaryExpression['operator'] = '-'
|
||||
): UnaryExpression {
|
||||
): Node<UnaryExpression> {
|
||||
return {
|
||||
type: 'UnaryExpression',
|
||||
start: 0,
|
||||
@ -739,7 +740,7 @@ export function createBinaryExpression([left, operator, right]: [
|
||||
BinaryExpression['left'],
|
||||
BinaryExpression['operator'],
|
||||
BinaryExpression['right']
|
||||
]): BinaryExpression {
|
||||
]): Node<BinaryExpression> {
|
||||
return {
|
||||
type: 'BinaryExpression',
|
||||
start: 0,
|
||||
@ -754,19 +755,19 @@ export function createBinaryExpression([left, operator, right]: [
|
||||
export function createBinaryExpressionWithUnary([left, right]: [
|
||||
BinaryExpression['left'],
|
||||
BinaryExpression['right']
|
||||
]): BinaryExpression {
|
||||
]): Node<BinaryExpression> {
|
||||
if (right.type === 'UnaryExpression' && right.operator === '-')
|
||||
return createBinaryExpression([left, '-', right.argument])
|
||||
return createBinaryExpression([left, '+', right])
|
||||
}
|
||||
|
||||
export function giveSketchFnCallTag(
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
range: Selection['range'],
|
||||
tag?: string
|
||||
):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
tag: string
|
||||
isTagExisting: boolean
|
||||
pathToNode: PathToNode
|
||||
@ -801,7 +802,7 @@ export function giveSketchFnCallTag(
|
||||
}
|
||||
|
||||
export function moveValueIntoNewVariablePath(
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
programMemory: ProgramMemory,
|
||||
pathToNode: PathToNode,
|
||||
variableName: string
|
||||
@ -834,12 +835,12 @@ export function moveValueIntoNewVariablePath(
|
||||
}
|
||||
|
||||
export function moveValueIntoNewVariable(
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
programMemory: ProgramMemory,
|
||||
sourceRange: Selection['range'],
|
||||
variableName: string
|
||||
): {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToReplacedNode?: PathToNode
|
||||
} {
|
||||
const meta = isNodeSafeToReplace(ast, sourceRange)
|
||||
@ -872,17 +873,17 @@ export function moveValueIntoNewVariable(
|
||||
*/
|
||||
export function deleteSegmentFromPipeExpression(
|
||||
dependentRanges: SourceRange[],
|
||||
modifiedAst: Program,
|
||||
modifiedAst: Node<Program>,
|
||||
programMemory: ProgramMemory,
|
||||
code: string,
|
||||
pathToNode: PathToNode
|
||||
): Program | Error {
|
||||
): Node<Program> | Error {
|
||||
let _modifiedAst = structuredClone(modifiedAst)
|
||||
|
||||
dependentRanges.forEach((range) => {
|
||||
const path = getNodePathFromSourceRange(_modifiedAst, range)
|
||||
|
||||
const callExp = getNodeFromPath<CallExpression>(
|
||||
const callExp = getNodeFromPath<Node<CallExpression>>(
|
||||
_modifiedAst,
|
||||
path,
|
||||
'CallExpression',
|
||||
@ -928,11 +929,11 @@ export function deleteSegmentFromPipeExpression(
|
||||
export function removeSingleConstraintInfo(
|
||||
pathToCallExp: PathToNode,
|
||||
argDetails: SimplifiedArgDetails,
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
programMemory: ProgramMemory
|
||||
):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| false {
|
||||
@ -954,12 +955,12 @@ export function removeSingleConstraintInfo(
|
||||
}
|
||||
|
||||
export async function deleteFromSelection(
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
selection: Selection,
|
||||
programMemory: ProgramMemory,
|
||||
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
||||
({} as any)
|
||||
): Promise<Program | Error> {
|
||||
): Promise<Node<Program> | Error> {
|
||||
const astClone = structuredClone(ast)
|
||||
const range = selection.range
|
||||
const path = getNodePathFromSourceRange(ast, range)
|
||||
@ -1134,5 +1135,5 @@ export async function deleteFromSelection(
|
||||
}
|
||||
|
||||
const nonCodeMetaEmpty = () => {
|
||||
return { nonCodeNodes: {}, start: [] }
|
||||
return { nonCodeNodes: {}, startNodes: [], start: 0, end: 0 }
|
||||
}
|
||||
|
@ -36,11 +36,12 @@ import {
|
||||
getSweepFromSuspectedPath,
|
||||
} from 'lang/std/artifactGraph'
|
||||
import { kclManager, engineCommandManager, editorManager } from 'lib/singletons'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
// Apply Fillet To Selection
|
||||
|
||||
export function applyFilletToSelection(
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
selection: Selections,
|
||||
radius: KclCommandValue
|
||||
): void | Error {
|
||||
@ -55,10 +56,10 @@ export function applyFilletToSelection(
|
||||
}
|
||||
|
||||
export function modifyAstCloneWithFilletAndTag(
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
selection: Selections,
|
||||
radius: KclCommandValue
|
||||
): { modifiedAst: Program; pathToFilletNode: Array<PathToNode> } | Error {
|
||||
): { modifiedAst: Node<Program>; pathToFilletNode: Array<PathToNode> } | Error {
|
||||
let clonedAst = structuredClone(ast)
|
||||
const clonedAstForGetExtrude = structuredClone(ast)
|
||||
|
||||
@ -246,7 +247,7 @@ export function getPathToExtrudeForSegmentSelection(
|
||||
}
|
||||
|
||||
async function updateAstAndFocus(
|
||||
modifiedAst: Program,
|
||||
modifiedAst: Node<Program>,
|
||||
pathToFilletNode: Array<PathToNode>
|
||||
) {
|
||||
const updatedAst = await kclManager.updateAst(modifiedAst, true, {
|
||||
@ -258,7 +259,7 @@ async function updateAstAndFocus(
|
||||
}
|
||||
|
||||
function mutateAstWithTagForSketchSegment(
|
||||
astClone: Program,
|
||||
astClone: Node<Program>,
|
||||
pathToSegmentNode: PathToNode
|
||||
): { modifiedAst: Program; tag: string } | Error {
|
||||
const segmentNode = getNodeFromPath<CallExpression>(
|
||||
@ -292,7 +293,7 @@ function mutateAstWithTagForSketchSegment(
|
||||
function getEdgeTagCall(
|
||||
tag: string,
|
||||
selectionType: string
|
||||
): Identifier | CallExpression {
|
||||
): Node<Identifier | CallExpression> {
|
||||
let tagCall: Expr = createIdentifier(tag)
|
||||
|
||||
// Modify the tag based on selectionType
|
||||
@ -426,7 +427,7 @@ export const hasValidFilletSelection = ({
|
||||
code,
|
||||
}: {
|
||||
selectionRanges: Selections
|
||||
ast: Program
|
||||
ast: Node<Program>
|
||||
code: string
|
||||
}) => {
|
||||
// check if there is anything filletable in the scene
|
||||
@ -454,7 +455,7 @@ export const hasValidFilletSelection = ({
|
||||
for (const selection of selectionRanges.codeBasedSelections) {
|
||||
// check if all selections are in sketchLineHelperMap
|
||||
const path = getNodePathFromSourceRange(ast, selection.range)
|
||||
const segmentNode = getNodeFromPath<CallExpression>(
|
||||
const segmentNode = getNodeFromPath<Node<CallExpression>>(
|
||||
ast,
|
||||
path,
|
||||
'CallExpression'
|
||||
@ -534,7 +535,7 @@ export const isTagUsedInFillet = ({
|
||||
ast,
|
||||
callExp,
|
||||
}: {
|
||||
ast: Program
|
||||
ast: Node<Program>
|
||||
callExp: CallExpression
|
||||
}): Array<EdgeTypes> => {
|
||||
const tag = getTagFromCallExpression(callExp)
|
||||
|
@ -29,6 +29,7 @@ import {
|
||||
} from './std/sketchcombos'
|
||||
import { err } from 'lib/trap'
|
||||
import { ImportStatement } from 'wasm-lib/kcl/bindings/ImportStatement'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
/**
|
||||
* Retrieves a node from a given path within a Program node structure, optionally stopping at a specified node type.
|
||||
@ -121,12 +122,13 @@ export function getNodeFromPathCurry(
|
||||
}
|
||||
|
||||
function moreNodePathFromSourceRange(
|
||||
node:
|
||||
node: Node<
|
||||
| Expr
|
||||
| ImportStatement
|
||||
| ExpressionStatement
|
||||
| VariableDeclaration
|
||||
| ReturnStatement,
|
||||
| ReturnStatement
|
||||
>,
|
||||
sourceRange: Selection['range'],
|
||||
previousPath: PathToNode = [['body', '']]
|
||||
): PathToNode {
|
||||
@ -344,15 +346,16 @@ export function getNodePathFromSourceRange(
|
||||
return path
|
||||
}
|
||||
|
||||
type KCLNode =
|
||||
type KCLNode = Node<
|
||||
| Expr
|
||||
| ExpressionStatement
|
||||
| VariableDeclaration
|
||||
| VariableDeclarator
|
||||
| ReturnStatement
|
||||
>
|
||||
|
||||
export function traverse(
|
||||
node: KCLNode | Program,
|
||||
node: KCLNode | Node<Program>,
|
||||
option: {
|
||||
enter?: (node: KCLNode, pathToNode: PathToNode) => void
|
||||
leave?: (node: KCLNode) => void
|
||||
@ -512,9 +515,9 @@ export function findAllPreviousVariables(
|
||||
}
|
||||
|
||||
type ReplacerFn = (
|
||||
_ast: Program,
|
||||
_ast: Node<Program>,
|
||||
varName: string
|
||||
) => { modifiedAst: Program; pathToReplaced: PathToNode } | Error
|
||||
) => { modifiedAst: Node<Program>; pathToReplaced: PathToNode } | Error
|
||||
|
||||
export function isNodeSafeToReplacePath(
|
||||
ast: Program,
|
||||
@ -583,12 +586,12 @@ export function isNodeSafeToReplacePath(
|
||||
}
|
||||
|
||||
export function isNodeSafeToReplace(
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
sourceRange: [number, number]
|
||||
):
|
||||
| {
|
||||
isSafe: boolean
|
||||
value: Expr
|
||||
value: Node<Expr>
|
||||
replacer: ReplacerFn
|
||||
}
|
||||
| Error {
|
||||
@ -837,7 +840,7 @@ export function findUsesOfTagInPipe(
|
||||
? String(thirdParam.value)
|
||||
: thirdParam.name
|
||||
|
||||
const varDec = getNodeFromPath<VariableDeclaration>(
|
||||
const varDec = getNodeFromPath<Node<VariableDeclaration>>(
|
||||
ast,
|
||||
pathToNode,
|
||||
'VariableDeclaration'
|
||||
@ -898,7 +901,7 @@ export function hasSketchPipeBeenExtruded(selection: Selection, ast: Program) {
|
||||
}
|
||||
|
||||
/** File must contain at least one sketch that has not been extruded already */
|
||||
export function doesSceneHaveSweepableSketch(ast: Program) {
|
||||
export function doesSceneHaveSweepableSketch(ast: Node<Program>) {
|
||||
const theMap: any = {}
|
||||
traverse(ast as any, {
|
||||
enter(node) {
|
||||
|
@ -17,6 +17,7 @@ import {
|
||||
import { getNodeFromPath, getNodePathFromSourceRange } from '../queryAst'
|
||||
import { enginelessExecutor } from '../../lib/testHelpers'
|
||||
import { err } from 'lib/trap'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
const eachQuad: [number, [number, number]][] = [
|
||||
[-315, [1, 1]],
|
||||
@ -687,7 +688,7 @@ describe('testing getConstraintInfo', () => {
|
||||
]
|
||||
if (err(ast)) return ast
|
||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||
const callExp = getNodeFromPath<CallExpression>(
|
||||
const callExp = getNodeFromPath<Node<CallExpression>>(
|
||||
ast,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
@ -841,7 +842,7 @@ describe('testing getConstraintInfo', () => {
|
||||
]
|
||||
if (err(ast)) return ast
|
||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||
const callExp = getNodeFromPath<CallExpression>(
|
||||
const callExp = getNodeFromPath<Node<CallExpression>>(
|
||||
ast,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
@ -1197,7 +1198,7 @@ describe('testing getConstraintInfo', () => {
|
||||
]
|
||||
if (err(ast)) return ast
|
||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||
const callExp = getNodeFromPath<CallExpression>(
|
||||
const callExp = getNodeFromPath<Node<CallExpression>>(
|
||||
ast,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
|
@ -55,6 +55,7 @@ import { err } from 'lib/trap'
|
||||
import { perpendicularDistance } from 'sketch-helpers'
|
||||
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
||||
import { EdgeCutInfo } from 'machines/modelingMachine'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
const STRAIGHT_SEGMENT_ERR = new Error(
|
||||
'Invalid input, expected "straight-segment"'
|
||||
@ -1785,7 +1786,7 @@ export const angledLineThatIntersects: SketchLineHelper = {
|
||||
)
|
||||
}
|
||||
if (intersectTag !== -1) {
|
||||
const tag = firstArg.properties[intersectTag]?.value as Identifier
|
||||
const tag = firstArg.properties[intersectTag]?.value as Node<Identifier>
|
||||
const pathToTagProp: PathToNode = [
|
||||
...pathToObjectExp,
|
||||
[intersectTag, 'index'],
|
||||
@ -1825,7 +1826,9 @@ export const updateStartProfileAtArgs: SketchLineHelper['updateArgs'] = ({
|
||||
body: [],
|
||||
|
||||
nonCodeMeta: {
|
||||
start: [],
|
||||
start: 0,
|
||||
end: 0,
|
||||
startNodes: [],
|
||||
nonCodeNodes: [],
|
||||
},
|
||||
},
|
||||
@ -1865,7 +1868,7 @@ export const sketchLineHelperMap: { [key: string]: SketchLineHelper } = {
|
||||
} as const
|
||||
|
||||
export function changeSketchArguments(
|
||||
node: Program,
|
||||
node: Node<Program>,
|
||||
programMemory: ProgramMemory,
|
||||
sourceRangeOrPath:
|
||||
| {
|
||||
@ -1877,7 +1880,7 @@ export function changeSketchArguments(
|
||||
pathToNode: PathToNode
|
||||
},
|
||||
input: SegmentInputs
|
||||
): { modifiedAst: Program; pathToNode: PathToNode } | Error {
|
||||
): { modifiedAst: Node<Program>; pathToNode: PathToNode } | Error {
|
||||
const _node = { ...node }
|
||||
const thePath =
|
||||
sourceRangeOrPath.type === 'sourceRange'
|
||||
@ -1906,7 +1909,7 @@ export function changeSketchArguments(
|
||||
}
|
||||
|
||||
export function getConstraintInfo(
|
||||
callExpression: CallExpression,
|
||||
callExpression: Node<CallExpression>,
|
||||
code: string,
|
||||
pathToNode: PathToNode
|
||||
): ConstrainInfo[] {
|
||||
@ -1944,7 +1947,7 @@ export function compareVec2Epsilon2(
|
||||
}
|
||||
|
||||
interface CreateLineFnCallArgs {
|
||||
node: Program
|
||||
node: Node<Program>
|
||||
programMemory: ProgramMemory
|
||||
input: SegmentInputs
|
||||
fnName: ToolTip
|
||||
@ -1961,7 +1964,7 @@ export function addNewSketchLn({
|
||||
spliceBetween = false,
|
||||
}: CreateLineFnCallArgs):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
| Error {
|
||||
@ -1971,8 +1974,12 @@ export function addNewSketchLn({
|
||||
return new Error('not a sketch line helper')
|
||||
}
|
||||
|
||||
getNodeFromPath<VariableDeclarator>(node, pathToNode, 'VariableDeclarator')
|
||||
getNodeFromPath<PipeExpression | CallExpression>(
|
||||
getNodeFromPath<Node<VariableDeclarator>>(
|
||||
node,
|
||||
pathToNode,
|
||||
'VariableDeclarator'
|
||||
)
|
||||
getNodeFromPath<Node<PipeExpression | CallExpression>>(
|
||||
node,
|
||||
pathToNode,
|
||||
'PipeExpression'
|
||||
@ -1991,13 +1998,13 @@ export function addCallExpressionsToPipe({
|
||||
pathToNode,
|
||||
expressions,
|
||||
}: {
|
||||
node: Program
|
||||
node: Node<Program>
|
||||
programMemory: ProgramMemory
|
||||
pathToNode: PathToNode
|
||||
expressions: CallExpression[]
|
||||
expressions: Node<CallExpression>[]
|
||||
}) {
|
||||
const _node = { ...node }
|
||||
const pipeExpression = getNodeFromPath<PipeExpression>(
|
||||
const pipeExpression = getNodeFromPath<Node<PipeExpression>>(
|
||||
_node,
|
||||
pathToNode,
|
||||
'PipeExpression'
|
||||
@ -2046,7 +2053,7 @@ export function replaceSketchLine({
|
||||
replaceExistingCallback,
|
||||
referencedSegment,
|
||||
}: {
|
||||
node: Program
|
||||
node: Node<Program>
|
||||
programMemory: ProgramMemory
|
||||
pathToNode: PathToNode
|
||||
fnName: ToolTip
|
||||
@ -2055,7 +2062,7 @@ export function replaceSketchLine({
|
||||
referencedSegment?: Path
|
||||
}):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
valueUsedInTransform?: number
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
@ -2107,7 +2114,7 @@ function addTagToChamfer(
|
||||
edgeCutMeta: EdgeCutInfo | null
|
||||
):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
tag: string
|
||||
}
|
||||
| Error {
|
||||
@ -2234,7 +2241,7 @@ export function addTagForSketchOnFace(
|
||||
edgeCutMeta: EdgeCutInfo | null
|
||||
):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
tag: string
|
||||
}
|
||||
| Error {
|
||||
@ -2272,12 +2279,14 @@ function isAngleLiteral(lineArugement: Expr): boolean {
|
||||
: false
|
||||
}
|
||||
|
||||
type addTagFn = (a: AddTagInfo) => { modifiedAst: Program; tag: string } | Error
|
||||
type addTagFn = (
|
||||
a: AddTagInfo
|
||||
) => { modifiedAst: Node<Program>; tag: string } | Error
|
||||
|
||||
function addTag(tagIndex = 2): addTagFn {
|
||||
return ({ node, pathToNode }) => {
|
||||
const _node = { ...node }
|
||||
const callExpr = getNodeFromPath<CallExpression>(
|
||||
const callExpr = getNodeFromPath<Node<CallExpression>>(
|
||||
_node,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
|
@ -49,6 +49,7 @@ import {
|
||||
getSketchSegmentFromSourceRange,
|
||||
} from './sketchConstraints'
|
||||
import { getAngle, roundOff, normaliseAngle } from '../../lib/utils'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
export type LineInputsType =
|
||||
| 'xAbsolute'
|
||||
@ -325,7 +326,7 @@ const setHorzVertDistanceCreateNode =
|
||||
if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR
|
||||
|
||||
const valueUsedInTransform = roundOff(literalArg - refNum, 2)
|
||||
let finalValue: Expr = createBinaryExpressionWithUnary([
|
||||
let finalValue: Node<Expr> = createBinaryExpressionWithUnary([
|
||||
createSegEnd(referenceSegName, !index),
|
||||
forceValueUsedInTransform || createLiteral(valueUsedInTransform),
|
||||
])
|
||||
@ -1541,7 +1542,7 @@ export function transformSecondarySketchLinesTagFirst({
|
||||
forceSegName,
|
||||
forceValueUsedInTransform,
|
||||
}: {
|
||||
ast: Program
|
||||
ast: Node<Program>
|
||||
selectionRanges: Selections
|
||||
transformInfos: TransformInfo[]
|
||||
programMemory: ProgramMemory
|
||||
@ -1549,7 +1550,7 @@ export function transformSecondarySketchLinesTagFirst({
|
||||
forceValueUsedInTransform?: BinaryPart
|
||||
}):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
valueUsedInTransform?: number
|
||||
pathToNodeMap: PathToNodeMap
|
||||
tagInfo: {
|
||||
@ -1620,7 +1621,7 @@ export function transformAstSketchLines({
|
||||
forceValueUsedInTransform,
|
||||
referencedSegmentRange,
|
||||
}: {
|
||||
ast: Program
|
||||
ast: Node<Program>
|
||||
selectionRanges: Selections | PathToNode[]
|
||||
transformInfos: TransformInfo[]
|
||||
programMemory: ProgramMemory
|
||||
@ -1629,7 +1630,7 @@ export function transformAstSketchLines({
|
||||
referencedSegmentRange?: Selection['range']
|
||||
}):
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
valueUsedInTransform?: number
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
@ -1647,7 +1648,7 @@ export function transformAstSketchLines({
|
||||
|
||||
const getNode = getNodeFromPathCurry(node, _pathToNode)
|
||||
|
||||
const callExp = getNode<CallExpression>('CallExpression')
|
||||
const callExp = getNode<Node<CallExpression>>('CallExpression')
|
||||
if (err(callExp)) return callExp
|
||||
const varDec = getNode<VariableDeclarator>('VariableDeclarator')
|
||||
if (err(varDec)) return varDec
|
||||
@ -1806,13 +1807,16 @@ function createSegAngle(referenceSegName: string): BinaryPart {
|
||||
return createCallExpression('segAng', [createIdentifier(referenceSegName)])
|
||||
}
|
||||
|
||||
function createSegEnd(referenceSegName: string, isX: boolean): CallExpression {
|
||||
function createSegEnd(
|
||||
referenceSegName: string,
|
||||
isX: boolean
|
||||
): Node<CallExpression> {
|
||||
return createCallExpression(isX ? 'segEndX' : 'segEndY', [
|
||||
createIdentifier(referenceSegName),
|
||||
])
|
||||
}
|
||||
|
||||
function createLastSeg(isX: boolean): CallExpression {
|
||||
function createLastSeg(isX: boolean): Node<CallExpression> {
|
||||
return createCallExpression(isX ? 'lastSegX' : 'lastSegY', [
|
||||
createPipeSubstitution(),
|
||||
])
|
||||
@ -1830,7 +1834,7 @@ export function getConstraintLevelFromSourceRange(
|
||||
ast: Program | Error
|
||||
): Error | { range: [number, number]; level: ConstraintLevel } {
|
||||
if (err(ast)) return ast
|
||||
const nodeMeta = getNodeFromPath<CallExpression>(
|
||||
const nodeMeta = getNodeFromPath<Node<CallExpression>>(
|
||||
ast,
|
||||
getNodePathFromSourceRange(ast, cursorRange),
|
||||
'CallExpression'
|
||||
|
@ -11,16 +11,17 @@ import {
|
||||
BinaryPart,
|
||||
} from '../wasm'
|
||||
import { LineInputsType } from './sketchcombos'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
export interface ModifyAstBase {
|
||||
node: Program
|
||||
node: Node<Program>
|
||||
// TODO #896: Remove ProgramMemory from this interface
|
||||
previousProgramMemory: ProgramMemory
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
|
||||
export interface AddTagInfo {
|
||||
node: Program
|
||||
node: Node<Program>
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
|
||||
@ -134,7 +135,7 @@ type _InputArg<T> =
|
||||
* Which is why a union type is used that can be type narrowed using the {@link RawArg.type} property
|
||||
* {@link RawArg.expr} is common to all of these types
|
||||
*/
|
||||
export type InputArg = _InputArg<Expr>
|
||||
export type InputArg = _InputArg<Node<Expr>>
|
||||
|
||||
/**
|
||||
* {@link RawArg.expr} is the literal equivalent of whatever current expression is
|
||||
@ -142,7 +143,7 @@ export type InputArg = _InputArg<Expr>
|
||||
* but of course works for expressions like myVar + someFn() etc too
|
||||
* This is useful in cases where we want to "un-constrain" inputs to segments
|
||||
*/
|
||||
type RawArg = _InputArg<Literal>
|
||||
type RawArg = _InputArg<Node<Literal>>
|
||||
|
||||
export type InputArgs = Array<InputArg>
|
||||
|
||||
@ -186,7 +187,7 @@ export type CreateStdLibSketchCallExpr = (args: {
|
||||
inputs: InputArgs
|
||||
rawArgs: RawArgs
|
||||
referenceSegName: string
|
||||
tag?: Expr
|
||||
tag?: Node<Expr>
|
||||
forceValueUsedInTransform?: BinaryPart
|
||||
referencedSegment?: Path
|
||||
}) => CreatedSketchExprResult | Error
|
||||
@ -215,26 +216,26 @@ export interface ConstrainInfo {
|
||||
export interface SketchLineHelper {
|
||||
add: (a: addCall) =>
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNode: PathToNode
|
||||
valueUsedInTransform?: number
|
||||
}
|
||||
| Error
|
||||
updateArgs: (a: updateArgs) =>
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
| Error
|
||||
getTag: (a: CallExpression) => string | Error
|
||||
addTag: (a: AddTagInfo) =>
|
||||
| {
|
||||
modifiedAst: Program
|
||||
modifiedAst: Node<Program>
|
||||
tag: string
|
||||
}
|
||||
| Error
|
||||
getConstraintInfo: (
|
||||
callExp: CallExpression,
|
||||
callExp: Node<CallExpression>,
|
||||
code: string,
|
||||
pathToNode: PathToNode
|
||||
) => ConstrainInfo[]
|
||||
|
13
src/lang/wasm.test.ts
Normal file
13
src/lang/wasm.test.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { err } from 'lib/trap'
|
||||
import { parse } from './wasm'
|
||||
import { enginelessExecutor } from 'lib/testHelpers'
|
||||
|
||||
it('can execute parsed AST', async () => {
|
||||
const code = `x = 1
|
||||
// A comment.`
|
||||
const ast = parse(code)
|
||||
expect(err(ast)).toEqual(false)
|
||||
const execState = await enginelessExecutor(ast)
|
||||
expect(err(ast)).toEqual(false)
|
||||
expect(execState.memory.get('x')?.value).toEqual(1)
|
||||
})
|
@ -42,6 +42,7 @@ import { ExecState as RawExecState } from '../wasm-lib/kcl/bindings/ExecState'
|
||||
import { ProgramMemory as RawProgramMemory } from '../wasm-lib/kcl/bindings/ProgramMemory'
|
||||
import { EnvironmentRef } from '../wasm-lib/kcl/bindings/EnvironmentRef'
|
||||
import { Environment } from '../wasm-lib/kcl/bindings/Environment'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
export type { Program } from '../wasm-lib/kcl/bindings/Program'
|
||||
export type { Expr } from '../wasm-lib/kcl/bindings/Expr'
|
||||
@ -122,11 +123,11 @@ export const initPromise = initialise()
|
||||
export const rangeTypeFix = (ranges: number[][]): [number, number][] =>
|
||||
ranges.map(([start, end]) => [start, end])
|
||||
|
||||
export const parse = (code: string | Error): Program | Error => {
|
||||
export const parse = (code: string | Error): Node<Program> | Error => {
|
||||
if (err(code)) return code
|
||||
|
||||
try {
|
||||
const program: Program = parse_wasm(code)
|
||||
const program: Node<Program> = parse_wasm(code)
|
||||
return program
|
||||
} catch (e: any) {
|
||||
// throw e
|
||||
@ -378,7 +379,7 @@ export function sketchFromKclValue(
|
||||
}
|
||||
|
||||
export const executor = async (
|
||||
node: Program,
|
||||
node: Node<Program>,
|
||||
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
||||
idGenerator: IdGenerator = defaultIdGenerator(),
|
||||
engineCommandManager: EngineCommandManager,
|
||||
@ -402,7 +403,7 @@ export const executor = async (
|
||||
}
|
||||
|
||||
export const _executor = async (
|
||||
node: Program,
|
||||
node: Node<Program>,
|
||||
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
||||
idGenerator: IdGenerator = defaultIdGenerator(),
|
||||
engineCommandManager: EngineCommandManager,
|
||||
@ -493,13 +494,13 @@ export function lexer(str: string): Token[] | Error {
|
||||
|
||||
export const modifyAstForSketch = async (
|
||||
engineCommandManager: EngineCommandManager,
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
variableName: string,
|
||||
currentPlane: string,
|
||||
engineId: string
|
||||
): Promise<Program> => {
|
||||
): Promise<Node<Program>> => {
|
||||
try {
|
||||
const updatedAst: Program = await modify_ast_for_sketch_wasm(
|
||||
const updatedAst: Node<Program> = await modify_ast_for_sketch_wasm(
|
||||
engineCommandManager,
|
||||
JSON.stringify(ast),
|
||||
variableName,
|
||||
|
@ -6,6 +6,7 @@ import { Identifier, Expr, VariableDeclaration } from 'lang/wasm'
|
||||
import { commandBarMachine } from 'machines/commandBarMachine'
|
||||
import { ReactNode } from 'react'
|
||||
import { MachineManager } from 'components/MachineManagerProvider'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
type Icon = CustomIconName
|
||||
const PLATFORMS = ['both', 'web', 'desktop'] as const
|
||||
@ -24,8 +25,8 @@ export interface KclExpression {
|
||||
}
|
||||
export interface KclExpressionWithVariable extends KclExpression {
|
||||
variableName: string
|
||||
variableDeclarationAst: VariableDeclaration
|
||||
variableIdentifierAst: Identifier
|
||||
variableDeclarationAst: Node<VariableDeclaration>
|
||||
variableIdentifierAst: Node<Identifier>
|
||||
insertIndex: number
|
||||
}
|
||||
export type KclCommandValue = KclExpression | KclExpressionWithVariable
|
||||
|
@ -36,6 +36,7 @@ import {
|
||||
getWallCodeRef,
|
||||
ArtifactId,
|
||||
} from 'lang/std/artifactGraph'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
export const X_AXIS_UUID = 'ad792545-7fd3-482a-a602-a93924e3055b'
|
||||
export const Y_AXIS_UUID = '680fd157-266f-4b8a-984f-cdf46b8bdf01'
|
||||
@ -244,7 +245,7 @@ export function getEventForSegmentSelection(
|
||||
const updatedAst = parse(codeManager.code)
|
||||
if (err(updatedAst)) return null
|
||||
|
||||
const nodeMeta = getNodeFromPath<CallExpression>(
|
||||
const nodeMeta = getNodeFromPath<Node<CallExpression>>(
|
||||
updatedAst,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
@ -362,7 +363,7 @@ function updateSceneObjectColors(codeBasedSelections: Selection[]) {
|
||||
|
||||
Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => {
|
||||
if (!SEGMENT_BODIES_PLUS_PROFILE_START.includes(segmentGroup?.name)) return
|
||||
const nodeMeta = getNodeFromPath<CallExpression>(
|
||||
const nodeMeta = getNodeFromPath<Node<CallExpression>>(
|
||||
updated,
|
||||
segmentGroup.userData.pathToNode,
|
||||
'CallExpression'
|
||||
|
@ -17,6 +17,7 @@ import { DefaultPlanes } from 'wasm-lib/kcl/bindings/DefaultPlanes'
|
||||
import { err, reportRejection } from 'lib/trap'
|
||||
import { toSync } from './utils'
|
||||
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
||||
import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
|
||||
type WebSocketResponse = Models['WebSocketResponse_type']
|
||||
|
||||
@ -84,7 +85,7 @@ class MockEngineCommandManager {
|
||||
}
|
||||
|
||||
export async function enginelessExecutor(
|
||||
ast: Program | Error,
|
||||
ast: Node<Program> | Error,
|
||||
pm: ProgramMemory | Error = ProgramMemory.empty(),
|
||||
idGenerator: IdGenerator = defaultIdGenerator()
|
||||
): Promise<ExecState> {
|
||||
@ -109,7 +110,7 @@ export async function enginelessExecutor(
|
||||
}
|
||||
|
||||
export async function executor(
|
||||
ast: Program,
|
||||
ast: Node<Program>,
|
||||
pm: ProgramMemory = ProgramMemory.empty(),
|
||||
idGenerator: IdGenerator = defaultIdGenerator()
|
||||
): Promise<ExecState> {
|
||||
|
@ -1,6 +1,6 @@
|
||||
extern crate alloc;
|
||||
use kcl_lib::ast::types::{
|
||||
BodyItem, Expr, Identifier, ItemVisibility, Literal, LiteralValue, NonCodeMeta, Program, VariableDeclaration,
|
||||
BodyItem, Expr, Identifier, ItemVisibility, Literal, LiteralValue, Node, Program, VariableDeclaration,
|
||||
VariableDeclarator, VariableKind,
|
||||
};
|
||||
use kcl_macros::parse;
|
||||
@ -9,36 +9,46 @@ use pretty_assertions::assert_eq;
|
||||
#[test]
|
||||
fn basic() {
|
||||
let actual = parse!("const y = 4");
|
||||
let expected = Program {
|
||||
start: 0,
|
||||
end: 11,
|
||||
body: vec![BodyItem::VariableDeclaration(Box::new(VariableDeclaration {
|
||||
start: 0,
|
||||
end: 11,
|
||||
declarations: vec![VariableDeclarator {
|
||||
start: 6,
|
||||
end: 11,
|
||||
id: Identifier {
|
||||
start: 6,
|
||||
end: 7,
|
||||
let expected = Node {
|
||||
inner: Program {
|
||||
body: vec![BodyItem::VariableDeclaration(Box::new(Node::new(
|
||||
VariableDeclaration {
|
||||
declarations: vec![Node::new(
|
||||
VariableDeclarator {
|
||||
id: Node::new(
|
||||
Identifier {
|
||||
name: "y".to_owned(),
|
||||
digest: None,
|
||||
},
|
||||
init: Expr::Literal(Box::new(Literal {
|
||||
start: 10,
|
||||
end: 11,
|
||||
6,
|
||||
7,
|
||||
),
|
||||
init: Expr::Literal(Box::new(Node::new(
|
||||
Literal {
|
||||
value: LiteralValue::IInteger(4),
|
||||
raw: "4".to_owned(),
|
||||
digest: None,
|
||||
})),
|
||||
},
|
||||
10,
|
||||
11,
|
||||
))),
|
||||
digest: None,
|
||||
}],
|
||||
},
|
||||
6,
|
||||
11,
|
||||
)],
|
||||
visibility: ItemVisibility::Default,
|
||||
kind: VariableKind::Const,
|
||||
digest: None,
|
||||
}))],
|
||||
non_code_meta: NonCodeMeta::default(),
|
||||
},
|
||||
0,
|
||||
11,
|
||||
)))],
|
||||
non_code_meta: Default::default(),
|
||||
digest: None,
|
||||
},
|
||||
start: 0,
|
||||
end: 11,
|
||||
};
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ use crate::{
|
||||
executor::{Point2d, SourceRange},
|
||||
};
|
||||
|
||||
use super::types::Node;
|
||||
|
||||
type Point3d = kcmc::shared::Point3d<f64>;
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -35,7 +37,7 @@ const EPSILON: f64 = 0.015625; // or 2^-6
|
||||
/// a move or a new line.
|
||||
pub async fn modify_ast_for_sketch(
|
||||
engine: &Arc<Box<dyn EngineManager>>,
|
||||
program: &mut Program,
|
||||
program: &mut Node<Program>,
|
||||
// The name of the sketch.
|
||||
sketch_name: &str,
|
||||
// The type of plane the sketch is on. `XY` or `XZ`, etc
|
||||
@ -195,7 +197,7 @@ fn create_start_sketch_on(
|
||||
end: [f64; 2],
|
||||
plane: crate::executor::PlaneType,
|
||||
additional_lines: Vec<[f64; 2]>,
|
||||
) -> Result<VariableDeclarator, KclError> {
|
||||
) -> Result<Node<VariableDeclarator>, KclError> {
|
||||
let start_sketch_on = CallExpression::new("startSketchOn", vec![Literal::new(plane.to_string().into()).into()])?;
|
||||
let start_profile_at = CallExpression::new(
|
||||
"startProfileAt",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,10 @@
|
||||
use crate::executor::Metadata;
|
||||
use crate::executor::SourceRange;
|
||||
|
||||
use super::impl_value_meta;
|
||||
use super::BoxNode;
|
||||
use super::ConstraintLevel;
|
||||
use super::Hover;
|
||||
use super::Node;
|
||||
use super::NodeList;
|
||||
use super::{Digest, Expr};
|
||||
use databake::*;
|
||||
use schemars::JsonSchema;
|
||||
@ -19,12 +20,10 @@ type IfBlock = crate::ast::types::Program;
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct IfExpression {
|
||||
pub start: usize,
|
||||
pub end: usize,
|
||||
pub cond: Box<Expr>,
|
||||
pub then_val: Box<IfBlock>,
|
||||
pub else_ifs: Vec<ElseIf>,
|
||||
pub final_else: Box<IfBlock>,
|
||||
pub then_val: BoxNode<IfBlock>,
|
||||
pub else_ifs: NodeList<ElseIf>,
|
||||
pub final_else: BoxNode<IfBlock>,
|
||||
|
||||
pub digest: Option<Digest>,
|
||||
}
|
||||
@ -34,57 +33,21 @@ pub struct IfExpression {
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct ElseIf {
|
||||
pub start: usize,
|
||||
pub end: usize,
|
||||
pub cond: Expr,
|
||||
pub then_val: Box<IfBlock>,
|
||||
pub then_val: BoxNode<IfBlock>,
|
||||
|
||||
pub digest: Option<Digest>,
|
||||
}
|
||||
|
||||
// Source code metadata
|
||||
|
||||
impl_value_meta!(IfExpression);
|
||||
impl_value_meta!(ElseIf);
|
||||
|
||||
impl IfExpression {
|
||||
impl Node<IfExpression> {
|
||||
fn source_ranges(&self) -> Vec<SourceRange> {
|
||||
vec![SourceRange::from(self)]
|
||||
}
|
||||
}
|
||||
|
||||
impl From<IfExpression> for Metadata {
|
||||
fn from(value: IfExpression) -> Self {
|
||||
Self {
|
||||
source_range: value.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ElseIf> for Metadata {
|
||||
fn from(value: ElseIf) -> Self {
|
||||
Self {
|
||||
source_range: value.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl From<&IfExpression> for Metadata {
|
||||
fn from(value: &IfExpression) -> Self {
|
||||
Self {
|
||||
source_range: value.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ElseIf> for Metadata {
|
||||
fn from(value: &ElseIf) -> Self {
|
||||
Self {
|
||||
source_range: value.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ElseIf {
|
||||
impl Node<ElseIf> {
|
||||
#[allow(dead_code)]
|
||||
fn source_ranges(&self) -> Vec<SourceRange> {
|
||||
vec![SourceRange([self.start, self.end])]
|
||||
@ -93,6 +56,15 @@ impl ElseIf {
|
||||
|
||||
// IDE support and refactors
|
||||
|
||||
impl Node<IfExpression> {
|
||||
/// Get the constraint level.
|
||||
pub fn get_constraint_level(&self) -> ConstraintLevel {
|
||||
ConstraintLevel::Full {
|
||||
source_ranges: self.source_ranges(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl IfExpression {
|
||||
pub fn get_hover_value_for_position(&self, pos: usize, code: &str) -> Option<Hover> {
|
||||
self.cond
|
||||
@ -115,12 +87,7 @@ impl IfExpression {
|
||||
}
|
||||
self.final_else.rename_identifiers(old_name, new_name);
|
||||
}
|
||||
/// Get the constraint level.
|
||||
pub fn get_constraint_level(&self) -> ConstraintLevel {
|
||||
ConstraintLevel::Full {
|
||||
source_ranges: self.source_ranges(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn replace_value(&mut self, source_range: SourceRange, new_value: Expr) {
|
||||
self.cond.replace_value(source_range, new_value.clone());
|
||||
for else_if in &mut self.else_ifs {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use super::{
|
||||
human_friendly_type, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart,
|
||||
CallExpression, Expr, IfExpression, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject,
|
||||
CallExpression, Expr, IfExpression, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Node,
|
||||
ObjectExpression, TagDeclarator, UnaryExpression, UnaryOperator,
|
||||
};
|
||||
use crate::{
|
||||
@ -32,7 +32,7 @@ impl BinaryPart {
|
||||
}
|
||||
}
|
||||
|
||||
impl MemberExpression {
|
||||
impl Node<MemberExpression> {
|
||||
pub fn get_result_array(&self, exec_state: &mut ExecState, index: usize) -> Result<KclValue, KclError> {
|
||||
let array = match &self.object {
|
||||
MemberObject::MemberExpression(member_expr) => member_expr.get_result(exec_state)?,
|
||||
@ -137,7 +137,7 @@ impl MemberExpression {
|
||||
}
|
||||
}
|
||||
|
||||
impl BinaryExpression {
|
||||
impl Node<BinaryExpression> {
|
||||
#[async_recursion]
|
||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let left_json_value = self.left.get_result(exec_state, ctx).await?.get_json_value()?;
|
||||
@ -186,7 +186,7 @@ impl BinaryExpression {
|
||||
}
|
||||
}
|
||||
|
||||
impl UnaryExpression {
|
||||
impl Node<UnaryExpression> {
|
||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
if self.operator == UnaryOperator::Not {
|
||||
let value = self.argument.get_result(exec_state, ctx).await?.get_json_value()?;
|
||||
@ -297,7 +297,7 @@ async fn inner_execute_pipe_body(
|
||||
Ok(final_output)
|
||||
}
|
||||
|
||||
impl CallExpression {
|
||||
impl Node<CallExpression> {
|
||||
#[async_recursion]
|
||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let fn_name = &self.callee.name;
|
||||
@ -502,7 +502,7 @@ impl CallExpression {
|
||||
}
|
||||
}
|
||||
|
||||
impl TagDeclarator {
|
||||
impl Node<TagDeclarator> {
|
||||
pub async fn execute(&self, exec_state: &mut ExecState) -> Result<KclValue, KclError> {
|
||||
let memory_item = KclValue::TagIdentifier(Box::new(TagIdentifier {
|
||||
value: self.name.clone(),
|
||||
@ -518,7 +518,7 @@ impl TagDeclarator {
|
||||
}
|
||||
}
|
||||
|
||||
impl ArrayExpression {
|
||||
impl Node<ArrayExpression> {
|
||||
#[async_recursion]
|
||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let mut results = Vec::with_capacity(self.elements.len());
|
||||
@ -543,21 +543,21 @@ impl ArrayExpression {
|
||||
}
|
||||
}
|
||||
|
||||
impl ArrayRangeExpression {
|
||||
impl Node<ArrayRangeExpression> {
|
||||
#[async_recursion]
|
||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let metadata = Metadata::from(&*self.start_element);
|
||||
let metadata = Metadata::from(&self.start_element);
|
||||
let start = ctx
|
||||
.execute_expr(&self.start_element, exec_state, &metadata, StatementKind::Expression)
|
||||
.await?
|
||||
.get_json_value()?;
|
||||
let start = parse_json_number_as_i64(&start, (&*self.start_element).into())?;
|
||||
let metadata = Metadata::from(&*self.end_element);
|
||||
let start = parse_json_number_as_i64(&start, (&self.start_element).into())?;
|
||||
let metadata = Metadata::from(&self.end_element);
|
||||
let end = ctx
|
||||
.execute_expr(&self.end_element, exec_state, &metadata, StatementKind::Expression)
|
||||
.await?
|
||||
.get_json_value()?;
|
||||
let end = parse_json_number_as_i64(&end, (&*self.end_element).into())?;
|
||||
let end = parse_json_number_as_i64(&end, (&self.end_element).into())?;
|
||||
|
||||
if end < start {
|
||||
return Err(KclError::Semantic(KclErrorDetails {
|
||||
@ -581,7 +581,7 @@ impl ArrayRangeExpression {
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectExpression {
|
||||
impl Node<ObjectExpression> {
|
||||
#[async_recursion]
|
||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let mut object = serde_json::Map::new();
|
||||
@ -655,7 +655,7 @@ pub fn json_as_bool(j: &serde_json::Value) -> Option<bool> {
|
||||
}
|
||||
}
|
||||
|
||||
impl IfExpression {
|
||||
impl Node<IfExpression> {
|
||||
#[async_recursion]
|
||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
// Check the `if` branch.
|
||||
@ -717,13 +717,13 @@ impl Property {
|
||||
let property_src: SourceRange = value.clone().into();
|
||||
match value {
|
||||
LiteralIdentifier::Identifier(identifier) => {
|
||||
let name = identifier.name;
|
||||
let name = &identifier.name;
|
||||
if !computed {
|
||||
// Treat the property as a literal
|
||||
Ok(Property::String(name.to_string()))
|
||||
} else {
|
||||
// Actually evaluate memory to compute the property.
|
||||
let prop = exec_state.memory.get(&name, property_src)?;
|
||||
let prop = exec_state.memory.get(name, property_src)?;
|
||||
let KclValue::UserVal(prop) = prop else {
|
||||
return Err(KclError::Semantic(KclErrorDetails {
|
||||
source_ranges: property_sr,
|
||||
@ -732,7 +732,7 @@ impl Property {
|
||||
),
|
||||
}));
|
||||
};
|
||||
jvalue_to_prop(&prop.value, property_sr, &name)
|
||||
jvalue_to_prop(&prop.value, property_sr, name)
|
||||
}
|
||||
}
|
||||
LiteralIdentifier::Literal(literal) => {
|
||||
|
@ -5,6 +5,8 @@ use serde_json::Value as JValue;
|
||||
|
||||
use crate::ast::types::{Expr, Literal};
|
||||
|
||||
use super::Node;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
@ -33,8 +35,8 @@ impl LiteralValue {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Literal> for Expr {
|
||||
fn from(literal: Literal) -> Self {
|
||||
impl From<Node<Literal>> for Expr {
|
||||
fn from(literal: Node<Literal>) -> Self {
|
||||
Expr::Literal(Box::new(literal))
|
||||
}
|
||||
}
|
||||
|
@ -396,6 +396,9 @@ fn generate_function(internal_fn: Box<dyn StdLibFn>) -> Result<BTreeMap<String,
|
||||
fn cleanup_static_links(output: &str) -> String {
|
||||
let mut cleaned_output = output.to_string();
|
||||
// Fix the links to the types.
|
||||
// Gross hack for the stupid alias types.
|
||||
cleaned_output = cleaned_output.replace("TagNode", "TagDeclarator");
|
||||
|
||||
let link = format!("[`{}`](/docs/kcl/types#tag-declaration)", "TagDeclarator");
|
||||
cleaned_output = cleaned_output.replace("`TagDeclarator`", &link);
|
||||
let link = format!("[`{}`](/docs/kcl/types#tag-identifier)", "TagIdentifier");
|
||||
@ -409,7 +412,7 @@ fn cleanup_type_links(output: &str, types: Vec<String>) -> String {
|
||||
let mut cleaned_output = output.to_string();
|
||||
// Fix the links to the types.
|
||||
for type_name in types {
|
||||
if type_name == "TagDeclarator" || type_name == "TagIdentifier" {
|
||||
if type_name == "TagDeclarator" || type_name == "TagIdentifier" || type_name == "TagNode" {
|
||||
continue;
|
||||
} else {
|
||||
let link = format!("(/docs/kcl/types/{})", type_name);
|
||||
@ -486,7 +489,7 @@ fn generate_type(
|
||||
}
|
||||
|
||||
// Skip over TagDeclarator and TagIdentifier since they have custom docs.
|
||||
if name == "TagDeclarator" || name == "TagIdentifier" {
|
||||
if name == "TagDeclarator" || name == "TagIdentifier" || name == "TagNode" {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ impl StdLibFnArg {
|
||||
|| self.type_ == "SketchOrSurface"
|
||||
{
|
||||
return Ok(Some((index, format!("${{{}:{}}}", index, "%"))));
|
||||
} else if self.type_ == "TagDeclarator" && self.required {
|
||||
} else if (self.type_ == "TagDeclarator" || self.type_ == "TagNode") && self.required {
|
||||
return Ok(Some((index, format!("${{{}:{}}}", index, "$myTag"))));
|
||||
} else if self.type_ == "TagIdentifier" && self.required {
|
||||
// TODO: actually use the ast to populate this.
|
||||
|
@ -26,8 +26,8 @@ type Point3D = kcmc::shared::Point3d<f64>;
|
||||
|
||||
use crate::{
|
||||
ast::types::{
|
||||
human_friendly_type, BodyItem, Expr, ExpressionStatement, FunctionExpression, ImportStatement, ItemVisibility,
|
||||
KclNone, Program, ReturnStatement, TagDeclarator,
|
||||
human_friendly_type, BodyItem, Expr, FunctionExpression, ItemVisibility, KclNone, Node, NodeRef, Program,
|
||||
TagDeclarator, TagNode,
|
||||
},
|
||||
engine::{EngineManager, ExecutionKind},
|
||||
errors::{KclError, KclErrorDetails},
|
||||
@ -155,6 +155,7 @@ impl Default for ProgramMemory {
|
||||
|
||||
/// An index pointing to an environment.
|
||||
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[schemars(transparent)]
|
||||
pub struct EnvironmentRef(usize);
|
||||
|
||||
impl EnvironmentRef {
|
||||
@ -339,7 +340,7 @@ impl IdGenerator {
|
||||
pub enum KclValue {
|
||||
UserVal(UserVal),
|
||||
TagIdentifier(Box<TagIdentifier>),
|
||||
TagDeclarator(Box<TagDeclarator>),
|
||||
TagDeclarator(crate::ast::types::BoxNode<TagDeclarator>),
|
||||
Plane(Box<Plane>),
|
||||
Face(Box<Face>),
|
||||
|
||||
@ -352,7 +353,7 @@ pub enum KclValue {
|
||||
Function {
|
||||
#[serde(skip)]
|
||||
func: Option<MemoryFunction>,
|
||||
expression: Box<FunctionExpression>,
|
||||
expression: crate::ast::types::BoxNode<FunctionExpression>,
|
||||
memory: Box<ProgramMemory>,
|
||||
#[serde(rename = "__meta")]
|
||||
meta: Vec<Metadata>,
|
||||
@ -890,7 +891,7 @@ pub type MemoryFunction =
|
||||
fn(
|
||||
s: Vec<KclValue>,
|
||||
memory: ProgramMemory,
|
||||
expression: Box<FunctionExpression>,
|
||||
expression: crate::ast::types::BoxNode<FunctionExpression>,
|
||||
metadata: Vec<Metadata>,
|
||||
exec_state: &ExecState,
|
||||
ctx: ExecutorContext,
|
||||
@ -900,7 +901,7 @@ impl From<KclValue> for Vec<SourceRange> {
|
||||
fn from(item: KclValue) -> Self {
|
||||
match item {
|
||||
KclValue::UserVal(u) => u.meta.iter().map(|m| m.source_range).collect(),
|
||||
KclValue::TagDeclarator(t) => t.into(),
|
||||
KclValue::TagDeclarator(t) => vec![(&t).into()],
|
||||
KclValue::TagIdentifier(t) => t.meta.iter().map(|m| m.source_range).collect(),
|
||||
KclValue::Solid(e) => e.meta.iter().map(|m| m.source_range).collect(),
|
||||
KclValue::Solids { value } => value
|
||||
@ -1043,9 +1044,9 @@ impl KclValue {
|
||||
}
|
||||
|
||||
/// Get a tag declarator from a memory item.
|
||||
pub fn get_tag_declarator(&self) -> Result<TagDeclarator, KclError> {
|
||||
pub fn get_tag_declarator(&self) -> Result<TagNode, KclError> {
|
||||
match self {
|
||||
KclValue::TagDeclarator(t) => Ok(*t.clone()),
|
||||
KclValue::TagDeclarator(t) => Ok((**t).clone()),
|
||||
_ => Err(KclError::Semantic(KclErrorDetails {
|
||||
message: format!("Not a tag declarator: {:?}", self),
|
||||
source_ranges: self.clone().into(),
|
||||
@ -1054,9 +1055,9 @@ impl KclValue {
|
||||
}
|
||||
|
||||
/// Get an optional tag from a memory item.
|
||||
pub fn get_tag_declarator_opt(&self) -> Result<Option<TagDeclarator>, KclError> {
|
||||
pub fn get_tag_declarator_opt(&self) -> Result<Option<TagNode>, KclError> {
|
||||
match self {
|
||||
KclValue::TagDeclarator(t) => Ok(Some(*t.clone())),
|
||||
KclValue::TagDeclarator(t) => Ok(Some((**t).clone())),
|
||||
_ => Err(KclError::Semantic(KclErrorDetails {
|
||||
message: format!("Not a tag declarator: {:?}", self),
|
||||
source_ranges: self.clone().into(),
|
||||
@ -1200,7 +1201,7 @@ pub struct GetTangentialInfoFromPathsResult {
|
||||
}
|
||||
|
||||
impl Sketch {
|
||||
pub(crate) fn add_tag(&mut self, tag: &TagDeclarator, current_path: &Path) {
|
||||
pub(crate) fn add_tag(&mut self, tag: NodeRef<'_, TagDeclarator>, current_path: &Path) {
|
||||
let mut tag_identifier: TagIdentifier = tag.into();
|
||||
let base = current_path.get_base();
|
||||
tag_identifier.info = Some(TagEngineInfo {
|
||||
@ -1326,7 +1327,7 @@ pub enum EdgeCut {
|
||||
/// The engine id of the edge to fillet.
|
||||
#[serde(rename = "edgeId")]
|
||||
edge_id: uuid::Uuid,
|
||||
tag: Box<Option<TagDeclarator>>,
|
||||
tag: Box<Option<TagNode>>,
|
||||
},
|
||||
/// A chamfer.
|
||||
Chamfer {
|
||||
@ -1336,7 +1337,7 @@ pub enum EdgeCut {
|
||||
/// The engine id of the edge to chamfer.
|
||||
#[serde(rename = "edgeId")]
|
||||
edge_id: uuid::Uuid,
|
||||
tag: Box<Option<TagDeclarator>>,
|
||||
tag: Box<Option<TagNode>>,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1355,7 +1356,7 @@ impl EdgeCut {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tag(&self) -> Option<TagDeclarator> {
|
||||
pub fn tag(&self) -> Option<TagNode> {
|
||||
match self {
|
||||
EdgeCut::Fillet { tag, .. } => *tag.clone(),
|
||||
EdgeCut::Chamfer { tag, .. } => *tag.clone(),
|
||||
@ -1529,26 +1530,10 @@ impl From<SourceRange> for Metadata {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ImportStatement> for Metadata {
|
||||
fn from(stmt: &ImportStatement) -> Self {
|
||||
impl<T> From<NodeRef<'_, T>> for Metadata {
|
||||
fn from(node: NodeRef<'_, T>) -> Self {
|
||||
Self {
|
||||
source_range: SourceRange::new(stmt.start, stmt.end),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ExpressionStatement> for Metadata {
|
||||
fn from(exp_statement: &ExpressionStatement) -> Self {
|
||||
Self {
|
||||
source_range: SourceRange::new(exp_statement.start, exp_statement.end),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ReturnStatement> for Metadata {
|
||||
fn from(return_statement: &ReturnStatement) -> Self {
|
||||
Self {
|
||||
source_range: SourceRange::new(return_statement.start, return_statement.end),
|
||||
source_range: SourceRange::new(node.start, node.end),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1573,7 +1558,7 @@ pub struct BasePath {
|
||||
#[ts(type = "[number, number]")]
|
||||
pub to: [f64; 2],
|
||||
/// The tag of the path.
|
||||
pub tag: Option<TagDeclarator>,
|
||||
pub tag: Option<TagNode>,
|
||||
/// Metadata.
|
||||
#[serde(rename = "__geoMeta")]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1709,7 +1694,7 @@ impl Path {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_tag(&self) -> Option<TagDeclarator> {
|
||||
pub fn get_tag(&self) -> Option<TagNode> {
|
||||
match self {
|
||||
Path::ToPoint { base } => base.tag.clone(),
|
||||
Path::Horizontal { base, .. } => base.tag.clone(),
|
||||
@ -1820,7 +1805,7 @@ pub struct ChamferSurface {
|
||||
/// The id for the chamfer surface.
|
||||
pub face_id: uuid::Uuid,
|
||||
/// The tag.
|
||||
pub tag: Option<TagDeclarator>,
|
||||
pub tag: Option<Node<TagDeclarator>>,
|
||||
/// Metadata.
|
||||
#[serde(flatten)]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1834,7 +1819,7 @@ pub struct FilletSurface {
|
||||
/// The id for the fillet surface.
|
||||
pub face_id: uuid::Uuid,
|
||||
/// The tag.
|
||||
pub tag: Option<TagDeclarator>,
|
||||
pub tag: Option<Node<TagDeclarator>>,
|
||||
/// Metadata.
|
||||
#[serde(flatten)]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1848,7 +1833,7 @@ pub struct ExtrudePlane {
|
||||
/// The face id for the extrude plane.
|
||||
pub face_id: uuid::Uuid,
|
||||
/// The tag.
|
||||
pub tag: Option<TagDeclarator>,
|
||||
pub tag: Option<Node<TagDeclarator>>,
|
||||
/// Metadata.
|
||||
#[serde(flatten)]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1862,7 +1847,7 @@ pub struct ExtrudeArc {
|
||||
/// The face id for the extrude plane.
|
||||
pub face_id: uuid::Uuid,
|
||||
/// The tag.
|
||||
pub tag: Option<TagDeclarator>,
|
||||
pub tag: Option<Node<TagDeclarator>>,
|
||||
/// Metadata.
|
||||
#[serde(flatten)]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1878,7 +1863,7 @@ impl ExtrudeSurface {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_tag(&self) -> Option<TagDeclarator> {
|
||||
pub fn get_tag(&self) -> Option<Node<TagDeclarator>> {
|
||||
match self {
|
||||
ExtrudeSurface::ExtrudePlane(ep) => ep.tag.clone(),
|
||||
ExtrudeSurface::ExtrudeArc(ea) => ea.tag.clone(),
|
||||
@ -2156,7 +2141,7 @@ impl ExecutorContext {
|
||||
/// Kurt uses this for partial execution.
|
||||
pub async fn run(
|
||||
&self,
|
||||
program: &crate::ast::types::Program,
|
||||
program: NodeRef<'_, crate::ast::types::Program>,
|
||||
memory: Option<ProgramMemory>,
|
||||
id_generator: IdGenerator,
|
||||
project_directory: Option<String>,
|
||||
@ -2170,7 +2155,7 @@ impl ExecutorContext {
|
||||
/// Kurt uses this for partial execution.
|
||||
pub async fn run_with_session_data(
|
||||
&self,
|
||||
program: &crate::ast::types::Program,
|
||||
program: NodeRef<'_, crate::ast::types::Program>,
|
||||
memory: Option<ProgramMemory>,
|
||||
id_generator: IdGenerator,
|
||||
project_directory: Option<String>,
|
||||
@ -2212,9 +2197,9 @@ impl ExecutorContext {
|
||||
|
||||
/// Execute an AST's program.
|
||||
#[async_recursion]
|
||||
pub(crate) async fn inner_execute(
|
||||
&self,
|
||||
program: &crate::ast::types::Program,
|
||||
pub(crate) async fn inner_execute<'a>(
|
||||
&'a self,
|
||||
program: NodeRef<'a, crate::ast::types::Program>,
|
||||
exec_state: &mut ExecState,
|
||||
body_type: BodyType,
|
||||
) -> Result<Option<KclValue>, KclError> {
|
||||
@ -2450,7 +2435,7 @@ impl ExecutorContext {
|
||||
/// Execute the program, then get a PNG screenshot.
|
||||
pub async fn execute_and_prepare_snapshot(
|
||||
&self,
|
||||
program: &Program,
|
||||
program: NodeRef<'_, Program>,
|
||||
id_generator: IdGenerator,
|
||||
project_directory: Option<String>,
|
||||
) -> Result<TakeSnapshot> {
|
||||
@ -2462,7 +2447,7 @@ impl ExecutorContext {
|
||||
/// Execute the program, return the interpreter and outputs.
|
||||
pub async fn execute_and_prepare(
|
||||
&self,
|
||||
program: &Program,
|
||||
program: NodeRef<'_, Program>,
|
||||
id_generator: IdGenerator,
|
||||
project_directory: Option<String>,
|
||||
) -> Result<(ExecState, TakeSnapshot)> {
|
||||
@ -2507,7 +2492,7 @@ impl ExecutorContext {
|
||||
/// assign it to a parameter of the function, in the given block of function memory.
|
||||
/// Returns Err if too few/too many arguments were given for the function.
|
||||
fn assign_args_to_params(
|
||||
function_expression: &FunctionExpression,
|
||||
function_expression: NodeRef<'_, FunctionExpression>,
|
||||
args: Vec<KclValue>,
|
||||
mut fn_memory: ProgramMemory,
|
||||
) -> Result<ProgramMemory, KclError> {
|
||||
@ -2559,7 +2544,7 @@ fn assign_args_to_params(
|
||||
pub(crate) async fn call_user_defined_function(
|
||||
args: Vec<KclValue>,
|
||||
memory: &ProgramMemory,
|
||||
function_expression: &FunctionExpression,
|
||||
function_expression: NodeRef<'_, FunctionExpression>,
|
||||
exec_state: &mut ExecState,
|
||||
ctx: &ExecutorContext,
|
||||
) -> Result<Option<KclValue>, KclError> {
|
||||
@ -2598,7 +2583,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::ast::types::{Identifier, Parameter};
|
||||
use crate::ast::types::{Identifier, Node, Parameter};
|
||||
|
||||
pub async fn parse_execute(code: &str) -> Result<ProgramMemory> {
|
||||
let tokens = crate::token::lexer(code)?;
|
||||
@ -3570,13 +3555,11 @@ let w = f() + f()
|
||||
meta: Default::default(),
|
||||
})
|
||||
}
|
||||
fn ident(s: &'static str) -> Identifier {
|
||||
Identifier {
|
||||
start: 0,
|
||||
end: 0,
|
||||
fn ident(s: &'static str) -> Node<Identifier> {
|
||||
Node::no_src(Identifier {
|
||||
name: s.to_owned(),
|
||||
digest: None,
|
||||
}
|
||||
})
|
||||
}
|
||||
fn opt_param(s: &'static str) -> Parameter {
|
||||
Parameter {
|
||||
@ -3668,20 +3651,20 @@ let w = f() + f()
|
||||
),
|
||||
] {
|
||||
// Run each test.
|
||||
let func_expr = &FunctionExpression {
|
||||
start: 0,
|
||||
end: 0,
|
||||
let func_expr = &Node::no_src(FunctionExpression {
|
||||
params,
|
||||
body: crate::ast::types::Program {
|
||||
start: 0,
|
||||
end: 0,
|
||||
body: Node {
|
||||
inner: crate::ast::types::Program {
|
||||
body: Vec::new(),
|
||||
non_code_meta: Default::default(),
|
||||
digest: None,
|
||||
},
|
||||
start: 0,
|
||||
end: 0,
|
||||
},
|
||||
return_type: None,
|
||||
digest: None,
|
||||
};
|
||||
});
|
||||
let actual = assign_args_to_params(func_expr, args, ProgramMemory::new());
|
||||
assert_eq!(
|
||||
actual, expected,
|
||||
|
@ -13,7 +13,7 @@ use crate::{
|
||||
pub struct FunctionParam<'a> {
|
||||
pub inner: Option<&'a MemoryFunction>,
|
||||
pub memory: ProgramMemory,
|
||||
pub fn_expr: Box<FunctionExpression>,
|
||||
pub fn_expr: crate::ast::types::BoxNode<FunctionExpression>,
|
||||
pub meta: Vec<Metadata>,
|
||||
pub ctx: ExecutorContext,
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::{
|
||||
ast::types::CallExpression,
|
||||
ast::types::{CallExpression, NodeRef},
|
||||
docs::StdLibFn,
|
||||
executor::SourceRange,
|
||||
lint::rule::{def_finding, Discovered, Finding},
|
||||
@ -18,7 +18,10 @@ def_finding!(
|
||||
Previously, we have not been failing when too many arguments are passed to a stdlib function. This is a problem because it can lead to unexpected behavior. We will in the future fail when too many arguments are passed to a function. So fix your code now."
|
||||
);
|
||||
|
||||
fn lint_too_many_args_std_lib_function(f: Box<dyn StdLibFn>, exp: &CallExpression) -> Result<Vec<Discovered>> {
|
||||
fn lint_too_many_args_std_lib_function(
|
||||
f: Box<dyn StdLibFn>,
|
||||
exp: NodeRef<'_, CallExpression>,
|
||||
) -> Result<Vec<Discovered>> {
|
||||
let mut findings = vec![];
|
||||
|
||||
if f.name() == "pow" {
|
||||
|
@ -3,14 +3,14 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tower_lsp::lsp_types::notification::Notification;
|
||||
|
||||
use crate::settings::types::UnitLength;
|
||||
use crate::{ast::types::Node, settings::types::UnitLength};
|
||||
|
||||
/// A notification that the AST has changed.
|
||||
#[derive(Debug)]
|
||||
pub enum AstUpdated {}
|
||||
|
||||
impl Notification for AstUpdated {
|
||||
type Params = crate::ast::types::Program;
|
||||
type Params = Node<crate::ast::types::Program>;
|
||||
const METHOD: &'static str = "kcl/astUpdated";
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ use tower_lsp::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
ast::types::{Expr, VariableKind},
|
||||
ast::types::{Expr, Node, NodeRef, VariableKind},
|
||||
executor::{IdGenerator, SourceRange},
|
||||
lsp::{backend::Backend as _, util::IntoDiagnostic},
|
||||
parser::PIPE_OPERATOR,
|
||||
@ -99,7 +99,7 @@ pub struct Backend {
|
||||
/// Token maps.
|
||||
pub token_map: DashMap<String, Vec<crate::token::Token>>,
|
||||
/// AST maps.
|
||||
pub ast_map: DashMap<String, crate::ast::types::Program>,
|
||||
pub ast_map: DashMap<String, Node<crate::ast::types::Program>>,
|
||||
/// Memory maps.
|
||||
pub memory_map: DashMap<String, crate::executor::ProgramMemory>,
|
||||
/// Current code.
|
||||
@ -571,7 +571,7 @@ impl Backend {
|
||||
self.client.publish_diagnostics(params.uri.clone(), items, None).await;
|
||||
}
|
||||
|
||||
async fn execute(&self, params: &TextDocumentItem, ast: &crate::ast::types::Program) -> Result<()> {
|
||||
async fn execute(&self, params: &TextDocumentItem, ast: NodeRef<'_, crate::ast::types::Program>) -> Result<()> {
|
||||
// Check if we can execute.
|
||||
if !self.can_execute().await {
|
||||
return Ok(());
|
||||
|
@ -7,6 +7,7 @@ use tower_lsp::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
ast::types::{Node, Program},
|
||||
executor::ProgramMemory,
|
||||
lsp::test_util::{copilot_lsp_server, kcl_lsp_server},
|
||||
};
|
||||
@ -1070,7 +1071,7 @@ fn myFn = (param1) => {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
|
||||
// Send semantic tokens request.
|
||||
let semantic_tokens = server
|
||||
@ -2396,7 +2397,7 @@ async fn kcl_test_kcl_lsp_full_to_empty_file_updates_ast_and_memory() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2416,7 +2417,7 @@ async fn kcl_test_kcl_lsp_full_to_empty_file_updates_ast_and_memory() {
|
||||
})
|
||||
.await;
|
||||
|
||||
let mut default_hashed = crate::ast::types::Program::default();
|
||||
let mut default_hashed = Node::<Program>::default();
|
||||
default_hashed.compute_digest();
|
||||
|
||||
// Get the ast.
|
||||
@ -2453,7 +2454,7 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2487,9 +2488,9 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
||||
// Clear the ast and memory.
|
||||
server
|
||||
.ast_map
|
||||
.insert("file:///test.kcl".to_string(), crate::ast::types::Program::default());
|
||||
.insert("file:///test.kcl".to_string(), Node::<Program>::default());
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert_eq!(ast, crate::ast::types::Program::default());
|
||||
assert_eq!(ast, Node::<Program>::default());
|
||||
server
|
||||
.memory_map
|
||||
.insert("file:///test.kcl".to_string(), ProgramMemory::default());
|
||||
@ -2513,7 +2514,7 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2549,7 +2550,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_unchanged_but_has_diagnostics_reexecute()
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2604,7 +2605,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_unchanged_but_has_diagnostics_reexecute()
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2640,7 +2641,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_diagnostics_reexe
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2698,7 +2699,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_diagnostics_reexe
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2734,7 +2735,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_memory_reexecute_
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2770,7 +2771,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_memory_reexecute_
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2806,7 +2807,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2841,7 +2842,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2883,7 +2884,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
||||
let units = server.executor_ctx().await.clone().unwrap().settings.units;
|
||||
assert_eq!(units, crate::settings::types::UnitLength::Mm);
|
||||
|
||||
let mut default_hashed = crate::ast::types::Program::default();
|
||||
let mut default_hashed = Node::<Program>::default();
|
||||
default_hashed.compute_digest();
|
||||
|
||||
// Get the ast.
|
||||
@ -2924,7 +2925,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
// Now it should NOT be the default memory.
|
||||
@ -3064,7 +3065,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
|
||||
// Assure we have one diagnostics.
|
||||
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
||||
@ -3087,7 +3088,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
|
||||
// Assure we have one diagnostics.
|
||||
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
||||
@ -3183,7 +3184,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl");
|
||||
assert!(memory.is_none());
|
||||
@ -3205,7 +3206,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl");
|
||||
assert!(memory.is_none());
|
||||
@ -3248,7 +3249,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl");
|
||||
assert!(memory.is_none());
|
||||
@ -3278,7 +3279,7 @@ const NEW_LINT = 1"#
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl");
|
||||
assert!(memory.is_none());
|
||||
@ -3394,7 +3395,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
|
||||
// Get the symbols map.
|
||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||
@ -3489,7 +3490,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
|
||||
// Get the symbols map.
|
||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||
@ -3532,7 +3533,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
assert!(ast != Node::<Program>::default());
|
||||
|
||||
// Get the symbols map.
|
||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
ast::types::Program,
|
||||
ast::types::{Node, Program},
|
||||
errors::{KclError, KclErrorDetails},
|
||||
executor::SourceRange,
|
||||
token::{Token, TokenType},
|
||||
@ -13,7 +13,7 @@ pub const PIPE_SUBSTITUTION_OPERATOR: &str = "%";
|
||||
pub const PIPE_OPERATOR: &str = "|>";
|
||||
|
||||
/// Parse the given KCL code into an AST.
|
||||
pub fn parse(code: &str) -> Result<Program, KclError> {
|
||||
pub fn parse(code: &str) -> Result<Node<Program>, KclError> {
|
||||
let tokens = crate::token::lexer(code)?;
|
||||
let parser = Parser::new(tokens);
|
||||
parser.ast()
|
||||
@ -33,7 +33,7 @@ impl Parser {
|
||||
}
|
||||
|
||||
/// Run the parser
|
||||
pub fn ast(&self) -> Result<Program, KclError> {
|
||||
pub fn ast(&self) -> Result<Node<Program>, KclError> {
|
||||
if !self.unknown_tokens.is_empty() {
|
||||
let source_ranges = self.unknown_tokens.iter().map(SourceRange::from).collect();
|
||||
let token_list = self.unknown_tokens.iter().map(|t| t.value.as_str()).collect::<Vec<_>>();
|
||||
@ -48,7 +48,7 @@ impl Parser {
|
||||
// Important, to not call this before the unknown tokens check.
|
||||
if self.tokens.is_empty() {
|
||||
// Empty file should just do nothing.
|
||||
return Ok(Program::default());
|
||||
return Ok(Node::<Program>::default());
|
||||
}
|
||||
|
||||
// Check all the tokens are whitespace or comments.
|
||||
@ -57,7 +57,7 @@ impl Parser {
|
||||
.iter()
|
||||
.all(|t| t.token_type.is_whitespace() || t.token_type.is_comment())
|
||||
{
|
||||
return Ok(Program::default());
|
||||
return Ok(Node::<Program>::default());
|
||||
}
|
||||
|
||||
parser_impl::run_parser(&mut self.tokens.as_slice())
|
||||
|
@ -1,18 +1,18 @@
|
||||
use crate::{
|
||||
ast::types::{BinaryExpression, BinaryOperator, BinaryPart},
|
||||
ast::types::{BinaryExpression, BinaryOperator, BinaryPart, Node},
|
||||
errors::{KclError, KclErrorDetails},
|
||||
executor::SourceRange,
|
||||
};
|
||||
|
||||
/// Parses a list of tokens (in infix order, i.e. as the user typed them)
|
||||
/// into a binary expression tree.
|
||||
pub fn parse(infix_tokens: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclError> {
|
||||
pub fn parse(infix_tokens: Vec<BinaryExpressionToken>) -> Result<Node<BinaryExpression>, KclError> {
|
||||
let rpn = postfix(infix_tokens);
|
||||
evaluate(rpn)
|
||||
}
|
||||
|
||||
/// Parses a list of tokens (in postfix order) into a binary expression tree.
|
||||
fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclError> {
|
||||
fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<Node<BinaryExpression>, KclError> {
|
||||
let source_ranges = source_range(&rpn);
|
||||
let mut operand_stack: Vec<BinaryPart> = Vec::new();
|
||||
let e = KclError::Internal(KclErrorDetails {
|
||||
@ -28,14 +28,19 @@ fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclErro
|
||||
let Some(left) = operand_stack.pop() else {
|
||||
return Err(e);
|
||||
};
|
||||
BinaryPart::BinaryExpression(Box::new(BinaryExpression {
|
||||
start: left.start(),
|
||||
end: right.end(),
|
||||
let start = left.start();
|
||||
let end = right.end();
|
||||
|
||||
BinaryPart::BinaryExpression(Node::boxed(
|
||||
BinaryExpression {
|
||||
operator,
|
||||
left,
|
||||
right,
|
||||
digest: None,
|
||||
}))
|
||||
},
|
||||
start,
|
||||
end,
|
||||
))
|
||||
}
|
||||
BinaryExpressionToken::Operand(o) => o,
|
||||
};
|
||||
@ -125,13 +130,15 @@ mod tests {
|
||||
fn parse_and_evaluate() {
|
||||
/// Make a literal
|
||||
fn lit(n: u8) -> BinaryPart {
|
||||
BinaryPart::Literal(Box::new(Literal {
|
||||
start: 0,
|
||||
end: 0,
|
||||
BinaryPart::Literal(Box::new(Node::new(
|
||||
Literal {
|
||||
value: n.into(),
|
||||
raw: n.to_string(),
|
||||
digest: None,
|
||||
}))
|
||||
},
|
||||
0,
|
||||
0,
|
||||
)))
|
||||
}
|
||||
let tests: Vec<Vec<BinaryExpressionToken>> = vec![
|
||||
// 3 + 4 × 2 ÷ ( 1 − 5 ) ^ 2 ^ 3
|
||||
@ -142,14 +149,16 @@ mod tests {
|
||||
BinaryOperator::Mul.into(),
|
||||
lit(2).into(),
|
||||
BinaryOperator::Div.into(),
|
||||
BinaryPart::BinaryExpression(Box::new(BinaryExpression {
|
||||
start: 0,
|
||||
end: 0,
|
||||
BinaryPart::BinaryExpression(Node::boxed(
|
||||
BinaryExpression {
|
||||
operator: BinaryOperator::Sub,
|
||||
left: lit(1),
|
||||
right: lit(5),
|
||||
digest: None,
|
||||
}))
|
||||
},
|
||||
0,
|
||||
0,
|
||||
))
|
||||
.into(),
|
||||
BinaryOperator::Pow.into(),
|
||||
lit(2).into(),
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,23 +4,23 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 5,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 4,
|
||||
"end": 5,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
}
|
||||
"raw": "2",
|
||||
"start": 4,
|
||||
"end": 5
|
||||
},
|
||||
"start": 0,
|
||||
"end": 5
|
||||
}
|
||||
|
@ -4,23 +4,23 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 2,
|
||||
"end": 3,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
}
|
||||
"raw": "2",
|
||||
"start": 2,
|
||||
"end": 3
|
||||
},
|
||||
"start": 0,
|
||||
"end": 3
|
||||
}
|
||||
|
@ -4,23 +4,23 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 4,
|
||||
"operator": "-",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 3,
|
||||
"end": 4,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
}
|
||||
"raw": "2",
|
||||
"start": 3,
|
||||
"end": 4
|
||||
},
|
||||
"start": 0,
|
||||
"end": 4
|
||||
}
|
||||
|
@ -4,38 +4,38 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 9,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 4,
|
||||
"end": 9,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 4,
|
||||
"end": 5,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
"raw": "2",
|
||||
"start": 4,
|
||||
"end": 5
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 8,
|
||||
"end": 9,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
}
|
||||
"raw": "3",
|
||||
"start": 8,
|
||||
"end": 9
|
||||
},
|
||||
"start": 4,
|
||||
"end": 9
|
||||
},
|
||||
"start": 0,
|
||||
"end": 9
|
||||
}
|
||||
|
@ -4,38 +4,38 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 11,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 6,
|
||||
"end": 11,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
"raw": "2",
|
||||
"start": 6,
|
||||
"end": 7
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 10,
|
||||
"end": 11,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
}
|
||||
"raw": "3",
|
||||
"start": 10,
|
||||
"end": 11
|
||||
},
|
||||
"start": 6,
|
||||
"end": 11
|
||||
},
|
||||
"start": 0,
|
||||
"end": 11
|
||||
}
|
||||
|
@ -4,53 +4,53 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 17,
|
||||
"operator": "/",
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 11,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 6,
|
||||
"end": 11,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
"raw": "2",
|
||||
"start": 6,
|
||||
"end": 7
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 10,
|
||||
"end": 11,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
}
|
||||
"raw": "3",
|
||||
"start": 10,
|
||||
"end": 11
|
||||
},
|
||||
"start": 6,
|
||||
"end": 11
|
||||
},
|
||||
"start": 0,
|
||||
"end": 11
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 16,
|
||||
"end": 17,
|
||||
"value": 4,
|
||||
"raw": "4"
|
||||
}
|
||||
"raw": "4",
|
||||
"start": 16,
|
||||
"end": 17
|
||||
},
|
||||
"start": 0,
|
||||
"end": 17
|
||||
}
|
||||
|
@ -4,53 +4,53 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 17,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 6,
|
||||
"end": 17,
|
||||
"operator": "/",
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 6,
|
||||
"end": 11,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
"raw": "2",
|
||||
"start": 6,
|
||||
"end": 7
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 10,
|
||||
"end": 11,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
"raw": "3",
|
||||
"start": 10,
|
||||
"end": 11
|
||||
},
|
||||
"start": 6,
|
||||
"end": 11
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 16,
|
||||
"end": 17,
|
||||
"value": 4,
|
||||
"raw": "4"
|
||||
}
|
||||
}
|
||||
"raw": "4",
|
||||
"start": 16,
|
||||
"end": 17
|
||||
},
|
||||
"start": 6,
|
||||
"end": 17
|
||||
},
|
||||
"start": 0,
|
||||
"end": 17
|
||||
}
|
||||
|
@ -4,68 +4,68 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 7,
|
||||
"end": 22,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 7,
|
||||
"end": 18,
|
||||
"operator": "/",
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 7,
|
||||
"end": 12,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 7,
|
||||
"end": 8,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
"raw": "2",
|
||||
"start": 7,
|
||||
"end": 8
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 11,
|
||||
"end": 12,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
"raw": "3",
|
||||
"start": 11,
|
||||
"end": 12
|
||||
},
|
||||
"start": 7,
|
||||
"end": 12
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 17,
|
||||
"end": 18,
|
||||
"value": 4,
|
||||
"raw": "4"
|
||||
}
|
||||
"raw": "4",
|
||||
"start": 17,
|
||||
"end": 18
|
||||
},
|
||||
"start": 7,
|
||||
"end": 18
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 21,
|
||||
"end": 22,
|
||||
"value": 5,
|
||||
"raw": "5"
|
||||
}
|
||||
}
|
||||
"raw": "5",
|
||||
"start": 21,
|
||||
"end": 22
|
||||
},
|
||||
"start": 7,
|
||||
"end": 22
|
||||
},
|
||||
"start": 0,
|
||||
"end": 22
|
||||
}
|
||||
|
@ -4,38 +4,38 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 13,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 8,
|
||||
"end": 13,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 8,
|
||||
"end": 9,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
"raw": "2",
|
||||
"start": 8,
|
||||
"end": 9
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 12,
|
||||
"end": 13,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
}
|
||||
"raw": "3",
|
||||
"start": 12,
|
||||
"end": 13
|
||||
},
|
||||
"start": 8,
|
||||
"end": 13
|
||||
},
|
||||
"start": 0,
|
||||
"end": 13
|
||||
}
|
||||
|
@ -4,78 +4,78 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 44,
|
||||
"operator": "/",
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 18,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 12,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"name": "distance",
|
||||
"start": 0,
|
||||
"end": 8,
|
||||
"name": "distance"
|
||||
"end": 8
|
||||
},
|
||||
"right": {
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"name": "p",
|
||||
"start": 11,
|
||||
"end": 12,
|
||||
"name": "p"
|
||||
}
|
||||
"end": 12
|
||||
},
|
||||
"start": 0,
|
||||
"end": 12
|
||||
},
|
||||
"right": {
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"name": "FOS",
|
||||
"start": 15,
|
||||
"end": 18,
|
||||
"name": "FOS"
|
||||
}
|
||||
"end": 18
|
||||
},
|
||||
"start": 0,
|
||||
"end": 18
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 21,
|
||||
"end": 22,
|
||||
"value": 6,
|
||||
"raw": "6"
|
||||
}
|
||||
"raw": "6",
|
||||
"start": 21,
|
||||
"end": 22
|
||||
},
|
||||
"start": 0,
|
||||
"end": 22
|
||||
},
|
||||
"right": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 26,
|
||||
"end": 44,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"name": "sigmaAllow",
|
||||
"start": 26,
|
||||
"end": 36,
|
||||
"name": "sigmaAllow"
|
||||
"end": 36
|
||||
},
|
||||
"right": {
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"name": "width",
|
||||
"start": 39,
|
||||
"end": 44,
|
||||
"name": "width"
|
||||
}
|
||||
}
|
||||
"end": 44
|
||||
},
|
||||
"start": 26,
|
||||
"end": 44
|
||||
},
|
||||
"start": 0,
|
||||
"end": 44
|
||||
}
|
||||
|
@ -4,23 +4,23 @@ expression: actual
|
||||
---
|
||||
{
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 8,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
"raw": "2",
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 7,
|
||||
"end": 8,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
"raw": "3",
|
||||
"start": 7,
|
||||
"end": 8
|
||||
},
|
||||
"start": 0,
|
||||
"end": 8
|
||||
}
|
||||
|
@ -3,253 +3,253 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 144,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 143,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 143,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 15,
|
||||
"name": "boxSketch"
|
||||
"name": "boxSketch",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression",
|
||||
"start": 18,
|
||||
"end": 143,
|
||||
"body": [
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 18,
|
||||
"end": 39,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 18,
|
||||
"end": 31,
|
||||
"name": "startSketchAt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 32,
|
||||
"end": 38,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 33,
|
||||
"end": 34,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 33,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 36,
|
||||
"end": 37,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
}
|
||||
]
|
||||
"raw": "0",
|
||||
"start": 36,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 38,
|
||||
"start": 32,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 31,
|
||||
"name": "startSketchAt",
|
||||
"start": 18,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 39,
|
||||
"optional": false,
|
||||
"start": 18,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 47,
|
||||
"end": 63,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 47,
|
||||
"end": 51,
|
||||
"name": "line"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 52,
|
||||
"end": 59,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 53,
|
||||
"end": 54,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 53,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 56,
|
||||
"end": 58,
|
||||
"value": 10,
|
||||
"raw": "10"
|
||||
"raw": "10",
|
||||
"start": 56,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 10
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 59,
|
||||
"start": 52,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 62,
|
||||
"start": 61,
|
||||
"end": 62
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 51,
|
||||
"name": "line",
|
||||
"start": 47,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 63,
|
||||
"optional": false,
|
||||
"start": 47,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 71,
|
||||
"end": 96,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 71,
|
||||
"end": 84,
|
||||
"name": "tangentialArc"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 85,
|
||||
"end": 92,
|
||||
"elements": [
|
||||
{
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression",
|
||||
"start": 86,
|
||||
"end": 88,
|
||||
"operator": "-",
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"end": 88,
|
||||
"raw": "5",
|
||||
"start": 87,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 5
|
||||
},
|
||||
"end": 88,
|
||||
"value": 5,
|
||||
"raw": "5"
|
||||
}
|
||||
"operator": "-",
|
||||
"start": 86,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 90,
|
||||
"end": 91,
|
||||
"value": 5,
|
||||
"raw": "5"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"start": 94,
|
||||
"end": 95
|
||||
"raw": "5",
|
||||
"start": 90,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 5
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 92,
|
||||
"start": 85,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 104,
|
||||
"end": 121,
|
||||
"end": 95,
|
||||
"start": 94,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 104,
|
||||
"end": 108,
|
||||
"name": "line"
|
||||
"end": 84,
|
||||
"name": "tangentialArc",
|
||||
"start": 71,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 96,
|
||||
"optional": false,
|
||||
"start": 71,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 109,
|
||||
"end": 117,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 110,
|
||||
"end": 111,
|
||||
"value": 5,
|
||||
"raw": "5"
|
||||
"raw": "5",
|
||||
"start": 110,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression",
|
||||
"start": 113,
|
||||
"argument": {
|
||||
"end": 116,
|
||||
"raw": "15",
|
||||
"start": 114,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 15
|
||||
},
|
||||
"end": 116,
|
||||
"operator": "-",
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 114,
|
||||
"end": 116,
|
||||
"value": 15,
|
||||
"raw": "15"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"start": 119,
|
||||
"end": 120
|
||||
"start": 113,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 117,
|
||||
"start": 109,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 129,
|
||||
"end": 143,
|
||||
"end": 120,
|
||||
"start": 119,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 129,
|
||||
"end": 136,
|
||||
"name": "extrude"
|
||||
"end": 108,
|
||||
"name": "line",
|
||||
"start": 104,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 121,
|
||||
"optional": false,
|
||||
"start": 104,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 137,
|
||||
"end": 139,
|
||||
"value": 10,
|
||||
"raw": "10"
|
||||
"raw": "10",
|
||||
"start": 137,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 10
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 142,
|
||||
"start": 141,
|
||||
"end": 142
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
}
|
||||
"callee": {
|
||||
"end": 136,
|
||||
"name": "extrude",
|
||||
"start": 129,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 143,
|
||||
"optional": false,
|
||||
"start": 129,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 143,
|
||||
"start": 18,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 143,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 144,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,42 +3,42 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 17,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 17,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 17,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 8,
|
||||
"name": "sg"
|
||||
"name": "sg",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression",
|
||||
"start": 11,
|
||||
"argument": {
|
||||
"end": 17,
|
||||
"name": "scale",
|
||||
"start": 12,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 17,
|
||||
"operator": "-",
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 17,
|
||||
"name": "scale"
|
||||
}
|
||||
}
|
||||
"start": 11,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 17,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 17,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,79 +3,79 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 23,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 23,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 23,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 6,
|
||||
"name": "lineTo"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression",
|
||||
"start": 7,
|
||||
"end": 22,
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 9,
|
||||
"end": 20,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 11,
|
||||
"name": "to"
|
||||
"name": "to",
|
||||
"start": 9,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 9,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 13,
|
||||
"end": 20,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 14,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression",
|
||||
"start": 17,
|
||||
"argument": {
|
||||
"end": 19,
|
||||
"raw": "1",
|
||||
"start": 18,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
},
|
||||
"end": 19,
|
||||
"operator": "-",
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
"start": 17,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 20,
|
||||
"start": 13,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 23,
|
||||
"optional": false,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 23,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,51 +3,51 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 23,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 23,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 23,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 13,
|
||||
"name": "myArray"
|
||||
"name": "myArray",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrayRangeExpression",
|
||||
"type": "ArrayRangeExpression",
|
||||
"start": 16,
|
||||
"end": 23,
|
||||
"startElement": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 17,
|
||||
"end": 18,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
"endElement": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 20,
|
||||
"end": 22,
|
||||
"value": 10,
|
||||
"raw": "10"
|
||||
"raw": "10",
|
||||
"start": 20,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 10
|
||||
},
|
||||
"endInclusive": true
|
||||
}
|
||||
"endInclusive": true,
|
||||
"start": 16,
|
||||
"startElement": {
|
||||
"end": 18,
|
||||
"raw": "0",
|
||||
"start": 17,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
"type": "ArrayRangeExpression",
|
||||
"type": "ArrayRangeExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 23,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 23,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,75 +3,75 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 80,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 5,
|
||||
"end": 57,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 8,
|
||||
"end": 57,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 8,
|
||||
"end": 24,
|
||||
"name": "firstPrimeNumber"
|
||||
"name": "firstPrimeNumber",
|
||||
"start": 8,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "FunctionExpression",
|
||||
"type": "FunctionExpression",
|
||||
"start": 27,
|
||||
"end": 57,
|
||||
"params": [],
|
||||
"body": {
|
||||
"start": 33,
|
||||
"end": 57,
|
||||
"body": [
|
||||
{
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement",
|
||||
"start": 43,
|
||||
"end": 51,
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 50,
|
||||
"end": 51,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"raw": "2",
|
||||
"start": 50,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 2
|
||||
},
|
||||
"end": 51,
|
||||
"start": 43,
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement"
|
||||
}
|
||||
],
|
||||
"kind": "fn"
|
||||
"end": 57,
|
||||
"start": 33
|
||||
},
|
||||
"end": 57,
|
||||
"params": [],
|
||||
"start": 27,
|
||||
"type": "FunctionExpression",
|
||||
"type": "FunctionExpression"
|
||||
},
|
||||
"start": 8,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"end": 57,
|
||||
"kind": "fn",
|
||||
"start": 5,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 62,
|
||||
"end": 80,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 62,
|
||||
"end": 80,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 62,
|
||||
"end": 78,
|
||||
"name": "firstPrimeNumber"
|
||||
},
|
||||
"arguments": [],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 78,
|
||||
"name": "firstPrimeNumber",
|
||||
"start": 62,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 80,
|
||||
"optional": false,
|
||||
"start": 62,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 62,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 80,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,95 +3,95 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 66,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 49,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 3,
|
||||
"end": 49,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 3,
|
||||
"end": 8,
|
||||
"name": "thing"
|
||||
"name": "thing",
|
||||
"start": 3,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "FunctionExpression",
|
||||
"type": "FunctionExpression",
|
||||
"start": 11,
|
||||
"body": {
|
||||
"body": [
|
||||
{
|
||||
"argument": {
|
||||
"end": 43,
|
||||
"raw": "true",
|
||||
"start": 39,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": true
|
||||
},
|
||||
"end": 43,
|
||||
"start": 32,
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement"
|
||||
}
|
||||
],
|
||||
"end": 49,
|
||||
"start": 22
|
||||
},
|
||||
"end": 49,
|
||||
"params": [
|
||||
{
|
||||
"type": "Parameter",
|
||||
"identifier": {
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 17,
|
||||
"name": "param"
|
||||
"name": "param",
|
||||
"start": 12,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"start": 22,
|
||||
"end": 49,
|
||||
"body": [
|
||||
{
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement",
|
||||
"start": 32,
|
||||
"end": 43,
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 39,
|
||||
"end": 43,
|
||||
"value": true,
|
||||
"raw": "true"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"start": 11,
|
||||
"type": "FunctionExpression",
|
||||
"type": "FunctionExpression"
|
||||
},
|
||||
"start": 3,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"kind": "fn"
|
||||
"end": 49,
|
||||
"kind": "fn",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 54,
|
||||
"end": 66,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 54,
|
||||
"end": 66,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 54,
|
||||
"end": 59,
|
||||
"name": "thing"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 60,
|
||||
"end": 65,
|
||||
"value": false,
|
||||
"raw": "false"
|
||||
"raw": "false",
|
||||
"start": 60,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": false
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 59,
|
||||
"name": "thing",
|
||||
"start": 54,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 66,
|
||||
"optional": false,
|
||||
"start": 54,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 54,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 66,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,245 +3,245 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 165,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 165,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 165,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 14,
|
||||
"name": "mySketch"
|
||||
"name": "mySketch",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression",
|
||||
"start": 17,
|
||||
"end": 165,
|
||||
"body": [
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 17,
|
||||
"end": 37,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 17,
|
||||
"end": 30,
|
||||
"name": "startSketchAt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 31,
|
||||
"end": 36,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 32,
|
||||
"end": 33,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 32,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 34,
|
||||
"end": 35,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
}
|
||||
]
|
||||
"raw": "0",
|
||||
"start": 34,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 36,
|
||||
"start": 31,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 30,
|
||||
"name": "startSketchAt",
|
||||
"start": 17,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 37,
|
||||
"optional": false,
|
||||
"start": 17,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 49,
|
||||
"end": 75,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 49,
|
||||
"end": 55,
|
||||
"name": "lineTo"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 56,
|
||||
"end": 62,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 57,
|
||||
"end": 58,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 57,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 60,
|
||||
"end": 61,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 60,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 62,
|
||||
"start": 56,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 65,
|
||||
"start": 64,
|
||||
"end": 65
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
},
|
||||
{
|
||||
"type": "TagDeclarator",
|
||||
"type": "TagDeclarator",
|
||||
"start": 67,
|
||||
"end": 74,
|
||||
"start": 67,
|
||||
"type": "TagDeclarator",
|
||||
"type": "TagDeclarator",
|
||||
"value": "myPath"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 55,
|
||||
"name": "lineTo",
|
||||
"start": 49,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 75,
|
||||
"optional": false,
|
||||
"start": 49,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 87,
|
||||
"end": 104,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 87,
|
||||
"end": 93,
|
||||
"name": "lineTo"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 94,
|
||||
"end": 100,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 95,
|
||||
"end": 96,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 95,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 98,
|
||||
"end": 99,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"start": 102,
|
||||
"end": 103
|
||||
"raw": "1",
|
||||
"start": 98,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 100,
|
||||
"start": 94,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 116,
|
||||
"end": 145,
|
||||
"end": 103,
|
||||
"start": 102,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 116,
|
||||
"end": 122,
|
||||
"name": "lineTo"
|
||||
"end": 93,
|
||||
"name": "lineTo",
|
||||
"start": 87,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 104,
|
||||
"optional": false,
|
||||
"start": 87,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 123,
|
||||
"end": 129,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 124,
|
||||
"end": 125,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 124,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 127,
|
||||
"end": 128,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 127,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 129,
|
||||
"start": 123,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 132,
|
||||
"start": 131,
|
||||
"end": 132
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
},
|
||||
{
|
||||
"type": "TagDeclarator",
|
||||
"type": "TagDeclarator",
|
||||
"start": 134,
|
||||
"end": 144,
|
||||
"start": 134,
|
||||
"type": "TagDeclarator",
|
||||
"type": "TagDeclarator",
|
||||
"value": "rightPath"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 122,
|
||||
"name": "lineTo",
|
||||
"start": 116,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 145,
|
||||
"optional": false,
|
||||
"start": 116,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 157,
|
||||
"end": 165,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 157,
|
||||
"end": 162,
|
||||
"name": "close"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 164,
|
||||
"start": 163,
|
||||
"end": 164
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
}
|
||||
"callee": {
|
||||
"end": 162,
|
||||
"name": "close",
|
||||
"start": 157,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 165,
|
||||
"optional": false,
|
||||
"start": 157,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 165,
|
||||
"start": 17,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 165,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 165,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,141 +3,141 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 70,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 70,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 70,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 14,
|
||||
"name": "mySketch"
|
||||
"name": "mySketch",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression",
|
||||
"start": 17,
|
||||
"end": 70,
|
||||
"body": [
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 17,
|
||||
"end": 37,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 17,
|
||||
"end": 30,
|
||||
"name": "startSketchAt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 31,
|
||||
"end": 36,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 32,
|
||||
"end": 33,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 32,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 34,
|
||||
"end": 35,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
}
|
||||
]
|
||||
"raw": "0",
|
||||
"start": 34,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 36,
|
||||
"start": 31,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 30,
|
||||
"name": "startSketchAt",
|
||||
"start": 17,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 37,
|
||||
"optional": false,
|
||||
"start": 17,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 41,
|
||||
"end": 58,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 41,
|
||||
"end": 47,
|
||||
"name": "lineTo"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 48,
|
||||
"end": 54,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 49,
|
||||
"end": 50,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 49,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 52,
|
||||
"end": 53,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"start": 56,
|
||||
"end": 57
|
||||
"raw": "1",
|
||||
"start": 52,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 54,
|
||||
"start": 48,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 62,
|
||||
"end": 70,
|
||||
"end": 57,
|
||||
"start": 56,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 62,
|
||||
"end": 67,
|
||||
"name": "close"
|
||||
"end": 47,
|
||||
"name": "lineTo",
|
||||
"start": 41,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 58,
|
||||
"optional": false,
|
||||
"start": 41,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 69,
|
||||
"start": 68,
|
||||
"end": 69
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
}
|
||||
"callee": {
|
||||
"end": 67,
|
||||
"name": "close",
|
||||
"start": 62,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 70,
|
||||
"optional": false,
|
||||
"start": 62,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 70,
|
||||
"start": 17,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 70,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 70,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,50 +3,50 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 30,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 11,
|
||||
"name": "myBox"
|
||||
"name": "myBox",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 14,
|
||||
"end": 30,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 14,
|
||||
"end": 27,
|
||||
"name": "startSketchAt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"start": 28,
|
||||
"end": 29,
|
||||
"name": "p"
|
||||
"name": "p",
|
||||
"start": 28,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
"callee": {
|
||||
"end": 27,
|
||||
"name": "startSketchAt",
|
||||
"start": 14,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 30,
|
||||
"optional": false,
|
||||
"start": 14,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 30,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 30,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,88 +3,88 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 29,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 29,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 29,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 11,
|
||||
"name": "myBox"
|
||||
"name": "myBox",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression",
|
||||
"start": 14,
|
||||
"end": 29,
|
||||
"body": [
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 14,
|
||||
"end": 18,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"name": "f"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 16,
|
||||
"end": 17,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 16,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 15,
|
||||
"name": "f",
|
||||
"start": 14,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 18,
|
||||
"optional": false,
|
||||
"start": 14,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 22,
|
||||
"end": 29,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 22,
|
||||
"end": 23,
|
||||
"name": "g"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 24,
|
||||
"end": 25,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
"raw": "2",
|
||||
"start": 24,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 28,
|
||||
"start": 27,
|
||||
"end": 28
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
}
|
||||
"callee": {
|
||||
"end": 23,
|
||||
"name": "g",
|
||||
"start": 22,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 29,
|
||||
"optional": false,
|
||||
"start": 22,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 29,
|
||||
"start": 14,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 29,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 29,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,102 +3,102 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 49,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 49,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 49,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 11,
|
||||
"name": "myBox"
|
||||
"name": "myBox",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression",
|
||||
"start": 14,
|
||||
"end": 49,
|
||||
"body": [
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 14,
|
||||
"end": 30,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 14,
|
||||
"end": 27,
|
||||
"name": "startSketchAt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"start": 28,
|
||||
"end": 29,
|
||||
"name": "p"
|
||||
"name": "p",
|
||||
"start": 28,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 27,
|
||||
"name": "startSketchAt",
|
||||
"start": 14,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 30,
|
||||
"optional": false,
|
||||
"start": 14,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 34,
|
||||
"end": 49,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 34,
|
||||
"end": 38,
|
||||
"name": "line"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 39,
|
||||
"end": 45,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 40,
|
||||
"end": 41,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 40,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"start": 43,
|
||||
"end": 44,
|
||||
"name": "l"
|
||||
"name": "l",
|
||||
"start": 43,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 45,
|
||||
"start": 39,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 48,
|
||||
"start": 47,
|
||||
"end": 48
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
}
|
||||
"callee": {
|
||||
"end": 38,
|
||||
"name": "line",
|
||||
"start": 34,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 49,
|
||||
"optional": false,
|
||||
"start": 34,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 49,
|
||||
"start": 14,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 49,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 49,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,72 +3,72 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 6,
|
||||
"name": "lineTo"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression",
|
||||
"start": 7,
|
||||
"end": 21,
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 9,
|
||||
"end": 19,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 11,
|
||||
"name": "to"
|
||||
"name": "to",
|
||||
"start": 9,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 9,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 13,
|
||||
"end": 19,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 14,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 17,
|
||||
"end": 18,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
"raw": "1",
|
||||
"start": 17,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 19,
|
||||
"start": 13,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 22,
|
||||
"optional": false,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 22,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,107 +3,107 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 36,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 36,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 36,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 6,
|
||||
"name": "lineTo"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression",
|
||||
"start": 7,
|
||||
"end": 35,
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 9,
|
||||
"end": 19,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 11,
|
||||
"name": "to"
|
||||
"name": "to",
|
||||
"start": 9,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 13,
|
||||
"end": 19,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 17,
|
||||
"end": 18,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": 9,
|
||||
"type": "ObjectProperty",
|
||||
"start": 21,
|
||||
"end": 33,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 21,
|
||||
"end": 25,
|
||||
"name": "from"
|
||||
},
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 27,
|
||||
"end": 33,
|
||||
"elements": [
|
||||
{
|
||||
"end": 15,
|
||||
"raw": "0",
|
||||
"start": 14,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 28,
|
||||
"end": 29,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"end": 18,
|
||||
"raw": "1",
|
||||
"start": 17,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 31,
|
||||
"end": 32,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
"value": 1
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 19,
|
||||
"start": 13,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 33,
|
||||
"key": {
|
||||
"end": 25,
|
||||
"name": "from",
|
||||
"start": 21,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 21,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 29,
|
||||
"raw": "3",
|
||||
"start": 28,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"end": 32,
|
||||
"raw": "3",
|
||||
"start": 31,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
}
|
||||
],
|
||||
"end": 33,
|
||||
"start": 27,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 36,
|
||||
"optional": false,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 36,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,72 +3,72 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 6,
|
||||
"name": "lineTo"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression",
|
||||
"start": 7,
|
||||
"end": 18,
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 8,
|
||||
"end": 17,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 8,
|
||||
"end": 10,
|
||||
"name": "to"
|
||||
"name": "to",
|
||||
"start": 8,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 8,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 11,
|
||||
"end": 17,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 12,
|
||||
"end": 13,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 12,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 15,
|
||||
"end": 16,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
"raw": "1",
|
||||
"start": 15,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 17,
|
||||
"start": 11,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 19,
|
||||
"optional": false,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 19,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,107 +3,107 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 6,
|
||||
"name": "lineTo"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression",
|
||||
"start": 7,
|
||||
"end": 34,
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 9,
|
||||
"end": 19,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 11,
|
||||
"name": "to"
|
||||
"name": "to",
|
||||
"start": 9,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 13,
|
||||
"end": 19,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 17,
|
||||
"end": 18,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": 9,
|
||||
"type": "ObjectProperty",
|
||||
"start": 21,
|
||||
"end": 33,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 21,
|
||||
"end": 25,
|
||||
"name": "from"
|
||||
},
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 27,
|
||||
"end": 33,
|
||||
"elements": [
|
||||
{
|
||||
"end": 15,
|
||||
"raw": "0",
|
||||
"start": 14,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 28,
|
||||
"end": 29,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"end": 18,
|
||||
"raw": "1",
|
||||
"start": 17,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 31,
|
||||
"end": 32,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
"value": 1
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 19,
|
||||
"start": 13,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 33,
|
||||
"key": {
|
||||
"end": 25,
|
||||
"name": "from",
|
||||
"start": 21,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 21,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 29,
|
||||
"raw": "3",
|
||||
"start": 28,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"end": 32,
|
||||
"raw": "3",
|
||||
"start": 31,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
}
|
||||
],
|
||||
"end": 33,
|
||||
"start": 27,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 35,
|
||||
"optional": false,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 35,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,107 +3,107 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 6,
|
||||
"name": "lineTo"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression",
|
||||
"start": 7,
|
||||
"end": 34,
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 9,
|
||||
"end": 19,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 11,
|
||||
"name": "to"
|
||||
"name": "to",
|
||||
"start": 9,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 13,
|
||||
"end": 19,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 17,
|
||||
"end": 18,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": 9,
|
||||
"type": "ObjectProperty",
|
||||
"start": 20,
|
||||
"end": 32,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 20,
|
||||
"end": 24,
|
||||
"name": "from"
|
||||
},
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 26,
|
||||
"end": 32,
|
||||
"elements": [
|
||||
{
|
||||
"end": 15,
|
||||
"raw": "0",
|
||||
"start": 14,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 27,
|
||||
"end": 28,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"end": 18,
|
||||
"raw": "1",
|
||||
"start": 17,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 30,
|
||||
"end": 31,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
"value": 1
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 19,
|
||||
"start": 13,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 32,
|
||||
"key": {
|
||||
"end": 24,
|
||||
"name": "from",
|
||||
"start": 20,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 20,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 28,
|
||||
"raw": "3",
|
||||
"start": 27,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"end": 31,
|
||||
"raw": "3",
|
||||
"start": 30,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
}
|
||||
],
|
||||
"end": 32,
|
||||
"start": 26,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"start": 7,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 6,
|
||||
"name": "lineTo",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 35,
|
||||
"optional": false,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 35,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,67 +3,67 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 37,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 37,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 37,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 14,
|
||||
"name": "mySketch"
|
||||
"name": "mySketch",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 17,
|
||||
"end": 37,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 17,
|
||||
"end": 30,
|
||||
"name": "startSketchAt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 31,
|
||||
"end": 36,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 32,
|
||||
"end": 33,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 32,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 34,
|
||||
"end": 35,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
}
|
||||
]
|
||||
"raw": "0",
|
||||
"start": 34,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
"end": 36,
|
||||
"start": 31,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"callee": {
|
||||
"end": 30,
|
||||
"name": "startSketchAt",
|
||||
"start": 17,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 37,
|
||||
"optional": false,
|
||||
"start": 17,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 37,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 37,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,52 +3,52 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"name": "log"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 4,
|
||||
"end": 5,
|
||||
"value": 5,
|
||||
"raw": "5"
|
||||
"raw": "5",
|
||||
"start": 4,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 7,
|
||||
"end": 14,
|
||||
"value": "hello",
|
||||
"raw": "\"hello\""
|
||||
"raw": "\"hello\"",
|
||||
"start": 7,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "hello"
|
||||
},
|
||||
{
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"start": 16,
|
||||
"end": 27,
|
||||
"name": "aIdentifier"
|
||||
"name": "aIdentifier",
|
||||
"start": 16,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 3,
|
||||
"name": "log",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 28,
|
||||
"optional": false,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 28,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,37 +3,37 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 7,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 7,
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 7,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 5,
|
||||
"raw": "5"
|
||||
"raw": "5",
|
||||
"start": 0,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 5
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 4,
|
||||
"end": 7,
|
||||
"value": "a",
|
||||
"raw": "\"a\""
|
||||
"raw": "\"a\"",
|
||||
"start": 4,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "a"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 7,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,58 +3,58 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 4,
|
||||
"name": "line"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 5,
|
||||
"end": 11,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 6,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 10,
|
||||
"name": "l"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"start": 13,
|
||||
"end": 14
|
||||
"name": "l",
|
||||
"start": 9,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"end": 11,
|
||||
"start": 5,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 14,
|
||||
"start": 13,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 4,
|
||||
"name": "line",
|
||||
"start": 0,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 15,
|
||||
"optional": false,
|
||||
"start": 0,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 0,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 15,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,171 +3,171 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 108,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 107,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 107,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 14,
|
||||
"name": "cylinder"
|
||||
"name": "cylinder",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression",
|
||||
"start": 17,
|
||||
"end": 107,
|
||||
"body": [
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 17,
|
||||
"end": 36,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 17,
|
||||
"end": 30,
|
||||
"name": "startSketchOn"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 31,
|
||||
"end": 35,
|
||||
"value": "XY",
|
||||
"raw": "'XY'"
|
||||
"raw": "'XY'",
|
||||
"start": 31,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XY"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 30,
|
||||
"name": "startSketchOn",
|
||||
"start": 17,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 36,
|
||||
"optional": false,
|
||||
"start": 17,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 44,
|
||||
"end": 85,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 44,
|
||||
"end": 50,
|
||||
"name": "circle"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression",
|
||||
"start": 51,
|
||||
"end": 81,
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 53,
|
||||
"end": 67,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 53,
|
||||
"end": 59,
|
||||
"name": "center"
|
||||
"name": "center",
|
||||
"start": 53,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 53,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 61,
|
||||
"end": 67,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 62,
|
||||
"end": 63,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 62,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 65,
|
||||
"end": 66,
|
||||
"value": 0,
|
||||
"raw": "0"
|
||||
"raw": "0",
|
||||
"start": 65,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 67,
|
||||
"start": 61,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 69,
|
||||
"end": 79,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 69,
|
||||
"end": 75,
|
||||
"name": "radius"
|
||||
"name": "radius",
|
||||
"start": 69,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 69,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 77,
|
||||
"end": 79,
|
||||
"value": 22,
|
||||
"raw": "22"
|
||||
"raw": "22",
|
||||
"start": 77,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 22
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"start": 83,
|
||||
"end": 84
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"start": 51,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 93,
|
||||
"end": 107,
|
||||
"end": 84,
|
||||
"start": 83,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 93,
|
||||
"end": 100,
|
||||
"name": "extrude"
|
||||
"end": 50,
|
||||
"name": "circle",
|
||||
"start": 44,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 85,
|
||||
"optional": false,
|
||||
"start": 44,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 101,
|
||||
"end": 103,
|
||||
"value": 14,
|
||||
"raw": "14"
|
||||
"raw": "14",
|
||||
"start": 101,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 14
|
||||
},
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 106,
|
||||
"start": 105,
|
||||
"end": 106
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
}
|
||||
"callee": {
|
||||
"end": 100,
|
||||
"name": "extrude",
|
||||
"start": 93,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 107,
|
||||
"optional": false,
|
||||
"start": 93,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 107,
|
||||
"start": 17,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 107,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 108,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,88 +3,88 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 49,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 49,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 3,
|
||||
"end": 49,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 3,
|
||||
"end": 4,
|
||||
"name": "f"
|
||||
"name": "f",
|
||||
"start": 3,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "FunctionExpression",
|
||||
"type": "FunctionExpression",
|
||||
"start": 7,
|
||||
"body": {
|
||||
"body": [
|
||||
{
|
||||
"argument": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 41,
|
||||
"name": "angle",
|
||||
"start": 36,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
{
|
||||
"end": 46,
|
||||
"raw": "360",
|
||||
"start": 43,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 360
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 35,
|
||||
"name": "default",
|
||||
"start": 28,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 47,
|
||||
"optional": false,
|
||||
"start": 28,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"end": 47,
|
||||
"start": 21,
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement"
|
||||
}
|
||||
],
|
||||
"end": 49,
|
||||
"start": 19
|
||||
},
|
||||
"end": 49,
|
||||
"params": [
|
||||
{
|
||||
"type": "Parameter",
|
||||
"identifier": {
|
||||
"type": "Identifier",
|
||||
"start": 8,
|
||||
"end": 13,
|
||||
"name": "angle"
|
||||
"name": "angle",
|
||||
"start": 8,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"optional": true
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"start": 19,
|
||||
"start": 7,
|
||||
"type": "FunctionExpression",
|
||||
"type": "FunctionExpression"
|
||||
},
|
||||
"start": 3,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"end": 49,
|
||||
"body": [
|
||||
{
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement",
|
||||
"start": 21,
|
||||
"end": 47,
|
||||
"argument": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 28,
|
||||
"end": 47,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 28,
|
||||
"end": 35,
|
||||
"name": "default"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"type": "Identifier",
|
||||
"start": 36,
|
||||
"end": 41,
|
||||
"name": "angle"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 43,
|
||||
"end": 46,
|
||||
"value": 360,
|
||||
"raw": "360"
|
||||
"kind": "fn",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "fn"
|
||||
}
|
||||
]
|
||||
"end": 49,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,55 +3,44 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 91,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 91,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 91,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 11,
|
||||
"name": "numbers"
|
||||
"name": "numbers",
|
||||
"start": 4,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 14,
|
||||
"end": 91,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 28,
|
||||
"end": 29,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 28,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 79,
|
||||
"end": 80,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
"raw": "3",
|
||||
"start": 79,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
}
|
||||
],
|
||||
"end": 91,
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"1": [
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 43,
|
||||
"end": 48,
|
||||
"start": 43,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "A,",
|
||||
@ -61,9 +50,9 @@ expression: actual
|
||||
],
|
||||
"2": [
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 61,
|
||||
"end": 66,
|
||||
"start": 61,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "B,",
|
||||
@ -72,12 +61,23 @@ expression: actual
|
||||
}
|
||||
]
|
||||
},
|
||||
"start": []
|
||||
}
|
||||
}
|
||||
"startNodes": []
|
||||
},
|
||||
"start": 14,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
"start": 4,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 91,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 91,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,55 +3,44 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 91,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 91,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 91,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 11,
|
||||
"name": "numbers"
|
||||
"name": "numbers",
|
||||
"start": 4,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression",
|
||||
"start": 14,
|
||||
"end": 91,
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 28,
|
||||
"end": 29,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
"raw": "1",
|
||||
"start": 28,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 43,
|
||||
"end": 44,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
"raw": "2",
|
||||
"start": 43,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 2
|
||||
}
|
||||
],
|
||||
"end": 91,
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"2": [
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 58,
|
||||
"end": 63,
|
||||
"start": 58,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "A,",
|
||||
@ -61,9 +50,9 @@ expression: actual
|
||||
],
|
||||
"3": [
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 76,
|
||||
"end": 81,
|
||||
"start": 76,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "B,",
|
||||
@ -72,12 +61,23 @@ expression: actual
|
||||
}
|
||||
]
|
||||
},
|
||||
"start": []
|
||||
}
|
||||
}
|
||||
"startNodes": []
|
||||
},
|
||||
"start": 14,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
"start": 4,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 91,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 91,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,77 +3,26 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 80,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 80,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 80,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 9,
|
||||
"name": "props"
|
||||
"name": "props",
|
||||
"start": 4,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression",
|
||||
"start": 12,
|
||||
"end": 80,
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 26,
|
||||
"end": 30,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 26,
|
||||
"end": 27,
|
||||
"name": "a"
|
||||
},
|
||||
"value": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 29,
|
||||
"end": 30,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 65,
|
||||
"end": 69,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 65,
|
||||
"end": 66,
|
||||
"name": "c"
|
||||
},
|
||||
"value": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 68,
|
||||
"end": 69,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"1": [
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 44,
|
||||
"end": 52,
|
||||
"start": 44,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "b: 2,",
|
||||
@ -82,12 +31,63 @@ expression: actual
|
||||
}
|
||||
]
|
||||
},
|
||||
"start": []
|
||||
"startNodes": []
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"end": 30,
|
||||
"key": {
|
||||
"end": 27,
|
||||
"name": "a",
|
||||
"start": 26,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 26,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 30,
|
||||
"raw": "1",
|
||||
"start": 29,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 69,
|
||||
"key": {
|
||||
"end": 66,
|
||||
"name": "c",
|
||||
"start": 65,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 65,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 69,
|
||||
"raw": "3",
|
||||
"start": 68,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"start": 12,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
},
|
||||
"start": 4,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 80,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 80,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,77 +3,26 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 79,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 79,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 79,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 9,
|
||||
"name": "props"
|
||||
"name": "props",
|
||||
"start": 4,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression",
|
||||
"start": 12,
|
||||
"end": 79,
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 26,
|
||||
"end": 30,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 26,
|
||||
"end": 27,
|
||||
"name": "a"
|
||||
},
|
||||
"value": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 29,
|
||||
"end": 30,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 65,
|
||||
"end": 69,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 65,
|
||||
"end": 66,
|
||||
"name": "c"
|
||||
},
|
||||
"value": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 68,
|
||||
"end": 69,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"1": [
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 44,
|
||||
"end": 52,
|
||||
"start": 44,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "b: 2,",
|
||||
@ -82,12 +31,63 @@ expression: actual
|
||||
}
|
||||
]
|
||||
},
|
||||
"start": []
|
||||
"startNodes": []
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"end": 30,
|
||||
"key": {
|
||||
"end": 27,
|
||||
"name": "a",
|
||||
"start": 26,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 26,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 30,
|
||||
"raw": "1",
|
||||
"start": 29,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 69,
|
||||
"key": {
|
||||
"end": 66,
|
||||
"name": "c",
|
||||
"start": 65,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 65,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 69,
|
||||
"raw": "3",
|
||||
"start": 68,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"start": 12,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
},
|
||||
"start": 4,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 79,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 79,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,89 +3,89 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 36,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 36,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 36,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 11,
|
||||
"name": "myVar"
|
||||
"name": "myVar",
|
||||
"start": 6,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 14,
|
||||
"end": 36,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 14,
|
||||
"end": 17,
|
||||
"name": "min"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"value": 5,
|
||||
"raw": "5"
|
||||
"raw": "5",
|
||||
"start": 18,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression",
|
||||
"start": 22,
|
||||
"argument": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 31,
|
||||
"raw": "5",
|
||||
"start": 30,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"end": 34,
|
||||
"raw": "4",
|
||||
"start": 33,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 4
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 29,
|
||||
"name": "legLen",
|
||||
"start": 23,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 35,
|
||||
"optional": false,
|
||||
"start": 23,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"end": 35,
|
||||
"operator": "-",
|
||||
"argument": {
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 23,
|
||||
"end": 35,
|
||||
"start": 22,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 23,
|
||||
"end": 29,
|
||||
"name": "legLen"
|
||||
"end": 17,
|
||||
"name": "min",
|
||||
"start": 14,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 30,
|
||||
"end": 31,
|
||||
"value": 5,
|
||||
"raw": "5"
|
||||
"end": 36,
|
||||
"optional": false,
|
||||
"start": 14,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 33,
|
||||
"end": 34,
|
||||
"value": 4,
|
||||
"raw": "4"
|
||||
"start": 6,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
"end": 36,
|
||||
"kind": "const",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
}
|
||||
]
|
||||
"end": 36,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,83 +3,72 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 133,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 1,
|
||||
"end": 132,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 7,
|
||||
"end": 132,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 7,
|
||||
"end": 16,
|
||||
"name": "sketch001"
|
||||
"name": "sketch001",
|
||||
"start": 7,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression",
|
||||
"start": 19,
|
||||
"end": 132,
|
||||
"body": [
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 19,
|
||||
"end": 38,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 19,
|
||||
"end": 32,
|
||||
"name": "startSketchOn"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 33,
|
||||
"end": 37,
|
||||
"value": "XY",
|
||||
"raw": "'XY'"
|
||||
"raw": "'XY'",
|
||||
"start": 33,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XY"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 32,
|
||||
"name": "startSketchOn",
|
||||
"start": 19,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 38,
|
||||
"optional": false,
|
||||
"start": 19,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression",
|
||||
"start": 115,
|
||||
"end": 132,
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 115,
|
||||
"end": 129,
|
||||
"name": "startProfileAt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution",
|
||||
"end": 131,
|
||||
"start": 130,
|
||||
"end": 131
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"optional": false
|
||||
"callee": {
|
||||
"end": 129,
|
||||
"name": "startProfileAt",
|
||||
"start": 115,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 132,
|
||||
"optional": false,
|
||||
"start": 115,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"end": 132,
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"0": [
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 41,
|
||||
"end": 52,
|
||||
"start": 41,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "|> arc({",
|
||||
@ -87,9 +76,9 @@ expression: actual
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 55,
|
||||
"end": 74,
|
||||
"start": 55,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "angleEnd: 270,",
|
||||
@ -97,9 +86,9 @@ expression: actual
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 77,
|
||||
"end": 98,
|
||||
"start": 77,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "angleStart: 450,",
|
||||
@ -107,9 +96,9 @@ expression: actual
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "NonCodeNode",
|
||||
"start": 101,
|
||||
"end": 109,
|
||||
"start": 101,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "}, %)",
|
||||
@ -118,12 +107,23 @@ expression: actual
|
||||
}
|
||||
]
|
||||
},
|
||||
"start": []
|
||||
}
|
||||
}
|
||||
"startNodes": []
|
||||
},
|
||||
"start": 19,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 7,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 132,
|
||||
"kind": "const",
|
||||
"start": 1,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 133,
|
||||
"start": 0
|
||||
}
|
||||
|
@ -3,96 +3,96 @@ source: kcl/src/parser/parser_impl.rs
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"start": 0,
|
||||
"end": 32,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration",
|
||||
"start": 1,
|
||||
"end": 31,
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 7,
|
||||
"end": 31,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 7,
|
||||
"end": 11,
|
||||
"name": "my14"
|
||||
"name": "my14",
|
||||
"start": 7,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 14,
|
||||
"end": 31,
|
||||
"operator": "-",
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 14,
|
||||
"end": 19,
|
||||
"operator": "^",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"value": 4,
|
||||
"raw": "4"
|
||||
},
|
||||
"right": {
|
||||
"raw": "4",
|
||||
"start": 14,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
}
|
||||
"value": 4
|
||||
},
|
||||
"right": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 22,
|
||||
"end": 31,
|
||||
"operator": "*",
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression",
|
||||
"start": 22,
|
||||
"end": 27,
|
||||
"operator": "^",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 22,
|
||||
"end": 23,
|
||||
"value": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"right": {
|
||||
"end": 19,
|
||||
"raw": "2",
|
||||
"start": 18,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 26,
|
||||
"end": 27,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
}
|
||||
"value": 2
|
||||
},
|
||||
"start": 14,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"operator": "-",
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 30,
|
||||
"end": 31,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
}
|
||||
}
|
||||
}
|
||||
"left": {
|
||||
"end": 27,
|
||||
"left": {
|
||||
"end": 23,
|
||||
"raw": "3",
|
||||
"start": 22,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 3
|
||||
},
|
||||
"operator": "^",
|
||||
"right": {
|
||||
"end": 27,
|
||||
"raw": "2",
|
||||
"start": 26,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 2
|
||||
},
|
||||
"start": 22,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"operator": "*",
|
||||
"right": {
|
||||
"end": 31,
|
||||
"raw": "2",
|
||||
"start": 30,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 2
|
||||
},
|
||||
"start": 22,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"start": 14,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"start": 7,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
"end": 31,
|
||||
"kind": "const",
|
||||
"start": 1,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": 32,
|
||||
"start": 0
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user