-
Notifications
You must be signed in to change notification settings - Fork 504
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
Functional Rewrite (2.0.0) #198
Open
shreyasminocha
wants to merge
134
commits into
master
Choose a base branch
from
2.0.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The new version will be written directly with Typescript, so we'll start by having a simple, blank Typescript project base.
Extracted "simplifyExpression" helper function to its own file
Extracted `simpleExp` function so we can easily compile expressions that only add something to the input
Changed all functions to return regular expressions. This way we use regexp as the sanitized form and strings are always unsanitized
`multiple` now supports: - `multiple('foo')` — `(?:foo)*` - `multiple('foo', 2)` — `(?:foo){2}` - `multiple('foo', 2, Infinity)` — `(?:foo){2,}` - `multiple('foo', 2, 10)` — `(?:foo){2,10}`
We aren't using nyc at the moment. Entries like .idea, .vscode, and .DS_STORE should be in one's global gitignore rather than in the project's gitignore.
We aren't using them at the moment.
… in preparation for a readme-rewrite.
Rollup bundles doesn't seem to be exporting default exports. See also: - https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html - https://humanwhocodes.com/blog/2019/01/stop-using-default-exports-javascript-module
@jehna I'd appreciate if you would leave this PR a review. Like I said, we're still not ready for production, of course. In terms of features and tests though I think we're pretty solid. I understand it's a large PR, so take your time! |
Reduces duplication and associated troubles.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See also #196 and #197.
For a sneak peak, check out the tests in the
test
directory, especially those intest/examples
.Completed features
anyCharacterFrom
—[…]
anyCharacterBut
—[^…]
group
—(…)
group.capturing
—(…)
group.nonCapturing
—(?:…)
group.named
|group.capturing.named
—(?<foo>…)
backReference
—\1
or\k<foo>
or
—(?…|…|…)
maybe
|optionally
—…?
maybe.greedy
—…?
maybe.lazy
—…??
multiple
|zeroOrMore
—…*
multiple.greedy
—…*
multiple.lazy
—…*?
oneOrMore
—…+
oneOrMore.greedy
—…+
oneOrMore.lazy
—…+?
repeat
repeat(x)
—…{x}
repeat(min, Infinity)
—…{x,}
repeat(min, max)
—…{min,max}
oneOrMore
lookahead
—(?=…)
lookahead.negative
—(?!…)
lookahead.positive
—(?=…)
lookbehind
—(?<=…)
lookbehind.negative
—(?<!…)
lookbehind.positive
—(?<=…)
anyCharacter
—.
digit
—\d
nonDigit
—\D
whitespaceCharacter
—\s
nonWhitespaceCharacter
—\S
wordCharacter
—\w
nonWordCharacter
—\W
something
—.+
anything
—.*
startOfLine
—^
endOfLine
—$
wordBoundary
—\b
nonWordBoundary
—\B
concat
Incomplete/planned features
String replacement helper constants and functionsDropped. See aeb11c9.Tests
They're all up to date from my end and we have 100% coverage although let me know if you notice something that's not being properly tested. At the moment there are over 15 test suites and over 150 tests.
Docs
I haven't written any docs at the moment, although if you want to get a feel of how things will be, check out the tests in the
test
directory, especiallytest/examples
. I'm thinking of a gatsby site with the actual docs written in mdx although I'm open to other ideas.This PR should also resolve
or
is used withendOfLine
#167