13 lines
352 B
Plaintext
13 lines
352 B
Plaintext
|
|
use std::str::FromStr;
|
||
|
|
|
||
|
|
grammar;
|
||
|
|
|
||
|
|
pub Atom: f64 = {
|
||
|
|
<n:Int> => n as f64,
|
||
|
|
Float,
|
||
|
|
"(" <Atom> ")",
|
||
|
|
};
|
||
|
|
|
||
|
|
pub Int: i64 = <s:r"[0-9]|[1-9][0-9]*"> => i64::from_str(s).unwrap();
|
||
|
|
pub Float: f64 = <s:r"[+-]?([0-9]*[.][0-9]+|[0-9]*([.][0-9]+)?[Ee][+-]?[1-9][0-9]*)"> => f64::from_str(s).unwrap();
|
||
|
|
pub StringLiteral: &'input str = <s:"\"[^\"]\""> => s;
|