<commit_before>module Pione
  module Lang
    # DeclarationTransformer is a transformer for all declarations.
    module DeclarationTransformer
      include Util::ParsletTransformerModule

      #
      # sentences
      #

      # Transform +variable_binding_sentence+ into +Lang::VariableBindingDeclaration+.
      rule(:variable_binding_sentence => subtree(:tree)) {
        Lang::VariableBindingDeclaration.new(tree[:expr1], tree[:expr2]).tap do |declaration|
          line, col = (tree[:declarator] || tree[:expr1]).line_and_column
          declaration.set_source_position(package_name, filename, line, col)
        end
      }

      # Transform +package_binding_sentence+ into +Lang::PackageBindingDeclaration+.
      rule(:package_binding_sentence => subtree(:tree)) {
        Lang::PackageBindingDeclaration.new(tree[:expr1], tree[:expr2]).tap do |declaration|
          line, col = tree[:declarator].line_and_column
          declaration.set_source_position(package_name, filename, line, col)
        end
      }

      # Transform +param_sentence+ into +Lang::ParamDeclaration+.
      rule(:param_sentence => subtree(:tree)) {
        type = (tree[:type] || "basic").to_sym

        Lang::ParamDeclaration.new(type, tree[:expr1], tree[:expr2]).tap do |declaration|<commit_msg>Fixed a bug about param declaration transformer.<commit_after>module Pione
  module Lang
    # DeclarationTransformer is a transformer for all declarations.
    module DeclarationTransformer
      include Util::ParsletTransformerModule

      #
      # sentences
      #

      # Transform +variable_binding_sentence+ into +Lang::VariableBindingDeclaration+.
      rule(:variable_binding_sentence => subtree(:tree)) {
        Lang::VariableBindingDeclaration.new(tree[:expr1], tree[:expr2]).tap do |declaration|
          line, col = (tree[:declarator] || tree[:expr1]).line_and_column
          declaration.set_source_position(package_name, filename, line, col)
        end
      }

      # Transform +package_binding_sentence+ into +Lang::PackageBindingDeclaration+.
      rule(:package_binding_sentence => subtree(:tree)) {
        Lang::PackageBindingDeclaration.new(tree[:expr1], tree[:expr2]).tap do |declaration|
          line, col = tree[:declarator].line_and_column
          declaration.set_source_position(package_name, filename, line, col)
        end
      }

      # Transform +param_sentence+ into +Lang::ParamDeclaration+.
      rule(:param_sentence => subtree(:tree), :tail => simple(:tail_message)) {
        type = (tree[:type] || "basic").to_sym

        Lang::ParamDeclaration.new(type, tree[:expr1], tree[:expr2]).tap do |declaration|
{'fraction_non_alphanumeric': 0.11711371363808085, 'fraction_numerical': 0.005289006422364941, 'mean_word_length': 3.7033747779751334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6601267', 'n_tokens_mistral': 745, 'n_tokens_neox': 700, 'n_words': 141}