Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

language: regex concatenation not working as expected #340

Open
anthraxn8b opened this issue Nov 13, 2020 · 2 comments
Open

language: regex concatenation not working as expected #340

anthraxn8b opened this issue Nov 13, 2020 · 2 comments
Labels
bug This is considered a bug and shall get fixed mtail-Language/VM Issues related to the mtail language, compiler, or VM

Comments

@anthraxn8b
Copy link

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!

@jaqx0r
Copy link
Contributor

jaqx0r commented Nov 18, 2020 via email

@jaqx0r
Copy link
Contributor

jaqx0r commented Mar 20, 2021

Wow the first one is actually very terrible syntax. I should have required using an equal sign!

@jaqx0r jaqx0r added the bug This is considered a bug and shall get fixed label Mar 20, 2021
@jaqx0r jaqx0r changed the title regex concatenation not working as expected language: regex concatenation not working as expected Mar 21, 2021
@jaqx0r jaqx0r added Language mtail-Language/VM Issues related to the mtail language, compiler, or VM and removed mtail-Language labels Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is considered a bug and shall get fixed mtail-Language/VM Issues related to the mtail language, compiler, or VM
Projects
None yet
Development

No branches or pull requests

2 participants