Support GNU case ranges
00xc opened this issue · 1 comments
00xc commented
Case ranges are a GNU extension that allow matching a number of consecutive cases, like so:
#include <stdio.h>
int main() {
int v = 4;
switch (v) {
case 0 ... 4: puts("Between 0 and 4"); break;
case 5: puts("5"); break;
default: puts("something else"); break;
}
return 0;
}
This will be compiled without errors with gcc -std=gnu11 range.c
. However, when parsing with lang-c, this results in a SyntaxError
:
use lang_c::driver::{Config, parse};
fn main() {
let config = Config::with_gcc();
let p = parse(&config, "range.c");
if let Err(e) = p {
println!("{}", e);
}
}
Output:
syntax error: unexpected token at line 733 column 11, expected '[_a-zA-Z]'
vickenty commented
Thanks!