Deprecate constant regular expression strings

This commit is contained in:
Oleh Prypin 2015-04-14 22:30:21 +03:00
commit ff25c1272f

View file

@ -413,22 +413,28 @@ proc escapeRe*(s: string): string =
result.add(toHex(ord(c), 2)) result.add(toHex(ord(c), 2))
const ## common regular expressions const ## common regular expressions
reIdentifier* = r"\b[a-zA-Z_]+[a-zA-Z_0-9]*\b" ## describes an identifier reIdentifier* {.deprecated.} = r"\b[a-zA-Z_]+[a-zA-Z_0-9]*\b"
reNatural* = r"\b\d+\b" ## describes a natural number ## describes an identifier
reInteger* = r"\b[-+]?\d+\b" ## describes an integer reNatural* {.deprecated.} = r"\b\d+\b"
reHex* = r"\b0[xX][0-9a-fA-F]+\b" ## describes a hexadecimal number ## describes a natural number
reBinary* = r"\b0[bB][01]+\b" ## describes a binary number (example: 0b11101) reInteger* {.deprecated.} = r"\b[-+]?\d+\b"
reOctal* = r"\b0[oO][0-7]+\b" ## describes an octal number (example: 0o777) ## describes an integer
reFloat* = r"\b[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\b" reHex* {.deprecated.} = r"\b0[xX][0-9a-fA-F]+\b"
## describes a hexadecimal number
reBinary* {.deprecated.} = r"\b0[bB][01]+\b"
## describes a binary number (example: 0b11101)
reOctal* {.deprecated.} = r"\b0[oO][0-7]+\b"
## describes an octal number (example: 0o777)
reFloat* {.deprecated.} = r"\b[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\b"
## describes a floating point number ## describes a floating point number
reEmail* = r"\b[a-zA-Z0-9!#$%&'*+/=?^_`{|}~\-]+(?:\. &" & reEmail* {.deprecated.} = r"\b[a-zA-Z0-9!#$%&'*+/=?^_`{|}~\-]+(?:\. &" &
r"[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)" & r"[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@" &
r"*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+" & r"(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+" &
r"(?:[a-zA-Z]{2}|com|org|" & r"(?:[a-zA-Z]{2}|com|org|net|gov|mil|biz|" &
r"net|gov|mil|biz|info|mobi|name|aero|jobs|museum)\b" r"info|mobi|name|aero|jobs|museum)\b"
## describes a common email address ## describes a common email address
reURL* = r"\b(http(s)?|ftp|gopher|telnet|file|notes|ms\-help):" & reURL* {.deprecated.} = r"\b(http(s)?|ftp|gopher|telnet|file|notes|ms-help)" &
r"((//)|(\\\\))+[\w\d:#@%/;$()~_?\+\-\=\\\.\&]*\b" r":((//)|(\\\\))+[\w\d:#@%/;$()~_?\+\-\=\\\.\&]*\b"
## describes an URL ## describes an URL
when isMainModule: when isMainModule: