Cleanup more lint warnings.

db4
John Benediktsson 2011-10-16 13:01:58 -07:00
parent ea4240cea0
commit c8732657b7
11 changed files with 17 additions and 17 deletions

View File

@ -44,7 +44,7 @@ IN: http.parsers
"1" token , "1" token ,
"." token , "." token ,
{ "0" "1" } one-of , { "0" "1" } one-of ,
] seq* [ concat >string ] action ; ] seq* [ "" concat-as ] action ;
PEG: parse-request-line ( string -- triple ) PEG: parse-request-line ( string -- triple )
#! Triple is { method url version } #! Triple is { method url version }

View File

@ -10,7 +10,7 @@ IN: memoize
! We can't use n*quot, narray and firstn from generalizations because ! We can't use n*quot, narray and firstn from generalizations because
! they're macros, and macros use memoize! ! they're macros, and macros use memoize!
: (n*quot) ( n quot -- quotquot ) : (n*quot) ( n quot -- quotquot )
<repetition> concat >quotation ; <repetition> [ ] concat-as ;
: [nsequence] ( length exemplar -- quot ) : [nsequence] ( length exemplar -- quot )
[ [ [ 1 - ] keep ] dip '[ _ _ _ new-sequence ] ] [ [ [ 1 - ] keep ] dip '[ _ _ _ new-sequence ] ]

View File

@ -519,7 +519,7 @@ SingleLineComment = "//" (!("\n") .)* "\n" => [[ ignore ]]
MultiLineComment = "/*" (!("*/") .)* "*/" => [[ ignore ]] MultiLineComment = "/*" (!("*/") .)* "*/" => [[ ignore ]]
Space = " " | "\t" | "\r" | "\n" | SingleLineComment | MultiLineComment Space = " " | "\t" | "\r" | "\n" | SingleLineComment | MultiLineComment
Spaces = Space* => [[ ignore ]] 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 ]] | Digits => [[ >string string>number ast-number boa ]]
Special = "(" | ")" | "{" | "}" | "[" | "]" | "," | ";" Special = "(" | ")" | "{" | "}" | "[" | "]" | "," | ";"
| "?" | ":" | "!==" | "~=" | "===" | "==" | "=" | ">=" | "?" | ":" | "!==" | "~=" | "===" | "==" | "=" | ">="

View File

@ -283,7 +283,7 @@ DEFER: 'choice'
"]]" token ensure-not , "]]" token ensure-not ,
"]?" token ensure-not , "]?" token ensure-not ,
[ drop t ] satisfy , [ drop t ] satisfy ,
] seq* repeat0 [ concat >string ] action ; ] seq* repeat0 [ "" concat-as ] action ;
: 'ensure-not' ( -- parser ) : 'ensure-not' ( -- parser )
#! Parses the '!' syntax to ensure that #! Parses the '!' syntax to ensure that

View File

@ -89,7 +89,7 @@ PRIVATE>
[ [ hex> ] dip ] assoc-map ; [ [ hex> ] dip ] assoc-map ;
: process-data ( index data -- hash ) : 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 ) : (chain-decomposed) ( hash value -- newvalue )
[ [

View File

@ -35,7 +35,7 @@ IN: xml.elements
: assure-no-duplicates ( attrs-alist -- attrs-alist ) : assure-no-duplicates ( attrs-alist -- attrs-alist )
H{ } clone 2dup '[ swap _ push-at ] assoc-each 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 ; [ first first2 duplicate-attr ] unless-empty ;
: middle-tag ( -- attrs-alist ) : middle-tag ( -- attrs-alist )

View File

@ -85,10 +85,11 @@ HINTS: next* { spot } ;
#! Advance code past any whitespace, including newlines #! Advance code past any whitespace, including newlines
[ blank? not ] skip-until ; [ 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 ? ) ) : string-matcher ( str -- quot: ( pos char -- pos ? ) )
dup length 1 - '[ dup length 1 - '[ _ next-matching dup _ > ] ; inline
over _ nth eq? [ 1 + ] [ drop 0 ] if dup _ >
] ; inline
: take-string ( match -- string ) : take-string ( match -- string )
[ 0 swap string-matcher take-until nip ] keep [ 0 swap string-matcher take-until nip ] keep
@ -143,8 +144,7 @@ HINTS: next* { spot } ;
1024 <sbuf> [ spot get (parse-char) ] keep >string ; inline 1024 <sbuf> [ spot get (parse-char) ] keep >string ; inline
: assure-no-]]> ( pos char -- pos' ) : assure-no-]]> ( pos char -- pos' )
over "]]>" nth eq? [ 1 + ] [ drop 0 ] if "]]>" next-matching dup 2 > [ text-w/]]> ] when ;
dup 2 > [ text-w/]]> ] when ;
:: parse-text ( -- string ) :: parse-text ( -- string )
0 :> pos! 0 :> pos!

View File

@ -740,9 +740,11 @@ PRIVATE>
[ exchange-unsafe ] [ exchange-unsafe ]
3tri ; 3tri ;
: midpoint@ ( seq -- n ) length 2/ ; inline
: reverse! ( seq -- seq ) : reverse! ( seq -- seq )
[ [
[ length 2/ iota ] [ length ] [ ] tri [ midpoint@ iota ] [ length ] [ ] tri
[ [ over - 1 - ] dip exchange-unsafe ] 2curry each [ [ over - 1 - ] dip exchange-unsafe ] 2curry each
] keep ; ] keep ;
@ -815,8 +817,6 @@ PRIVATE>
: insert-nth ( elt n seq -- seq' ) : insert-nth ( elt n seq -- seq' )
swap cut-slice [ swap suffix ] dip append ; swap cut-slice [ swap suffix ] dip append ;
: midpoint@ ( seq -- n ) length 2/ ; inline
: halves ( seq -- first-slice second-slice ) : halves ( seq -- first-slice second-slice )
dup midpoint@ cut-slice ; dup midpoint@ cut-slice ;

View File

@ -46,7 +46,7 @@ TUPLE: ast-hashtable elements ;
'identifier-middle' , 'identifier-middle' ,
'identifier-ends' , 'identifier-ends' ,
] seq* [ ] seq* [
concat >string f ast-identifier boa "" concat-as f ast-identifier boa
] action ; ] action ;

View File

@ -8,7 +8,7 @@ EBNF: tokenize-infix
Letter = [a-zA-Z] Letter = [a-zA-Z]
Digit = [0-9] Digit = [0-9]
Digits = Digit+ 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 ]] | Digits => [[ >string string>number ast-number boa ]]
Space = " " | "\n" | "\r" | "\t" Space = " " | "\n" | "\r" | "\t"
Spaces = Space* => [[ ignore ]] Spaces = Space* => [[ ignore ]]

View File

@ -45,7 +45,7 @@ Keyword = ("break"
| "while" | "while"
| "with") !(NameRest) | "with") !(NameRest)
Name = !(Keyword) iName => [[ ast-name boa ]] 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 ]] | Digits => [[ >string string>number ast-number boa ]]
EscapeChar = "\\n" => [[ 10 ]] EscapeChar = "\\n" => [[ 10 ]]