summaryrefslogtreecommitdiff
path: root/contrib/seg/seg-validate.pl
diff options
context:
space:
mode:
authorTom Lane2000-12-11 20:40:33 +0000
committerTom Lane2000-12-11 20:40:33 +0000
commita3694b420f194ba26f3bf721f4a53fc0a43c2581 (patch)
treec7381cad0c118f47d04f3b2a986f3ca95b0dc038 /contrib/seg/seg-validate.pl
parent9892ddf5ee0c1c82e879f4bb20bf1f53b4241a45 (diff)
Gene Selkov's SEG datatype (GiST example code)
Diffstat (limited to 'contrib/seg/seg-validate.pl')
-rwxr-xr-xcontrib/seg/seg-validate.pl42
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/seg/seg-validate.pl b/contrib/seg/seg-validate.pl
new file mode 100755
index 00000000000..9272936aef2
--- /dev/null
+++ b/contrib/seg/seg-validate.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+$integer = '[+-]?[0-9]+';
+$real = '[+-]?[0-9]+\.[0-9]+';
+
+$RANGE = '(\.\.)(\.)?';
+$PLUMIN = q(\'\+\-\');
+$FLOAT = "(($integer)|($real))([eE]($integer))?";
+$EXTENSION = '<|>|~';
+
+$boundary = "($EXTENSION)?$FLOAT";
+$deviation = $FLOAT;
+
+$rule_1 = $boundary . $PLUMIN . $deviation;
+$rule_2 = $boundary . $RANGE . $boundary;
+$rule_3 = $boundary . $RANGE;
+$rule_4 = $RANGE . $boundary;
+$rule_5 = $boundary;
+
+
+print "$rule_5\n";
+while (<>) {
+# s/ +//g;
+ if ( /^($rule_1)$/ ) {
+ print;
+ }
+ elsif ( /^($rule_2)$/ ) {
+ print;
+ }
+ elsif ( /^($rule_3)$/ ) {
+ print;
+ }
+ elsif ( /^($rule_4)$/ ) {
+ print;
+ }
+ elsif ( /^($rule_5)$/ ) {
+ print;
+ }
+ else {
+ print STDERR "error in $_\n";
+ }
+
+}