Skip to content

language: regex concatenation not working as expected #340

@anthraxn8b

Description

@anthraxn8b

Hi! Great tool and maybe this is not a bug but a question for which the documentation is not clear enough. In this case please apologize thus "bug".

In my program I am doing the following - which does not work:

const A /^\/some\/path\/to\/wherever\/and\/whenever\/rest\//
const B /(servicename)\/?$/

# THE FOLLOWING LINE FAILS:
const C A + B

# THIS ALSO FAILS:
$uri =~ A + /(servicename)\/?$/ {
    service_name=$1
}

The error (first case) is:

I1113 11:34:56.517650 7604 lexer.go:116] Emitting CONST spelled "const" at mtail.mtail:49:5-9
I1113 11:34:56.517697 7604 lexer.go:116] Emitting ID spelled "C" at mtail.mtail:49:11
I1113 11:34:56.517790 7604 parser.y:628] position marked at mtail.mtail:49:11
I1113 11:34:56.517807 7604 lexer.go:116] Emitting ID spelled "A" at mtail.mtail:49:13
E1113 11:34:56.518126 7604 main.go:180] Compile encountered errors:
compile failed for mtail.mtail:
mtail.mtail:49:13: syntax error: unexpected ID, expecting DIV

So the problem is obviously the concatenation of two regex vars.

Is this a bug or am I missing some knowledge here?
THX!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis is considered a bug and shall get fixedmtail-Language/VMIssues related to the mtail language, compiler, or VM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions