From b4eebf65a9bb6177dc1c77335ca1ca83c6cdfe0e Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 20 Jun 2016 15:42:09 -0700 Subject: [PATCH] syntax: add [[ ]] [=[ ]=] etc. fix docs. --- core/bootstrap/syntax.factor | 1 + core/syntax/syntax.factor | 13 +++++++++++++ .../classes/struct/prettyprint/prettyprint.factor | 2 +- language/peg/ebnf/ebnf-docs.factor | 8 ++++---- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/core/bootstrap/syntax.factor b/core/bootstrap/syntax.factor index 3e3d125044..0e9f506f27 100644 --- a/core/bootstrap/syntax.factor +++ b/core/bootstrap/syntax.factor @@ -12,6 +12,7 @@ in: bootstrap.syntax ":" ";" "![[" "![=[" "![==[" + "[[" "[=[" "[==[" "PRIVATE<" "B{" "BV{" diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index 68fd76e22e..e3cfbf5c89 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -70,6 +70,19 @@ in: bootstrap.syntax "]==]" parse-multiline-string drop ] define-core-syntax + + "[[" [ + "]]" parse-multiline-string suffix! + ] define-core-syntax + + "[=[" [ + "]=]" parse-multiline-string suffix! + ] define-core-syntax + + "[==[" [ + "]==]" parse-multiline-string suffix! + ] define-core-syntax + "PRIMITIVE:" [ current-vocab name>> scan-word scan-effect ";" expect ensure-primitive diff --git a/language/classes/struct/prettyprint/prettyprint.factor b/language/classes/struct/prettyprint/prettyprint.factor index ae576a4d73..8c27e8e9ae 100644 --- a/language/classes/struct/prettyprint/prettyprint.factor +++ b/language/classes/struct/prettyprint/prettyprint.factor @@ -4,7 +4,7 @@ alien.prettyprint arrays assocs classes classes.struct combinators combinators.short-circuit continuations fry kernel libc make math math.parser mirrors prettyprint.backend prettyprint.custom prettyprint.sections see.private sequences -slots strings summary words ; +slots strings summary words see ; in: classes.struct.prettyprint PRIVATE< diff --git a/language/peg/ebnf/ebnf-docs.factor b/language/peg/ebnf/ebnf-docs.factor index d272f38872..5d3a5c3e12 100644 --- a/language/peg/ebnf/ebnf-docs.factor +++ b/language/peg/ebnf/ebnf-docs.factor @@ -3,8 +3,8 @@ USING: help.syntax help.markup peg peg.search words ; in: peg.ebnf -HELP: EBNF< -{ $syntax "EBNF<...ebnf... EBNF>" } +HELP: EBNF-MAIN{{ +{ $syntax "EBNF-MAIN{{ ...ebnf... }}" } { $values { "...ebnf..." "EBNF DSL text" } } { $description "Creates a " { $vocab-link "peg" } @@ -15,7 +15,7 @@ HELP: EBNF< { $examples { $example "USING: kernel prettyprint peg.ebnf peg.search ;" - "\"abcdab\" EBNF< rule=\"a\" \"b\" => [[ drop \"foo\" ]] EBNF> replace ." + "\"abcdab\" EBNF-MAIN{{ rule=\"a\" \"b\" => [[ drop \"foo\" ]] }} replace ." "\"foocdfoo\"" } } ; @@ -469,7 +469,7 @@ ARTICLE: "peg.ebnf" "EBNF" "EBNF syntax. It provides three parsing words described below. These words all " "accept the same EBNF syntax. The difference is in how they are used. " { $subsections - \ EBNF< + \ EBNF-MAIN{{ \ EBNF{{ } "The EBNF syntax is composed of a series of rules of the form:"