From 7ffc5f8fb0416cb33bd6e296a8b08d8f3809a030 Mon Sep 17 00:00:00 2001 From: Maas Lalani Date: Thu, 10 Nov 2022 15:55:05 -0500 Subject: [PATCH] feat(lexer): backticks act as strings --- examples/fixtures/all.tape | 4 +++- lexer.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/fixtures/all.tape b/examples/fixtures/all.tape index 73e1a8cf..faadcec6 100644 --- a/examples/fixtures/all.tape +++ b/examples/fixtures/all.tape @@ -29,9 +29,11 @@ Sleep .5 Sleep 0.5 # Type: -Type "All" Type@.5 "All" Type@500ms "All" +Type "Double Quote" +Type '"Single" Quote' +Type `"Backtick" 'Quote'` # Keys: Backspace diff --git a/lexer.go b/lexer.go index b6e92a69..908c2492 100644 --- a/lexer.go +++ b/lexer.go @@ -53,6 +53,10 @@ func (l *Lexer) NextToken() Token { tok.Type = JSON tok.Literal = "{" + l.readJSON() + "}" l.readChar() + case '`': + tok.Type = STRING + tok.Literal = l.readString('`') + l.readChar() case '\'': tok.Type = STRING tok.Literal = l.readString('\'')