From b2d1d965dee8cc2c1e063067d53a3c8e28a46d6c Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Sat, 24 Dec 2022 10:04:42 +0000 Subject: Adds the character range mapping syntax Ranges of characters can be mapped with [] For example, capitalisation of a letter: [a-z=A-Z] Caesar cipher shift of 1: [a-zA-Z=b-zaB-ZA] --- main/subexast.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'main/subexast.go') diff --git a/main/subexast.go b/main/subexast.go index 040bc9d..aabdcd0 100644 --- a/main/subexast.go +++ b/main/subexast.go @@ -151,3 +151,13 @@ func (ast SubexASTJoin) compileWith(next SubexState) SubexState { next, } } + +type SubexASTRange struct { + parts map[rune]rune +} +func (ast SubexASTRange) compileWith(next SubexState) SubexState { + return &SubexRangeState { + parts: ast.parts, + next: next, + } +} -- cgit v1.2.3