medikoo/i18n2 — pull request #1 by kamsi (2014-08-08 10:29:35+00:00)
Title: Messages source code parser

We should parse code with [esniff](https://github.com/medikoo/esniff#esniff).

I think it may make sense to create `parse` directory, and create following scripts:

1. `parse/source`, it'll assume it'll receive content of one file, and return following map:
```javascript
{
context: 'fooContext',
messages: {
"Normal message": [{ point: 17, column: 17, line: 2 }, { point: 37, column: 17, line: 4 }],
"n\0One Apple\0Many apples": [{ point: 17, column: 17, line: 2 }]
}
}
```
2. `parse/paths`, it should work similarly to how xlint behaves, but with no fancy things like streaming and watching. Technically behind a scenes, on each path it receives, it should run [fs2/readdir](https://github.com/medikoo/fs2/#readdirpath-options-cb-fs2readdir) with following (overridable) options:
`{ depth: Infinity, type: { file: true }, pattern: /\.js$/, ignoreRules: 'git' }`
Behind the scenes it should rely on `parse/source`

It should return following map:
```javascript
{
"Normal message": {
fooContext: [{ fileName: '/path/to/filename/foo.js', point: 17, column: 17, line: 2 },
{ filename: '/path/to/filename/foo.js', point: 37, column: 17, line: 4 }],
default: [{ fileName: '/path/to/filename/bar.js', point: 17, column: 17, line: 2 }]
}
"n\0One Apple\0Many apples": {
fooContext: [{ fileName: '/path/to/filename/foo.js', point: 17, column: 17, line: 2 },
{ filename: '/path/to/filename/foo.js', point: 37, column: 17, line: 4 }],
default: [{ fileName: '/path/to/filename/bar.js', point: 17, column: 17, line: 2 }]
}
}
```