add 1token and docs

db4
Doug Coleman 2008-03-12 10:43:18 -05:00
parent d99c57f696
commit ef437c96da
2 changed files with 13 additions and 1 deletions

View File

@ -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.
USING: help.markup help.syntax peg peg.parsers.private
unicode.categories ;
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)
{ $values
{ "items" "a sequence" }

View File

@ -21,6 +21,8 @@ M: just-parser compile ( parser -- quot )
MEMO: just ( parser -- parser )
just-parser construct-boa init-parser ;
MEMO: 1token ( ch -- parser ) 1string token ;
<PRIVATE
MEMO: (list-of) ( items separator repeat1? -- parser )
>r over 2seq r> [ repeat1 ] [ repeat0 ] if [ concat ] action 2seq