lib/ometa/ometa/ometa.js
function cached(grammar_file) {
  var fs      = require('fs'),
      path    = require('path'),
      change  = fs.statSync(grammar_file).mtime.valueOf(),
      cache   = [cache_path,'/', path.basename(grammar_file), '.', change, '.js'].join('');

  if(!fs.existsSync(cache_path))
    fs.mkdirSync(cache_path);

  if(fs.existsSync(cache))
    return fs.readFileSync(cache, 'utf8');

  var result = load(grammar_file);
  fs.writeFileSync(cache, result);
  return result;
}
function cached(grammar_file) {
  var fs      = require('fs'),
      path    = require('path'),
      change  = fs.statSync(grammar_file).mtime.valueOf(),
      cache   = [cache_path,'/', path.basename(grammar_file), '.', change, '.js'].join('');

  if(!fs.existsSync(cache_path))
    fs.mkdirSync(cache_path);

  if(fs.existsSync(cache))
    return fs.readFileSync(cache, 'utf8');

  var result = load(grammar_file);
  fs.writeFileSync(cache, result);
  return result;
}
function cached ( grammar_file ) { var fs = require ( 'fs' ) , path = require ( 'path' ) , change = fs . statSync ( grammar_file ) . mtime . valueOf ( ) , cache = [ cache_path , '/' , path . basename ( grammar_file ) , '.' , change , '.js' ] . join ( '' ) ; if ( ! fs . existsSync ( cache_path ) ) fs . mkdirSync ( cache_path ) ; if ( fs . existsSync ( cache ) ) return fs . readFileSync ( cache , 'utf8' ) ; var result = load ( grammar_file ) ; fs . writeFileSync ( cache , result ) ; return result ; }
Internal function to cache grammars. Creates a `.cache` directory in the current
working path.
Internal function to cache grammars . Creates a . cache directory in the current working path .