Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Last active June 14, 2019 21:27
Show Gist options
  • Save joseoliv/a329d0ab090c6d8e553ee7fbd3b54f98 to your computer and use it in GitHub Desktop.
Save joseoliv/a329d0ab090c6d8e553ee7fbd3b54f98 to your computer and use it in GitHub Desktop.
string_r_R
package metaobjectTest
@doc{*
This is a literal string annotation, an identifier precedes a literal
string. The string should be a regular expression as expected by
prototype cyan.lang.RegExpr. The same regular expression language
is used by java.util.regex.Pattern. The annotation
r"regexpr" or R"regexpr"
is replaced by
RegExpr("regexpr")
*}
object String_r_R
func run {
var ok = "aabc" ~= r"a*b*c";
assert ok;
ok = "aabc" ~= r"a+b*c+";
assert ok;
ok = "0bc" ~= R"[0-9]b*cc*";
assert ok;
ok = "012aaabbc" ~= R"[0-2]*a+D?b*c";
assert ok;
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment