Added support for emojis 😁
This commit is contained in:
@ -7,5 +7,5 @@ edition = "2024"
|
|||||||
lalrpop = "0.22"
|
lalrpop = "0.22"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dot = "0.1"
|
regex = { version = "1.11", features = ["unicode-bool"] }
|
||||||
lalrpop-util = { version = "0.22", features = ["lexer", "unicode"] }
|
lalrpop-util = { version = "0.22", features = ["lexer", "unicode"] }
|
||||||
|
|||||||
@ -11,7 +11,7 @@ fn main() -> std::io::Result<()> {
|
|||||||
// std::thread::sleep(std::time::Duration::new(2, 0));
|
// std::thread::sleep(std::time::Duration::new(2, 0));
|
||||||
// println!("{}", now.elapsed().as_micros());
|
// println!("{}", now.elapsed().as_micros());
|
||||||
|
|
||||||
// examples::stats()?;
|
examples::stats()?;
|
||||||
|
|
||||||
// examples::freq()?;
|
// examples::freq()?;
|
||||||
|
|
||||||
|
|||||||
@ -17,13 +17,25 @@ grammar(translator: &mut Translator);
|
|||||||
// Helpers
|
// Helpers
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// order
|
||||||
|
match {
|
||||||
|
r"[0-9]+" => NUMBER
|
||||||
|
} else {
|
||||||
|
r"([[:alpha:]]|\p{Emoji})([[:word:]]|\p{Emoji})*" => WORD
|
||||||
|
} else {
|
||||||
|
_
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// matches words (letter followed by numbers, letters or _)
|
// matches words (letter followed by numbers, letters or _)
|
||||||
Literal = { r"[[:alpha:]][[:word:]]*" };
|
Literal: String = {
|
||||||
|
WORD => <>.to_string()
|
||||||
|
};
|
||||||
|
|
||||||
// all numbers are i64
|
// all numbers are i64
|
||||||
Num: i64 = {
|
Num: i64 = {
|
||||||
r"[0-9]+" =>? i64::from_str(<>)
|
NUMBER =>? i64::from_str(<>)
|
||||||
.map_err(|_| ParseError::User { error: "Number is too big" })
|
.map_err(|_| ParseError::User { error: "Number is too big" })
|
||||||
};
|
};
|
||||||
|
|
||||||
// macro for matching sequence of patterns with C as separator
|
// macro for matching sequence of patterns with C as separator
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
Weights: 10,10
|
Weights: 10,10
|
||||||
Sets: {a,b},{a}
|
Sets: {a,b},{a, 😵}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
Environment: [x = {a}.y, y =({a}.nill + {b}.nill)]
|
Environment: [x = {a}.🐶, 🐶 =({a}.nill + {b}.nill)]
|
||||||
Initial Entities: {a, b}
|
Initial Entities: {a, b}
|
||||||
Context: [({a,b}.{a}.{a,c}.x + {a,b}.{a}.{a}.nil)]
|
Context: [({a,b}.{a}.{a,c}.x + {a,b}.{a}.{a}.nil)]
|
||||||
Reactions: ([r: {a,b}, i: {c}, p: {b}])
|
Reactions: ([r: {a,b}, i: {c}, p: {b, 😵}])
|
||||||
|
|||||||
Reference in New Issue
Block a user