Skip to content

Commit 986830d

Browse files
committed
syntax: conditionally compile all look-around types
1 parent e01e3c6 commit 986830d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

regex-syntax/src/ast/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@ pub enum Ast {
503503
Dot(Box<Span>),
504504
/// A single zero-width assertion.
505505
Assertion(Box<Assertion>),
506-
#[cfg(feature = "look-behinds")]
507506
/// A single look-around regular expression.
507+
#[cfg(feature = "look-behinds")]
508508
LookAround(Box<LookAround>),
509509
/// A single Unicode character class, e.g., `\pL` or `\p{Greek}`.
510510
ClassUnicode(Box<ClassUnicode>),
@@ -1384,6 +1384,7 @@ pub enum AssertionKind {
13841384
/// A single zero-width look-around.
13851385
#[derive(Clone, Debug, Eq, PartialEq)]
13861386
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1387+
#[cfg(feature = "look-behinds")]
13871388
pub struct LookAround {
13881389
/// The span of this look-around.
13891390
pub span: Span,
@@ -1396,6 +1397,7 @@ pub struct LookAround {
13961397
/// A look-around kind.
13971398
#[derive(Clone, Debug, Eq, PartialEq)]
13981399
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1400+
#[cfg(feature = "look-behinds")]
13991401
pub enum LookAroundKind {
14001402
/// `(?<=...)`
14011403
PositiveLookBehind,

regex-syntax/src/hir/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,13 +1804,15 @@ impl Look {
18041804
/// Currently, only lookbehind assertions are supported.
18051805
/// Furthermore, capture groups inside assertions are not supported.
18061806
#[derive(Clone, Debug, Eq, PartialEq)]
1807+
#[cfg(feature = "look-behinds")]
18071808
pub enum LookAround {
18081809
/// A positive lookbehind assertion.
18091810
PositiveLookBehind(Box<Hir>),
18101811
/// A negative lookbehind assertion.
18111812
NegativeLookBehind(Box<Hir>),
18121813
}
18131814

1815+
#[cfg(feature = "look-behinds")]
18141816
impl LookAround {
18151817
/// Returns a reference to the inner expression that must match for this
18161818
/// look-around assertion to hold.

0 commit comments

Comments
 (0)