Skip to content

Commit

Permalink
CHANGE: Removed /all refine from parse
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 6, 2022
1 parent eef4085 commit 1a9db60
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/boot/natives.reb
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ parse: native [
{Parses a string or block series according to grammar rules.}
input [series!] {Input series to parse}
rules [block!] {Rules to parse}
/all {For simple rules (not blocks) parse all chars including whitespace}
;/all {For simple rules (not blocks) parse all chars including whitespace}
/case {Uses case-sensitive comparison}
]

Expand Down
9 changes: 6 additions & 3 deletions src/core/u-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,10 +1286,13 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
REBVAL *arg = D_ARG(2);
REBCNT opts = 0;

if (D_REF(3)) opts |= PF_ALL;
if (D_REF(4)) opts |= PF_CASE;
if (D_REF(3)) opts |= PF_CASE;
if (IS_BINARY(val)) opts |= PF_CASE;

if (IS_BINARY(val)) opts |= PF_ALL | PF_CASE;
// There was originally also /all
// if (D_REF(3)) opts |= PF_ALL;
// if (D_REF(4)) opts |= PF_CASE;
// if (IS_BINARY(val)) opts |= PF_ALL | PF_CASE;

#ifdef INCLUDE_PARSE_SERIES_SPLITTING
// Is it a simple string?
Expand Down
2 changes: 1 addition & 1 deletion src/mezz/codec-bbcode.reb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ form-attribute: func[name /default value][

encode-value: func[value [any-string!] /local out tmp][
out: copy ""
parse/all value [
parse value [
any [
;pos: ;(probe pos)
[
Expand Down
2 changes: 1 addition & 1 deletion src/mezz/codec-der.reb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ register-codec [
/full "Returns name with group name as a string"
/local main name warn
][
parse/all oid [
parse oid [
#{2B0E0302} (main: "Oddball OIW OID") [
;http://oid-info.com/get/1.3.14.3.2
#"^(01)" (name: 'rsa)
Expand Down
4 changes: 2 additions & 2 deletions src/mezz/codec-pkix.reb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ wrap [
some ch_pretext rl_label
]

unless parse/all input [
unless parse input [
s: rl_label ( pre-text: copy/part s e )
any [
copy tag some ch_tag #":"
Expand Down Expand Up @@ -83,7 +83,7 @@ wrap [
|
some ch_pretext rl_label
]
parse/all data [rl_label to end]
parse data [rl_label to end]
]
]
]
2 changes: 1 addition & 1 deletion src/mezz/codec-utc-time.reb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ register-codec [
utc [binary! string!]
][
ch_digits: charset [#"0" - #"9"]
parse/all utc [
parse utc [
insert "20"
2 ch_digits insert #"-"
2 ch_digits insert #"-"
Expand Down
2 changes: 1 addition & 1 deletion src/mezz/mezz-files.reb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ clean-path: func [
out: make file length? file ; same datatype
cnt: 0 ; back dir counter

parse/all reverse file [
parse reverse file [
some [
;pp: (?? pp)
"../" (++ cnt)
Expand Down
6 changes: 3 additions & 3 deletions src/mezz/prot-http.reb
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ check-response: func [port /local conn res headers d1 d2 line info state awake s
res: false
unless info/response-parsed [
;?? line
parse/all line [
parse line [
"HTTP/1." [#"0" | #"1"] some #" " [
#"1" (info/response-parsed: 'info)
|
Expand Down Expand Up @@ -600,7 +600,7 @@ check-data: func [port /local headers res data available out chunk-size pos trai
]
if not empty? data [
until [
either parse/all data [
either parse data [
copy chunk-size some hex-digits
crlfbin pos: to end
][
Expand All @@ -610,7 +610,7 @@ check-data: func [port /local headers res data available out chunk-size pos trai
available: length? data
sys/log/more 'HTTP ["Chunk-size:^[[m" chunk-size " ^[[36mavailable:^[[m " available]
either chunk-size = 0 [
if parse/all data [
if parse data [
crlfbin (trailer: "") to end | copy trailer to crlf2bin to end
][
trailer: construct trailer
Expand Down
22 changes: 11 additions & 11 deletions src/mezz/prot-mysql.reb
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ mysql-driver: make object! [
]

set 'sql-escape func [value [string!] /local c][
parse/all value [
parse value [
any [
c: sql-chars (c: change/part c select escaped c/1 1) :c
| sql-no-chars
Expand Down Expand Up @@ -694,7 +694,7 @@ mysql-driver: make object! [

insert-all-queries: func [port [port!] data [string!] /local s e res d][
d: port/extra/delimiter
parse/all s: data [
parse s: data [
any [
#"#" thru newline
| #"'" any ["\\" | "\'" | "''" | not-squote] #"'"
Expand Down Expand Up @@ -769,7 +769,7 @@ mysql-driver: make object! [
254 [
if pl/packet-len < 9 [
if pl/packet-len = 5 [
parse/all/case next port/data [
parse/case next port/data [
read-int (pl/current-result/warnings: int)
read-int (pl/more-results?: not zero? int and 8)
]
Expand All @@ -791,7 +791,7 @@ mysql-driver: make object! [
]
]
; ignore session track info
parse/all/case next port/data rules
parse/case next port/data rules
]
return 'OK
]
Expand Down Expand Up @@ -905,7 +905,7 @@ mysql-driver: make object! [
case [
any [pl/current-cmd = defs/cmd/query
pl/current-cmd = defs/cmd/field-list][
parse/all/case buf [
parse/case buf [
read-length (if zero? pl/current-result/n-columns: len [
pl/stream-end?: true
sys/log/more 'MySQL["stream ended because of 0 columns"]
Expand Down Expand Up @@ -970,7 +970,7 @@ mysql-driver: make object! [
OTHER [
col: make column-class []
either pl/capabilities and defs/client/protocol-41 [
parse/all/case buf [
parse/case buf [
read-field (col/catalog: to string! field)
read-field (col/db: to string! field)
read-field (col/table: to string! field)
Expand All @@ -987,7 +987,7 @@ mysql-driver: make object! [
read-length (col/default: len)
]
][
parse/all/case buf [
parse/case buf [
read-field (col/table: to string! field)
read-field (col/name: to string! field)
read-length (col/length: len)
Expand Down Expand Up @@ -1049,7 +1049,7 @@ mysql-driver: make object! [
OTHER FB[
row: make block! pl/current-result/n-columns
;sys/log/more 'MySQL["row buf:" copy/part buf pl/next-packet-length]
parse/all/case buf [pl/current-result/n-columns [read-field (append row field)]]
parse/case buf [pl/current-result/n-columns [read-field (append row field)]]
;sys/log/more 'MySQL["row:" mold row]
if none? pl/current-result/rows [
pl/current-result/rows: make block! 10
Expand Down Expand Up @@ -1114,13 +1114,13 @@ mysql-driver: make object! [
tcp-port: port
pl: port/extra
if data/1 = 255 [;error packet
parse/all skip data 1 [
parse skip data 1 [
read-int (pl/error-code: int)
read-string (pl/error-msg: string)
]
cause-error 'Access 'message reduce [pl/error-code pl/error-msg]
]
parse/all data [
parse data [
read-byte (pl/protocol: byte)
read-string (pl/version: string)
read-long (pl/thread-id: long)
Expand Down Expand Up @@ -1255,7 +1255,7 @@ mysql-driver: make object! [
switch/default pl/packet-state [
reading-packet-head [
;sys/log/more 'MySQL["read a packet head" mold copy/part tcp-port/data std-header-length]
parse/all tcp-port/data [
parse tcp-port/data [
read-int24 (pl/packet-len: int24)
read-byte (pl/seq-num: byte)
]
Expand Down
2 changes: 1 addition & 1 deletion src/mezz/sys-base.reb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ log: func [
][
if error [
msg: form either block? msg [reduce msg][msg]
foreach line parse/all msg #"^/" [
foreach line split msg #"^/" [
print ajoin [
" ^[[35m[" id "] ^[[1m"
either line/1 = #"*" []["** Error: "]
Expand Down
2 changes: 1 addition & 1 deletion src/modules/httpd.reb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ decode-target: wrap [

result: object [file: none values: make block! 8 fragment: none original: target]
unless target [return result]
parse/all to binary! target [
parse to binary! target [
opt [
copy val any chars (result/file: val) [
#"?"
Expand Down
10 changes: 5 additions & 5 deletions src/tests/units/parse-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,10 @@ Rebol [
abc: charset [ "a" "b" "c" ]
rls: [ "a" some ws copy b some abc some ws "c" ]
rla: [ "a" any ws copy b some abc any ws "c" ]
--assert parse/all "a b c" rls
--assert parse/all "a b c" rla
--assert not parse/all "a b" rls
--assert not parse/all "a b" rla
--assert parse "a b c" rls
--assert parse "a b c" rla
--assert not parse "a b" rls
--assert not parse "a b" rla


--test-- "issue-967"
Expand Down Expand Up @@ -392,7 +392,7 @@ Rebol [
--test-- "issue-206"
;@@ https://github.com/Oldes/Rebol-issues/issues/206
any-char: complement charset ""
--assert parse/all "^(80)" [any-char]
--assert parse "^(80)" [any-char]

--test-- "issue-1895"
;@@ https://github.com/Oldes/Rebol-issues/issues/1895
Expand Down

0 comments on commit 1a9db60

Please sign in to comment.