Java 类org.eclipse.jface.text.rules.RuleBasedScanner 实例源码
项目:hybris-commerce-eclipse-plugin
文件:ImpexSourceViewerConfig.java
protected RuleBasedScanner getImpexScanner(String partition) {
RuleBasedScanner scanner = scanMap.get(partition);
if (scanner == null) {
scanner = new ImpexRuleScanner(ColorProvider.getInstance());
if (partition != null) {
switch (partition) {
case ImpexDocumentPartitioner.IMPEX_INSTRUCTION:
scanner = new InstructionsRuleScanner(ColorProvider.getInstance());
break;
}
}
}
return scanner;
}
项目:GLSL-Eclipse
文件:GlslScanners.java
public static final RuleBasedScanner createPreprocessorScanner() {
final TextAttribute attribute = new TextAttribute(
Activator.getDefault().getColor(GlslEditor.PREPROCESSOR_COLOR), null, SWT.BOLD
);
final Token preprocessorToken = new Token(attribute);
IRule[] rules = new IRule[Glsl.PREPROCESSORS.length];
for (int i = 0; i < rules.length; i++) {
rules[i] = new SingleLineRule(Glsl.PREPROCESSORS[i], null, preprocessorToken, '\0',
true, false);
}
RuleBasedScanner scanner = new RuleBasedScanner();
scanner.setRules(rules);
return scanner;
}
项目:pgcodekeeper
文件:SQLEditorSourceViewerConfiguration.java
private RuleBasedScanner createRecipeScanner() {
RuleBasedScanner recipeScanner= new RuleBasedScanner();
IRule[] rules= {
sqlSyntaxRules()
};
recipeScanner.setRules(rules);
return recipeScanner;
}
项目:http4e
文件:HConfiguration.java
private RuleBasedScanner getCommentScanner(){
if (commentScanner == null) {
commentScanner = new HCommentScanner();
commentScanner.setDefaultReturnToken(new Token(new TextAttribute(ResourceUtils.getColor(Styles.COMMENT))));
}
return commentScanner;
}
项目:http4e
文件:HConfiguration.java
private RuleBasedScanner getValueScanner(){
if (valueScanner == null) {
valueScanner = new HValueScanner();
valueScanner.setDefaultReturnToken(new Token(new TextAttribute(ResourceUtils.getColor(Styles.STRING))));
}
return valueScanner;
}
项目:http4e
文件:HConfiguration.java
private RuleBasedScanner getDefaultScanner(){
if (defaultScanner == null) {
defaultScanner = new HDefaultScanner();
defaultScanner.setDefaultReturnToken(new Token(new TextAttribute(ResourceUtils.getColor(Styles.KEY))));
}
return defaultScanner;
}
项目:fluentmark
文件:FrontMatterRule.java
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
if (fColumn == UNDEFINED) return doEvaluate(scanner, resume);
int c = scanner.read();
scanner.unread();
if (c == fStartSequence[0] && fColumn == scanner.getColumn()) {
if (((RuleBasedScanner) scanner).getTokenOffset() == 0) {
return doEvaluate(scanner, resume);
}
}
return Token.UNDEFINED;
}
项目:GLSL-Eclipse
文件:GlslScanners.java
public static final RuleBasedScanner createCommentScanner() {
final TextAttribute attribute = new TextAttribute(
Activator.getDefault().getColor(GlslEditor.COMMENTS_COLOR)
);
final Token commentToken = new Token(attribute);
RuleBasedScanner scanner = new RuleBasedScanner();
scanner.setDefaultReturnToken(commentToken);
scanner.setRules(new IRule[0]);
return scanner;
}
项目:GLSL-Eclipse
文件:GlslScanners.java
public static final RuleBasedScanner createVariableDeclarationScanner() {
final Token qualifierToken = new Token(new TextAttribute(
Activator.getDefault().getColor(GlslEditor.QUALIFIER_COLOR)
));
final Token typeToken = new Token(new TextAttribute(
Activator.getDefault().getColor(GlslEditor.TYPE_COLOR)
));
final Token builtInVariableToken = new Token(new TextAttribute(
Activator.getDefault().getColor(GlslEditor.BUILT_IN_VARIABLES_COLOR)
));
final Token functionToken = new Token(new TextAttribute(
Activator.getDefault().getColor(GlslEditor.FUNCTION_COLOR)
));
WordRule wordRule = createWordRule();
addToWordRule(wordRule, Glsl.QUALIFIERS, qualifierToken);
addToWordRule(wordRule, Glsl.TYPES, typeToken);
addToWordRule(wordRule, Glsl.VARIABLES, builtInVariableToken);
addToWordRule(wordRule, Glsl.FUNCTIONS, functionToken);
RuleBasedScanner scanner = new RuleBasedScanner();
scanner.setRules(new IRule[] {
wordRule,
// TODO Variable highlighting
});
return scanner;
}
项目:APICloud-Studio
文件:CompositeSourceViewerConfiguration.java
private ITokenScanner getStartEndTokenScanner() {
if (startEndTokenScanner == null) {
RuleBasedScanner ts = new RuleBasedScanner();
IToken seqToken = new Token(getStartEndTokenType());
List<IRule> rules = new ArrayList<IRule>();
for (String[] pair : getPartitionerSwitchStrategy().getSwitchTagPairs()) {
rules.add(new SingleTagRule(pair[0], seqToken));
rules.add(new SingleTagRule(pair[1], seqToken));
}
ts.setRules(rules.toArray(new IRule[rules.size()]));
ts.setDefaultReturnToken(new Token("text")); //$NON-NLS-1$
startEndTokenScanner = ts;
}
return startEndTokenScanner;
}
项目:syncope
文件:HTMLSourceConfiguration.java
protected RuleBasedScanner getJavaScriptScanner() {
if (javaScriptScanner == null) {
javaScriptScanner = new InnerJavaScriptScanner();
RGB rgb = IHTMLColorConstants.FOREGROUND;
Color color = new Color(Display.getCurrent(), rgb);
javaScriptScanner.setDefaultReturnToken(new Token(new TextAttribute(color)));
}
return javaScriptScanner;
}
项目:syncope
文件:HTMLSourceConfiguration.java
protected RuleBasedScanner getCSSScanner() {
if (cssScanner == null) {
cssScanner = new InnerCSSScanner();
RGB rgb = IHTMLColorConstants.FOREGROUND;
Color color = new Color(Display.getCurrent(), rgb);
cssScanner.setDefaultReturnToken(new Token(new TextAttribute(color)));
}
return cssScanner;
}
项目:textuml
文件:SyntaxHighlighter.java
ITokenScanner getCommentScanner() {
// lazy init
if (this.commentScanner == null) {
final Token comment = new Token(new TextAttribute(JFaceResources.getColorRegistry().get(COMMENT_COLOR)));
// no rules needed, because this will apply to comment partition
// only
final RuleBasedScanner ruleBasedScanner = new RuleBasedScanner();
// this will apply the syntax
ruleBasedScanner.setDefaultReturnToken(comment);
this.commentScanner = ruleBasedScanner;
}
return commentScanner;
}
项目:birt
文件:JSSourceViewerConfiguration.java
/**
* Gets default scanner
*
* @return scanner
*/
protected RuleBasedScanner getDefaultScanner( )
{
if ( scanner == null )
{
scanner = new JSScanner( );
scanner.setDefaultReturnToken( new Token( UIUtil.getAttributeFor( ReportPlugin.EXPRESSION_CONTENT_COLOR_PREFERENCE ) ) );
}
return scanner;
}
项目:byteman-editor
文件:BytemanRuleConfiguration.java
protected RuleBasedScanner getBytemanRuleScannerForLine() {
if (defLineScanner == null) {
defLineScanner = new BytemanRuleScannerForDefLine(tokenManager);
defLineScanner.setDefaultReturnToken(
tokenManager.getToken(TokenManager.TOKEN_BYTEMAN_DEFAULT));
}
return defLineScanner;
}
项目:pgcodekeeper
文件:SQLEditorSourceViewerConfiguration.java
private void addDamagerRepairer(PresentationReconciler reconciler, RuleBasedScanner commentScanner, String contentType) {
DefaultDamagerRepairer commentDamagerRepairer= new DefaultDamagerRepairer(commentScanner);
reconciler.setDamager(commentDamagerRepairer, contentType);
reconciler.setRepairer(commentDamagerRepairer, contentType);
}
项目:pgcodekeeper
文件:SQLEditorSourceViewerConfiguration.java
private RuleBasedScanner createCommentScanner() {
RuleBasedScanner commentScanner= new RuleBasedScanner();
commentScanner.setDefaultReturnToken(new Token(
getTextAttribute(prefs, SQLEditorStatementTypes.SINGLE_LINE_COMMENTS)));
return commentScanner;
}
项目:pgcodekeeper
文件:SQLEditorSourceViewerConfiguration.java
private RuleBasedScanner createMultiCommentScanner() {
RuleBasedScanner commentScanner= new RuleBasedScanner();
commentScanner.setDefaultReturnToken(new Token(
getTextAttribute(prefs, SQLEditorStatementTypes.MULTI_LINE_COMMENTS)));
return commentScanner;
}
项目:pgcodekeeper
文件:SQLEditorSourceViewerConfiguration.java
private RuleBasedScanner createCharacterStringLiteralCommentScanner() {
RuleBasedScanner commentScanner= new RuleBasedScanner();
commentScanner.setDefaultReturnToken(new Token(
getTextAttribute(prefs, SQLEditorStatementTypes.CHARACTER_STRING_LITERAL)));
return commentScanner;
}
项目:velocity-edit
文件:VelocityEditorEnvironment.java
/**
* Returns the singleton code scanner.
*/
public static RuleBasedScanner getCodeScanner()
{
return fgCodeScanner;
}
项目:velocity-edit
文件:VelocityEditorEnvironment.java
/**
* Returns the singleton string scanner.
*/
public static RuleBasedScanner getStringScanner()
{
return fgStringScanner;
}
项目:myLOGO4Eclipse
文件:LogoScriptSourceViewerConfiguration.java
private ITokenScanner createTokenScanner() {
RuleBasedScanner scanner = new RuleBasedScanner();
scanner.setRules(createRules());
return scanner;
}
项目:typescript.java
文件:TypeScriptSourceViewerConfiguration.java
/**
* Returns the TypeScript source code scanner for this configuration.
*
* @return the TypeScript source code scanner
*/
@Override
protected RuleBasedScanner getCodeScanner() {
return fCodeScanner;
}
项目:typescript.java
文件:TypeScriptSourceViewerConfiguration.java
/**
* Returns the JSX source code scanner for this configuration.
*
* @return the JSX source code scanner
*/
protected RuleBasedScanner getJSXScanner() {
return jsxScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaSourceViewerConfiguration.java
/**
* Returns the Java source code scanner for this configuration.
*
* @return the Java source code scanner
*/
protected RuleBasedScanner getCodeScanner() {
return fCodeScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaSourceViewerConfiguration.java
/**
* Returns the Java multi-line comment scanner for this configuration.
*
* @return the Java multi-line comment scanner
* @since 2.0
*/
protected RuleBasedScanner getMultilineCommentScanner() {
return fMultilineCommentScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaSourceViewerConfiguration.java
/**
* Returns the Java single-line comment scanner for this configuration.
*
* @return the Java single-line comment scanner
* @since 2.0
*/
protected RuleBasedScanner getSinglelineCommentScanner() {
return fSinglelineCommentScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaSourceViewerConfiguration.java
/**
* Returns the Java string scanner for this configuration.
*
* @return the Java string scanner
* @since 2.0
*/
protected RuleBasedScanner getStringScanner() {
return fStringScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaSourceViewerConfiguration.java
/**
* Returns the JavaDoc scanner for this configuration.
*
* @return the JavaDoc scanner
*/
protected RuleBasedScanner getJavaDocScanner() {
return fJavaDocScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaTextTools.java
/**
* Returns a scanner which is configured to scan Java source code.
*
* @return a Java source code scanner
* @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getCodeScanner()}
*/
public RuleBasedScanner getCodeScanner() {
return fCodeScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaTextTools.java
/**
* Returns a scanner which is configured to scan Java multi-line comments.
*
* @return a Java multi-line comment scanner
* @since 2.0
* @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getMultilineCommentScanner()}
*/
public RuleBasedScanner getMultilineCommentScanner() {
return fMultilineCommentScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaTextTools.java
/**
* Returns a scanner which is configured to scan Java single-line comments.
*
* @return a Java single-line comment scanner
* @since 2.0
* @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getSinglelineCommentScanner()}
*/
public RuleBasedScanner getSinglelineCommentScanner() {
return fSinglelineCommentScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaTextTools.java
/**
* Returns a scanner which is configured to scan Java strings.
*
* @return a Java string scanner
* @since 2.0
* @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getStringScanner()}
*/
public RuleBasedScanner getStringScanner() {
return fStringScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaTextTools.java
/**
* Returns a scanner which is configured to scan JavaDoc compliant comments.
* <p>
* Note that the start sequence "/**" and the corresponding end sequence
* are part of the Javadoc comment.</p>
*
* @return a Javadoc scanner
* @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getJavaDocScanner()}
*/
public RuleBasedScanner getJavaDocScanner() {
return fJavaDocScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:PropertiesFileSourceViewerConfiguration.java
/**
* Returns the property key scanner for this configuration.
*
* @return the property key scanner
*/
protected RuleBasedScanner getPropertyKeyScanner() {
return fPropertyKeyScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:PropertiesFileSourceViewerConfiguration.java
/**
* Returns the comment scanner for this configuration.
*
* @return the comment scanner
*/
protected RuleBasedScanner getCommentScanner() {
return fCommentScanner;
}
项目:Eclipse-Postfix-Code-Completion
文件:PropertiesFileSourceViewerConfiguration.java
/**
* Returns the property value scanner for this configuration.
*
* @return the property value scanner
*/
protected RuleBasedScanner getPropertyValueScanner() {
return fPropertyValueScanner;
}
项目:editorconfig-eclipse
文件:EditorConfigSourceViewerConfiguration.java
/**
* Returns the property key scanner for this configuration.
*
* @return the property key scanner
*/
protected RuleBasedScanner getPropertyKeyScanner() {
return propertyKeyScanner;
}
项目:editorconfig-eclipse
文件:EditorConfigSourceViewerConfiguration.java
/**
* Returns the comment scanner for this configuration.
*
* @return the comment scanner
*/
protected RuleBasedScanner getCommentScanner() {
return commentScanner;
}
项目:editorconfig-eclipse
文件:EditorConfigSourceViewerConfiguration.java
/**
* Returns the section scanner for this configuration.
*
* @return the section scanner
*/
protected RuleBasedScanner getSectionNameScanner() {
return sectionScanner;
}