From 174a1f26956d7d854d2f7ab5aff1bb39456dddea Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 23 Jun 2016 21:54:22 -0700 Subject: [PATCH] syntax: add ` `` ``` ```` --- core/bootstrap/syntax.factor | 1 + core/syntax/syntax.factor | 18 ++++++++++++++++++ language/backticks/backticks-docs.factor | 6 +++--- language/backticks/backticks.factor | 4 ++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/core/bootstrap/syntax.factor b/core/bootstrap/syntax.factor index 5d31199838..201a42fa50 100644 --- a/core/bootstrap/syntax.factor +++ b/core/bootstrap/syntax.factor @@ -12,6 +12,7 @@ IN: bootstrap.syntax ":" ";" "--" + "`" "``" "```" "````" "![[" "![=[" "![==[" "[[" "[=[" "[==[" "factor[[" "factor[=[" "factor[==[" diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index 7150ecd382..8892b9c27e 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -87,6 +87,23 @@ IN: bootstrap.syntax "]==]" parse-multiline-string suffix! ] define-core-syntax + + "`" [ + scan-token suffix! + ] define-core-syntax + + "``" [ + "``" parse-multiline-string suffix! + ] define-core-syntax + + "```" [ + "```" parse-multiline-string suffix! + ] define-core-syntax + + "````" [ + "````" parse-multiline-string suffix! + ] define-core-syntax + ! Different from parse-multiline-string "factor\"" [ lexer get skip-blank parse-string suffix! @@ -427,4 +444,5 @@ IN: bootstrap.syntax [ subwords [ changed-definition ] each ] [ parse-definition { } like set-specializer ] tri ] define-core-syntax + ] with-compilation-unit diff --git a/language/backticks/backticks-docs.factor b/language/backticks/backticks-docs.factor index df6b135554..8479625caf 100644 --- a/language/backticks/backticks-docs.factor +++ b/language/backticks/backticks-docs.factor @@ -1,12 +1,12 @@ USING: help.markup help.syntax io.encodings.utf8 strings ; IN: backticks -HELP: ` -{ $syntax "` command [args]`" } +HELP: \ shell`` +{ $syntax "shell`` command [args]``" } { $description "Runs the specified command and captures the output as a " { $link utf8 } " encoded " { $link string } "." } { $examples { $unchecked-example - "` ls -l`" + "shell`` ls -l``" "total 45\ndrwxrwxr-x+ 61 root admin 2074 Apr 8 22:58 Applic..." } } ; diff --git a/language/backticks/backticks.factor b/language/backticks/backticks.factor index 6a6f349759..a7e0250a48 100644 --- a/language/backticks/backticks.factor +++ b/language/backticks/backticks.factor @@ -4,8 +4,8 @@ USING: fry io io.encodings.utf8 interpolate io.launcher multiline sequences ; IN: backticks -SYNTAX: \ ` - "`" parse-multiline-string '[ +SYNTAX: \ shell`` + "``" parse-multiline-string '[ _ interpolate>string utf8 [ contents ] with-process-reader ] append! ;