Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ikil' of github.com:olabini/ioke into ikil
- Loading branch information
Showing
20 changed files
with
170 additions
and
58 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
#!/usr/bin/env ioke | |||
|
|||
use("ikil") | |||
IKIL generate(*(System programArguments)) |
Binary file not shown.
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
|
|||
IKIL = Origin mimic | |||
IKIL Language = Origin mimic | |||
|
|||
use("ikil/dsl") | |||
use("ikil/main") | |||
use("ikil/languages/java") | |||
use("ikil/languages/csharp") |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,11 @@ | |||
|
|||
IKIL definitions = [] | |||
IKIL cell(:"{}") = macro( | |||
call arguments[0] selected(name == :"=") each(msg, | |||
def = Origin mimic | |||
def className = msg arguments[0] name asText | |||
def definitionName = msg arguments[1] name | |||
def definition = msg arguments[1] arguments | |||
definitions << def | |||
) | |||
) |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
|
|||
IKIL Language CSharp = IKIL Language mimic | |||
|
|||
IKIL Language CSharp createFile = method(name, dir, content, | |||
fullDir = "#{dir}/Ioke.Lang" | |||
FileSystem ensureDirectory(fullDir) | |||
FileSystem withOpenFile("#{fullDir}/#{name}.cs", fn(f, f print(content))) | |||
) | |||
|
|||
IKIL Language CSharp defineSimpleIokeObject = method(name, parent, | |||
" | |||
namespace Ioke.Lang { | |||
public class #{name} { | |||
public static void Init(IokeObject obj) { | |||
Runtime runtime = obj.runtime; | |||
obj.Kind = \"#{name}\"; | |||
obj.MimicsWithoutCheck((IokeObject)runtime.IokeGround.GetCell(null, null, \"#{parent}\")); | |||
runtime.IokeGround.RegisterCell(\"#{name}\", obj); | |||
} | |||
} | |||
} | |||
" | |||
) |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,25 @@ | |||
|
|||
IKIL Language Java = IKIL Language mimic | |||
|
|||
IKIL Language Java createFile = method(name, dir, content, | |||
fullDir = "#{dir}/ioke/lang" | |||
FileSystem ensureDirectory(fullDir) | |||
FileSystem withOpenFile("#{fullDir}/#{name}.java", fn(f, f print(content))) | |||
) | |||
|
|||
IKIL Language Java defineSimpleIokeObject = method(name, parent, | |||
" | |||
package ioke.lang; | |||
import ioke.lang.exceptions.ControlFlow; | |||
public class #{name} { | |||
public static void init(IokeObject obj) throws ControlFlow { | |||
Runtime runtime = obj.runtime; | |||
obj.setKind(\"#{name}\"); | |||
obj.mimicsWithoutCheck((IokeObject)runtime.iokeGround.getCell(null, null, \"#{parent}\")); | |||
runtime.iokeGround.registerCell(\"#{name}\", obj); | |||
} | |||
} | |||
" | |||
) |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
|
|||
IKIL generate = method(language, directory, outDirectory, | |||
FileSystem["#{directory}/**/*.ik"] each(name, | |||
use(name) | |||
) | |||
|
|||
lang = case(language, | |||
or("-java", "-j"), Language Java, | |||
or("-csharp", "-c"), Language CSharp) | |||
|
|||
definitions each(def, | |||
case(def definitionName, | |||
:IokeObject, lang createFile(def className, outDirectory, lang defineSimpleIokeObject(def className, *(def definition))), | |||
else, "can't handle #{def definitionName}" println | |||
) | |||
) | |||
) |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
|
|||
IKIL { | |||
Handler = IokeObject(Origin) | |||
Rescue = IokeObject(Origin) | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,55 @@ | |||
|
|||
IKIL { | |||
;; will create fields and constructor automatically | |||
;; will create an init method that makes sure it inits the correct things | |||
;; will add accessors for all the fields | |||
;; will add native method stuff for all methods defined | |||
;; will add standardized getInspect and getNotice | |||
|
|||
Range = IokeObjectData([Origin, Mixins Sequenced], | |||
from = IokeObject | |||
to = IokeObject | |||
inclusive = boolean | |||
inverted = boolean | |||
|
|||
methods { | |||
exclusive?: method("returns true if the receiver is an exclusive range, false otherwise", | |||
return(boolean(not(data inclusive)))), | |||
|
|||
inclusive?: method("returns true if the receiver is an inclusive range, false otherwise", | |||
return(boolean(data inclusive))), | |||
|
|||
from: method("returns the 'from' part of the range", | |||
return(data from)), | |||
|
|||
to: method("returns the 'to' part of the range", | |||
return(data to)), | |||
|
|||
inspect: method("Returns a text inspection of the object", | |||
return(text(inspect(self)))), | |||
|
|||
notice: method("Returns a brief text inspection of the object", | |||
return(text(notice(self)))), | |||
} | |||
|
|||
inspect { | |||
append(globalInspect(from)) | |||
|
|||
if(inclusive, | |||
append(".."), | |||
append("...")) | |||
|
|||
append(globalInspect(to)) | |||
} | |||
|
|||
notice { | |||
append(globalNotice(from)) | |||
|
|||
if(inclusive, | |||
append(".."), | |||
append("...")) | |||
|
|||
append(globalNotice(to)) | |||
} | |||
) | |||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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