Permalink
Browse files

FIX: blocks for nested extracts work

  • Loading branch information...
shanebdavis committed Nov 18, 2018
1 parent c59aff4 commit 9530720eec755bf40117669c7456a1f16c706446
@@ -1,11 +1,14 @@
import &StandardImport, &CaffeineEight
extractExpression:
"" extractSource:value _ /extract/ conditionalExtract:conditionalExtract? _ extractionTarget
"" extractSource:value _ /extract/ conditionalExtract:conditionalExtract? _? extractBodyBlock
"" extractSource:value _ /extract/ conditionalExtract:conditionalExtract? extractActions
stnFactory: :ExtractStn
stnProps: -> conditional: !!@conditionalExtract
extractActions:
"" _ extractionTarget
"" _? extractBodyBlock
extractBodyBlock: Extensions.IndentBlocks.getPropsToSubparseBlock rule: :extractBody
extractBody: "end* extractBodyLine+"
@@ -26,7 +29,7 @@ extractAction:
:extractToIdentifier
chainExtract:
"" extractSource:extractToIdentifier _ /extract/ conditionalExtract:conditionalExtract? _ extractionTarget
"" extractSource:extractToIdentifier _ /extract/ conditionalExtract:conditionalExtract? extractActions
stnFactory: :ExtractStn
stnProps: -> conditional: !!@conditionalExtract
@@ -7,15 +7,15 @@ Caf.defMod(module, () => {
Extensions => {
return {
extractExpression: [
"extractSource:value _ /extract/ conditionalExtract:conditionalExtract? _ extractionTarget",
"extractSource:value _ /extract/ conditionalExtract:conditionalExtract? _? extractBodyBlock",
"extractSource:value _ /extract/ conditionalExtract:conditionalExtract? extractActions",
{
stnFactory: "ExtractStn",
stnProps: function() {
return { conditional: !!this.conditionalExtract };
}
}
],
extractActions: ["_ extractionTarget", "_? extractBodyBlock"],
extractBodyBlock: Extensions.IndentBlocks.getPropsToSubparseBlock({
rule: "extractBody"
}),
@@ -29,7 +29,7 @@ Caf.defMod(module, () => {
],
extractAction: ["chainExtract", "extractToIdentifier"],
chainExtract: [
"extractSource:extractToIdentifier _ /extract/ conditionalExtract:conditionalExtract? _ extractionTarget",
"extractSource:extractToIdentifier _ /extract/ conditionalExtract:conditionalExtract? extractActions",
{
stnFactory: "ExtractStn",
stnProps: function() {
@@ -80,6 +80,12 @@ module.exports = suite: parseTestSuite
d
""": "let b, c, d; b = a.b; c = a.c; d = a.d;"
"""
a extract
b extract
c
""": "let b, c; b = a.b; c = b.c;"
pathing:
"a extract b.c": "let c; c = a.b.c;"
###
@@ -47,24 +47,6 @@ while a > 0
This should have "let a" outside the while, but should have "let b" inside, like
all the comprehensions.
---------
```
result extract colorInfo extract colorMap
```
SHOULD extract colorInfo. Notes:
1. ```> result extract colorInfo, colorInfo extract colorMap```
is just weird
2. ```> (a extract b) ->```
That sets 'a' even though it is an intermediate value.
However, I'm OK with the following not setting 'b':
```
> a extract b.c
```
--------
### Extract Todo

0 comments on commit 9530720

Please sign in to comment.