<commit_before>require 'ast'

module BEL
  module Parsers
    # BEL AST module.
    module AST
      # Raises +ArgumentError+ if *argument* is not a *expected*.
      def self.assert_is_a(expected, actual, argument)
        msg = ->(x, y, z) { "Expected #{x} of #{y}, but got #{z}" }
        return if actual.is_a? expected
        raise ArgumentError, msg.call(expected, argument, actual.class)
      end

      # BEL application-specific AST node.
      class Node < ::AST::Node
        # New BEL AST node.
        #
        # * *Args*:
        # - +type+ -> the node type symbol
        # - +children+ -> optional Array of children
        # - +properties+ -> optional Hash of supported properties
        #
        # *Raises*:
        # - +ArgumentError+ -> If anything other than an Array or Hash are
        #                      supplied as children and properties
        def initialize(type, children = [], properties = {})
          AST.assert_is_a(Array, children, 'children')
          AST.assert_is_a(Hash, properties, 'properties')
          super(type, children, properties)
        end

        # Get the line number where this AST node originates.
        attr_reader :line_number

        # Get the character range enclosing this AST node.
        # It is defined as the close interval containing all the characters
        # of this AST node.
        attr_reader :character_range

        # Get the start of the character range enclosing this AST node.
        def range_start
          @character_range[0]
        end

        # Get _a_ in the character range [a, b].
        alias range_a range_start

        # Get the end of the character range enclosing this AST node.
        def range_end
          @character_range[1]
        end

        # Get _b_ in the character range [a, b].<commit_msg>bump Node init class doc<commit_after>require 'ast'

module BEL
  module Parsers
    # BEL AST module.
    module AST
      # Raises +ArgumentError+ if *argument* is not a *expected*.
      def self.assert_is_a(expected, actual, argument)
        msg = ->(x, y, z) { "Expected #{x} of #{y}, but got #{z}" }
        return if actual.is_a? expected
        raise ArgumentError, msg.call(expected, argument, actual.class)
      end

      # BEL application-specific AST node.
      class Node < ::AST::Node
        # New BEL AST node.
        #
        # *Args*:
        # - +type+ -> the node type symbol
        # - +children+ -> optional Array of children
        # - +properties+ -> optional Hash of supported properties
        #
        # === Supported properties
        # - +line_number+ -> #line_number
        # - +character_range+ -> #character_range, #range_start, #range_end
        # - +complete+ -> #complete?
        # - +return_type+ #return_type
        # - +encoding+ -> #encoding
        # - +has_semantics+ -> #has_semantics
        #
        # *Raises*:
        # - +ArgumentError+ -> If _children_ is not an Array or _properties_ is
        #   not a Hash
        def initialize(type, children = [], properties = {})
          AST.assert_is_a(Array, children, 'children')
          AST.assert_is_a(Hash, properties, 'properties')
          super(type, children, properties)
        end

        # Get the line number where this AST node originates.
        attr_reader :line_number

        # Get the character range enclosing this AST node.
        # It is defined as the close interval containing all the characters
        # of this AST node.
        attr_reader :character_range

        # Get the start of the character range enclosing this AST node.
        def range_start
          @character_range[0]
        end

        # Get _a_ in the character range [a, b].
        alias range_a range_start

        # Get the end of the character range enclosing this AST node.
        def range_end
          @character_range[1]
        end

        # Get _b_ in the character range [a, b].
{'fraction_non_alphanumeric': 0.09035377958768134, 'fraction_numerical': 0.0010180707559175363, 'mean_word_length': 1.9908675799086757, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6482551', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1055, 'n_words': 391}