[Nemerle 0001158]: regexp match problem

2 views
Skip to first unread message

feed...@nemerle.org

unread,
Dec 17, 2008, 11:13:24 AM12/17/08
to nemerl...@googlegroups.com

The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=1158>
======================================================================
Reported By: Don Reba
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 1158
Category: The Macro Library
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 12-17-2008 17:13 CET
Last Modified: 12-17-2008 17:13 CET
======================================================================
Summary: regexp match problem
Description:
The following code works:

using Nemerle.Text;
def GetLanguage(path)
{
regexp match (path.ToLower())
{
| @"file-(?<language>..)\.txt" => language
| _ => "none"
}
}
System.Console.WriteLine(GetLanguage("file-fr.txt"));

but the following does not:

using Nemerle.Text;
def GetLanguage(paths)
{
mutable result;
foreach (path in paths)
{
result =
regexp match (path.ToLower())
{
| @"file-(?<language>..)\.txt" => language
| _ => "none"
}
}
result;
}
System.Console.WriteLine(GetLanguage([ "file-fr.txt" ]));

test.n|9 col 4| 13:5: error: unbound type `matchobj.Groups["language"]'
test.n|9 col 4| 13:5: error: unbound name
`matchobj.Groups["language"].ToString'
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
12-17-08 17:13 Don Reba New Issue
======================================================================

feed...@nemerle.org

unread,
Dec 18, 2008, 5:06:41 AM12/18/08
to nemerl...@googlegroups.com

A NOTE has been added to this issue.

======================================================================
<http://nemerle.org/bugs/view.php?id=1158>
======================================================================
Reported By: Don Reba
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 1158
Category: The Macro Library
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 12-17-2008 17:13 CET
Last Modified: 12-18-2008 11:06 CET

----------------------------------------------------------------------
NN - 12-18-08 11:06
----------------------------------------------------------------------
I have the same problem while implementing regexp foreach:
http://rsdn.ru/forum/message/2943448.flat.aspx#2943448

I get the similar errors:
Error: unbound type 'matchobj.Groups["_N_4560"]'
Error: unbound name 'matchobj.Groups["_N_4560"].Success'
Error: unbound type 'matchobj.Groups["x"]'
Error: unbound name 'matchobj.Groups["x"].ToString'

It works for
def s = regexp foreach(a in ["a", "b"])
{
| "a" => "a"
| "b" => "b"
| _ => "c"
}

But not for
mutable s = "";
regexp foreach(a in ["a", "b"])
{
| "a" => s = "a"
| "b" => s = "b"
| _ => s = "c"
}

Issue History
Date Modified Username Field Change
======================================================================
12-17-08 17:13 Don Reba New Issue

12-17-08 17:13 Don Reba Issue Monitored: Don Reba
12-18-08 11:06 NN Note Added: 0002154
======================================================================

feed...@nemerle.org

unread,
Dec 18, 2008, 5:08:43 AM12/18/08
to nemerl...@googlegroups.com

A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=1158>
======================================================================
Reported By: Don Reba
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 1158
Category: The Macro Library
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 12-17-2008 17:13 CET
Last Modified: 12-18-2008 11:08 CET

----------------------------------------------------------------------
NN - 12-18-08 11:08
----------------------------------------------------------------------
Mistake:
I meant s = x instead s = "a"

Issue History
Date Modified Username Field Change
======================================================================
12-17-08 17:13 Don Reba New Issue
12-17-08 17:13 Don Reba Issue Monitored: Don Reba
12-18-08 11:06 NN Note Added: 0002154

12-18-08 11:08 NN Note Added: 0002155
======================================================================

Reply all
Reply to author
Forward
0 new messages