diff options
Diffstat (limited to 'plugins/org.eclipse.etrice.dctools.fsm/src/org/eclipse/etrice/dctools/fsm/ast/internal/DCWordDetector.xtend')
-rw-r--r-- | plugins/org.eclipse.etrice.dctools.fsm/src/org/eclipse/etrice/dctools/fsm/ast/internal/DCWordDetector.xtend | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/org.eclipse.etrice.dctools.fsm/src/org/eclipse/etrice/dctools/fsm/ast/internal/DCWordDetector.xtend b/plugins/org.eclipse.etrice.dctools.fsm/src/org/eclipse/etrice/dctools/fsm/ast/internal/DCWordDetector.xtend new file mode 100644 index 000000000..96b7165bf --- /dev/null +++ b/plugins/org.eclipse.etrice.dctools.fsm/src/org/eclipse/etrice/dctools/fsm/ast/internal/DCWordDetector.xtend @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2018 protos software gmbh (http://www.protos.de). + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.dctools.fsm.ast.internal + +import org.eclipse.jface.text.rules.IWordDetector + +class DCWordDetector implements IWordDetector { + + boolean includePreprocessDirectives + + new() { + this(false) + } + + new(boolean includePreprocessDirectives) { + this.includePreprocessDirectives = includePreprocessDirectives + } + + override boolean isWordStart(char c) { + Character.isJavaIdentifierStart(c) || (includePreprocessDirectives && c === Character.valueOf('#').charValue) + } + override boolean isWordPart(char c) { + Character.isJavaIdentifierPart(c) + } +}
\ No newline at end of file |