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

Give error for [\1\Z] #99

Closed
Alexey-T opened this issue Dec 21, 2019 · 2 comments
Closed

Give error for [\1\Z] #99

Alexey-T opened this issue Dec 21, 2019 · 2 comments

Comments

@Alexey-T
Copy link
Collaborator

if meta chars are not allowed in [], it is not handled, and no error shows.
e.g. try regex [\1] or [\Z] - this gives char '1' in [], char 'Z' in [].
suggestion- show error here.

            if regparse^ = EscChar then
            begin
              Inc(regparse);
              if regparse >= fRegexEnd then
              begin
                Error(reeParseAtomTrailingBackSlash);
                Exit;
              end;
              if _IsMetaChar(regparse^) then
              begin
                AddrOfString := nil;
                CanBeRange := False;
                EmitC(OpKind_MetaClass);
                EmitC(regparse^);
              end
              else
              begin
                EmitSimpleRangeC(UnQuoteChar(regparse));
               //!! error
              end;
@Alexey-T
Copy link
Collaborator Author

@andgineer Ok to do?

@andgineer
Copy link
Owner

andgineer commented Dec 21, 2019

This is unclear for me.
Now we CAN have meta-chars inside [] like \s, \W and so on.
But also we can use "escaped" simple chars for example [a\-z] so this is not range a-z but just three chars 'a', '-', 'z'. So we do nee escaping inside [].
as well as \x20 for example.

Why do you want to raise an error?

This issue was closed.
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