Class: Mutineer::Parser
- Inherits:
-
Object
- Object
- Mutineer::Parser
- Defined in:
- lib/mutineer/parser.rb
Overview
Thin boundary around Prism.
Both methods return a Prism::ParseResult so all callers use result.value, result.source.source (raw bytes), and result.errors uniformly. No wrapping struct.
Class Method Summary collapse
-
.parse_file(path) ⇒ Prism::ParseResult
Parses a file with Prism.
-
.parse_string(source) ⇒ Prism::ParseResult
Parses source text with Prism.
Class Method Details
.parse_file(path) ⇒ Prism::ParseResult
Parses a file with Prism.
22 23 24 25 26 |
# File 'lib/mutineer/parser.rb', line 22 def self.parse_file(path) Prism.parse_file(path) rescue SystemCallError => e raise ParseError, e. end |
.parse_string(source) ⇒ Prism::ParseResult
Parses source text with Prism.
32 33 34 |
# File 'lib/mutineer/parser.rb', line 32 def self.parse_string(source) Prism.parse(source) end |