diff --git a/gen/intellij/haskell/parser/HaskellParser.java b/gen/intellij/haskell/parser/HaskellParser.java index 3ead0098..8d4bc2cd 100644 --- a/gen/intellij/haskell/parser/HaskellParser.java +++ b/gen/intellij/haskell/parser/HaskellParser.java @@ -7,7 +7,6 @@ import com.intellij.lang.PsiBuilder; import com.intellij.lang.PsiBuilder.Marker; import com.intellij.lang.PsiParser; import com.intellij.psi.tree.IElementType; -import com.intellij.psi.tree.IFileElementType; import static intellij.haskell.psi.HaskellParserUtil.*; import static intellij.haskell.psi.HaskellTypes.*; @@ -24,16 +23,15 @@ public class HaskellParser implements PsiParser, LightPsiParser { boolean r; b = adapt_builder_(t, b, this, null); Marker m = enter_section_(b, 0, _COLLAPSE_, null); - if (t instanceof IFileElementType) { - r = parse_root_(t, b, 0); - } - else { - r = false; - } + r = parse_root_(t, b); exit_section_(b, 0, m, t, r, true, TRUE_CONDITION); } - protected boolean parse_root_(IElementType t, PsiBuilder b, int l) { + protected boolean parse_root_(IElementType t, PsiBuilder b) { + return parse_root_(t, b, 0); + } + + static boolean parse_root_(IElementType t, PsiBuilder b, int l) { return program(b, l + 1); } @@ -681,12 +679,14 @@ public class HaskellParser implements PsiParser, LightPsiParser { /* ********************************************************** */ // type_signature | cdecl_data_declaration | cidecl - static boolean cdecl(PsiBuilder b, int l) { + public static boolean cdecl(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "cdecl")) return false; boolean r; + Marker m = enter_section_(b, l, _NONE_, HS_CDECL, ""); r = type_signature(b, l + 1); if (!r) r = cdecl_data_declaration(b, l + 1); if (!r) r = cidecl(b, l + 1); + exit_section_(b, l, m, r, false, null); return r; } @@ -846,9 +846,10 @@ public class HaskellParser implements PsiParser, LightPsiParser { /* ********************************************************** */ // pragma | instance_declaration | default_declaration | // newtype_declaration | data_declaration | type_declaration | type_family_declaration | line_expression - static boolean cidecl(PsiBuilder b, int l) { + public static boolean cidecl(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "cidecl")) return false; boolean r; + Marker m = enter_section_(b, l, _NONE_, HS_CIDECL, ""); r = pragma(b, l + 1); if (!r) r = instance_declaration(b, l + 1); if (!r) r = default_declaration(b, l + 1); @@ -857,6 +858,7 @@ public class HaskellParser implements PsiParser, LightPsiParser { if (!r) r = type_declaration(b, l + 1); if (!r) r = type_family_declaration(b, l + 1); if (!r) r = line_expression(b, l + 1); + exit_section_(b, l, m, r, false, null); return r; } @@ -1268,32 +1270,6 @@ public class HaskellParser implements PsiParser, LightPsiParser { return true; } - /* ********************************************************** */ - // var | con | conop | varop - public static boolean cname(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "cname")) return false; - boolean r; - Marker m = enter_section_(b, l, _NONE_, HS_CNAME, ""); - r = var(b, l + 1); - if (!r) r = con(b, l + 1); - if (!r) r = conop(b, l + 1); - if (!r) r = varop(b, l + 1); - exit_section_(b, l, m, r, false, null); - return r; - } - - /* ********************************************************** */ - // dot_dot | cname - public static boolean cname_dot_dot(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "cname_dot_dot")) return false; - boolean r; - Marker m = enter_section_(b, l, _NONE_, HS_CNAME_DOT_DOT, ""); - r = dot_dot(b, l + 1); - if (!r) r = cname(b, l + 1); - exit_section_(b, l, m, r, false, null); - return r; - } - /* ********************************************************** */ // COMMENT | NCOMMENT | HADDOCK | NHADDOCK | NOT_TERMINATED_COMMENT public static boolean comments(PsiBuilder b, int l) { @@ -1309,31 +1285,6 @@ public class HaskellParser implements PsiParser, LightPsiParser { return r; } - /* ********************************************************** */ - // conid | LEFT_PAREN consym RIGHT_PAREN - public static boolean con(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "con")) return false; - if (!nextTokenIs(b, "", HS_CON_ID, HS_LEFT_PAREN)) return false; - boolean r; - Marker m = enter_section_(b, l, _NONE_, HS_CON, ""); - r = conid(b, l + 1); - if (!r) r = con_1(b, l + 1); - exit_section_(b, l, m, r, false, null); - return r; - } - - // LEFT_PAREN consym RIGHT_PAREN - private static boolean con_1(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "con_1")) return false; - boolean r; - Marker m = enter_section_(b); - r = consumeToken(b, HS_LEFT_PAREN); - r = r && consym(b, l + 1); - r = r && consumeToken(b, HS_RIGHT_PAREN); - exit_section_(b, m, null, r); - return r; - } - /* ********************************************************** */ // CON_ID "#"? public static boolean conid(PsiBuilder b, int l) { @@ -1354,31 +1305,6 @@ public class HaskellParser implements PsiParser, LightPsiParser { return true; } - /* ********************************************************** */ - // consym | BACKQUOTE conid BACKQUOTE - public static boolean conop(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "conop")) return false; - if (!nextTokenIs(b, "", HS_BACKQUOTE, HS_CONSYM_ID)) return false; - boolean r; - Marker m = enter_section_(b, l, _NONE_, HS_CONOP, ""); - r = consym(b, l + 1); - if (!r) r = conop_1(b, l + 1); - exit_section_(b, l, m, r, false, null); - return r; - } - - // BACKQUOTE conid BACKQUOTE - private static boolean conop_1(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "conop_1")) return false; - boolean r; - Marker m = enter_section_(b); - r = consumeToken(b, HS_BACKQUOTE); - r = r && conid(b, l + 1); - r = r && consumeToken(b, HS_BACKQUOTE); - exit_section_(b, m, null, r); - return r; - } - /* ********************************************************** */ // type_signature | constr1 | constr2 | constr3 public static boolean constr(PsiBuilder b, int l) { @@ -2311,126 +2237,22 @@ public class HaskellParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // export3 | export2 | export4 | export5 + // export1 | export2 | export3 public static boolean export(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "export")) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, HS_EXPORT, ""); - r = export3(b, l + 1); + r = export1(b, l + 1); if (!r) r = export2(b, l + 1); - if (!r) r = export4(b, l + 1); - if (!r) r = export5(b, l + 1); + if (!r) r = export3(b, l + 1); exit_section_(b, l, m, r, false, null); return r; } - /* ********************************************************** */ - // TYPE? onl cname+ - static boolean export2(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export2")) return false; - boolean r; - Marker m = enter_section_(b); - r = export2_0(b, l + 1); - r = r && onl(b, l + 1); - r = r && export2_2(b, l + 1); - exit_section_(b, m, null, r); - return r; - } - - // TYPE? - private static boolean export2_0(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export2_0")) return false; - consumeToken(b, HS_TYPE); - return true; - } - - // cname+ - private static boolean export2_2(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export2_2")) return false; - boolean r; - Marker m = enter_section_(b); - r = cname(b, l + 1); - while (r) { - int c = current_position_(b); - if (!cname(b, l + 1)) break; - if (!empty_element_parsed_guard_(b, "export2_2", c)) break; - } - exit_section_(b, m, null, r); - return r; - } - - /* ********************************************************** */ - // (q_con | cname) onl LEFT_PAREN (onl cname_dot_dot (onl COMMA onl cname_dot_dot)*)? onl RIGHT_PAREN - static boolean export3(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export3")) return false; - boolean r; - Marker m = enter_section_(b); - r = export3_0(b, l + 1); - r = r && onl(b, l + 1); - r = r && consumeToken(b, HS_LEFT_PAREN); - r = r && export3_3(b, l + 1); - r = r && onl(b, l + 1); - r = r && consumeToken(b, HS_RIGHT_PAREN); - exit_section_(b, m, null, r); - return r; - } - - // q_con | cname - private static boolean export3_0(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export3_0")) return false; - boolean r; - r = q_con(b, l + 1); - if (!r) r = cname(b, l + 1); - return r; - } - - // (onl cname_dot_dot (onl COMMA onl cname_dot_dot)*)? - private static boolean export3_3(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export3_3")) return false; - export3_3_0(b, l + 1); - return true; - } - - // onl cname_dot_dot (onl COMMA onl cname_dot_dot)* - private static boolean export3_3_0(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export3_3_0")) return false; - boolean r; - Marker m = enter_section_(b); - r = onl(b, l + 1); - r = r && cname_dot_dot(b, l + 1); - r = r && export3_3_0_2(b, l + 1); - exit_section_(b, m, null, r); - return r; - } - - // (onl COMMA onl cname_dot_dot)* - private static boolean export3_3_0_2(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export3_3_0_2")) return false; - while (true) { - int c = current_position_(b); - if (!export3_3_0_2_0(b, l + 1)) break; - if (!empty_element_parsed_guard_(b, "export3_3_0_2", c)) break; - } - return true; - } - - // onl COMMA onl cname_dot_dot - private static boolean export3_3_0_2_0(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export3_3_0_2_0")) return false; - boolean r; - Marker m = enter_section_(b); - r = onl(b, l + 1); - r = r && consumeToken(b, HS_COMMA); - r = r && onl(b, l + 1); - r = r && cname_dot_dot(b, l + 1); - exit_section_(b, m, null, r); - return r; - } - /* ********************************************************** */ // MODULE modid - static boolean export4(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export4")) return false; + static boolean export1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export1")) return false; if (!nextTokenIs(b, HS_MODULE)) return false; boolean r; Marker m = enter_section_(b); @@ -2441,44 +2263,121 @@ public class HaskellParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // conid DOT cname | LEFT_PAREN con DOT cname RIGHT_PAREN - static boolean export5(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export5")) return false; - if (!nextTokenIs(b, "", HS_CON_ID, HS_LEFT_PAREN)) return false; + // q_name (onl LEFT_PAREN (onl q_name (onl COMMA onl q_name)*)? onl RIGHT_PAREN | onl LEFT_PAREN onl dot_dot onl RIGHT_PAREN)? + static boolean export2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export2")) return false; boolean r; Marker m = enter_section_(b); - r = export5_0(b, l + 1); - if (!r) r = export5_1(b, l + 1); + r = q_name(b, l + 1); + r = r && export2_1(b, l + 1); exit_section_(b, m, null, r); return r; } - // conid DOT cname - private static boolean export5_0(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export5_0")) return false; + // (onl LEFT_PAREN (onl q_name (onl COMMA onl q_name)*)? onl RIGHT_PAREN | onl LEFT_PAREN onl dot_dot onl RIGHT_PAREN)? + private static boolean export2_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export2_1")) return false; + export2_1_0(b, l + 1); + return true; + } + + // onl LEFT_PAREN (onl q_name (onl COMMA onl q_name)*)? onl RIGHT_PAREN | onl LEFT_PAREN onl dot_dot onl RIGHT_PAREN + private static boolean export2_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export2_1_0")) return false; boolean r; Marker m = enter_section_(b); - r = conid(b, l + 1); - r = r && consumeToken(b, HS_DOT); - r = r && cname(b, l + 1); + r = export2_1_0_0(b, l + 1); + if (!r) r = export2_1_0_1(b, l + 1); exit_section_(b, m, null, r); return r; } - // LEFT_PAREN con DOT cname RIGHT_PAREN - private static boolean export5_1(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "export5_1")) return false; + // onl LEFT_PAREN (onl q_name (onl COMMA onl q_name)*)? onl RIGHT_PAREN + private static boolean export2_1_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export2_1_0_0")) return false; boolean r; Marker m = enter_section_(b); - r = consumeToken(b, HS_LEFT_PAREN); - r = r && con(b, l + 1); - r = r && consumeToken(b, HS_DOT); - r = r && cname(b, l + 1); + r = onl(b, l + 1); + r = r && consumeToken(b, HS_LEFT_PAREN); + r = r && export2_1_0_0_2(b, l + 1); + r = r && onl(b, l + 1); r = r && consumeToken(b, HS_RIGHT_PAREN); exit_section_(b, m, null, r); return r; } + // (onl q_name (onl COMMA onl q_name)*)? + private static boolean export2_1_0_0_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export2_1_0_0_2")) return false; + export2_1_0_0_2_0(b, l + 1); + return true; + } + + // onl q_name (onl COMMA onl q_name)* + private static boolean export2_1_0_0_2_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export2_1_0_0_2_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = onl(b, l + 1); + r = r && q_name(b, l + 1); + r = r && export2_1_0_0_2_0_2(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // (onl COMMA onl q_name)* + private static boolean export2_1_0_0_2_0_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export2_1_0_0_2_0_2")) return false; + while (true) { + int c = current_position_(b); + if (!export2_1_0_0_2_0_2_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "export2_1_0_0_2_0_2", c)) break; + } + return true; + } + + // onl COMMA onl q_name + private static boolean export2_1_0_0_2_0_2_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export2_1_0_0_2_0_2_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = onl(b, l + 1); + r = r && consumeToken(b, HS_COMMA); + r = r && onl(b, l + 1); + r = r && q_name(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // onl LEFT_PAREN onl dot_dot onl RIGHT_PAREN + private static boolean export2_1_0_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export2_1_0_1")) return false; + boolean r; + Marker m = enter_section_(b); + r = onl(b, l + 1); + r = r && consumeToken(b, HS_LEFT_PAREN); + r = r && onl(b, l + 1); + r = r && dot_dot(b, l + 1); + r = r && onl(b, l + 1); + r = r && consumeToken(b, HS_RIGHT_PAREN); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // TYPE onl conid + static boolean export3(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "export3")) return false; + if (!nextTokenIs(b, HS_TYPE)) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, HS_TYPE); + r = r && onl(b, l + 1); + r = r && conid(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + /* ********************************************************** */ // LEFT_PAREN onl export ((onl COMMA)? onl export)* (onl COMMA)? onl RIGHT_PAREN | LEFT_PAREN RIGHT_PAREN public static boolean exports(PsiBuilder b, int l) { @@ -3146,7 +3045,7 @@ public class HaskellParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // TYPE? (cname onls LEFT_PAREN onls (cname_dot_dot onls (COMMA onls cname_dot_dot onls)* onls)? RIGHT_PAREN | cname) + // TYPE? (q_name onls LEFT_PAREN onls (q_name onls (COMMA onls q_name onls)* onls)? RIGHT_PAREN | q_name LEFT_PAREN onls dot_dot onls RIGHT_PAREN | q_name) public static boolean import_id(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "import_id")) return false; boolean r; @@ -3164,23 +3063,24 @@ public class HaskellParser implements PsiParser, LightPsiParser { return true; } - // cname onls LEFT_PAREN onls (cname_dot_dot onls (COMMA onls cname_dot_dot onls)* onls)? RIGHT_PAREN | cname + // q_name onls LEFT_PAREN onls (q_name onls (COMMA onls q_name onls)* onls)? RIGHT_PAREN | q_name LEFT_PAREN onls dot_dot onls RIGHT_PAREN | q_name private static boolean import_id_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "import_id_1")) return false; boolean r; Marker m = enter_section_(b); r = import_id_1_0(b, l + 1); - if (!r) r = cname(b, l + 1); + if (!r) r = import_id_1_1(b, l + 1); + if (!r) r = q_name(b, l + 1); exit_section_(b, m, null, r); return r; } - // cname onls LEFT_PAREN onls (cname_dot_dot onls (COMMA onls cname_dot_dot onls)* onls)? RIGHT_PAREN + // q_name onls LEFT_PAREN onls (q_name onls (COMMA onls q_name onls)* onls)? RIGHT_PAREN private static boolean import_id_1_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "import_id_1_0")) return false; boolean r; Marker m = enter_section_(b); - r = cname(b, l + 1); + r = q_name(b, l + 1); r = r && onls(b, l + 1); r = r && consumeToken(b, HS_LEFT_PAREN); r = r && onls(b, l + 1); @@ -3190,19 +3090,19 @@ public class HaskellParser implements PsiParser, LightPsiParser { return r; } - // (cname_dot_dot onls (COMMA onls cname_dot_dot onls)* onls)? + // (q_name onls (COMMA onls q_name onls)* onls)? private static boolean import_id_1_0_4(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "import_id_1_0_4")) return false; import_id_1_0_4_0(b, l + 1); return true; } - // cname_dot_dot onls (COMMA onls cname_dot_dot onls)* onls + // q_name onls (COMMA onls q_name onls)* onls private static boolean import_id_1_0_4_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "import_id_1_0_4_0")) return false; boolean r; Marker m = enter_section_(b); - r = cname_dot_dot(b, l + 1); + r = q_name(b, l + 1); r = r && onls(b, l + 1); r = r && import_id_1_0_4_0_2(b, l + 1); r = r && onls(b, l + 1); @@ -3210,7 +3110,7 @@ public class HaskellParser implements PsiParser, LightPsiParser { return r; } - // (COMMA onls cname_dot_dot onls)* + // (COMMA onls q_name onls)* private static boolean import_id_1_0_4_0_2(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "import_id_1_0_4_0_2")) return false; while (true) { @@ -3221,19 +3121,34 @@ public class HaskellParser implements PsiParser, LightPsiParser { return true; } - // COMMA onls cname_dot_dot onls + // COMMA onls q_name onls private static boolean import_id_1_0_4_0_2_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "import_id_1_0_4_0_2_0")) return false; boolean r; Marker m = enter_section_(b); r = consumeToken(b, HS_COMMA); r = r && onls(b, l + 1); - r = r && cname_dot_dot(b, l + 1); + r = r && q_name(b, l + 1); r = r && onls(b, l + 1); exit_section_(b, m, null, r); return r; } + // q_name LEFT_PAREN onls dot_dot onls RIGHT_PAREN + private static boolean import_id_1_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "import_id_1_1")) return false; + boolean r; + Marker m = enter_section_(b); + r = q_name(b, l + 1); + r = r && consumeToken(b, HS_LEFT_PAREN); + r = r && onls(b, l + 1); + r = r && dot_dot(b, l + 1); + r = r && onls(b, l + 1); + r = r && consumeToken(b, HS_RIGHT_PAREN); + exit_section_(b, m, null, r); + return r; + } + /* ********************************************************** */ // LEFT_PAREN onls import_id (onls COMMA? onls import_id)* onls (COMMA)? onls RIGHT_PAREN public static boolean import_ids_spec(PsiBuilder b, int l) { @@ -3343,7 +3258,7 @@ public class HaskellParser implements PsiParser, LightPsiParser { /* ********************************************************** */ // gtycon+ instvar* (LEFT_PAREN onls gtycon (instvar)* onls RIGHT_PAREN)* instvar* | - // (LEFT_PAREN onls instvar (onls COMMA onls instvar)+ onls RIGHT_PAREN)+ instvar* | + // (LEFT_PAREN onls instvar (onls COMMA onls instvar)* onls RIGHT_PAREN)+ instvar* | // QUOTE? (LEFT_BRACKET onls instvar onls RIGHT_BRACKET)+ instvar* | // (LEFT_PAREN onls instvar+ onls RIGHT_PAREN)+ instvar* | // ((LEFT_PAREN onls instvar+ (onls RIGHT_ARROW onls instvar+)+ onls RIGHT_PAREN)+ instvar*)+ @@ -3457,7 +3372,7 @@ public class HaskellParser implements PsiParser, LightPsiParser { return true; } - // (LEFT_PAREN onls instvar (onls COMMA onls instvar)+ onls RIGHT_PAREN)+ instvar* + // (LEFT_PAREN onls instvar (onls COMMA onls instvar)* onls RIGHT_PAREN)+ instvar* private static boolean inst_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "inst_1")) return false; boolean r; @@ -3468,7 +3383,7 @@ public class HaskellParser implements PsiParser, LightPsiParser { return r; } - // (LEFT_PAREN onls instvar (onls COMMA onls instvar)+ onls RIGHT_PAREN)+ + // (LEFT_PAREN onls instvar (onls COMMA onls instvar)* onls RIGHT_PAREN)+ private static boolean inst_1_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "inst_1_0")) return false; boolean r; @@ -3483,7 +3398,7 @@ public class HaskellParser implements PsiParser, LightPsiParser { return r; } - // LEFT_PAREN onls instvar (onls COMMA onls instvar)+ onls RIGHT_PAREN + // LEFT_PAREN onls instvar (onls COMMA onls instvar)* onls RIGHT_PAREN private static boolean inst_1_0_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "inst_1_0_0")) return false; boolean r; @@ -3498,19 +3413,15 @@ public class HaskellParser implements PsiParser, LightPsiParser { return r; } - // (onls COMMA onls instvar)+ + // (onls COMMA onls instvar)* private static boolean inst_1_0_0_3(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "inst_1_0_0_3")) return false; - boolean r; - Marker m = enter_section_(b); - r = inst_1_0_0_3_0(b, l + 1); - while (r) { + while (true) { int c = current_position_(b); if (!inst_1_0_0_3_0(b, l + 1)) break; if (!empty_element_parsed_guard_(b, "inst_1_0_0_3", c)) break; } - exit_section_(b, m, null, r); - return r; + return true; } // onls COMMA onls instvar @@ -3788,7 +3699,7 @@ public class HaskellParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // INSTANCE onls ("OVERLAPPABLE_" | "OVERLAPPING_" | pragma)? onls (var_con+ DOT)? onls (scontext onls DOUBLE_RIGHT_ARROW)? onls + // INSTANCE onls ("OVERLAPPABLE_" | "OVERLAPPING_" | pragma)? onls (varid+ DOT)? onls (scontext onls DOUBLE_RIGHT_ARROW)? onls // (type_equality | q_name onls inst (onls WHERE (onls cidecls)?)?) public static boolean instance_declaration(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "instance_declaration")) return false; @@ -3827,14 +3738,14 @@ public class HaskellParser implements PsiParser, LightPsiParser { return r; } - // (var_con+ DOT)? + // (varid+ DOT)? private static boolean instance_declaration_4(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "instance_declaration_4")) return false; instance_declaration_4_0(b, l + 1); return true; } - // var_con+ DOT + // varid+ DOT private static boolean instance_declaration_4_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "instance_declaration_4_0")) return false; boolean r; @@ -3845,15 +3756,15 @@ public class HaskellParser implements PsiParser, LightPsiParser { return r; } - // var_con+ + // varid+ private static boolean instance_declaration_4_0_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "instance_declaration_4_0_0")) return false; boolean r; Marker m = enter_section_(b); - r = var_con(b, l + 1); + r = varid(b, l + 1); while (r) { int c = current_position_(b); - if (!var_con(b, l + 1)) break; + if (!varid(b, l + 1)) break; if (!empty_element_parsed_guard_(b, "instance_declaration_4_0_0", c)) break; } exit_section_(b, m, null, r); @@ -6160,31 +6071,6 @@ public class HaskellParser implements PsiParser, LightPsiParser { return r; } - /* ********************************************************** */ - // varid | LEFT_PAREN varsym RIGHT_PAREN - public static boolean var(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "var")) return false; - if (!nextTokenIs(b, "", HS_LEFT_PAREN, HS_VAR_ID)) return false; - boolean r; - Marker m = enter_section_(b, l, _NONE_, HS_VAR, ""); - r = varid(b, l + 1); - if (!r) r = var_1(b, l + 1); - exit_section_(b, l, m, r, false, null); - return r; - } - - // LEFT_PAREN varsym RIGHT_PAREN - private static boolean var_1(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "var_1")) return false; - boolean r; - Marker m = enter_section_(b); - r = consumeToken(b, HS_LEFT_PAREN); - r = r && varsym(b, l + 1); - r = r && consumeToken(b, HS_RIGHT_PAREN); - exit_section_(b, m, null, r); - return r; - } - /* ********************************************************** */ // varid | consym | varsym | conid public static boolean var_con(PsiBuilder b, int l) { @@ -6219,30 +6105,6 @@ public class HaskellParser implements PsiParser, LightPsiParser { return true; } - /* ********************************************************** */ - // varsym | BACKQUOTE varid BACKQUOTE - public static boolean varop(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "varop")) return false; - boolean r; - Marker m = enter_section_(b, l, _NONE_, HS_VAROP, ""); - r = varsym(b, l + 1); - if (!r) r = varop_1(b, l + 1); - exit_section_(b, l, m, r, false, null); - return r; - } - - // BACKQUOTE varid BACKQUOTE - private static boolean varop_1(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "varop_1")) return false; - boolean r; - Marker m = enter_section_(b); - r = consumeToken(b, HS_BACKQUOTE); - r = r && varid(b, l + 1); - r = r && consumeToken(b, HS_BACKQUOTE); - exit_section_(b, m, null, r); - return r; - } - /* ********************************************************** */ // VARSYM_ID | DOT+ VARSYM_ID | DOT+ EQUAL | DOT+ BACKSLASH | DOT+ TILDE | DOT+ AT | DOT+ CONSYM_ID | DOT+ VERTICAL_BAR | DOT DOT DOT+ | DOT public static boolean varsym(PsiBuilder b, int l) { diff --git a/gen/intellij/haskell/psi/HaskellCdecl.java b/gen/intellij/haskell/psi/HaskellCdecl.java new file mode 100644 index 00000000..62489e70 --- /dev/null +++ b/gen/intellij/haskell/psi/HaskellCdecl.java @@ -0,0 +1,17 @@ +// This is a generated file. Not intended for manual editing. +package intellij.haskell.psi; + +import org.jetbrains.annotations.Nullable; + +public interface HaskellCdecl extends HaskellCompositeElement { + + @Nullable + HaskellCdeclDataDeclaration getCdeclDataDeclaration(); + + @Nullable + HaskellCidecl getCidecl(); + + @Nullable + HaskellTypeSignature getTypeSignature(); + +} diff --git a/gen/intellij/haskell/psi/HaskellCdecls.java b/gen/intellij/haskell/psi/HaskellCdecls.java index c8eb45d8..584e4b19 100644 --- a/gen/intellij/haskell/psi/HaskellCdecls.java +++ b/gen/intellij/haskell/psi/HaskellCdecls.java @@ -1,49 +1,13 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi; +import org.jetbrains.annotations.NotNull; + import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; public interface HaskellCdecls extends HaskellCompositeElement { @NotNull - List getCdeclDataDeclarationList(); - - @NotNull - List getDataDeclarationList(); - - @NotNull - List getDefaultDeclarationList(); - - @NotNull - List getDotDotList(); - - @NotNull - List getInstanceDeclarationList(); - - @NotNull - List getNewtypeDeclarationList(); - - @NotNull - List getPragmaList(); - - @NotNull - List getQNameList(); - - @NotNull - List getReservedIdList(); - - @NotNull - List getTextLiteralList(); - - @NotNull - List getTypeDeclarationList(); - - @NotNull - List getTypeFamilyDeclarationList(); - - @NotNull - List getTypeSignatureList(); + List getCdeclList(); } diff --git a/gen/intellij/haskell/psi/HaskellCidecl.java b/gen/intellij/haskell/psi/HaskellCidecl.java new file mode 100644 index 00000000..8c930c30 --- /dev/null +++ b/gen/intellij/haskell/psi/HaskellCidecl.java @@ -0,0 +1,44 @@ +// This is a generated file. Not intended for manual editing. +package intellij.haskell.psi; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public interface HaskellCidecl extends HaskellCompositeElement { + + @Nullable + HaskellDataDeclaration getDataDeclaration(); + + @Nullable + HaskellDefaultDeclaration getDefaultDeclaration(); + + @NotNull + List getDotDotList(); + + @Nullable + HaskellInstanceDeclaration getInstanceDeclaration(); + + @Nullable + HaskellNewtypeDeclaration getNewtypeDeclaration(); + + @Nullable + HaskellPragma getPragma(); + + @NotNull + List getQNameList(); + + @NotNull + List getReservedIdList(); + + @NotNull + List getTextLiteralList(); + + @Nullable + HaskellTypeDeclaration getTypeDeclaration(); + + @Nullable + HaskellTypeFamilyDeclaration getTypeFamilyDeclaration(); + +} diff --git a/gen/intellij/haskell/psi/HaskellCidecls.java b/gen/intellij/haskell/psi/HaskellCidecls.java index f416ace5..c37ebea3 100644 --- a/gen/intellij/haskell/psi/HaskellCidecls.java +++ b/gen/intellij/haskell/psi/HaskellCidecls.java @@ -1,43 +1,13 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi; +import org.jetbrains.annotations.NotNull; + import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; public interface HaskellCidecls extends HaskellCompositeElement { @NotNull - List getDataDeclarationList(); - - @NotNull - List getDefaultDeclarationList(); - - @NotNull - List getDotDotList(); - - @NotNull - List getInstanceDeclarationList(); - - @NotNull - List getNewtypeDeclarationList(); - - @NotNull - List getPragmaList(); - - @NotNull - List getQNameList(); - - @NotNull - List getReservedIdList(); - - @NotNull - List getTextLiteralList(); - - @NotNull - List getTypeDeclarationList(); - - @NotNull - List getTypeFamilyDeclarationList(); + List getCideclList(); } diff --git a/gen/intellij/haskell/psi/HaskellCname.java b/gen/intellij/haskell/psi/HaskellCname.java deleted file mode 100644 index a2ca7707..00000000 --- a/gen/intellij/haskell/psi/HaskellCname.java +++ /dev/null @@ -1,29 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; -import scala.Option; - -public interface HaskellCname extends HaskellQualifiedNameElement { - - @Nullable - HaskellCon getCon(); - - @Nullable - HaskellConop getConop(); - - @Nullable - HaskellVar getVar(); - - @Nullable - HaskellVarop getVarop(); - - String getName(); - - HaskellNamedElement getIdentifierElement(); - - Option getQualifierName(); - -} diff --git a/gen/intellij/haskell/psi/HaskellCnameDotDot.java b/gen/intellij/haskell/psi/HaskellCnameDotDot.java deleted file mode 100644 index 67bc7535..00000000 --- a/gen/intellij/haskell/psi/HaskellCnameDotDot.java +++ /dev/null @@ -1,16 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; - -public interface HaskellCnameDotDot extends HaskellCompositeElement { - - @Nullable - HaskellCname getCname(); - - @Nullable - HaskellDotDot getDotDot(); - -} diff --git a/gen/intellij/haskell/psi/HaskellCon.java b/gen/intellij/haskell/psi/HaskellCon.java deleted file mode 100644 index 458fe6da..00000000 --- a/gen/intellij/haskell/psi/HaskellCon.java +++ /dev/null @@ -1,18 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; - -public interface HaskellCon extends HaskellCNameElement { - - @Nullable - HaskellConid getConid(); - - @Nullable - HaskellConsym getConsym(); - - String getName(); - -} diff --git a/gen/intellij/haskell/psi/HaskellConop.java b/gen/intellij/haskell/psi/HaskellConop.java deleted file mode 100644 index d6adfdff..00000000 --- a/gen/intellij/haskell/psi/HaskellConop.java +++ /dev/null @@ -1,18 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; - -public interface HaskellConop extends HaskellCNameElement { - - @Nullable - HaskellConid getConid(); - - @Nullable - HaskellConsym getConsym(); - - String getName(); - -} diff --git a/gen/intellij/haskell/psi/HaskellExport.java b/gen/intellij/haskell/psi/HaskellExport.java index 5469aa0a..bd98cf34 100644 --- a/gen/intellij/haskell/psi/HaskellExport.java +++ b/gen/intellij/haskell/psi/HaskellExport.java @@ -1,28 +1,23 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; public interface HaskellExport extends HaskellCompositeElement { - @Nullable - HaskellCname getCname(); - - @NotNull - List getCnameDotDotList(); - - @Nullable - HaskellCon getCon(); - @Nullable HaskellConid getConid(); @Nullable - HaskellModid getModid(); + HaskellDotDot getDotDot(); @Nullable - HaskellQCon getQCon(); + HaskellModid getModid(); + + @NotNull + List getQNameList(); } diff --git a/gen/intellij/haskell/psi/HaskellImportId.java b/gen/intellij/haskell/psi/HaskellImportId.java index 161927b9..7e4b6c26 100644 --- a/gen/intellij/haskell/psi/HaskellImportId.java +++ b/gen/intellij/haskell/psi/HaskellImportId.java @@ -1,16 +1,17 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; public interface HaskellImportId extends HaskellCompositeElement { - @NotNull - HaskellCname getCname(); + @Nullable + HaskellDotDot getDotDot(); @NotNull - List getCnameDotDotList(); + List getQNameList(); } diff --git a/gen/intellij/haskell/psi/HaskellInstanceDeclaration.java b/gen/intellij/haskell/psi/HaskellInstanceDeclaration.java index 9f4fa3c9..62a59e0d 100644 --- a/gen/intellij/haskell/psi/HaskellInstanceDeclaration.java +++ b/gen/intellij/haskell/psi/HaskellInstanceDeclaration.java @@ -30,7 +30,7 @@ public interface HaskellInstanceDeclaration extends HaskellDeclarationElement { HaskellTypeEquality getTypeEquality(); @NotNull - List getVarConList(); + List getVaridList(); String getName(); diff --git a/gen/intellij/haskell/psi/HaskellTypes.java b/gen/intellij/haskell/psi/HaskellTypes.java index c214761c..139ded95 100644 --- a/gen/intellij/haskell/psi/HaskellTypes.java +++ b/gen/intellij/haskell/psi/HaskellTypes.java @@ -1,26 +1,23 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi; -import com.intellij.psi.tree.IElementType; -import com.intellij.psi.PsiElement; import com.intellij.lang.ASTNode; -import intellij.haskell.psi.impl.HaskellElementTypeFactory; +import com.intellij.psi.PsiElement; +import com.intellij.psi.tree.IElementType; import intellij.haskell.psi.impl.*; public interface HaskellTypes { IElementType HS_CCONTEXT = new HaskellCompositeElementType("HS_CCONTEXT"); + IElementType HS_CDECL = new HaskellCompositeElementType("HS_CDECL"); IElementType HS_CDECLS = new HaskellCompositeElementType("HS_CDECLS"); IElementType HS_CDECL_DATA_DECLARATION = new HaskellCompositeElementType("HS_CDECL_DATA_DECLARATION"); + IElementType HS_CIDECL = new HaskellCompositeElementType("HS_CIDECL"); IElementType HS_CIDECLS = new HaskellCompositeElementType("HS_CIDECLS"); IElementType HS_CLASS_DECLARATION = new HaskellCompositeElementType("HS_CLASS_DECLARATION"); IElementType HS_CLAZZ = new HaskellCompositeElementType("HS_CLAZZ"); - IElementType HS_CNAME = new HaskellCompositeElementType("HS_CNAME"); - IElementType HS_CNAME_DOT_DOT = new HaskellCompositeElementType("HS_CNAME_DOT_DOT"); IElementType HS_COMMENTS = new HaskellCompositeElementType("HS_COMMENTS"); - IElementType HS_CON = new HaskellCompositeElementType("HS_CON"); IElementType HS_CONID = HaskellElementTypeFactory.factory("HS_CONID"); - IElementType HS_CONOP = new HaskellCompositeElementType("HS_CONOP"); IElementType HS_CONSTR = new HaskellCompositeElementType("HS_CONSTR"); IElementType HS_CONSTR_1 = new HaskellCompositeElementType("HS_CONSTR_1"); IElementType HS_CONSTR_2 = new HaskellCompositeElementType("HS_CONSTR_2"); @@ -90,9 +87,7 @@ public interface HaskellTypes { IElementType HS_TYPE_FAMILY_TYPE = new HaskellCompositeElementType("HS_TYPE_FAMILY_TYPE"); IElementType HS_TYPE_INSTANCE_DECLARATION = new HaskellCompositeElementType("HS_TYPE_INSTANCE_DECLARATION"); IElementType HS_TYPE_SIGNATURE = new HaskellCompositeElementType("HS_TYPE_SIGNATURE"); - IElementType HS_VAR = new HaskellCompositeElementType("HS_VAR"); IElementType HS_VARID = HaskellElementTypeFactory.factory("HS_VARID"); - IElementType HS_VAROP = new HaskellCompositeElementType("HS_VAROP"); IElementType HS_VARSYM = HaskellElementTypeFactory.factory("HS_VARSYM"); IElementType HS_VAR_CON = new HaskellCompositeElementType("HS_VAR_CON"); @@ -174,260 +169,167 @@ public interface HaskellTypes { IElementType type = node.getElementType(); if (type == HS_CCONTEXT) { return new HaskellCcontextImpl(node); - } - else if (type == HS_CDECLS) { + } else if (type == HS_CDECL) { + return new HaskellCdeclImpl(node); + } else if (type == HS_CDECLS) { return new HaskellCdeclsImpl(node); - } - else if (type == HS_CDECL_DATA_DECLARATION) { + } else if (type == HS_CDECL_DATA_DECLARATION) { return new HaskellCdeclDataDeclarationImpl(node); - } - else if (type == HS_CIDECLS) { + } else if (type == HS_CIDECL) { + return new HaskellCideclImpl(node); + } else if (type == HS_CIDECLS) { return new HaskellCideclsImpl(node); - } - else if (type == HS_CLASS_DECLARATION) { + } else if (type == HS_CLASS_DECLARATION) { return new HaskellClassDeclarationImpl(node); - } - else if (type == HS_CLAZZ) { + } else if (type == HS_CLAZZ) { return new HaskellClazzImpl(node); - } - else if (type == HS_CNAME) { - return new HaskellCnameImpl(node); - } - else if (type == HS_CNAME_DOT_DOT) { - return new HaskellCnameDotDotImpl(node); - } - else if (type == HS_COMMENTS) { + } else if (type == HS_COMMENTS) { return new HaskellCommentsImpl(node); - } - else if (type == HS_CON) { - return new HaskellConImpl(node); - } - else if (type == HS_CONID) { + } else if (type == HS_CONID) { return new HaskellConidImpl(node); - } - else if (type == HS_CONOP) { - return new HaskellConopImpl(node); - } - else if (type == HS_CONSTR) { + } else if (type == HS_CONSTR) { return new HaskellConstrImpl(node); - } - else if (type == HS_CONSTR_1) { + } else if (type == HS_CONSTR_1) { return new HaskellConstr1Impl(node); - } - else if (type == HS_CONSTR_2) { + } else if (type == HS_CONSTR_2) { return new HaskellConstr2Impl(node); - } - else if (type == HS_CONSTR_3) { + } else if (type == HS_CONSTR_3) { return new HaskellConstr3Impl(node); - } - else if (type == HS_CONSYM) { + } else if (type == HS_CONSYM) { return new HaskellConsymImpl(node); - } - else if (type == HS_DATA_DECLARATION) { + } else if (type == HS_DATA_DECLARATION) { return new HaskellDataDeclarationImpl(node); - } - else if (type == HS_DATA_DECLARATION_DERIVING) { + } else if (type == HS_DATA_DECLARATION_DERIVING) { return new HaskellDataDeclarationDerivingImpl(node); - } - else if (type == HS_DEFAULT_DECLARATION) { + } else if (type == HS_DEFAULT_DECLARATION) { return new HaskellDefaultDeclarationImpl(node); - } - else if (type == HS_DERIVING_DECLARATION) { + } else if (type == HS_DERIVING_DECLARATION) { return new HaskellDerivingDeclarationImpl(node); - } - else if (type == HS_DOT_DOT) { + } else if (type == HS_DOT_DOT) { return new HaskellDotDotImpl(node); - } - else if (type == HS_EXPORT) { + } else if (type == HS_EXPORT) { return new HaskellExportImpl(node); - } - else if (type == HS_EXPORTS) { + } else if (type == HS_EXPORTS) { return new HaskellExportsImpl(node); - } - else if (type == HS_EXPRESSION) { + } else if (type == HS_EXPRESSION) { return new HaskellExpressionImpl(node); - } - else if (type == HS_FIELDDECL) { + } else if (type == HS_FIELDDECL) { return new HaskellFielddeclImpl(node); - } - else if (type == HS_FILE_HEADER) { + } else if (type == HS_FILE_HEADER) { return new HaskellFileHeaderImpl(node); - } - else if (type == HS_FIXITY_DECLARATION) { + } else if (type == HS_FIXITY_DECLARATION) { return new HaskellFixityDeclarationImpl(node); - } - else if (type == HS_FOREIGN_DECLARATION) { + } else if (type == HS_FOREIGN_DECLARATION) { return new HaskellForeignDeclarationImpl(node); - } - else if (type == HS_GENERAL_PRAGMA_CONTENT) { + } else if (type == HS_GENERAL_PRAGMA_CONTENT) { return new HaskellGeneralPragmaContentImpl(node); - } - else if (type == HS_GTYCON) { + } else if (type == HS_GTYCON) { return new HaskellGtyconImpl(node); - } - else if (type == HS_IMPORT_DECLARATION) { + } else if (type == HS_IMPORT_DECLARATION) { return new HaskellImportDeclarationImpl(node); - } - else if (type == HS_IMPORT_DECLARATIONS) { + } else if (type == HS_IMPORT_DECLARATIONS) { return new HaskellImportDeclarationsImpl(node); - } - else if (type == HS_IMPORT_EMPTY_SPEC) { + } else if (type == HS_IMPORT_EMPTY_SPEC) { return new HaskellImportEmptySpecImpl(node); - } - else if (type == HS_IMPORT_HIDING) { + } else if (type == HS_IMPORT_HIDING) { return new HaskellImportHidingImpl(node); - } - else if (type == HS_IMPORT_HIDING_SPEC) { + } else if (type == HS_IMPORT_HIDING_SPEC) { return new HaskellImportHidingSpecImpl(node); - } - else if (type == HS_IMPORT_ID) { + } else if (type == HS_IMPORT_ID) { return new HaskellImportIdImpl(node); - } - else if (type == HS_IMPORT_IDS_SPEC) { + } else if (type == HS_IMPORT_IDS_SPEC) { return new HaskellImportIdsSpecImpl(node); - } - else if (type == HS_IMPORT_PACKAGE_NAME) { + } else if (type == HS_IMPORT_PACKAGE_NAME) { return new HaskellImportPackageNameImpl(node); - } - else if (type == HS_IMPORT_QUALIFIED) { + } else if (type == HS_IMPORT_QUALIFIED) { return new HaskellImportQualifiedImpl(node); - } - else if (type == HS_IMPORT_QUALIFIED_AS) { + } else if (type == HS_IMPORT_QUALIFIED_AS) { return new HaskellImportQualifiedAsImpl(node); - } - else if (type == HS_IMPORT_SPEC) { + } else if (type == HS_IMPORT_SPEC) { return new HaskellImportSpecImpl(node); - } - else if (type == HS_INST) { + } else if (type == HS_INST) { return new HaskellInstImpl(node); - } - else if (type == HS_INSTANCE_DECLARATION) { + } else if (type == HS_INSTANCE_DECLARATION) { return new HaskellInstanceDeclarationImpl(node); - } - else if (type == HS_INSTVAR) { + } else if (type == HS_INSTVAR) { return new HaskellInstvarImpl(node); - } - else if (type == HS_KIND_SIGNATURE) { + } else if (type == HS_KIND_SIGNATURE) { return new HaskellKindSignatureImpl(node); - } - else if (type == HS_LIST_TYPE) { + } else if (type == HS_LIST_TYPE) { return new HaskellListTypeImpl(node); - } - else if (type == HS_MODID) { + } else if (type == HS_MODID) { return new HaskellModidImpl(node); - } - else if (type == HS_MODULE_BODY) { + } else if (type == HS_MODULE_BODY) { return new HaskellModuleBodyImpl(node); - } - else if (type == HS_MODULE_DECLARATION) { + } else if (type == HS_MODULE_DECLARATION) { return new HaskellModuleDeclarationImpl(node); - } - else if (type == HS_NEWCONSTR) { + } else if (type == HS_NEWCONSTR) { return new HaskellNewconstrImpl(node); - } - else if (type == HS_NEWCONSTR_FIELDDECL) { + } else if (type == HS_NEWCONSTR_FIELDDECL) { return new HaskellNewconstrFielddeclImpl(node); - } - else if (type == HS_NEWTYPE_DECLARATION) { + } else if (type == HS_NEWTYPE_DECLARATION) { return new HaskellNewtypeDeclarationImpl(node); - } - else if (type == HS_PRAGMA) { + } else if (type == HS_PRAGMA) { return new HaskellPragmaImpl(node); - } - else if (type == HS_QUALIFIER) { + } else if (type == HS_QUALIFIER) { return new HaskellQualifierImpl(node); - } - else if (type == HS_Q_CON) { + } else if (type == HS_Q_CON) { return new HaskellQConImpl(node); - } - else if (type == HS_Q_CON_QUALIFIER) { + } else if (type == HS_Q_CON_QUALIFIER) { return new HaskellQConQualifierImpl(node); - } - else if (type == HS_Q_CON_QUALIFIER_1) { + } else if (type == HS_Q_CON_QUALIFIER_1) { return new HaskellQConQualifier1Impl(node); - } - else if (type == HS_Q_CON_QUALIFIER_2) { + } else if (type == HS_Q_CON_QUALIFIER_2) { return new HaskellQConQualifier2Impl(node); - } - else if (type == HS_Q_CON_QUALIFIER_3) { + } else if (type == HS_Q_CON_QUALIFIER_3) { return new HaskellQConQualifier3Impl(node); - } - else if (type == HS_Q_CON_QUALIFIER_4) { + } else if (type == HS_Q_CON_QUALIFIER_4) { return new HaskellQConQualifier4Impl(node); - } - else if (type == HS_Q_NAME) { + } else if (type == HS_Q_NAME) { return new HaskellQNameImpl(node); - } - else if (type == HS_Q_NAMES) { + } else if (type == HS_Q_NAMES) { return new HaskellQNamesImpl(node); - } - else if (type == HS_Q_VAR_CON) { + } else if (type == HS_Q_VAR_CON) { return new HaskellQVarConImpl(node); - } - else if (type == HS_RESERVED_ID) { + } else if (type == HS_RESERVED_ID) { return new HaskellReservedIdImpl(node); - } - else if (type == HS_SCONTEXT) { + } else if (type == HS_SCONTEXT) { return new HaskellScontextImpl(node); - } - else if (type == HS_SHEBANG_LINE) { + } else if (type == HS_SHEBANG_LINE) { return new HaskellShebangLineImpl(node); - } - else if (type == HS_SIMPLECLASS) { + } else if (type == HS_SIMPLECLASS) { return new HaskellSimpleclassImpl(node); - } - else if (type == HS_SIMPLETYPE) { + } else if (type == HS_SIMPLETYPE) { return new HaskellSimpletypeImpl(node); - } - else if (type == HS_TEXT_LITERAL) { + } else if (type == HS_TEXT_LITERAL) { return new HaskellTextLiteralImpl(node); - } - else if (type == HS_TOP_DECLARATION) { + } else if (type == HS_TOP_DECLARATION) { return new HaskellTopDeclarationImpl(node); - } - else if (type == HS_TOP_DECLARATION_LINE) { + } else if (type == HS_TOP_DECLARATION_LINE) { return new HaskellTopDeclarationLineImpl(node); - } - else if (type == HS_TTYPE) { + } else if (type == HS_TTYPE) { return new HaskellTtypeImpl(node); - } - else if (type == HS_TTYPE_1) { + } else if (type == HS_TTYPE_1) { return new HaskellTtype1Impl(node); - } - else if (type == HS_TTYPE_2) { + } else if (type == HS_TTYPE_2) { return new HaskellTtype2Impl(node); - } - else if (type == HS_TYPE_DECLARATION) { + } else if (type == HS_TYPE_DECLARATION) { return new HaskellTypeDeclarationImpl(node); - } - else if (type == HS_TYPE_EQUALITY) { + } else if (type == HS_TYPE_EQUALITY) { return new HaskellTypeEqualityImpl(node); - } - else if (type == HS_TYPE_FAMILY_DECLARATION) { + } else if (type == HS_TYPE_FAMILY_DECLARATION) { return new HaskellTypeFamilyDeclarationImpl(node); - } - else if (type == HS_TYPE_FAMILY_TYPE) { + } else if (type == HS_TYPE_FAMILY_TYPE) { return new HaskellTypeFamilyTypeImpl(node); - } - else if (type == HS_TYPE_INSTANCE_DECLARATION) { + } else if (type == HS_TYPE_INSTANCE_DECLARATION) { return new HaskellTypeInstanceDeclarationImpl(node); - } - else if (type == HS_TYPE_SIGNATURE) { + } else if (type == HS_TYPE_SIGNATURE) { return new HaskellTypeSignatureImpl(node); - } - else if (type == HS_VAR) { - return new HaskellVarImpl(node); - } - else if (type == HS_VARID) { + } else if (type == HS_VARID) { return new HaskellVaridImpl(node); - } - else if (type == HS_VAROP) { - return new HaskellVaropImpl(node); - } - else if (type == HS_VARSYM) { + } else if (type == HS_VARSYM) { return new HaskellVarsymImpl(node); - } - else if (type == HS_VAR_CON) { + } else if (type == HS_VAR_CON) { return new HaskellVarConImpl(node); } throw new AssertionError("Unknown element type: " + type); diff --git a/gen/intellij/haskell/psi/HaskellVar.java b/gen/intellij/haskell/psi/HaskellVar.java deleted file mode 100644 index 5e16541e..00000000 --- a/gen/intellij/haskell/psi/HaskellVar.java +++ /dev/null @@ -1,18 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; - -public interface HaskellVar extends HaskellCNameElement { - - @Nullable - HaskellVarid getVarid(); - - @Nullable - HaskellVarsym getVarsym(); - - String getName(); - -} diff --git a/gen/intellij/haskell/psi/HaskellVarop.java b/gen/intellij/haskell/psi/HaskellVarop.java deleted file mode 100644 index f656fb1f..00000000 --- a/gen/intellij/haskell/psi/HaskellVarop.java +++ /dev/null @@ -1,18 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.psi.PsiElement; - -public interface HaskellVarop extends HaskellCNameElement { - - @Nullable - HaskellVarid getVarid(); - - @Nullable - HaskellVarsym getVarsym(); - - String getName(); - -} diff --git a/gen/intellij/haskell/psi/HaskellVisitor.java b/gen/intellij/haskell/psi/HaskellVisitor.java index eb90adfc..9c5bd07d 100644 --- a/gen/intellij/haskell/psi/HaskellVisitor.java +++ b/gen/intellij/haskell/psi/HaskellVisitor.java @@ -1,9 +1,8 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi; -import org.jetbrains.annotations.*; import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.PsiLanguageInjectionHost; +import org.jetbrains.annotations.NotNull; public class HaskellVisitor extends PsiElementVisitor { @@ -11,6 +10,10 @@ public class HaskellVisitor extends PsiElementVisitor { visitCompositeElement(o); } + public void visitCdecl(@NotNull HaskellCdecl o) { + visitCompositeElement(o); + } + public void visitCdeclDataDeclaration(@NotNull HaskellCdeclDataDeclaration o) { visitCompositeElement(o); } @@ -19,6 +22,10 @@ public class HaskellVisitor extends PsiElementVisitor { visitCompositeElement(o); } + public void visitCidecl(@NotNull HaskellCidecl o) { + visitCompositeElement(o); + } + public void visitCidecls(@NotNull HaskellCidecls o) { visitCompositeElement(o); } @@ -31,30 +38,14 @@ public class HaskellVisitor extends PsiElementVisitor { visitCompositeElement(o); } - public void visitCname(@NotNull HaskellCname o) { - visitQualifiedNameElement(o); - } - - public void visitCnameDotDot(@NotNull HaskellCnameDotDot o) { - visitCompositeElement(o); - } - public void visitComments(@NotNull HaskellComments o) { visitCompositeElement(o); } - public void visitCon(@NotNull HaskellCon o) { - visitCNameElement(o); - } - public void visitConid(@NotNull HaskellConid o) { visitNamedElement(o); } - public void visitConop(@NotNull HaskellConop o) { - visitCNameElement(o); - } - public void visitConstr(@NotNull HaskellConstr o) { visitCompositeElement(o); } @@ -338,10 +329,6 @@ public class HaskellVisitor extends PsiElementVisitor { visitDeclarationElement(o); } - public void visitVar(@NotNull HaskellVar o) { - visitCNameElement(o); - } - public void visitVarCon(@NotNull HaskellVarCon o) { visitCompositeElement(o); } @@ -350,18 +337,10 @@ public class HaskellVisitor extends PsiElementVisitor { visitNamedElement(o); } - public void visitVarop(@NotNull HaskellVarop o) { - visitCNameElement(o); - } - public void visitVarsym(@NotNull HaskellVarsym o) { visitNamedElement(o); } - public void visitCNameElement(@NotNull HaskellCNameElement o) { - visitCompositeElement(o); - } - public void visitDataConstructorDeclarationElement(@NotNull HaskellDataConstructorDeclarationElement o) { visitCompositeElement(o); } diff --git a/gen/intellij/haskell/psi/impl/HaskellCdeclImpl.java b/gen/intellij/haskell/psi/impl/HaskellCdeclImpl.java new file mode 100644 index 00000000..1291689a --- /dev/null +++ b/gen/intellij/haskell/psi/impl/HaskellCdeclImpl.java @@ -0,0 +1,44 @@ +// This is a generated file. Not intended for manual editing. +package intellij.haskell.psi.impl; + +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import intellij.haskell.psi.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class HaskellCdeclImpl extends HaskellCompositeElementImpl implements HaskellCdecl { + + public HaskellCdeclImpl(ASTNode node) { + super(node); + } + + public void accept(@NotNull HaskellVisitor visitor) { + visitor.visitCdecl(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public HaskellCdeclDataDeclaration getCdeclDataDeclaration() { + return PsiTreeUtil.getChildOfType(this, HaskellCdeclDataDeclaration.class); + } + + @Override + @Nullable + public HaskellCidecl getCidecl() { + return PsiTreeUtil.getChildOfType(this, HaskellCidecl.class); + } + + @Override + @Nullable + public HaskellTypeSignature getTypeSignature() { + return PsiTreeUtil.getChildOfType(this, HaskellTypeSignature.class); + } + +} diff --git a/gen/intellij/haskell/psi/impl/HaskellCdeclsImpl.java b/gen/intellij/haskell/psi/impl/HaskellCdeclsImpl.java index 7f3dcc6b..e2998f60 100644 --- a/gen/intellij/haskell/psi/impl/HaskellCdeclsImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellCdeclsImpl.java @@ -1,14 +1,15 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi.impl; -import java.util.List; -import org.jetbrains.annotations.*; import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; -import intellij.haskell.psi.*; +import intellij.haskell.psi.HaskellCdecl; +import intellij.haskell.psi.HaskellCdecls; +import intellij.haskell.psi.HaskellVisitor; +import org.jetbrains.annotations.NotNull; + +import java.util.List; public class HaskellCdeclsImpl extends HaskellCompositeElementImpl implements HaskellCdecls { @@ -21,86 +22,14 @@ public class HaskellCdeclsImpl extends HaskellCompositeElementImpl implements Ha } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } @Override @NotNull - public List getCdeclDataDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellCdeclDataDeclaration.class); - } - - @Override - @NotNull - public List getDataDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellDataDeclaration.class); - } - - @Override - @NotNull - public List getDefaultDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellDefaultDeclaration.class); - } - - @Override - @NotNull - public List getDotDotList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellDotDot.class); - } - - @Override - @NotNull - public List getInstanceDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellInstanceDeclaration.class); - } - - @Override - @NotNull - public List getNewtypeDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellNewtypeDeclaration.class); - } - - @Override - @NotNull - public List getPragmaList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellPragma.class); - } - - @Override - @NotNull - public List getQNameList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellQName.class); - } - - @Override - @NotNull - public List getReservedIdList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellReservedId.class); - } - - @Override - @NotNull - public List getTextLiteralList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellTextLiteral.class); - } - - @Override - @NotNull - public List getTypeDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellTypeDeclaration.class); - } - - @Override - @NotNull - public List getTypeFamilyDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellTypeFamilyDeclaration.class); - } - - @Override - @NotNull - public List getTypeSignatureList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellTypeSignature.class); + public List getCdeclList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellCdecl.class); } } diff --git a/gen/intellij/haskell/psi/impl/HaskellCideclImpl.java b/gen/intellij/haskell/psi/impl/HaskellCideclImpl.java new file mode 100644 index 00000000..c75de235 --- /dev/null +++ b/gen/intellij/haskell/psi/impl/HaskellCideclImpl.java @@ -0,0 +1,94 @@ +// This is a generated file. Not intended for manual editing. +package intellij.haskell.psi.impl; + +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import intellij.haskell.psi.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class HaskellCideclImpl extends HaskellCompositeElementImpl implements HaskellCidecl { + + public HaskellCideclImpl(ASTNode node) { + super(node); + } + + public void accept(@NotNull HaskellVisitor visitor) { + visitor.visitCidecl(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public HaskellDataDeclaration getDataDeclaration() { + return PsiTreeUtil.getChildOfType(this, HaskellDataDeclaration.class); + } + + @Override + @Nullable + public HaskellDefaultDeclaration getDefaultDeclaration() { + return PsiTreeUtil.getChildOfType(this, HaskellDefaultDeclaration.class); + } + + @Override + @NotNull + public List getDotDotList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellDotDot.class); + } + + @Override + @Nullable + public HaskellInstanceDeclaration getInstanceDeclaration() { + return PsiTreeUtil.getChildOfType(this, HaskellInstanceDeclaration.class); + } + + @Override + @Nullable + public HaskellNewtypeDeclaration getNewtypeDeclaration() { + return PsiTreeUtil.getChildOfType(this, HaskellNewtypeDeclaration.class); + } + + @Override + @Nullable + public HaskellPragma getPragma() { + return PsiTreeUtil.getChildOfType(this, HaskellPragma.class); + } + + @Override + @NotNull + public List getQNameList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellQName.class); + } + + @Override + @NotNull + public List getReservedIdList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellReservedId.class); + } + + @Override + @NotNull + public List getTextLiteralList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellTextLiteral.class); + } + + @Override + @Nullable + public HaskellTypeDeclaration getTypeDeclaration() { + return PsiTreeUtil.getChildOfType(this, HaskellTypeDeclaration.class); + } + + @Override + @Nullable + public HaskellTypeFamilyDeclaration getTypeFamilyDeclaration() { + return PsiTreeUtil.getChildOfType(this, HaskellTypeFamilyDeclaration.class); + } + +} diff --git a/gen/intellij/haskell/psi/impl/HaskellCideclsImpl.java b/gen/intellij/haskell/psi/impl/HaskellCideclsImpl.java index 96bdd848..9164a7da 100644 --- a/gen/intellij/haskell/psi/impl/HaskellCideclsImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellCideclsImpl.java @@ -1,14 +1,15 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi.impl; -import java.util.List; -import org.jetbrains.annotations.*; import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; -import intellij.haskell.psi.*; +import intellij.haskell.psi.HaskellCidecl; +import intellij.haskell.psi.HaskellCidecls; +import intellij.haskell.psi.HaskellVisitor; +import org.jetbrains.annotations.NotNull; + +import java.util.List; public class HaskellCideclsImpl extends HaskellCompositeElementImpl implements HaskellCidecls { @@ -21,74 +22,14 @@ public class HaskellCideclsImpl extends HaskellCompositeElementImpl implements H } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } @Override @NotNull - public List getDataDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellDataDeclaration.class); - } - - @Override - @NotNull - public List getDefaultDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellDefaultDeclaration.class); - } - - @Override - @NotNull - public List getDotDotList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellDotDot.class); - } - - @Override - @NotNull - public List getInstanceDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellInstanceDeclaration.class); - } - - @Override - @NotNull - public List getNewtypeDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellNewtypeDeclaration.class); - } - - @Override - @NotNull - public List getPragmaList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellPragma.class); - } - - @Override - @NotNull - public List getQNameList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellQName.class); - } - - @Override - @NotNull - public List getReservedIdList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellReservedId.class); - } - - @Override - @NotNull - public List getTextLiteralList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellTextLiteral.class); - } - - @Override - @NotNull - public List getTypeDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellTypeDeclaration.class); - } - - @Override - @NotNull - public List getTypeFamilyDeclarationList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellTypeFamilyDeclaration.class); + public List getCideclList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellCidecl.class); } } diff --git a/gen/intellij/haskell/psi/impl/HaskellClassDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellClassDeclarationImpl.java index 433165cc..f799bf8c 100644 --- a/gen/intellij/haskell/psi/impl/HaskellClassDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellClassDeclarationImpl.java @@ -24,7 +24,7 @@ public class HaskellClassDeclarationImpl extends HaskellCompositeElementImpl imp } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellCnameDotDotImpl.java b/gen/intellij/haskell/psi/impl/HaskellCnameDotDotImpl.java deleted file mode 100644 index b872624c..00000000 --- a/gen/intellij/haskell/psi/impl/HaskellCnameDotDotImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi.impl; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; -import intellij.haskell.psi.*; - -public class HaskellCnameDotDotImpl extends HaskellCompositeElementImpl implements HaskellCnameDotDot { - - public HaskellCnameDotDotImpl(ASTNode node) { - super(node); - } - - public void accept(@NotNull HaskellVisitor visitor) { - visitor.visitCnameDotDot(this); - } - - public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); - else super.accept(visitor); - } - - @Override - @Nullable - public HaskellCname getCname() { - return PsiTreeUtil.getChildOfType(this, HaskellCname.class); - } - - @Override - @Nullable - public HaskellDotDot getDotDot() { - return PsiTreeUtil.getChildOfType(this, HaskellDotDot.class); - } - -} diff --git a/gen/intellij/haskell/psi/impl/HaskellCnameImpl.java b/gen/intellij/haskell/psi/impl/HaskellCnameImpl.java deleted file mode 100644 index 766c963a..00000000 --- a/gen/intellij/haskell/psi/impl/HaskellCnameImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi.impl; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; -import intellij.haskell.psi.*; -import scala.Option; - -public class HaskellCnameImpl extends HaskellCompositeElementImpl implements HaskellCname { - - public HaskellCnameImpl(ASTNode node) { - super(node); - } - - public void accept(@NotNull HaskellVisitor visitor) { - visitor.visitCname(this); - } - - public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); - else super.accept(visitor); - } - - @Override - @Nullable - public HaskellCon getCon() { - return PsiTreeUtil.getChildOfType(this, HaskellCon.class); - } - - @Override - @Nullable - public HaskellConop getConop() { - return PsiTreeUtil.getChildOfType(this, HaskellConop.class); - } - - @Override - @Nullable - public HaskellVar getVar() { - return PsiTreeUtil.getChildOfType(this, HaskellVar.class); - } - - @Override - @Nullable - public HaskellVarop getVarop() { - return PsiTreeUtil.getChildOfType(this, HaskellVarop.class); - } - - @Override - public String getName() { - return HaskellPsiImplUtil.getName(this); - } - - @Override - public HaskellNamedElement getIdentifierElement() { - return HaskellPsiImplUtil.getIdentifierElement(this); - } - - @Override - public Option getQualifierName() { - return HaskellPsiImplUtil.getQualifierName(this); - } - -} diff --git a/gen/intellij/haskell/psi/impl/HaskellConImpl.java b/gen/intellij/haskell/psi/impl/HaskellConImpl.java deleted file mode 100644 index 105ebd3c..00000000 --- a/gen/intellij/haskell/psi/impl/HaskellConImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi.impl; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; -import intellij.haskell.psi.*; - -public class HaskellConImpl extends HaskellCNameElementImpl implements HaskellCon { - - public HaskellConImpl(ASTNode node) { - super(node); - } - - public void accept(@NotNull HaskellVisitor visitor) { - visitor.visitCon(this); - } - - public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); - else super.accept(visitor); - } - - @Override - @Nullable - public HaskellConid getConid() { - return PsiTreeUtil.getChildOfType(this, HaskellConid.class); - } - - @Override - @Nullable - public HaskellConsym getConsym() { - return PsiTreeUtil.getChildOfType(this, HaskellConsym.class); - } - - @Override - public String getName() { - return HaskellPsiImplUtil.getName(this); - } - -} diff --git a/gen/intellij/haskell/psi/impl/HaskellConopImpl.java b/gen/intellij/haskell/psi/impl/HaskellConopImpl.java deleted file mode 100644 index cf2d90a3..00000000 --- a/gen/intellij/haskell/psi/impl/HaskellConopImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi.impl; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; -import intellij.haskell.psi.*; - -public class HaskellConopImpl extends HaskellCNameElementImpl implements HaskellConop { - - public HaskellConopImpl(ASTNode node) { - super(node); - } - - public void accept(@NotNull HaskellVisitor visitor) { - visitor.visitConop(this); - } - - public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); - else super.accept(visitor); - } - - @Override - @Nullable - public HaskellConid getConid() { - return PsiTreeUtil.getChildOfType(this, HaskellConid.class); - } - - @Override - @Nullable - public HaskellConsym getConsym() { - return PsiTreeUtil.getChildOfType(this, HaskellConsym.class); - } - - @Override - public String getName() { - return HaskellPsiImplUtil.getName(this); - } - -} diff --git a/gen/intellij/haskell/psi/impl/HaskellDataDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellDataDeclarationImpl.java index e0e67fcb..a516877d 100644 --- a/gen/intellij/haskell/psi/impl/HaskellDataDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellDataDeclarationImpl.java @@ -24,7 +24,7 @@ public class HaskellDataDeclarationImpl extends HaskellCompositeElementImpl impl } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellDefaultDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellDefaultDeclarationImpl.java index fe49ab69..405ef18c 100644 --- a/gen/intellij/haskell/psi/impl/HaskellDefaultDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellDefaultDeclarationImpl.java @@ -24,7 +24,7 @@ public class HaskellDefaultDeclarationImpl extends HaskellCompositeElementImpl i } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellDerivingDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellDerivingDeclarationImpl.java index 696bfbf0..1aa3dfcd 100644 --- a/gen/intellij/haskell/psi/impl/HaskellDerivingDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellDerivingDeclarationImpl.java @@ -22,7 +22,7 @@ public class HaskellDerivingDeclarationImpl extends HaskellCompositeElementImpl } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellExportImpl.java b/gen/intellij/haskell/psi/impl/HaskellExportImpl.java index a6239a00..b4240cee 100644 --- a/gen/intellij/haskell/psi/impl/HaskellExportImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellExportImpl.java @@ -1,14 +1,14 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi.impl; -import java.util.List; -import org.jetbrains.annotations.*; import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; import intellij.haskell.psi.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; public class HaskellExportImpl extends HaskellCompositeElementImpl implements HaskellExport { @@ -21,34 +21,22 @@ public class HaskellExportImpl extends HaskellCompositeElementImpl implements Ha } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } - @Override - @Nullable - public HaskellCname getCname() { - return PsiTreeUtil.getChildOfType(this, HaskellCname.class); - } - - @Override - @NotNull - public List getCnameDotDotList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellCnameDotDot.class); - } - - @Override - @Nullable - public HaskellCon getCon() { - return PsiTreeUtil.getChildOfType(this, HaskellCon.class); - } - @Override @Nullable public HaskellConid getConid() { return PsiTreeUtil.getChildOfType(this, HaskellConid.class); } + @Override + @Nullable + public HaskellDotDot getDotDot() { + return PsiTreeUtil.getChildOfType(this, HaskellDotDot.class); + } + @Override @Nullable public HaskellModid getModid() { @@ -56,9 +44,9 @@ public class HaskellExportImpl extends HaskellCompositeElementImpl implements Ha } @Override - @Nullable - public HaskellQCon getQCon() { - return PsiTreeUtil.getChildOfType(this, HaskellQCon.class); + @NotNull + public List getQNameList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellQName.class); } } diff --git a/gen/intellij/haskell/psi/impl/HaskellForeignDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellForeignDeclarationImpl.java index 34ecd09d..eec5272e 100644 --- a/gen/intellij/haskell/psi/impl/HaskellForeignDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellForeignDeclarationImpl.java @@ -24,7 +24,7 @@ public class HaskellForeignDeclarationImpl extends HaskellCompositeElementImpl i } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellImportIdImpl.java b/gen/intellij/haskell/psi/impl/HaskellImportIdImpl.java index 75423565..c31a7092 100644 --- a/gen/intellij/haskell/psi/impl/HaskellImportIdImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellImportIdImpl.java @@ -1,14 +1,17 @@ // This is a generated file. Not intended for manual editing. package intellij.haskell.psi.impl; -import java.util.List; -import org.jetbrains.annotations.*; import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; -import intellij.haskell.psi.*; +import intellij.haskell.psi.HaskellDotDot; +import intellij.haskell.psi.HaskellImportId; +import intellij.haskell.psi.HaskellQName; +import intellij.haskell.psi.HaskellVisitor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; public class HaskellImportIdImpl extends HaskellCompositeElementImpl implements HaskellImportId { @@ -21,20 +24,20 @@ public class HaskellImportIdImpl extends HaskellCompositeElementImpl implements } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } @Override - @NotNull - public HaskellCname getCname() { - return notNullChild(PsiTreeUtil.getChildOfType(this, HaskellCname.class)); + @Nullable + public HaskellDotDot getDotDot() { + return PsiTreeUtil.getChildOfType(this, HaskellDotDot.class); } @Override @NotNull - public List getCnameDotDotList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellCnameDotDot.class); + public List getQNameList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellQName.class); } } diff --git a/gen/intellij/haskell/psi/impl/HaskellInstanceDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellInstanceDeclarationImpl.java index 9e57060f..6370996f 100644 --- a/gen/intellij/haskell/psi/impl/HaskellInstanceDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellInstanceDeclarationImpl.java @@ -24,7 +24,7 @@ public class HaskellInstanceDeclarationImpl extends HaskellCompositeElementImpl } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } @@ -66,8 +66,8 @@ public class HaskellInstanceDeclarationImpl extends HaskellCompositeElementImpl @Override @NotNull - public List getVarConList() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellVarCon.class); + public List getVaridList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellVarid.class); } @Override diff --git a/gen/intellij/haskell/psi/impl/HaskellModuleDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellModuleDeclarationImpl.java index 0bde8ddc..9971117a 100644 --- a/gen/intellij/haskell/psi/impl/HaskellModuleDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellModuleDeclarationImpl.java @@ -22,7 +22,7 @@ public class HaskellModuleDeclarationImpl extends HaskellCompositeElementImpl im } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellNewtypeDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellNewtypeDeclarationImpl.java index fc74ca94..b523e82d 100644 --- a/gen/intellij/haskell/psi/impl/HaskellNewtypeDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellNewtypeDeclarationImpl.java @@ -22,7 +22,7 @@ public class HaskellNewtypeDeclarationImpl extends HaskellCompositeElementImpl i } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellSimpletypeImpl.java b/gen/intellij/haskell/psi/impl/HaskellSimpletypeImpl.java index 7bd976be..a0c2c867 100644 --- a/gen/intellij/haskell/psi/impl/HaskellSimpletypeImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellSimpletypeImpl.java @@ -22,7 +22,7 @@ public class HaskellSimpletypeImpl extends HaskellCompositeElementImpl implement } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellTypeDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellTypeDeclarationImpl.java index 6cd00da7..cf750498 100644 --- a/gen/intellij/haskell/psi/impl/HaskellTypeDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellTypeDeclarationImpl.java @@ -24,7 +24,7 @@ public class HaskellTypeDeclarationImpl extends HaskellCompositeElementImpl impl } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellTypeFamilyDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellTypeFamilyDeclarationImpl.java index 4f3f8065..e6cb0b9d 100644 --- a/gen/intellij/haskell/psi/impl/HaskellTypeFamilyDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellTypeFamilyDeclarationImpl.java @@ -22,7 +22,7 @@ public class HaskellTypeFamilyDeclarationImpl extends HaskellCompositeElementImp } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellTypeInstanceDeclarationImpl.java b/gen/intellij/haskell/psi/impl/HaskellTypeInstanceDeclarationImpl.java index a29ec3d9..694882b4 100644 --- a/gen/intellij/haskell/psi/impl/HaskellTypeInstanceDeclarationImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellTypeInstanceDeclarationImpl.java @@ -24,7 +24,7 @@ public class HaskellTypeInstanceDeclarationImpl extends HaskellCompositeElementI } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellTypeSignatureImpl.java b/gen/intellij/haskell/psi/impl/HaskellTypeSignatureImpl.java index 347c64ed..d7d70209 100644 --- a/gen/intellij/haskell/psi/impl/HaskellTypeSignatureImpl.java +++ b/gen/intellij/haskell/psi/impl/HaskellTypeSignatureImpl.java @@ -23,7 +23,7 @@ public class HaskellTypeSignatureImpl extends HaskellCompositeElementImpl implem } public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); + if (visitor instanceof HaskellVisitor) accept((HaskellVisitor) visitor); else super.accept(visitor); } diff --git a/gen/intellij/haskell/psi/impl/HaskellVarImpl.java b/gen/intellij/haskell/psi/impl/HaskellVarImpl.java deleted file mode 100644 index aa975401..00000000 --- a/gen/intellij/haskell/psi/impl/HaskellVarImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi.impl; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; -import intellij.haskell.psi.*; - -public class HaskellVarImpl extends HaskellCNameElementImpl implements HaskellVar { - - public HaskellVarImpl(ASTNode node) { - super(node); - } - - public void accept(@NotNull HaskellVisitor visitor) { - visitor.visitVar(this); - } - - public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); - else super.accept(visitor); - } - - @Override - @Nullable - public HaskellVarid getVarid() { - return PsiTreeUtil.getChildOfType(this, HaskellVarid.class); - } - - @Override - @Nullable - public HaskellVarsym getVarsym() { - return PsiTreeUtil.getChildOfType(this, HaskellVarsym.class); - } - - @Override - public String getName() { - return HaskellPsiImplUtil.getName(this); - } - -} diff --git a/gen/intellij/haskell/psi/impl/HaskellVaropImpl.java b/gen/intellij/haskell/psi/impl/HaskellVaropImpl.java deleted file mode 100644 index 1a94bd95..00000000 --- a/gen/intellij/haskell/psi/impl/HaskellVaropImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -// This is a generated file. Not intended for manual editing. -package intellij.haskell.psi.impl; - -import java.util.List; -import org.jetbrains.annotations.*; -import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.util.PsiTreeUtil; -import static intellij.haskell.psi.HaskellTypes.*; -import intellij.haskell.psi.*; - -public class HaskellVaropImpl extends HaskellCNameElementImpl implements HaskellVarop { - - public HaskellVaropImpl(ASTNode node) { - super(node); - } - - public void accept(@NotNull HaskellVisitor visitor) { - visitor.visitVarop(this); - } - - public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor); - else super.accept(visitor); - } - - @Override - @Nullable - public HaskellVarid getVarid() { - return PsiTreeUtil.getChildOfType(this, HaskellVarid.class); - } - - @Override - @Nullable - public HaskellVarsym getVarsym() { - return PsiTreeUtil.getChildOfType(this, HaskellVarsym.class); - } - - @Override - public String getName() { - return HaskellPsiImplUtil.getName(this); - } - -} diff --git a/src/main/scala/intellij/haskell/editor/HaskellImportOptimizer.scala b/src/main/scala/intellij/haskell/editor/HaskellImportOptimizer.scala index dee1f511..a6f2bcaa 100644 --- a/src/main/scala/intellij/haskell/editor/HaskellImportOptimizer.scala +++ b/src/main/scala/intellij/haskell/editor/HaskellImportOptimizer.scala @@ -71,7 +71,7 @@ object HaskellImportOptimizer { def removeRedundantImportIds(psiFile: PsiFile, moduleName: String, idNames: Seq[String]): Unit = { HaskellPsiUtil.findImportDeclarations(psiFile).find(_.getModuleName.contains(moduleName)).foreach { importDeclaration => val prefix = Option(importDeclaration.getImportQualifiedAs).map(_.getQualifier.getName).orElse(importDeclaration.getModuleName) - val idsToRemove = importDeclaration.getImportSpec.getImportIdsSpec.getImportIdList.asScala.filter(iid => idNames.exists(idn => idn == iid.getCname.getName || prefix.exists(p => idn == p + "." + iid.getCname.getName))) + val idsToRemove = importDeclaration.getImportSpec.getImportIdsSpec.getImportIdList.asScala.flatMap(_.getQNameList.asScala).filter(qn => idNames.exists(idn => idn == qn.getName || prefix.exists(p => idn == p + "." + qn.getName))) idsToRemove.foreach { iid => val commaToRemove = Option(PsiTreeUtil.findSiblingBackward(iid, HS_COMMA, true, null)).orElse(Option(PsiTreeUtil.findSiblingForward(iid, HS_COMMA, true, null))) val whiteSpaceRemove = Option(PsiTreeUtil.findSiblingBackward(iid, WHITE_SPACE, true, null)).orElse(Option(PsiTreeUtil.findSiblingForward(iid, WHITE_SPACE, true, null))) diff --git a/src/main/scala/intellij/haskell/external/component/FileModuleIdentifiers.scala b/src/main/scala/intellij/haskell/external/component/FileModuleIdentifiers.scala index 6472288f..ab487dea 100644 --- a/src/main/scala/intellij/haskell/external/component/FileModuleIdentifiers.scala +++ b/src/main/scala/intellij/haskell/external/component/FileModuleIdentifiers.scala @@ -232,6 +232,6 @@ object FileModuleIdentifiers { } private def findImportIds(importIdList: util.List[HaskellImportId]): Iterable[String] = { - importIdList.asScala.flatMap(importId => Iterable(ApplicationUtil.runReadAction(importId.getCname.getName)) ++ importId.getCnameDotDotList.asScala.flatMap(cndd => Option(cndd.getCname).map(cn => ApplicationUtil.runReadAction(cn.getName)))) + importIdList.asScala.flatMap(_.getQNameList.asScala).map(qn => ApplicationUtil.runReadAction(qn.getName)) } } diff --git a/src/main/scala/intellij/haskell/haskell.bnf b/src/main/scala/intellij/haskell/haskell.bnf index 586f358b..d70b387b 100644 --- a/src/main/scala/intellij/haskell/haskell.bnf +++ b/src/main/scala/intellij/haskell/haskell.bnf @@ -34,16 +34,12 @@ methods("var_con|q_var_con")=[getName getIdentifierElement] - methods("q_name|cname")=[getName getIdentifierElement getQualifierName] - implements("q_name|cname")="intellij.haskell.psi.HaskellQualifiedNameElement" + methods("q_name")=[getName getIdentifierElement getQualifierName] + implements("q_name")="intellij.haskell.psi.HaskellQualifiedNameElement" implements("expression")="intellij.haskell.psi.HaskellExpressionElement" mixin("expression")="intellij.haskell.psi.impl.HaskellExpressionElementImpl" - methods("var|con|varop|conop")=[getName] - implements("var|con|varop|conop")="intellij.haskell.psi.HaskellCNameElement" - mixin("var|con|varop|conop")="intellij.haskell.psi.impl.HaskellCNameElementImpl" - methods("q_con_qualifier1|q_con_qualifier2|q_con_qualifier3|q_con_qualifier4|qualifier")=[getName setName getNameIdentifier getReference getPresentation] implements("q_con_qualifier1|q_con_qualifier2|q_con_qualifier3|q_con_qualifier4|qualifier")="intellij.haskell.psi.HaskellQualifierElement" mixin("q_con_qualifier1|q_con_qualifier2|q_con_qualifier3|q_con_qualifier4|qualifier")="intellij.haskell.psi.impl.HaskellQualifierElementImpl" @@ -78,7 +74,7 @@ import_ids_spec ::= LEFT_PAREN onls import_id (onls COMMA? onls impo import_hiding_spec ::= import_hiding onls LEFT_PAREN onls (import_id onls (onls COMMA onls import_id)* onls (COMMA)?)? onls RIGHT_PAREN import_empty_spec ::= LEFT_PAREN RIGHT_PAREN import_hiding ::= "hiding" -import_id ::= TYPE? (cname onls LEFT_PAREN onls (cname_dot_dot onls (COMMA onls cname_dot_dot onls)* onls)? RIGHT_PAREN | cname) +import_id ::= TYPE? (q_name onls LEFT_PAREN onls (q_name onls (COMMA onls q_name onls)* onls)? RIGHT_PAREN | q_name LEFT_PAREN onls dot_dot onls RIGHT_PAREN | q_name) import_package_name ::= text_literal top_declaration_line ::= top_declaration SEMICOLON? NEWLINE @@ -107,7 +103,7 @@ class_declaration ::= CLASS onls (scontext onls DOUBLE_RIGHT_ARROW)? o (onls VERTICAL_BAR onls ttype (onls COMMA onls ttype)*)? onls WHERE? onls cdecls? | CLASS onls scontext onls DOUBLE_RIGHT_ARROW onls (q_name+ | ttype) onls WHERE? onls cdecls? // seen in Control.Lens.Internal.Indexed -instance_declaration ::= INSTANCE onls ("OVERLAPPABLE_" | "OVERLAPPING_" | pragma)? onls (var_con+ DOT)? onls (scontext onls DOUBLE_RIGHT_ARROW)? onls +instance_declaration ::= INSTANCE onls ("OVERLAPPABLE_" | "OVERLAPPING_" | pragma)? onls (varid+ DOT)? onls (scontext onls DOUBLE_RIGHT_ARROW)? onls (type_equality | q_name onls inst (onls WHERE (onls cidecls)?)?) // this way of using type equality in Data.Type.Equality type_equality ::= q_name+ TILDE q_name+ @@ -147,12 +143,6 @@ conid ::= CON_ID "#"? {stubClass = "intellij.haskell.psi.s varsym ::= VARSYM_ID | DOT+ VARSYM_ID | DOT+ EQUAL | DOT+ BACKSLASH | DOT+ TILDE | DOT+ AT | DOT+ CONSYM_ID | DOT+ VERTICAL_BAR | DOT DOT DOT+ | DOT {stubClass = "intellij.haskell.psi.stubs.HaskellVarsymStub"} consym ::= CONSYM_ID {stubClass = "intellij.haskell.psi.stubs.HaskellConsymStub"} -cname ::= var | con | conop | varop -var ::= varid | LEFT_PAREN varsym RIGHT_PAREN -con ::= conid | LEFT_PAREN consym RIGHT_PAREN -varop ::= varsym | BACKQUOTE varid BACKQUOTE -conop ::= consym | BACKQUOTE conid BACKQUOTE - var_con ::= varid | consym | varsym | conid q_var_con ::= &<> qualifier DOT (varid | consym | varsym) | q_con @@ -216,7 +206,7 @@ scontext ::= simpleclass | simpleclass onls LEFT_PAREN onls s simpleclass ::= ttype | q_name+ LEFT_PAREN q_name+ RIGHT_PAREN q_name* | q_name+ inst ::= gtycon+ instvar* (LEFT_PAREN onls gtycon (instvar)* onls RIGHT_PAREN)* instvar* | - (LEFT_PAREN onls instvar (onls COMMA onls instvar)+ onls RIGHT_PAREN)+ instvar* | + (LEFT_PAREN onls instvar (onls COMMA onls instvar)* onls RIGHT_PAREN)+ instvar* | QUOTE? (LEFT_BRACKET onls instvar onls RIGHT_BRACKET)+ instvar* | (LEFT_PAREN onls instvar+ onls RIGHT_PAREN)+ instvar* | ((LEFT_PAREN onls instvar+ (onls RIGHT_ARROW onls instvar+)+ onls RIGHT_PAREN)+ instvar*)+ @@ -226,12 +216,10 @@ instvar ::= ttype | q_name | LEFT_BRACKET q_name+ RIGHT_BRAC private fixity ::= INFIXL | INFIXR | INFIX exports ::= LEFT_PAREN onl export ((onl COMMA)? onl export)* (onl COMMA)? onl RIGHT_PAREN | LEFT_PAREN RIGHT_PAREN -export ::= export3 | export2 | export4 | export5 -private export3 ::= (q_con | cname) onl LEFT_PAREN (onl cname_dot_dot (onl COMMA onl cname_dot_dot)*)? onl RIGHT_PAREN -private export2 ::= TYPE? onl cname+ -private export4 ::= MODULE modid -private export5 ::= conid DOT cname | LEFT_PAREN con DOT cname RIGHT_PAREN -cname_dot_dot ::= dot_dot | cname +export ::= export1 | export2 | export3 +private export1 ::= MODULE modid +private export2 ::= q_name (onl LEFT_PAREN (onl q_name (onl COMMA onl q_name)*)? onl RIGHT_PAREN | onl LEFT_PAREN onl dot_dot onl RIGHT_PAREN)? +private export3 ::= TYPE onl conid newconstr ::= newconstr_fielddecl | q_name atype newconstr_fielddecl ::= q_name onls LEFT_BRACE? onls type_signature onls RIGHT_BRACE? @@ -241,9 +229,9 @@ cidecls ::= cidecl (nls cidecl)* // copy of data_declaration but without all onls cdecl_data_declaration ::= DATA (onls pragma)? onls (LEFT_PAREN onls kind_signature onls RIGHT_PAREN)* onls simpletype (onls LEFT_PAREN onls kind_signature onls RIGHT_PAREN)* (onls COLON_COLON ttype)? q_name* -private cdecl ::= type_signature | cdecl_data_declaration | cidecl +cdecl ::= type_signature | cdecl_data_declaration | cidecl -private cidecl ::= pragma | instance_declaration | default_declaration | +cidecl ::= pragma | instance_declaration | default_declaration | newtype_declaration | data_declaration | type_declaration | type_family_declaration | line_expression expression ::= line_expression (nls line_expression)* diff --git a/src/main/scala/intellij/haskell/navigation/HaskellReference.scala b/src/main/scala/intellij/haskell/navigation/HaskellReference.scala index aac5da16..8f5648c6 100644 --- a/src/main/scala/intellij/haskell/navigation/HaskellReference.scala +++ b/src/main/scala/intellij/haskell/navigation/HaskellReference.scala @@ -39,7 +39,7 @@ class HaskellReference(element: HaskellNamedElement, textRange: TextRange) exten } } - private def findQualifierDeclaration(project: Project, psiFile: PsiFile, qualifier: HaskellQualifier) = { + private def findQualifierDeclaration(project: Project, psiFile: PsiFile, qualifier: HaskellQualifierElement) = { ProgressManager.checkCanceled() val importDeclarations = HaskellPsiUtil.findImportDeclarations(psiFile) @@ -95,8 +95,8 @@ class HaskellReference(element: HaskellNamedElement, textRange: TextRange) exten ProgressManager.checkCanceled() val psiFile = element.getContainingFile.getOriginalFile val result = element match { - case q: HaskellQualifier if isPartOfQualifiedAs(q) => Some(HaskellNamedElementResolveResult(q)) - case q: HaskellQualifier => findQualifierDeclaration(project, psiFile, q) + case q: HaskellQualifierElement if isPartOfQualifiedAs(q) => Some(HaskellNamedElementResolveResult(q)) + case q: HaskellQualifierElement => findQualifierDeclaration(project, psiFile, q) case mid: HaskellModid => findModule(project, mid) case ne: HaskellNamedElement if isPartOfQualifier(ne) | isPartOfQualifiedAs(ne) | isPartOfModId(ne) => None case ne: HaskellNamedElement => diff --git a/src/main/scala/intellij/haskell/psi/HaskellCNameElement.scala b/src/main/scala/intellij/haskell/psi/HaskellCNameElement.scala deleted file mode 100644 index 0a849aec..00000000 --- a/src/main/scala/intellij/haskell/psi/HaskellCNameElement.scala +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2014-2019 Rik van der Kleij - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package intellij.haskell.psi - -trait HaskellCNameElement extends HaskellCompositeElement { - - def getName: String -} diff --git a/src/main/scala/intellij/haskell/psi/impl/HaskellCompositeElementImpl.scala b/src/main/scala/intellij/haskell/psi/impl/HaskellCompositeElementImpl.scala index 4b84203d..c18948ea 100644 --- a/src/main/scala/intellij/haskell/psi/impl/HaskellCompositeElementImpl.scala +++ b/src/main/scala/intellij/haskell/psi/impl/HaskellCompositeElementImpl.scala @@ -27,8 +27,6 @@ class HaskellCompositeElementImpl(node: ASTNode) extends ASTWrapperPsiElement(no } } -abstract class HaskellCNameElementImpl private[impl](node: ASTNode) extends HaskellCompositeElementImpl(node) with HaskellCNameElement - abstract class HaskellExpressionElementImpl private[impl](node: ASTNode) extends HaskellCompositeElementImpl(node) with HaskellExpressionElement abstract class HaskellNamedElementImpl private[impl](node: ASTNode) extends HaskellCompositeElementImpl(node) with HaskellNamedElement diff --git a/src/main/scala/intellij/haskell/psi/impl/HaskellPsiImplUtil.scala b/src/main/scala/intellij/haskell/psi/impl/HaskellPsiImplUtil.scala index e240d83c..d34287ab 100644 --- a/src/main/scala/intellij/haskell/psi/impl/HaskellPsiImplUtil.scala +++ b/src/main/scala/intellij/haskell/psi/impl/HaskellPsiImplUtil.scala @@ -70,26 +70,6 @@ object HaskellPsiImplUtil { orElse(Option(qvc.getQCon).flatMap(qc => Option(qc.getQConQualifier1).orElse(Option(qc.getQConQualifier2)).orElse(Option(qc.getQConQualifier3)).map(_.getText)))) } - def getName(cname: HaskellCname): String = { - cname.getText - } - - def getIdentifierElement(cname: HaskellCname): HaskellNamedElement = { - Option(cname.getVar).flatMap(v => Option(v.getVarsym)). - orElse(Option(cname.getVar).flatMap(v => Option(v.getVarid))). - orElse(Option(cname.getVarop).flatMap(v => Option(v.getVarid))). - orElse(Option(cname.getVarop).flatMap(v => Option(v.getVarsym))). - orElse(Option(cname.getCon).flatMap(v => Option(v.getConid))). - orElse(Option(cname.getCon).flatMap(v => Option(v.getConsym))). - orElse(Option(cname.getConop).flatMap(v => Option(v.getConid))). - orElse(Option(cname.getConop).flatMap(v => Option(v.getConsym))). - getOrElse(throw new IllegalStateException(s"Identifier for $cname should exist")) - } - - def getQualifierName(cname: HaskellCname): Option[String] = { - None - } - def getName(modid: HaskellModid): String = { modid.getText } @@ -196,22 +176,6 @@ object HaskellPsiImplUtil { ArrayUtil.getFirstElement(ReferenceProvidersRegistry.getReferencesFromProviders(element)) } - def getName(`var`: HaskellVar): String = { - Option(`var`.getVarid).getOrElse(`var`.getVarsym).getName - } - - def getName(con: HaskellCon): String = { - Option(con.getConid).getOrElse(con.getConsym).getName - } - - def getName(varop: HaskellVarop): String = { - Option(varop.getVarid).getOrElse(varop.getVarsym).getName - } - - def getName(conop: HaskellConop): String = { - Option(conop.getConid).getOrElse(conop.getConsym).getName - } - private abstract class HaskellItemPresentation(haskellElement: PsiElement) extends ItemPresentation { def getLocationString: String = { @@ -339,17 +303,19 @@ object HaskellPsiImplUtil { } def getIdentifierElements(newtypeDeclaration: HaskellNewtypeDeclaration): Seq[HaskellNamedElement] = { + val fielddecl = Option(newtypeDeclaration.getNewconstr.getNewconstrFielddecl) newtypeDeclaration.getSimpletype.getIdentifierElements ++ - Option(newtypeDeclaration.getNewconstr.getNewconstrFielddecl).flatMap(_.getTypeSignature.getQNamesList.asScala.headOption).map(_.getQNameList.asScala.headOption.map(_.getIdentifierElement).toSeq).getOrElse(Seq()) ++ - Option(newtypeDeclaration.getNewconstr.getNewconstrFielddecl).map(_.getQName.getIdentifierElement).toSeq ++ + fielddecl.flatMap(_.getTypeSignature.getQNamesList.asScala.headOption).map(_.getQNameList.asScala.headOption.map(_.getIdentifierElement).toSeq).getOrElse(Seq()) ++ + fielddecl.map(_.getQName.getIdentifierElement).toSeq ++ newtypeDeclaration.getNewconstr.getQNameList.asScala.headOption.map(_.getIdentifierElement).toSeq } def getIdentifierElements(classDeclaration: HaskellClassDeclaration): Seq[HaskellNamedElement] = { + val cdecls = Option(classDeclaration.getCdecls).map(_.getCdeclList.asScala).getOrElse(Seq()) classDeclaration.getQNameList.asScala.headOption.map(_.getIdentifierElement).toSeq ++ - Option(classDeclaration.getCdecls).map(_.getTypeSignatureList.asScala.flatMap(_.getIdentifierElements)).getOrElse(Seq()) ++ - Option(classDeclaration.getCdecls).map(_.getTypeDeclarationList.asScala.flatMap(_.getIdentifierElements)).getOrElse(Seq()) ++ - Option(classDeclaration.getCdecls).map(_.getCdeclDataDeclarationList.asScala.flatMap(_.getSimpletype.getIdentifierElements)).getOrElse(Seq()) + cdecls.flatMap(cd => Option(cd.getTypeSignature).map(_.getIdentifierElements).getOrElse(Seq())) ++ + cdecls.flatMap(cd => Option(cd.getCdeclDataDeclaration).toSeq.flatMap(_.getQNameList.asScala.map(_.getIdentifierElement))) ++ + cdecls.flatMap(cd => Option(cd.getCidecl).toSeq.flatMap(_.getQNameList.asScala.map(_.getIdentifierElement))) } def getIdentifierElements(instanceDeclaration: HaskellInstanceDeclaration): Seq[HaskellNamedElement] = { @@ -360,8 +326,9 @@ object HaskellPsiImplUtil { } def getIdentifierElements(typeFamilyDeclaration: HaskellTypeFamilyDeclaration): Seq[HaskellNamedElement] = { - typeFamilyDeclaration.getTypeFamilyType.getQNameList.asScala.map(_.getIdentifierElement).toSeq ++ - typeFamilyDeclaration.getTypeFamilyType.getQNamesList.asScala.flatMap(_.getQNameList.asScala.map(_.getIdentifierElement)) + val familyType = typeFamilyDeclaration.getTypeFamilyType + familyType.getQNameList.asScala.map(_.getIdentifierElement).toSeq ++ + familyType.getQNamesList.asScala.flatMap(_.getQNameList.asScala.map(_.getIdentifierElement)) } def getIdentifierElements(derivingDeclaration: HaskellDerivingDeclaration): Seq[HaskellNamedElement] = { @@ -373,14 +340,12 @@ object HaskellPsiImplUtil { } def getIdentifierElements(simpleType: HaskellSimpletype): Seq[HaskellNamedElement] = { - { - simpleType.getQNameList.asScala.map(_.getIdentifierElement) ++ { - Option(simpleType.getTtype) match { - case Some(t) => t.getQNameList.asScala.headOption.map(_.getIdentifierElement) - case None => simpleType.getQNameList.asScala.headOption.map(_.getIdentifierElement) - } + simpleType.getQNameList.asScala.map(_.getIdentifierElement).toSeq ++ { + Option(simpleType.getTtype) match { + case Some(t) => t.getQNameList.asScala.headOption.map(_.getIdentifierElement) + case None => simpleType.getQNameList.asScala.headOption.map(_.getIdentifierElement) } - }.toSeq + } } def getIdentifierElements(defaultDeclaration: HaskellDefaultDeclaration): Seq[HaskellNamedElement] = {