Package org.cfeclipse.cfml.parser

Examples of org.cfeclipse.cfml.parser.CFNodeList


      }
      } else {
      try {
        if (state.getIDocument().getPartition(state.getOffset()).getType().equals(CFPartitionScanner.CF_SCRIPT)) {
          CFDocument doc = ((ICFDocument) state.getIDocument()).getCFDocument();
          CFNodeList funknodes = doc.getDocumentRoot().selectNodes(
              "//ASTFunctionDeclaration[#startpos<" + state.getOffset() + "]");
          if (funknodes.size() > 0) {
            FunctionInfo funknode = (FunctionInfo) funknodes.get(funknodes.size() - 1);
            Function func = doc.getFunctionByName(funknode.getFunctionName());
            if (func != null) {
              params = func.getParameters();
              return prepareProposals(state, params);
            } else {
View Full Code Here


    if(doc == null) {
      return null;
    }
   
    try {
      CFNodeList matchingNodes = doc.getDocumentRoot().selectNodes(
        "//cffunction"
      );
      int lineFound = 0;

      Iterator i = matchingNodes.iterator();
      while (i.hasNext()) {
        DocItem node = (DocItem) i.next();
        if (node instanceof CfmlTagItem) {
          CfmlTagItem currItem = (CfmlTagItem) node;
          if (lineFound == 0 ||
View Full Code Here

   
    private void expand(TagItem function)
    {
        this.clearChildren();
       
        CFNodeList args = function.selectNodes("//cfargument");
        Iterator argiter = args.iterator();
        while (argiter.hasNext())
        {
            CfmlTagItem argTag = (CfmlTagItem) argiter.next();
            ArgumentNode argNode = new ArgumentNode(argTag);
            argNode.setParent(this);
View Full Code Here

     * @param element The element that (should be) the CFScript function
     * @return The formatted name of the funciton + parameters
     */
    private String getCFScriptFunctionName(Object element) {
        ASTFunctionDeclaration function = (ASTFunctionDeclaration)element;
        CFNodeList children = function.getChildNodes();
        StringBuffer nameBuffer = new StringBuffer();
       
        if(children.size() > 0)
        {
            DocItem firstChild = (DocItem)children.get(0);
            if(firstChild instanceof ASTParameterList)
            {
                CFNodeList params = ((ASTParameterList)firstChild).getChildNodes();
                Iterator paramIter = params.iterator();
                while(paramIter.hasNext())
                {
                    Object currentParam = paramIter.next();
                    if(!(currentParam instanceof ASTId))
                    {
View Full Code Here

      System.out.println("CodeFoldingSetter::foldTags got a null from doc.getCFDocument().");
      return;
    }
    // nodes =
    // rootItem.selectNodes("//function[#startpos>=0 and #endpos < 200]");
    CFNodeList nodes = rootItem.selectNodes("//" + tagName.toLowerCase());

    Iterator it = nodes.iterator();
    while (it.hasNext()) {
      Object o = it.next();
      if (o instanceof CfmlTagItem && ((CfmlTagItem) o).matchingItem != null) {
        CfmlTagItem tag = (CfmlTagItem) o;
View Full Code Here

    }
  /***** Added by Oliver Tupman ******/
  public SimpleNode(SPLParser p, int id) {
  }
    public CFNodeList getChildNodes() {
        CFNodeList list = new CFNodeList();
        if(children != null){         
        for(int childIndex = 0; childIndex < this.children.length; childIndex++)
        {
          list.add(this.children[childIndex]);
        }
        }
       
        return list;
    }
View Full Code Here

    if(docRoot == null) {
      return null;
    }

    try {
      CFNodeList matchingNodes = docRoot.getDocumentRoot().selectNodes(
        "//*" + attrString
        ,includeClosingTags
      );
     
      //there should only be 0 or 1 nodes in any one position (unless it spans
      //more then one tag I suppose
      if(matchingNodes.size() > 0)
      {
        DocItem node = (DocItem)matchingNodes.get(0);
        if (node instanceof CfmlTagItem) {         
          return (CfmlTagItem)node;
        } else {
          // probably a comment, but we could use this for udder stuff too?
          return node;
View Full Code Here

        CFParser parser = new CFParser();
        CFDocument doc = parser.parseDoc(inputString);

        // Now we just want to add the nodes!
        DocItem docroot = doc.getDocumentRoot();
        CFNodeList nodes;
        nodes = docroot.selectNodes("//cffunction");
        Iterator iter = nodes.iterator();
        while (iter.hasNext())
        {
            TagItem thisTag = (TagItem) iter.next();
            FunctionNode funcnode = new FunctionNode(thisTag);
            funcnode.setParent(this);
View Full Code Here

    CFDocument doc = ((ICFDocument) state.getIDocument()).getCFDocument();
    return getCFCName(variableName, doc);
  }

  public static String getCFCName(String variableName, CFDocument doc) {
    CFNodeList nodelist = doc.getDocumentRoot().getChildNodes();
    String cfcName = null;

    Iterator iter = nodelist.iterator();

    while (iter.hasNext()) {
      Object cfItem = iter.next();

      if (cfItem instanceof CfmlComment) {
        CfmlComment comment = (CfmlComment) cfItem;
        String commentText = ((CfmlComment) cfItem).getItemData();

        // Now get the type from the comment text         
        Pattern p = Pattern.compile(cfmlVarRE);
        Matcher m = p.matcher(commentText);

        if (m.find() && m.group(1).equalsIgnoreCase(variableName)) {
          cfcName = m.group(2);
          break;
        }
      } else if (cfItem instanceof CfmlTagItem) {
        CfmlTagItem cfsetTag = (CfmlTagItem) cfItem;
        if (!((CfmlTagItem) cfItem).getName().equalsIgnoreCase("cfset")) {
          continue;
        }
        String tagText = ((CfmlTagItem) cfItem).getItemData();
        Map<String, String> varMap = parseCfSetText(tagText);
        if (varMap == null) {
          continue;
        } else {
          if (varMap.get("variableName").equalsIgnoreCase(variableName)) {
            cfcName = varMap.get("variableType");
            break;
          }
        }
      }
    }
    CFNodeList scriptNodes = doc.getDocumentRoot().selectNodes("//ASTAssignment");
    Iterator i = scriptNodes.iterator();
    while (i.hasNext()) {
      ScriptItem assignment = (ScriptItem) i.next();
      if (assignment.getFirstChild().getItemData().equals(variableName)) {
        return assignment.getLastChild().getItemData().replaceAll("\\(.*", "");
      }
    }
    scriptNodes = doc.getDocumentRoot().selectNodes("//ASTVarDeclaration");
    i = scriptNodes.iterator();
    while (i.hasNext()) {
      ScriptItem assignment = (ScriptItem) i.next();
      Iterator id = assignment.selectNodes("//ASTIdentifier").iterator();
      while (id.hasNext()) {
        ScriptItem identifier = (ScriptItem) id.next();
View Full Code Here

          CFDocument doc = parser.parseDoc(cfdocument.get());

          // Now we just want to add the nodes!
          DocItem docroot = doc.getDocumentRoot();
         
          CFNodeList compNodes = docroot.selectNodes("/cfcomponent");
         
          CFNodeList nodes = docroot.selectNodes("//cffunction");
     
         Iterator funcIter =  nodes.iterator();
         while(funcIter.hasNext()){
              TagItem thisFunction = (TagItem)funcIter.next();

              System.out.println("function " + thisFunction.getAttributeValue("name"));
         }
View Full Code Here

TOP

Related Classes of org.cfeclipse.cfml.parser.CFNodeList

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.