Skip to content

Instantly share code, notes, and snippets.

@SkyBirdSoar
Created September 3, 2015 16:04
Show Gist options
  • Save SkyBirdSoar/34399619083fe59356ff to your computer and use it in GitHub Desktop.
Save SkyBirdSoar/34399619083fe59356ff to your computer and use it in GitHub Desktop.
data = /^data ((?<inherits>[(]?([[:upper:]][\w, ]*)*[)]?) => )?(?<name>[[:upper:]]\w*) ?(?<type_vars>[[:lower:]][\w ]*)?(= (?<constructor>[[:upper:]][\w |]*))?(:: (?<type>.*))?/
klass = /^class ((?<inherits>[(]?([[:upper:]][\w, ]*)*[)]?) => )?(?<name>[[:upper:]][\w ]*?) where/
const = /^(=|\|) (?<name>[[:upper:]][\w]+)( (?<type_vars>.*))?/
# Special
# symbol: -> x { x.match(/^(?:(\(\W+\))[, ]{0,})+(?: ::.*)?/).captures.first.split(/[, ]/) },
# func: -> x { x.gsub(/::.*$/, "").split(/[, ]/) },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment