Created
March 6, 2011 14:33
-
-
Save chanwit/857332 to your computer and use it in GitHub Desktop.
A Type-safe Monad that combines Node and List<Node> written in Groovy++
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
| package org.korat.ast | |
| class SomeNode { | |
| List<Node> data | |
| String getText() { data[0].text } | |
| String getType() { data[0].type } | |
| List<Node> getChild() { data[0].child } | |
| SomeNode getUnresolvedProperty(String name) { | |
| return data[0].getUnresolvedProperty(name) | |
| } | |
| SomeNode getAt(int i) { | |
| return new SomeNode(data: [data[i]]) | |
| } | |
| String toString() { | |
| return "#" + data[0].toString() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment