parseDirectives.coffee | |
---|---|
HEADER = ///
(?:
(\#\#\# .* \#\#\#\n?) |
(// .* \n?) |
(\# .* \n?)
)+
///
DIRECTIVE = ///
^[\W] *= \s* (\w+.*?) (\*\\/)?$
///gm
module.exports = parseDirectives = (code) ->
return [] unless match = HEADER.exec(code)
header = match[0]
match[1] while match = DIRECTIVE.exec header
|