syntax: add ` `` ``` ````

locals-and-roots
Doug Coleman 2016-06-23 21:54:22 -07:00
parent 6206ef7777
commit 174a1f2695
4 changed files with 24 additions and 5 deletions

View File

@ -12,6 +12,7 @@ IN: bootstrap.syntax
":" ":"
";" ";"
"--" "--"
"`" "``" "```" "````"
"![[" "![=[" "![==[" "![[" "![=[" "![==["
"[[" "[=[" "[==[" "[[" "[=[" "[==["
"factor[[" "factor[=[" "factor[==[" "factor[[" "factor[=[" "factor[==["

View File

@ -87,6 +87,23 @@ IN: bootstrap.syntax
"]==]" parse-multiline-string suffix! "]==]" parse-multiline-string suffix!
] define-core-syntax ] 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 ! Different from parse-multiline-string
"factor\"" [ "factor\"" [
lexer get skip-blank parse-string suffix! lexer get skip-blank parse-string suffix!
@ -427,4 +444,5 @@ IN: bootstrap.syntax
[ subwords [ changed-definition ] each ] [ subwords [ changed-definition ] each ]
[ parse-definition { } like set-specializer ] tri [ parse-definition { } like set-specializer ] tri
] define-core-syntax ] define-core-syntax
] with-compilation-unit ] with-compilation-unit

View File

@ -1,12 +1,12 @@
USING: help.markup help.syntax io.encodings.utf8 strings ; USING: help.markup help.syntax io.encodings.utf8 strings ;
IN: backticks IN: backticks
HELP: ` HELP: \ shell``
{ $syntax "` command [args]`" } { $syntax "shell`` command [args]``" }
{ $description "Runs the specified command and captures the output as a " { $link utf8 } " encoded " { $link string } "." } { $description "Runs the specified command and captures the output as a " { $link utf8 } " encoded " { $link string } "." }
{ $examples { $examples
{ $unchecked-example { $unchecked-example
"` ls -l`" "shell`` ls -l``"
"total 45\ndrwxrwxr-x+ 61 root admin 2074 Apr 8 22:58 Applic..." "total 45\ndrwxrwxr-x+ 61 root admin 2074 Apr 8 22:58 Applic..."
} }
} ; } ;

View File

@ -4,8 +4,8 @@ USING: fry io io.encodings.utf8 interpolate io.launcher
multiline sequences ; multiline sequences ;
IN: backticks IN: backticks
SYNTAX: \ ` SYNTAX: \ shell``
"`" parse-multiline-string '[ "``" parse-multiline-string '[
_ interpolate>string _ interpolate>string
utf8 [ contents ] with-process-reader utf8 [ contents ] with-process-reader
] append! ; ] append! ;