UCSD-PL/language-ecmascript — pull request #4 by panagosg7 (2013-10-30 03:29:24+00:00)
Title: Adding support for annotations to the parser

In addition to `parseJavascriptFromFile`, the parsing API now has a `parseJavascriptFromFile'` that accepts a parser to parse annotations at certains parts of the code.

parseJavascriptFromFile' :: Parser String (Maybe r) r -> String -> m [Statement (SourceSpan, Maybe r)]

This parsing argument shall return values of type `Maybe r`, where `r` can be anything (e.g. for NanoJS it can be RefType).

At this point, there is only one place for annotation parsing at `parseVarDecl`, but this should be easy to extend.

Annotations will be in special comment format, which looks like normal block comments, but have a special character after the `/*`. This is set at language-ecmascript/src/Language/ECMAScript3/Lexer.hs using the variable `annotChar`. How it's set to `:` (to avoid confusion with the `@` used for NanoJS).