From: Juan Francisco Cantero Hurtado Date: Fri, 31 Dec 2021 22:42:21 +0000 (+0100) Subject: Raku syntax: Fix strings and comments (#2311) X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=a2d83132caa137ffcaa8e557e52e744607ad0a6f;p=micro.git Raku syntax: Fix strings and comments (#2311) * Raku syntax: Fix strings and comments Problematic code: my @array1 = [ "'", "a", "b" ]; my @array2 = [ '"', 'a', 'b' ]; my @array3 = [ "#", "a", "b" ]; I deleted "default" because it was breaking comments with urls after of my changes. Some parts were taken from: https://github.com/hankache/raku.nanorc/blob/master/raku.nanorc * Raku syntax: fix strings Code: sub xyz(Str is encoded('utf8')) returns int32 is native('asdf') { * } sub xyz(Str is encoded("utf8")) returns int32 is native("asdf") { * } From python3.yaml --- diff --git a/runtime/syntax/raku.yaml b/runtime/syntax/raku.yaml index 919da125..c0f6c910 100644 --- a/runtime/syntax/raku.yaml +++ b/runtime/syntax/raku.yaml @@ -12,14 +12,29 @@ rules: - identifier: "[$@%&](\\.|!|^)?([[:alpha:]]|_)([[:alnum:]]|-|_)*([[:alnum:]]|_)" - identifier: "[$@%&](\\?|\\*)([A-Z])([A-Z]|-)*([A-Z])" - - constant.string: "\".*\"|qq\\|.*\\|" - - default: "[sm]/.*/" + - comment: "#\ [^`|=]*" + - comment: "#[:alnum:].*" + - comment: "^#!/.*" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - preproc: start: "(^use| = new)" end: ";" rules: [] - - comment: "#.*" - identifier.macro: start: "<