Skip to content

Commit b2451d1

Browse files
committed
chore: update escaping rules
1 parent 3ccacc4 commit b2451d1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

parser/tests/escaping_character_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ func TestEscapingCharacterParser(t *testing.T) {
1515
node ast.Node
1616
}{
1717
{
18-
text: `\# 123`,
18+
text: `\#`,
1919
node: &ast.EscapingCharacter{
2020
Symbol: "#",
2121
},
2222
},
23+
{
24+
text: `\' test`,
25+
node: &ast.EscapingCharacter{
26+
Symbol: "'",
27+
},
28+
},
2329
}
2430

2531
for _, test := range tests {

parser/tokenizer/tokenizer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const (
2525
Pipe TokenType = "|"
2626
Colon TokenType = ":"
2727
Caret TokenType = "^"
28+
Apostrophe TokenType = "'"
2829
Backslash TokenType = "\\"
2930
Slash TokenType = "/"
3031
NewLine TokenType = "\n"
@@ -95,6 +96,8 @@ func Tokenize(text string) []*Token {
9596
tokens = append(tokens, NewToken(Colon, ":"))
9697
case '^':
9798
tokens = append(tokens, NewToken(Caret, "^"))
99+
case '\'':
100+
tokens = append(tokens, NewToken(Apostrophe, "'"))
98101
case '\\':
99102
tokens = append(tokens, NewToken(Backslash, `\`))
100103
case '/':

0 commit comments

Comments
 (0)