Skip to content

Instantly share code, notes, and snippets.

@Moligaloo
Created May 5, 2018 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Moligaloo/1681de4a1fa1f17dc178f9e00728d6b2 to your computer and use it in GitHub Desktop.
Save Moligaloo/1681de4a1fa1f17dc178f9e00728d6b2 to your computer and use it in GitHub Desktop.
get member list from struct definition using C style DSL
#!/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