Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply frozen string literal magic comment #424

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "bundler/gem_tasks"

namespace "build" do
Expand Down
2 changes: 2 additions & 0 deletions Steepfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# D = Steep::Diagnostic
#
target :lib do
Expand Down
1 change: 1 addition & 0 deletions exe/lrama
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH << File.join(__dir__, "../lib")
require "lrama"
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "lrama/bitmap"
require_relative "lrama/command"
require_relative "lrama/context"
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/bitmap.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
module Bitmap
def self.from_array(ary)
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Command
LRAMA_LIB = File.realpath(File.join(File.dirname(__FILE__)))
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/context.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "report/duration"

module Lrama
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/counterexamples.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "set"

require_relative "counterexamples/derivation"
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/counterexamples/derivation.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Counterexamples
class Derivation
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/counterexamples/example.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Counterexamples
class Example
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/counterexamples/path.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Counterexamples
class Path
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/counterexamples/production_path.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Counterexamples
class ProductionPath < Path
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/counterexamples/start_path.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Counterexamples
class StartPath < Path
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/counterexamples/state_item.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Counterexamples
class StateItem < Struct.new(:state, :item)
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/counterexamples/transition_path.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Counterexamples
class TransitionPath < Path
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/counterexamples/triple.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Counterexamples
# s: state
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/digraph.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
# Algorithm Digraph of https://dl.acm.org/doi/pdf/10.1145/69622.357187 (P. 625)
class Digraph
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "forwardable"
require_relative "grammar/auxiliary"
require_relative "grammar/binding"
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/auxiliary.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
# Grammar file information not used by States but by Output
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/binding.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Binding
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/code.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "forwardable"
require_relative "code/destructor_code"
require_relative "code/initial_action_code"
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/code/destructor_code.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Code
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/code/initial_action_code.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Code
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/code/no_reference_code.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Code
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/code/printer_code.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Code
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/code/rule_action.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Code
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/counter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Counter
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/destructor.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Destructor < Struct.new(:ident_or_tags, :token_code, :lineno, keyword_init: true)
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/error_token.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class ErrorToken < Struct.new(:ident_or_tags, :token_code, :lineno, keyword_init: true)
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/parameterizing_rule.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'parameterizing_rule/resolver'
require_relative 'parameterizing_rule/rhs'
require_relative 'parameterizing_rule/rule'
2 changes: 2 additions & 0 deletions lib/lrama/grammar/parameterizing_rule/resolver.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class ParameterizingRule
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/parameterizing_rule/rhs.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class ParameterizingRule
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/parameterizing_rule/rule.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class ParameterizingRule
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/percent_code.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class PercentCode
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/precedence.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Precedence < Struct.new(:type, :precedence, keyword_init: true)
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/printer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Printer < Struct.new(:ident_or_tags, :token_code, :lineno, keyword_init: true)
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/reference.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
# type: :dollar or :at
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/rule.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
# _rhs holds original RHS element. Use rhs to refer to Symbol.
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/rule_builder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class RuleBuilder
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/symbol.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Symbol is both of nterm and term
# `number` is both for nterm and term
# `token_id` is tokentype for term, internal sequence number for nterm
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/symbols.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

require_relative "symbols/resolver"
2 changes: 2 additions & 0 deletions lib/lrama/grammar/symbols/resolver.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Symbols
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/type.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Type
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/grammar/union.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Grammar
class Union < Struct.new(:code, :lineno, keyword_init: true)
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/lexer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "strscan"

require_relative "lexer/grammar_file"
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/lexer/grammar_file.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Lexer
class GrammarFile
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/lexer/location.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Lexer
class Location
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/lexer/token.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'token/char'
require_relative 'token/ident'
require_relative 'token/instantiate_rule'
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/lexer/token/char.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Lexer
class Token
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/lexer/token/ident.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Lexer
class Token
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/lexer/token/instantiate_rule.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Lexer
class Token
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/lexer/token/tag.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
class Lexer
class Token
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/lexer/token/user_code.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "strscan"

module Lrama
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/option_parser.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'optparse'

module Lrama
Expand Down
2 changes: 2 additions & 0 deletions lib/lrama/options.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lrama
# Command line options.
class Options
Expand Down
Loading