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

Lookarounds #323

Open
BeckySharp opened this issue Aug 2, 2021 · 1 comment
Open

Lookarounds #323

BeckySharp opened this issue Aug 2, 2021 · 1 comment

Comments

@BeckySharp
Copy link
Contributor

Add info about lookarounds to the documentation, with examples.

@BeckySharp
Copy link
Contributor Author

def lookaround[_: P]: P[Ast.Assertion] = {
P(StringIn("(?=", "(?!", "(?<=", "(?<!").! ~ disjunctivePattern ~ ")").map {
// format: off
case ("(?=", pattern) => Ast.PositiveLookaheadAssertion(pattern)
case ("(?!", pattern) => Ast.NegativeLookaheadAssertion(pattern)
case ("(?<=", pattern) => Ast.PositiveLookbehindAssertion(pattern)
case ("(?<!", pattern) => Ast.NegativeLookbehindAssertion(pattern)
// format: on
case _ => ???
}
}

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

No branches or pull requests

1 participant