Skip to content

Commit 636d6c0

Browse files
committed
support double quote as quoted_name; add 60 layouts example
1 parent 7cc0aaa commit 636d6c0

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

layouts/60.tvkl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:| Esc [$4] | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | '-' | '=' | Back [$8] |-
2+
:| Tab [$6] | Q | W | E | R | T | Y | U | I | O | P | '[' | ']' | '\' [$6] |-
3+
:| Caps [$7] | A | S | D | F | G | H | J | K | L | ';' | "'" | Enter [$9] |-
4+
:| LShift [$9] | Z | X | C | V | B | N | M | ',' | '.' | '/' | RShift [$11] |-
5+
:| LCtrl [$5] | Win [$5] | LAlt [$5] | Space [$25] | RAlt [$5] | Win [$5] | App [$5] | RCtrl [$5] |-

src/lexer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ impl<'a> Lexer<'a> {
6868
self.src.next();
6969
Some(Token { token_type: TokenType::RBrace, value: "}".to_string() })
7070
}
71-
'\'' => {
72-
Some(self.collect_quoted_name())
71+
'\'' | '\"' => {
72+
Some(self.collect_quoted_name(c))
7373
}
7474
_ => {
7575
Some(self.collect_plain_name())
@@ -87,12 +87,12 @@ impl<'a> Lexer<'a> {
8787
}
8888
}
8989

90-
fn collect_quoted_name(&mut self) -> Token {
90+
fn collect_quoted_name(&mut self, quote: char) -> Token {
9191
self.src.next();
9292
let mut value = String::new();
9393

9494
while let Some(&c) = self.src.peek() {
95-
if c == '\'' {
95+
if c == quote {
9696
self.src.next();
9797
break;
9898
}

src/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl Parser {
2222
if self.current < self.tokens.len() {
2323
Ok(&self.tokens[self.current])
2424
} else {
25-
Err(ParserError::Err("a".to_string()))
25+
Err(ParserError::Err("EOF".to_string()))
2626
}
2727
}
2828

@@ -31,7 +31,7 @@ impl Parser {
3131
self.current += 1;
3232
Ok(&self.tokens[self.current - 1])
3333
} else {
34-
Err(ParserError::Err("a".to_string()))
34+
Err(ParserError::Err("EOF".to_string()))
3535
}
3636
}
3737

0 commit comments

Comments
 (0)