Package org.mozilla.javascript

Examples of org.mozilla.javascript.Node


   *
   * @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

   */
  @Override
  protected List<String> retrieveDependencyArguments(Node node) {
    List<String> singleDependencyList = new ArrayList<String>();
   
    Node propertyResolution = node.getFirstChild();
   
    if (propertyResolution != null) {     
      String firstArg = getFnCallArgumentStr(propertyResolution, 0);
      if (firstArg != null) {
        singleDependencyList.add(firstArg);
View Full Code Here

   *
   * @param functionCall - Function call reference
   * @return Function call from main dojo object reference.
   */
  protected boolean isDojoObjectRef (Node functionCall) {
    Node propertyLookup = functionCall.getFirstChild();
   
    if (propertyLookup != null &&
      propertyLookup.getType() == Token.GETPROP
      && propertyLookup.getFirstChild().getType() == Token.NAME) {
        String functionName = propertyLookup.getFirstChild().getString();
        if (DOJO_OBJ_REF.equals(functionName)) {
          return true;
      }
    }
   
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.Node

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.