Last active
June 14, 2019 21:27
-
-
Save joseoliv/a329d0ab090c6d8e553ee7fbd3b54f98 to your computer and use it in GitHub Desktop.
string_r_R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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