prism 0.28.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -1
- data/CONTRIBUTING.md +0 -4
- data/README.md +1 -0
- data/config.yml +95 -26
- data/docs/fuzzing.md +1 -1
- data/docs/ripper_translation.md +22 -0
- data/ext/prism/api_node.c +70 -52
- data/ext/prism/extconf.rb +27 -23
- data/ext/prism/extension.c +107 -372
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +170 -102
- data/include/prism/diagnostic.h +18 -3
- data/include/prism/node.h +0 -21
- data/include/prism/parser.h +23 -25
- data/include/prism/regexp.h +17 -8
- data/include/prism/static_literals.h +3 -2
- data/include/prism/util/pm_char.h +1 -2
- data/include/prism/util/pm_constant_pool.h +0 -8
- data/include/prism/util/pm_integer.h +16 -9
- data/include/prism/util/pm_string.h +0 -8
- data/include/prism/version.h +2 -2
- data/include/prism.h +0 -11
- data/lib/prism/compiler.rb +3 -0
- data/lib/prism/desugar_compiler.rb +4 -4
- data/lib/prism/dispatcher.rb +14 -0
- data/lib/prism/dot_visitor.rb +54 -35
- data/lib/prism/dsl.rb +23 -18
- data/lib/prism/ffi.rb +25 -4
- data/lib/prism/inspect_visitor.rb +26 -24
- data/lib/prism/mutation_compiler.rb +6 -1
- data/lib/prism/node.rb +314 -389
- data/lib/prism/node_ext.rb +175 -17
- data/lib/prism/parse_result/comments.rb +1 -8
- data/lib/prism/parse_result/newlines.rb +102 -12
- data/lib/prism/parse_result.rb +17 -0
- data/lib/prism/reflection.rb +11 -9
- data/lib/prism/serialize.rb +91 -68
- data/lib/prism/translation/parser/compiler.rb +288 -138
- data/lib/prism/translation/parser.rb +7 -2
- data/lib/prism/translation/ripper.rb +24 -22
- data/lib/prism/translation/ruby_parser.rb +32 -14
- data/lib/prism/visitor.rb +3 -0
- data/lib/prism.rb +0 -4
- data/prism.gemspec +2 -4
- data/rbi/prism/node.rbi +114 -57
- data/rbi/prism/node_ext.rbi +5 -0
- data/rbi/prism/parse_result.rbi +1 -1
- data/rbi/prism/visitor.rbi +3 -0
- data/rbi/prism.rbi +6 -0
- data/sig/prism/dsl.rbs +13 -10
- data/sig/prism/lex_compat.rbs +10 -0
- data/sig/prism/mutation_compiler.rbs +1 -0
- data/sig/prism/node.rbs +72 -48
- data/sig/prism/node_ext.rbs +4 -0
- data/sig/prism/visitor.rbs +1 -0
- data/sig/prism.rbs +21 -0
- data/src/diagnostic.c +56 -27
- data/src/node.c +432 -1690
- data/src/prettyprint.c +97 -54
- data/src/prism.c +1286 -1196
- data/src/regexp.c +133 -68
- data/src/serialize.c +22 -17
- data/src/static_literals.c +63 -84
- data/src/token_type.c +4 -4
- data/src/util/pm_constant_pool.c +0 -8
- data/src/util/pm_integer.c +39 -11
- data/src/util/pm_string.c +0 -12
- data/src/util/pm_strpbrk.c +32 -6
- metadata +3 -5
- data/include/prism/util/pm_string_list.h +0 -44
- data/lib/prism/debug.rb +0 -249
- data/src/util/pm_string_list.c +0 -28
data/include/prism/ast.h
CHANGED
@@ -831,194 +831,197 @@ enum pm_node_type {
|
|
831
831
|
/** InterpolatedXStringNode */
|
832
832
|
PM_INTERPOLATED_X_STRING_NODE = 87,
|
833
833
|
|
834
|
+
/** ItLocalVariableReadNode */
|
835
|
+
PM_IT_LOCAL_VARIABLE_READ_NODE = 88,
|
836
|
+
|
834
837
|
/** ItParametersNode */
|
835
|
-
PM_IT_PARAMETERS_NODE =
|
838
|
+
PM_IT_PARAMETERS_NODE = 89,
|
836
839
|
|
837
840
|
/** KeywordHashNode */
|
838
|
-
PM_KEYWORD_HASH_NODE =
|
841
|
+
PM_KEYWORD_HASH_NODE = 90,
|
839
842
|
|
840
843
|
/** KeywordRestParameterNode */
|
841
|
-
PM_KEYWORD_REST_PARAMETER_NODE =
|
844
|
+
PM_KEYWORD_REST_PARAMETER_NODE = 91,
|
842
845
|
|
843
846
|
/** LambdaNode */
|
844
|
-
PM_LAMBDA_NODE =
|
847
|
+
PM_LAMBDA_NODE = 92,
|
845
848
|
|
846
849
|
/** LocalVariableAndWriteNode */
|
847
|
-
PM_LOCAL_VARIABLE_AND_WRITE_NODE =
|
850
|
+
PM_LOCAL_VARIABLE_AND_WRITE_NODE = 93,
|
848
851
|
|
849
852
|
/** LocalVariableOperatorWriteNode */
|
850
|
-
PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE =
|
853
|
+
PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE = 94,
|
851
854
|
|
852
855
|
/** LocalVariableOrWriteNode */
|
853
|
-
PM_LOCAL_VARIABLE_OR_WRITE_NODE =
|
856
|
+
PM_LOCAL_VARIABLE_OR_WRITE_NODE = 95,
|
854
857
|
|
855
858
|
/** LocalVariableReadNode */
|
856
|
-
PM_LOCAL_VARIABLE_READ_NODE =
|
859
|
+
PM_LOCAL_VARIABLE_READ_NODE = 96,
|
857
860
|
|
858
861
|
/** LocalVariableTargetNode */
|
859
|
-
PM_LOCAL_VARIABLE_TARGET_NODE =
|
862
|
+
PM_LOCAL_VARIABLE_TARGET_NODE = 97,
|
860
863
|
|
861
864
|
/** LocalVariableWriteNode */
|
862
|
-
PM_LOCAL_VARIABLE_WRITE_NODE =
|
865
|
+
PM_LOCAL_VARIABLE_WRITE_NODE = 98,
|
863
866
|
|
864
867
|
/** MatchLastLineNode */
|
865
|
-
PM_MATCH_LAST_LINE_NODE =
|
868
|
+
PM_MATCH_LAST_LINE_NODE = 99,
|
866
869
|
|
867
870
|
/** MatchPredicateNode */
|
868
|
-
PM_MATCH_PREDICATE_NODE =
|
871
|
+
PM_MATCH_PREDICATE_NODE = 100,
|
869
872
|
|
870
873
|
/** MatchRequiredNode */
|
871
|
-
PM_MATCH_REQUIRED_NODE =
|
874
|
+
PM_MATCH_REQUIRED_NODE = 101,
|
872
875
|
|
873
876
|
/** MatchWriteNode */
|
874
|
-
PM_MATCH_WRITE_NODE =
|
877
|
+
PM_MATCH_WRITE_NODE = 102,
|
875
878
|
|
876
879
|
/** MissingNode */
|
877
|
-
PM_MISSING_NODE =
|
880
|
+
PM_MISSING_NODE = 103,
|
878
881
|
|
879
882
|
/** ModuleNode */
|
880
|
-
PM_MODULE_NODE =
|
883
|
+
PM_MODULE_NODE = 104,
|
881
884
|
|
882
885
|
/** MultiTargetNode */
|
883
|
-
PM_MULTI_TARGET_NODE =
|
886
|
+
PM_MULTI_TARGET_NODE = 105,
|
884
887
|
|
885
888
|
/** MultiWriteNode */
|
886
|
-
PM_MULTI_WRITE_NODE =
|
889
|
+
PM_MULTI_WRITE_NODE = 106,
|
887
890
|
|
888
891
|
/** NextNode */
|
889
|
-
PM_NEXT_NODE =
|
892
|
+
PM_NEXT_NODE = 107,
|
890
893
|
|
891
894
|
/** NilNode */
|
892
|
-
PM_NIL_NODE =
|
895
|
+
PM_NIL_NODE = 108,
|
893
896
|
|
894
897
|
/** NoKeywordsParameterNode */
|
895
|
-
PM_NO_KEYWORDS_PARAMETER_NODE =
|
898
|
+
PM_NO_KEYWORDS_PARAMETER_NODE = 109,
|
896
899
|
|
897
900
|
/** NumberedParametersNode */
|
898
|
-
PM_NUMBERED_PARAMETERS_NODE =
|
901
|
+
PM_NUMBERED_PARAMETERS_NODE = 110,
|
899
902
|
|
900
903
|
/** NumberedReferenceReadNode */
|
901
|
-
PM_NUMBERED_REFERENCE_READ_NODE =
|
904
|
+
PM_NUMBERED_REFERENCE_READ_NODE = 111,
|
902
905
|
|
903
906
|
/** OptionalKeywordParameterNode */
|
904
|
-
PM_OPTIONAL_KEYWORD_PARAMETER_NODE =
|
907
|
+
PM_OPTIONAL_KEYWORD_PARAMETER_NODE = 112,
|
905
908
|
|
906
909
|
/** OptionalParameterNode */
|
907
|
-
PM_OPTIONAL_PARAMETER_NODE =
|
910
|
+
PM_OPTIONAL_PARAMETER_NODE = 113,
|
908
911
|
|
909
912
|
/** OrNode */
|
910
|
-
PM_OR_NODE =
|
913
|
+
PM_OR_NODE = 114,
|
911
914
|
|
912
915
|
/** ParametersNode */
|
913
|
-
PM_PARAMETERS_NODE =
|
916
|
+
PM_PARAMETERS_NODE = 115,
|
914
917
|
|
915
918
|
/** ParenthesesNode */
|
916
|
-
PM_PARENTHESES_NODE =
|
919
|
+
PM_PARENTHESES_NODE = 116,
|
917
920
|
|
918
921
|
/** PinnedExpressionNode */
|
919
|
-
PM_PINNED_EXPRESSION_NODE =
|
922
|
+
PM_PINNED_EXPRESSION_NODE = 117,
|
920
923
|
|
921
924
|
/** PinnedVariableNode */
|
922
|
-
PM_PINNED_VARIABLE_NODE =
|
925
|
+
PM_PINNED_VARIABLE_NODE = 118,
|
923
926
|
|
924
927
|
/** PostExecutionNode */
|
925
|
-
PM_POST_EXECUTION_NODE =
|
928
|
+
PM_POST_EXECUTION_NODE = 119,
|
926
929
|
|
927
930
|
/** PreExecutionNode */
|
928
|
-
PM_PRE_EXECUTION_NODE =
|
931
|
+
PM_PRE_EXECUTION_NODE = 120,
|
929
932
|
|
930
933
|
/** ProgramNode */
|
931
|
-
PM_PROGRAM_NODE =
|
934
|
+
PM_PROGRAM_NODE = 121,
|
932
935
|
|
933
936
|
/** RangeNode */
|
934
|
-
PM_RANGE_NODE =
|
937
|
+
PM_RANGE_NODE = 122,
|
935
938
|
|
936
939
|
/** RationalNode */
|
937
|
-
PM_RATIONAL_NODE =
|
940
|
+
PM_RATIONAL_NODE = 123,
|
938
941
|
|
939
942
|
/** RedoNode */
|
940
|
-
PM_REDO_NODE =
|
943
|
+
PM_REDO_NODE = 124,
|
941
944
|
|
942
945
|
/** RegularExpressionNode */
|
943
|
-
PM_REGULAR_EXPRESSION_NODE =
|
946
|
+
PM_REGULAR_EXPRESSION_NODE = 125,
|
944
947
|
|
945
948
|
/** RequiredKeywordParameterNode */
|
946
|
-
PM_REQUIRED_KEYWORD_PARAMETER_NODE =
|
949
|
+
PM_REQUIRED_KEYWORD_PARAMETER_NODE = 126,
|
947
950
|
|
948
951
|
/** RequiredParameterNode */
|
949
|
-
PM_REQUIRED_PARAMETER_NODE =
|
952
|
+
PM_REQUIRED_PARAMETER_NODE = 127,
|
950
953
|
|
951
954
|
/** RescueModifierNode */
|
952
|
-
PM_RESCUE_MODIFIER_NODE =
|
955
|
+
PM_RESCUE_MODIFIER_NODE = 128,
|
953
956
|
|
954
957
|
/** RescueNode */
|
955
|
-
PM_RESCUE_NODE =
|
958
|
+
PM_RESCUE_NODE = 129,
|
956
959
|
|
957
960
|
/** RestParameterNode */
|
958
|
-
PM_REST_PARAMETER_NODE =
|
961
|
+
PM_REST_PARAMETER_NODE = 130,
|
959
962
|
|
960
963
|
/** RetryNode */
|
961
|
-
PM_RETRY_NODE =
|
964
|
+
PM_RETRY_NODE = 131,
|
962
965
|
|
963
966
|
/** ReturnNode */
|
964
|
-
PM_RETURN_NODE =
|
967
|
+
PM_RETURN_NODE = 132,
|
965
968
|
|
966
969
|
/** SelfNode */
|
967
|
-
PM_SELF_NODE =
|
970
|
+
PM_SELF_NODE = 133,
|
968
971
|
|
969
972
|
/** ShareableConstantNode */
|
970
|
-
PM_SHAREABLE_CONSTANT_NODE =
|
973
|
+
PM_SHAREABLE_CONSTANT_NODE = 134,
|
971
974
|
|
972
975
|
/** SingletonClassNode */
|
973
|
-
PM_SINGLETON_CLASS_NODE =
|
976
|
+
PM_SINGLETON_CLASS_NODE = 135,
|
974
977
|
|
975
978
|
/** SourceEncodingNode */
|
976
|
-
PM_SOURCE_ENCODING_NODE =
|
979
|
+
PM_SOURCE_ENCODING_NODE = 136,
|
977
980
|
|
978
981
|
/** SourceFileNode */
|
979
|
-
PM_SOURCE_FILE_NODE =
|
982
|
+
PM_SOURCE_FILE_NODE = 137,
|
980
983
|
|
981
984
|
/** SourceLineNode */
|
982
|
-
PM_SOURCE_LINE_NODE =
|
985
|
+
PM_SOURCE_LINE_NODE = 138,
|
983
986
|
|
984
987
|
/** SplatNode */
|
985
|
-
PM_SPLAT_NODE =
|
988
|
+
PM_SPLAT_NODE = 139,
|
986
989
|
|
987
990
|
/** StatementsNode */
|
988
|
-
PM_STATEMENTS_NODE =
|
991
|
+
PM_STATEMENTS_NODE = 140,
|
989
992
|
|
990
993
|
/** StringNode */
|
991
|
-
PM_STRING_NODE =
|
994
|
+
PM_STRING_NODE = 141,
|
992
995
|
|
993
996
|
/** SuperNode */
|
994
|
-
PM_SUPER_NODE =
|
997
|
+
PM_SUPER_NODE = 142,
|
995
998
|
|
996
999
|
/** SymbolNode */
|
997
|
-
PM_SYMBOL_NODE =
|
1000
|
+
PM_SYMBOL_NODE = 143,
|
998
1001
|
|
999
1002
|
/** TrueNode */
|
1000
|
-
PM_TRUE_NODE =
|
1003
|
+
PM_TRUE_NODE = 144,
|
1001
1004
|
|
1002
1005
|
/** UndefNode */
|
1003
|
-
PM_UNDEF_NODE =
|
1006
|
+
PM_UNDEF_NODE = 145,
|
1004
1007
|
|
1005
1008
|
/** UnlessNode */
|
1006
|
-
PM_UNLESS_NODE =
|
1009
|
+
PM_UNLESS_NODE = 146,
|
1007
1010
|
|
1008
1011
|
/** UntilNode */
|
1009
|
-
PM_UNTIL_NODE =
|
1012
|
+
PM_UNTIL_NODE = 147,
|
1010
1013
|
|
1011
1014
|
/** WhenNode */
|
1012
|
-
PM_WHEN_NODE =
|
1015
|
+
PM_WHEN_NODE = 148,
|
1013
1016
|
|
1014
1017
|
/** WhileNode */
|
1015
|
-
PM_WHILE_NODE =
|
1018
|
+
PM_WHILE_NODE = 149,
|
1016
1019
|
|
1017
1020
|
/** XStringNode */
|
1018
|
-
PM_X_STRING_NODE =
|
1021
|
+
PM_X_STRING_NODE = 150,
|
1019
1022
|
|
1020
1023
|
/** YieldNode */
|
1021
|
-
PM_YIELD_NODE =
|
1024
|
+
PM_YIELD_NODE = 151,
|
1022
1025
|
|
1023
1026
|
/** A special kind of node used for compilation. */
|
1024
1027
|
PM_SCOPE_NODE
|
@@ -1818,14 +1821,14 @@ typedef struct pm_call_operator_write_node {
|
|
1818
1821
|
pm_constant_id_t write_name;
|
1819
1822
|
|
1820
1823
|
/**
|
1821
|
-
* CallOperatorWriteNode#
|
1824
|
+
* CallOperatorWriteNode#binary_operator
|
1822
1825
|
*/
|
1823
|
-
pm_constant_id_t
|
1826
|
+
pm_constant_id_t binary_operator;
|
1824
1827
|
|
1825
1828
|
/**
|
1826
|
-
* CallOperatorWriteNode#
|
1829
|
+
* CallOperatorWriteNode#binary_operator_loc
|
1827
1830
|
*/
|
1828
|
-
pm_location_t
|
1831
|
+
pm_location_t binary_operator_loc;
|
1829
1832
|
|
1830
1833
|
/**
|
1831
1834
|
* CallOperatorWriteNode#value
|
@@ -2129,9 +2132,9 @@ typedef struct pm_class_variable_operator_write_node {
|
|
2129
2132
|
pm_location_t name_loc;
|
2130
2133
|
|
2131
2134
|
/**
|
2132
|
-
* ClassVariableOperatorWriteNode#
|
2135
|
+
* ClassVariableOperatorWriteNode#binary_operator_loc
|
2133
2136
|
*/
|
2134
|
-
pm_location_t
|
2137
|
+
pm_location_t binary_operator_loc;
|
2135
2138
|
|
2136
2139
|
/**
|
2137
2140
|
* ClassVariableOperatorWriteNode#value
|
@@ -2139,9 +2142,9 @@ typedef struct pm_class_variable_operator_write_node {
|
|
2139
2142
|
struct pm_node *value;
|
2140
2143
|
|
2141
2144
|
/**
|
2142
|
-
* ClassVariableOperatorWriteNode#
|
2145
|
+
* ClassVariableOperatorWriteNode#binary_operator
|
2143
2146
|
*/
|
2144
|
-
pm_constant_id_t
|
2147
|
+
pm_constant_id_t binary_operator;
|
2145
2148
|
} pm_class_variable_operator_write_node_t;
|
2146
2149
|
|
2147
2150
|
/**
|
@@ -2326,9 +2329,9 @@ typedef struct pm_constant_operator_write_node {
|
|
2326
2329
|
pm_location_t name_loc;
|
2327
2330
|
|
2328
2331
|
/**
|
2329
|
-
* ConstantOperatorWriteNode#
|
2332
|
+
* ConstantOperatorWriteNode#binary_operator_loc
|
2330
2333
|
*/
|
2331
|
-
pm_location_t
|
2334
|
+
pm_location_t binary_operator_loc;
|
2332
2335
|
|
2333
2336
|
/**
|
2334
2337
|
* ConstantOperatorWriteNode#value
|
@@ -2336,9 +2339,9 @@ typedef struct pm_constant_operator_write_node {
|
|
2336
2339
|
struct pm_node *value;
|
2337
2340
|
|
2338
2341
|
/**
|
2339
|
-
* ConstantOperatorWriteNode#
|
2342
|
+
* ConstantOperatorWriteNode#binary_operator
|
2340
2343
|
*/
|
2341
|
-
pm_constant_id_t
|
2344
|
+
pm_constant_id_t binary_operator;
|
2342
2345
|
} pm_constant_operator_write_node_t;
|
2343
2346
|
|
2344
2347
|
/**
|
@@ -2478,9 +2481,9 @@ typedef struct pm_constant_path_operator_write_node {
|
|
2478
2481
|
struct pm_constant_path_node *target;
|
2479
2482
|
|
2480
2483
|
/**
|
2481
|
-
* ConstantPathOperatorWriteNode#
|
2484
|
+
* ConstantPathOperatorWriteNode#binary_operator_loc
|
2482
2485
|
*/
|
2483
|
-
pm_location_t
|
2486
|
+
pm_location_t binary_operator_loc;
|
2484
2487
|
|
2485
2488
|
/**
|
2486
2489
|
* ConstantPathOperatorWriteNode#value
|
@@ -2488,9 +2491,9 @@ typedef struct pm_constant_path_operator_write_node {
|
|
2488
2491
|
struct pm_node *value;
|
2489
2492
|
|
2490
2493
|
/**
|
2491
|
-
* ConstantPathOperatorWriteNode#
|
2494
|
+
* ConstantPathOperatorWriteNode#binary_operator
|
2492
2495
|
*/
|
2493
|
-
pm_constant_id_t
|
2496
|
+
pm_constant_id_t binary_operator;
|
2494
2497
|
} pm_constant_path_operator_write_node_t;
|
2495
2498
|
|
2496
2499
|
/**
|
@@ -3015,36 +3018,73 @@ typedef struct pm_for_node {
|
|
3015
3018
|
|
3016
3019
|
/**
|
3017
3020
|
* ForNode#index
|
3021
|
+
*
|
3022
|
+
* The index expression for `for` loops.
|
3023
|
+
*
|
3024
|
+
* for i in a end
|
3025
|
+
* ^
|
3018
3026
|
*/
|
3019
3027
|
struct pm_node *index;
|
3020
3028
|
|
3021
3029
|
/**
|
3022
3030
|
* ForNode#collection
|
3031
|
+
*
|
3032
|
+
* The collection to iterate over.
|
3033
|
+
*
|
3034
|
+
* for i in a end
|
3035
|
+
* ^
|
3023
3036
|
*/
|
3024
3037
|
struct pm_node *collection;
|
3025
3038
|
|
3026
3039
|
/**
|
3027
3040
|
* ForNode#statements
|
3041
|
+
*
|
3042
|
+
* Represents the body of statements to execute for each iteration of the loop.
|
3043
|
+
*
|
3044
|
+
* for i in a
|
3045
|
+
* foo(i)
|
3046
|
+
* ^^^^^^
|
3047
|
+
* end
|
3028
3048
|
*/
|
3029
3049
|
struct pm_statements_node *statements;
|
3030
3050
|
|
3031
3051
|
/**
|
3032
3052
|
* ForNode#for_keyword_loc
|
3053
|
+
*
|
3054
|
+
* The location of the `for` keyword.
|
3055
|
+
*
|
3056
|
+
* for i in a end
|
3057
|
+
* ^^^
|
3033
3058
|
*/
|
3034
3059
|
pm_location_t for_keyword_loc;
|
3035
3060
|
|
3036
3061
|
/**
|
3037
3062
|
* ForNode#in_keyword_loc
|
3063
|
+
*
|
3064
|
+
* The location of the `in` keyword.
|
3065
|
+
*
|
3066
|
+
* for i in a end
|
3067
|
+
* ^^
|
3038
3068
|
*/
|
3039
3069
|
pm_location_t in_keyword_loc;
|
3040
3070
|
|
3041
3071
|
/**
|
3042
3072
|
* ForNode#do_keyword_loc
|
3073
|
+
*
|
3074
|
+
* The location of the `do` keyword, if present.
|
3075
|
+
*
|
3076
|
+
* for i in a do end
|
3077
|
+
* ^^
|
3043
3078
|
*/
|
3044
3079
|
pm_location_t do_keyword_loc;
|
3045
3080
|
|
3046
3081
|
/**
|
3047
3082
|
* ForNode#end_keyword_loc
|
3083
|
+
*
|
3084
|
+
* The location of the `end` keyword.
|
3085
|
+
*
|
3086
|
+
* for i in a end
|
3087
|
+
* ^^^
|
3048
3088
|
*/
|
3049
3089
|
pm_location_t end_keyword_loc;
|
3050
3090
|
} pm_for_node_t;
|
@@ -3144,9 +3184,9 @@ typedef struct pm_global_variable_operator_write_node {
|
|
3144
3184
|
pm_location_t name_loc;
|
3145
3185
|
|
3146
3186
|
/**
|
3147
|
-
* GlobalVariableOperatorWriteNode#
|
3187
|
+
* GlobalVariableOperatorWriteNode#binary_operator_loc
|
3148
3188
|
*/
|
3149
|
-
pm_location_t
|
3189
|
+
pm_location_t binary_operator_loc;
|
3150
3190
|
|
3151
3191
|
/**
|
3152
3192
|
* GlobalVariableOperatorWriteNode#value
|
@@ -3154,9 +3194,9 @@ typedef struct pm_global_variable_operator_write_node {
|
|
3154
3194
|
struct pm_node *value;
|
3155
3195
|
|
3156
3196
|
/**
|
3157
|
-
* GlobalVariableOperatorWriteNode#
|
3197
|
+
* GlobalVariableOperatorWriteNode#binary_operator
|
3158
3198
|
*/
|
3159
|
-
pm_constant_id_t
|
3199
|
+
pm_constant_id_t binary_operator;
|
3160
3200
|
} pm_global_variable_operator_write_node_t;
|
3161
3201
|
|
3162
3202
|
/**
|
@@ -3651,14 +3691,14 @@ typedef struct pm_index_operator_write_node {
|
|
3651
3691
|
struct pm_node *block;
|
3652
3692
|
|
3653
3693
|
/**
|
3654
|
-
* IndexOperatorWriteNode#
|
3694
|
+
* IndexOperatorWriteNode#binary_operator
|
3655
3695
|
*/
|
3656
|
-
pm_constant_id_t
|
3696
|
+
pm_constant_id_t binary_operator;
|
3657
3697
|
|
3658
3698
|
/**
|
3659
|
-
* IndexOperatorWriteNode#
|
3699
|
+
* IndexOperatorWriteNode#binary_operator_loc
|
3660
3700
|
*/
|
3661
|
-
pm_location_t
|
3701
|
+
pm_location_t binary_operator_loc;
|
3662
3702
|
|
3663
3703
|
/**
|
3664
3704
|
* IndexOperatorWriteNode#value
|
@@ -3819,9 +3859,9 @@ typedef struct pm_instance_variable_operator_write_node {
|
|
3819
3859
|
pm_location_t name_loc;
|
3820
3860
|
|
3821
3861
|
/**
|
3822
|
-
* InstanceVariableOperatorWriteNode#
|
3862
|
+
* InstanceVariableOperatorWriteNode#binary_operator_loc
|
3823
3863
|
*/
|
3824
|
-
pm_location_t
|
3864
|
+
pm_location_t binary_operator_loc;
|
3825
3865
|
|
3826
3866
|
/**
|
3827
3867
|
* InstanceVariableOperatorWriteNode#value
|
@@ -3829,9 +3869,9 @@ typedef struct pm_instance_variable_operator_write_node {
|
|
3829
3869
|
struct pm_node *value;
|
3830
3870
|
|
3831
3871
|
/**
|
3832
|
-
* InstanceVariableOperatorWriteNode#
|
3872
|
+
* InstanceVariableOperatorWriteNode#binary_operator
|
3833
3873
|
*/
|
3834
|
-
pm_constant_id_t
|
3874
|
+
pm_constant_id_t binary_operator;
|
3835
3875
|
} pm_instance_variable_operator_write_node_t;
|
3836
3876
|
|
3837
3877
|
/**
|
@@ -4148,6 +4188,18 @@ typedef struct pm_interpolated_x_string_node {
|
|
4148
4188
|
pm_location_t closing_loc;
|
4149
4189
|
} pm_interpolated_x_string_node_t;
|
4150
4190
|
|
4191
|
+
/**
|
4192
|
+
* ItLocalVariableReadNode
|
4193
|
+
*
|
4194
|
+
* Type: PM_IT_LOCAL_VARIABLE_READ_NODE
|
4195
|
+
*
|
4196
|
+
* @extends pm_node_t
|
4197
|
+
*/
|
4198
|
+
typedef struct pm_it_local_variable_read_node {
|
4199
|
+
/** The embedded base node. */
|
4200
|
+
pm_node_t base;
|
4201
|
+
} pm_it_local_variable_read_node_t;
|
4202
|
+
|
4151
4203
|
/**
|
4152
4204
|
* ItParametersNode
|
4153
4205
|
*
|
@@ -4304,9 +4356,9 @@ typedef struct pm_local_variable_operator_write_node {
|
|
4304
4356
|
pm_location_t name_loc;
|
4305
4357
|
|
4306
4358
|
/**
|
4307
|
-
* LocalVariableOperatorWriteNode#
|
4359
|
+
* LocalVariableOperatorWriteNode#binary_operator_loc
|
4308
4360
|
*/
|
4309
|
-
pm_location_t
|
4361
|
+
pm_location_t binary_operator_loc;
|
4310
4362
|
|
4311
4363
|
/**
|
4312
4364
|
* LocalVariableOperatorWriteNode#value
|
@@ -4319,9 +4371,9 @@ typedef struct pm_local_variable_operator_write_node {
|
|
4319
4371
|
pm_constant_id_t name;
|
4320
4372
|
|
4321
4373
|
/**
|
4322
|
-
* LocalVariableOperatorWriteNode#
|
4374
|
+
* LocalVariableOperatorWriteNode#binary_operator
|
4323
4375
|
*/
|
4324
|
-
pm_constant_id_t
|
4376
|
+
pm_constant_id_t binary_operator;
|
4325
4377
|
|
4326
4378
|
/**
|
4327
4379
|
* LocalVariableOperatorWriteNode#depth
|
@@ -4389,10 +4441,6 @@ typedef struct pm_local_variable_read_node {
|
|
4389
4441
|
* Note that this can also be an underscore followed by a number for the default block parameters.
|
4390
4442
|
*
|
4391
4443
|
* _1 # name `:_1`
|
4392
|
-
*
|
4393
|
-
* Finally, for the default `it` block parameter, the name is `0it`. This is to distinguish it from an `it` local variable that is explicitly declared.
|
4394
|
-
*
|
4395
|
-
* it # name `:0it`
|
4396
4444
|
*/
|
4397
4445
|
pm_constant_id_t name;
|
4398
4446
|
|
@@ -5238,6 +5286,11 @@ typedef struct pm_range_node {
|
|
5238
5286
|
* RationalNode
|
5239
5287
|
*
|
5240
5288
|
* Type: PM_RATIONAL_NODE
|
5289
|
+
* Flags:
|
5290
|
+
* PM_INTEGER_BASE_FLAGS_BINARY
|
5291
|
+
* PM_INTEGER_BASE_FLAGS_DECIMAL
|
5292
|
+
* PM_INTEGER_BASE_FLAGS_OCTAL
|
5293
|
+
* PM_INTEGER_BASE_FLAGS_HEXADECIMAL
|
5241
5294
|
*
|
5242
5295
|
* @extends pm_node_t
|
5243
5296
|
*/
|
@@ -5246,9 +5299,22 @@ typedef struct pm_rational_node {
|
|
5246
5299
|
pm_node_t base;
|
5247
5300
|
|
5248
5301
|
/**
|
5249
|
-
* RationalNode#
|
5302
|
+
* RationalNode#numerator
|
5303
|
+
*
|
5304
|
+
* The numerator of the rational number.
|
5305
|
+
*
|
5306
|
+
* 1.5r # numerator 3
|
5250
5307
|
*/
|
5251
|
-
|
5308
|
+
pm_integer_t numerator;
|
5309
|
+
|
5310
|
+
/**
|
5311
|
+
* RationalNode#denominator
|
5312
|
+
*
|
5313
|
+
* The denominator of the rational number.
|
5314
|
+
*
|
5315
|
+
* 1.5r # denominator 2
|
5316
|
+
*/
|
5317
|
+
pm_integer_t denominator;
|
5252
5318
|
} pm_rational_node_t;
|
5253
5319
|
|
5254
5320
|
/**
|
@@ -5833,7 +5899,9 @@ typedef struct pm_unless_node {
|
|
5833
5899
|
* UnlessNode#then_keyword_loc
|
5834
5900
|
*
|
5835
5901
|
* The location of the `then` keyword, if present.
|
5836
|
-
*
|
5902
|
+
*
|
5903
|
+
* unless cond then bar end
|
5904
|
+
* ^^^^
|
5837
5905
|
*/
|
5838
5906
|
pm_location_t then_keyword_loc;
|
5839
5907
|
|
data/include/prism/diagnostic.h
CHANGED
@@ -36,13 +36,16 @@ typedef enum {
|
|
36
36
|
PM_ERR_ARGUMENT_BARE_HASH,
|
37
37
|
PM_ERR_ARGUMENT_BLOCK_FORWARDING,
|
38
38
|
PM_ERR_ARGUMENT_BLOCK_MULTI,
|
39
|
+
PM_ERR_ARGUMENT_CONFLICT_AMPERSAND,
|
40
|
+
PM_ERR_ARGUMENT_CONFLICT_STAR,
|
41
|
+
PM_ERR_ARGUMENT_CONFLICT_STAR_STAR,
|
39
42
|
PM_ERR_ARGUMENT_FORMAL_CLASS,
|
40
43
|
PM_ERR_ARGUMENT_FORMAL_CONSTANT,
|
41
44
|
PM_ERR_ARGUMENT_FORMAL_GLOBAL,
|
42
45
|
PM_ERR_ARGUMENT_FORMAL_IVAR,
|
43
46
|
PM_ERR_ARGUMENT_FORWARDING_UNBOUND,
|
44
47
|
PM_ERR_ARGUMENT_IN,
|
45
|
-
|
48
|
+
PM_ERR_ARGUMENT_NO_FORWARDING_AMPERSAND,
|
46
49
|
PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES,
|
47
50
|
PM_ERR_ARGUMENT_NO_FORWARDING_STAR,
|
48
51
|
PM_ERR_ARGUMENT_NO_FORWARDING_STAR_STAR,
|
@@ -124,6 +127,7 @@ typedef enum {
|
|
124
127
|
PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT_HASH,
|
125
128
|
PM_ERR_EXPECT_EXPRESSION_AFTER_STAR,
|
126
129
|
PM_ERR_EXPECT_IDENT_REQ_PARAMETER,
|
130
|
+
PM_ERR_EXPECT_IN_DELIMITER,
|
127
131
|
PM_ERR_EXPECT_LPAREN_REQ_PARAMETER,
|
128
132
|
PM_ERR_EXPECT_MESSAGE,
|
129
133
|
PM_ERR_EXPECT_RBRACKET,
|
@@ -139,6 +143,7 @@ typedef enum {
|
|
139
143
|
PM_ERR_EXPRESSION_NOT_WRITABLE_FILE,
|
140
144
|
PM_ERR_EXPRESSION_NOT_WRITABLE_LINE,
|
141
145
|
PM_ERR_EXPRESSION_NOT_WRITABLE_NIL,
|
146
|
+
PM_ERR_EXPRESSION_NOT_WRITABLE_NUMBERED,
|
142
147
|
PM_ERR_EXPRESSION_NOT_WRITABLE_SELF,
|
143
148
|
PM_ERR_EXPRESSION_NOT_WRITABLE_TRUE,
|
144
149
|
PM_ERR_FLOAT_PARSE,
|
@@ -163,6 +168,7 @@ typedef enum {
|
|
163
168
|
PM_ERR_INVALID_BLOCK_EXIT,
|
164
169
|
PM_ERR_INVALID_CHARACTER,
|
165
170
|
PM_ERR_INVALID_ENCODING_MAGIC_COMMENT,
|
171
|
+
PM_ERR_INVALID_ESCAPE_CHARACTER,
|
166
172
|
PM_ERR_INVALID_FLOAT_EXPONENT,
|
167
173
|
PM_ERR_INVALID_LOCAL_VARIABLE_READ,
|
168
174
|
PM_ERR_INVALID_LOCAL_VARIABLE_WRITE,
|
@@ -171,11 +177,13 @@ typedef enum {
|
|
171
177
|
PM_ERR_INVALID_MULTIBYTE_ESCAPE,
|
172
178
|
PM_ERR_INVALID_NUMBER_BINARY,
|
173
179
|
PM_ERR_INVALID_NUMBER_DECIMAL,
|
180
|
+
PM_ERR_INVALID_NUMBER_FRACTION,
|
174
181
|
PM_ERR_INVALID_NUMBER_HEXADECIMAL,
|
175
182
|
PM_ERR_INVALID_NUMBER_OCTAL,
|
176
183
|
PM_ERR_INVALID_NUMBER_UNDERSCORE_INNER,
|
177
184
|
PM_ERR_INVALID_NUMBER_UNDERSCORE_TRAILING,
|
178
185
|
PM_ERR_INVALID_PERCENT,
|
186
|
+
PM_ERR_INVALID_PERCENT_EOF,
|
179
187
|
PM_ERR_INVALID_PRINTABLE_CHARACTER,
|
180
188
|
PM_ERR_INVALID_RETRY_AFTER_ELSE,
|
181
189
|
PM_ERR_INVALID_RETRY_AFTER_ENSURE,
|
@@ -207,15 +215,17 @@ typedef enum {
|
|
207
215
|
PM_ERR_NO_LOCAL_VARIABLE,
|
208
216
|
PM_ERR_NOT_EXPRESSION,
|
209
217
|
PM_ERR_NUMBER_LITERAL_UNDERSCORE,
|
218
|
+
PM_ERR_NUMBERED_PARAMETER_INNER_BLOCK,
|
210
219
|
PM_ERR_NUMBERED_PARAMETER_IT,
|
211
220
|
PM_ERR_NUMBERED_PARAMETER_ORDINARY,
|
212
|
-
|
221
|
+
PM_ERR_NUMBERED_PARAMETER_OUTER_BLOCK,
|
213
222
|
PM_ERR_OPERATOR_MULTI_ASSIGN,
|
214
223
|
PM_ERR_OPERATOR_WRITE_ARGUMENTS,
|
215
224
|
PM_ERR_OPERATOR_WRITE_BLOCK,
|
216
225
|
PM_ERR_PARAMETER_ASSOC_SPLAT_MULTI,
|
217
226
|
PM_ERR_PARAMETER_BLOCK_MULTI,
|
218
227
|
PM_ERR_PARAMETER_CIRCULAR,
|
228
|
+
PM_ERR_PARAMETER_FORWARDING_AFTER_REST,
|
219
229
|
PM_ERR_PARAMETER_METHOD_NAME,
|
220
230
|
PM_ERR_PARAMETER_NAME_DUPLICATED,
|
221
231
|
PM_ERR_PARAMETER_NO_DEFAULT,
|
@@ -225,8 +235,8 @@ typedef enum {
|
|
225
235
|
PM_ERR_PARAMETER_SPLAT_MULTI,
|
226
236
|
PM_ERR_PARAMETER_STAR,
|
227
237
|
PM_ERR_PARAMETER_UNEXPECTED_FWD,
|
228
|
-
PM_ERR_PARAMETER_WILD_LOOSE_COMMA,
|
229
238
|
PM_ERR_PARAMETER_UNEXPECTED_NO_KW,
|
239
|
+
PM_ERR_PARAMETER_WILD_LOOSE_COMMA,
|
230
240
|
PM_ERR_PATTERN_CAPTURE_DUPLICATE,
|
231
241
|
PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET,
|
232
242
|
PM_ERR_PATTERN_EXPRESSION_AFTER_COMMA,
|
@@ -238,8 +248,10 @@ typedef enum {
|
|
238
248
|
PM_ERR_PATTERN_EXPRESSION_AFTER_PIPE,
|
239
249
|
PM_ERR_PATTERN_EXPRESSION_AFTER_RANGE,
|
240
250
|
PM_ERR_PATTERN_EXPRESSION_AFTER_REST,
|
251
|
+
PM_ERR_PATTERN_HASH_IMPLICIT,
|
241
252
|
PM_ERR_PATTERN_HASH_KEY,
|
242
253
|
PM_ERR_PATTERN_HASH_KEY_DUPLICATE,
|
254
|
+
PM_ERR_PATTERN_HASH_KEY_INTERPOLATED,
|
243
255
|
PM_ERR_PATTERN_HASH_KEY_LABEL,
|
244
256
|
PM_ERR_PATTERN_HASH_KEY_LOCALS,
|
245
257
|
PM_ERR_PATTERN_IDENT_AFTER_HROCKET,
|
@@ -253,6 +265,7 @@ typedef enum {
|
|
253
265
|
PM_ERR_REGEXP_INCOMPAT_CHAR_ENCODING,
|
254
266
|
PM_ERR_REGEXP_INVALID_UNICODE_RANGE,
|
255
267
|
PM_ERR_REGEXP_NON_ESCAPED_MBC,
|
268
|
+
PM_ERR_REGEXP_PARSE_ERROR,
|
256
269
|
PM_ERR_REGEXP_TERM,
|
257
270
|
PM_ERR_REGEXP_UNKNOWN_OPTIONS,
|
258
271
|
PM_ERR_REGEXP_UTF8_CHAR_NON_UTF8_REGEXP,
|
@@ -294,6 +307,7 @@ typedef enum {
|
|
294
307
|
PM_ERR_XSTRING_TERM,
|
295
308
|
|
296
309
|
// These are the warning diagnostics.
|
310
|
+
PM_WARN_AMBIGUOUS_BINARY_OPERATOR,
|
297
311
|
PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_MINUS,
|
298
312
|
PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_PLUS,
|
299
313
|
PM_WARN_AMBIGUOUS_PREFIX_AMPERSAND,
|
@@ -316,6 +330,7 @@ typedef enum {
|
|
316
330
|
PM_WARN_KEYWORD_EOL,
|
317
331
|
PM_WARN_LITERAL_IN_CONDITION_DEFAULT,
|
318
332
|
PM_WARN_LITERAL_IN_CONDITION_VERBOSE,
|
333
|
+
PM_WARN_SHAREABLE_CONSTANT_VALUE_LINE,
|
319
334
|
PM_WARN_SHEBANG_CARRIAGE_RETURN,
|
320
335
|
PM_WARN_UNEXPECTED_CARRIAGE_RETURN,
|
321
336
|
PM_WARN_UNREACHABLE_STATEMENT,
|