Cleanup more lint warnings.
parent
ea4240cea0
commit
c8732657b7
|
@ -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 }
|
||||
|
|
|
@ -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 ] ]
|
||||
|
|
|
@ -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 = "(" | ")" | "{" | "}" | "[" | "]" | "," | ";"
|
||||
| "?" | ":" | "!==" | "~=" | "===" | "==" | "=" | ">="
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
[
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
||||
|
|
|
@ -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 ]]
|
||||
|
|
|
@ -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 ]]
|
||||
|
|
Loading…
Reference in New Issue