Skip to content

Commit

Permalink
Use rbs-inline styled type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed Feb 5, 2025
1 parent 569f568 commit 4bd35c0
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 13 deletions.
30 changes: 21 additions & 9 deletions lib/lrama/options.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
# rbs_inline: enabled
# frozen_string_literal: true

module Lrama
# Command line options.
class Options
attr_accessor :skeleton, :header, :header_file,
:report_file, :outfile,
:error_recovery, :grammar_file,
:trace_opts, :report_opts,
:diagnostic, :y, :debug, :define,
:diagram, :diagram_file, :profile_opts
attr_accessor :skeleton #: String
attr_accessor :header #: bool
attr_accessor :header_file #: String
attr_accessor :report_file #: String
attr_accessor :outfile #: String
attr_accessor :error_recovery #: bool
attr_accessor :grammar_file #: String
attr_accessor :trace_opts #: Hash[Symbol, bool]?
attr_accessor :report_opts #: Hash[Symbol, bool]?
attr_accessor :diagnostic #: bool
attr_accessor :y #: IO
attr_accessor :debug #: bool
attr_accessor :define #: Hash[String, String]
attr_accessor :diagram #: bool
attr_accessor :diagram_file #: String
attr_accessor :profile_opts #: Hash[Symbol, bool]?

# @rbs () -> void
def initialize
@skeleton = "bison/yacc.c"
@skeleton = 'bison/yacc.c'
@define = {}
@header = false
@header_file = nil
@report_file = nil
@outfile = "y.tab.c"
@outfile = 'y.tab.c'
@error_recovery = false
@grammar_file = nil
@trace_opts = nil
Expand All @@ -25,7 +37,7 @@ def initialize
@y = STDIN
@debug = false
@diagram = false
@diagram_file = "diagram.html"
@diagram_file = 'diagram.html'
@profile_opts = nil
end
end
Expand Down
29 changes: 25 additions & 4 deletions sig/lrama/options.rbs → sig/generated/lrama/options.rbs
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
# Generated from lib/lrama/options.rb with RBS::Inline

module Lrama
# Command line options.
class Options
attr_accessor skeleton: String
attr_accessor define: Hash[String, String]

attr_accessor header: bool
attr_accessor header_file: String?
attr_accessor report_file: String?

attr_accessor header_file: String

attr_accessor report_file: String

attr_accessor outfile: String

attr_accessor error_recovery: bool
attr_accessor grammar_file: String?

attr_accessor grammar_file: String

attr_accessor trace_opts: Hash[Symbol, bool]?

attr_accessor report_opts: Hash[Symbol, bool]?

attr_accessor diagnostic: bool

attr_accessor y: IO

attr_accessor debug: bool

attr_accessor define: Hash[String, String]

attr_accessor diagram: bool

attr_accessor diagram_file: String

attr_accessor profile_opts: Hash[Symbol, bool]?

# @rbs () -> void
def initialize: () -> void
end
end

0 comments on commit 4bd35c0

Please sign in to comment.