~vil/pydev/upstream

« back to all changes in this revision

Viewing changes to org.python.pydev.parser/src/org/python/pydev/parser/visitors/PythonLanguageUtils.java

  • Committer: Vladimír Lapáček
  • Date: 2006-08-30 18:38:44 UTC
  • Revision ID: vladimir.lapacek@gmail.com-20060830183844-f4d82c1239a7770a
Initial import of upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Created on Jun 10, 2006
 
3
 * @author Fabio
 
4
 */
 
5
package org.python.pydev.parser.visitors;
 
6
 
 
7
import java.util.SortedSet;
 
8
import java.util.TreeSet;
 
9
 
 
10
/**
 
11
 * These are some utilities for the Python language
 
12
 */
 
13
public class PythonLanguageUtils {
 
14
 
 
15
    public static final String[] KEYWORDS = new String[]{
 
16
            "and",
 
17
            "assert",
 
18
            "break",
 
19
            "class",
 
20
            "continue",
 
21
            "def",
 
22
            "del",
 
23
            "elif",
 
24
            "else",
 
25
            "except",
 
26
            "exec",
 
27
            "finally",
 
28
            "for",
 
29
            "from",
 
30
            "global",
 
31
            "if",
 
32
            "import",
 
33
            "in",
 
34
            "is",
 
35
            "lambda",
 
36
            "not",
 
37
            "or",
 
38
            "pass",
 
39
            "print",
 
40
            "raise",
 
41
            "return",
 
42
            "try",
 
43
            "while",
 
44
            "yield"            
 
45
    };
 
46
 
 
47
    public static final SortedSet<String> KEYWORDS_SET = createKeywordsSet();
 
48
 
 
49
    private static SortedSet<String> createKeywordsSet() {
 
50
        TreeSet<String> set = new TreeSet<String>();
 
51
        for(String k : KEYWORDS){
 
52
            set.add(k);
 
53
        }
 
54
        return set;
 
55
    }
 
56
 
 
57
    public static boolean isKeyword(String selectedWord) {
 
58
        return KEYWORDS_SET.contains(selectedWord);
 
59
    }
 
60
}