[nem-bug] [Nemerle 0000713]: Problem with 'regexp match' macro

feedback at nemerle.org feedback at nemerle.org
Wed Jul 12 21:58:03 CEST 2006


The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=713> 
======================================================================
Reported By:                steffen
Assigned To:                nazgul
======================================================================
Project:                    Nemerle
Issue ID:                   713
Category:                   The Macro Library
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     resolved
Resolution:                 fixed
Fixed in Version:           
======================================================================
Date Submitted:             07-11-2006 16:54 CEST
Last Modified:              07-12-2006 21:58 CEST
======================================================================
Summary:                    Problem with 'regexp match' macro
Description: 
The following program:

using Nemerle.Text;

def s = "asdf";

regexp match (s) {
    | @"(?<_a>.*)\)" => ()
    | _ => ()
}

creates an ICE on compilation:

error: internal compiler error: got some unknown exception of type
System.InvalidOperationException: Operation is not valid due to the
current state of the object
in <0x00066> System.Collections.Generic.Stack`1[System.Boolean]:Pop ()
in <0x00a6e> Nemerle.Text.regexpMacro:Run (Nemerle.Compiler.Typer _N_1,
Nemerle.Core.list`1 parms)
in <0x004e1> Nemerle.Compiler.MacroRegistry:expand_macro
(Nemerle.Compiler.Typer ctx, Nemerle.Compiler.Parsetree.PExpr expr)
in <0x000bf> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x051f5> Nemerle.Compiler.Typer:DoType
(Nemerle.Compiler.Parsetree.PExpr expression, Nemerle.Compiler.TyVar
expected, Boolean is_toplevel_in_seq)
in <0x000d5> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected,
Boolean is_toplevel_in_seq)
in <0x00012> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e, Nemerle.Compiler.TyVar expected)
in <0x0001d> Nemerle.Compiler.Typer:TypeExpr
(Nemerle.Compiler.Parsetree.PExpr e)
in <0x0047c> Nemerle.Compiler.Typer:RunTyper ()
in <0x00321> Nemerle.Compiler.Typer:.ctor (Nemerle.Compiler.MethodBuilder
m)
in <0x0003d> Nemerle.Compiler.MethodBuilder:RunBodyTyper ()
in <0x00045> Nemerle.Compiler.MethodBuilder:Compile ()
in <0x000ff> Nemerle.Compiler.TypeBuilder:EmitImplementation ()
in <0x0004f> Nemerle.Compiler.TypesManager+_N_emit_impl_24604:apply_void
(Nemerle.Compiler.TypeBuilder _N_24603)
in <0x0012c> Nemerle.Compiler.TypesManager+_N_maybe_f_25051:apply_void
(Nemerle.Compiler.TypeBuilder _N_25050)
in <0x00087> Nemerle.Collections.List:Iter[TypeBuilder]
(Nemerle.Core.list`1 l, Nemerle.Builtins.FunctionVoid`1 f)
in <0x0000d> Nemerle.Core.list`1[Nemerle.Compiler.TypeBuilder]:Iter
(Nemerle.Builtins.FunctionVoid`1 )
in <0x00065> Nemerle.Compiler.TypesManager:Iter (Nemerle.Core.list`1
builders, Nemerle.Builtins.FunctionVoid`1 f)
in <0x0001d> Nemerle.Compiler.TypesManager:Iter
(Nemerle.Builtins.FunctionVoid`1 f)
in <0x001d3> Nemerle.Compiler.TypesManager:compile_all_tyinfos (Boolean
aux_phase)
in <0x00039> Nemerle.Compiler.TypesManager+_N__N_l24188_24276:apply_void
()
in <0x00040> Nemerle.Compiler.Solver:Enqueue
(Nemerle.Builtins.FunctionVoid action)
in <0x00058> Nemerle.Compiler.TypesManager:EmitDecls ()
in <0x00201> Nemerle.Compiler.ManagerClass:Run ()
in <0x000f5> Nemerle.CommandlineCompiler.MainClass:main_with_catching ()


======================================================================

----------------------------------------------------------------------
 Snaury - 07-11-06 19:01 
----------------------------------------------------------------------
I think this patch fixes all issues with escaped parentheses. It also
includes small improvement that eliminates dead code with
MatchFailureException and actually moves throw to the appropriate place.
So now expressions like this:

def text = regexp match("something") {
  | @"something" => "sometext"
}

Will both compile and execute (was giving inference error before which was
not surprising), and will throw if no branch matches.

----------------------------------------------------------------------
 nazgul - 07-12-06 21:58 
----------------------------------------------------------------------
Fixed on trunk (r6447).
Thanks.

BTW. it would be useful to prefix the topic of bug with [PATCH] after
attaching one :-)

Issue History
Date Modified  Username       Field                    Change              
======================================================================
07-11-06 16:54 steffen        New Issue                                    
07-11-06 18:58 Snaury         File Added: bug-regexp-match.patch                
   
07-11-06 19:01 Snaury         Note Added: 0001361                          
07-12-06 21:58 nazgul         Status                   new => resolved     
07-12-06 21:58 nazgul         Resolution               open => fixed       
07-12-06 21:58 nazgul         Assigned To               => nazgul          
07-12-06 21:58 nazgul         Note Added: 0001364                          
======================================================================




More information about the bugs mailing list