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

How to make expression work with . (Escape for js does not work) #22

Open
deanmaster opened this issue Jul 2, 2024 · 1 comment
Open

Comments

@deanmaster
Copy link

Hello @kevinkhill .

I hope I read you well. Current i'm stuck with creating an expression to detect the method syntax.
For example

employee.getName()

My expression look like this but it does not work. Do you know how to pass in . and ( and ) into the regex of your library?

lexer.rule(/(?<![\w\d])(\.)(getName)(?![\w\d])/, (ctx, match) => {
  ctx.accept("method");
});
@kevinkhill
Copy link
Owner

To be honest... I don't remember. I made this a long time ago and don't remember how it works........

I think you need to be more generic with the rule. Instead of matching the actual method, match that a word is following a "." and ends with "(" because that would indicate a method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants