@@ -898,13 +898,14 @@ class Result
898898
899899 # Create a new result object with the given values.
900900 #--
901- #: (Array[Comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
902- def initialize ( comments , magic_comments , data_loc , errors , warnings , source )
901+ #: (Array[Comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
902+ def initialize ( comments , magic_comments , data_loc , errors , warnings , continuable , source )
903903 @comments = comments
904904 @magic_comments = magic_comments
905905 @data_loc = data_loc
906906 @errors = errors
907907 @warnings = warnings
908+ @continuable = continuable
908909 @source = source
909910 end
910911
@@ -961,54 +962,8 @@ def failure?
961962 #--
962963 #: () -> bool
963964 def continuable?
964- return false if errors . empty?
965-
966- offset = source . source . bytesize
967- errors . all? { |error | CONTINUABLE . include? ( error . type ) || error . location . start_offset == offset }
968- end
969-
970- # The set of error types whose location the parser places at the opening
971- # token of an unclosed construct rather than at the end of the source. These
972- # errors always indicate incomplete input regardless of their byte position,
973- # so they are checked by type rather than by location.
974- #--
975- #: Array[Symbol]
976- CONTINUABLE = %i[
977- begin_term
978- begin_upcase_term
979- block_param_pipe_term
980- block_term_brace
981- block_term_end
982- case_missing_conditions
983- case_term
984- class_term
985- conditional_term
986- conditional_term_else
987- def_term
988- embdoc_term
989- end_upcase_term
990- for_term
991- hash_term
992- heredoc_term
993- lambda_term_brace
994- lambda_term_end
995- list_i_lower_term
996- list_i_upper_term
997- list_w_lower_term
998- list_w_upper_term
999- module_term
1000- regexp_term
1001- rescue_term
1002- string_interpolated_term
1003- string_literal_eof
1004- symbol_term_dynamic
1005- symbol_term_interpolated
1006- until_term
1007- while_term
1008- xstring_term
1009- ] . freeze
1010-
1011- private_constant :CONTINUABLE
965+ @continuable
966+ end
1012967
1013968 # Create a code units cache for the given encoding.
1014969 #--
@@ -1033,10 +988,10 @@ class ParseResult < Result
1033988
1034989 # Create a new parse result object with the given values.
1035990 #--
1036- #: (ProgramNode value, Array[Comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
1037- def initialize ( value , comments , magic_comments , data_loc , errors , warnings , source )
991+ #: (ProgramNode value, Array[Comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
992+ def initialize ( value , comments , magic_comments , data_loc , errors , warnings , continuable , source )
1038993 @value = value
1039- super ( comments , magic_comments , data_loc , errors , warnings , source )
994+ super ( comments , magic_comments , data_loc , errors , warnings , continuable , source )
1040995 end
1041996
1042997 # Implement the hash pattern matching interface for ParseResult.
@@ -1077,10 +1032,10 @@ class LexResult < Result
10771032
10781033 # Create a new lex result object with the given values.
10791034 #--
1080- #: (Array[[Token, Integer]] value, Array[Comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
1081- def initialize ( value , comments , magic_comments , data_loc , errors , warnings , source )
1035+ #: (Array[[Token, Integer]] value, Array[Comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
1036+ def initialize ( value , comments , magic_comments , data_loc , errors , warnings , continuable , source )
10821037 @value = value
1083- super ( comments , magic_comments , data_loc , errors , warnings , source )
1038+ super ( comments , magic_comments , data_loc , errors , warnings , continuable , source )
10841039 end
10851040
10861041 # Implement the hash pattern matching interface for LexResult.
@@ -1099,10 +1054,10 @@ class ParseLexResult < Result
10991054
11001055 # Create a new parse lex result object with the given values.
11011056 #--
1102- #: ([ProgramNode, Array[[Token, Integer]]] value, Array[Comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
1103- def initialize ( value , comments , magic_comments , data_loc , errors , warnings , source )
1057+ #: ([ProgramNode, Array[[Token, Integer]]] value, Array[Comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
1058+ def initialize ( value , comments , magic_comments , data_loc , errors , warnings , continuable , source )
11041059 @value = value
1105- super ( comments , magic_comments , data_loc , errors , warnings , source )
1060+ super ( comments , magic_comments , data_loc , errors , warnings , continuable , source )
11061061 end
11071062
11081063 # Implement the hash pattern matching interface for ParseLexResult.
0 commit comments