Package org.cfeclipse.cfml.editors.partitioner.scanners.rules

Examples of org.cfeclipse.cfml.editors.partitioner.scanners.rules.NamedTagRule


    rules.add(new MultiLineRule("<!--", "-->", htmComment));
    //doctype rule
    rules.add(new MultiLineRule("<!doctype", ">", doctype));
   
    // Handle the if/elsief/set/return tag partitioning
    rules.add(new NamedTagRule("<cfset",">", CF_START_TAG, CF_SET_STATEMENT));
    rules.add(new NamedTagRule("<cfif",">", CF_START_TAG, CF_BOOLEAN_STATEMENT));
    rules.add(new NamedTagRule("<cfelseif",">", CF_START_TAG, CF_BOOLEAN_STATEMENT));
    rules.add(new NamedTagRule("<cfreturn",">", CF_START_TAG, CF_RETURN_STATEMENT));

    /*
     * TODO: Need to add some code to track the partition changes
     * as we run the nextToken() method.
     *
     * As each partition change occurs it needs to see if the
     * default partition needs to change.
     *
     * Also need to look into some method for having <cfset***> with
     * the starter and ender being separate partitions but easily
     * identifiable as part of the same tag for parser purposes. Possibly
     * through some sort of __expression_wrapper_start,
     * __expression_wrapper_end pair that precede and follow the
     * __cf_expression partition type. That would allow us to handle ##
     * pairs as well, but we need to also think about syntax highlighting
     * for those.
     *
     * Need to provide simple methods in the partitioner or document to
     * retrieve the stored partition details.
     *
     */
   
    SyntaxDictionary sd = DictionaryManager.getDictionary(DictionaryManager.CFDIC);
   
    Tag tg = null;
    try
    {
      Set elements = ((ISyntaxDictionary)sd).getAllElements();
     
      Iterator it = elements.iterator();
      while(it.hasNext())
      {
        String ename = (String)it.next();
        //System.out.println(ename);

          tg = sd.getTag(ename);
          rules.add(new NamedTagRule("<" + ename,">", CF_START_TAG, CF_TAG_ATTRIBS));
          //if(!tg.isSingle())
          //{ 
            rules.add(new NamedTagRule("</" + ename,">", CF_END_TAG, CF_END_TAG));
          //}
       
      }
    }
    catch(Exception e)
    {
      e.printStackTrace(System.err);
    }
   
    //these are not really handled in the dictionary because you can call
    //normal pages as cf_'s
    rules.add(new CustomTagRule("<cf_",">", CF_START_TAG, CF_TAG_ATTRIBS));
    rules.add(new CustomTagRule("</cf_",">", CF_END_TAG, CF_END_TAG));
   
    //do the html tags now
    sd = DictionaryManager.getDictionary(DictionaryManager.HTDIC);
   
    try
    {
      Set elements = ((ISyntaxDictionary)sd).getAllElements();
     
      //this is going to be used to tell if we need to add a form, table,
      //or normal tag for the html tags
      String startTokenType = HTM_START_TAG;
      String endTokenType = HTM_END_TAG;
      String midTokenType = HTM_TAG_ATTRIBS;
     
      //loop over all the tags in the html dictionary and try to set the
      //partition to the correct type
      Iterator it = elements.iterator();
      while(it.hasNext())
      {
        String ename = (String)it.next();
       
       
          tg = sd.getTag(ename);
         
          //colour form and table tags differently...
          if(tg.isTableTag()) { 
              startTokenType = TABLE_START_TAG;
              midTokenType = TABLE_TAG_ATTRIBS;
              endTokenType = TABLE_END_TAG;
          }
          else if(tg.isFormTag()) {
              startTokenType = FORM_START_TAG;
              midTokenType = FORM_TAG_ATTRIBS;
              endTokenType = FORM_END_TAG;
          }
          else {
              startTokenType = HTM_START_TAG;
              midTokenType = HTM_TAG_ATTRIBS;
              endTokenType = HTM_END_TAG;
          }
         
          rules.add(new NamedTagRule("<" + ename,">", startTokenType, midTokenType));
          rules.add(new NamedTagRule("</" + ename,">", endTokenType, endTokenType));

       
      }
    }
    catch(Exception e)
View Full Code Here

TOP

Related Classes of org.cfeclipse.cfml.editors.partitioner.scanners.rules.NamedTagRule

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.