mirror of
https://github.com/PaddiM8/kalker.git
synced 2024-12-12 17:40:52 +01:00
allow letters after underscore in variables, eg. x_a
This commit is contained in:
parent
ee6a4066da
commit
4d17210b49
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -92,7 +92,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kalk"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"phf",
|
||||
@ -103,7 +103,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kalk_cli"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"kalk",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kalk"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
authors = ["PaddiM8"]
|
||||
edition = "2018"
|
||||
readme = "README.md"
|
||||
|
@ -153,11 +153,11 @@ impl<'a> Lexer<'a> {
|
||||
while is_valid_identifier(self.peek()) {
|
||||
let c = *self.peek().unwrap();
|
||||
|
||||
// If the current character is an underscore, expect a number next.
|
||||
// If the current character is an underscore, allow a number next.
|
||||
// This is to allow the notation like the following: x_1
|
||||
if c == '_' {
|
||||
self.advance();
|
||||
let num = self.next_number_literal().value;
|
||||
let num = self.next().value;
|
||||
value.push('_');
|
||||
value.push_str(&num.trim_end()); // Trim, since the number_literal function allows whitespace, which identifiers should not contain.
|
||||
break;
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kalk_cli"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
authors = ["PaddiM8"]
|
||||
edition = "2018"
|
||||
readme = "../README.md"
|
||||
@ -15,7 +15,7 @@ path = "src/main.rs"
|
||||
name = "kalk"
|
||||
|
||||
[dependencies]
|
||||
kalk = { path = "../kalk", version = "^0.2.1" }
|
||||
kalk = { path = "../kalk", version = "^0.2.2" }
|
||||
rustyline = "6.1.2"
|
||||
ansi_term = "0.12"
|
||||
regex = "1"
|
||||
|
Loading…
Reference in New Issue
Block a user