packages feed

language-typescript 0.0.1 → 0.0.2

raw patch · 3 files changed

+27/−7 lines, 3 files

Files

language-typescript.cabal view
@@ -1,5 +1,5 @@ name: language-typescript-version: 0.0.1+version: 0.0.2 cabal-version: >=1.4 build-type: Simple license: MIT
src/Language/TypeScript/Parser.hs view
@@ -36,12 +36,14 @@  declarationSourceFile = whiteSpace >> many declarationElement <* eof +exported = reserved "export" >> return Exported+ declarationElement = choice $ map try-  [ InterfaceDeclaration <$> commentPlaceholder <*> optionMaybe (reserved "export" >> return Exported) <*> interface-  , ImportDeclaration <$> optionMaybe (reserved "export" >> return Exported) <*> (reserved "import" *> identifier) <*> (lexeme (char '=') *> entityName)+  [ InterfaceDeclaration <$> commentPlaceholder <*> optionMaybe exported <*> interface+  , ImportDeclaration <$> optionMaybe exported <*> (reserved "import" *> identifier) <*> (lexeme (char '=') *> entityName)   , ExportDeclaration <$> (reserved "export" >> lexeme (char '=') *> identifier)-  , ExternalImportDeclaration <$> optionMaybe (reserved "export" >> return Exported) <*> (reserved "import" *> identifier) <*> (lexeme (char '=') *> reserved "require" *> parens stringLiteral)-  , AmbientDeclaration <$> commentPlaceholder <*> optionMaybe (reserved "export" >> return Exported) <*> (reserved "declare" *> ambientDeclaration)+  , ExternalImportDeclaration <$> optionMaybe exported <*> (reserved "import" *> identifier) <*> (lexeme (char '=') *> reserved "require" *> parens stringLiteral)+  , AmbientDeclaration <$> commentPlaceholder <*> optionMaybe exported <*> (reserved "declare" *> ambientDeclaration)   ]  ambientDeclaration = choice (map try@@ -68,7 +70,19 @@  ambientModuleDeclaration = AmbientModuleDeclaration <$> commentPlaceholder <*> (reserved "module" *> sepBy identifier dot) <*> braces (many ambientDeclaration) -ambientExternalModuleDeclaration = AmbientExternalModuleDeclaration <$> commentPlaceholder <*> (reserved "module" *> stringLiteral) <*> braces (many ambientDeclaration)+ambientExternalModuleDeclaration = AmbientExternalModuleDeclaration <$> commentPlaceholder <*> (reserved "module" *> stringLiteral) <*> braces (many ambientExternalModuleElement)++ambientExternalModuleElement = choice (map try+  [ AmbientModuleElement <$> ambientDeclaration+  , exportAssignment+  , externalImportDeclaration ])++exportAssignment = ExportAssignment <$> (reserved "export" *> lexeme (char '=') *> identifier <* semi)++externalImportDeclaration =+  AmbientModuleExternalImportDeclaration <$> optionMaybe exported+                                         <*> (reserved "import" *> identifier)+                                         <*> (lexeme (char '=') *> reserved "require" *> stringLiteral)  ambientClassBodyElement = (,) <$> commentPlaceholder <*> (choice $ map try   [ ambientConstructorDeclaration
src/Language/TypeScript/Types.hs view
@@ -52,7 +52,13 @@   | AmbientInterfaceDeclaration Interface   | AmbientEnumDeclaration CommentPlaceholder String [(String, Maybe Integer)]   | AmbientModuleDeclaration CommentPlaceholder [String] [Ambient]-  | AmbientExternalModuleDeclaration CommentPlaceholder String [Ambient]+  | AmbientExternalModuleDeclaration CommentPlaceholder String [AmbientExternalModuleElement]+  deriving (Show, Data, Typeable)++data AmbientExternalModuleElement+  = AmbientModuleElement Ambient+  | ExportAssignment String+  | AmbientModuleExternalImportDeclaration (Maybe Exported) String String   deriving (Show, Data, Typeable)  data TypeRef = TypeRef TypeName (Maybe [Type]) deriving (Show, Data, Typeable)