• R/O
  • SSH

kink: Commit

Kink runtime


Commit MetaInfo

Revisionbdfa13b30f8f7e721327ac446c07707887bad472 (tree)
Time2020-09-16 01:05:06
Authormiyakawataku
Commitermiyakawataku

Log Message

remove REGEX.new valid_pattern? error_message

Change Summary

Incremental Difference

diff -r 84d27d9e3623 -r bdfa13b30f8f src/main/resources/kink-mods/kink/regex/REGEX.kn
--- a/src/main/resources/kink-mods/kink/regex/REGEX.kn Wed Sep 16 00:42:15 2020 +0900
+++ b/src/main/resources/kink-mods/kink/regex/REGEX.kn Wed Sep 16 01:05:06 2020 +0900
@@ -343,29 +343,6 @@
343343 Text_string.call_method('offsetByCodePoints' [JAVA.int(0) JAVA.int(Rune_ind)])
344344 }
345345
346-## REGEX.new(Pat) {{{1
347-#
348-# `new` makes a regex val from the `Pat` str.
349-#
350-# Preconditions:
351-#
352-# • `Pat` must be a str.
353-#
354-# • `Pat` must be a valid pattern.
355-:new <- {(:Pat)
356- STR.is?(Pat) || raise(
357- 'REGEX.new(Pat): required str for Pat, but got {}'.format(Pat.repr))
358- :Pattern_obj = _compile(Pat $id){(:Msg)
359- raise('REGEX.new(Pat): {}'.format(Msg))
360- }
361- new_val(
362- ... Regex_trait
363- 'Pat' Pat
364- 'Pattern_obj' Pattern_obj
365- )
366-
367-} # }}}1
368-
369346 ## REGEX.compile(Pattern ...[$config]) {{{
370347 #
371348 # `compile` makes a regex from `Pattern`.
@@ -513,55 +490,6 @@
513490
514491 # }}}
515492
516-## REGEX.valid_pattern?(Str) {{{
517-#
518-# `valid_pattern?` returns whether `Str` is a valid pattern.
519-#
520-# Precondition:
521-#
522-# • `Str` must be a str.
523-#
524-# Example:
525-#
526-# :REGEX.require_from('kink/regex/')
527-#
528-# stdout.print_line(REGEX.valid_pattern?('[a-z]*').repr) # => true
529-# stdout.print_line(REGEX.valid_pattern?('[A-Z').repr) # => false
530-:valid_pattern? <- {(:Str)
531- STR.is?(Str) || raise('REGEX.valid_pattern?(Str): Str must be str, but got {}'.format(Str.repr))
532- _compile(Str { true } { false })
533-} # }}}
534-
535-## REGEX.error_message(Invalid_pat) {{{
536-#
537-# `error_message` returns a str describing the compilation error of `Invalid_pat`.
538-#
539-# Preconditions:
540-#
541-# • `Invalid_pat` must be a str
542-#
543-# • `Invalid_pat` must be an invalid pattern,
544-# which means that valid_pattern?(Invalid_pat) must return false
545-#
546-# Example:
547-#
548-# :REGEX.require_from('kink/regex/')
549-#
550-# stdout.print_line(REGEX.error_message('[A-Z').repr)
551-# # => "Unclosed character class near index 3\n[A-Z\n ^"
552-:error_message <- {(:Invalid_pat)
553- :Desc = 'REGEX.error_message(Invalid_pat)'
554- STR.is?(Invalid_pat) || raise(
555- '{}: Invalid_pat must be a str, but got {}'.format(Desc Invalid_pat.repr))
556- _compile(Invalid_pat
557- { raise(
558- '{}: Invalid_pat must be an invalid pattern, but got valid pattern {}'
559- .format(Desc Invalid_pat.repr))
560- }
561- $id
562- )
563-} # }}}
564-
565493 ## REGEX.escape(Str)
566494 #
567495 # `escape` escapes regex special characters in `Str`.
Show on old repository browser