Class for a directive information bundle
@param filename
@param directiveArguments
@constructor
425636
function Directive(filename, directiveArguments) {
  this.filename = filename;
  this.name = directiveArguments[0].value;
  var directiveConfiguration = directiveArguments[1];
  // Extract the last attribute of the array
  if (directiveConfiguration.type === 'ArrayExpression' && directiveConfiguration.elements.length) {
    directiveConfiguration = directiveConfiguration.elements[directiveConfiguration.elements.length - 1];
  }
  // Parse the function
  if (directiveConfiguration && directiveConfiguration.type === 'FunctionExpression') {
    directiveConfiguration = esprimaHelper.getFirstReturnStatement(directiveConfiguration);
  }
  // Get the returnStatement
  if (directiveConfiguration && directiveConfiguration.type === 'ReturnStatement') {
    directiveConfiguration = directiveConfiguration.argument;
  }
  // Parse the object
  if (directiveConfiguration && directiveConfiguration.type === 'ObjectExpression') {
    var properties = esprimaHelper.parseObjectExpressions(directiveConfiguration);
    this.replace = !!properties.replace;
    this.transclude = !!properties.transclude;
    this.template = properties.template;
    this.templateUrl = properties.templateUrl;
    if (properties.restrict) {
      this.restrict = {
        A: properties.restrict.toUpperCase().indexOf('A') >= 0,
        E: properties.restrict.toUpperCase().indexOf('E') >= 0,
        C: properties.restrict.toUpperCase().indexOf('C') >= 0
      };
    }
  }
  // Add parse warning
  if (!this.restrict) {
    module.exports.logger('no restriction set for', this.filename, this.name);
    this.restrict = {
      A: true,
      E: false,
      C: false
    };
  }
}
977476
private void setDirectiveList(String directives) {
        String[] directiveList = directives.replaceAll("\\s", EMPTY_STRING_VALUE).split(",");
        for (String entry : directiveList) {
            String[] nameValueArray = entry.split("=");
            String directiveName = nameValueArray[0];
            if (checkDirective(directiveName)) {
                if (nameValueArray.length > 1) {
                    parseDirectiveWithValue(directiveName, nameValueArray[1]);
                    continue;
                }
                this.directives.put(Directive.get(directiveName), EMPTY_STRING_VALUE);
            }
        }
    }
1241810
@Override
    public void processArguments(String[] args) throws IOException {
        List<File> classFiles = new ArrayList<File>();
        List<File> jarFiles = new ArrayList<File>();
        String[] fileArgs = null;

        for (int i = 0; i < args.length; i++) {
            if (args[i].equalsIgnoreCase("--debug") || args[i].equals("-d")) {
                setDebug(true);
            } else if (args[i].equalsIgnoreCase("--config")) {
                // TODO: Handle config file parsing
                File configFile = new File(args[++i]);
                System.out.println("Config file not currently supported" + configFile);
            } else if (args[i].equalsIgnoreCase("--ffdc")) {
                addFfdc = true;
            } else if (args[i].equalsIgnoreCase("--static")) {
                injectStatic = true;
            } else if (args[i].equalsIgnoreCase("--liberty")) {
                defaultTraceType = TraceType.LIBERTY;
            } else if (args[i].equalsIgnoreCase("--tr")) {
                defaultTraceType = TraceType.TR;
            } else if (args[i].equalsIgnoreCase("--java-logging")) {
                defaultTraceType = TraceType.JAVA_LOGGING;
            } else {
                fileArgs = new String[args.length - i];
                System.arraycopy(args, i, fileArgs, 0, fileArgs.length);
                break;
            }
        }

        if (fileArgs == null || fileArgs.length == 0) {
            throw new IllegalArgumentException("No file specified");
        }

        // Add jar files, zip files, and class files to the appropriate collections
        for (int i = 0; i < fileArgs.length; i++) {
            File f = new File(fileArgs[i]);
            if (!f.exists()) {
                throw new IllegalArgumentException("File \"" + f + "\" does not exist");
            } else if (f.isDirectory()) {
                classFiles.addAll(getClassFiles(f, null));
                jarFiles.addAll(getJarFiles(f, null));
            } else if (f.getName().endsWith(".class")) {
                classFiles.add(f);
            } else if (f.getName().endsWith(".jar")) {
                jarFiles.add(f);
            } else if (f.getName().endsWith(".zip")) {
                jarFiles.add(f);
            } else {
                System.err.println(f + " is an unexpected file type; ignoring");
            }
        }

        setClassFiles(classFiles);
        setJarFiles(jarFiles);
    }
450252
public Engine addDirective(String directiveName, Class<? extends Directive> directiveClass) {
		config.addDirective(directiveName, directiveClass);
		return this;
	}
251660
public static void copyDirective(HashMap<String, String> directives,
            StringBuilder sb, String directive) {
        String directiveValue = directives.get(directive);
        if (directiveValue != null) {
            sb.append(directive).append(" = \"").append(directiveValue).append(
                    "\", ");
        }
    }
763846
function (arg) {
            var out = arg.out;
            var statement = arg.statement;

            // Add dependencies specified explicitly in the template declaration
            this._processDependencies(out);

            this._createBlocks(out);
            this._processInheritance(out);
            this._processScript(out);

            out.enterBlock("main");
            out.writeln("var Aria = require('ariatemplates/Aria');");
            out.leaveBlock();

            out.enterBlock("classDefinition");
            this._writeClassDefHeaders(out);
            this._writeConstructor(out);
            this._writeDestructor(out);
            out.leaveBlock();

            // main part of the processing (process the whole template):
            out.processContent(statement.content);

            if (out.errors) {
                out.$dispose();
                this.$callback(out.callback, {
                    classDef : null,
                    errors : out.errors
                });
                // in case of synchronous call, the following line prevents a second call of the callback
                // to report the error
                out.errors = false;
                return;
            }

            out.enterBlock("prototype");
            this._writeClassInit(out);
            this._writeInitTemplate(out);
            out.leaveBlock();

            out.enterBlock("classDefinition");
            this._writeDependencies(out);
            this._writeClassDefEnd(out);
            out.leaveBlock();

            out.enterBlock("main");
            out.writeDependencies();
            out.write(out.getBlockContent("classDefinition"));
            out.leaveBlock();

            out.tree.properties = {
                macros: out.macros,
                views: out.views,
                wlibs: out.wlibs
            };
            var res = null;
            res = out.getBlockContent("main");
            out.$dispose();
            this.$callback(out.callback, {
                classDef : res,
                logicalPath : Aria.getLogicalPath(out.templateParam.$classpath, Aria.ACCEPTED_TYPES[this._classType]),
                tree : out.tree,
                debug : out.debug
            });
        }
77776
function define (File, utils) {
  const { callable } = utils;
  const { debug, error, strong } = utils.cnsl;
  const { regexpEscape, uniqueMatch } = utils.string;

  return class NUNJUCKSFile extends File {
    /**
     * Constructor
     * @param {String} id
     * @param {String} filepath
     * @param {Object} options
     *  - {Object} caches
     *  - {Object} fileExtensions
     *  - {Function} fileFactory
     *  - {Object} globalAliases
     *  - {Array} npmModulepaths
     *  - {Object} pluginOptions
     *  - {Object} runtimeOptions
     */
    constructor (id, filepath, options) {
      super(id, filepath, options);

      this.workflows.writeable = WORKFLOW_WRITEABLE;
    }

    /**
     * Parse file contents for dependency references
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    parse (buildOptions, fn) {
      super.parse(buildOptions, (err) => {
        if (err) return fn(err);

        // Find sidecar json file
        const sidecarData = super.parseSidecarDependency();
        // Parse includes
        let matches = uniqueMatch(this.content, RE_INCLUDE)
          .map((match) => {
            match.id = match.match;
            match.isInclude = true;
            return match;
          });

        // Parse imports
        matches.push(...uniqueMatch(this.content, RE_IMPORT)
          .map((match) => {
            match.id = match.match;
            match.isImport = true;
            return match;
          }));
        if (sidecarData) matches.push(sidecarData);

        super.addDependencies(matches, buildOptions);
        fn();
      });
    }

    /**
     * Replace relative dependency references with fully resolved
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    replaceReferences (buildOptions, fn) {
      [...this.getAllDependencies(), this].forEach((file) => {
        if (file instanceof NUNJUCKSFile && this.dependencyReferences.length) {
          let content = file.content;

          file.dependencyReferences.forEach((reference) => {
            if (reference.file && reference.isImport) {
              const context = reference.context.replace(reference.id, reference.file.filepath);

              // Create new RegExp so that flags work properly
              content = content.replace(new RegExp(regexpEscape(reference.context), 'g'), context);
            }
          });

          file.setContent(content);
        }
      });
      fn();
    }

    /**
     * Inline css/img/js dependency content
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    inlineInlineable (buildOptions, fn) {
      // Only dependencies
      parallel([...this.getAllDependencies()].reduce((inlineable, file) => {
        if (file instanceof NUNJUCKSFile && this.dependencyReferences.length) {
          inlineable.push(callable(file, 'inline', buildOptions));
        }
        return inlineable;
      }, []), fn);
    }

    /**
     * Inline included content
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    inlineIncludes (buildOptions, fn) {
      [...this.getAllDependencies(), this].forEach((file) => {
        if (file instanceof NUNJUCKSFile && file.dependencyReferences.length) {
          let content = file.content;

          file.dependencyReferences.forEach((reference) => {
            if (reference.file && reference.context && reference.isInclude) {
              content = content.replace(new RegExp(regexpEscape(reference.context), 'g'), reference.file.content);
            }
          });

          file.setContent(content);
        }
      });
      fn();
    }

    /**
     * Compile file contents
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    compile (buildOptions, fn) {
      const options = Object.assign({}, DEFAULT_OPTIONS, this.options.pluginOptions.nunjucks);

      nunjucks.configure(null, options);
      nunjucks.renderString(this.content, this.findSidecarDependency(), (err, content) => {
        if (err) {
          if (!this.options.runtimeOptions.watch) return fn(err);
          error(err, 4, false);
        }
        this.setContent(content);
        debug(`compile: ${strong(this.relpath)}`, 4);
        fn();
      });
    }

    /**
     * Reparse file contents for dependency references
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    reparse (buildOptions, fn) {
      this.allDependencies = null;
      this.allDependencyReferences = null;
      this.dependencies = [];
      this.dependencyReferences = [];

      super.parse(buildOptions, fn);
    }
  };
}
795272
def add_file_arg(self, filename):
    
    self.__arguments.append(filename)
    if filename not in self.__input_files:
      self.__input_files.append(filename)
140180
function (destdir, srcdir, srcfile, defines, txt) {
            /*  expand variables  */
            if (options.expandDefines) {
                txt = txt.replace(options.directiveSyntax.expand,
                    function (directive, name) {

                    /*  skip special case  */
                    if (name === "include")
                        return directive;

                    /*  resolve variable  */
                    var txt = defines[name];
                    if (typeof txt === "undefined") {
                        if (options.onUndefinedVariable === "keep")
                            txt = directive;
                        else if (options.onUndefinedVariable === "empty")
                            txt = "";
                        else /* if (options.onUndefinedVariable === "error") */
                            throw "Variable \"" + name + "\" not defined.";
                    }
                    return txt;
                });
            }

            /*  expand includes  */
            if (options.expandIncludes) {
                txt = txt.replace(options.directiveSyntax.include,
                    function (directive, prolog, _q, file, definitions, epilog) {

                    /*  resolve possibly existing escapes  */
                    file = file.replace(new RegExp("\\\\" + _q, "g"), _q);

                    /*  process file  */
                    if (!grunt.file.isPathAbsolute(file))
                        file = path.resolve(path.join(srcdir, file));
                    if (!grunt.file.exists(file))
                        throw "Include file \"" + file + "\" not found.";
                    var include_dir = path.dirname(file);
                    var include_file = path.basename(file);
                    var txt = grunt.file.read(file);

                    /*  optionally strip header comment of includes  */
                    if (options.stripHeaderOfInclude)
                        txt = txt.replace(options.directiveSyntax.header, "");

                    /*  process defines  */
                    var include_defines = defines;
                    if (typeof definitions !== "undefined" && definitions !== "") {
                        definitions.replace(options.directiveSyntax.define,
                            function (define, _q1, name, _q2, value) {
                            /*  resolve possibly existing escapes  */
                            if (typeof _q1 !== "undefined" && _q1 !== "")
                                value = value.replace(new RegExp("\\\\" + _q1, "g"), _q1);
                            value = value.replace(new RegExp("\\\\" + _q2, "g"), _q2);

                            /*  store definition  */
                            include_defines[name] = value;
                        });
                    }

                    /*  expand included text (RECURSION!)  */
                    txt = expandText(
                        destdir,
                        include_dir,
                        include_file,
                        include_defines,
                        txt
                    );

                    /*  post whitespace processing  */
                    if (options.repeatWhitespaceProlog)
                        txt = txt.replace(/^(?=.)/mg, prolog);
                    if (options.keepWhitespaceProlog)
                        txt = prolog + txt;
                    if (options.keepWhitespaceEpilog)
                        txt = txt + epilog;
                    return txt;
                });
            }

            /*  adjust references  */
            if (options.adjustReferences) {
                txt = txt.replace(options.directiveSyntax.adjust,
                    function (directive, prolog, _q, ref, epilog) {

                    /*  resolve possibly existing escapes  */
                    ref = ref.replace(new RegExp("\\\\" + _q, "g"), _q);

                    /*  only adjust references which can be resolved on the filesystem  */
                    var file = path.join(srcdir, ref);
                    if (grunt.file.exists(file)) {
                        /*  adjust path from source to destination anchor  */
                        var ref_new = path.normalize(path.join(path.relative(destdir, srcdir), ref));

                        /*  ensure that the reference is still correct based on the destination  */
                        file = path.join(destdir, ref_new);
                        if (!grunt.file.exists(file))
                            throw "Adjusted referenced file \"" + ref_new + "\" not found " +
                                "(from destination directory \"" + destdir + "\").";

                        /*  provide adjusted directive  */
                        directive = prolog + ref_new + epilog;
                    }

                    return directive;
                });
            }

            return txt;
        }
386854
private void addAuxClassPathEntries(String argument) {
        StringTokenizer tok = new StringTokenizer(argument, File.pathSeparator);
        while (tok.hasMoreTokens()) {
            project.addAuxClasspathEntry(tok.nextToken());
        }
    }
686360
function compile(filename) {
  var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

  var result;

  opts.filename = filename;

  var optsManager = new _transformationFileOptionsOptionManager2["default"]();
  optsManager.mergeOptions(transformOpts);
  opts = optsManager.init(opts);

  var cacheKey = JSON.stringify(opts) + ":" + babel.version;

  var env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env) cacheKey += ":" + env;

  if (cache) {
    var cached = cache[cacheKey];
    if (cached && cached.mtime === mtime(filename)) {
      result = cached;
    }
  }

  if (!result) {
    result = babel.transformFileSync(filename, _lodashObjectExtend2["default"](opts, {
      sourceMap: "both",
      ast: false
    }));
  }

  if (cache) {
    result.mtime = mtime(filename);
    cache[cacheKey] = result;
  }

  maps[filename] = result.map;

  return result.code;
}
241894
function resolveIncludeDirectives(text, fileItem) {
	var result = [];

	// parse source code with esprima
	try {
		var srcParsed = esprima.parse(text);
	} catch (e) {
		logger.error(buildErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', fileItem.filePath, e));
		throw buildShortErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', path.basename(fileItem.filePath), e)
	}

	// iterating over and looking for include directives
	for (var key in srcParsed.body) {
		var item = srcParsed.body[key];

		// resolve include directive from dom item
		var includeDirective = resolveIncludeDirectiveDom(item);
		if (includeDirective != null) {
			result.push(includeDirective);
		}
	}

	return result;
}
123529
function initCustomPointerTypemaps(typemapsdir) {
  return fs.readdirAsync(typemapsdir).then(function(dirs) {
    return Promise.all(_.map(dirs, function(dir) {
      // get all js*.i directives from class-specific subdirectories, to be parsed below for %typemaps directives
      return fs.readdirAsync(typemapsdir + '/' + dir).then(function(files) {
        var directive = _.find(files, function(fn) {
          return ((path.extname(fn) == '.i') && (path.basename(fn).search(/^js/) != -1));
        });
        var data = {};
        if (directive) {
          data[dir] = typemapsdir + '/' + dir + '/' + directive;
        }
        return data;
      }).catch(function(e) {
        // get all .i directives from top level directory, and parse for %array_class directives
        if (e.code == 'ENOTDIR') {
          var fn = dir;
          if (path.extname(fn) == '.i') {
            return fs.readFileAsync(typemapsdir + '/' + fn, 'utf8').then(function(directives) {
              var arraytypes = _.filter(directives.split(/\n/), function(line) {
                return (line.search(/^%array_class/) != -1);
              });
              _.each(arraytypes, function(arraytype) {
                var parsed = arraytype.match(/%array_class\(([A-Za-z0-9_]+)[\s]*,[\s]*([A-Za-z0-9_]+)\)/);
                if (parsed) {
                  var from = parsed[1];
                  var to = parsed[2];
                  xml2js.ARRAY_TYPEMAPS[from] = { arrayType: to, classes: [] };
                } else {
                  console.log('Incorrectly parsed array_class from ' + fn + ': ' + arraytype);
                }
              });
            });
          }
        } else {
          throw e;
        }
      });
    }));
  }).then(function(__directivesFiles) {
    // parse for %typemaps & %pointer_functions directives
    var _directivesFiles = _.filter(__directivesFiles, function(data) { return !_.isEmpty(data); });
    var directivesFiles = _.object(_.map(_directivesFiles, _.keys), _.flatten(_.map(_directivesFiles, _.values)));
    return Promise.all(_.map(directivesFiles, function(directivesFn, className) {
      return fs.readFileAsync(directivesFn, 'utf8').then(function(directives) {
        var typemaps = _.filter(directives.split(/\n/), function(line) {
          return (line.search(/^%typemap/) != -1);
        });
        _.each(typemaps, function(typemap) {
          var parsed = typemap.match(/%typemap\((in|out)\)[\s]+([A-Za-z0-9_]+[\s]*[\*])/);
          if (parsed) {
            var dir = parsed[1]; // TODO: ignored for now
            var type = normalizePointer(parsed[2]);
            var datatype = getPointerDataType(type);
            if (_.has(xml2js.ARRAY_TYPEMAPS, datatype)) {
              xml2js.ARRAY_TYPEMAPS[datatype].classes.push(className);
            } else {
              console.log('Ignored typemap from ' + directivesFn + ': ' + typemap.replace('{', '') + ' (no %array_class directive found for ' + datatype + ')');
            }
          } else {
            console.log('Ignored typemap from ' + directivesFn + ': ' + typemap.replace('{', '') + ' (only considering in/out typemaps of pointer types)');
          }
        });
        var ptrfns = _.filter(directives.split(/\n/), function(line) {
          return (line.search(/^%pointer_functions/) != -1);
        });
        _.each(ptrfns, function(ptrfn) {
          var parsed = ptrfn.match(/%pointer_functions\(([A-Za-z0-9_]+)[\s]*,[\s]*([A-Za-z0-9_]+)\)/);
          if (parsed) {
            var from = parsed[1];
            var to = parsed[2];
            if (!_.has(xml2js.POINTER_TYPEMAPS, className)) {
              xml2js.POINTER_TYPEMAPS[className] = {};
            }
            xml2js.POINTER_TYPEMAPS[className][from] = to;
          }
        });
      });
    }));
  });
}
346418
function(varArgs) {
        for (var i = 0, m = arguments.length; i < m; i++) {
            this.addFile(arguments[i]);
        }
        return this;
    }
247975
function (moduleName, filepath, options) {
    var quoteChar = options.quoteChar;
    var indentString = options.indentString;
    var withModule = !options.singleModule;
    var content = getContent(filepath, options);
    var doubleIndent = indentString + indentString;
    var strict = (options.useStrict) ? indentString + quoteChar + 'use strict' + quoteChar + ';\n' : '';
    var compiled = '';

    if (withModule) {
      compiled += 'angular.module(' + quoteChar + moduleName +
        quoteChar + ', []).run([' + quoteChar + '$templateCache' + quoteChar + ', function($templateCache) {\n' + strict;
    }

    compiled += indentString + '$templateCache.put(' + quoteChar + moduleName + quoteChar +
      ',\n' + doubleIndent + quoteChar + content + quoteChar + ');';

    if (withModule) {
      compiled += '\n}]);\n';
    }

    return compiled;
  }
547694
def read_package_directives(dirname, filename)
      package = JSON.parse(File.read(filename), create_additions: false)

      case package['main']
      when String
        yield File.expand_path(package['main'], dirname)
      when nil
        yield File.expand_path('index.js', dirname)
      end

      yield File.expand_path(package['style'], dirname) if package['style']
    end
820993
function createArguments() {
  var cli = commandLineArgs([{
    name: 'file',
    alias: 'f',
    type: String,
    defaultValue: "",
    description: "Full path to the credentials file.",
    required: true
  }, {
    name: 'section',
    alias: 's',
    type: String,
    defaultValue: "default",
    description: "Title of the section that will be added to the .edgerc file."
  }, {
    name: 'path',
    alias: 'p',
    type: String,
    defaultValue: os.homedir() + "/.edgerc",
    description: "Full path to the .edgerc file."
  }, {
    name: 'help',
    alias: 'h',
    description: "Display help and usage information."
  }]);

  return cli;
}