comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <PChapin@vtc.vsc.edu>
Subject: GNAT.Regpat problem.
Date: Tue, 22 Mar 2011 14:35:15 -0400
Date: 2011-03-22T14:35:15-04:00	[thread overview]
Message-ID: <alpine.WNT.2.00.1103221429170.5412@WHIRLWIND> (raw)

I'm trying to use regular expressions in a program via the package 
GNAT.Regpat. Here is a reduced example:

with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Regpat;

procedure Check is
    Matcher : GNAT.Regpat.Pattern_Matcher(10);

begin
    GNAT.Regpat.Compile(Matcher, "^[:space:]*xyzzy$");

exception
    when Storage_Error =>
       Put_Line("Insufficient space in Pattern_Matcher");

end Check;

The documentation for package GNAT.Regpat says this about the Compile 
procedure I think I'm using: "This function [sic] raises Storage_Error if 
Matcher is too small to hold the resulting code (i.e. Matcher.Size has too 
small a value)."

In the example above the size is intentionally set too small. My program 
fails with a PROGRAM_ERROR exception (EXCEPTION_ACCESS_VIOLATION). If I make 
the size of the Matcher just 1, the program hangs. If I make the size 
something reasonable, the program runs fine.

So is this an issue with GNAT.Regpat? It seems like it does not honor its 
documentation. Perhaps I'm doing something wrong.

Peter




             reply	other threads:[~2011-03-22 18:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 18:35 Peter C. Chapin [this message]
2011-03-22 19:01 ` GNAT.Regpat problem Georg Bauhaus
2011-03-22 19:17 ` Florian Weimer
2011-03-22 19:21 ` Adam Beneschan
2011-03-22 20:31   ` Simon Wright
2011-03-24 10:23     ` Peter C. Chapin
2011-03-24 10:43       ` Dmitry A. Kazakov
2011-03-24 14:04         ` Peter C. Chapin
2011-03-24 14:34           ` Dmitry A. Kazakov
2011-03-24 16:20             ` Georg Bauhaus
2011-03-24 17:37               ` Dmitry A. Kazakov
2011-03-24 21:12             ` Peter C. Chapin
2011-03-25  9:02               ` Dmitry A. Kazakov
2011-03-24 16:41           ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox