mirror of
https://github.com/PaddiM8/kalker.git
synced 2024-12-13 18:10:42 +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]]
|
[[package]]
|
||||||
name = "kalk"
|
name = "kalk"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"phf",
|
"phf",
|
||||||
@ -103,7 +103,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kalk_cli"
|
name = "kalk_cli"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
"kalk",
|
"kalk",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kalk"
|
name = "kalk"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
authors = ["PaddiM8"]
|
authors = ["PaddiM8"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -153,11 +153,11 @@ impl<'a> Lexer<'a> {
|
|||||||
while is_valid_identifier(self.peek()) {
|
while is_valid_identifier(self.peek()) {
|
||||||
let c = *self.peek().unwrap();
|
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
|
// This is to allow the notation like the following: x_1
|
||||||
if c == '_' {
|
if c == '_' {
|
||||||
self.advance();
|
self.advance();
|
||||||
let num = self.next_number_literal().value;
|
let num = self.next().value;
|
||||||
value.push('_');
|
value.push('_');
|
||||||
value.push_str(&num.trim_end()); // Trim, since the number_literal function allows whitespace, which identifiers should not contain.
|
value.push_str(&num.trim_end()); // Trim, since the number_literal function allows whitespace, which identifiers should not contain.
|
||||||
break;
|
break;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kalk_cli"
|
name = "kalk_cli"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
authors = ["PaddiM8"]
|
authors = ["PaddiM8"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
@ -15,7 +15,7 @@ path = "src/main.rs"
|
|||||||
name = "kalk"
|
name = "kalk"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
kalk = { path = "../kalk", version = "^0.2.1" }
|
kalk = { path = "../kalk", version = "^0.2.2" }
|
||||||
rustyline = "6.1.2"
|
rustyline = "6.1.2"
|
||||||
ansi_term = "0.12"
|
ansi_term = "0.12"
|
||||||
regex = "1"
|
regex = "1"
|
||||||
|
Loading…
Reference in New Issue
Block a user