Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic generator support complete
- Loading branch information
Showing
25 changed files
with
161 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<settings> | ||
<language>boo</language> | ||
<outputType>library</outputType> | ||
<references/> | ||
<outputFolder>/boo-extensions/bin</outputFolder> | ||
<additionalOptions></additionalOptions> | ||
</settings> |
4 changes: 2 additions & 2 deletions
4
boojay/src/Boojay.Runtime/Builtins.boo → boojay/src/Boojay.Lang/Builtins.boo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace Boojay.Lang | ||
|
||
interface Callable: | ||
def Call(args as (object)) as object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace Boojay.Lang | ||
|
||
interface Disposable: | ||
def Dispose() |
2 changes: 1 addition & 1 deletion
2
boojay/src/Boojay.Runtime/Enumerable.boo → boojay/src/Boojay.Lang/Enumerable.boo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Boojay.Runtime | ||
namespace Boojay.Lang | ||
|
||
interface Enumerable: | ||
def GetEnumerator() as Enumerator | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Boojay.Lang | ||
|
||
abstract class Generator(Enumerable): | ||
pass | ||
|
||
abstract class GeneratorEnumerator(Enumerator): | ||
_current = null | ||
_state = 0 | ||
|
||
Current: | ||
get: return _current | ||
|
||
protected def Yield(state as int, value): | ||
_state = state | ||
_current = value | ||
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace Boojay.Lang | ||
|
||
class MulticastDelegate: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace Boojay.Lang | ||
|
||
class NotImplementedException(java.lang.RuntimeException): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
namespace Boojay.Lang | ||
|
||
import java.lang | ||
import java.util | ||
|
||
static class RuntimeServices: | ||
|
||
def ToBool(o): | ||
if o is null: | ||
return false | ||
boolean = o as Boolean | ||
if boolean is not null: | ||
return boolean.booleanValue() | ||
return true | ||
|
||
def UnboxChar(o): | ||
return cast(Character, o).charValue() | ||
|
||
def BoxChar(ch as char): | ||
return Character(ch) | ||
|
||
def UnboxInt32(o): | ||
return cast(Number, o).intValue() | ||
|
||
def EqualityOperator(x, y): | ||
if x is y: return true | ||
if x is null: return false | ||
return x.Equals(y) | ||
|
||
def GetEnumerable(source) as Enumerable: | ||
if source isa Enumerable: | ||
return source | ||
if source isa Iterable: | ||
return IterableEnumerable(source) | ||
if source isa string: | ||
return StringEnumerable(source) | ||
raise IllegalArgumentException("source") | ||
|
||
internal class StringEnumerable(Enumerable): | ||
_string as string | ||
def constructor(value as string): | ||
_string = value | ||
def GetEnumerator(): | ||
return StringEnumerator(_string) | ||
|
||
internal class StringEnumerator(Enumerator): | ||
|
||
_string as string | ||
_current = -1 | ||
|
||
def constructor(value as string): | ||
_string = value | ||
|
||
def MoveNext(): | ||
next = _current + 1 | ||
if next >= len(_string): | ||
return false | ||
_current = next | ||
return true | ||
|
||
Current: | ||
get: return _string[_current] | ||
|
||
internal class IterableEnumerable(Enumerable): | ||
_iterable as Iterable | ||
def constructor(iterable as Iterable): | ||
_iterable = iterable | ||
def GetEnumerator() as Enumerator: | ||
return IteratorEnumerator(_iterable.iterator()) | ||
|
||
internal class IteratorEnumerator(Enumerator): | ||
|
||
_iterator as Iterator | ||
_current | ||
|
||
def constructor(iterator as Iterator): | ||
_iterator = iterator | ||
|
||
def MoveNext(): | ||
if not _iterator.hasNext(): return false | ||
_current = _iterator.next() | ||
return true | ||
|
||
Current: | ||
get: return _current |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.