-
Notifications
You must be signed in to change notification settings - Fork 1.8k
java.util.Pattern flavor for TRegex #4815
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
base: master
Are you sure you want to change the base?
Conversation
|
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When singing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. |
|
Thank you for contributing to GraalVM, we will review your PR shortly |
|
@djoooooe could you please assign someone to review this PR? let me know if you need me to mirror it to bitbucket. Thank you |
| import org.graalvm.polyglot.Context; | ||
| import org.graalvm.polyglot.Value; | ||
|
|
||
| public class JavaTruffleRegex { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused?
| // String input = "hello World!"; | ||
| // String input = "def=def"; | ||
| String input = "abcabcabc"; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove commented code and TODO comments
| context = Context.newBuilder().build(); | ||
| context.enter(); | ||
| tregexPattern = context.eval(TRegexTestDummyLanguage.ID, '/' + reURL + '/'); | ||
| tregexPattern = context.eval(TRegexTestDummyLanguage.ID, /*"Flavor=JavaUtilPattern" + */'/' + reURL + '/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undo
| // @Benchmark | ||
| // public boolean javaPattern(BenchState state) { | ||
| // return state.javaPattern.matcher(state.input).find(); | ||
| // } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undo
| public void quantifiers() { | ||
| test("abc?", 0, "ab"); | ||
| test("abc??", 0, "ab"); | ||
| // test("abc?+c", 0, "abcc"); // not supported yet --> bailout (possive quantifiers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transform to a test that expects the bailout
| parens(); | ||
| break; | ||
| case '^': | ||
| case '^': // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
| @@ -0,0 +1,294 @@ | |||
| package com.oracle.truffle.regex.tregex.parser; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing copyright header
| private final int value; | ||
|
|
||
| private static final String FLAGS = "idmsuxU"; | ||
| // private static final String BIT_FLAGS = "mixy"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code
| private void addQuantifier(Token.Quantifier quantifier) { | ||
| astBuilder.addQuantifier(quantifier); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code
| addDollar(); // $ | ||
| nextSequence(); // | | ||
| pushLookAheadAssertion(false); // (?= | ||
| pushGroup(); // (?: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushLookAheadAssertion automatically pushes a group, no need to do that here
Yes, please mirror this PR to bitbucket |
| pushGroup(); // (?: | ||
| addCharClass(CodePointSet.create('\r')); | ||
| addCharClass(CodePointSet.create('\n')); | ||
| nextSequence(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also remove the corresponding popGroup(), and add a test that hits this path
Adding support for Java Regex in TRegex (as part of Bachelor thesis)