From e03eccff973f34842a17398d4f7831f75ce15c4e Mon Sep 17 00:00:00 2001 From: zyuyou Date: Fri, 12 Aug 2022 16:31:01 +0800 Subject: [PATCH 1/7] add otp-25 `maybe_expr` support --- gen/org/intellij/erlang/ErlangTypes.java | 19 + .../intellij/erlang/parser/ErlangParser.java | 154 ++++- .../intellij/erlang/parser/_ErlangLexer.java | 543 +++++++++--------- .../intellij/erlang/psi/ErlangAttribute.java | 3 + .../erlang/psi/ErlangElseAtomAttribute.java | 10 + .../erlang/psi/ErlangMaybeExpression.java | 25 + .../psi/ErlangMaybeMatchExpression.java | 13 + .../erlang/psi/ErlangMaybeMatchExprs.java | 16 + .../intellij/erlang/psi/ErlangVisitor.java | 17 + .../erlang/psi/impl/ErlangAttributeImpl.java | 6 + .../psi/impl/ErlangElseAtomAttributeImpl.java | 29 + .../psi/impl/ErlangMaybeExpressionImpl.java | 60 ++ .../impl/ErlangMaybeMatchExpressionImpl.java | 36 ++ .../psi/impl/ErlangMaybeMatchExprsImpl.java | 41 ++ grammars/erlang.bnf | 22 +- resources/liveTemplates/erlang.xml | 26 + .../intellij/erlang/ErlangBraceMatcher.java | 1 + .../erlang/editor/ErlangAnnotator.java | 5 + .../erlang/editor/ErlangEnterHandler.java | 22 +- .../editor/ErlangSyntaxHighlighter.java | 6 +- .../formatter/ErlangFormattingBlock.java | 6 +- .../ErlangFormattingModelBuilder.java | 4 +- .../formatter/ErlangIndentProcessor.java | 13 +- src/org/intellij/erlang/parser/Erlang.flex | 3 + .../intellij/erlang/parser/ErlangLexer.java | 3 +- .../erlang/psi/impl/ErlangPsiImplUtil.java | 9 + testData/formatter/bindMaybe-after.erl | 4 + testData/formatter/bindMaybe.erl | 2 + testData/formatter/bindMaybeElse-after.erl | 6 + testData/formatter/bindMaybeElse.erl | 4 + .../formatter/bindMaybeElse__IR_OFF-after.erl | 6 + .../bindMaybeFirstElseClause-after.erl | 6 + .../formatter/bindMaybeFirstElseClause.erl | 5 + ...bindMaybeFirstElseClause__IR_OFF-after.erl | 6 + .../bindMaybeLastElseClause-after.erl | 7 + .../formatter/bindMaybeLastElseClause.erl | 6 + .../bindMaybeLastElseClause__IR_OFF-after.erl | 7 + .../formatter/bindMaybe__IR_OFF-after.erl | 4 + testData/formatter/maybe1-after.erl | 4 + testData/formatter/maybe1.erl | 2 + testData/formatter/maybe2-after.erl | 4 + testData/formatter/maybe2.erl | 3 + testData/formatter/maybe3-after.erl | 6 + testData/formatter/maybe3.erl | 4 + testData/formatter/maybe4-after.erl | 6 + testData/formatter/maybe4.erl | 5 + testData/formatter/maybe5-after.erl | 7 + testData/formatter/maybe5.erl | 6 + testData/parser/304.txt | 4 +- .../completion/ErlangCompletionTest.java | 2 +- .../formatting/ErlangFormattingTest.java | 31 + 51 files changed, 927 insertions(+), 312 deletions(-) create mode 100644 gen/org/intellij/erlang/psi/ErlangElseAtomAttribute.java create mode 100644 gen/org/intellij/erlang/psi/ErlangMaybeExpression.java create mode 100644 gen/org/intellij/erlang/psi/ErlangMaybeMatchExpression.java create mode 100644 gen/org/intellij/erlang/psi/ErlangMaybeMatchExprs.java create mode 100644 gen/org/intellij/erlang/psi/impl/ErlangElseAtomAttributeImpl.java create mode 100644 gen/org/intellij/erlang/psi/impl/ErlangMaybeExpressionImpl.java create mode 100644 gen/org/intellij/erlang/psi/impl/ErlangMaybeMatchExpressionImpl.java create mode 100644 gen/org/intellij/erlang/psi/impl/ErlangMaybeMatchExprsImpl.java create mode 100644 testData/formatter/bindMaybe-after.erl create mode 100644 testData/formatter/bindMaybe.erl create mode 100644 testData/formatter/bindMaybeElse-after.erl create mode 100644 testData/formatter/bindMaybeElse.erl create mode 100644 testData/formatter/bindMaybeElse__IR_OFF-after.erl create mode 100644 testData/formatter/bindMaybeFirstElseClause-after.erl create mode 100644 testData/formatter/bindMaybeFirstElseClause.erl create mode 100644 testData/formatter/bindMaybeFirstElseClause__IR_OFF-after.erl create mode 100644 testData/formatter/bindMaybeLastElseClause-after.erl create mode 100644 testData/formatter/bindMaybeLastElseClause.erl create mode 100644 testData/formatter/bindMaybeLastElseClause__IR_OFF-after.erl create mode 100644 testData/formatter/bindMaybe__IR_OFF-after.erl create mode 100644 testData/formatter/maybe1-after.erl create mode 100644 testData/formatter/maybe1.erl create mode 100644 testData/formatter/maybe2-after.erl create mode 100644 testData/formatter/maybe2.erl create mode 100644 testData/formatter/maybe3-after.erl create mode 100644 testData/formatter/maybe3.erl create mode 100644 testData/formatter/maybe4-after.erl create mode 100644 testData/formatter/maybe4.erl create mode 100644 testData/formatter/maybe5-after.erl create mode 100644 testData/formatter/maybe5.erl diff --git a/gen/org/intellij/erlang/ErlangTypes.java b/gen/org/intellij/erlang/ErlangTypes.java index 8b3167156..4e2cf686d 100644 --- a/gen/org/intellij/erlang/ErlangTypes.java +++ b/gen/org/intellij/erlang/ErlangTypes.java @@ -43,6 +43,7 @@ public interface ErlangTypes { IElementType ERL_CONFIG_CALL_EXPRESSION = new ErlangCompositeElementType("ERL_CONFIG_CALL_EXPRESSION"); IElementType ERL_CONFIG_EXPRESSION = new ErlangCompositeElementType("ERL_CONFIG_EXPRESSION"); IElementType ERL_CR_CLAUSE = new ErlangCompositeElementType("ERL_CR_CLAUSE"); + IElementType ERL_ELSE_ATOM_ATTRIBUTE = new ErlangCompositeElementType("ERL_ELSE_ATOM_ATTRIBUTE"); IElementType ERL_EXPORT = new ErlangCompositeElementType("ERL_EXPORT"); IElementType ERL_EXPORT_FUNCTION = new ErlangCompositeElementType("ERL_EXPORT_FUNCTION"); IElementType ERL_EXPORT_FUNCTIONS = new ErlangCompositeElementType("ERL_EXPORT_FUNCTIONS"); @@ -92,6 +93,9 @@ public interface ErlangTypes { IElementType ERL_MAP_TUPLE = new ErlangCompositeElementType("ERL_MAP_TUPLE"); IElementType ERL_MAP_TYPE = new ErlangCompositeElementType("ERL_MAP_TYPE"); IElementType ERL_MAX_EXPRESSION = new ErlangCompositeElementType("ERL_MAX_EXPRESSION"); + IElementType ERL_MAYBE_EXPRESSION = new ErlangCompositeElementType("ERL_MAYBE_EXPRESSION"); + IElementType ERL_MAYBE_MATCH_EXPRESSION = new ErlangCompositeElementType("ERL_MAYBE_MATCH_EXPRESSION"); + IElementType ERL_MAYBE_MATCH_EXPRS = new ErlangCompositeElementType("ERL_MAYBE_MATCH_EXPRS"); IElementType ERL_MODEL_FIELD_LIST = new ErlangCompositeElementType("ERL_MODEL_FIELD_LIST"); IElementType ERL_MODULE = ErlangElementTypeFactory.factory("ERL_MODULE"); IElementType ERL_MODULE_REF = new ErlangCompositeElementType("ERL_MODULE_REF"); @@ -165,12 +169,14 @@ public interface ErlangTypes { IElementType ERL_DOT = new ErlangTokenType("."); IElementType ERL_DOT_DOT = new ErlangTokenType(".."); IElementType ERL_DOT_DOT_DOT = new ErlangTokenType("..."); + IElementType ERL_ELSE = new ErlangTokenType("else"); IElementType ERL_END = new ErlangTokenType("end"); IElementType ERL_FLOAT = new ErlangTokenType("float"); IElementType ERL_FUN = new ErlangTokenType("fun"); IElementType ERL_IF = new ErlangTokenType("if"); IElementType ERL_INTEGER = new ErlangTokenType("integer"); IElementType ERL_MATCH = new ErlangTokenType(":="); + IElementType ERL_MAYBE = new ErlangTokenType("maybe"); IElementType ERL_NOT = new ErlangTokenType("not"); IElementType ERL_OF = new ErlangTokenType("of"); IElementType ERL_OP_AR_DIV = new ErlangTokenType("/"); @@ -187,6 +193,7 @@ public interface ErlangTypes { IElementType ERL_OP_LT = new ErlangTokenType("<"); IElementType ERL_OP_LT_EQ = new ErlangTokenType("<="); IElementType ERL_OP_LT_MINUS = new ErlangTokenType("<-"); + IElementType ERL_OP_MAYBE_EQ = new ErlangTokenType("?="); IElementType ERL_OP_MINUS = new ErlangTokenType("-"); IElementType ERL_OP_MINUS_MINUS = new ErlangTokenType("--"); IElementType ERL_OP_OR = new ErlangTokenType("|"); @@ -311,6 +318,9 @@ else if (type == ERL_CONFIG_EXPRESSION) { else if (type == ERL_CR_CLAUSE) { return new ErlangCrClauseImpl(node); } + else if (type == ERL_ELSE_ATOM_ATTRIBUTE) { + return new ErlangElseAtomAttributeImpl(node); + } else if (type == ERL_EXPORT) { return new ErlangExportImpl(node); } @@ -455,6 +465,15 @@ else if (type == ERL_MAP_TYPE) { else if (type == ERL_MAX_EXPRESSION) { return new ErlangMaxExpressionImpl(node); } + else if (type == ERL_MAYBE_EXPRESSION) { + return new ErlangMaybeExpressionImpl(node); + } + else if (type == ERL_MAYBE_MATCH_EXPRESSION) { + return new ErlangMaybeMatchExpressionImpl(node); + } + else if (type == ERL_MAYBE_MATCH_EXPRS) { + return new ErlangMaybeMatchExprsImpl(node); + } else if (type == ERL_MODEL_FIELD_LIST) { return new ErlangModelFieldListImpl(node); } diff --git a/gen/org/intellij/erlang/parser/ErlangParser.java b/gen/org/intellij/erlang/parser/ErlangParser.java index 2bd74828c..a5062162c 100644 --- a/gen/org/intellij/erlang/parser/ErlangParser.java +++ b/gen/org/intellij/erlang/parser/ErlangParser.java @@ -46,13 +46,14 @@ static boolean parse_root_(IElementType t, PsiBuilder b, int l) { ERL_CONFIG_EXPRESSION, ERL_EXPRESSION, ERL_FUNCTION_CALL_EXPRESSION, ERL_FUN_EXPRESSION, ERL_GENERIC_FUNCTION_CALL_EXPRESSION, ERL_GLOBAL_FUNCTION_CALL_EXPRESSION, ERL_IF_EXPRESSION, ERL_LC_EXPRESSION, ERL_LIST_COMPREHENSION, ERL_LIST_EXPRESSION, ERL_LIST_OP_EXPRESSION, ERL_MAP_EXPRESSION, - ERL_MAX_EXPRESSION, ERL_MULTIPLICATIVE_EXPRESSION, ERL_ORELSE_EXPRESSION, ERL_PARENTHESIZED_EXPRESSION, - ERL_PREFIX_EXPRESSION, ERL_QUALIFIED_EXPRESSION, ERL_RECEIVE_EXPRESSION, ERL_RECORD_EXPRESSION, - ERL_SEND_EXPRESSION, ERL_STRING_LITERAL, ERL_TRY_EXPRESSION, ERL_TUPLE_EXPRESSION), + ERL_MAX_EXPRESSION, ERL_MAYBE_EXPRESSION, ERL_MAYBE_MATCH_EXPRESSION, ERL_MULTIPLICATIVE_EXPRESSION, + ERL_ORELSE_EXPRESSION, ERL_PARENTHESIZED_EXPRESSION, ERL_PREFIX_EXPRESSION, ERL_QUALIFIED_EXPRESSION, + ERL_RECEIVE_EXPRESSION, ERL_RECORD_EXPRESSION, ERL_SEND_EXPRESSION, ERL_STRING_LITERAL, + ERL_TRY_EXPRESSION, ERL_TUPLE_EXPRESSION), }; /* ********************************************************** */ - // '+' |'-' | bor | bxor | bsl | bsr | or | xor + // '+' | '-' | bor | bxor | bsl | bsr | or | xor static boolean add_op(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "add_op")) return false; boolean r; @@ -1442,7 +1443,7 @@ public static boolean clause_guard(PsiBuilder b, int l) { } /* ********************************************************** */ - // '==' | '/=' |'=<' |'<' |'>=' |'>' |'=:=' |'=/=' + // '==' | '/=' | '=<' |'<' | '>=' | '>' | '=:=' | '=/=' static boolean comp_op(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "comp_op")) return false; boolean r; @@ -1908,22 +1909,11 @@ private static boolean cr_clauses_1_0(PsiBuilder b, int l) { } /* ********************************************************** */ - // &'else' atom_name + // 'else' public static boolean else_atom_attribute(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "else_atom_attribute")) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ERL_ATOM_ATTRIBUTE, ""); - r = else_atom_attribute_0(b, l + 1); - r = r && consumeToken(b, ERL_ATOM_NAME); - exit_section_(b, l, m, r, false, null); - return r; - } - - // &'else' - private static boolean else_atom_attribute_0(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "else_atom_attribute_0")) return false; - boolean r; - Marker m = enter_section_(b, l, _AND_); + Marker m = enter_section_(b, l, _NONE_, ERL_ELSE_ATOM_ATTRIBUTE, ""); r = consumeToken(b, "else"); exit_section_(b, l, m, r, false, null); return r; @@ -2187,7 +2177,7 @@ private static boolean exprs_1_0(PsiBuilder b, int l) { } /* ********************************************************** */ - // !(')' | ',' | '->' | '.' | ':-' | ';' | '}' | after | catch | end | of | atom '(') + // !(')' | ',' | '->' | '.' | ':-' | ';' | '}' | after | catch | else | end | of | atom '(') static boolean exprs_recover(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "exprs_recover")) return false; boolean r; @@ -2197,7 +2187,7 @@ static boolean exprs_recover(PsiBuilder b, int l) { return r; } - // ')' | ',' | '->' | '.' | ':-' | ';' | '}' | after | catch | end | of | atom '(' + // ')' | ',' | '->' | '.' | ':-' | ';' | '}' | after | catch | else | end | of | atom '(' private static boolean exprs_recover_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "exprs_recover_0")) return false; boolean r; @@ -2211,16 +2201,17 @@ private static boolean exprs_recover_0(PsiBuilder b, int l) { if (!r) r = consumeToken(b, ERL_CURLY_RIGHT); if (!r) r = consumeToken(b, ERL_AFTER); if (!r) r = consumeToken(b, ERL_CATCH); + if (!r) r = consumeToken(b, ERL_ELSE); if (!r) r = consumeToken(b, ERL_END); if (!r) r = consumeToken(b, ERL_OF); - if (!r) r = exprs_recover_0_11(b, l + 1); + if (!r) r = exprs_recover_0_12(b, l + 1); exit_section_(b, m, null, r); return r; } // atom '(' - private static boolean exprs_recover_0_11(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "exprs_recover_0_11")) return false; + private static boolean exprs_recover_0_12(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "exprs_recover_0_12")) return false; boolean r; Marker m = enter_section_(b); r = atom(b, l + 1); @@ -2345,7 +2336,7 @@ private static boolean form_10(PsiBuilder b, int l) { } /* ********************************************************** */ - // !('+' | '-' | '<<' | '?' | '[' | '{' | atom_name | single_quote | bnot | char | float | integer | not | string | var | '#'| '.') + // !('+' | '-' | '<<' | '?' | '[' | '{' | atom_name | single_quote | bnot | char | float | integer | not | string | var | '#' | '.') static boolean form_recover(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "form_recover")) return false; boolean r; @@ -2355,7 +2346,7 @@ static boolean form_recover(PsiBuilder b, int l) { return r; } - // '+' | '-' | '<<' | '?' | '[' | '{' | atom_name | single_quote | bnot | char | float | integer | not | string | var | '#'| '.' + // '+' | '-' | '<<' | '?' | '[' | '{' | atom_name | single_quote | bnot | char | float | integer | not | string | var | '#' | '.' private static boolean form_recover_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "form_recover_0")) return false; boolean r; @@ -4007,6 +3998,41 @@ static boolean marked_lc_tail(PsiBuilder b, int l) { return r || p; } + /* ********************************************************** */ + // maybe maybe_match_exprs [else cr_clauses] end + public static boolean maybe_expression(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_expression")) return false; + if (!nextTokenIs(b, "", ERL_MAYBE)) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, ERL_MAYBE_EXPRESSION, ""); + r = consumeToken(b, ERL_MAYBE); + p = r; // pin = 1 + r = r && report_error_(b, maybe_match_exprs(b, l + 1)); + r = p && report_error_(b, maybe_expression_2(b, l + 1)) && r; + r = p && consumeToken(b, ERL_END) && r; + exit_section_(b, l, m, r, p, null); + return r || p; + } + + // [else cr_clauses] + private static boolean maybe_expression_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_expression_2")) return false; + maybe_expression_2_0(b, l + 1); + return true; + } + + // else cr_clauses + private static boolean maybe_expression_2_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_expression_2_0")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_); + r = consumeToken(b, ERL_ELSE); + p = r; // pin = 1 + r = r && cr_clauses(b, l + 1); + exit_section_(b, l, m, r, p, null); + return r || p; + } + /* ********************************************************** */ // function_clause_head clause_guard? clause_body static boolean maybe_macro_function_clause(PsiBuilder b, int l) { @@ -4027,6 +4053,80 @@ private static boolean maybe_macro_function_clause_1(PsiBuilder b, int l) { return true; } + /* ********************************************************** */ + // expression '?=' expression + public static boolean maybe_match_expression(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_match_expression")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, ERL_MAYBE_MATCH_EXPRESSION, ""); + r = expression(b, l + 1, -1); + r = r && consumeToken(b, ERL_OP_MAYBE_EQ); + r = r && expression(b, l + 1, -1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // (maybe_match_expression | expression) [',' maybe_match_exprs] (exprs_tail)* + public static boolean maybe_match_exprs(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_match_exprs")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, ERL_MAYBE_MATCH_EXPRS, ""); + r = maybe_match_exprs_0(b, l + 1); + r = r && maybe_match_exprs_1(b, l + 1); + r = r && maybe_match_exprs_2(b, l + 1); + exit_section_(b, l, m, r, false, ErlangParser::exprs_recover); + return r; + } + + // maybe_match_expression | expression + private static boolean maybe_match_exprs_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_match_exprs_0")) return false; + boolean r; + r = maybe_match_expression(b, l + 1); + if (!r) r = expression(b, l + 1, -1); + return r; + } + + // [',' maybe_match_exprs] + private static boolean maybe_match_exprs_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_match_exprs_1")) return false; + maybe_match_exprs_1_0(b, l + 1); + return true; + } + + // ',' maybe_match_exprs + private static boolean maybe_match_exprs_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_match_exprs_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, ERL_COMMA); + r = r && maybe_match_exprs(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // (exprs_tail)* + private static boolean maybe_match_exprs_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_match_exprs_2")) return false; + while (true) { + int c = current_position_(b); + if (!maybe_match_exprs_2_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "maybe_match_exprs_2", c)) break; + } + return true; + } + + // (exprs_tail) + private static boolean maybe_match_exprs_2_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "maybe_match_exprs_2_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = exprs_tail(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + /* ********************************************************** */ // q_var ['::' top_type] public static boolean model_field(PsiBuilder b, int l) { @@ -4154,7 +4254,7 @@ static boolean module_tail(PsiBuilder b, int l) { } /* ********************************************************** */ - // '/' |'*' | div | rem | band | and + // '/' | '*' | div | rem | band | and static boolean mult_op(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "mult_op")) return false; boolean r; @@ -6218,6 +6318,7 @@ private static boolean qualified_expression_3(PsiBuilder b, int l) { // | receive_expression // | fun_expression // | try_expression + // | maybe_expression // | binary_expression // | begin_end_expression public static boolean max_expression(PsiBuilder b, int l) { @@ -6236,6 +6337,7 @@ public static boolean max_expression(PsiBuilder b, int l) { if (!r) r = receive_expression(b, l + 1); if (!r) r = fun_expression(b, l + 1); if (!r) r = try_expression(b, l + 1); + if (!r) r = maybe_expression(b, l + 1); if (!r) r = binary_expression(b, l + 1); if (!r) r = begin_end_expression(b, l + 1); exit_section_(b, l, m, r, false, null); diff --git a/gen/org/intellij/erlang/parser/_ErlangLexer.java b/gen/org/intellij/erlang/parser/_ErlangLexer.java index f1bb0e6b1..6894e781c 100644 --- a/gen/org/intellij/erlang/parser/_ErlangLexer.java +++ b/gen/org/intellij/erlang/parser/_ErlangLexer.java @@ -53,11 +53,11 @@ public static int ZZ_CMAP(int ch) { /* The ZZ_CMAP_A table has 384 entries */ static final char ZZ_CMAP_A[] = zzUnpackCMap( - "\1\1\10\0\1\1\1\6\2\0\1\4\21\0\2\1\1\3\1\22\1\2\1\41\1\5\1\0\1\33\1\67\1\70"+ - "\1\62\1\61\1\43\1\14\1\15\1\63\10\17\2\11\1\56\1\72\1\60\1\42\1\57\1\73\1"+ + "\1\1\10\0\1\1\1\6\2\0\1\4\21\0\2\1\1\3\1\22\1\2\1\41\1\5\1\0\1\33\1\70\1\71"+ + "\1\64\1\63\1\43\1\14\1\15\1\65\10\17\2\11\1\60\1\73\1\62\1\42\1\61\1\67\1"+ "\20\4\7\1\12\25\7\1\34\1\16\1\36\1\21\1\44\1\40\1\45\1\23\1\53\1\24\1\13\1"+ - "\25\1\50\1\47\1\51\2\10\1\66\1\64\1\26\1\52\2\10\1\27\1\30\1\31\1\54\1\32"+ - "\1\46\1\65\1\55\1\10\1\35\1\71\1\37\42\0\1\1\337\0"); + "\25\1\50\1\47\1\51\2\10\1\57\1\56\1\26\1\52\2\10\1\27\1\30\1\31\1\54\1\32"+ + "\1\46\1\66\1\55\1\10\1\35\1\72\1\37\42\0\1\1\337\0"); /** * Translates DFA states to action switch labels. @@ -67,23 +67,23 @@ public static int ZZ_CMAP(int ch) { private static final String ZZ_ACTION_PACKED_0 = "\2\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+ "\1\10\1\7\1\11\1\12\1\1\6\7\1\13\1\14"+ - "\1\15\1\16\1\17\1\20\1\21\1\22\5\7\1\23"+ + "\1\15\1\16\1\17\1\20\1\21\1\22\6\7\1\23"+ "\1\24\1\25\1\26\1\27\1\30\1\7\1\31\1\32"+ "\1\33\1\34\1\35\1\7\1\1\1\36\1\37\1\5"+ - "\1\40\1\0\1\10\1\0\1\7\1\41\1\42\1\43"+ + "\1\40\1\0\1\10\1\0\2\7\1\41\1\42\1\43"+ "\2\0\1\44\14\7\2\20\1\45\1\0\1\46\1\47"+ - "\1\0\3\7\1\50\1\51\1\52\1\7\1\53\1\54"+ + "\1\0\3\7\1\50\1\51\1\52\2\7\1\53\1\54"+ "\1\55\1\56\1\57\1\60\1\61\1\62\1\63\1\7"+ - "\1\64\2\0\1\40\1\65\2\10\1\66\1\67\1\70"+ - "\2\7\1\71\1\72\1\7\1\73\1\7\1\74\1\75"+ - "\1\76\1\7\1\77\1\100\1\20\1\0\1\101\1\102"+ - "\1\7\1\103\4\7\1\104\1\0\1\7\1\105\1\106"+ - "\1\107\1\7\1\20\2\7\1\110\1\7\1\111\1\7"+ - "\1\66\1\0\1\112\1\7\1\113\2\7\1\114\2\7"+ - "\1\115\1\116\1\117"; + "\1\64\1\65\2\0\1\40\1\66\2\10\1\67\1\70"+ + "\1\7\1\71\2\7\1\72\1\73\1\7\1\74\1\7"+ + "\1\75\1\76\1\77\1\7\1\100\1\101\1\20\1\0"+ + "\1\102\1\103\1\7\1\104\5\7\1\105\1\0\1\106"+ + "\1\7\1\107\1\110\1\111\1\7\1\20\2\7\1\112"+ + "\1\7\1\113\2\7\1\67\1\0\1\114\1\7\1\115"+ + "\2\7\1\116\1\117\2\7\1\120\1\121\1\122"; private static int [] zzUnpackAction() { - int [] result = new int[157]; + int [] result = new int[166]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -112,25 +112,26 @@ private static int zzUnpackAction(String packed, int offset, int [] result) { "\0\u01a4\0\u01e0\0\u021c\0\u0258\0\u0294\0\u02d0\0\u030c\0\u0348"+ "\0\u0384\0\u03c0\0\u03fc\0\u0438\0\u0474\0\170\0\170\0\170"+ "\0\170\0\u04b0\0\u04ec\0\170\0\u0528\0\u0564\0\u05a0\0\u05dc"+ - "\0\u0618\0\u0654\0\u0690\0\u06cc\0\u0708\0\170\0\u0744\0\u0780"+ - "\0\170\0\170\0\u07bc\0\170\0\170\0\u07f8\0\u0834\0\170"+ - "\0\u0870\0\u08ac\0\u08e8\0\u0924\0\u0960\0\u099c\0\u09d8\0\170"+ - "\0\170\0\u0a14\0\u02d0\0\u0a50\0\170\0\u0a8c\0\u0ac8\0\u0b04"+ - "\0\u0b40\0\u0b7c\0\u0bb8\0\u0bf4\0\u0c30\0\u0c6c\0\u0ca8\0\u0ce4"+ - "\0\170\0\170\0\u0d20\0\170\0\u0d5c\0\170\0\170\0\u0d98"+ - "\0\u0dd4\0\u0e10\0\u0e4c\0\u01a4\0\u01a4\0\u0e88\0\u0ec4\0\170"+ - "\0\170\0\170\0\170\0\170\0\170\0\170\0\170\0\170"+ - "\0\u0f00\0\170\0\u0834\0\u0f3c\0\u0f78\0\u0fb4\0\u0924\0\u0ff0"+ - "\0\u102c\0\u01a4\0\170\0\u1068\0\u10a4\0\u01a4\0\u01a4\0\u10e0"+ - "\0\u01a4\0\u111c\0\u01a4\0\u01a4\0\u01a4\0\u1158\0\u01a4\0\u01a4"+ - "\0\u1194\0\u11d0\0\170\0\170\0\u120c\0\u1248\0\u1284\0\u12c0"+ - "\0\u12fc\0\u1338\0\u01a4\0\u1374\0\u13b0\0\u01a4\0\u01a4\0\u01a4"+ - "\0\u13ec\0\u1428\0\u1464\0\u14a0\0\u01a4\0\u14dc\0\u01a4\0\u1518"+ - "\0\u1554\0\u1554\0\u01a4\0\u1590\0\u01a4\0\u15cc\0\u1608\0\u01a4"+ - "\0\u1644\0\u1680\0\u01a4\0\u01a4\0\u01a4"; + "\0\u0618\0\u0654\0\u0690\0\u06cc\0\u0708\0\u0744\0\170\0\u0780"+ + "\0\u07bc\0\u07f8\0\170\0\170\0\u0834\0\170\0\u0870\0\u08ac"+ + "\0\170\0\u08e8\0\u0924\0\u0960\0\u099c\0\u09d8\0\u0a14\0\u0a50"+ + "\0\u0a8c\0\170\0\170\0\u0ac8\0\u02d0\0\u0b04\0\170\0\u0b40"+ + "\0\u0b7c\0\u0bb8\0\u0bf4\0\u0c30\0\u0c6c\0\u0ca8\0\u0ce4\0\u0d20"+ + "\0\u0d5c\0\u0d98\0\170\0\170\0\u0dd4\0\170\0\u0e10\0\170"+ + "\0\170\0\u0e4c\0\u0e88\0\u0ec4\0\u0f00\0\u01a4\0\u01a4\0\u0f3c"+ + "\0\u0f78\0\u0fb4\0\170\0\170\0\170\0\170\0\170\0\170"+ + "\0\170\0\170\0\170\0\u0ff0\0\170\0\170\0\u08ac\0\u102c"+ + "\0\u1068\0\u10a4\0\u099c\0\u10e0\0\u111c\0\u01a4\0\u1158\0\170"+ + "\0\u1194\0\u11d0\0\u01a4\0\u01a4\0\u120c\0\u01a4\0\u1248\0\u01a4"+ + "\0\u01a4\0\u01a4\0\u1284\0\u01a4\0\u01a4\0\u12c0\0\u12fc\0\170"+ + "\0\170\0\u1338\0\u1374\0\u13b0\0\u13ec\0\u1428\0\u1464\0\u14a0"+ + "\0\u01a4\0\u14dc\0\u01a4\0\u1518\0\u01a4\0\u01a4\0\u01a4\0\u1554"+ + "\0\u1590\0\u15cc\0\u1608\0\u01a4\0\u1644\0\u01a4\0\u1680\0\u16bc"+ + "\0\u16f8\0\u16f8\0\u01a4\0\u1734\0\u01a4\0\u1770\0\u17ac\0\u01a4"+ + "\0\u01a4\0\u17e8\0\u1824\0\u01a4\0\u01a4\0\u01a4"; private static int [] zzUnpackRowMap() { - int [] result = new int[157]; + int [] result = new int[166]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -158,120 +159,129 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) { "\2\3\1\16\1\17\1\20\1\21\1\22\1\23\1\11"+ "\1\24\1\11\1\25\1\26\1\27\1\30\1\31\1\3"+ "\1\32\1\33\1\34\1\10\1\35\1\36\2\11\1\37"+ - "\1\40\1\41\2\11\1\42\1\43\1\44\1\45\1\46"+ - "\1\47\1\11\1\50\1\11\1\51\1\52\1\53\1\54"+ - "\1\55\16\56\1\57\14\56\1\60\40\56\75\0\1\4"+ - "\4\0\1\4\70\0\1\61\70\0\4\62\1\0\1\63"+ - "\1\0\65\62\7\0\5\10\3\0\2\10\2\0\10\10"+ - "\11\0\12\10\6\0\3\10\14\0\5\11\3\0\2\11"+ - "\2\0\10\11\11\0\12\11\6\0\3\11\7\0\1\64"+ - "\6\0\1\65\3\0\1\66\1\0\1\65\63\0\5\11"+ - "\3\0\2\11\2\0\3\11\1\67\4\11\11\0\12\11"+ - "\6\0\3\11\21\0\1\70\42\0\1\71\31\0\1\72"+ - "\56\0\16\73\1\74\3\73\1\75\51\73\7\0\4\11"+ - "\1\76\3\0\2\11\2\0\3\11\1\77\1\11\1\100"+ - "\2\11\11\0\1\11\1\101\4\11\1\102\3\11\6\0"+ - "\1\11\1\103\1\11\14\0\5\11\3\0\2\11\2\0"+ - "\10\11\11\0\5\11\1\104\4\11\6\0\3\11\14\0"+ - "\5\11\3\0\2\11\2\0\10\11\11\0\10\11\1\105"+ - "\1\11\6\0\3\11\14\0\5\11\3\0\2\11\2\0"+ - "\10\11\11\0\6\11\1\106\3\11\6\0\3\11\14\0"+ - "\4\11\1\107\3\0\2\11\2\0\10\11\11\0\12\11"+ - "\6\0\3\11\14\0\5\11\3\0\2\11\2\0\4\11"+ - "\1\110\3\11\11\0\12\11\6\0\3\11\40\0\1\111"+ - "\40\0\6\112\1\0\7\112\1\113\55\112\42\0\1\114"+ - "\13\0\1\115\1\116\1\117\2\0\1\120\17\0\5\11"+ - "\3\0\2\11\2\0\2\11\1\121\1\122\4\11\11\0"+ - "\12\11\6\0\3\11\14\0\5\11\3\0\2\11\2\0"+ - "\10\11\11\0\3\11\1\123\6\11\6\0\3\11\14\0"+ - "\5\11\3\0\2\11\2\0\2\11\1\124\5\11\11\0"+ - "\12\11\6\0\3\11\14\0\5\11\3\0\2\11\2\0"+ - "\2\11\1\125\1\11\1\126\3\11\11\0\12\11\6\0"+ - "\3\11\14\0\5\11\3\0\2\11\2\0\10\11\11\0"+ - "\1\11\1\127\10\11\6\0\3\11\47\0\1\130\13\0"+ - "\1\131\57\0\1\132\14\0\1\133\30\0\1\134\25\0"+ - "\1\135\15\0\1\136\74\0\1\137\54\0\1\140\40\0"+ - "\5\11\3\0\2\11\2\0\10\11\11\0\6\11\1\141"+ - "\3\11\6\0\3\11\76\0\1\142\2\0\16\56\1\143"+ - "\14\56\1\0\40\56\5\0\1\56\5\0\1\56\1\0"+ - "\3\56\1\0\1\144\23\56\27\0\4\61\1\0\1\61"+ - "\1\0\65\61\4\62\1\0\1\62\1\0\65\62\4\145"+ - "\1\0\1\146\1\0\65\145\7\0\5\147\3\0\1\147"+ - "\3\0\10\147\12\0\11\147\6\0\3\147\7\0\1\64"+ - "\6\0\1\150\3\0\1\66\1\0\1\150\65\0\1\151"+ - "\5\0\1\151\63\0\5\11\3\0\2\11\2\0\1\11"+ - "\1\152\6\11\11\0\12\11\6\0\3\11\22\0\1\153"+ - "\56\0\74\73\7\0\5\11\3\0\2\11\2\0\10\11"+ - "\11\0\4\11\1\154\5\11\6\0\3\11\14\0\5\11"+ - "\3\0\2\11\2\0\10\11\11\0\6\11\1\155\3\11"+ - "\6\0\3\11\14\0\5\11\3\0\2\11\2\0\4\11"+ - "\1\156\3\11\11\0\12\11\6\0\2\11\1\157\14\0"+ - "\5\11\3\0\2\11\2\0\3\11\1\160\4\11\11\0"+ - "\12\11\6\0\3\11\14\0\5\11\3\0\2\11\2\0"+ - "\4\11\1\161\3\11\11\0\12\11\6\0\3\11\14\0"+ + "\1\40\1\41\2\11\1\42\1\11\1\43\1\44\1\45"+ + "\1\46\1\47\1\50\1\51\1\52\1\53\1\54\1\55"+ + "\1\56\16\57\1\60\14\57\1\61\40\57\75\0\1\4"+ + "\4\0\1\4\70\0\1\62\70\0\4\63\1\0\1\64"+ + "\1\0\65\63\7\0\5\10\3\0\2\10\2\0\10\10"+ + "\11\0\14\10\6\0\1\10\14\0\5\11\3\0\2\11"+ + "\2\0\10\11\11\0\14\11\6\0\1\11\7\0\1\65"+ + "\6\0\1\66\3\0\1\67\1\0\1\66\63\0\5\11"+ + "\3\0\2\11\2\0\3\11\1\70\4\11\11\0\13\11"+ + "\1\71\6\0\1\11\21\0\1\72\44\0\1\73\27\0"+ + "\1\74\56\0\16\75\1\76\3\75\1\77\51\75\7\0"+ + "\4\11\1\100\3\0\2\11\2\0\3\11\1\101\1\11"+ + "\1\102\2\11\11\0\1\11\1\103\4\11\1\104\5\11"+ + "\6\0\1\105\14\0\5\11\3\0\2\11\2\0\10\11"+ + "\11\0\5\11\1\106\6\11\6\0\1\11\14\0\5\11"+ + "\3\0\2\11\2\0\10\11\11\0\10\11\1\107\3\11"+ + "\6\0\1\11\14\0\5\11\3\0\2\11\2\0\10\11"+ + "\11\0\6\11\1\110\5\11\6\0\1\11\14\0\4\11"+ + "\1\111\3\0\2\11\2\0\10\11\11\0\14\11\6\0"+ + "\1\11\14\0\5\11\3\0\2\11\2\0\4\11\1\112"+ + "\3\11\11\0\14\11\6\0\1\11\40\0\1\113\40\0"+ + "\6\114\1\0\7\114\1\115\55\114\42\0\1\116\15\0"+ + "\1\117\1\120\1\121\2\0\1\122\15\0\5\11\3\0"+ + "\2\11\2\0\2\11\1\123\1\124\4\11\11\0\14\11"+ + "\6\0\1\11\14\0\5\11\3\0\2\11\2\0\10\11"+ + "\11\0\3\11\1\125\10\11\6\0\1\11\14\0\5\11"+ + "\3\0\2\11\2\0\2\11\1\126\5\11\11\0\14\11"+ + "\6\0\1\11\14\0\5\11\3\0\2\11\2\0\2\11"+ + "\1\127\1\11\1\130\3\11\11\0\14\11\6\0\1\11"+ + "\14\0\5\11\3\0\2\11\2\0\10\11\11\0\1\11"+ + "\1\131\12\11\6\0\1\11\14\0\5\11\3\0\2\11"+ + "\2\0\10\11\11\0\1\11\1\132\12\11\6\0\1\11"+ + "\47\0\1\133\15\0\1\134\55\0\1\135\16\0\1\136"+ + "\26\0\1\137\25\0\1\140\17\0\1\141\74\0\1\142"+ + "\52\0\1\143\40\0\5\11\3\0\2\11\2\0\10\11"+ + "\11\0\6\11\1\144\5\11\6\0\1\11\47\0\1\145"+ + "\123\0\1\146\1\0\16\57\1\147\14\57\1\0\40\57"+ + "\5\0\1\57\5\0\1\57\1\0\3\57\1\0\1\150"+ + "\23\57\27\0\4\62\1\0\1\62\1\0\65\62\4\63"+ + "\1\0\1\63\1\0\65\63\4\151\1\0\1\152\1\0"+ + "\65\151\7\0\5\153\3\0\1\153\3\0\10\153\12\0"+ + "\13\153\6\0\1\153\7\0\1\65\6\0\1\154\3\0"+ + "\1\67\1\0\1\154\65\0\1\155\5\0\1\155\63\0"+ + "\5\11\3\0\2\11\2\0\1\11\1\156\6\11\11\0"+ + "\14\11\6\0\1\11\14\0\5\11\3\0\2\11\2\0"+ + "\5\11\1\157\2\11\11\0\14\11\6\0\1\11\22\0"+ + "\1\160\56\0\74\75\7\0\5\11\3\0\2\11\2\0"+ + "\10\11\11\0\4\11\1\161\7\11\6\0\1\11\14\0"+ "\5\11\3\0\2\11\2\0\10\11\11\0\6\11\1\162"+ - "\3\11\6\0\3\11\14\0\5\11\3\0\2\11\2\0"+ - "\7\11\1\163\11\0\12\11\6\0\3\11\14\0\5\11"+ - "\3\0\2\11\2\0\3\11\1\164\4\11\11\0\12\11"+ - "\6\0\3\11\14\0\5\11\3\0\2\11\2\0\6\11"+ - "\1\165\1\11\11\0\12\11\6\0\3\11\14\0\5\11"+ - "\3\0\2\11\2\0\10\11\11\0\7\11\1\166\2\11"+ - "\6\0\1\167\2\11\14\0\5\11\3\0\2\11\2\0"+ - "\10\11\11\0\11\11\1\170\6\0\3\11\6\0\1\112"+ - "\3\0\2\112\4\0\1\112\1\0\2\112\1\171\1\0"+ - "\1\172\23\112\71\0\1\173\73\0\1\174\40\0\5\11"+ - "\3\0\2\11\2\0\6\11\1\175\1\11\11\0\12\11"+ - "\6\0\3\11\14\0\5\11\3\0\2\11\2\0\1\11"+ - "\1\176\6\11\11\0\12\11\6\0\3\11\14\0\4\11"+ - "\1\177\3\0\2\11\2\0\10\11\11\0\12\11\6\0"+ - "\3\11\14\0\4\11\1\200\3\0\2\11\2\0\10\11"+ - "\11\0\12\11\6\0\3\11\14\0\5\11\3\0\2\11"+ - "\2\0\5\11\1\201\1\202\1\11\11\0\12\11\6\0"+ - "\3\11\14\0\5\11\3\0\2\11\2\0\4\11\1\203"+ - "\3\11\11\0\12\11\6\0\3\11\14\0\1\56\2\0"+ - "\1\56\3\0\1\56\1\0\2\56\12\0\1\56\1\0"+ - "\1\56\5\0\1\56\27\0\4\145\1\0\1\145\1\0"+ - "\65\145\4\146\1\0\1\146\1\0\65\146\11\0\1\150"+ - "\3\0\1\66\1\0\1\150\65\0\1\151\2\204\3\0"+ - "\1\151\63\0\5\11\3\0\2\11\2\0\10\11\11\0"+ - "\5\11\1\205\4\11\6\0\3\11\14\0\5\11\3\0"+ - "\2\11\2\0\6\11\1\206\1\11\11\0\12\11\6\0"+ - "\3\11\14\0\5\11\3\0\2\11\2\0\1\11\1\207"+ - "\6\11\11\0\12\11\6\0\3\11\14\0\5\11\3\0"+ - "\2\11\2\0\4\11\1\210\3\11\11\0\12\11\6\0"+ - "\3\11\14\0\4\11\1\211\3\0\2\11\2\0\10\11"+ - "\11\0\12\11\6\0\3\11\24\0\1\212\63\0\1\112"+ - "\2\0\1\112\3\0\1\112\1\0\2\112\12\0\1\112"+ - "\1\0\1\112\5\0\1\112\36\0\4\11\1\213\3\0"+ - "\2\11\2\0\10\11\11\0\12\11\6\0\3\11\14\0"+ - "\5\11\3\0\2\11\2\0\10\11\11\0\1\11\1\214"+ - "\10\11\6\0\3\11\14\0\5\11\3\0\2\11\2\0"+ - "\3\11\1\215\4\11\11\0\12\11\6\0\3\11\14\0"+ - "\5\11\3\0\2\11\2\0\10\11\11\0\12\11\6\0"+ - "\2\11\1\216\14\0\4\11\1\217\3\0\2\11\2\0"+ - "\10\11\11\0\12\11\6\0\3\11\14\0\5\11\3\0"+ - "\2\11\2\0\10\11\11\0\7\11\1\220\2\11\6\0"+ - "\3\11\16\0\1\221\2\0\1\222\2\0\1\221\41\0"+ - "\1\222\21\0\5\11\3\0\2\11\2\0\3\11\1\223"+ - "\4\11\11\0\12\11\6\0\3\11\14\0\5\11\3\0"+ - "\2\11\2\0\10\11\11\0\5\11\1\224\4\11\6\0"+ - "\3\11\24\0\1\112\63\0\5\11\3\0\2\11\2\0"+ - "\4\11\1\225\3\11\11\0\12\11\6\0\3\11\14\0"+ - "\5\11\3\0\2\11\2\0\10\11\11\0\12\11\6\0"+ - "\2\11\1\226\14\0\5\11\3\0\2\11\2\0\5\11"+ - "\1\227\2\11\11\0\12\11\6\0\3\11\14\0\5\11"+ - "\3\0\2\11\2\0\10\11\11\0\3\11\1\230\6\11"+ - "\6\0\3\11\16\0\1\221\5\0\1\221\63\0\5\11"+ - "\3\0\2\11\2\0\7\11\1\231\11\0\12\11\6\0"+ - "\3\11\14\0\5\11\3\0\2\11\2\0\5\11\1\232"+ - "\2\11\11\0\12\11\6\0\3\11\14\0\4\11\1\233"+ - "\3\0\2\11\2\0\10\11\11\0\12\11\6\0\3\11"+ - "\14\0\4\11\1\234\3\0\2\11\2\0\10\11\11\0"+ - "\12\11\6\0\3\11\14\0\5\11\3\0\2\11\2\0"+ - "\10\11\11\0\6\11\1\235\3\11\6\0\3\11\5\0"; + "\5\11\6\0\1\11\14\0\5\11\3\0\2\11\2\0"+ + "\4\11\1\163\3\11\11\0\13\11\1\164\6\0\1\11"+ + "\14\0\5\11\3\0\2\11\2\0\3\11\1\165\4\11"+ + "\11\0\14\11\6\0\1\11\14\0\5\11\3\0\2\11"+ + "\2\0\4\11\1\166\3\11\11\0\14\11\6\0\1\11"+ + "\14\0\5\11\3\0\2\11\2\0\10\11\11\0\6\11"+ + "\1\167\5\11\6\0\1\11\14\0\5\11\3\0\2\11"+ + "\2\0\7\11\1\170\11\0\14\11\6\0\1\11\14\0"+ + "\5\11\3\0\2\11\2\0\3\11\1\171\4\11\11\0"+ + "\14\11\6\0\1\11\14\0\5\11\3\0\2\11\2\0"+ + "\6\11\1\172\1\11\11\0\14\11\6\0\1\11\14\0"+ + "\5\11\3\0\2\11\2\0\10\11\11\0\7\11\1\173"+ + "\2\11\1\174\1\11\6\0\1\11\14\0\5\11\3\0"+ + "\2\11\2\0\10\11\11\0\11\11\1\175\2\11\6\0"+ + "\1\11\6\0\1\114\3\0\2\114\4\0\1\114\1\0"+ + "\2\114\1\176\1\0\1\177\23\114\71\0\1\200\73\0"+ + "\1\201\40\0\5\11\3\0\2\11\2\0\6\11\1\202"+ + "\1\11\11\0\14\11\6\0\1\11\14\0\5\11\3\0"+ + "\2\11\2\0\1\11\1\203\6\11\11\0\14\11\6\0"+ + "\1\11\14\0\4\11\1\204\3\0\2\11\2\0\10\11"+ + "\11\0\14\11\6\0\1\11\14\0\4\11\1\205\3\0"+ + "\2\11\2\0\10\11\11\0\14\11\6\0\1\11\14\0"+ + "\5\11\3\0\2\11\2\0\5\11\1\206\1\207\1\11"+ + "\11\0\14\11\6\0\1\11\14\0\5\11\3\0\2\11"+ + "\2\0\10\11\11\0\11\11\1\210\2\11\6\0\1\11"+ + "\14\0\5\11\3\0\2\11\2\0\4\11\1\211\3\11"+ + "\11\0\14\11\6\0\1\11\14\0\1\57\2\0\1\57"+ + "\3\0\1\57\1\0\2\57\12\0\1\57\1\0\1\57"+ + "\5\0\1\57\27\0\4\151\1\0\1\151\1\0\65\151"+ + "\4\152\1\0\1\152\1\0\65\152\11\0\1\154\3\0"+ + "\1\67\1\0\1\154\65\0\1\155\2\212\3\0\1\155"+ + "\63\0\4\11\1\213\3\0\2\11\2\0\10\11\11\0"+ + "\14\11\6\0\1\11\14\0\5\11\3\0\2\11\2\0"+ + "\10\11\11\0\5\11\1\214\6\11\6\0\1\11\14\0"+ + "\5\11\3\0\2\11\2\0\6\11\1\215\1\11\11\0"+ + "\14\11\6\0\1\11\14\0\5\11\3\0\2\11\2\0"+ + "\1\11\1\216\6\11\11\0\14\11\6\0\1\11\14\0"+ + "\5\11\3\0\2\11\2\0\4\11\1\217\3\11\11\0"+ + "\14\11\6\0\1\11\14\0\4\11\1\220\3\0\2\11"+ + "\2\0\10\11\11\0\14\11\6\0\1\11\24\0\1\221"+ + "\63\0\1\114\2\0\1\114\3\0\1\114\1\0\2\114"+ + "\12\0\1\114\1\0\1\114\5\0\1\114\36\0\4\11"+ + "\1\222\3\0\2\11\2\0\10\11\11\0\14\11\6\0"+ + "\1\11\14\0\5\11\3\0\2\11\2\0\10\11\11\0"+ + "\1\11\1\223\12\11\6\0\1\11\14\0\5\11\3\0"+ + "\2\11\2\0\3\11\1\224\4\11\11\0\14\11\6\0"+ + "\1\11\14\0\5\11\3\0\2\11\2\0\10\11\11\0"+ + "\13\11\1\225\6\0\1\11\14\0\4\11\1\226\3\0"+ + "\2\11\2\0\10\11\11\0\14\11\6\0\1\11\14\0"+ + "\5\11\3\0\2\11\2\0\10\11\11\0\7\11\1\227"+ + "\4\11\6\0\1\11\14\0\5\11\3\0\2\11\2\0"+ + "\1\230\7\11\11\0\14\11\6\0\1\11\16\0\1\231"+ + "\2\0\1\232\2\0\1\231\43\0\1\232\17\0\5\11"+ + "\3\0\2\11\2\0\3\11\1\233\4\11\11\0\14\11"+ + "\6\0\1\11\14\0\5\11\3\0\2\11\2\0\10\11"+ + "\11\0\5\11\1\234\6\11\6\0\1\11\24\0\1\114"+ + "\63\0\5\11\3\0\2\11\2\0\4\11\1\235\3\11"+ + "\11\0\14\11\6\0\1\11\14\0\5\11\3\0\2\11"+ + "\2\0\10\11\11\0\13\11\1\236\6\0\1\11\14\0"+ + "\5\11\3\0\2\11\2\0\5\11\1\237\2\11\11\0"+ + "\14\11\6\0\1\11\14\0\5\11\3\0\2\11\2\0"+ + "\10\11\11\0\3\11\1\240\10\11\6\0\1\11\14\0"+ + "\4\11\1\241\3\0\2\11\2\0\10\11\11\0\14\11"+ + "\6\0\1\11\16\0\1\231\5\0\1\231\63\0\5\11"+ + "\3\0\2\11\2\0\7\11\1\242\11\0\14\11\6\0"+ + "\1\11\14\0\5\11\3\0\2\11\2\0\5\11\1\243"+ + "\2\11\11\0\14\11\6\0\1\11\14\0\4\11\1\244"+ + "\3\0\2\11\2\0\10\11\11\0\14\11\6\0\1\11"+ + "\14\0\4\11\1\245\3\0\2\11\2\0\10\11\11\0"+ + "\14\11\6\0\1\11\14\0\5\11\3\0\2\11\2\0"+ + "\10\11\11\0\6\11\1\246\5\11\6\0\1\11\5\0"; private static int [] zzUnpackTrans() { - int [] result = new int[5820]; + int [] result = new int[6240]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -310,14 +320,14 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) { private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\11\2\1\1\11\17\1\4\11\2\1\1\11"+ - "\11\1\1\11\2\1\2\11\1\1\2\11\2\1\1\11"+ - "\3\1\1\0\1\1\1\0\1\1\2\11\1\1\2\0"+ + "\12\1\1\11\3\1\2\11\1\1\1\11\2\1\1\11"+ + "\3\1\1\0\1\1\1\0\2\1\2\11\1\1\2\0"+ "\1\11\13\1\2\11\1\1\1\11\1\0\2\11\1\0"+ - "\7\1\11\11\1\1\1\11\2\0\6\1\1\11\16\1"+ - "\1\0\2\11\7\1\1\0\15\1\1\0\13\1"; + "\10\1\11\11\1\1\2\11\2\0\7\1\1\11\16\1"+ + "\1\0\2\11\10\1\1\0\17\1\1\0\14\1"; private static int [] zzUnpackAttribute() { - int [] result = new int[157]; + int [] result = new int[166]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -626,397 +636,412 @@ else if (zzAtEOF) { { yybegin(YYINITIAL); return com.intellij.psi.TokenType.BAD_CHARACTER; } // fall through - case 80: break; + case 83: break; case 2: { return com.intellij.psi.TokenType.WHITE_SPACE; } // fall through - case 81: break; + case 84: break; case 3: { return ERL_RADIX; } // fall through - case 82: break; + case 85: break; case 4: { return ERL_OP_EXL; } // fall through - case 83: break; + case 86: break; case 5: { return ERL_COMMENT; } // fall through - case 84: break; + case 87: break; case 6: { return ERL_VAR; } // fall through - case 85: break; + case 88: break; case 7: { return ERL_ATOM_NAME; } // fall through - case 86: break; + case 89: break; case 8: { return ERL_INTEGER; } // fall through - case 87: break; + case 90: break; case 9: { return ERL_OP_MINUS; } // fall through - case 88: break; + case 91: break; case 10: { return ERL_DOT; } // fall through - case 89: break; + case 92: break; case 11: { yybegin(IN_QUOTES); return ERL_SINGLE_QUOTE; } // fall through - case 90: break; + case 93: break; case 12: { return ERL_BRACKET_LEFT; } // fall through - case 91: break; + case 94: break; case 13: { return ERL_CURLY_LEFT; } // fall through - case 92: break; + case 95: break; case 14: { return ERL_BRACKET_RIGHT; } // fall through - case 93: break; + case 96: break; case 15: { return ERL_CURLY_RIGHT; } // fall through - case 94: break; + case 97: break; case 16: { return ERL_CHAR; } // fall through - case 95: break; + case 98: break; case 17: { return ERL_OP_EQ; } // fall through - case 96: break; + case 99: break; case 18: { return ERL_COMMA; } // fall through - case 97: break; + case 100: break; case 19: { return ERL_COLON; } // fall through - case 98: break; + case 101: break; case 20: { return ERL_OP_GT; } // fall through - case 99: break; + case 102: break; case 21: { return ERL_OP_LT; } // fall through - case 100: break; + case 103: break; case 22: { return ERL_OP_PLUS; } // fall through - case 101: break; + case 104: break; case 23: { return ERL_OP_AR_MUL; } // fall through - case 102: break; + case 105: break; case 24: { return ERL_OP_AR_DIV; } // fall through - case 103: break; + case 106: break; case 25: - { return ERL_PAR_LEFT; + { return ERL_QMARK; } // fall through - case 104: break; + case 107: break; case 26: - { return ERL_PAR_RIGHT; + { return ERL_PAR_LEFT; } // fall through - case 105: break; + case 108: break; case 27: - { return ERL_OP_OR; + { return ERL_PAR_RIGHT; } // fall through - case 106: break; + case 109: break; case 28: - { return ERL_SEMI; + { return ERL_OP_OR; } // fall through - case 107: break; + case 110: break; case 29: - { return ERL_QMARK; + { return ERL_SEMI; } // fall through - case 108: break; + case 111: break; case 30: { yybegin(YYINITIAL); return ERL_SINGLE_QUOTE; } // fall through - case 109: break; + case 112: break; case 31: { return getTokenStart() == 0 ? ERL_SHEBANG : com.intellij.psi.TokenType.ERROR_ELEMENT; } // fall through - case 110: break; + case 113: break; case 32: { return ERL_FUNCTION_DOC_COMMENT; } // fall through - case 111: break; + case 114: break; case 33: { return ERL_OP_MINUS_MINUS; } // fall through - case 112: break; + case 115: break; case 34: { return ERL_ARROW; } // fall through - case 113: break; + case 116: break; case 35: { return ERL_DOT_DOT; } // fall through - case 114: break; + case 117: break; case 36: { return ERL_STRING; } // fall through - case 115: break; + case 118: break; case 37: { return ERL_OP_EQ_EQ; } // fall through - case 116: break; + case 119: break; case 38: { return ERL_ASSOC; } // fall through - case 117: break; + case 120: break; case 39: { return ERL_OP_EQ_LT; } // fall through - case 118: break; + case 121: break; case 40: { return ERL_IF; } // fall through - case 119: break; + case 122: break; case 41: { return ERL_OF; } // fall through - case 120: break; + case 123: break; case 42: { return ERL_OR; } // fall through - case 121: break; + case 124: break; case 43: { return ERL_MATCH; } // fall through - case 122: break; + case 125: break; case 44: { return ERL_COLON_COLON; } // fall through - case 123: break; + case 126: break; case 45: { return ERL_OP_GT_EQ; } // fall through - case 124: break; + case 127: break; case 46: { return ERL_BIN_END; } // fall through - case 125: break; + case 128: break; case 47: { return ERL_OP_LT_MINUS; } // fall through - case 126: break; + case 129: break; case 48: { return ERL_OP_LT_EQ; } // fall through - case 127: break; + case 130: break; case 49: { return ERL_BIN_START; } // fall through - case 128: break; + case 131: break; case 50: { return ERL_OP_PLUS_PLUS; } // fall through - case 129: break; + case 132: break; case 51: { return ERL_OP_DIV_EQ; } // fall through - case 130: break; + case 133: break; case 52: - { return ERL_OR_OR; + { return ERL_OP_MAYBE_EQ; } // fall through - case 131: break; + case 134: break; case 53: - { return ERL_MODULE_DOC_COMMENT; + { return ERL_OR_OR; } // fall through - case 132: break; + case 135: break; case 54: - { return ERL_FLOAT; + { return ERL_MODULE_DOC_COMMENT; } // fall through - case 133: break; + case 136: break; case 55: - { return ERL_END; + { return ERL_FLOAT; } // fall through - case 134: break; + case 137: break; case 56: - { return ERL_DOT_DOT_DOT; + { return ERL_END; } // fall through - case 135: break; + case 138: break; case 57: - { return ERL_BSR; + { return ERL_DOT_DOT_DOT; } // fall through - case 136: break; + case 139: break; case 58: - { return ERL_BSL; + { return ERL_BSR; } // fall through - case 137: break; + case 140: break; case 59: - { return ERL_BOR; + { return ERL_BSL; } // fall through - case 138: break; + case 141: break; case 60: - { return ERL_DIV; + { return ERL_BOR; } // fall through - case 139: break; + case 142: break; case 61: - { return ERL_FUN; + { return ERL_DIV; } // fall through - case 140: break; + case 143: break; case 62: - { return ERL_NOT; + { return ERL_FUN; } // fall through - case 141: break; + case 144: break; case 63: - { return ERL_REM; + { return ERL_NOT; } // fall through - case 142: break; + case 145: break; case 64: - { return ERL_TRY; + { return ERL_REM; } // fall through - case 143: break; + case 146: break; case 65: - { return ERL_OP_EQ_COL_EQ; + { return ERL_TRY; } // fall through - case 144: break; + case 147: break; case 66: - { return ERL_OP_EQ_DIV_EQ; + { return ERL_OP_EQ_COL_EQ; } // fall through - case 145: break; + case 148: break; case 67: - { return ERL_AND; + { return ERL_OP_EQ_DIV_EQ; } // fall through - case 146: break; + case 149: break; case 68: - { return ERL_XOR; + { return ERL_AND; } // fall through - case 147: break; + case 150: break; case 69: - { return ERL_BNOT; + { return ERL_XOR; } // fall through - case 148: break; + case 151: break; case 70: - { return ERL_BAND; + { return ERL_ELSE; } // fall through - case 149: break; + case 152: break; case 71: - { return ERL_BXOR; + { return ERL_BNOT; } // fall through - case 150: break; + case 153: break; case 72: - { return ERL_WHEN; + { return ERL_BAND; } // fall through - case 151: break; + case 154: break; case 73: - { return ERL_CASE; + { return ERL_BXOR; } // fall through - case 152: break; + case 155: break; case 74: - { return ERL_BEGIN; + { return ERL_WHEN; } // fall through - case 153: break; + case 156: break; case 75: - { return ERL_AFTER; + { return ERL_CASE; } // fall through - case 154: break; + case 157: break; case 76: - { return ERL_CATCH; + { return ERL_BEGIN; } // fall through - case 155: break; + case 158: break; case 77: - { return ERL_ORELSE; + { return ERL_AFTER; } // fall through - case 156: break; + case 159: break; case 78: - { return ERL_RECEIVE; + { return ERL_CATCH; } // fall through - case 157: break; + case 160: break; case 79: + { return ERL_MAYBE; + } + // fall through + case 161: break; + case 80: + { return ERL_ORELSE; + } + // fall through + case 162: break; + case 81: + { return ERL_RECEIVE; + } + // fall through + case 163: break; + case 82: { return ERL_ANDALSO; } // fall through - case 158: break; + case 164: break; default: zzScanError(ZZ_NO_MATCH); } diff --git a/gen/org/intellij/erlang/psi/ErlangAttribute.java b/gen/org/intellij/erlang/psi/ErlangAttribute.java index 84de87e2f..4cc338646 100644 --- a/gen/org/intellij/erlang/psi/ErlangAttribute.java +++ b/gen/org/intellij/erlang/psi/ErlangAttribute.java @@ -16,6 +16,9 @@ public interface ErlangAttribute extends ErlangCompositeElement { @Nullable ErlangCallbackSpec getCallbackSpec(); + @Nullable + ErlangElseAtomAttribute getElseAtomAttribute(); + @Nullable ErlangExport getExport(); diff --git a/gen/org/intellij/erlang/psi/ErlangElseAtomAttribute.java b/gen/org/intellij/erlang/psi/ErlangElseAtomAttribute.java new file mode 100644 index 000000000..41577707e --- /dev/null +++ b/gen/org/intellij/erlang/psi/ErlangElseAtomAttribute.java @@ -0,0 +1,10 @@ +// This is a generated file. Not intended for manual editing. +package org.intellij.erlang.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface ErlangElseAtomAttribute extends ErlangMetaAttribute { + +} diff --git a/gen/org/intellij/erlang/psi/ErlangMaybeExpression.java b/gen/org/intellij/erlang/psi/ErlangMaybeExpression.java new file mode 100644 index 000000000..a93bcccee --- /dev/null +++ b/gen/org/intellij/erlang/psi/ErlangMaybeExpression.java @@ -0,0 +1,25 @@ +// This is a generated file. Not intended for manual editing. +package org.intellij.erlang.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface ErlangMaybeExpression extends ErlangExpression, ErlangClauseOwner { + + @NotNull + List getCrClauseList(); + + @Nullable + ErlangMaybeMatchExprs getMaybeMatchExprs(); + + @Nullable + PsiElement getElse(); + + @Nullable + PsiElement getEnd(); + + @NotNull + PsiElement getMaybe(); + +} diff --git a/gen/org/intellij/erlang/psi/ErlangMaybeMatchExpression.java b/gen/org/intellij/erlang/psi/ErlangMaybeMatchExpression.java new file mode 100644 index 000000000..3fccfbb38 --- /dev/null +++ b/gen/org/intellij/erlang/psi/ErlangMaybeMatchExpression.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package org.intellij.erlang.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface ErlangMaybeMatchExpression extends ErlangFakeBinaryExpression { + + @NotNull + PsiElement getOpMaybeEq(); + +} diff --git a/gen/org/intellij/erlang/psi/ErlangMaybeMatchExprs.java b/gen/org/intellij/erlang/psi/ErlangMaybeMatchExprs.java new file mode 100644 index 000000000..ce49a5a6e --- /dev/null +++ b/gen/org/intellij/erlang/psi/ErlangMaybeMatchExprs.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package org.intellij.erlang.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface ErlangMaybeMatchExprs extends ErlangCompositeElement { + + @NotNull + List getExpressionList(); + + @Nullable + ErlangMaybeMatchExprs getMaybeMatchExprs(); + +} diff --git a/gen/org/intellij/erlang/psi/ErlangVisitor.java b/gen/org/intellij/erlang/psi/ErlangVisitor.java index 1de165dc8..34b33c217 100644 --- a/gen/org/intellij/erlang/psi/ErlangVisitor.java +++ b/gen/org/intellij/erlang/psi/ErlangVisitor.java @@ -140,6 +140,10 @@ public void visitCrClause(@NotNull ErlangCrClause o) { visitCompositeElement(o); } + public void visitElseAtomAttribute(@NotNull ErlangElseAtomAttribute o) { + visitMetaAttribute(o); + } + public void visitExport(@NotNull ErlangExport o) { visitMetaAttribute(o); } @@ -340,6 +344,19 @@ public void visitMaxExpression(@NotNull ErlangMaxExpression o) { visitExpression(o); } + public void visitMaybeExpression(@NotNull ErlangMaybeExpression o) { + visitExpression(o); + // visitClauseOwner(o); + } + + public void visitMaybeMatchExpression(@NotNull ErlangMaybeMatchExpression o) { + visitFakeBinaryExpression(o); + } + + public void visitMaybeMatchExprs(@NotNull ErlangMaybeMatchExprs o) { + visitCompositeElement(o); + } + public void visitModelFieldList(@NotNull ErlangModelFieldList o) { visitCompositeElement(o); } diff --git a/gen/org/intellij/erlang/psi/impl/ErlangAttributeImpl.java b/gen/org/intellij/erlang/psi/impl/ErlangAttributeImpl.java index fa53f0303..59ee11efe 100644 --- a/gen/org/intellij/erlang/psi/impl/ErlangAttributeImpl.java +++ b/gen/org/intellij/erlang/psi/impl/ErlangAttributeImpl.java @@ -44,6 +44,12 @@ public ErlangCallbackSpec getCallbackSpec() { return PsiTreeUtil.getChildOfType(this, ErlangCallbackSpec.class); } + @Override + @Nullable + public ErlangElseAtomAttribute getElseAtomAttribute() { + return PsiTreeUtil.getChildOfType(this, ErlangElseAtomAttribute.class); + } + @Override @Nullable public ErlangExport getExport() { diff --git a/gen/org/intellij/erlang/psi/impl/ErlangElseAtomAttributeImpl.java b/gen/org/intellij/erlang/psi/impl/ErlangElseAtomAttributeImpl.java new file mode 100644 index 000000000..e7aa377be --- /dev/null +++ b/gen/org/intellij/erlang/psi/impl/ErlangElseAtomAttributeImpl.java @@ -0,0 +1,29 @@ +// This is a generated file. Not intended for manual editing. +package org.intellij.erlang.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 org.intellij.erlang.ErlangTypes.*; +import org.intellij.erlang.psi.*; + +public class ErlangElseAtomAttributeImpl extends ErlangCompositeElementImpl implements ErlangElseAtomAttribute { + + public ErlangElseAtomAttributeImpl(ASTNode node) { + super(node); + } + + public void accept(@NotNull ErlangVisitor visitor) { + visitor.visitElseAtomAttribute(this); + } + + @Override + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof ErlangVisitor) accept((ErlangVisitor)visitor); + else super.accept(visitor); + } + +} diff --git a/gen/org/intellij/erlang/psi/impl/ErlangMaybeExpressionImpl.java b/gen/org/intellij/erlang/psi/impl/ErlangMaybeExpressionImpl.java new file mode 100644 index 000000000..6cd933ced --- /dev/null +++ b/gen/org/intellij/erlang/psi/impl/ErlangMaybeExpressionImpl.java @@ -0,0 +1,60 @@ +// This is a generated file. Not intended for manual editing. +package org.intellij.erlang.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 org.intellij.erlang.ErlangTypes.*; +import org.intellij.erlang.psi.*; + +public class ErlangMaybeExpressionImpl extends ErlangExpressionImpl implements ErlangMaybeExpression { + + public ErlangMaybeExpressionImpl(ASTNode node) { + super(node); + } + + @Override + public void accept(@NotNull ErlangVisitor visitor) { + visitor.visitMaybeExpression(this); + } + + @Override + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof ErlangVisitor) accept((ErlangVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getCrClauseList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, ErlangCrClause.class); + } + + @Override + @Nullable + public ErlangMaybeMatchExprs getMaybeMatchExprs() { + return PsiTreeUtil.getChildOfType(this, ErlangMaybeMatchExprs.class); + } + + @Override + @Nullable + public PsiElement getElse() { + return findChildByType(ERL_ELSE); + } + + @Override + @Nullable + public PsiElement getEnd() { + return findChildByType(ERL_END); + } + + @Override + @NotNull + public PsiElement getMaybe() { + return notNullChild(findChildByType(ERL_MAYBE)); + } + +} diff --git a/gen/org/intellij/erlang/psi/impl/ErlangMaybeMatchExpressionImpl.java b/gen/org/intellij/erlang/psi/impl/ErlangMaybeMatchExpressionImpl.java new file mode 100644 index 000000000..b442d106e --- /dev/null +++ b/gen/org/intellij/erlang/psi/impl/ErlangMaybeMatchExpressionImpl.java @@ -0,0 +1,36 @@ +// This is a generated file. Not intended for manual editing. +package org.intellij.erlang.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 org.intellij.erlang.ErlangTypes.*; +import org.intellij.erlang.psi.*; + +public class ErlangMaybeMatchExpressionImpl extends ErlangFakeBinaryExpressionImpl implements ErlangMaybeMatchExpression { + + public ErlangMaybeMatchExpressionImpl(ASTNode node) { + super(node); + } + + @Override + public void accept(@NotNull ErlangVisitor visitor) { + visitor.visitMaybeMatchExpression(this); + } + + @Override + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof ErlangVisitor) accept((ErlangVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public PsiElement getOpMaybeEq() { + return notNullChild(findChildByType(ERL_OP_MAYBE_EQ)); + } + +} diff --git a/gen/org/intellij/erlang/psi/impl/ErlangMaybeMatchExprsImpl.java b/gen/org/intellij/erlang/psi/impl/ErlangMaybeMatchExprsImpl.java new file mode 100644 index 000000000..2c92648d3 --- /dev/null +++ b/gen/org/intellij/erlang/psi/impl/ErlangMaybeMatchExprsImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package org.intellij.erlang.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 org.intellij.erlang.ErlangTypes.*; +import org.intellij.erlang.psi.*; + +public class ErlangMaybeMatchExprsImpl extends ErlangCompositeElementImpl implements ErlangMaybeMatchExprs { + + public ErlangMaybeMatchExprsImpl(ASTNode node) { + super(node); + } + + public void accept(@NotNull ErlangVisitor visitor) { + visitor.visitMaybeMatchExprs(this); + } + + @Override + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof ErlangVisitor) accept((ErlangVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getExpressionList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, ErlangExpression.class); + } + + @Override + @Nullable + public ErlangMaybeMatchExprs getMaybeMatchExprs() { + return PsiTreeUtil.getChildOfType(this, ErlangMaybeMatchExprs.class); + } + +} diff --git a/grammars/erlang.bnf b/grammars/erlang.bnf index 9e350b5fe..0aa4d0e28 100644 --- a/grammars/erlang.bnf +++ b/grammars/erlang.bnf @@ -39,6 +39,7 @@ OP_EQ = "=" OP_EXL = "!" OP_LT_MINUS = "<-" + OP_MAYBE_EQ = "?=" BIN_START = "<<" BIN_END = ">>" @@ -65,7 +66,7 @@ ASSOC = "=>" ] - extends("assignment_expression|send_expression|orelse_expression|andalso_expression|comp_op_expression|list_op_expression|additive_expression|multiplicative_expression")=fake_binary_expression + extends("assignment_expression|maybe_match_expression|send_expression|orelse_expression|andalso_expression|comp_op_expression|list_op_expression|additive_expression|multiplicative_expression")=fake_binary_expression extends(".*_(expression|comprehension|literal)")=expression name(".*_(expression|comprehension|literal)")=expression @@ -82,7 +83,7 @@ extends("behaviour|type_definition|include|include_lib|callback_spec|callback_function")="org.intellij.erlang.psi.impl.ErlangStubbedPsiElementBase" elementTypeFactory("function|behaviour|module|record_definition|type_definition|macros_definition|include|include_lib|callback_spec|callback_function|specification")="org.intellij.erlang.ErlangElementTypeFactory.factory" - implements("case_expression|try_expression|receive_expression")="org.intellij.erlang.psi.ErlangClauseOwner" + implements("case_expression|try_expression|receive_expression|maybe_expression")="org.intellij.erlang.psi.ErlangClauseOwner" } forms ::= console_expression | application_file_expression | form_with_period * @@ -92,7 +93,7 @@ private console_expression_or_empty ::= exprs period | empty {pin(".*")=1} private empty ::= () private form_with_period ::= form period {recoverWhile=form_recover pin=1} private left period ::= '.' | <> <> -private form_recover ::= !('+' | '-' | '<<' | '?' | '[' | '{' | atom_name | single_quote | bnot | char | float | integer | not | string | var | '#'| '.') +private form_recover ::= !('+' | '-' | '<<' | '?' | '[' | '{' | atom_name | single_quote | bnot | char | float | integer | not | string | var | '#' | '.') private form ::= is_config config_expression | function @@ -219,7 +220,7 @@ type_ref ::= q_atom { } ifdef_ifndef_undef_attribute ::= &('ifdef'|'ifndef'|'undef') atom_name '(' macros_name ')' {pin=2 elementType=atom_attribute} -else_atom_attribute ::= &'else' atom_name {elementType=atom_attribute} +else_atom_attribute ::= 'else' {pin=1} on_load ::= &'on_load' atom_name '(' function_with_arity ')'{pin=2 elementType=atom_attribute} atom_attribute ::= atom_name ['(' typed_attr_val ')' | typed_attr_val | attr_val] {methods=[getName]} export_functions ::= '[' export_function_list? ']' {pin=1} @@ -439,6 +440,7 @@ max_expression ::= | receive_expression | fun_expression | try_expression + | maybe_expression | binary_expression | begin_end_expression @@ -571,6 +573,10 @@ try_clauses ::= try_clause (';' try_clause)* try_clause ::= <> clause_guard? clause_body {pin=1} private try_argument_definition ::= [argument_definition ':'] argument_definition +maybe_expression ::= maybe maybe_match_exprs [else cr_clauses] end {pin(".*")=1} +maybe_match_exprs ::= (maybe_match_expression | expression) [',' maybe_match_exprs] (exprs_tail)* {pin=3 recoverWhile=exprs_recover} +maybe_match_expression ::= expression '?=' expression { rightAssociative=true } + argument_list ::= '(' call_exprs? ')' fake fake_binary_expression ::= expression+ { @@ -582,7 +588,7 @@ fake fake_binary_expression ::= expression+ { private exprs ::= expression (exprs_tail)* {pin=2 recoverWhile=exprs_recover} private exprs_tail ::= ',' expression {pin=1 recoverWhile=exprs_recover} -private exprs_recover ::= !(')' | ',' | '->' | '.' | ':-' | ';' | '}' | after | catch | end | of | atom '(') +private exprs_recover ::= !(')' | ',' | '->' | '.' | ':-' | ';' | '}' | after | catch | else | end | of | atom '(') guard ::= exprs (';' exprs)* {pin(".*")=1} private atomic ::= q_atom !'(' | integer | (string_literal | macros)+ | float | char string_literal ::= string { @@ -591,10 +597,10 @@ string_literal ::= string { } private prefix_op ::= '+' | '-' | bnot | not -private mult_op ::= '/' |'*' | div | rem | band | and -private add_op ::= '+' |'-' | bor | bxor | bsl | bsr | or | xor +private mult_op ::= '/' | '*' | div | rem | band | and +private add_op ::= '+' | '-' | bor | bxor | bsl | bsr | or | xor private list_op ::= '++' | '--' -private comp_op ::= '==' | '/=' |'=<' |'<' |'>=' |'>' |'=:=' |'=/=' +private comp_op ::= '==' | '/=' | '=<' |'<' | '>=' | '>' | '=:=' | '=/=' rule ::= rule_clause (';' rule_clause)* {pin(".*")=1} rule_clause ::= q_atom argument_list clause_guard? rule_body diff --git a/resources/liveTemplates/erlang.xml b/resources/liveTemplates/erlang.xml index 32f606bc8..c0c2e25fc 100644 --- a/resources/liveTemplates/erlang.xml +++ b/resources/liveTemplates/erlang.xml @@ -98,6 +98,32 @@