prism 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -1
  3. data/README.md +2 -1
  4. data/config.yml +188 -55
  5. data/docs/building.md +9 -2
  6. data/docs/configuration.md +10 -9
  7. data/docs/encoding.md +24 -56
  8. data/docs/local_variable_depth.md +229 -0
  9. data/docs/ruby_api.md +2 -0
  10. data/docs/serialization.md +18 -13
  11. data/ext/prism/api_node.c +337 -195
  12. data/ext/prism/extconf.rb +13 -7
  13. data/ext/prism/extension.c +96 -32
  14. data/ext/prism/extension.h +1 -1
  15. data/include/prism/ast.h +340 -137
  16. data/include/prism/defines.h +17 -0
  17. data/include/prism/diagnostic.h +11 -5
  18. data/include/prism/encoding.h +248 -0
  19. data/include/prism/options.h +2 -2
  20. data/include/prism/parser.h +62 -42
  21. data/include/prism/regexp.h +2 -2
  22. data/include/prism/util/pm_buffer.h +9 -1
  23. data/include/prism/util/pm_memchr.h +2 -2
  24. data/include/prism/util/pm_strpbrk.h +3 -3
  25. data/include/prism/version.h +2 -2
  26. data/include/prism.h +13 -15
  27. data/lib/prism/compiler.rb +12 -0
  28. data/lib/prism/debug.rb +9 -4
  29. data/lib/prism/desugar_compiler.rb +3 -3
  30. data/lib/prism/dispatcher.rb +56 -0
  31. data/lib/prism/dot_visitor.rb +476 -198
  32. data/lib/prism/dsl.rb +66 -46
  33. data/lib/prism/ffi.rb +16 -3
  34. data/lib/prism/lex_compat.rb +19 -9
  35. data/lib/prism/mutation_compiler.rb +20 -0
  36. data/lib/prism/node.rb +1173 -450
  37. data/lib/prism/node_ext.rb +41 -16
  38. data/lib/prism/parse_result.rb +12 -15
  39. data/lib/prism/ripper_compat.rb +49 -34
  40. data/lib/prism/serialize.rb +242 -212
  41. data/lib/prism/visitor.rb +12 -0
  42. data/lib/prism.rb +20 -4
  43. data/prism.gemspec +4 -10
  44. data/rbi/prism.rbi +605 -230
  45. data/rbi/prism_static.rbi +3 -0
  46. data/sig/prism.rbs +379 -124
  47. data/sig/prism_static.rbs +1 -0
  48. data/src/diagnostic.c +228 -222
  49. data/src/encoding.c +5137 -0
  50. data/src/node.c +66 -0
  51. data/src/options.c +21 -2
  52. data/src/prettyprint.c +806 -406
  53. data/src/prism.c +1092 -700
  54. data/src/regexp.c +3 -3
  55. data/src/serialize.c +227 -157
  56. data/src/util/pm_buffer.c +10 -1
  57. data/src/util/pm_memchr.c +1 -1
  58. data/src/util/pm_strpbrk.c +4 -4
  59. metadata +5 -11
  60. data/include/prism/enc/pm_encoding.h +0 -227
  61. data/src/enc/pm_big5.c +0 -116
  62. data/src/enc/pm_cp51932.c +0 -57
  63. data/src/enc/pm_euc_jp.c +0 -69
  64. data/src/enc/pm_gbk.c +0 -65
  65. data/src/enc/pm_shift_jis.c +0 -57
  66. data/src/enc/pm_tables.c +0 -2073
  67. data/src/enc/pm_unicode.c +0 -2369
  68. data/src/enc/pm_windows_31j.c +0 -57
data/include/prism/ast.h CHANGED
@@ -631,374 +631,386 @@ enum pm_node_type {
631
631
  /** CallOrWriteNode */
632
632
  PM_CALL_OR_WRITE_NODE = 21,
633
633
 
634
+ /** CallTargetNode */
635
+ PM_CALL_TARGET_NODE = 22,
636
+
634
637
  /** CapturePatternNode */
635
- PM_CAPTURE_PATTERN_NODE = 22,
638
+ PM_CAPTURE_PATTERN_NODE = 23,
636
639
 
637
640
  /** CaseMatchNode */
638
- PM_CASE_MATCH_NODE = 23,
641
+ PM_CASE_MATCH_NODE = 24,
639
642
 
640
643
  /** CaseNode */
641
- PM_CASE_NODE = 24,
644
+ PM_CASE_NODE = 25,
642
645
 
643
646
  /** ClassNode */
644
- PM_CLASS_NODE = 25,
647
+ PM_CLASS_NODE = 26,
645
648
 
646
649
  /** ClassVariableAndWriteNode */
647
- PM_CLASS_VARIABLE_AND_WRITE_NODE = 26,
650
+ PM_CLASS_VARIABLE_AND_WRITE_NODE = 27,
648
651
 
649
652
  /** ClassVariableOperatorWriteNode */
650
- PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE = 27,
653
+ PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE = 28,
651
654
 
652
655
  /** ClassVariableOrWriteNode */
653
- PM_CLASS_VARIABLE_OR_WRITE_NODE = 28,
656
+ PM_CLASS_VARIABLE_OR_WRITE_NODE = 29,
654
657
 
655
658
  /** ClassVariableReadNode */
656
- PM_CLASS_VARIABLE_READ_NODE = 29,
659
+ PM_CLASS_VARIABLE_READ_NODE = 30,
657
660
 
658
661
  /** ClassVariableTargetNode */
659
- PM_CLASS_VARIABLE_TARGET_NODE = 30,
662
+ PM_CLASS_VARIABLE_TARGET_NODE = 31,
660
663
 
661
664
  /** ClassVariableWriteNode */
662
- PM_CLASS_VARIABLE_WRITE_NODE = 31,
665
+ PM_CLASS_VARIABLE_WRITE_NODE = 32,
663
666
 
664
667
  /** ConstantAndWriteNode */
665
- PM_CONSTANT_AND_WRITE_NODE = 32,
668
+ PM_CONSTANT_AND_WRITE_NODE = 33,
666
669
 
667
670
  /** ConstantOperatorWriteNode */
668
- PM_CONSTANT_OPERATOR_WRITE_NODE = 33,
671
+ PM_CONSTANT_OPERATOR_WRITE_NODE = 34,
669
672
 
670
673
  /** ConstantOrWriteNode */
671
- PM_CONSTANT_OR_WRITE_NODE = 34,
674
+ PM_CONSTANT_OR_WRITE_NODE = 35,
672
675
 
673
676
  /** ConstantPathAndWriteNode */
674
- PM_CONSTANT_PATH_AND_WRITE_NODE = 35,
677
+ PM_CONSTANT_PATH_AND_WRITE_NODE = 36,
675
678
 
676
679
  /** ConstantPathNode */
677
- PM_CONSTANT_PATH_NODE = 36,
680
+ PM_CONSTANT_PATH_NODE = 37,
678
681
 
679
682
  /** ConstantPathOperatorWriteNode */
680
- PM_CONSTANT_PATH_OPERATOR_WRITE_NODE = 37,
683
+ PM_CONSTANT_PATH_OPERATOR_WRITE_NODE = 38,
681
684
 
682
685
  /** ConstantPathOrWriteNode */
683
- PM_CONSTANT_PATH_OR_WRITE_NODE = 38,
686
+ PM_CONSTANT_PATH_OR_WRITE_NODE = 39,
684
687
 
685
688
  /** ConstantPathTargetNode */
686
- PM_CONSTANT_PATH_TARGET_NODE = 39,
689
+ PM_CONSTANT_PATH_TARGET_NODE = 40,
687
690
 
688
691
  /** ConstantPathWriteNode */
689
- PM_CONSTANT_PATH_WRITE_NODE = 40,
692
+ PM_CONSTANT_PATH_WRITE_NODE = 41,
690
693
 
691
694
  /** ConstantReadNode */
692
- PM_CONSTANT_READ_NODE = 41,
695
+ PM_CONSTANT_READ_NODE = 42,
693
696
 
694
697
  /** ConstantTargetNode */
695
- PM_CONSTANT_TARGET_NODE = 42,
698
+ PM_CONSTANT_TARGET_NODE = 43,
696
699
 
697
700
  /** ConstantWriteNode */
698
- PM_CONSTANT_WRITE_NODE = 43,
701
+ PM_CONSTANT_WRITE_NODE = 44,
699
702
 
700
703
  /** DefNode */
701
- PM_DEF_NODE = 44,
704
+ PM_DEF_NODE = 45,
702
705
 
703
706
  /** DefinedNode */
704
- PM_DEFINED_NODE = 45,
707
+ PM_DEFINED_NODE = 46,
705
708
 
706
709
  /** ElseNode */
707
- PM_ELSE_NODE = 46,
710
+ PM_ELSE_NODE = 47,
708
711
 
709
712
  /** EmbeddedStatementsNode */
710
- PM_EMBEDDED_STATEMENTS_NODE = 47,
713
+ PM_EMBEDDED_STATEMENTS_NODE = 48,
711
714
 
712
715
  /** EmbeddedVariableNode */
713
- PM_EMBEDDED_VARIABLE_NODE = 48,
716
+ PM_EMBEDDED_VARIABLE_NODE = 49,
714
717
 
715
718
  /** EnsureNode */
716
- PM_ENSURE_NODE = 49,
719
+ PM_ENSURE_NODE = 50,
717
720
 
718
721
  /** FalseNode */
719
- PM_FALSE_NODE = 50,
722
+ PM_FALSE_NODE = 51,
720
723
 
721
724
  /** FindPatternNode */
722
- PM_FIND_PATTERN_NODE = 51,
725
+ PM_FIND_PATTERN_NODE = 52,
723
726
 
724
727
  /** FlipFlopNode */
725
- PM_FLIP_FLOP_NODE = 52,
728
+ PM_FLIP_FLOP_NODE = 53,
726
729
 
727
730
  /** FloatNode */
728
- PM_FLOAT_NODE = 53,
731
+ PM_FLOAT_NODE = 54,
729
732
 
730
733
  /** ForNode */
731
- PM_FOR_NODE = 54,
734
+ PM_FOR_NODE = 55,
732
735
 
733
736
  /** ForwardingArgumentsNode */
734
- PM_FORWARDING_ARGUMENTS_NODE = 55,
737
+ PM_FORWARDING_ARGUMENTS_NODE = 56,
735
738
 
736
739
  /** ForwardingParameterNode */
737
- PM_FORWARDING_PARAMETER_NODE = 56,
740
+ PM_FORWARDING_PARAMETER_NODE = 57,
738
741
 
739
742
  /** ForwardingSuperNode */
740
- PM_FORWARDING_SUPER_NODE = 57,
743
+ PM_FORWARDING_SUPER_NODE = 58,
741
744
 
742
745
  /** GlobalVariableAndWriteNode */
743
- PM_GLOBAL_VARIABLE_AND_WRITE_NODE = 58,
746
+ PM_GLOBAL_VARIABLE_AND_WRITE_NODE = 59,
744
747
 
745
748
  /** GlobalVariableOperatorWriteNode */
746
- PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE = 59,
749
+ PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE = 60,
747
750
 
748
751
  /** GlobalVariableOrWriteNode */
749
- PM_GLOBAL_VARIABLE_OR_WRITE_NODE = 60,
752
+ PM_GLOBAL_VARIABLE_OR_WRITE_NODE = 61,
750
753
 
751
754
  /** GlobalVariableReadNode */
752
- PM_GLOBAL_VARIABLE_READ_NODE = 61,
755
+ PM_GLOBAL_VARIABLE_READ_NODE = 62,
753
756
 
754
757
  /** GlobalVariableTargetNode */
755
- PM_GLOBAL_VARIABLE_TARGET_NODE = 62,
758
+ PM_GLOBAL_VARIABLE_TARGET_NODE = 63,
756
759
 
757
760
  /** GlobalVariableWriteNode */
758
- PM_GLOBAL_VARIABLE_WRITE_NODE = 63,
761
+ PM_GLOBAL_VARIABLE_WRITE_NODE = 64,
759
762
 
760
763
  /** HashNode */
761
- PM_HASH_NODE = 64,
764
+ PM_HASH_NODE = 65,
762
765
 
763
766
  /** HashPatternNode */
764
- PM_HASH_PATTERN_NODE = 65,
767
+ PM_HASH_PATTERN_NODE = 66,
765
768
 
766
769
  /** IfNode */
767
- PM_IF_NODE = 66,
770
+ PM_IF_NODE = 67,
768
771
 
769
772
  /** ImaginaryNode */
770
- PM_IMAGINARY_NODE = 67,
773
+ PM_IMAGINARY_NODE = 68,
771
774
 
772
775
  /** ImplicitNode */
773
- PM_IMPLICIT_NODE = 68,
776
+ PM_IMPLICIT_NODE = 69,
777
+
778
+ /** ImplicitRestNode */
779
+ PM_IMPLICIT_REST_NODE = 70,
774
780
 
775
781
  /** InNode */
776
- PM_IN_NODE = 69,
782
+ PM_IN_NODE = 71,
777
783
 
778
784
  /** IndexAndWriteNode */
779
- PM_INDEX_AND_WRITE_NODE = 70,
785
+ PM_INDEX_AND_WRITE_NODE = 72,
780
786
 
781
787
  /** IndexOperatorWriteNode */
782
- PM_INDEX_OPERATOR_WRITE_NODE = 71,
788
+ PM_INDEX_OPERATOR_WRITE_NODE = 73,
783
789
 
784
790
  /** IndexOrWriteNode */
785
- PM_INDEX_OR_WRITE_NODE = 72,
791
+ PM_INDEX_OR_WRITE_NODE = 74,
792
+
793
+ /** IndexTargetNode */
794
+ PM_INDEX_TARGET_NODE = 75,
786
795
 
787
796
  /** InstanceVariableAndWriteNode */
788
- PM_INSTANCE_VARIABLE_AND_WRITE_NODE = 73,
797
+ PM_INSTANCE_VARIABLE_AND_WRITE_NODE = 76,
789
798
 
790
799
  /** InstanceVariableOperatorWriteNode */
791
- PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE = 74,
800
+ PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE = 77,
792
801
 
793
802
  /** InstanceVariableOrWriteNode */
794
- PM_INSTANCE_VARIABLE_OR_WRITE_NODE = 75,
803
+ PM_INSTANCE_VARIABLE_OR_WRITE_NODE = 78,
795
804
 
796
805
  /** InstanceVariableReadNode */
797
- PM_INSTANCE_VARIABLE_READ_NODE = 76,
806
+ PM_INSTANCE_VARIABLE_READ_NODE = 79,
798
807
 
799
808
  /** InstanceVariableTargetNode */
800
- PM_INSTANCE_VARIABLE_TARGET_NODE = 77,
809
+ PM_INSTANCE_VARIABLE_TARGET_NODE = 80,
801
810
 
802
811
  /** InstanceVariableWriteNode */
803
- PM_INSTANCE_VARIABLE_WRITE_NODE = 78,
812
+ PM_INSTANCE_VARIABLE_WRITE_NODE = 81,
804
813
 
805
814
  /** IntegerNode */
806
- PM_INTEGER_NODE = 79,
815
+ PM_INTEGER_NODE = 82,
807
816
 
808
817
  /** InterpolatedMatchLastLineNode */
809
- PM_INTERPOLATED_MATCH_LAST_LINE_NODE = 80,
818
+ PM_INTERPOLATED_MATCH_LAST_LINE_NODE = 83,
810
819
 
811
820
  /** InterpolatedRegularExpressionNode */
812
- PM_INTERPOLATED_REGULAR_EXPRESSION_NODE = 81,
821
+ PM_INTERPOLATED_REGULAR_EXPRESSION_NODE = 84,
813
822
 
814
823
  /** InterpolatedStringNode */
815
- PM_INTERPOLATED_STRING_NODE = 82,
824
+ PM_INTERPOLATED_STRING_NODE = 85,
816
825
 
817
826
  /** InterpolatedSymbolNode */
818
- PM_INTERPOLATED_SYMBOL_NODE = 83,
827
+ PM_INTERPOLATED_SYMBOL_NODE = 86,
819
828
 
820
829
  /** InterpolatedXStringNode */
821
- PM_INTERPOLATED_X_STRING_NODE = 84,
830
+ PM_INTERPOLATED_X_STRING_NODE = 87,
822
831
 
823
832
  /** KeywordHashNode */
824
- PM_KEYWORD_HASH_NODE = 85,
833
+ PM_KEYWORD_HASH_NODE = 88,
825
834
 
826
835
  /** KeywordRestParameterNode */
827
- PM_KEYWORD_REST_PARAMETER_NODE = 86,
836
+ PM_KEYWORD_REST_PARAMETER_NODE = 89,
828
837
 
829
838
  /** LambdaNode */
830
- PM_LAMBDA_NODE = 87,
839
+ PM_LAMBDA_NODE = 90,
831
840
 
832
841
  /** LocalVariableAndWriteNode */
833
- PM_LOCAL_VARIABLE_AND_WRITE_NODE = 88,
842
+ PM_LOCAL_VARIABLE_AND_WRITE_NODE = 91,
834
843
 
835
844
  /** LocalVariableOperatorWriteNode */
836
- PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE = 89,
845
+ PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE = 92,
837
846
 
838
847
  /** LocalVariableOrWriteNode */
839
- PM_LOCAL_VARIABLE_OR_WRITE_NODE = 90,
848
+ PM_LOCAL_VARIABLE_OR_WRITE_NODE = 93,
840
849
 
841
850
  /** LocalVariableReadNode */
842
- PM_LOCAL_VARIABLE_READ_NODE = 91,
851
+ PM_LOCAL_VARIABLE_READ_NODE = 94,
843
852
 
844
853
  /** LocalVariableTargetNode */
845
- PM_LOCAL_VARIABLE_TARGET_NODE = 92,
854
+ PM_LOCAL_VARIABLE_TARGET_NODE = 95,
846
855
 
847
856
  /** LocalVariableWriteNode */
848
- PM_LOCAL_VARIABLE_WRITE_NODE = 93,
857
+ PM_LOCAL_VARIABLE_WRITE_NODE = 96,
849
858
 
850
859
  /** MatchLastLineNode */
851
- PM_MATCH_LAST_LINE_NODE = 94,
860
+ PM_MATCH_LAST_LINE_NODE = 97,
852
861
 
853
862
  /** MatchPredicateNode */
854
- PM_MATCH_PREDICATE_NODE = 95,
863
+ PM_MATCH_PREDICATE_NODE = 98,
855
864
 
856
865
  /** MatchRequiredNode */
857
- PM_MATCH_REQUIRED_NODE = 96,
866
+ PM_MATCH_REQUIRED_NODE = 99,
858
867
 
859
868
  /** MatchWriteNode */
860
- PM_MATCH_WRITE_NODE = 97,
869
+ PM_MATCH_WRITE_NODE = 100,
861
870
 
862
871
  /** MissingNode */
863
- PM_MISSING_NODE = 98,
872
+ PM_MISSING_NODE = 101,
864
873
 
865
874
  /** ModuleNode */
866
- PM_MODULE_NODE = 99,
875
+ PM_MODULE_NODE = 102,
867
876
 
868
877
  /** MultiTargetNode */
869
- PM_MULTI_TARGET_NODE = 100,
878
+ PM_MULTI_TARGET_NODE = 103,
870
879
 
871
880
  /** MultiWriteNode */
872
- PM_MULTI_WRITE_NODE = 101,
881
+ PM_MULTI_WRITE_NODE = 104,
873
882
 
874
883
  /** NextNode */
875
- PM_NEXT_NODE = 102,
884
+ PM_NEXT_NODE = 105,
876
885
 
877
886
  /** NilNode */
878
- PM_NIL_NODE = 103,
887
+ PM_NIL_NODE = 106,
879
888
 
880
889
  /** NoKeywordsParameterNode */
881
- PM_NO_KEYWORDS_PARAMETER_NODE = 104,
890
+ PM_NO_KEYWORDS_PARAMETER_NODE = 107,
891
+
892
+ /** NumberedParametersNode */
893
+ PM_NUMBERED_PARAMETERS_NODE = 108,
882
894
 
883
895
  /** NumberedReferenceReadNode */
884
- PM_NUMBERED_REFERENCE_READ_NODE = 105,
896
+ PM_NUMBERED_REFERENCE_READ_NODE = 109,
885
897
 
886
898
  /** OptionalKeywordParameterNode */
887
- PM_OPTIONAL_KEYWORD_PARAMETER_NODE = 106,
899
+ PM_OPTIONAL_KEYWORD_PARAMETER_NODE = 110,
888
900
 
889
901
  /** OptionalParameterNode */
890
- PM_OPTIONAL_PARAMETER_NODE = 107,
902
+ PM_OPTIONAL_PARAMETER_NODE = 111,
891
903
 
892
904
  /** OrNode */
893
- PM_OR_NODE = 108,
905
+ PM_OR_NODE = 112,
894
906
 
895
907
  /** ParametersNode */
896
- PM_PARAMETERS_NODE = 109,
908
+ PM_PARAMETERS_NODE = 113,
897
909
 
898
910
  /** ParenthesesNode */
899
- PM_PARENTHESES_NODE = 110,
911
+ PM_PARENTHESES_NODE = 114,
900
912
 
901
913
  /** PinnedExpressionNode */
902
- PM_PINNED_EXPRESSION_NODE = 111,
914
+ PM_PINNED_EXPRESSION_NODE = 115,
903
915
 
904
916
  /** PinnedVariableNode */
905
- PM_PINNED_VARIABLE_NODE = 112,
917
+ PM_PINNED_VARIABLE_NODE = 116,
906
918
 
907
919
  /** PostExecutionNode */
908
- PM_POST_EXECUTION_NODE = 113,
920
+ PM_POST_EXECUTION_NODE = 117,
909
921
 
910
922
  /** PreExecutionNode */
911
- PM_PRE_EXECUTION_NODE = 114,
923
+ PM_PRE_EXECUTION_NODE = 118,
912
924
 
913
925
  /** ProgramNode */
914
- PM_PROGRAM_NODE = 115,
926
+ PM_PROGRAM_NODE = 119,
915
927
 
916
928
  /** RangeNode */
917
- PM_RANGE_NODE = 116,
929
+ PM_RANGE_NODE = 120,
918
930
 
919
931
  /** RationalNode */
920
- PM_RATIONAL_NODE = 117,
932
+ PM_RATIONAL_NODE = 121,
921
933
 
922
934
  /** RedoNode */
923
- PM_REDO_NODE = 118,
935
+ PM_REDO_NODE = 122,
924
936
 
925
937
  /** RegularExpressionNode */
926
- PM_REGULAR_EXPRESSION_NODE = 119,
938
+ PM_REGULAR_EXPRESSION_NODE = 123,
927
939
 
928
940
  /** RequiredKeywordParameterNode */
929
- PM_REQUIRED_KEYWORD_PARAMETER_NODE = 120,
941
+ PM_REQUIRED_KEYWORD_PARAMETER_NODE = 124,
930
942
 
931
943
  /** RequiredParameterNode */
932
- PM_REQUIRED_PARAMETER_NODE = 121,
944
+ PM_REQUIRED_PARAMETER_NODE = 125,
933
945
 
934
946
  /** RescueModifierNode */
935
- PM_RESCUE_MODIFIER_NODE = 122,
947
+ PM_RESCUE_MODIFIER_NODE = 126,
936
948
 
937
949
  /** RescueNode */
938
- PM_RESCUE_NODE = 123,
950
+ PM_RESCUE_NODE = 127,
939
951
 
940
952
  /** RestParameterNode */
941
- PM_REST_PARAMETER_NODE = 124,
953
+ PM_REST_PARAMETER_NODE = 128,
942
954
 
943
955
  /** RetryNode */
944
- PM_RETRY_NODE = 125,
956
+ PM_RETRY_NODE = 129,
945
957
 
946
958
  /** ReturnNode */
947
- PM_RETURN_NODE = 126,
959
+ PM_RETURN_NODE = 130,
948
960
 
949
961
  /** SelfNode */
950
- PM_SELF_NODE = 127,
962
+ PM_SELF_NODE = 131,
951
963
 
952
964
  /** SingletonClassNode */
953
- PM_SINGLETON_CLASS_NODE = 128,
965
+ PM_SINGLETON_CLASS_NODE = 132,
954
966
 
955
967
  /** SourceEncodingNode */
956
- PM_SOURCE_ENCODING_NODE = 129,
968
+ PM_SOURCE_ENCODING_NODE = 133,
957
969
 
958
970
  /** SourceFileNode */
959
- PM_SOURCE_FILE_NODE = 130,
971
+ PM_SOURCE_FILE_NODE = 134,
960
972
 
961
973
  /** SourceLineNode */
962
- PM_SOURCE_LINE_NODE = 131,
974
+ PM_SOURCE_LINE_NODE = 135,
963
975
 
964
976
  /** SplatNode */
965
- PM_SPLAT_NODE = 132,
977
+ PM_SPLAT_NODE = 136,
966
978
 
967
979
  /** StatementsNode */
968
- PM_STATEMENTS_NODE = 133,
980
+ PM_STATEMENTS_NODE = 137,
969
981
 
970
982
  /** StringNode */
971
- PM_STRING_NODE = 134,
983
+ PM_STRING_NODE = 138,
972
984
 
973
985
  /** SuperNode */
974
- PM_SUPER_NODE = 135,
986
+ PM_SUPER_NODE = 139,
975
987
 
976
988
  /** SymbolNode */
977
- PM_SYMBOL_NODE = 136,
989
+ PM_SYMBOL_NODE = 140,
978
990
 
979
991
  /** TrueNode */
980
- PM_TRUE_NODE = 137,
992
+ PM_TRUE_NODE = 141,
981
993
 
982
994
  /** UndefNode */
983
- PM_UNDEF_NODE = 138,
995
+ PM_UNDEF_NODE = 142,
984
996
 
985
997
  /** UnlessNode */
986
- PM_UNLESS_NODE = 139,
998
+ PM_UNLESS_NODE = 143,
987
999
 
988
1000
  /** UntilNode */
989
- PM_UNTIL_NODE = 140,
1001
+ PM_UNTIL_NODE = 144,
990
1002
 
991
1003
  /** WhenNode */
992
- PM_WHEN_NODE = 141,
1004
+ PM_WHEN_NODE = 145,
993
1005
 
994
1006
  /** WhileNode */
995
- PM_WHILE_NODE = 142,
1007
+ PM_WHILE_NODE = 146,
996
1008
 
997
1009
  /** XStringNode */
998
- PM_X_STRING_NODE = 143,
1010
+ PM_X_STRING_NODE = 147,
999
1011
 
1000
1012
  /** YieldNode */
1001
- PM_YIELD_NODE = 144,
1013
+ PM_YIELD_NODE = 148,
1002
1014
 
1003
1015
  /** A special kind of node used for compilation. */
1004
1016
  PM_SCOPE_NODE
@@ -1037,6 +1049,11 @@ static const pm_node_flags_t PM_NODE_FLAG_COMMON_MASK = (1 << (PM_NODE_FLAG_BITS
1037
1049
  */
1038
1050
  #define PM_NODE_TYPE_P(node, type) (PM_NODE_TYPE(node) == (type))
1039
1051
 
1052
+ /**
1053
+ * Return true if the given flag is set on the given node.
1054
+ */
1055
+ #define PM_NODE_FLAG_P(node, flag) ((((pm_node_t *)(node))->flags & (flag)) != 0)
1056
+
1040
1057
  /**
1041
1058
  * This is the base structure that represents a node in the syntax tree. It is
1042
1059
  * embedded into every node type.
@@ -1150,7 +1167,7 @@ typedef struct pm_and_node {
1150
1167
  *
1151
1168
  * Type: PM_ARGUMENTS_NODE
1152
1169
  * Flags:
1153
- * PM_ARGUMENTS_NODE_FLAGS_KEYWORD_SPLAT
1170
+ * PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT
1154
1171
  *
1155
1172
  * @extends pm_node_t
1156
1173
  */
@@ -1166,6 +1183,8 @@ typedef struct pm_arguments_node {
1166
1183
  * ArrayNode
1167
1184
  *
1168
1185
  * Type: PM_ARRAY_NODE
1186
+ * Flags:
1187
+ * PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT
1169
1188
  *
1170
1189
  * @extends pm_node_t
1171
1190
  */
@@ -1344,8 +1363,11 @@ typedef struct pm_block_node {
1344
1363
  /** BlockNode#locals */
1345
1364
  pm_constant_id_list_t locals;
1346
1365
 
1366
+ /** BlockNode#locals_body_index */
1367
+ uint32_t locals_body_index;
1368
+
1347
1369
  /** BlockNode#parameters */
1348
- struct pm_block_parameters_node *parameters;
1370
+ struct pm_node *parameters;
1349
1371
 
1350
1372
  /** BlockNode#body */
1351
1373
  struct pm_node *body;
@@ -1427,6 +1449,7 @@ typedef struct pm_break_node {
1427
1449
  * Flags:
1428
1450
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
1429
1451
  * PM_CALL_NODE_FLAGS_VARIABLE_CALL
1452
+ * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
1430
1453
  *
1431
1454
  * @extends pm_node_t
1432
1455
  */
@@ -1463,6 +1486,7 @@ typedef struct pm_call_and_write_node {
1463
1486
  * Flags:
1464
1487
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
1465
1488
  * PM_CALL_NODE_FLAGS_VARIABLE_CALL
1489
+ * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
1466
1490
  *
1467
1491
  * @extends pm_node_t
1468
1492
  */
@@ -1476,6 +1500,9 @@ typedef struct pm_call_node {
1476
1500
  /** CallNode#call_operator_loc */
1477
1501
  pm_location_t call_operator_loc;
1478
1502
 
1503
+ /** CallNode#name */
1504
+ pm_constant_id_t name;
1505
+
1479
1506
  /** CallNode#message_loc */
1480
1507
  pm_location_t message_loc;
1481
1508
 
@@ -1490,9 +1517,6 @@ typedef struct pm_call_node {
1490
1517
 
1491
1518
  /** CallNode#block */
1492
1519
  struct pm_node *block;
1493
-
1494
- /** CallNode#name */
1495
- pm_constant_id_t name;
1496
1520
  } pm_call_node_t;
1497
1521
 
1498
1522
  /**
@@ -1502,6 +1526,7 @@ typedef struct pm_call_node {
1502
1526
  * Flags:
1503
1527
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
1504
1528
  * PM_CALL_NODE_FLAGS_VARIABLE_CALL
1529
+ * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
1505
1530
  *
1506
1531
  * @extends pm_node_t
1507
1532
  */
@@ -1541,6 +1566,7 @@ typedef struct pm_call_operator_write_node {
1541
1566
  * Flags:
1542
1567
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
1543
1568
  * PM_CALL_NODE_FLAGS_VARIABLE_CALL
1569
+ * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
1544
1570
  *
1545
1571
  * @extends pm_node_t
1546
1572
  */
@@ -1570,6 +1596,34 @@ typedef struct pm_call_or_write_node {
1570
1596
  struct pm_node *value;
1571
1597
  } pm_call_or_write_node_t;
1572
1598
 
1599
+ /**
1600
+ * CallTargetNode
1601
+ *
1602
+ * Type: PM_CALL_TARGET_NODE
1603
+ * Flags:
1604
+ * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
1605
+ * PM_CALL_NODE_FLAGS_VARIABLE_CALL
1606
+ * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
1607
+ *
1608
+ * @extends pm_node_t
1609
+ */
1610
+ typedef struct pm_call_target_node {
1611
+ /** The embedded base node. */
1612
+ pm_node_t base;
1613
+
1614
+ /** CallTargetNode#receiver */
1615
+ struct pm_node *receiver;
1616
+
1617
+ /** CallTargetNode#call_operator_loc */
1618
+ pm_location_t call_operator_loc;
1619
+
1620
+ /** CallTargetNode#name */
1621
+ pm_constant_id_t name;
1622
+
1623
+ /** CallTargetNode#message_loc */
1624
+ pm_location_t message_loc;
1625
+ } pm_call_target_node_t;
1626
+
1573
1627
  /**
1574
1628
  * CapturePatternNode
1575
1629
  *
@@ -2097,6 +2151,9 @@ typedef struct pm_def_node {
2097
2151
  /** DefNode#locals */
2098
2152
  pm_constant_id_list_t locals;
2099
2153
 
2154
+ /** DefNode#locals_body_index */
2155
+ uint32_t locals_body_index;
2156
+
2100
2157
  /** DefNode#def_keyword_loc */
2101
2158
  pm_location_t def_keyword_loc;
2102
2159
 
@@ -2607,6 +2664,18 @@ typedef struct pm_implicit_node {
2607
2664
  struct pm_node *value;
2608
2665
  } pm_implicit_node_t;
2609
2666
 
2667
+ /**
2668
+ * ImplicitRestNode
2669
+ *
2670
+ * Type: PM_IMPLICIT_REST_NODE
2671
+ *
2672
+ * @extends pm_node_t
2673
+ */
2674
+ typedef struct pm_implicit_rest_node {
2675
+ /** The embedded base node. */
2676
+ pm_node_t base;
2677
+ } pm_implicit_rest_node_t;
2678
+
2610
2679
  /**
2611
2680
  * InNode
2612
2681
  *
@@ -2638,6 +2707,7 @@ typedef struct pm_in_node {
2638
2707
  * Flags:
2639
2708
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
2640
2709
  * PM_CALL_NODE_FLAGS_VARIABLE_CALL
2710
+ * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
2641
2711
  *
2642
2712
  * @extends pm_node_t
2643
2713
  */
@@ -2677,6 +2747,7 @@ typedef struct pm_index_and_write_node {
2677
2747
  * Flags:
2678
2748
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
2679
2749
  * PM_CALL_NODE_FLAGS_VARIABLE_CALL
2750
+ * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
2680
2751
  *
2681
2752
  * @extends pm_node_t
2682
2753
  */
@@ -2719,6 +2790,7 @@ typedef struct pm_index_operator_write_node {
2719
2790
  * Flags:
2720
2791
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
2721
2792
  * PM_CALL_NODE_FLAGS_VARIABLE_CALL
2793
+ * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
2722
2794
  *
2723
2795
  * @extends pm_node_t
2724
2796
  */
@@ -2751,6 +2823,37 @@ typedef struct pm_index_or_write_node {
2751
2823
  struct pm_node *value;
2752
2824
  } pm_index_or_write_node_t;
2753
2825
 
2826
+ /**
2827
+ * IndexTargetNode
2828
+ *
2829
+ * Type: PM_INDEX_TARGET_NODE
2830
+ * Flags:
2831
+ * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
2832
+ * PM_CALL_NODE_FLAGS_VARIABLE_CALL
2833
+ * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
2834
+ *
2835
+ * @extends pm_node_t
2836
+ */
2837
+ typedef struct pm_index_target_node {
2838
+ /** The embedded base node. */
2839
+ pm_node_t base;
2840
+
2841
+ /** IndexTargetNode#receiver */
2842
+ struct pm_node *receiver;
2843
+
2844
+ /** IndexTargetNode#opening_loc */
2845
+ pm_location_t opening_loc;
2846
+
2847
+ /** IndexTargetNode#arguments */
2848
+ struct pm_arguments_node *arguments;
2849
+
2850
+ /** IndexTargetNode#closing_loc */
2851
+ pm_location_t closing_loc;
2852
+
2853
+ /** IndexTargetNode#block */
2854
+ struct pm_node *block;
2855
+ } pm_index_target_node_t;
2856
+
2754
2857
  /**
2755
2858
  * InstanceVariableAndWriteNode
2756
2859
  *
@@ -2886,8 +2989,8 @@ typedef struct pm_instance_variable_write_node {
2886
2989
  * Type: PM_INTEGER_NODE
2887
2990
  * Flags:
2888
2991
  * PM_INTEGER_BASE_FLAGS_BINARY
2889
- * PM_INTEGER_BASE_FLAGS_OCTAL
2890
2992
  * PM_INTEGER_BASE_FLAGS_DECIMAL
2993
+ * PM_INTEGER_BASE_FLAGS_OCTAL
2891
2994
  * PM_INTEGER_BASE_FLAGS_HEXADECIMAL
2892
2995
  *
2893
2996
  * @extends pm_node_t
@@ -2910,6 +3013,9 @@ typedef struct pm_integer_node {
2910
3013
  * PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT
2911
3014
  * PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J
2912
3015
  * PM_REGULAR_EXPRESSION_FLAGS_UTF_8
3016
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING
3017
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING
3018
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING
2913
3019
  *
2914
3020
  * @extends pm_node_t
2915
3021
  */
@@ -2940,6 +3046,9 @@ typedef struct pm_interpolated_match_last_line_node {
2940
3046
  * PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT
2941
3047
  * PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J
2942
3048
  * PM_REGULAR_EXPRESSION_FLAGS_UTF_8
3049
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING
3050
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING
3051
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING
2943
3052
  *
2944
3053
  * @extends pm_node_t
2945
3054
  */
@@ -3024,6 +3133,8 @@ typedef struct pm_interpolated_x_string_node {
3024
3133
  * KeywordHashNode
3025
3134
  *
3026
3135
  * Type: PM_KEYWORD_HASH_NODE
3136
+ * Flags:
3137
+ * PM_KEYWORD_HASH_NODE_FLAGS_STATIC_KEYS
3027
3138
  *
3028
3139
  * @extends pm_node_t
3029
3140
  */
@@ -3070,6 +3181,9 @@ typedef struct pm_lambda_node {
3070
3181
  /** LambdaNode#locals */
3071
3182
  pm_constant_id_list_t locals;
3072
3183
 
3184
+ /** LambdaNode#locals_body_index */
3185
+ uint32_t locals_body_index;
3186
+
3073
3187
  /** LambdaNode#operator_loc */
3074
3188
  pm_location_t operator_loc;
3075
3189
 
@@ -3080,7 +3194,7 @@ typedef struct pm_lambda_node {
3080
3194
  pm_location_t closing_loc;
3081
3195
 
3082
3196
  /** LambdaNode#parameters */
3083
- struct pm_block_parameters_node *parameters;
3197
+ struct pm_node *parameters;
3084
3198
 
3085
3199
  /** LambdaNode#body */
3086
3200
  struct pm_node *body;
@@ -3246,6 +3360,9 @@ typedef struct pm_local_variable_write_node {
3246
3360
  * PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT
3247
3361
  * PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J
3248
3362
  * PM_REGULAR_EXPRESSION_FLAGS_UTF_8
3363
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING
3364
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING
3365
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING
3249
3366
  *
3250
3367
  * @extends pm_node_t
3251
3368
  */
@@ -3476,6 +3593,21 @@ typedef struct pm_no_keywords_parameter_node {
3476
3593
  pm_location_t keyword_loc;
3477
3594
  } pm_no_keywords_parameter_node_t;
3478
3595
 
3596
+ /**
3597
+ * NumberedParametersNode
3598
+ *
3599
+ * Type: PM_NUMBERED_PARAMETERS_NODE
3600
+ *
3601
+ * @extends pm_node_t
3602
+ */
3603
+ typedef struct pm_numbered_parameters_node {
3604
+ /** The embedded base node. */
3605
+ pm_node_t base;
3606
+
3607
+ /** NumberedParametersNode#maximum */
3608
+ uint8_t maximum;
3609
+ } pm_numbered_parameters_node_t;
3610
+
3479
3611
  /**
3480
3612
  * NumberedReferenceReadNode
3481
3613
  *
@@ -3575,7 +3707,7 @@ typedef struct pm_parameters_node {
3575
3707
  struct pm_node_list optionals;
3576
3708
 
3577
3709
  /** ParametersNode#rest */
3578
- struct pm_rest_parameter_node *rest;
3710
+ struct pm_node *rest;
3579
3711
 
3580
3712
  /** ParametersNode#posts */
3581
3713
  struct pm_node_list posts;
@@ -3782,6 +3914,9 @@ typedef struct pm_redo_node {
3782
3914
  * PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT
3783
3915
  * PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J
3784
3916
  * PM_REGULAR_EXPRESSION_FLAGS_UTF_8
3917
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING
3918
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING
3919
+ * PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING
3785
3920
  *
3786
3921
  * @extends pm_node_t
3787
3922
  */
@@ -4056,6 +4191,8 @@ typedef struct pm_statements_node {
4056
4191
  *
4057
4192
  * Type: PM_STRING_NODE
4058
4193
  * Flags:
4194
+ * PM_STRING_FLAGS_FORCED_UTF8_ENCODING
4195
+ * PM_STRING_FLAGS_FORCED_BINARY_ENCODING
4059
4196
  * PM_STRING_FLAGS_FROZEN
4060
4197
  *
4061
4198
  * @extends pm_node_t
@@ -4108,6 +4245,10 @@ typedef struct pm_super_node {
4108
4245
  * SymbolNode
4109
4246
  *
4110
4247
  * Type: PM_SYMBOL_NODE
4248
+ * Flags:
4249
+ * PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING
4250
+ * PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING
4251
+ * PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING
4111
4252
  *
4112
4253
  * @extends pm_node_t
4113
4254
  */
@@ -4265,6 +4406,9 @@ typedef struct pm_while_node {
4265
4406
  * XStringNode
4266
4407
  *
4267
4408
  * Type: PM_X_STRING_NODE
4409
+ * Flags:
4410
+ * PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING
4411
+ * PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING
4268
4412
  *
4269
4413
  * @extends pm_node_t
4270
4414
  */
@@ -4314,9 +4458,17 @@ typedef struct pm_yield_node {
4314
4458
  */
4315
4459
  typedef enum pm_arguments_node_flags {
4316
4460
  /** if arguments contain keyword splat */
4317
- PM_ARGUMENTS_NODE_FLAGS_KEYWORD_SPLAT = 1,
4461
+ PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT = 1,
4318
4462
  } pm_arguments_node_flags_t;
4319
4463
 
4464
+ /**
4465
+ * Flags for array nodes.
4466
+ */
4467
+ typedef enum pm_array_node_flags {
4468
+ /** if array contains splat nodes */
4469
+ PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT = 1,
4470
+ } pm_array_node_flags_t;
4471
+
4320
4472
  /**
4321
4473
  * Flags for call nodes.
4322
4474
  */
@@ -4326,8 +4478,22 @@ typedef enum pm_call_node_flags {
4326
4478
 
4327
4479
  /** a call that could have been a local variable */
4328
4480
  PM_CALL_NODE_FLAGS_VARIABLE_CALL = 2,
4481
+
4482
+ /** a call that is an attribute write, so the value being written should be returned */
4483
+ PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE = 4,
4329
4484
  } pm_call_node_flags_t;
4330
4485
 
4486
+ /**
4487
+ * Flags for nodes that have unescaped content.
4488
+ */
4489
+ typedef enum pm_encoding_flags {
4490
+ /** internal bytes forced the encoding to UTF-8 */
4491
+ PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING = 1,
4492
+
4493
+ /** internal bytes forced the encoding to binary */
4494
+ PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING = 2,
4495
+ } pm_encoding_flags_t;
4496
+
4331
4497
  /**
4332
4498
  * Flags for integer nodes that correspond to the base of the integer.
4333
4499
  */
@@ -4335,16 +4501,24 @@ typedef enum pm_integer_base_flags {
4335
4501
  /** 0b prefix */
4336
4502
  PM_INTEGER_BASE_FLAGS_BINARY = 1,
4337
4503
 
4338
- /** 0o or 0 prefix */
4339
- PM_INTEGER_BASE_FLAGS_OCTAL = 2,
4340
-
4341
4504
  /** 0d or no prefix */
4342
- PM_INTEGER_BASE_FLAGS_DECIMAL = 4,
4505
+ PM_INTEGER_BASE_FLAGS_DECIMAL = 2,
4506
+
4507
+ /** 0o or 0 prefix */
4508
+ PM_INTEGER_BASE_FLAGS_OCTAL = 4,
4343
4509
 
4344
4510
  /** 0x prefix */
4345
4511
  PM_INTEGER_BASE_FLAGS_HEXADECIMAL = 8,
4346
4512
  } pm_integer_base_flags_t;
4347
4513
 
4514
+ /**
4515
+ * Flags for keyword hash nodes.
4516
+ */
4517
+ typedef enum pm_keyword_hash_node_flags {
4518
+ /** a keyword hash which only has `AssocNode` elements all with static literal keys, which means the elements can be treated as keyword arguments */
4519
+ PM_KEYWORD_HASH_NODE_FLAGS_STATIC_KEYS = 1,
4520
+ } pm_keyword_hash_node_flags_t;
4521
+
4348
4522
  /**
4349
4523
  * Flags for while and until loop nodes.
4350
4524
  */
@@ -4388,16 +4562,45 @@ typedef enum pm_regular_expression_flags {
4388
4562
 
4389
4563
  /** u - forces the UTF-8 encoding */
4390
4564
  PM_REGULAR_EXPRESSION_FLAGS_UTF_8 = 128,
4565
+
4566
+ /** internal bytes forced the encoding to UTF-8 */
4567
+ PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING = 256,
4568
+
4569
+ /** internal bytes forced the encoding to binary */
4570
+ PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING = 512,
4571
+
4572
+ /** internal bytes forced the encoding to US-ASCII */
4573
+ PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING = 1024,
4391
4574
  } pm_regular_expression_flags_t;
4392
4575
 
4393
4576
  /**
4394
4577
  * Flags for string nodes.
4395
4578
  */
4396
4579
  typedef enum pm_string_flags {
4580
+ /** internal bytes forced the encoding to UTF-8 */
4581
+ PM_STRING_FLAGS_FORCED_UTF8_ENCODING = 1,
4582
+
4583
+ /** internal bytes forced the encoding to binary */
4584
+ PM_STRING_FLAGS_FORCED_BINARY_ENCODING = 2,
4585
+
4397
4586
  /** frozen by virtue of a `frozen_string_literal` comment */
4398
- PM_STRING_FLAGS_FROZEN = 1,
4587
+ PM_STRING_FLAGS_FROZEN = 4,
4399
4588
  } pm_string_flags_t;
4400
4589
 
4590
+ /**
4591
+ * Flags for symbol nodes.
4592
+ */
4593
+ typedef enum pm_symbol_flags {
4594
+ /** internal bytes forced the encoding to UTF-8 */
4595
+ PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING = 1,
4596
+
4597
+ /** internal bytes forced the encoding to binary */
4598
+ PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING = 2,
4599
+
4600
+ /** internal bytes forced the encoding to US-ASCII */
4601
+ PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING = 4,
4602
+ } pm_symbol_flags_t;
4603
+
4401
4604
  /**
4402
4605
  * When we're serializing to Java, we want to skip serializing the location
4403
4606
  * fields as they won't be used by JRuby or TruffleRuby. This boolean allows us