From 10d1b54e6077bfd595e853bb3a209bc70018c485 Mon Sep 17 00:00:00 2001 From: Giftpflanze Date: Tue, 6 Dec 2022 20:21:39 +0000 Subject: [PATCH] peg: Add documentation for PEG: --- basis/peg/peg-docs.factor | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/basis/peg/peg-docs.factor b/basis/peg/peg-docs.factor index d21240f245..5a2700bc9f 100644 --- a/basis/peg/peg-docs.factor +++ b/basis/peg/peg-docs.factor @@ -178,3 +178,13 @@ HELP: box "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 " "that calls the quotation at runtime." } ; + +HELP: PEG: +{ $syntax "PEG: word ( stack -- effect ) definition... ;" } +{ $description "Defines a word that when called will parse a string using the syntax" + "defined by the parser created by the definition. The definition should have stack" + "effect " { $snippet "( -- parser )" } " and the created word " + { $snippet "( string -- ast )" } ". In contrast to calling the parser resulting from" + "the definition with " { $link parse } ", the parser is pre-compiled and not compiled" + "for each invocation of " { $link parse } ". If the parsing fails, the word throws an" + "exception." } ; -- 2.34.1