<commit_before>require 'rubygems'
require 'spec/runner'

dir = File.dirname(__FILE__)
require "#{dir}/../spec_helper"
require "#{dir}/metagrammar_spec_context_helper"

context "The subset of the metagrammar rooted at the parsing_rule rule" do
  include MetagrammarSpecContextHelper
  
  setup do
    @root = :parsing_rule
  end

  specify "parses an empty string" do
    with_both_protometagrammar_and_metagrammar do
      result = parse_result_for("rule foo 'bar' end")
   
      result.should be_an_instance_of(ParsingRule)
    end
  end
  
  specify "parses a parse rule with a terminal symbol as its expression" do
    with_both_protometagrammar_and_metagrammar do
      result = parse_result_for("rule foo 'bar' end")
   
      result.should be_an_instance_of(ParsingRule)
      result.nonterminal_symbol.name.should == :foo
      result.parsing_expression.should be_an_instance_of(TerminalSymbol)      
    end
  end

  specify "parses a parse rule with a nasty fucking expression" do
    with_both_protometagrammar_and_metagrammar do
      result = parse_result_for("rule foo 'bar' baz+ (xyzzy / plugh*) !bar end")
   
      result.should be_an_instance_of(ParsingRule)      
    end
  end
end<commit_msg>ns - Deleted expletive.<commit_after>require 'rubygems'
require 'spec/runner'

dir = File.dirname(__FILE__)
require "#{dir}/../spec_helper"
require "#{dir}/metagrammar_spec_context_helper"

context "The subset of the metagrammar rooted at the parsing_rule rule" do
  include MetagrammarSpecContextHelper
  
  setup do
    @root = :parsing_rule
  end

  specify "parses an empty string" do
    with_both_protometagrammar_and_metagrammar do
      result = parse_result_for("rule foo 'bar' end")
   
      result.should be_an_instance_of(ParsingRule)
    end
  end
  
  specify "parses a parse rule with a terminal symbol as its expression" do
    with_both_protometagrammar_and_metagrammar do
      result = parse_result_for("rule foo 'bar' end")
   
      result.should be_an_instance_of(ParsingRule)
      result.nonterminal_symbol.name.should == :foo
      result.parsing_expression.should be_an_instance_of(TerminalSymbol)      
    end
  end

  specify "parses a parse rule with a complex expression" do
    with_both_protometagrammar_and_metagrammar do
      result = parse_result_for("rule foo 'bar' baz+ (xyzzy / plugh*) !bar end")
   
      result.should be_an_instance_of(ParsingRule)      
    end
  end
end
{'fraction_non_alphanumeric': 0.0700164744645799, 'fraction_numerical': 0.0, 'mean_word_length': 3.7909270216962523, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5561526', 'n_tokens_mistral': 784, 'n_tokens_neox': 777, 'n_words': 202}