mathworks / MATLAB-Language-grammar

This repository contains a regular expression based language grammar for MATLAB to be used by GitHub Linguist for highlighting MATLAB code on GitHub
49 stars 17 forks source link

fix switch statements #84

Closed watermarkhu closed 2 months ago

watermarkhu commented 2 months ago

Fixes #45 Fixes #47 Fixes #52 Fixes #64

Switch statements are syntactically the same as if/elseif/else.

switch if
switch keyword if keyword
switch declaration if declaration
- if statements
case keyword elseif keyword
case declaration elseif declaration
case statements elseif statements
otherwise keyword else keyword
otherwise statements else statements
end keyword end keyword

This PR copies the implementation from #82 and replaces the tokens with the ones for switch.

dklilley commented 2 months ago

Thanks for making these changes!