Permalink
Browse files

Work on new scope system.

  • Loading branch information...
neilellis committed Aug 8, 2017
1 parent 0cfd33f commit 6aff6dd40d263f742ed2341a1642f015862d0425
Showing with 573 additions and 380 deletions.
  1. +5 −0 .bettercodehub.yml
  2. +1 −0 README.tmpl.md
  3. +16 −3 dollar-examples/src/main/resources/test_parameters.ds
  4. +0 −228 dollar-examples/src/main/resources/test_reactive.ds
  5. +83 −0 dollar-examples/src/main/resources/test_reactive1.ds
  6. +15 −0 dollar-examples/src/main/resources/test_reactive2.ds
  7. +16 −0 dollar-examples/src/main/resources/test_reactive3.ds
  8. +36 −0 dollar-examples/src/main/resources/test_reactive4.ds
  9. +16 −0 dollar-examples/src/main/resources/test_reactive5.ds
  10. +20 −0 dollar-examples/src/main/resources/test_reactive6.ds
  11. +8 −0 dollar-examples/src/main/resources/test_reactive7.ds
  12. +17 −0 dollar-examples/src/main/resources/test_reactive8.ds
  13. +3 −3 dollar-examples/src/test/java/dollar/internal/runtime/script/ParserTest.java
  14. +10 −2 ...xecution-plugin/src/main/java/com/sillelien/dollar/execution/simple/ScopeAwareDollarExecutor.java
  15. +17 −3 dollar-script/src/main/java/dollar/internal/runtime/script/BinaryOp.java
  16. +11 −12 dollar-script/src/main/java/dollar/internal/runtime/script/DollarParserImpl.java
  17. +54 −4 dollar-script/src/main/java/dollar/internal/runtime/script/DollarScriptSupport.java
  18. +5 −2 dollar-script/src/main/java/dollar/internal/runtime/script/DollarSource.java
  19. +76 −46 dollar-script/src/main/java/dollar/internal/runtime/script/ScriptScope.java
  20. +4 −1 dollar-script/src/main/java/dollar/internal/runtime/script/api/Scope.java
  21. +38 −20 dollar-script/src/main/java/dollar/internal/runtime/script/operators/AssignmentOperator.java
  22. +86 −37 dollar-script/src/main/java/dollar/internal/runtime/script/operators/CollectOperator.java
  23. +24 −12 dollar-script/src/main/java/dollar/internal/runtime/script/operators/ListenOperator.java
  24. +6 −4 dollar-script/src/main/java/dollar/internal/runtime/script/operators/PipeOperator.java
  25. +5 −2 dollar-script/src/main/java/dollar/internal/runtime/script/operators/VariableUsageOperator.java
  26. +1 −1 pom.xml
View
@@ -0,0 +1,5 @@
exclude:
- /bin/.*
component_depth: 1
languages:
- java
View
@@ -5,6 +5,7 @@
[![GitHub Issues](https://img.shields.io/github/issues/sillelien/dollar.svg)](https://github.com/sillelien/dollar/issues)
[![GitHub Release](https://img.shields.io/github/release/sillelien/dollar.svg)](https://github.com/sillelien/dollar)
[![Dependency Status](https://www.versioneye.com/user/projects/54ae285534ff3e2204000002/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54ae285534ff3e2204000002)
[![BCH compliance](https://bettercodehub.com/edge/badge/sillelien/dollar?branch=master)](https://bettercodehub.com/)
[![Join the chat at https://gitter.im/sillelien/dollar](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sillelien/dollar?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![GitQ](https://gitq.com/badge.svg)](https://gitq.com/sillelien/dollar)
@@ -1,9 +1,22 @@
[1,2,3][1] <-> 2
def first [$1[0]]
first([3,1]) <-> [3]
def second [$1[1]]
second([3,1]) <-> [1]
const array=[2,1]
def revrse1 [array[1],array[0]]
revrse1([2,1]) <-> [1,2]
def revrse [$1[1],$1[0]]
revrse([2,1]) <-> [1,2]
[2,1] -> revrse <-> [1,2]
([2,1] -> revrse) <-> [1,2]
//You must use the fix operator here to avoid an infinitely recursive expression.
fix ([2,1] -> revrse) -> revrse <-> [2,1]
@@ -13,6 +26,6 @@ def testParams {$2 + " " + $1}
testParams ("Hello", "World") <-> "World Hello"
def testParams2 {last + " " + first}
testParams2(first="Hello", last="World") <-> "World Hello"
def testParams2 {end + " " + begin}
testParams2(begin="Hello", end="World") <-> "World Hello"

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,83 @@
// = (assignment) normally forces immediate evaluation of the RHS
// however := is the lambda assignment and does not, thus creating a
// lambda style expression
@@ "*****"
var lamval=1
lamval causes { @@ "->"+lamval; }
const lambda2 := lamval
const lambda := ( ( lamval ) + lamval )
const notlambda = ( ( lamval ) + lamval )
lamval= 7
var lamval2= 23
//The simplest possible lambda (serves no purpose!)
.: 1 == 1
.: 1 == fix 1
.: & 1 == 1
@@ "*****"
//Since the lambda shares the scope of when it was declared this should be 14 not 2
.: &lambda == 14
.: &notlambda == 2
//And this is the single lamval syntax from earlier
&lambda2 <=> 7
//Now we test levels of indirection
def delayName { ("lamval" + lamval)}
@@ "*****"
lamval=5
var lamval5=13
//Did you follow that crazyness :-) Don't do this at home!
@@ "*****"
@@ "lamval"
@@ "lamval" + 1
@@ lamval + 1
@@ lamval
@@ $("lamval" + lamval)
@@ $('lamval' + lamval)
//Lambda variable resolution @@! - notice the two levels of indirection here - yeah edge case :-)
&$(${delayName}) <=> 13
def removeWorld ($1 - "World")
@@ ["Hello", "World"] -> removeWorld
(["Hello", "World"] -> removeWorld) <=> ["Hello"]
(["Goodbye", "World"] -> removeWorld) <=> ["Goodbye"]
($2 + " " + $1)("Hello", "World") <=> "World Hello"
def testParams ($2 + " " + $1)
(testParams) ("Hello", "World") <=> "World Hello"
//short-form of parameterized variable (function call style)
testParams("Hello", "World") <=> "World Hello"
@@ -0,0 +1,15 @@
var a=1
var b=1
a causes (print a)
a causes (b= a)
a <-> 1
b <-> 1
a=2
a <-> 2
b <-> 2
@@ -0,0 +1,16 @@
///////////////////////////////////////////////////////////////////////////////
var c=1
var d=1
c > 3 ? (d= c)
&c <=> 1
&d <=> 1
c=2
&c <=> 2
&d <=> 1
c=5
&c <=> 5
&d <=> 5
Oops, something went wrong.

0 comments on commit 6aff6dd

Please sign in to comment.