JSElementTypes.java

1    /* 
2     * Copyright 2000-2005 JetBrains s.r.o. 
3     * 
4     * Licensed under the Apache License, Version 2.0 (the "License"); 
5     * you may not use this file except in compliance with the License. 
6     * You may obtain a copy of the License at 
7     * 
8     * http://www.apache.org/licenses/LICENSE-2.0 
9     * 
10    * Unless required by applicable law or agreed to in writing, software 
11    * distributed under the License is distributed on an "AS IS" BASIS, 
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13    * See the License for the specific language governing permissions and 
14    * limitations under the License. 
15    */ 
16   package com.intellij.lang.javascript; 
17    
18   import com.intellij.lang.Language; 
19   import com.intellij.psi.tree.IChameleonElementType; 
20   import com.intellij.psi.tree.IElementType; 
21   import com.intellij.psi.tree.IFileElementType; 
22   import com.intellij.psi.tree.TokenSet; 
23    
24   /** 
25    * Created by IntelliJ IDEA. 
26    * User: max 
27    * Date: Jan 28, 2005 
28    * Time: 12:27:21 AM 
29    * To change this template use File | Settings | File Templates. 
30    */ 
31   public interface JSElementTypes { 
32     IFileElementType FILE = new IFileElementType(Language.findInstance(JavascriptLanguage.class)); 
33     IElementType EMBEDDED_CONTENT = new IChameleonElementType("JS_EMBEDDED_CONTENT", Language.findInstance(JavascriptLanguage.class)); 
34     IElementType FUNCTION_DECLARATION = new JSElementType("FUNCTION_DECLARATION"); 
35     IElementType PARAMETER_LIST = new JSElementType("PARAMETER_LIST"); 
36     IElementType FORMAL_PARAMETER = new JSElementType("FORMAL_PARAMETER"); 
37     IElementType VARIABLE = new JSElementType("VARIABLE"); 
38     IElementType ARGUMENT_LIST = new JSElementType("ARGUMENT_LIST"); 
39    
40     // Statements 
41     IElementType BLOCK = new JSElementType("BLOCK"); 
42     IElementType LABELED_STATEMENT = new JSElementType("LABELED_STATEMENT"); 
43     IElementType EXPRESSION_STATEMENT = new JSElementType("EXPRESSION_STATEMENT"); 
44     IElementType VAR_STATEMENT = new JSElementType("VAR_STATEMENT"); 
45     IElementType EMPTY_STATEMENT = new JSElementType("EMPTY_STATEMENT"); 
46     IElementType IF_STATEMENT = new JSElementType("IF_STATEMENT"); 
47     IElementType CONTINUE_STATEMENT = new JSElementType("CONTINUE_STATEMENT"); 
48     IElementType BREAK_STATEMENT = new JSElementType("BREAK_STATEMENT"); 
49     IElementType WITH_STATEMENT = new JSElementType("WITH_STATEMENT"); 
50     IElementType RETURN_STATEMENT = new JSElementType("RETURN_STATEMENT"); 
51     IElementType THROW_STATEMENT = new JSElementType("THROW_STATEMENT"); 
52     IElementType TRY_STATEMENT = new JSElementType("TRY_STATEMENT"); 
53     IElementType CATCH_BLOCK = new JSElementType("CATCH_BLOCK"); 
54     IElementType SWITCH_STATEMENT = new JSElementType("SWITCH_STATEMENT"); 
55     IElementType CASE_CLAUSE = new JSElementType("CASE_CLAUSE"); 
56     IElementType FOR_STATEMENT = new JSElementType("FOR_STATEMENT"); 
57     IElementType FOR_IN_STATEMENT = new JSElementType("FOR_IN_STATEMENT"); 
58     IElementType WHILE_STATEMENT = new JSElementType("WHILE_STATEMENT"); 
59     IElementType DOWHILE_STATEMENT = new JSElementType("DOWHILE_STATEMENT"); 
60    
61     TokenSet STATEMENTS = TokenSet.create( 
62       BLOCK, LABELED_STATEMENT, VAR_STATEMENT, EMPTY_STATEMENT, IF_STATEMENT, CONTINUE_STATEMENT, BREAK_STATEMENT, WITH_STATEMENT, 
63       RETURN_STATEMENT, THROW_STATEMENT, TRY_STATEMENT, SWITCH_STATEMENT, FOR_IN_STATEMENT, FOR_STATEMENT, WHILE_STATEMENT, DOWHILE_STATEMENT, 
64       EXPRESSION_STATEMENT 
65     ); 
66    
67     TokenSet SOURCE_ELEMENTS = TokenSet.orSet(STATEMENTS, TokenSet.create(FUNCTION_DECLARATION)); 
68    
69     // Expressions 
70     IElementType THIS_EXPRESSION = new JSElementType("THIS_EXPRESSION"); 
71     IElementType REFERENCE_EXPRESSION = new JSElementType("REFERENCE_EXPRESSION"); 
72     IElementType LITERAL_EXPRESSION = new JSElementType("LITERAL_EXPRESSION"); 
73     IElementType PARENTHESIZED_EXPRESSION = new JSElementType("PARENTHESIZED_EXPRESSION"); 
74     IElementType ARRAY_LITERAL_EXPRESSION = new JSElementType("ARRAY_LITERAL_EXPRESSION"); 
75     IElementType OBJECT_LITERAL_EXPRESSION = new JSElementType("OBJECT_LITERAL_EXPRESSION"); 
76     IElementType PROPERTY = new JSElementType("PROPERTY"); 
77     IElementType ASSIGNMENT_EXPRESSION = new JSElementType("ASSIGNMENT_EXPRESSION"); 
78     IElementType CONDITIONAL_EXPRESSION = new JSElementType("CONDITIONAL_EXPRESSION"); 
79     IElementType BINARY_EXPRESSION = new JSElementType("BINARY_EXPRESSION"); 
80     IElementType PREFIX_EXPRESSION = new JSElementType("PREFIX_EXPRESSION"); 
81     IElementType POSTFIX_EXPRESSION = new JSElementType("POSTFIX_EXPRESSION"); 
82     IElementType COMMA_EXPRESSION = new JSElementType("COMMA_EXPRESSION"); 
83     IElementType FUNCTION_EXPRESSION = new JSElementType("FUNCTION_EXPRESSION"); 
84     IElementType NEW_EXPRESSION = new JSElementType("NEW_EXPRESSION"); 
85     IElementType INDEXED_PROPERTY_ACCESS_EXPRESSION = new JSElementType("INDEXED_PROPERTY_ACCESS_EXPRESSION"); 
86     IElementType CALL_EXPRESSION = new JSElementType("CALL_EXPRESSION"); 
87    
88     TokenSet EXPRESSIONS = TokenSet.create( 
89       THIS_EXPRESSION, REFERENCE_EXPRESSION, LITERAL_EXPRESSION, PARENTHESIZED_EXPRESSION, ARRAY_LITERAL_EXPRESSION, 
90       OBJECT_LITERAL_EXPRESSION, ASSIGNMENT_EXPRESSION, CONDITIONAL_EXPRESSION, BINARY_EXPRESSION, PREFIX_EXPRESSION, 
91       POSTFIX_EXPRESSION, COMMA_EXPRESSION, FUNCTION_EXPRESSION, NEW_EXPRESSION, INDEXED_PROPERTY_ACCESS_EXPRESSION,  CALL_EXPRESSION 
92     ); 
93   } 
94