UNPKG

376 Btext/coffeescriptView Raw
1
2fs = require 'fs'
3
4class File
5
6 constructor: ( @filename ) ->
7
8 @read() and @parse() and @tokenize()
9
10 read: () =>
11
12 @source = fs.readFileSync( @filename ).toString 'utf8'
13
14 parse: () =>
15
16 @lines = @source.split /\n/
17
18 tokenize: () =>
19
20 @tokens = @lines.map (line) ->
21 line.split(/[,\{\}\(\)\t ]+/).filter (p) -> p and p.length
22
23module.exports = File
\No newline at end of file