Package org.cfeclipse.cfml.parser

Examples of org.cfeclipse.cfml.parser.CFDocument


     */
  public ICompletionProposal[] getTagProposals(IAssistState state) {

    Set<Parameter> params = null;
      if (state.getDataSoFar().toLowerCase().matches(".*?arguments\\.[\\w]*$")) {
      CFDocument doc = ((ICFDocument) state.getIDocument()).getCFDocument();
      // get a reference to the containing function
      CfmlTagItem cti = getPreviousFunctionTag(state);
      Function func = doc.getFunctionByName(cti.getAttributeValue("name"));
      if (func != null) {
        params =  func.getParameters();     
        return prepareProposals(state, params);
      } else {
        return null;
      }
      } 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 {
              return null;
View Full Code Here


   * @param includeClosingTags
   * @return
   */
  private CfmlTagItem getPreviousFunctionTag(IAssistState state) {

    CFDocument doc = ((ICFDocument) state.getIDocument()).getCFDocument();   
    CfmlTagItem closestItem = null;
   
    // there might be a parse error with the document itself, which nullifies this
    if(doc == null) {
      return null;
    }
   
    try {
      CFNodeList matchingNodes = doc.getDocumentRoot().selectNodes(
        "//cffunction"
      );
      int lineFound = 0;

      Iterator i = matchingNodes.iterator();
View Full Code Here

            }
        }
  }
   
    private void updateModelForInitialReconcile() {
        CFDocument model= getCFModel();
        if (model == null) {
            return;
        }

        fInitialReconcile= false;
View Full Code Here

 
    try {
      String invoker = viewer.getDocument().get(documentOffset-1,1);
      ICFDocument document = (ICFDocument) viewer.getDocument();
      CFDocument doc = document.getCFDocument();
      int start = document.getPartition(documentOffset).getOffset();
      String scanData =  document.get(start, documentOffset - start);
      scanData = scanData.replace('\n',' ')// Eliminate any non-character characters
      scanData = scanData.replace('\r',' ')// as this allows us to treat the buffer as
      scanData = scanData.replace('\t',' ')// one long string
      if (invoker.equals(" ")) {
              return null;
          }

      if (!",".equals(invoker)
&& !"(".equals(invoker) && !"<".equals(invoker) && !".".equals(invoker)) {
        String toBeMatched = extractPrefix(viewer,documentOffset).replaceAll("[\r\n\t]", " ").trim();
        Set allPoss = SyntaxDictionary.limitSet(doc.getFunctions(), toBeMatched);
        Set poss = SyntaxDictionary.limitSet(
            DictionaryManager.getDictionary(DictionaryToUse).getAllFunctions(),
            toBeMatched
          );
        Iterator it = poss.iterator();
View Full Code Here

     
      //TODO: Break this out into methods, the flow is maddening!
     
     
      CFParser parser = new CFParser();
        CFDocument cfdoc = parser.parseDoc(state.getIDocument().get());
      String prefix = extractPrefix(state.getIDocument(), state.getOffset());

        //Get the variables:
        HashMap varMap = cfdoc.getVariableMap();
        ICompletionProposal[] proposals = null;
        Set scopeProposals = null;
        //Get the scopes we are looking for
//      Get an initial set of possibilities.
        //These are set in VariablesParser so go check that out if your variable isnt found
View Full Code Here

    }
   
   
    public ICompletionProposal[] getPageVariables(IAssistState state, ICFDocument doc){
      CFParser parser = new CFParser();
        CFDocument cfdoc = parser.parseDoc(state.getIDocument().get());
        //Get the variables:
        HashMap varMap = cfdoc.getVariableMap();
        String prefix = extractPrefix(doc, state.getOffset());
        Set<CompletionProposal> proposals = new HashSet<CompletionProposal>();
        int relavance;
        Iterator keyIter = varMap.keySet().iterator();
        int propIter = 0;
View Full Code Here

    fEditor= editor;
  }

  private void internalReconcile() {
    try {
            CFDocument model= fEditor.getCFModel();
      if (model instanceof CFDocument) {
        ((CFDocument)model).reconcile();
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

    if(docParser != null)
    {
        IPreferenceStore prefStore = CFMLPlugin.getDefault().getPreferenceStore();
      docParser.setCFScriptParsing(prefStore.getBoolean(ParserPreferenceConstants.P_PARSE_DOCFSCRIPT));
      docParser.setReportErrors(prefStore.getBoolean(ParserPreferenceConstants.P_PARSE_REPORT_ERRORS));
      CFDocument parsed = docParser.parseDoc();
      if (parsed != null) {
        docStructure = parsed;
      }
     
      commentParser.ParseDocument(this,lastRes);
View Full Code Here

  public DocItem getTagAt(int startpos, int endpos, boolean includeClosingTags)
  {
    //build the xpath
    String attrString = "[#startpos<=" + startpos + " and #endpos>=" + endpos + "]";
    //System.out.println(this.getClass() + " Finding the tag in the document" + attrString);
    CFDocument docRoot = getCFDocument();

    // there might be a parse error with the document itself, which nullifies this
    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
View Full Code Here

        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        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())
        {
View Full Code Here

TOP

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

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.