Package org.eclipse.jface.text.rules

Examples of org.eclipse.jface.text.rules.SingleLineRule


    ));
           
    List rules = new ArrayList();
   
    //style the whole block with some default colors
    rules.add(new SingleLineRule("<script", ">", scripttag));
    rules.add(new SingleLineRule("</script", ">", scripttag));
   
    rules.add(new SingleLineRule("<SCRIPT", ">", scripttag));
    rules.add(new SingleLineRule("</SCRIPT", ">", scripttag));
   
    rules.add(new MultiLineRule("<cf",">", new Token(CFPartitionScanner.CF_START_TAG)));
    rules.add(new MultiLineRule("<CF",">", new Token(CFPartitionScanner.CF_START_TAG)));
    rules.add(new SingleLineRule("</cf",">", new Token(CFPartitionScanner.CF_END_TAG)));
    rules.add(new SingleLineRule("</CF",">", new Token(CFPartitionScanner.CF_END_TAG)));
   
    JSSyntaxDictionary jssd = (JSSyntaxDictionary)DictionaryManager.getDictionary(DictionaryManager.JSDIC);
   
    ///////////////////////////////////////////////////////////////////////
    //do any keywords
    //get any script specific keywords (if, case, while, et cetra)
    Set set = jssd.getScriptKeywords();
    String allkeys[] = new String[set.size()];
    int i=0;
   
    Iterator it = set.iterator();
    while(it.hasNext())
    {
      allkeys[i++] = (String)it.next();
    }
   
    CFKeywordDetector cfkd = new CFKeywordDetector();
    PredicateWordRule words = new PredicateWordRule(
      cfkd,
      defaulttoken,
      allkeys,
      keyword
    );
   
    ///////////////////////////////////////////////////////////////////////
    //do any known functions
    //get any script specific functions (alert, parseInt, confirm, et cetra)
    set = jssd.getFunctions();
    i=0;
    //String allfuncs[] = new String[set.size()];
    it = set.iterator();
    while(it.hasNext())
    {
      //allfuncs[i++] = (String)it.next();
      String op = (String)it.next();
      //wr.addWord(op,function);
      words.addWord(op,function);
    }
   
    rules.add(words);
   
    ///////////////////////////////////////////////////////////////////////
    //do any operatores
    WordRule wr = new WordRule(new OperatorDetector());
    //get any script specific operators (*, +, =, et cetra)
    set = jssd.getOperators();
    it = set.iterator();
    while(it.hasNext())
    {
      String op = (String)it.next();
      wr.addWord(op,keyword);
    }
    rules.add(wr);
   
    ///////////////////////////////////////////////////////////////////////
    rules.add(new MultiLineRule("/*", "*/", comment));
    rules.add(new EndOfLineRule("//", comment));
   
    rules.add(new SingleLineRule("\"", "\"", string, '\\'));
    rules.add(new SingleLineRule("'", "'", string, '\\'));
   
    rules.add(new NumberRule(cfnumber));
   
    IRule[] rulearry = new IRule[rules.size()];
    rules.toArray(rulearry);
View Full Code Here


    ));
   
    List rules = new ArrayList();
   
    //style the whole block with some default colors
    rules.add(new SingleLineRule("<style", ">", styletag));
    rules.add(new SingleLineRule("</style", ">", styletag));
   
    rules.add(new SingleLineRule("<STYLE", ">", styletag));
    rules.add(new SingleLineRule("</STYLE", ">", styletag));
   
    rules.add(new MultiLineRule("/*", "*/", cfcomment));
   
    rules.add(new SingleLineRule("\"", "\"", string));
    rules.add(new SingleLineRule("'", "'", string));
   
    //the value of a css - this will change when the StyleDictionary is done
    rules.add(new SingleLineRule(":", ";", cfkeyword));
   
    //TODO this should load the name / values from a list somewhere
    //like border and border-color - but I don't feel like typeing all that
    //shite at the moment. (need StyleDictionary.class)
   
View Full Code Here

    IToken mstring = new Token(MULTILINE_STRING);

    IPredicateRule[] rules = new IPredicateRule[5];

    rules[0] = new MultiLineRule("/*", "*/", comment, (char) 0, true);
    rules[1] = new SingleLineRule("//", null, comment, (char) 0, true);
    rules[2] = new SingleLineRule("'", "'", string); // RAW STRING LITERAL
    rules[3] = new MultiLineRule("`", "`", mstring); // RAW STRING LITERAL
    rules[4] = new SingleLineRule("\"", "\"", string, '\\');

    setPredicateRules(rules);
  }
View Full Code Here

   
    List<IPredicateRule> rules = new ArrayList<IPredicateRule>();
   
    rules.add(new MultiLineRule("`", "`", tkRawString, NO_ESCAPE, true));
    rules.add(new MultiLineRule("\"", "\"", tkString, '\\', true));
    rules.add(new SingleLineRule("'", "'", tkCharacter, '\\', true));
   
    rules.add(new EndOfLineRule("//", tkSingleComment, NO_ESCAPE));
   
    rules.add(new MultiLineRule("/*", "*/", tkMultiComment, NO_ESCAPE, true));
   
View Full Code Here

        // CheckStyle:MagicNumber| OFF
        IRule[] rules = new IRule[3];
        // CheckStyle:MagicNumber| ON

        // Add rule for double quotes
        rules[0] = new SingleLineRule("\"", "\"", string, '\\');
        // Add a rule for single quotes
        rules[1] = new SingleLineRule("'", "'", string, '\\');
        // Add generic whitespace rule.
        rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());

        setRules(rules);
    }
View Full Code Here

        IToken procInstr = new Token(new TextAttribute(manager
                .getColor(PreferenceConstants.EDITOR_COLOR_PROC_INSTR)));

        IRule[] rules = new IRule[2];
        // Add rule for processing instructions
        rules[0] = new SingleLineRule("<?", "?>", procInstr);
        // Add generic whitespace rule.
        rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());

        setRules(rules);
    }
View Full Code Here

            .getAttribute( ACITextAttributeProvider.AUTHENTICATIONLEVEL_ATTRIBUTE ) );
        IToken itemOrUserFirst = new Token( provider.getAttribute( ACITextAttributeProvider.ITEMORUSERFIRST_ATTRIBUTE ) );
        IToken user = new Token( provider.getAttribute( ACITextAttributeProvider.USER_ATTRIBUTE ) );

        // Rules for Strings
        rules.add( new SingleLineRule( "\"", "\"", string, '\0', true ) );
        rules.add( new SingleLineRule( "'", "'", string, '\0', true ) );
        // Generic rule for whitespaces
        rules.add( new WhitespaceRule( new IWhitespaceDetector()
        {
            /**
             * Indicates if the given character is a whitespace
View Full Code Here

    // Add rule for single line comments.
    rules.add(new EndOfLineRule("//", Token.UNDEFINED)); //$NON-NLS-1$

    // Add rule for strings and character constants.
    rules.add(new SingleLineRule("\"", "\"", Token.UNDEFINED, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
    rules.add(new SingleLineRule("'", "'", Token.UNDEFINED, '\\')); //$NON-NLS-2$ //$NON-NLS-1$

    // Add special case word rule.
    rules.add(new WordPredicateRule(comment));

    // Add rules for multi-line comments and javadoc.
View Full Code Here

    // Add rule for single line comments.
    rules.add(new EndOfLineRule("//", comment)); //$NON-NLS-1$

    // Add rule for strings and character constants.
    rules.add(new SingleLineRule("\"", "\"", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
    rules.add(new SingleLineRule("'", "'", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$

    // Add generic whitespace rule.
    rules.add(new WhitespaceRule(new ProcessingWhitespaceDetector()));

    // Add a rule for each keyword explaining how to color it
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.rules.SingleLineRule

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.