diff options
author | Kevin Newton <[email protected]> | 2023-10-30 14:43:45 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2023-11-01 13:10:29 -0400 |
commit | 79034fbd503769ed2742003e31920733e9300909 () | |
tree | 3d2ec4007a132ed4a36ca3c30da7f31c6e1dda90 /lib/prism/pattern.rb | |
parent | 953138698e4c2ba7a698ee133fbdc5d075556a5d (diff) |
[ruby/prism] More Ruby docs
https://.com/ruby/prism/commit/ca9a660f52
-rw-r--r-- | lib/prism/pattern.rb | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -38,6 +38,8 @@ module Prism # Raised when the query given to a pattern is either invalid Ruby syntax or # is using syntax that we don't yet support. class CompilationError < StandardError def initialize(repr) super(<<~ERROR) prism was unable to compile the pattern you provided into a usable @@ -53,18 +55,27 @@ module Prism end end attr_reader :query def initialize(query) @query = query @compiled = nil end def compile result = Prism.parse("case nil\nin #{query}\nend") compile_node(result.value.statements.body.last.conditions.last.pattern) end def scan(root) return to_enum(__method__, root) unless block_given? |