5.16.5.23. Pattern Matching

Start data section to src/flx_parse.mly[29 /33 ] Next Prev First Last
  2014: match_expr:
  2015:   | MATCH expr WITH matchings ENDMATCH
  2016:   {
  2017:     `AST_match (rstoken $1 $5, ($2, $4))
  2018:   }
  2019: matchings:
  2020:   | matching matchings { $1 :: $2 }
  2021:   | matching { [$1] }
  2022: matching:
  2023:   | VBAR pattern EQRIGHTARROW expr { $2, $4 }
  2024:   | VBAR EQRIGHTARROW expr { let sr = rstoken $1 $2 in `PAT_none sr, $3 }
  2025: 
End data section to src/flx_parse.mly[29]
The pattern matching statment analyses the shape and contents of a value and selects the first matching case from the matching body.


5.16.5.23.1. Patterns