add 1token and docs
parent
d99c57f696
commit
ef437c96da
|
@ -1,9 +1,19 @@
|
||||||
! Copyright (C) 2007 Chris Double.
|
! Copyright (C) 2008 Chris Double, Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: help.markup help.syntax peg peg.parsers.private
|
USING: help.markup help.syntax peg peg.parsers.private
|
||||||
unicode.categories ;
|
unicode.categories ;
|
||||||
IN: peg.parsers
|
IN: peg.parsers
|
||||||
|
|
||||||
|
HELP: 1token
|
||||||
|
{ $values
|
||||||
|
{ "ch" "a character" }
|
||||||
|
{ "parser" "a parser" }
|
||||||
|
} { $description
|
||||||
|
"Calls 1string on a character and returns a parser that matches that character."
|
||||||
|
} { $examples
|
||||||
|
{ $example "USING: peg peg.parsers prettyprint ;" "\"a\" CHAR: a 1token parse parse-result-ast ." "\"a\"" }
|
||||||
|
} { $see-also 'string' } ;
|
||||||
|
|
||||||
HELP: (list-of)
|
HELP: (list-of)
|
||||||
{ $values
|
{ $values
|
||||||
{ "items" "a sequence" }
|
{ "items" "a sequence" }
|
||||||
|
|
|
@ -21,6 +21,8 @@ M: just-parser compile ( parser -- quot )
|
||||||
MEMO: just ( parser -- parser )
|
MEMO: just ( parser -- parser )
|
||||||
just-parser construct-boa init-parser ;
|
just-parser construct-boa init-parser ;
|
||||||
|
|
||||||
|
MEMO: 1token ( ch -- parser ) 1string token ;
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
MEMO: (list-of) ( items separator repeat1? -- parser )
|
MEMO: (list-of) ( items separator repeat1? -- parser )
|
||||||
>r over 2seq r> [ repeat1 ] [ repeat0 ] if [ concat ] action 2seq
|
>r over 2seq r> [ repeat1 ] [ repeat0 ] if [ concat ] action 2seq
|
||||||
|
|
Loading…
Reference in New Issue