peg: remove trailing whitespace from docs.

db4
John Benediktsson 2015-04-19 20:47:05 -07:00
parent 4e219f04c7
commit 338e99e434
1 changed files with 57 additions and 57 deletions

View File

@ -4,32 +4,32 @@ USING: help.markup help.syntax kernel quotations strings words ;
IN: peg IN: peg
HELP: parse HELP: parse
{ $values { $values
{ "input" string } { "input" string }
{ "parser" parser } { "parser" parser }
{ "ast" object } { "ast" object }
} }
{ $description { $description
"Given the input string, parse it using the given parser. The result is the abstract " "Given the input string, parse it using the given parser. The result is the abstract "
"syntax tree returned by the parser." } "syntax tree returned by the parser." }
{ $see-also compile } ; { $see-also compile } ;
HELP: compile HELP: compile
{ $values { $values
{ "parser" parser } { "parser" parser }
{ "word" word } { "word" word }
} }
{ $description { $description
"Compile the parser to a word. The word will have stack effect ( -- ast )." "Compile the parser to a word. The word will have stack effect ( -- ast )."
} }
{ $see-also parse } ; { $see-also parse } ;
HELP: token HELP: token
{ $values { $values
{ "string" string } { "string" string }
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that matches the given string." } ; "Returns a parser that matches the given string." } ;
HELP: satisfy HELP: satisfy
@ -37,7 +37,7 @@ HELP: satisfy
{ "quot" quotation } { "quot" quotation }
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that calls the quotation on the first character of the input string, " "Returns a parser that calls the quotation on the first character of the input string, "
"succeeding if that quotation returns true. The AST is the character from the string." } ; "succeeding if that quotation returns true. The AST is the character from the string." } ;
@ -56,83 +56,83 @@ HELP: seq
{ "seq" "a sequence of parsers" } { "seq" "a sequence of parsers" }
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that calls all parsers in the given sequence, in order. The parser succeeds if " "Returns a parser that calls all parsers in the given sequence, in order. The parser succeeds if "
"all the parsers succeed, otherwise it fails. The AST produced is a sequence of the AST produced by " "all the parsers succeed, otherwise it fails. The AST produced is a sequence of the AST produced by "
"the individual parsers." } ; "the individual parsers." } ;
HELP: choice HELP: choice
{ $values { $values
{ "seq" "a sequence of parsers" } { "seq" "a sequence of parsers" }
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that will try all the parsers in the sequence, in order, until one succeeds. " "Returns a parser that will try all the parsers in the sequence, in order, until one succeeds. "
"The resulting AST is that produced by the successful parser." } ; "The resulting AST is that produced by the successful parser." } ;
HELP: repeat0 HELP: repeat0
{ $values { $values
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that parses 0 or more instances of the 'p1' parser. The AST produced is " "Returns a parser that parses 0 or more instances of the 'p1' parser. The AST produced is "
"an array of the AST produced by the 'p1' parser. An empty array indicates 0 instances were " "an array of the AST produced by the 'p1' parser. An empty array indicates 0 instances were "
"parsed." } ; "parsed." } ;
HELP: repeat1 HELP: repeat1
{ $values { $values
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that parses 1 or more instances of the 'p1' parser. The AST produced is " "Returns a parser that parses 1 or more instances of the 'p1' parser. The AST produced is "
"an array of the AST produced by the 'p1' parser." } ; "an array of the AST produced by the 'p1' parser." } ;
HELP: optional HELP: optional
{ $values { $values
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that parses 0 or 1 instances of the 'p1' parser. The AST produced is " "Returns a parser that parses 0 or 1 instances of the 'p1' parser. The AST produced is "
"'f' if 0 instances are parsed the AST produced is 'f', otherwise it is the AST produced by 'p1'." } ; "'f' if 0 instances are parsed the AST produced is 'f', otherwise it is the AST produced by 'p1'." } ;
HELP: semantic HELP: semantic
{ $values { $values
{ "parser" parser } { "parser" parser }
{ "quot" { $quotation ( object -- ? ) } } { "quot" { $quotation ( object -- ? ) } }
} }
{ $description { $description
"Returns a parser that succeeds if the 'p1' parser succeeds and the quotation called with " "Returns a parser that succeeds if the 'p1' parser succeeds and the quotation called with "
"the AST produced by 'p1' on the stack returns true." } "the AST produced by 'p1' on the stack returns true." }
{ $examples { $examples
{ $example "USING: kernel math peg prettyprint ;" "\"C\" [ drop t ] satisfy [ 66 > ] semantic parse ." "67" } { $example "USING: kernel math peg prettyprint ;" "\"C\" [ drop t ] satisfy [ 66 > ] semantic parse ." "67" }
} ; } ;
HELP: ensure HELP: ensure
{ $values { $values
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that succeeds if the 'p1' parser succeeds but does not add anything to the " "Returns a parser that succeeds if the 'p1' parser succeeds but does not add anything to the "
"AST and does not move the location in the input string. This can be used for lookahead and " "AST and does not move the location in the input string. This can be used for lookahead and "
"disambiguation, along with the " { $link ensure-not } " word." } "disambiguation, along with the " { $link ensure-not } " word." }
{ $examples { $code "\"0\" token ensure octal-parser" } } ; { $examples { $code "\"0\" token ensure octal-parser" } } ;
HELP: ensure-not HELP: ensure-not
{ $values { $values
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that succeeds if the 'p1' parser fails but does not add anything to the " "Returns a parser that succeeds if the 'p1' parser fails but does not add anything to the "
"AST and does not move the location in the input string. This can be used for lookahead and " "AST and does not move the location in the input string. This can be used for lookahead and "
"disambiguation, along with the " { $link ensure } " word." } "disambiguation, along with the " { $link ensure } " word." }
{ $code "\"+\" token \"=\" token ensure-not \"+=\" token 3array seq" } ; { $code "\"+\" token \"=\" token ensure-not \"+=\" token 3array seq" } ;
HELP: action HELP: action
{ $values { $values
{ "parser" parser } { "parser" parser }
{ "quot" { $quotation ( ast -- ast ) } } { "quot" { $quotation ( ast -- ast ) } }
} }
{ $description { $description
"Returns a parser that calls the 'p1' parser and applies the quotation to the AST resulting " "Returns a parser that calls the 'p1' parser and applies the quotation to the AST resulting "
"from that parse. The result of the quotation is then used as the final AST. This can be used " "from that parse. The result of the quotation is then used as the final AST. This can be used "
"for manipulating the parse tree to produce a AST better suited for the task at hand rather than " "for manipulating the parse tree to produce a AST better suited for the task at hand rather than "
@ -140,41 +140,41 @@ HELP: action
{ $code "CHAR: 0 CHAR: 9 range [ to-digit ] action" } ; { $code "CHAR: 0 CHAR: 9 range [ to-digit ] action" } ;
HELP: sp HELP: sp
{ $values { $values
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that calls the original parser 'p1' after stripping any whitespace " "Returns a parser that calls the original parser 'p1' after stripping any whitespace "
" from the left of the input string." } ; " from the left of the input string." } ;
HELP: hide HELP: hide
{ $values { $values
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Returns a parser that succeeds if the original parser succeeds, but does not " "Returns a parser that succeeds if the original parser succeeds, but does not "
"put any result in the AST. Useful for ignoring 'syntax' in the AST." } "put any result in the AST. Useful for ignoring 'syntax' in the AST." }
{ $code "\"[\" token hide number \"]\" token hide 3array seq" } ; { $code "\"[\" token hide number \"]\" token hide 3array seq" } ;
HELP: delay HELP: delay
{ $values { $values
{ "quot" quotation } { "quot" quotation }
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Delays the construction of a parser until it is actually required to parse. This " "Delays the construction of a parser until it is actually required to parse. This "
"allows for calling a parser that results in a recursive call to itself. The quotation " "allows for calling a parser that results in a recursive call to itself. The quotation "
"should return the constructed parser and is called the first time the parser is run." "should return the constructed parser and is called the first time the parser is run. "
"The compiled result is memoized for future runs. See " { $link box } " for a word " "The compiled result is memoized for future runs. See " { $link box } " for a word "
"that calls the quotation at compile time." } ; "that calls the quotation at compile time." } ;
HELP: box HELP: box
{ $values { $values
{ "quot" quotation } { "quot" quotation }
{ "parser" parser } { "parser" parser }
} }
{ $description { $description
"Delays the construction of a parser until the parser is compiled. The quotation " "Delays the construction of a parser until the parser is compiled. The quotation "
"should return the constructed parser and is called when the parser is compiled." "should return the constructed parser and is called when the parser is compiled. "
"The compiled result is memoized for future runs. See " { $link delay } " for a word " "The compiled result is memoized for future runs. See " { $link delay } " for a word "
"that calls the quotation at runtime." } ; "that calls the quotation at runtime." } ;