]> gitweb.factorcode.org Git - factor.git/commitdiff
Cleanup more lint warnings.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 16 Oct 2011 20:01:58 +0000 (13:01 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 16 Oct 2011 20:01:58 +0000 (13:01 -0700)
basis/http/parsers/parsers.factor
basis/memoize/memoize.factor
basis/peg/ebnf/ebnf-tests.factor
basis/peg/ebnf/ebnf.factor
basis/unicode/data/data.factor
basis/xml/elements/elements.factor
basis/xml/tokenize/tokenize.factor
core/sequences/sequences.factor
extra/fjsc/fjsc.factor
extra/infix/tokenizer/tokenizer.factor
extra/peg/javascript/tokenizer/tokenizer.factor

index 475074d378fe66c0ec5628b5d22491074e319b6f..99c346f2dec173b70a8b5d1e7feb7482ff8a24a9 100644 (file)
@@ -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 }
index 71f9fe194255cc94db95e118b7ee5f94841640a5..43d447d7c037f88acd41c10ae166f18b870e5b29 100644 (file)
@@ -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 )
-    <repetition> concat >quotation ;
+    <repetition> [ ] concat-as ;
 
 : [nsequence] ( length exemplar -- quot )
     [ [ [ 1 - ] keep ] dip '[ _ _ _ new-sequence ] ]
index f267f69255a6a4219858981a690b26e01e55c6c0..acdc55a52ee5e44b343a2ef23f32016b6e06b573 100644 (file)
@@ -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            =   "("   | ")"   | "{"   | "}"   | "["   | "]"   | ","   | ";"
                      | "?"   | ":"   | "!==" | "~="  | "===" | "=="  | "="   | ">="
index 7f4f52e2e4e28d8a2148f8a580c66e219ae5e7e4..2c0e97f1d122ed1e1860edb302fee6b77983e89d 100644 (file)
@@ -283,7 +283,7 @@ DEFER: 'choice'
     "]]" token ensure-not ,\r
     "]?" token ensure-not ,\r
     [ drop t ] satisfy ,\r
-  ] seq* repeat0 [ concat >string ] action ;\r
+  ] seq* repeat0 [ "" concat-as ] action ;\r
 \r
 : 'ensure-not' ( -- parser )\r
   #! Parses the '!' syntax to ensure that \r
index 345b03fa5c691362ebe42ba78fe1e90f78441139..cb1b0ce032e33140016f43010f38b038418fecd9 100644 (file)
@@ -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 )
     [
index 8d7f963625bf7008bc8824aae50cf6d620b44f97..3ef1e669f1a5463e076ed45b1a26613fe2a3a504 100644 (file)
@@ -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 )
index f1f8bc83fbc4d29472988bd66cc715c1b902e3d0..ee7ffdf63963abe922ee640d9377e42a16e05daa 100644 (file)
@@ -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 <sbuf> [ 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!
index 0426a8bd9cdf5dfe29025b8617ed92ed5370a816..78fa81d0bcb970c89f256b81c64ea1b4c7b72dee 100644 (file)
@@ -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 ;
 
index 1a2c486dddcfeeca0de3a51cc05413efbcbd600c..83de1c543818b1823392f7bb1b492d9ccb30c421 100644 (file)
@@ -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 ;
 
 
index 7bf1bddcd4cf80b517c6041bb683d6719e79c51c..90604aa13638425c6d4354f6e23943516e96c16a 100644 (file)
@@ -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 ]]
index 30a3b5e7a5006336fd27e6ef3c40af13950bd4c2..34beedcaea57d48ae8f37eed83892db361307df9 100644 (file)
@@ -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 ]]