Created
May 5, 2018 08:57
-
-
Save Moligaloo/1681de4a1fa1f17dc178f9e00728d6b2 to your computer and use it in GitHub Desktop.
get member list from struct definition using C style DSL
This file contains hidden or 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
#!/usr/bin/env io | |
StructDefinition := Object clone do( | |
name ::= "" | |
memberList ::= list() | |
with := method(name, | |
self clone setName(name) setMemberList(list()) | |
) | |
curlyBrackets := method( | |
msg_list := list() | |
msg := call argAt(0) | |
while(msg, | |
msg_list push(msg) | |
msg = msg next | |
) | |
memberList = msg_list map(name) select(!= ";") println | |
) | |
) | |
struct := Object clone do( | |
forward := method( | |
StructDefinition with(call message name) | |
) | |
) | |
struct CGPoint { | |
float64 x; | |
float64 y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment