~ubuntu-branches/ubuntu/vivid/eclipse-linuxtools/vivid-proposed

« back to all changes in this revision

Viewing changes to valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/SuppressionsElementScanner.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam, Jakub Adam, tony mancill
  • Date: 2014-10-11 11:44:05 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20141011114405-yazjvxfzzhmi5sgj
Tags: 3.1.0-1
[ Jakub Adam ]
* New upstream release (Closes: #761524).
* Refreshed d/patches.
* Don't build removed feature org.eclipse.linuxtools.tools.launch
  - merged into org.eclipse.linuxtools.profiling.
* Use javac target 1.7.
* Build new feature org.eclipse.linuxtools.dataviewers.feature
  - required by Valgrind integration.
* Build-depend on eclipse-remote-services-api and eclipse-cdt-autotools.
* Bump Standards-Version to 3.9.6.
* Override incompatible-java-bytecode-format - linuxtools needs Java 7.
* Remove unused codeless-jar override.

[ tony mancill ]
* Tweak short package description to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
2
 * Copyright (c) 2008, 2009 Phil Muldoon <pkmuldoon@picobot.org>.
3
 
 * 
 
3
 *
4
4
 * All rights reserved. This program and the accompanying materials
5
5
 * are made available under the terms of the Eclipse Public License v1.0
6
6
 * which accompanies this distribution, and is available at
7
7
 * http://www.eclipse.org/legal/epl-v10.html
8
8
 *
9
9
 * Contributors:
10
 
 *    Phil Muldoon <pkmuldoon@picobot.org> - initial API. 
 
10
 *    Phil Muldoon <pkmuldoon@picobot.org> - initial API.
11
11
 *    Red Hat - modifications for use with Valgrind plugins.
12
12
 *******************************************************************************/
13
13
package org.eclipse.linuxtools.internal.valgrind.ui.editor;
29
29
 
30
30
public class SuppressionsElementScanner extends BufferedRuleBasedScanner {
31
31
 
32
 
        public static final String MEMCHECK = "Memcheck"; //$NON-NLS-1$ 
33
 
        public static final String[] MEMCHECK_SUPP_TYPES = new String[] {
34
 
                        "Value0", "Value1", "Value2", "Value4", "Value8", "Value16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
35
 
                        "Cond", //$NON-NLS-1$
36
 
                        "Addr1", "Addr2", "Addr4", "Addr8", "Addr16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
37
 
                        "Jump", //$NON-NLS-1$
38
 
                        "Param", //$NON-NLS-1$
39
 
                        "Free", //$NON-NLS-1$
40
 
                        "Overlap", //$NON-NLS-1$
41
 
                        "Leak" //$NON-NLS-1$
42
 
        };
43
 
        public static final String[] CONTEXTS = new String[] { "obj", "fun" //$NON-NLS-1$ //$NON-NLS-2$
44
 
        };
45
 
 
46
 
        public SuppressionsElementScanner(ColorManager colorManager) {
47
 
                String[] tools = { MEMCHECK };
48
 
                Map<String, List<String>> kinds = new HashMap<String, List<String>>();
49
 
                kinds.put(MEMCHECK, Arrays.asList(MEMCHECK_SUPP_TYPES));
50
 
                
51
 
                IToken defaultToken = new Token(new TextAttribute(colorManager
52
 
                                .getColor(ISuppressionsColorConstants.DEFAULT)));
53
 
                IToken toolToken = new Token(new TextAttribute(colorManager
54
 
                                .getColor(ISuppressionsColorConstants.TOOL), null, SWT.BOLD));
55
 
                IToken suppKindToken = new Token(new TextAttribute(colorManager
56
 
                                .getColor(ISuppressionsColorConstants.SUPP_TYPE)));
57
 
                IToken contextToken = new Token(new TextAttribute(colorManager
58
 
                                .getColor(ISuppressionsColorConstants.CONTEXT), null, SWT.BOLD));
59
 
                IToken commentToken = new Token(new TextAttribute(colorManager
60
 
                                .getColor(ISuppressionsColorConstants.COMMENT)));
61
 
                
62
 
                // Handle keywords                              
63
 
//              WordRule keywordsRule = new WordRule(new IWordDetector() {
64
 
//
65
 
//                      public boolean isWordPart(char c) {
66
 
//                              return Character.isJavaIdentifierPart(c);
67
 
//                      }
68
 
//
69
 
//                      public boolean isWordStart(char c) {
70
 
//                              return Character.isJavaIdentifierStart(c);
71
 
//                      }
72
 
//
73
 
//              }, defaultToken);
74
 
                
75
 
//              for (String tool : TOOLS) {
76
 
//                      keywordsRule.addWord(tool, toolToken);
77
 
//              }
78
 
//              for (String keyword : SUPP_TYPES) {
79
 
//                      keywordsRule.addWord(keyword, suppTypeToken);
80
 
//              }
81
 
//              for (String context : CONTEXTS) {
82
 
//                      keywordsRule.addWord(context, contextToken);
83
 
//              }
84
 
 
85
 
                setDefaultReturnToken(defaultToken);
86
 
                setRules(new IRule[] {
87
 
                                new EndOfLineRule("#", commentToken), //$NON-NLS-1$
88
 
                                new SuppressionToolRule(tools, toolToken),
89
 
                                new SuppressionKindRule(kinds, suppKindToken),
90
 
                                new SuppressionToolRule(CONTEXTS, contextToken),
91
 
//                              keywordsRule,
92
 
                                new WhitespaceRule(new IWhitespaceDetector() {
93
 
                                        public boolean isWhitespace(char c) {
94
 
                                                return Character.isWhitespace(c);
95
 
                                        }
96
 
                                }) });
97
 
        }
 
32
    public static final String MEMCHECK = "Memcheck"; //$NON-NLS-1$
 
33
    public static final String[] MEMCHECK_SUPP_TYPES = new String[] {
 
34
            "Value0", "Value1", "Value2", "Value4", "Value8", "Value16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
 
35
            "Cond", //$NON-NLS-1$
 
36
            "Addr1", "Addr2", "Addr4", "Addr8", "Addr16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
 
37
            "Jump", //$NON-NLS-1$
 
38
            "Param", //$NON-NLS-1$
 
39
            "Free", //$NON-NLS-1$
 
40
            "Overlap", //$NON-NLS-1$
 
41
            "Leak" //$NON-NLS-1$
 
42
    };
 
43
    public static final String[] CONTEXTS = new String[] { "obj", "fun" //$NON-NLS-1$ //$NON-NLS-2$
 
44
    };
 
45
 
 
46
    public SuppressionsElementScanner(ColorManager colorManager) {
 
47
        String[] tools = { MEMCHECK };
 
48
        Map<String, List<String>> kinds = new HashMap<>();
 
49
        kinds.put(MEMCHECK, Arrays.asList(MEMCHECK_SUPP_TYPES));
 
50
 
 
51
        IToken defaultToken = new Token(new TextAttribute(colorManager
 
52
                .getColor(ISuppressionsColorConstants.DEFAULT)));
 
53
        IToken toolToken = new Token(new TextAttribute(colorManager
 
54
                .getColor(ISuppressionsColorConstants.TOOL), null, SWT.BOLD));
 
55
        IToken suppKindToken = new Token(new TextAttribute(colorManager
 
56
                .getColor(ISuppressionsColorConstants.SUPP_TYPE)));
 
57
        IToken contextToken = new Token(new TextAttribute(colorManager
 
58
                .getColor(ISuppressionsColorConstants.CONTEXT), null, SWT.BOLD));
 
59
        IToken commentToken = new Token(new TextAttribute(colorManager
 
60
                .getColor(ISuppressionsColorConstants.COMMENT)));
 
61
 
 
62
        setDefaultReturnToken(defaultToken);
 
63
        setRules(new IRule[] {
 
64
                new EndOfLineRule("#", commentToken), //$NON-NLS-1$
 
65
                new SuppressionToolRule(tools, toolToken),
 
66
                new SuppressionKindRule(kinds, suppKindToken),
 
67
                new SuppressionToolRule(CONTEXTS, contextToken),
 
68
                new WhitespaceRule(new IWhitespaceDetector() {
 
69
                    @Override
 
70
                    public boolean isWhitespace(char c) {
 
71
                        return Character.isWhitespace(c);
 
72
                    }
 
73
                }) });
 
74
    }
98
75
}