Last active
August 29, 2015 14:10
-
-
Save Noxivs/94d758b3cffb641c950a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(macro_rules)] | |
macro_rules! grammar( | |
($name:expr,$x:expr) => ( /* parser + generate function */) | |
) | |
grammar!("url", " | |
rule TOP { | |
<protocol>'://'<address> | |
} | |
token protocol { | |
'http'|'https'|'ftp'|'file' | |
} | |
rule address { | |
<subdomain>'.'<domain>'.'<tld> | |
} | |
") | |
fn main() { | |
let res = match url("http://www.oker.fr") { | |
Ok(res) => res, | |
Err(err) => panic!("{}", err) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment