Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2009 itemis AG ( and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at /
 package org.eclipse.xtext.ui.editor.syntaxcoloring;
import  org.eclipse.xtext.ide.editor.syntaxcoloring.HighlightingStyles;

Sebastian Zarnekow - Initial contribution and API
	private static final Pattern QUOTED = Pattern.compile("(?:^'([^']*)'$)|(?:^\"([^\"]*)\")$".);
	private static final Pattern PUNCTUATION = Pattern.compile("\\p{Punct}*");
	protected String calculateId(String tokenNameint tokenType) {
		if(.matcher(tokenName).matches()) {
			return HighlightingStyles.PUNCTUATION_ID;
		if(.matcher(tokenName).matches()) {
			return HighlightingStyles.KEYWORD_ID;
		if("RULE_STRING".equals(tokenName)) {
			return HighlightingStyles.STRING_ID;
		if("RULE_INT".equals(tokenName)) {
			return HighlightingStyles.NUMBER_ID;
		if("RULE_ML_COMMENT".equals(tokenName) || "RULE_SL_COMMENT".equals(tokenName)) {
			return HighlightingStyles.COMMENT_ID;
		return HighlightingStyles.DEFAULT_ID;
New to GrepCode? Check out our FAQ X