Sha256: c78f0f655129784dc7de14595c09d8047b5ce5a6494960f546c41c60627644df
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
# encoding: utf-8 # frozen_string_literal: true module Carbon module Compiler class Parser module Statements # Parses a try statement. module Try protected def parse_statement_try expect :try body = parse_statement continued = parse_statement_try_continued Node::Statement::Try.new([body, continued]) end def parse_statement_try_continued case peek.type when :catch then parse_statement_try_catch when :finally then parse_statement_try_finally end end def parse_statement_try_catch expect :catch expect :"(" name = parse_name expect :":" type = parse_type expect :")" body = parse_statement follow = parse_statement_try_continued Node::Statement::Catch.new([name, type, body, follow]) end def parse_statement_try_finally expect :finally Node::Statement::Finally.new([parse_statement]) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
carbon-compiler-0.2.0 | lib/carbon/compiler/parser/statements/try.rb |