Skip to main content

parse_block_expr

Function parse_block_expr 

Source
pub fn parse_block_expr(pair: Pair<'_, Rule>) -> Result<Expr>
Expand description

Parse block expression

The PEG grammar uses (block_statement ~ ";"?)* ~ block_item? where ";"? is silent/optional. To implement semicolon-suppresses-return semantics ({ 1; } yields () while { 1 } yields 1), we inspect the raw source text after each block_statement span to detect whether a semicolon was actually present.