openbsd-ports/sysutils/augeas/patches/patch-lenses_rx_aug

87 lines
2.4 KiB
Plaintext

$OpenBSD: patch-lenses_rx_aug,v 1.1 2013/01/04 07:55:47 jasper Exp $
commit 41adae0ed1ddb805200fda754f933d286c710a7c
Author: Jasper Lievisse Adriaanse <jasper@humppa.nl>
Date: Thu Jan 3 21:09:48 2013 +0100
Some small Rx tweaks: include regexes for octal and hex and simplify ipv4 matching.
Fixes ticket #327
commit c7f74c4e43242876e391f936c3c3b27e7292c8aa
Author: Jasper Lievisse Adriaanse <jasper@humppa.nl>
Date: Thu Jan 3 09:37:49 2013 +0100
Add a lens for OpenNTPD's config file (ntpd.conf).
Extend rx.aug with some helpful regexes while here.
Fixes ticket #324
--- lenses/rx.aug.orig Fri Jan 4 08:51:56 2013
+++ lenses/rx.aug Fri Jan 4 08:51:58 2013
@@ -50,10 +50,14 @@ let word = /[A-Za-z0-9_.-]+/
One or more digits *)
let integer = /[0-9]+/
-(* Variable: integer
+(* Variable: relinteger
A relative <integer> *)
let relinteger = /[-+]?[0-9]+/
+(* Variable: relinteger_noplus
+ A relative <integer>, without explicit plus sign *)
+let relinteger_noplus = /[-]?[0-9]+/
+
(* Variable: decimal
A decimal value (using ',' or '.' as a separator) *)
let decimal = /[0-9]+([.,][0-9]+)?/
@@ -62,6 +66,18 @@ let decimal = /[0-9]+([.,][0-9]+)?/
A relative <decimal> *)
let reldecimal = /[+-]?[0-9]+([.,][0-9]+)?/
+(* Variable: byte
+ A byte (0 - 255) *)
+let byte = /25[0-5]?|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9]/
+
+(* Variable: hex
+ A hex value *)
+let hex = /0x[0-9a-fA-F]+/
+
+(* Variable: octal
+ An octal value *)
+let octal = /0[0-7]+/
+
(* Variable: fspath
A filesystem path *)
let fspath = /[^ \t\n]+/
@@ -71,7 +87,6 @@ let fspath = /[^ \t\n]+/
Anything but a space, a comma or a comment sign *)
let neg1 = /[^,# \n\t]+/
-
(*
* Group: IPs
* Cf. http://blog.mes-stats.fr/2008/10/09/regex-ipv4-et-ipv6/ (in fr)
@@ -80,8 +95,7 @@ let neg1 = /[^,# \n\t]+/
(* Variable: ipv4 *)
let ipv4 =
let dot = "." in
- let digits = /(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/ in
- digits . dot . digits . dot . digits . dot . digits
+ byte . dot . byte . dot . byte . dot . byte
(* Variable: ipv6 *)
let ipv6 =
@@ -114,6 +128,11 @@ let ipv6 =
An <ipv4> or <ipv6> *)
let ip = ipv4 | ipv6
+
+(* Variable: hostname
+ A valid RFC 1123 hostname *)
+let hostname = /(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(
+ [A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])/
(*
* Variable: device_name