fix .factor-rc error reporting
parent
8b1ef9eb88
commit
5ccc94464f
|
@ -6,6 +6,9 @@ data could fill up the buffer and cause a denial-of-service attack.
|
|||
|
||||
The alien interface now supports "float" and "double" types.
|
||||
|
||||
Moved the 'skip' combinator from the 'parser' vocabulary to 'sequences',
|
||||
since its generic now. Implemented 'index*' in terms of 'skip'.
|
||||
|
||||
Factor 0.74:
|
||||
------------
|
||||
|
||||
|
|
|
@ -8,16 +8,12 @@
|
|||
- 2map slow with lists
|
||||
- nappend: instead of using push, enlarge the sequence with set-length
|
||||
then add set the elements with set-nth
|
||||
- ensure-capacity: don't be generic
|
||||
- vector's ensure-capacity will crash if not given fixnums!
|
||||
- generic each some? all? member? memq? all=? index? subseq? map
|
||||
- index and index* are very slow with lists
|
||||
- unsafe-sbuf>string
|
||||
- generic subseq
|
||||
- GENERIC: map
|
||||
- list impl same as now
|
||||
- generic parser::scan
|
||||
- .factor-rc loading errors are not reported properly
|
||||
- code walker & exceptions
|
||||
- string sub-primitives
|
||||
- generational gc
|
||||
|
|
|
@ -10,7 +10,6 @@ vectors ;
|
|||
! defined tuples that respond to the sequence protocol.
|
||||
UNION: sequence array string sbuf vector ;
|
||||
|
||||
M: object ensure-capacity 2drop ;
|
||||
M: object thaw clone ;
|
||||
M: object freeze drop ;
|
||||
|
||||
|
@ -93,14 +92,23 @@ M: sequence (tree-each) [ (tree-each) ] seq-each-with ;
|
|||
: seq-2map ( seq1 seq2 quot -- seq | quot: elt1 elt2 -- elt3 )
|
||||
swap [ swap 2nmap ] immutable ; inline
|
||||
|
||||
: skip ( i seq quot -- n | quot: elt -- ? )
|
||||
#! Find the next element starting at i that satisfies the
|
||||
#! quotation.
|
||||
>r 2dup length < [
|
||||
2dup nth r> dup >r call [
|
||||
r> 2drop
|
||||
] [
|
||||
>r 1 + r> r> skip
|
||||
] ifte
|
||||
] [
|
||||
r> drop nip length
|
||||
] ifte ; inline
|
||||
|
||||
! Operations
|
||||
: index* ( obj i seq -- n )
|
||||
#! The index of the object in the sequence, starting from i.
|
||||
2dup length >= [
|
||||
3drop -1
|
||||
] [
|
||||
3dup nth = [ drop nip ] [ >r 1 + r> index* ] ifte
|
||||
] ifte ;
|
||||
[ dupd = ] skip nip ;
|
||||
|
||||
: index ( obj seq -- n )
|
||||
#! The index of the object in the sequence.
|
||||
|
@ -112,7 +120,6 @@ M: sequence (tree-each) [ (tree-each) ] seq-each-with ;
|
|||
|
||||
: nappend ( s1 s2 -- )
|
||||
#! Destructively append s2 to s1.
|
||||
! over length over ensure-capacity
|
||||
[ over push ] seq-each drop ;
|
||||
|
||||
: append ( s1 s2 -- s1+s2 )
|
||||
|
|
|
@ -14,7 +14,6 @@ USING: generic kernel math strings vectors ;
|
|||
GENERIC: empty? ( sequence -- ? )
|
||||
GENERIC: length ( sequence -- n )
|
||||
GENERIC: set-length ( n sequence -- )
|
||||
GENERIC: ensure-capacity ( n sequence -- )
|
||||
GENERIC: nth ( n sequence -- obj )
|
||||
GENERIC: set-nth ( value n sequence -- obj )
|
||||
GENERIC: thaw ( seq -- mutable-seq )
|
||||
|
|
|
@ -36,7 +36,7 @@ IN: kernel-internals
|
|||
#! to exactly len.
|
||||
[ vector-array grow-array ] keep set-vector-array ;
|
||||
|
||||
M: vector ensure-capacity ( n vec -- )
|
||||
: ensure-capacity ( n vec -- )
|
||||
#! If n is beyond the vector's length, increase the length,
|
||||
#! growing the array if necessary, with an optimistic
|
||||
#! doubling of its size.
|
||||
|
|
|
@ -9,16 +9,15 @@ USING: kernel lists namespaces sequences streams strings ;
|
|||
|
||||
: (parse-stream) ( name stream -- quot )
|
||||
#! Uses the current namespace for temporary variables.
|
||||
>r file set f ( initial parse tree ) r>
|
||||
[ (parse) ] read-lines reverse
|
||||
file off
|
||||
line-number off ;
|
||||
[
|
||||
>r file set f ( initial parse tree ) r>
|
||||
[ (parse) ] read-lines reverse
|
||||
file off
|
||||
line-number off
|
||||
] with-parser ;
|
||||
|
||||
: parse-stream ( name stream -- quot )
|
||||
[
|
||||
file-vocabs
|
||||
[ (parse-stream) ] with-parser
|
||||
] with-scope ;
|
||||
[ file-vocabs [ (parse-stream) ] with-parser ] with-scope ;
|
||||
|
||||
: parse-file ( file -- quot )
|
||||
dup <file-reader> parse-stream ;
|
||||
|
|
Loading…
Reference in New Issue