Package org.mozilla.javascript

Examples of org.mozilla.javascript.Node$Target


   * Update internal literal member list with
   * current values by traversing child nodes of literal declaration.
   */
  protected void parseArrayPropertyValues() {
    arrayPropertyValues = new ArrayList<Object>();   
    Node arrayItem = literalNode.getFirstChild();
   
    while(arrayItem != null) {
      arrayPropertyValues.add(extractPropertyValue(arrayItem));     
      arrayItem = arrayItem.getNext();
    }     
  }
View Full Code Here


    List<String> keys = getKeys();

    int index = keys.indexOf(key);

    if (index != -1) {
      Node propertyValue = literalNode.getFirstChild();
      while (index > 0) {
        propertyValue = propertyValue.getNext()
        index--;
      }
      literalValues.put(key, extractPropertyValue(propertyValue));
    }               
  } 
View Full Code Here

   *
   * @param node - AST node
   * @return AST node is global configuration declaration
   */
  protected boolean isGlobalDefinition(Node node) {
    Node globalNameReference = node.getFirstChild();
   
    if (globalNameReference != null && Token.SETNAME == globalNameReference.getType()) {
      String label = getStringNodeLabel(globalNameReference.getFirstChild());             
      if (matchesLoaderConfigName(label)) {
        addConfigurationLiteral(node, globalNameReference.getLastChild());
        return true;
      }
    }
   
    return false;
View Full Code Here

   *
   * @param node - AST node
   * @return AST node is local configuration declaration
   */
  protected boolean isLocalDefinition(Node node) {
    Node localNameReference = node.getFirstChild();
   
    if (localNameReference != null && Token.NAME == localNameReference.getType()) {
      String label = getStringNodeLabel(localNameReference);             
      if (matchesLoaderConfigName(label)) {
        addConfigurationLiteral(node, localNameReference.getLastChild());
        return true;
      }
    }
   
    return false;
View Full Code Here

   * @param argIndex - Argument index to access
   * @return String argument value, null if not available or not a string.
   */
  protected String getFnCallArgumentStr(Node fnCallNode, int argIndex) {
    String fnCallArg = null;
    Node argument = getFnCallArgument(fnCallNode, argIndex);
   
    if (argument != null) {
      fnCallArg = getStringNodeLabel(argument);       
    }
   
View Full Code Here

   * @param fnCallNode - AST nodes containing function arguments
   * @param argIndex - Argument index to retrieve
   * @return Argument node, null if not found
   */
  protected Node getFnCallArgument(Node fnCallNode, int argIndex) {
    Node argument = fnCallNode.getNext();
    while (argument != null && argIndex > 0) {
      argument = argument.getNext();
      argIndex--;
    };   
   
    return argument;
  }
View Full Code Here

   * @param propertyLookup - Function reference to search
   * @return Function property name, null if value not found or not a string.
   */
  protected String getFunctionPropertyName(Node propertyLookup) {
    String propertyName = null;   
    Node objectReference = propertyLookup.getFirstChild();
   
    if (objectReference != null) {
      propertyName = getStringNodeLabel(objectReference.getNext());
    }
   
    return propertyName;
  }
View Full Code Here

   * @param node - Parent node
   * @return Available string labels for child nodes
   */
  protected List<String> getNodeStringChildren(Node node) {
    List<String> childStrings = new ArrayList<String>();
    Node child = node.getFirstChild();
   
    while (child != null) {     
      String nodeLabel = getStringNodeLabel(child);
      if (nodeLabel != null) {
        childStrings.add(nodeLabel);
      }
      child = child.getNext();
    };   
   
    return childStrings;
  }
View Full Code Here

   * @return All dependency arguments discovered or an empty list
   */
  protected List<String> retrieveRequireDependencyArguments(Node node) {
    List<String> dependencyArguments = new ArrayList<String>();
   
    Node firstFnArgument = getFnCallArgument(node.getFirstChild(), 0);
   
    if (firstFnArgument != null) {
      switch (firstFnArgument.getType()) {
        case Token.STRING:
          dependencyArguments.add(firstFnArgument.getString());
          break;
        case Token.ARRAYLIT:               
          dependencyArguments.addAll(getNodeStringChildren(firstFnArgument));
          break;
        case Token.OBJECTLIT:
          if (firstFnArgument.getNext() != null) {
            dependencyArguments.addAll(getNodeStringChildren(firstFnArgument.getNext()));
          }
        default:
          break;
      }
    }
View Full Code Here

   * @return All dependency arguments discovered or an empty list
   */
  protected List<String> retrieveDefineDependencyArguments (Node node) {
    List<String> dependencyArguments = new ArrayList<String>();
   
    Node firstFnArgument = getFnCallArgument(node.getFirstChild(), 0);
   
    if (firstFnArgument != null) {
      switch (firstFnArgument.getType()) {
        case Token.STRING:
          dependencyArguments.addAll(getNodeStringChildren(firstFnArgument.getNext()));
          break;
        case Token.ARRAYLIT:               
          dependencyArguments.addAll(getNodeStringChildren(firstFnArgument));
          break;
        default:
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.Node$Target

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.