summary refs log tree commit diff stats
path: root/lib/pure/regexprs.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <andreasrumpf@noname>2009-09-23 23:38:00 +0200
committerAndreas Rumpf <andreasrumpf@noname>2009-09-23 23:38:00 +0200
commit3f3dda5a77fa8faf6d97aa5a0ed3b0fc6e8c0918 (patch)
tree81fcf664ab2abfda200061e57fa488ae17b03192 /lib/pure/regexprs.nim
parent66a7e3d37c0303997a6b1a3b7ec263dfb8c07748 (diff)
downloadNim-3f3dda5a77fa8faf6d97aa5a0ed3b0fc6e8c0918.tar.gz
implemented multi methods
Diffstat (limited to 'lib/pure/regexprs.nim')
-rwxr-xr-xlib/pure/regexprs.nim10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/pure/regexprs.nim b/lib/pure/regexprs.nim
index 3a6ca72ae..54f9dc471 100755
--- a/lib/pure/regexprs.nim
+++ b/lib/pure/regexprs.nim
@@ -8,6 +8,9 @@
 #
 
 ## Regular expression support for Nimrod.
+## **Deprecated** since version 0.8.2. Use the module `re` instead.
+{.deprecated.}
+
 ## Currently this module is implemented by providing a wrapper around the
 ## `PRCE (Perl-Compatible Regular Expressions) <http://www.pcre.org>`_
 ## C library. This means that your application will depend on the PRCE
@@ -131,13 +134,14 @@ template `=~` *(s, pattern: expr): expr =
   ##     echo("comment: ", matches[1])
   ##   else:
   ##     echo("syntax error")
-  ## 
-  var matches: array[0..maxSubPatterns-1, string]
+  ##
+  when not definedInScope(matches):
+    var matches: array[0..maxSubPatterns-1, string]
   match(s, pattern, matches)
   
 
 const ## common regular expressions
-  reIdentifier* = r"\b[a-zA-Z_]+[a-zA-Z_0-9]*\b"  ## describes an identifier
+  reIdentifier* = r"\b[a-zA-Z_][a-zA-Z_0-9]*\b"  ## describes an identifier
   reNatural* = r"\b\d+\b" ## describes a natural number
   reInteger* = r"\b[-+]?\d+\b" ## describes an integer
   reHex* = r"\b0[xX][0-9a-fA-F]+\b" ## describes a hexadecimal number