catb0t's PR: add a Prolog-like %! ... multiline comment #6

flac
kusumotonorio 2020-03-02 20:21:17 +09:00 committed by Steve Ayerhart
parent 9a94c2d54d
commit ca0859ff18
No known key found for this signature in database
GPG Key ID: 5BFD39C5359E967D
2 changed files with 19 additions and 5 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2019-2020 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays help.markup help.syntax kernel quotations sequences
prettyprint assocs math lists urls factlog.private ;
prettyprint assocs math make lists urls factlog.private ;
IN: factlog
HELP: !!
@ -140,6 +140,18 @@ HELP: LOGIC-VARS:
}
} ;
HELP: %!
{ $description "A multiline comment. Despite being a Prolog single-line comment, " { $link % } " is already well-known in Factor, so this variant is given instead." }
{ $syntax "%! comment !%" }
{ $examples
{ $example
"USE: factlog"
"%! I think that I shall never see"
" A proof lovely as a factlog. !%"
""
}
} ;
HELP: \+
{ $var-description "Express negation. \\+ acts on the goal immediately following it.\n" }
{ $examples
@ -722,7 +734,7 @@ SYMBOLS: Tom Jerry Nibbles ;"
{ cato Y } ;; { mouseo Y }
} rule"
} $nl
{ $link ;; } " is used to represent " { $strong "disjunction" } ". The code below it has the same meaning as the code below it." $nl
{ $link ;; } " is used to represent " { $strong "disjunction" } ". The following two forms are equivalent:" $nl
{ $code "Gh { Gb1 Gb2 Gb3 ;; Gb4 Gb5 ;; Gb6 } rule" }
$nl
{ $code

View File

@ -2,8 +2,8 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs classes classes.tuple combinators
combinators.short-circuit compiler.units continuations
formatting fry io kernel lexer lists locals make math namespaces
parser prettyprint prettyprint.backend prettyprint.config
formatting fry io kernel lexer lists locals make math multiline
namespaces parser prettyprint prettyprint.backend prettyprint.config
prettyprint.custom prettyprint.sections quotations sequences
sequences.deep sets splitting strings words words.symbol
vectors ;
@ -59,6 +59,9 @@ SYNTAX: LOGIC-PREDS: ";"
] each-token ;
>>
SYNTAX: %!
"!%" parse-multiline-string drop ;
<PRIVATE
TUPLE: logic-goal pred args ;
@ -573,4 +576,3 @@ LOGIC-PREDS:
{ listo L{ } } fact
{ listo L{ __ . __ } } fact