Class: Clef::Parser::LilypondParser
- Inherits:
-
Object
- Object
- Clef::Parser::LilypondParser
- Defined in:
- lib/clef/parser/lilypond_parser.rb
Constant Summary collapse
- SUPPORTED_COMMANDS =
%w[\\clef \\key \\major \\minor \\time \\tempo \\relative \\new \\with].freeze
- DYNAMIC_COMMANDS =
Clef::Notation::Dynamic::TYPES.map { |type| "\\#{type}" }.freeze
- STAFF_COMMAND =
/\\new\s+(?:Staff|PianoStaff|StaffGroup)/
Instance Attribute Summary collapse
-
#plugins ⇒ Object
readonly
Returns the value of attribute plugins.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(plugins: Clef.plugins) ⇒ LilypondParser
constructor
A new instance of LilypondParser.
- #parse(input) ⇒ Clef::Core::Score
Constructor Details
#initialize(plugins: Clef.plugins) ⇒ LilypondParser
Returns a new instance of LilypondParser.
13 14 15 16 |
# File 'lib/clef/parser/lilypond_parser.rb', line 13 def initialize(plugins: Clef.plugins) @plugins = plugins @warnings = [] end |
Instance Attribute Details
#plugins ⇒ Object (readonly)
Returns the value of attribute plugins.
10 11 12 |
# File 'lib/clef/parser/lilypond_parser.rb', line 10 def plugins @plugins end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
10 11 12 |
# File 'lib/clef/parser/lilypond_parser.rb', line 10 def warnings @warnings end |
Instance Method Details
#parse(input) ⇒ Clef::Core::Score
20 21 22 23 24 25 26 |
# File 'lib/clef/parser/lilypond_parser.rb', line 20 def parse(input) cleaned = strip_comments(input) @warnings = unsupported_command_warnings(cleaned) score = build_score(cleaned) plugins.run_hook(:on_after_parse, score) score end |