From c52788d3efb6c7c4beba1fff05a9bee353340079 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 25 Jun 2016 16:56:28 -0700 Subject: [PATCH] regexp: rename $ and ^ --- libs/regexp/classes/classes.factor | 2 +- libs/regexp/compiler/compiler.factor | 4 ++-- libs/regexp/nfa/nfa.factor | 4 ++-- libs/regexp/parser/parser.factor | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/regexp/classes/classes.factor b/libs/regexp/classes/classes.factor index d812a11038..71bf4c2c9b 100644 --- a/libs/regexp/classes/classes.factor +++ b/libs/regexp/classes/classes.factor @@ -12,7 +12,7 @@ ascii-class punctuation-class java-printable-class blank-class control-character-class hex-digit-class java-blank-class c-identifier-class unmatchable-class terminator-class word-boundary-class ; -SINGLETONS: beginning-of-input ^ end-of-input $ end-of-file +SINGLETONS: beginning-of-input begin-anchor end-of-input end-anchor end-of-file ^unix $unix word-break ; TUPLE: range-class { from read-only } { to read-only } ; diff --git a/libs/regexp/compiler/compiler.factor b/libs/regexp/compiler/compiler.factor index c0d89153b2..66724d76ab 100644 --- a/libs/regexp/compiler/compiler.factor +++ b/libs/regexp/compiler/compiler.factor @@ -30,10 +30,10 @@ M: end-of-file question>quot } 2&& ] ; -M: $ question>quot +M: end-anchor question>quot drop [ { [ length = ] [ ?nth "\r\n" member? ] } 2|| ] ; -M: ^ question>quot +M: begin-anchor question>quot drop [ { [ drop zero? ] [ [ 1 - ] dip ?nth "\r\n" member? ] } 2|| ] ; M: $unix question>quot diff --git a/libs/regexp/nfa/nfa.factor b/libs/regexp/nfa/nfa.factor index aec39e370d..6dc5ab702c 100644 --- a/libs/regexp/nfa/nfa.factor +++ b/libs/regexp/nfa/nfa.factor @@ -63,10 +63,10 @@ M: object modify-epsilon ; drop [ unix-lines option? ] 2dip swap ? ] [ 2nip ] if ; -M: $ modify-epsilon +M: end-anchor modify-epsilon $unix end-of-input line-option ; -M: ^ modify-epsilon +M: begin-anchor modify-epsilon ^unix beginning-of-input line-option ; M: tagged-epsilon nfa-node diff --git a/libs/regexp/parser/parser.factor b/libs/regexp/parser/parser.factor index 64f29ccd31..22b325c4ff 100644 --- a/libs/regexp/parser/parser.factor +++ b/libs/regexp/parser/parser.factor @@ -146,8 +146,8 @@ Escape = "p{" CharacterInBracket*:s "}" => [[ s name>class ]] EscapeSequence = "\\" Escape:e => [[ e ]] Character = EscapeSequence - | "$" => [[ $ ]] - | "^" => [[ ^ ]] + | "$" => [[ end-anchor ]] + | "^" => [[ begin-anchor ]] | . ?[ allowed-char? ]? AnyRangeCharacter = !("&&"|"||"|"--"|"~~") (EscapeSequence | .)