Permalink
Browse files

https://github.com/JPMoresmau/eclipsefp/issues/86: alphanumeric

identifiers shown in different color than symbol
  • Loading branch information...
1 parent 2239f51 commit 876c7a9829d94c7bb37782de7a721b7bd64cfe65 @JPMoresmau committed Feb 1, 2013
Showing with 430 additions and 409 deletions.
  1. +1 −0 docs/releasenotes/net.sf.eclipsefp.haskell_2.5.0.txt
  2. +4 −3 ....haskell.core/src/net/sf/eclipsefp/haskell/core/codeassist/{IScionTokens.java → ITokenTypes.java}
  3. +2 −0 ....eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/HaskellEditor.java
  4. +2 −0 ...psefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/text/ColorProvider.java
  5. +22 −20 ...i/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/text/PartitionedScionTokenScanner.java
  6. +26 −25 ...p.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/text/ScionTokenScanner.java
  7. +95 −95 ...i/src/net/sf/eclipsefp/haskell/ui/internal/editors/partitioned/AlexSourceViewerConfiguration.java
  8. +108 −108 .../src/net/sf/eclipsefp/haskell/ui/internal/editors/partitioned/HappySourceViewerConfiguration.java
  9. +22 −19 .../net/sf/eclipsefp/haskell/ui/internal/editors/partitioned/PartitionSourceViewerConfiguration.java
  10. +139 −139 .../src/net/sf/eclipsefp/haskell/ui/internal/editors/partitioned/UuagcSourceViewerConfiguration.java
  11. +2 −0 ...c/net/sf/eclipsefp/haskell/ui/internal/preferences/editor/DefaultEditorPreferenceInitializer.java
  12. +2 −0 ...askell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/editor/IEditorPreferenceNames.java
  13. +3 −0 ...sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/editor/SyntaxPP.java
  14. +1 −0 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/UITexts.java
  15. +1 −0 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/uitexts.properties
@@ -25,6 +25,7 @@ Features:
- Organize imports on single file: only keep actually used imports
- Refactor->rename can rename local bindings
- Synchronize from editor use a long running buildwrapper instance, should enhance performance. Closing the editor for a file closes the long running process, so no memory hog.
+ - https://github.com/JPMoresmau/eclipsefp/issues/86: symbols like $ and + are a different colors than alphanumeric identifiers
Internal:
- Start SQLite in a thread to avoid native locking (maybe)
@@ -1,13 +1,13 @@
package net.sf.eclipsefp.haskell.core.codeassist;
/**
- * Scion tokens: These are the token strings returned by scion to annotate various parts of the
+ * BuildWrapper tokens: These are the token strings returned by buildwrapper to annotate various parts of the
* input source, i.e., identify keywords, etc.
*
* @author B. Scott Michel (bscottm@ieee.org)
*/
-public interface IScionTokens {
- // !!These strings need to be synchronized with changes to the scion source!! (See lib/Scion/Inspect.hs)
+public interface ITokenTypes {
+ // !!These strings need to be synchronized with changes to the BuildWrapper source!! (See src/Language/Haskell/BuildWrapper/GHC.hs)
public final static String LITERAL_STRING = "LS"; //$NON-NLS-1$
public final static String LITERAL_CHAR = "LC"; //$NON-NLS-1$
public final static String PRAGMA = "P"; //$NON-NLS-1$
@@ -22,6 +22,7 @@
public final static String LITERAL_FLOAT = "LF"; //$NON-NLS-1$
public final static String IDENTIFIER_CONSTRUCTOR = "IC"; // aka "conid" //$NON-NLS-1$
public final static String IDENTIFIER_VARIABLE = "IV"; // aka "varid" //$NON-NLS-1$
+ public final static String SYMBOL_VARIABLE = "VS"; // aka "varsym" //$NON-NLS-1$
public final static String SYMBOL_RESERVED = "S"; //$NON-NLS-1$
public final static String SYMBOL_SPECIAL = "SS"; //$NON-NLS-1$
public final static String PREPROCESSOR_TEXT = "PP"; //$NON-NLS-1$
@@ -620,6 +620,8 @@ private boolean isAffectingProperty( final String property ) {
|| property.equals( EDITOR_NUMBER_BOLD )
|| property.equals( EDITOR_VAR_COLOR )
|| property.equals( EDITOR_VAR_BOLD )
+ || property.equals( EDITOR_VARSYM_COLOR )
+ || property.equals( EDITOR_VARSYM_BOLD )
|| property.equals( EDITOR_CON_COLOR )
|| property.equals( EDITOR_CON_BOLD )
|| property.equals( EDITOR_SYMBOL_COLOR )
@@ -36,6 +36,7 @@
public static final RGB DEFAULT_CHAR = new RGB( 96, 96, 96 );
public static final RGB DEFAULT_NUMBER = new RGB( 0, 0, 0 );
public static final RGB DEFAULT_VAR = new RGB( 0, 0, 0 );
+ public static final RGB DEFAULT_VARSYM = new RGB( 155, 0, 0 );
public static final RGB DEFAULT_CON = new RGB( 200, 0, 0 );
public static final RGB DEFAULT_CPP = new RGB( 63, 95, 191 );
public static final RGB DEFAULT_TH = new RGB( 0, 0, 0 );
@@ -131,6 +132,7 @@ private void initializeRgbs() {
putRgb( EDITOR_CHAR_COLOR, DEFAULT_CHAR );
putRgb( EDITOR_NUMBER_COLOR, DEFAULT_NUMBER );
putRgb( EDITOR_VAR_COLOR, DEFAULT_VAR );
+ putRgb( EDITOR_VARSYM_COLOR, DEFAULT_VARSYM );
putRgb( EDITOR_CON_COLOR, DEFAULT_CON );
putRgb( EDITOR_CPP_COLOR, DEFAULT_CPP );
putRgb( EDITOR_TH_COLOR, DEFAULT_TH );
@@ -9,7 +9,7 @@
import net.sf.eclipsefp.haskell.buildwrapper.BuildWrapperPlugin;
import net.sf.eclipsefp.haskell.buildwrapper.types.Location;
import net.sf.eclipsefp.haskell.buildwrapper.types.TokenDef;
-import net.sf.eclipsefp.haskell.core.codeassist.IScionTokens;
+import net.sf.eclipsefp.haskell.core.codeassist.ITokenTypes;
import net.sf.eclipsefp.haskell.ui.HaskellUIPlugin;
import net.sf.eclipsefp.haskell.ui.internal.preferences.editor.IEditorPreferenceNames;
import org.eclipse.core.resources.IFile;
@@ -78,41 +78,43 @@ public PartitionedScionTokenScanner( final ScannerManager man,final IFile file,
// get serialized...
private static final long serialVersionUID = 3579246300065591883L;
{
- put( IScionTokens.LITERAL_STRING,
+ put( ITokenTypes.LITERAL_STRING,
man.createToken( EDITOR_STRING_COLOR, EDITOR_STRING_BOLD ) );
- put( IScionTokens.LITERAL_CHAR,
+ put( ITokenTypes.LITERAL_CHAR,
man.createToken( EDITOR_CHAR_COLOR, EDITOR_CHAR_BOLD ) );
- put( IScionTokens.DOCUMENTATION_ANNOTATION,
+ put( ITokenTypes.DOCUMENTATION_ANNOTATION,
man.createToken( EDITOR_DOC_COLOR, EDITOR_DOC_BOLD ) );
- put( IScionTokens.COMMENT,
+ put( ITokenTypes.COMMENT,
man.createToken( EDITOR_COMMENT_COLOR, EDITOR_COMMENT_BOLD ) );
- put( IScionTokens.LITERATE_COMMENT, man.createToken(
+ put( ITokenTypes.LITERATE_COMMENT, man.createToken(
EDITOR_LITERATE_COMMENT_COLOR, EDITOR_LITERATE_COMMENT_BOLD ) );
- put( IScionTokens.PRAGMA,
+ put( ITokenTypes.PRAGMA,
man.createToken( EDITOR_PRAGMA_COLOR, EDITOR_PRAGMA_BOLD ) );
- put( IScionTokens.KEYWORD,
+ put( ITokenTypes.KEYWORD,
man.createToken( EDITOR_KEYWORD_COLOR, EDITOR_KEYWORD_BOLD ) );
- put( IScionTokens.GHC_EXTENSION_KEYWORD,
+ put( ITokenTypes.GHC_EXTENSION_KEYWORD,
man.createToken( EDITOR_KEYWORD_COLOR, EDITOR_KEYWORD_BOLD ) );
- put( IScionTokens.LITERAL_INTEGER,
+ put( ITokenTypes.LITERAL_INTEGER,
man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
- put( IScionTokens.LITERAL_RATIONAL,
+ put( ITokenTypes.LITERAL_RATIONAL,
man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
- put( IScionTokens.LITERAL_WORD,
+ put( ITokenTypes.LITERAL_WORD,
man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
- put( IScionTokens.LITERAL_FLOAT,
+ put( ITokenTypes.LITERAL_FLOAT,
man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
- put( IScionTokens.IDENTIFIER_CONSTRUCTOR,
+ put( ITokenTypes.IDENTIFIER_CONSTRUCTOR,
man.createToken( EDITOR_CON_COLOR, EDITOR_CON_BOLD ) );
- put( IScionTokens.IDENTIFIER_VARIABLE,
+ put( ITokenTypes.IDENTIFIER_VARIABLE,
man.createToken( EDITOR_VAR_COLOR, EDITOR_VAR_BOLD ) );
- put( IScionTokens.SYMBOL_RESERVED,
+ put( ITokenTypes.SYMBOL_VARIABLE,
+ man.createToken( EDITOR_VARSYM_COLOR, EDITOR_VARSYM_BOLD ) );
+ put( ITokenTypes.SYMBOL_RESERVED,
man.createToken( EDITOR_SYMBOL_COLOR, EDITOR_SYMBOL_BOLD ) );
- put( IScionTokens.SYMBOL_SPECIAL,
+ put( ITokenTypes.SYMBOL_SPECIAL,
man.createToken( EDITOR_SYMBOL_COLOR, EDITOR_SYMBOL_BOLD ) );
- put( IScionTokens.PREPROCESSOR_TEXT,
+ put( ITokenTypes.PREPROCESSOR_TEXT,
man.createToken( EDITOR_CPP_COLOR, EDITOR_CPP_BOLD ) );
- put( IScionTokens.TEMPLATE_HASKELL,
+ put( ITokenTypes.TEMPLATE_HASKELL,
man.createToken( EDITOR_TH_COLOR, EDITOR_TH_BOLD ) );
}
};
@@ -205,7 +207,7 @@ public void setRange( final IDocument document, final int offset,
doc = document;
contents = prevContents;
- TokenDef def = new TokenDef( IScionTokens.LITERATE_COMMENT,
+ TokenDef def = new TokenDef( ITokenTypes.LITERATE_COMMENT,
new Location( "", document, new Region( realOffset, realLength ) ) );
lTokenDefs = new ArrayList<TokenDef>();
lTokenDefs.add( def );
@@ -17,7 +17,7 @@
import net.sf.eclipsefp.haskell.buildwrapper.BuildWrapperPlugin;
import net.sf.eclipsefp.haskell.buildwrapper.types.Occurrence;
import net.sf.eclipsefp.haskell.buildwrapper.types.TokenDef;
-import net.sf.eclipsefp.haskell.core.codeassist.IScionTokens;
+import net.sf.eclipsefp.haskell.core.codeassist.ITokenTypes;
import net.sf.eclipsefp.haskell.ui.HaskellUIPlugin;
import net.sf.eclipsefp.haskell.ui.internal.preferences.editor.IEditorPreferenceNames;
import net.sf.eclipsefp.haskell.ui.internal.util.UITexts;
@@ -85,24 +85,25 @@ public ScionTokenScanner(final ScannerManager man,final IFile file,final Display
// get serialized...
private static final long serialVersionUID = 3579246300065591883L;
{
- put( IScionTokens.LITERAL_STRING, man.createToken( EDITOR_STRING_COLOR, EDITOR_STRING_BOLD ) );
- put( IScionTokens.LITERAL_CHAR, man.createToken( EDITOR_CHAR_COLOR, EDITOR_CHAR_BOLD ) );
- put( IScionTokens.DOCUMENTATION_ANNOTATION, man.createToken( EDITOR_DOC_COLOR,EDITOR_DOC_BOLD ) );
- put( IScionTokens.COMMENT, man.createToken( EDITOR_COMMENT_COLOR,EDITOR_COMMENT_BOLD ) );
- put( IScionTokens.PRAGMA, man.createToken( EDITOR_PRAGMA_COLOR,EDITOR_PRAGMA_BOLD ) );
- put( IScionTokens.LITERATE_COMMENT, man.createToken( EDITOR_LITERATE_COMMENT_COLOR, EDITOR_LITERATE_COMMENT_BOLD ) );
- put( IScionTokens.KEYWORD, man.createToken( EDITOR_KEYWORD_COLOR, EDITOR_KEYWORD_BOLD ) );
- put( IScionTokens.GHC_EXTENSION_KEYWORD, man.createToken( EDITOR_KEYWORD_COLOR, EDITOR_KEYWORD_BOLD ) );
- put( IScionTokens.LITERAL_INTEGER, man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
- put( IScionTokens.LITERAL_RATIONAL, man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
- put( IScionTokens.LITERAL_WORD, man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
- put( IScionTokens.LITERAL_FLOAT, man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
- put( IScionTokens.IDENTIFIER_CONSTRUCTOR, man.createToken( EDITOR_CON_COLOR, EDITOR_CON_BOLD ) );
- put( IScionTokens.IDENTIFIER_VARIABLE, man.createToken( EDITOR_VAR_COLOR, EDITOR_VAR_BOLD ) );
- put( IScionTokens.SYMBOL_RESERVED, man.createToken( EDITOR_SYMBOL_COLOR, EDITOR_SYMBOL_BOLD ) );
- put( IScionTokens.SYMBOL_SPECIAL, man.createToken( EDITOR_SYMBOL_COLOR, EDITOR_SYMBOL_BOLD ) );
- put( IScionTokens.PREPROCESSOR_TEXT, man.createToken( EDITOR_CPP_COLOR, EDITOR_CPP_BOLD ) );
- put( IScionTokens.TEMPLATE_HASKELL, man.createToken( EDITOR_TH_COLOR, EDITOR_TH_BOLD ) );
+ put( ITokenTypes.LITERAL_STRING, man.createToken( EDITOR_STRING_COLOR, EDITOR_STRING_BOLD ) );
+ put( ITokenTypes.LITERAL_CHAR, man.createToken( EDITOR_CHAR_COLOR, EDITOR_CHAR_BOLD ) );
+ put( ITokenTypes.DOCUMENTATION_ANNOTATION, man.createToken( EDITOR_DOC_COLOR,EDITOR_DOC_BOLD ) );
+ put( ITokenTypes.COMMENT, man.createToken( EDITOR_COMMENT_COLOR,EDITOR_COMMENT_BOLD ) );
+ put( ITokenTypes.PRAGMA, man.createToken( EDITOR_PRAGMA_COLOR,EDITOR_PRAGMA_BOLD ) );
+ put( ITokenTypes.LITERATE_COMMENT, man.createToken( EDITOR_LITERATE_COMMENT_COLOR, EDITOR_LITERATE_COMMENT_BOLD ) );
+ put( ITokenTypes.KEYWORD, man.createToken( EDITOR_KEYWORD_COLOR, EDITOR_KEYWORD_BOLD ) );
+ put( ITokenTypes.GHC_EXTENSION_KEYWORD, man.createToken( EDITOR_KEYWORD_COLOR, EDITOR_KEYWORD_BOLD ) );
+ put( ITokenTypes.LITERAL_INTEGER, man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
+ put( ITokenTypes.LITERAL_RATIONAL, man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
+ put( ITokenTypes.LITERAL_WORD, man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
+ put( ITokenTypes.LITERAL_FLOAT, man.createToken( EDITOR_NUMBER_COLOR, EDITOR_NUMBER_BOLD ) );
+ put( ITokenTypes.IDENTIFIER_CONSTRUCTOR, man.createToken( EDITOR_CON_COLOR, EDITOR_CON_BOLD ) );
+ put( ITokenTypes.IDENTIFIER_VARIABLE, man.createToken( EDITOR_VAR_COLOR, EDITOR_VAR_BOLD ) );
+ put( ITokenTypes.SYMBOL_VARIABLE, man.createToken( EDITOR_VARSYM_COLOR, EDITOR_VARSYM_BOLD ) );
+ put( ITokenTypes.SYMBOL_RESERVED, man.createToken( EDITOR_SYMBOL_COLOR, EDITOR_SYMBOL_BOLD ) );
+ put( ITokenTypes.SYMBOL_SPECIAL, man.createToken( EDITOR_SYMBOL_COLOR, EDITOR_SYMBOL_BOLD ) );
+ put( ITokenTypes.PREPROCESSOR_TEXT, man.createToken( EDITOR_CPP_COLOR, EDITOR_CPP_BOLD ) );
+ put( ITokenTypes.TEMPLATE_HASKELL, man.createToken( EDITOR_TH_COLOR, EDITOR_TH_BOLD ) );
}
};
getCaseS();
@@ -169,11 +170,11 @@ public IToken nextToken() {
private void addTokenOccurence(final String s,final int offset,int end,final TokenDef td){
String name=td.getName();
- if (name.equals( IScionTokens.KEYWORD )
- || name.equals( IScionTokens.GHC_EXTENSION_KEYWORD )
- || name.equals( IScionTokens.IDENTIFIER_CONSTRUCTOR )
- || name.equals( IScionTokens.IDENTIFIER_VARIABLE )
- || name.equals( IScionTokens.SYMBOL_RESERVED )
+ if (name.equals( ITokenTypes.KEYWORD )
+ || name.equals( ITokenTypes.GHC_EXTENSION_KEYWORD )
+ || name.equals( ITokenTypes.IDENTIFIER_CONSTRUCTOR )
+ || name.equals( ITokenTypes.IDENTIFIER_VARIABLE )
+ || name.equals( ITokenTypes.SYMBOL_RESERVED )
){ //|| name.equals( IScionTokens.SYMBOL_SPECIAL )
List<String> key=new LinkedList<String>();
@@ -366,7 +367,7 @@ public void markTaskTags(){
try {
file.deleteMarkers( IMarker.TASK , true, IResource.DEPTH_ZERO );
for (TokenDef nextTokenDef:lTokenDefs){
- if (nextTokenDef.getName().equals(IScionTokens.DOCUMENTATION_ANNOTATION) || nextTokenDef.getName().equals(IScionTokens.COMMENT) || nextTokenDef.getName().equals(IScionTokens.LITERATE_COMMENT)){
+ if (nextTokenDef.getName().equals(ITokenTypes.DOCUMENTATION_ANNOTATION) || nextTokenDef.getName().equals(ITokenTypes.COMMENT) || nextTokenDef.getName().equals(ITokenTypes.LITERATE_COMMENT)){
String s=nextTokenDef.getLocation().getContents( doc );
outer:for (int a=0;a<s.length();a++){
if (Character.isLetter( s.charAt( a ) )){
Oops, something went wrong.

0 comments on commit 876c7a9

Please sign in to comment.