Yeah I pretty much figured that. What I can't figure out is if a d.ts definition is actually TS or some sub type that has special rules. I looked through the TS parser and compiler code and didn't see anything specific to a d.ts file so I am assuming it's TS.
The problem here is two fold, one trying to create a scanner for TS and two the language is still greek to me as far as quickly understanding how to map a d.ts "AST" to actionscript. As I said early, forking the TS compiler and then emitting as from it was a first consideration but looking at the code, that ain't going to happen. :) So in the end it's write an antlr grammar(not going to happen), create a tokenizer by hand that uses characters and state transitions or using some type of regexp to scan things as you parse each line thus putting the scanner in states to save some type of simple AST that we can then walk/visit and emit actionscript. First the as spec for "d.as" files needs to be documented, then the tool can be thought about. We need to think about exactly what and how this stuff translates back to javascript during compilation (from the SWC definition). Mike On Mon, Jun 1, 2015 at 12:44 AM, Alex Harui <aha...@adobe.com> wrote: > > > On 5/31/15, 6:02 PM, "OmPrakash Muppirala" <bigosma...@gmail.com> wrote: > > >On May 31, 2015 9:41 AM, "Michael Schmalle" <teotigraphix...@gmail.com> > >wrote: > >> > >> Now, I wish I had an answer of how to create a d.ts parser without using > >> 100's of dev time hours. :) > > Mike, have you checked out Microsoft’s TypeScript compiler? It seems to > be on GitHub at [1]. > I’d guess that [2] is their parser/scanner. It looks like the scanning is > done in TS itself which is probably why you couldn’t find a grammar. > > -Alex > > [1] https://github.com/Microsoft/TypeScript > [2] > https://github.com/Microsoft/TypeScript/blob/270a149571b106dcfbbaee53897074 > 61e8fedcb9/src/compiler/scanner.ts > >