From c8732657b782de35193d9975b0d36c44c3dd3345 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 16 Oct 2011 13:01:58 -0700 Subject: [PATCH] Cleanup more lint warnings. --- basis/http/parsers/parsers.factor | 2 +- basis/memoize/memoize.factor | 2 +- basis/peg/ebnf/ebnf-tests.factor | 2 +- basis/peg/ebnf/ebnf.factor | 2 +- basis/unicode/data/data.factor | 2 +- basis/xml/elements/elements.factor | 2 +- basis/xml/tokenize/tokenize.factor | 10 +++++----- core/sequences/sequences.factor | 6 +++--- extra/fjsc/fjsc.factor | 2 +- extra/infix/tokenizer/tokenizer.factor | 2 +- extra/peg/javascript/tokenizer/tokenizer.factor | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/basis/http/parsers/parsers.factor b/basis/http/parsers/parsers.factor index 475074d378..99c346f2de 100644 --- a/basis/http/parsers/parsers.factor +++ b/basis/http/parsers/parsers.factor @@ -44,7 +44,7 @@ IN: http.parsers "1" token , "." token , { "0" "1" } one-of , - ] seq* [ concat >string ] action ; + ] seq* [ "" concat-as ] action ; PEG: parse-request-line ( string -- triple ) #! Triple is { method url version } diff --git a/basis/memoize/memoize.factor b/basis/memoize/memoize.factor index 71f9fe1942..43d447d7c0 100644 --- a/basis/memoize/memoize.factor +++ b/basis/memoize/memoize.factor @@ -10,7 +10,7 @@ IN: memoize ! We can't use n*quot, narray and firstn from generalizations because ! they're macros, and macros use memoize! : (n*quot) ( n quot -- quotquot ) - concat >quotation ; + [ ] concat-as ; : [nsequence] ( length exemplar -- quot ) [ [ [ 1 - ] keep ] dip '[ _ _ _ new-sequence ] ] diff --git a/basis/peg/ebnf/ebnf-tests.factor b/basis/peg/ebnf/ebnf-tests.factor index f267f69255..acdc55a52e 100644 --- a/basis/peg/ebnf/ebnf-tests.factor +++ b/basis/peg/ebnf/ebnf-tests.factor @@ -519,7 +519,7 @@ SingleLineComment = "//" (!("\n") .)* "\n" => [[ ignore ]] MultiLineComment = "/*" (!("*/") .)* "*/" => [[ ignore ]] Space = " " | "\t" | "\r" | "\n" | SingleLineComment | MultiLineComment Spaces = Space* => [[ ignore ]] -Number = Digits:ws '.' Digits:fs => [[ ws "." fs 3array concat >string string>number ast-number boa ]] +Number = Digits:ws '.' Digits:fs => [[ ws "." fs 3array "" concat-as string>number ast-number boa ]] | Digits => [[ >string string>number ast-number boa ]] Special = "(" | ")" | "{" | "}" | "[" | "]" | "," | ";" | "?" | ":" | "!==" | "~=" | "===" | "==" | "=" | ">=" diff --git a/basis/peg/ebnf/ebnf.factor b/basis/peg/ebnf/ebnf.factor index 7f4f52e2e4..2c0e97f1d1 100644 --- a/basis/peg/ebnf/ebnf.factor +++ b/basis/peg/ebnf/ebnf.factor @@ -283,7 +283,7 @@ DEFER: 'choice' "]]" token ensure-not , "]?" token ensure-not , [ drop t ] satisfy , - ] seq* repeat0 [ concat >string ] action ; + ] seq* repeat0 [ "" concat-as ] action ; : 'ensure-not' ( -- parser ) #! Parses the '!' syntax to ensure that diff --git a/basis/unicode/data/data.factor b/basis/unicode/data/data.factor index 345b03fa5c..cb1b0ce032 100644 --- a/basis/unicode/data/data.factor +++ b/basis/unicode/data/data.factor @@ -89,7 +89,7 @@ PRIVATE> [ [ hex> ] dip ] assoc-map ; : process-data ( index data -- hash ) - (process-data) [ hex> ] assoc-map [ nip ] assoc-filter >hashtable ; + (process-data) [ hex> ] assoc-map [ nip ] H{ } assoc-filter-as ; : (chain-decomposed) ( hash value -- newvalue ) [ diff --git a/basis/xml/elements/elements.factor b/basis/xml/elements/elements.factor index 8d7f963625..3ef1e669f1 100644 --- a/basis/xml/elements/elements.factor +++ b/basis/xml/elements/elements.factor @@ -35,7 +35,7 @@ IN: xml.elements : assure-no-duplicates ( attrs-alist -- attrs-alist ) H{ } clone 2dup '[ swap _ push-at ] assoc-each - [ nip length 2 >= ] assoc-filter >alist + [ nip length 2 >= ] { } assoc-filter-as [ first first2 duplicate-attr ] unless-empty ; : middle-tag ( -- attrs-alist ) diff --git a/basis/xml/tokenize/tokenize.factor b/basis/xml/tokenize/tokenize.factor index f1f8bc83fb..ee7ffdf639 100644 --- a/basis/xml/tokenize/tokenize.factor +++ b/basis/xml/tokenize/tokenize.factor @@ -85,10 +85,11 @@ HINTS: next* { spot } ; #! Advance code past any whitespace, including newlines [ blank? not ] skip-until ; +: next-matching ( pos ch str -- pos' ) + [ over ] dip nth eq? [ 1 + ] [ drop 0 ] if ; + : string-matcher ( str -- quot: ( pos char -- pos ? ) ) - dup length 1 - '[ - over _ nth eq? [ 1 + ] [ drop 0 ] if dup _ > - ] ; inline + dup length 1 - '[ _ next-matching dup _ > ] ; inline : take-string ( match -- string ) [ 0 swap string-matcher take-until nip ] keep @@ -143,8 +144,7 @@ HINTS: next* { spot } ; 1024 [ spot get (parse-char) ] keep >string ; inline : assure-no-]]> ( pos char -- pos' ) - over "]]>" nth eq? [ 1 + ] [ drop 0 ] if - dup 2 > [ text-w/]]> ] when ; + "]]>" next-matching dup 2 > [ text-w/]]> ] when ; :: parse-text ( -- string ) 0 :> pos! diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index 0426a8bd9c..78fa81d0bc 100644 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -740,9 +740,11 @@ PRIVATE> [ exchange-unsafe ] 3tri ; +: midpoint@ ( seq -- n ) length 2/ ; inline + : reverse! ( seq -- seq ) [ - [ length 2/ iota ] [ length ] [ ] tri + [ midpoint@ iota ] [ length ] [ ] tri [ [ over - 1 - ] dip exchange-unsafe ] 2curry each ] keep ; @@ -815,8 +817,6 @@ PRIVATE> : insert-nth ( elt n seq -- seq' ) swap cut-slice [ swap suffix ] dip append ; -: midpoint@ ( seq -- n ) length 2/ ; inline - : halves ( seq -- first-slice second-slice ) dup midpoint@ cut-slice ; diff --git a/extra/fjsc/fjsc.factor b/extra/fjsc/fjsc.factor index 1a2c486ddd..83de1c5438 100644 --- a/extra/fjsc/fjsc.factor +++ b/extra/fjsc/fjsc.factor @@ -46,7 +46,7 @@ TUPLE: ast-hashtable elements ; 'identifier-middle' , 'identifier-ends' , ] seq* [ - concat >string f ast-identifier boa + "" concat-as f ast-identifier boa ] action ; diff --git a/extra/infix/tokenizer/tokenizer.factor b/extra/infix/tokenizer/tokenizer.factor index 7bf1bddcd4..90604aa136 100644 --- a/extra/infix/tokenizer/tokenizer.factor +++ b/extra/infix/tokenizer/tokenizer.factor @@ -8,7 +8,7 @@ EBNF: tokenize-infix Letter = [a-zA-Z] Digit = [0-9] Digits = Digit+ -Number = Digits '.' Digits => [[ concat >string string>number ast-number boa ]] +Number = Digits '.' Digits => [[ "" concat-as string>number ast-number boa ]] | Digits => [[ >string string>number ast-number boa ]] Space = " " | "\n" | "\r" | "\t" Spaces = Space* => [[ ignore ]] diff --git a/extra/peg/javascript/tokenizer/tokenizer.factor b/extra/peg/javascript/tokenizer/tokenizer.factor index 30a3b5e7a5..34beedcaea 100644 --- a/extra/peg/javascript/tokenizer/tokenizer.factor +++ b/extra/peg/javascript/tokenizer/tokenizer.factor @@ -45,7 +45,7 @@ Keyword = ("break" | "while" | "with") !(NameRest) Name = !(Keyword) iName => [[ ast-name boa ]] -Number = Digits:ws '.' Digits:fs => [[ ws "." fs 3array concat >string string>number ast-number boa ]] +Number = Digits:ws '.' Digits:fs => [[ ws "." fs 3array "" concat-as string>number ast-number boa ]] | Digits => [[ >string string>number ast-number boa ]] EscapeChar = "\\n" => [[ 10 ]]