当前位置: 首页>>代码示例>>Java>>正文


Java PatternRule类代码示例

本文整理汇总了Java中org.eclipse.jface.text.rules.PatternRule的典型用法代码示例。如果您正苦于以下问题:Java PatternRule类的具体用法?Java PatternRule怎么用?Java PatternRule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PatternRule类属于org.eclipse.jface.text.rules包,在下文中一共展示了PatternRule类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: VelocityStringScanner

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
public VelocityStringScanner(VelocityColorProvider manager)
{
    List rules = new ArrayList();
    // Add generic whitespace rule
    rules.add(new WhitespaceRule(new WhitespaceDetector()));
    // Add pattern rule for formal references
    Token token = (Token) manager.getToken(IColorConstants.STRING_REFERENCE);
    rules.add(new PatternRule("$!{", "}", token, (char) 0, true));
    rules.add(new PatternRule("${", "}", token, (char) 0, true));
    // Add pattern rule for shorthand references
    token = (Token) manager.getToken(IColorConstants.STRING_REFERENCE);
    rules.add(new WordPatternRule(new IdentifierDetector(), "$!", null, token));
    rules.add(new WordPatternRule(new IdentifierDetector(), "$", null, token));
    IRule[] result = new IRule[rules.size()];
    rules.toArray(result);
    setRules(result);
    setDefaultReturnToken(manager.getToken(IColorConstants.STRING));
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:19,代码来源:VelocityStringScanner.java

示例2: addStandardRules

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
/***
 * Add some partition rules common to C-style languages.
 * All rules are optional, if an id is null, the rule will not be added.
 */
protected static void addStandardRules(ArrayList2<IPredicateRule> rules, 
		String lineCommentId, String blockCommentId, 
		String docLineCommentId, String docBlockCommentId,
		String stringId) {
	if(docLineCommentId != null) {
		rules.add(new PatternRule("///", null, new Token(docLineCommentId), NO_ESCAPE_CHAR, true, true));
	}
	if(docBlockCommentId != null) {
		rules.add(new PatternRule("/**", "*/", new Token(docBlockCommentId), NO_ESCAPE_CHAR, false, true));
	}
	
	if(lineCommentId != null) {
		rules.add(new PatternRule("//", null, new Token(lineCommentId), NO_ESCAPE_CHAR, true, true));
	}
	if(blockCommentId != null) {
		rules.add(new PatternRule("/*", "*/", new Token(blockCommentId), NO_ESCAPE_CHAR, false, true));
	}
	
	if(stringId != null) {
		rules.add(new PatternRule("\"", "\"", new Token(stringId), '\\', false, true));
	}
	
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:28,代码来源:LangPartitionScanner.java

示例3: createKspPartitionScanner

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
private IPartitionTokenScanner createKspPartitionScanner() {
	RuleBasedPartitionScanner scanner = new RuleBasedPartitionScanner();
	scanner.setPredicateRules(new IPredicateRule[] {
	/* String entre double quote. */
	new PatternRule("\"", "\"", new Token(KspRegionType.STRING.getContentType()), '\\', false),
	/* Commentaire multi-lignes */
	new PatternRule("/*", "*/", new Token(KspRegionType.COMMENT.getContentType()), '\\', false),
	/* Commentaire fin de ligne */
	new EndOfLineRule("//", new Token(KspRegionType.COMMENT.getContentType())) });
	return scanner;
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:12,代码来源:KspDocumentSetupParticipant.java

示例4: extractRules

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
private IRule[] extractRules() {
	IToken comment = new Token(new TextAttribute(new Color(Display.getCurrent(), commentColor), null, SWT.NORMAL));
	return new IRule[] {
	/* Commentaire multi-ligne */
	new PatternRule("/*", "*/", comment, NO_ESCAPE_CHAR, false),
	/* Commentaire à la fin d'une ligne */
	new EndOfLineRule("//", comment) };
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:9,代码来源:KspCommentScanner.java

示例5: RelationModelPartitionScanner

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
public RelationModelPartitionScanner() {
	final IToken commentPartition = new Token(RelationModelPartitionScanner.RELATION_MODEL_COMMENT);
	final IToken valuesPartition = new Token(RelationModelPartitionScanner.RELATION_MODEL_VALUES);

	final List<IRule> rules = new ArrayList<IRule>();
	rules.add(new MultiLineRule("/*", "*/", commentPartition));
	rules.add(new EndOfLineRule("//", commentPartition));
	rules.add(new PatternRule("\"", "\"", valuesPartition, (char) 0, true));

	final IPredicateRule[] result = new IPredicateRule[rules.size()];
	rules.toArray(result);
	this.setPredicateRules(result);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:14,代码来源:RelationModelPartitionScanner.java

示例6: VelocityCodeScanner

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
public VelocityCodeScanner(VelocityColorProvider manager)
{
    List rules = new ArrayList();
    // Add generic whitespace rule
    rules.add(new WhitespaceRule(new WhitespaceDetector()));
    // Add word rule for directives
    Token token = (Token) manager.getToken(IColorConstants.DIRECTIVE);
    WordRule wordRule = new WordRule(new DirectiveDetector(), token);
    token = (Token) manager.getToken(IColorConstants.DIRECTIVE);
    // System directives
    String[] directives = Directive.DIRECTIVES;
    for (int i = directives.length - 1; i >= 0; i--)
    {
        wordRule.addWord(directives[i], token);
    }
    // User directives
    Iterator userDirectives = VelocityEditorEnvironment.getParser().getUserDirectives().iterator();
    while (userDirectives.hasNext())
    {
        wordRule.addWord((String) userDirectives.next(), token);
    }
    rules.add(wordRule);
    // Add pattern rule for formal references
    token = (Token) manager.getToken(IColorConstants.REFERENCE);
    rules.add(new PatternRule("$!{", "}", token, (char) 0, true));
    rules.add(new PatternRule("${", "}", token, (char) 0, true));
    // Add pattern rule for shorthand references
    token = (Token) manager.getToken(IColorConstants.REFERENCE);
    rules.add(new WordPatternRule(new IdentifierDetector(), "$!", null, token));
    rules.add(new WordPatternRule(new IdentifierDetector(), "$", null, token));
    // token = new Token(new
    // TextAttribute(aProvider.getColor(IColorConstants.TAG), null,
    // SWT.BOLD));
    // rules.add(new TagRule(token));
    // token = new Token(new
    // TextAttribute(aProvider.getColor(IColorConstants.COMMENT)));
    IRule[] result = new IRule[rules.size()];
    rules.toArray(result);
    setRules(result);
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:41,代码来源:VelocityCodeScanner.java

示例7: HTMLTagScanner

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
public HTMLTagScanner(VelocityColorProvider manager)
{
    fDefaultToken = manager.getToken(IColorConstants.HTML_ATTRIBUTE);
    fElementToken = manager.getToken(IColorConstants.HTML_TAG);
    fEndElementToken = manager.getToken(IColorConstants.HTML_ENDTAG);
    IToken string = manager.getToken(IColorConstants.HTML_String);
    Vector rules = new Vector();
    setDefaultReturnToken(fDefaultToken);
    fElementRule = new WordRule(new HTMLElementDetector(), fDefaultToken);
    Token token = (Token) manager.getToken(IColorConstants.DIRECTIVE);
    WordRule wordRule = new WordRule(new DirectiveDetector(), token);
    token = (Token) manager.getToken(IColorConstants.DIRECTIVE);
    // System directives
    String[] directives = Directive.DIRECTIVES;
    for (int i = directives.length - 1; i >= 0; i--)
    {
        wordRule.addWord(directives[i], token);
    }
    rules.add(wordRule);
   
    rules.add(new PatternRule("\"", "\"", string, '\0', true));
    rules.add(new PatternRule("'", "'", string, '\0', true));
    rules.add(new WhitespaceRule(new WhitespaceDetector()));
    token = (Token) manager.getToken(IColorConstants.REFERENCE);
    rules.add(new PatternRule("$!{", "}", token, (char) 0, true));
    rules.add(new PatternRule("${", "}", token, (char) 0, true));
    // Add pattern rule for shorthand references
    token = (Token) manager.getToken(IColorConstants.REFERENCE);
    rules.add(new WordPatternRule(new IdentifierDetector(), "$!", null, token));
    rules.add(new WordPatternRule(new IdentifierDetector(), "$", null, token));
    IRule[] result = new IRule[rules.size()];
    rules.copyInto(result);
    setRules(result);
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:35,代码来源:HTMLTagScanner.java

示例8: DMPartitionScanner

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
public DMPartitionScanner()
{
	final IToken dmComment									= new Token(DM_COMMENT);
	final IToken dmString									= new Token(DM_STRING);

	final IPredicateRule[] rules							= new IPredicateRule[5];

	rules[0]												= new MultiLineRule("/*", "*/", dmComment);
	rules[1]												= new EndOfLineRule("//", dmComment, '\\', true);
	rules[2]												= new MultiLineRule("{\"", "\"}", dmString);
	rules[3]												= new DMStringRule(dmString);
	rules[4]												= new PatternRule("'", "'", dmString, '\\', true, true, true);

	this.setPredicateRules(rules);
}
 
开发者ID:nullquery,项目名称:BYONDclipse,代码行数:16,代码来源:DMPartitionScanner.java

示例9: createRules

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
/**
 * 
 * @return the list of rules to find document partitions
 */
protected List createRules()
{
  List rules = new ArrayList();
  rules.add(new EndOfLineRule("#", commentToken));

  for (int i = 0; i < IKeywordConstants.SINGLE_SEGMENT_KEYWORDS.length; i++)
    rules.add(new EolRule(IKeywordConstants.SINGLE_SEGMENT_KEYWORDS[i], syntaxOffEolToken));

  rules.add(new SingleLineRule("${", "}", preprocessorWithBracketsToken/* ,'\\' */));
  rules.add(new SingleLineRule("$[", "]", preprocessorWithBracketsToken/* ,'\\' */));
  rules.add(new PreprocessorWithLeadingDollarRule(preprocessorWithLeading$Token));

  rules.add(new PatternRule("\"", "\"", characterChainToken, '\\', true, true, true));
  // rules.add(new PatternRule("'", "'", characterChainToken, '\\', true, true, true));

  // rules.add(new FormularRule(formelInterpreterToken));

  // rules
  // .add(new SingleLineRule("${", "}", preprocessorWithBracketsToken/* ,'\\' */));
  // rules
  // .add(new SingleLineRule("$[", "]", preprocessorWithBracketsToken/* ,'\\' */));
  // rules.add(new PreprocessorWithLeadingDollarRule(
  // preprocessorWithLeading$Token));

  rules.add(new CodeRule(syntaxOffToken));
  for (int i = 0; i < IKeywordConstants.SYNTAX_OFF_SEGMENT_START_KEYWORDS.length; i++)
    if (IKeywordConstants.SYNTAX_OFF_SEGMENT_START_KEYWORDS[i].endsWith("CODE:")
        && !IKeywordConstants.SYNTAX_OFF_SEGMENT_START_KEYWORDS[i].equals("CODE:")) rules
        .add(new MultiLineRule(IKeywordConstants.SYNTAX_OFF_SEGMENT_START_KEYWORDS[i],
            "END_CODE", syntaxOffToken));

  // rules.add(new MultiLineRule("CODE:", "END_CODE", syntaxOffToken));
  rules.add(new MultiLineRule("MAN:", "END_MAN", syntaxOffToken));
  rules.add(new MultiLineRule("<%", "%>", syntaxOffToken));
  // rules.add(new StartOfLineRule(";",formelInterpreterToken));

  return rules;
}
 
开发者ID:matthias-wolff,项目名称:dLabPro-Plugin,代码行数:43,代码来源:CommonDocumentPartitionScanner.java

示例10: createRules

import org.eclipse.jface.text.rules.PatternRule; //导入依赖的package包/类
/**
 * this method overrides createRules() from the superclass
 * 
 * @see AbstractScanner#createRules()
 */
protected List createRules()
{
  List list = new ArrayList();
  IToken characterChainToken = getToken(IPreferenceConstants.P_CLR_STRING);
  list.add(new PatternRule("\"", "\"", characterChainToken, '\\', true, true, true));
  // list.add(new PatternRule("'", "'", characterChainToken, '\\', true, true, true));
  setDefaultReturnToken(getToken(IPreferenceConstants.DEFAULT));
  return list;
}
 
开发者ID:matthias-wolff,项目名称:dLabPro-Plugin,代码行数:15,代码来源:CharacterChainScanner.java


注:本文中的org.eclipse.jface.text.rules.PatternRule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。