initial commit
This commit is contained in:
13
src/literals.lalrpop
Normal file
13
src/literals.lalrpop
Normal file
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user