Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/Here-document/00-META.yaml
Normal file
2
Task/Here-document/00-META.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
from: http://rosettacode.org/wiki/Here_document
|
||||
16
Task/Here-document/00-TASK.txt
Normal file
16
Task/Here-document/00-TASK.txt
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
A ''here document'' (or "heredoc") is a way of specifying a text block, preserving the line breaks, indentation and other whitespace within the text.
|
||||
|
||||
Depending on the language being used, a ''here document'' is constructed using a command followed by "<<" (or some other symbol) followed by a token string.
|
||||
|
||||
The text block will then start on the next line, and will be followed by the chosen token at the beginning of the following line, which is used to mark the end of the text block.
|
||||
|
||||
|
||||
;Task:
|
||||
Demonstrate the use of ''here documents'' within the language.
|
||||
|
||||
;Related task:
|
||||
* [[Documentation]]
|
||||
<br><br>
|
||||
|
||||
{{omit from|Delphi}}
|
||||
|
||||
4
Task/Here-document/11l/here-document.11l
Normal file
4
Task/Here-document/11l/here-document.11l
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
print(‘
|
||||
here
|
||||
doc
|
||||
’)
|
||||
4
Task/Here-document/8th/here-document.8th
Normal file
4
Task/Here-document/8th/here-document.8th
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
quote *
|
||||
Hi
|
||||
there
|
||||
* .
|
||||
17
Task/Here-document/ALGOL-68/here-document.alg
Normal file
17
Task/Here-document/ALGOL-68/here-document.alg
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/local/bin/a68g --script #
|
||||
|
||||
[]STRING help = (
|
||||
"Usage: thingy [OPTIONS]",
|
||||
" -h Display this usage message",
|
||||
" -H hostname Hostname to connect to"
|
||||
);
|
||||
|
||||
printf(($gl$,help,$l$));
|
||||
|
||||
printf(($gl$,
|
||||
"The river was deep but I swam it, Janet.",
|
||||
"The future is ours so let's plan it, Janet.",
|
||||
"So please don't tell me to can it, Janet.",
|
||||
"I've one thing to say and that's ...",
|
||||
"Dammit. Janet, I love you."
|
||||
))
|
||||
6
Task/Here-document/APL/here-document-1.apl
Normal file
6
Task/Here-document/APL/here-document-1.apl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
BODY←⎕INP 'END-OF-⎕INP'
|
||||
First line
|
||||
Second line
|
||||
Third line
|
||||
...
|
||||
END-OF-⎕INP
|
||||
8
Task/Here-document/APL/here-document-2.apl
Normal file
8
Task/Here-document/APL/here-document-2.apl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
]boxing 8
|
||||
s ← """
|
||||
→ abc
|
||||
→ def
|
||||
→
|
||||
→ GHIJK
|
||||
→ """
|
||||
s
|
||||
56
Task/Here-document/ARM-Assembly/here-document.arm
Normal file
56
Task/Here-document/ARM-Assembly/here-document.arm
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/* ARM assembly Raspberry PI */
|
||||
/* program heredoc.s */
|
||||
|
||||
/* Constantes */
|
||||
.equ STDOUT, 1 @ Linux output console
|
||||
.equ EXIT, 1 @ Linux syscall
|
||||
.equ WRITE, 4 @ Linux syscall
|
||||
|
||||
.equ BUFFERSIZE, 100
|
||||
|
||||
/* Initialized data */
|
||||
.data
|
||||
szMessString: .asciz "String :
|
||||
ABCD
|
||||
EFGH TAB \n"
|
||||
|
||||
szCarriageReturn: .asciz "\n"
|
||||
|
||||
/* UnInitialized data */
|
||||
.bss
|
||||
|
||||
/* code section */
|
||||
.text
|
||||
.global main
|
||||
main:
|
||||
|
||||
ldr r0,iAdrszMessString @ display message
|
||||
bl affichageMess
|
||||
|
||||
|
||||
100: @ standard end of the program
|
||||
mov r0, #0 @ return code
|
||||
mov r7, #EXIT @ request to exit program
|
||||
svc 0 @ perform system call
|
||||
iAdrszMessString: .int szMessString
|
||||
iAdrszCarriageReturn: .int szCarriageReturn
|
||||
|
||||
/******************************************************************/
|
||||
/* display text with size calculation */
|
||||
/******************************************************************/
|
||||
/* r0 contains the address of the message */
|
||||
affichageMess:
|
||||
push {r0,r1,r2,r7,lr} @ save registers
|
||||
mov r2,#0 @ counter length */
|
||||
1: @ loop length calculation
|
||||
ldrb r1,[r0,r2] @ read octet start position + index
|
||||
cmp r1,#0 @ if 0 its over
|
||||
addne r2,r2,#1 @ else add 1 in the length
|
||||
bne 1b @ and loop
|
||||
@ so here r2 contains the length of the message
|
||||
mov r1,r0 @ address message in r1
|
||||
mov r0,#STDOUT @ code to write to the standard output Linux
|
||||
mov r7, #WRITE @ code call system "write"
|
||||
svc #0 @ call system
|
||||
pop {r0,r1,r2,r7,lr} @ restaur registers
|
||||
bx lr @ return
|
||||
20
Task/Here-document/Ada/here-document.ada
Normal file
20
Task/Here-document/Ada/here-document.ada
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
with Ada.Containers.Indefinite_Vectors, Ada.Text_IO;
|
||||
|
||||
procedure Here_Doc is
|
||||
|
||||
package String_Vec is new Ada.Containers.Indefinite_Vectors
|
||||
(Index_Type => Positive,
|
||||
Element_Type => String);
|
||||
|
||||
use type String_Vec.Vector;
|
||||
|
||||
Document: String_Vec.Vector := String_Vec.Empty_Vector
|
||||
& "This is a vector of strings with the following properties:"
|
||||
& " - indention is preserved, and"
|
||||
& " - a quotation mark '""' must be ""escaped"" by a double-quote '""""'.";
|
||||
begin
|
||||
Document := Document & "Have fun!";
|
||||
for I in Document.First_Index .. Document.Last_Index loop
|
||||
Ada.Text_IO.Put_Line(Document.Element(I));
|
||||
end loop;
|
||||
end Here_Doc;
|
||||
3
Task/Here-document/Applesoft-BASIC/here-document.basic
Normal file
3
Task/Here-document/Applesoft-BASIC/here-document.basic
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
0 Q$ = CHR$ (34)
|
||||
1 M$ = CHR$ (13)
|
||||
2 PRINT Q$"Oh, Danny Boy,"M$"The pipes, the pipes are calling"M$"From glen to glen and down the mountainside"Q$
|
||||
22
Task/Here-document/Arturo/here-document.arturo
Normal file
22
Task/Here-document/Arturo/here-document.arturo
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
print {:
|
||||
The “Red Death” had long devastated the country.
|
||||
No pestilence had ever been so fatal, or so hideous.
|
||||
|
||||
Blood was its Avator and its seal—
|
||||
the redness and the horror of blood.
|
||||
|
||||
There were sharp pains,
|
||||
and sudden dizziness,
|
||||
and then profuse bleeding at the pores,
|
||||
with dissolution.
|
||||
|
||||
The scarlet stains upon the body
|
||||
and especially upon the face of the victim,
|
||||
were the pest ban
|
||||
which shut him out from the aid
|
||||
and from the sympathy of his fellow-men.
|
||||
|
||||
And the whole seizure,
|
||||
progress and termination of the disease,
|
||||
were the incidents of half an hour.
|
||||
:}
|
||||
9
Task/Here-document/AutoHotkey/here-document.ahk
Normal file
9
Task/Here-document/AutoHotkey/here-document.ahk
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MyVar = "This is the text inside MyVar"
|
||||
MyVariable =
|
||||
(
|
||||
Note that whitespace is preserved
|
||||
As well as newlines.
|
||||
The LTrim option can be present to remove left whitespace.
|
||||
Variable references such as %MyVar% are expanded.
|
||||
)
|
||||
MsgBox % MyVariable
|
||||
8
Task/Here-document/BASIC/here-document.basic
Normal file
8
Task/Here-document/BASIC/here-document.basic
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
text1$ = " " + CHR$(10) + "<<'FOO' " + CHR$(10) + " 'jaja', `esto`" + CHR$(10) + " <simula>" + CHR$(10) + " \un\" + CHR$(10) + " ${ejemplo} de 'heredoc'" + CHR$(10) + " en QBASIC."
|
||||
|
||||
text2$ = "Esta es la primera línea." + CHR$(10) + "Esta es la segunda línea." + CHR$(10) + "Esta 'línea' contiene comillas."
|
||||
|
||||
PRINT text1$
|
||||
PRINT
|
||||
PRINT text2$
|
||||
END
|
||||
8
Task/Here-document/BASIC256/here-document.basic
Normal file
8
Task/Here-document/BASIC256/here-document.basic
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
text1$ = " " & chr(10) & "<<#FOO# " & chr(10) & " #jaja#, `esto`" & chr(10) & " <simula>" & chr(10) & " \un\" & chr(10) & " ${ejemplo} de 'heredoc'" & chr(10) & " en BASIC256."
|
||||
|
||||
text2$ = "Esta es la primera linea." & chr(10) & "Esta es la segunda linea." & chr(10) & "Esta 'linea' contiene comillas."
|
||||
|
||||
print text1$
|
||||
print
|
||||
print text2$
|
||||
end
|
||||
2
Task/Here-document/BQN/here-document-1.bqn
Normal file
2
Task/Here-document/BQN/here-document-1.bqn
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
•Out "dsdfsdfsad
|
||||
""fsadf""sdf"
|
||||
2
Task/Here-document/BQN/here-document-2.bqn
Normal file
2
Task/Here-document/BQN/here-document-2.bqn
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
dsdfsdfsad
|
||||
"fsadf"sdf
|
||||
8
Task/Here-document/BaCon/here-document.bacon
Normal file
8
Task/Here-document/BaCon/here-document.bacon
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
'--- we dont have a print here doc built-in command in BaCon
|
||||
'--- we can get the end result like this with the newline NL$
|
||||
|
||||
PRINT "To use Bacon your system must have either Korn Shell, or ZShell, or Bourne Again Shell (BASH) available." NL$ \
|
||||
"If none of these shells are available on your platform, download and install the free Public Domain Korn Shell which can" NL$ \
|
||||
"execute BaCon also. Furthermore BaCon also works with a newer Kornshell implementation like the MirBSD Korn Shell." NL$ NL$ \
|
||||
"BaCon intends to be a programming aid in creating tools which can be compiled on different platforms" NL$ \
|
||||
"(including 64bit environments). It tries to revive the days of the good old BASIC." NL$
|
||||
4
Task/Here-document/Blade/here-document.blade
Normal file
4
Task/Here-document/Blade/here-document.blade
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
echo 'All strings
|
||||
support
|
||||
multiline
|
||||
in Blade'
|
||||
10
Task/Here-document/Bracmat/here-document.bracmat
Normal file
10
Task/Here-document/Bracmat/here-document.bracmat
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
( {Multiline string:}
|
||||
"
|
||||
Second line
|
||||
Third line
|
||||
\"quoted\"
|
||||
A backslash: \\
|
||||
":?stringA
|
||||
& out$("Multiline string:")
|
||||
& out$(!stringA)
|
||||
)
|
||||
18
Task/Here-document/C++/here-document.cpp
Normal file
18
Task/Here-document/C++/here-document.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include <iostream> // Only for cout to demonstrate
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout <<
|
||||
R"EOF( A raw string begins with R, then a double-quote ("), then an optional
|
||||
identifier (here I've used "EOF"), then an opening parenthesis ('('). If you
|
||||
use an identifier, it cannot be longer than 16 characters, and it cannot
|
||||
contain a space, either opening or closing parentheses, a backslash, a tab, a
|
||||
vertical tab, a form feed, or a newline.
|
||||
|
||||
It ends with a closing parenthesis (')'), the identifer (if you used one),
|
||||
and a double-quote.
|
||||
|
||||
All characters are okay in a raw string, no escape sequences are necessary
|
||||
or recognized, and all whitespace is preserved.
|
||||
)EOF";
|
||||
}
|
||||
9
Task/Here-document/C-Shell/here-document.csh
Normal file
9
Task/Here-document/C-Shell/here-document.csh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/csh -f
|
||||
cat << ANARBITRARYTOKEN
|
||||
* Your HOME is $HOME
|
||||
* 2 + 2 is `@ n = 2 + 2; echo \$n`
|
||||
ANARBITRARYTOKEN
|
||||
|
||||
cat << 'ANARBITRARYTOKEN'
|
||||
$PATH \$PATH `shutdown now`
|
||||
'ANARBITRARYTOKEN'
|
||||
13
Task/Here-document/C-sharp/here-document.cs
Normal file
13
Task/Here-document/C-sharp/here-document.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.Write(@"
|
||||
multiline
|
||||
strings are easy
|
||||
to put together
|
||||
in C#");
|
||||
}
|
||||
}
|
||||
11
Task/Here-document/CoffeeScript/here-document.coffee
Normal file
11
Task/Here-document/CoffeeScript/here-document.coffee
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
myDoc = '''
|
||||
Single-quoted heredocs allows no '#{foo}' interpolation.
|
||||
This behavior is similar to single-quoted strings.
|
||||
'''
|
||||
doc2 = """
|
||||
However, double-quoted heredocs *do* allow these.
|
||||
See it in action:
|
||||
Content: "#{myDoc}"
|
||||
"""
|
||||
|
||||
console.log doc2
|
||||
10
Task/Here-document/Common-Lisp/here-document.lisp
Normal file
10
Task/Here-document/Common-Lisp/here-document.lisp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
;; load cl-heredoc with QuickLisp
|
||||
(ql:quickload 'cl-heredoc)
|
||||
|
||||
;; use #>xxx>yyyyyyyy!xxx as read-macro for heredoc
|
||||
(set-dispatch-macro-character #\# #\> #'cl-heredoc:read-heredoc)
|
||||
|
||||
;; example:
|
||||
(format t "~A~%" #>eof1>Write whatever (you) "want",
|
||||
no matter how many lines or what characters until
|
||||
the magic end sequence has been reached!eof1)
|
||||
6
Task/Here-document/Crystal/here-document.crystal
Normal file
6
Task/Here-document/Crystal/here-document.crystal
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
puts <<-DOC
|
||||
this is a heredoc
|
||||
it preserves indents and newlines
|
||||
the DOC identifier is completely arbitrary
|
||||
it can be lowercase, a keyword, or even a number (but not a float)
|
||||
DOC
|
||||
21
Task/Here-document/D/here-document.d
Normal file
21
Task/Here-document/D/here-document.d
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import std.stdio, std.string;
|
||||
|
||||
void main() {
|
||||
// Delimited strings: a 'q' followed by double quotes and an
|
||||
// opening and closing delimiter of choice:
|
||||
|
||||
q"[a string that you "don't" have to escape]"
|
||||
.writeln;
|
||||
|
||||
// If the delimiter is an identifier, the identifier must be
|
||||
// immediately followed by a newline, and the matching delimiter
|
||||
// is the same identifier starting at the beginning of the line:
|
||||
|
||||
q"EOS
|
||||
This
|
||||
is a multi-line
|
||||
heredoc string
|
||||
EOS".outdent.writeln;
|
||||
|
||||
// std.string.outdent is used to remove the four spaces indent.
|
||||
}
|
||||
4
Task/Here-document/DWScript/here-document.dw
Normal file
4
Task/Here-document/DWScript/here-document.dw
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
PrintLn("This is
|
||||
a multiline
|
||||
""string""
|
||||
sample");
|
||||
4
Task/Here-document/Elixir/here-document-1.elixir
Normal file
4
Task/Here-document/Elixir/here-document-1.elixir
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
IO.puts """
|
||||
привет
|
||||
мир
|
||||
"""
|
||||
2
Task/Here-document/Elixir/here-document-2.elixir
Normal file
2
Task/Here-document/Elixir/here-document-2.elixir
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
привет
|
||||
мир
|
||||
11
Task/Here-document/Elixir/here-document-3.elixir
Normal file
11
Task/Here-document/Elixir/here-document-3.elixir
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
iex(1)> a=2
|
||||
2
|
||||
iex(2)> '''
|
||||
...(2)> 1 + 1 = #{a}
|
||||
...(2)> '''
|
||||
'1 + 1 = 2\n'
|
||||
iex(3)>
|
||||
iex(3)> '''2'''
|
||||
** (SyntaxError) iex:3: heredoc start must be followed by a new line after '''
|
||||
|
||||
iex(3)>
|
||||
7
Task/Here-document/Erlang/here-document.erl
Normal file
7
Task/Here-document/Erlang/here-document.erl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
2> S = " ad
|
||||
2> 123
|
||||
2> the end".
|
||||
3> io:fwrite( S ).
|
||||
ad
|
||||
123
|
||||
the end
|
||||
11
Task/Here-document/Factor/here-document.factor
Normal file
11
Task/Here-document/Factor/here-document.factor
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
" a multiline
|
||||
string\n(with escape sequences: \u{greek-capital-letter-sigma})
|
||||
"
|
||||
"""this is "easier".."""
|
||||
|
||||
|
||||
|
||||
HEREDOC: EOF
|
||||
this
|
||||
is not \n escaped at all
|
||||
EOF
|
||||
49
Task/Here-document/Forth/here-document-1.fth
Normal file
49
Task/Here-document/Forth/here-document-1.fth
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
\ GForth specific words:
|
||||
\ under+ ( a b c -- a+c b) , latest ( -- nt ) , name>string ( nt -- ca u )
|
||||
\ Should not be a problem to modify it to work with other Forth implementation:
|
||||
|
||||
: $! ( ca u -- a )
|
||||
dup >R dup , here swap move R> allot ;
|
||||
: $@ ( a -- ca u )
|
||||
dup @ 1 cells under+ ;
|
||||
: c!+ ( c ca - ca+1 )
|
||||
tuck c! 1+ ;
|
||||
: $!+ ( a u a' -- a'+u ; string-store-plus )
|
||||
2dup + >R swap move R> ;
|
||||
|
||||
\ --- UNIX end-of-line adapted words
|
||||
10 constant EOL
|
||||
: input-fix ( -- ; for interactive use ! )
|
||||
source-id 0= IF cr THEN ;
|
||||
: get_line ( -- ca u ) EOL parse input-fix ;
|
||||
: EOL!+ ( a -- a' ; eol-store-plus ) EOL swap c!+ ;
|
||||
|
||||
: EOD ( -- ca u ; end-of-doc )
|
||||
latest name>string ;
|
||||
|
||||
: >> ( "doc-name" "doc-body" -- ) input-fix
|
||||
CREATE 0 , \ post body length
|
||||
here dup >R
|
||||
BEGIN refill >R
|
||||
get_line 2dup EOD compare
|
||||
R> AND \ notEOD && input-stream ->
|
||||
WHILE rot $!+ EOL!+
|
||||
REPEAT 2drop
|
||||
R> tuck - dup allot
|
||||
swap -1 cells + ! \ fixup body length
|
||||
DOES> ( -- ca u ) $@ ;
|
||||
|
||||
\ TEST ; excerpt from Project Gutenberg 'Alice in Wonderland'
|
||||
|
||||
>> ALICE
|
||||
CHAPTER I. Down the Rabbit-Hole
|
||||
|
||||
Alice was beginning to get very tired of sitting by her sister on the
|
||||
bank, and of having nothing to do: once or twice she had peeped into the
|
||||
book her sister was reading, but it had no pictures or conversations in
|
||||
it, 'and what is the use of a book,' thought Alice 'without pictures or
|
||||
conversation?'
|
||||
ALICE
|
||||
>> RABBIT
|
||||
RABBIT
|
||||
ALICE type ." --" cr RABBIT type
|
||||
28
Task/Here-document/Forth/here-document-2.fth
Normal file
28
Task/Here-document/Forth/here-document-2.fth
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
get-current get-order wordlist swap 1+ set-order definitions
|
||||
: place over >r rot over cell+ r> move ! ;
|
||||
: +place 2dup >r >r dup @ cell+ + swap move r> r> dup @ rot + swap ! ;
|
||||
: count dup cell+ swap @ ;
|
||||
set-current
|
||||
|
||||
CREATE eol 10 C, DOES> 1 ;
|
||||
CREATE eod 128 ALLOT DOES> count ;
|
||||
: seteod 0 parse ['] eod >body place ;
|
||||
: start 0 0 here place ;
|
||||
: read refill 0= IF abort" Unterminated here document" THEN ;
|
||||
: ~end source eod compare ;
|
||||
: store source here +place eol here +place ;
|
||||
: slurp BEGIN read ~end WHILE store REPEAT refill drop ;
|
||||
: totalsize here count + here - ;
|
||||
: finish totalsize ALLOT align ;
|
||||
: << seteod start slurp finish DOES> count ;
|
||||
previous
|
||||
|
||||
( Test )
|
||||
|
||||
CREATE Alice << ~~ end ~~
|
||||
They got a building down New York City, it’s called Whitehall Street,
|
||||
Where you walk in, you get injected, inspected, detected, infected,
|
||||
Neglected and selected.
|
||||
~~ end ~~
|
||||
|
||||
Alice type bye
|
||||
17
Task/Here-document/Fortran/here-document.f
Normal file
17
Task/Here-document/Fortran/here-document.f
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
INTEGER I !A stepper.
|
||||
CHARACTER*666 I AM !Sufficient space.
|
||||
I AM = "<col72
|
||||
C 111111111122222222223333333333444444444455555555556666666666
|
||||
C 123456789012345678901234567890123456789012345678901234567890123456789
|
||||
1 <col72
|
||||
2 I AM <col72
|
||||
3 <col72
|
||||
4 THAT I AM <col72
|
||||
5"
|
||||
|
||||
Chug through the text blob.
|
||||
DO I = 0,600,66 !Known length.
|
||||
WRITE (6,1) I AM(I + 1:I + 66) !Reveal one line.
|
||||
1 FORMAT (A66) !No control characters are expected.
|
||||
END DO !On to the next line.
|
||||
END
|
||||
15
Task/Here-document/FreeBASIC/here-document.basic
Normal file
15
Task/Here-document/FreeBASIC/here-document.basic
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
Dim As String text1 = " " & Chr(10) & _
|
||||
"<<'FOO' " & Chr(10) & _
|
||||
" 'jaja', `esto`" & Chr(10) & _
|
||||
" <simula>" & Chr(10) & _
|
||||
" \un\" & Chr(10) & _
|
||||
!" ${ejemplo} de \"heredoc\"" & Chr(10) & _
|
||||
" en FreeBASIC."
|
||||
|
||||
Dim As String text2 = "Esta es la primera linea." & Chr(10) & _
|
||||
"Esta es la segunda linea." & Chr(10) & _
|
||||
!"Esta \"linea\" contiene comillas."
|
||||
|
||||
Print text1
|
||||
Print Chr(10) + text2
|
||||
Sleep
|
||||
3
Task/Here-document/Frink/here-document.frink
Normal file
3
Task/Here-document/Frink/here-document.frink
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
lyrics = """Oh, Danny Boy,
|
||||
The pipes, the pipes are calling
|
||||
From glen to glen and down the mountainside"""
|
||||
19
Task/Here-document/Genie/here-document.genie
Normal file
19
Task/Here-document/Genie/here-document.genie
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[indent=4]
|
||||
/*
|
||||
Here documents, as template and verbatim strings in Genie
|
||||
valac heredoc.gs
|
||||
*/
|
||||
init
|
||||
test:string = "Genie string"
|
||||
|
||||
var multilineString = """
|
||||
this is a $test
|
||||
"""
|
||||
|
||||
var templateString = @"
|
||||
this is a $test template
|
||||
with math for six times seven = $(6 * 7)
|
||||
"
|
||||
|
||||
stdout.printf("%s", multilineString)
|
||||
stdout.printf("%s", templateString)
|
||||
3
Task/Here-document/Go/here-document.go
Normal file
3
Task/Here-document/Go/here-document.go
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
var m = ` leading spaces
|
||||
|
||||
and blank lines`
|
||||
8
Task/Here-document/Groovy/here-document-1.groovy
Normal file
8
Task/Here-document/Groovy/here-document-1.groovy
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
println '''
|
||||
Time's a strange fellow;
|
||||
more he gives than takes
|
||||
(and he takes all) nor any marvel finds
|
||||
quite disappearance but some keener makes
|
||||
losing, gaining
|
||||
--love! if a world ends
|
||||
'''
|
||||
18
Task/Here-document/Groovy/here-document-2.groovy
Normal file
18
Task/Here-document/Groovy/here-document-2.groovy
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
def expired='defunct'
|
||||
def horse='stallion'
|
||||
def christ='Jesus'
|
||||
|
||||
println """
|
||||
Buffalo Bill's
|
||||
${expired}
|
||||
who used to
|
||||
ride a watersmooth-silver
|
||||
${horse}
|
||||
and break onetwothreefourfive pigeonsjustlikethat
|
||||
${christ}
|
||||
|
||||
he was a handsome man
|
||||
and what i want to know is
|
||||
how do you like your blueeyed boy
|
||||
Mister Death
|
||||
"""
|
||||
16
Task/Here-document/Haskell/here-document.hs
Normal file
16
Task/Here-document/Haskell/here-document.hs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
main :: IO ()
|
||||
main = do
|
||||
|
||||
-- multiline String
|
||||
putStrLn "Hello\
|
||||
\ World!\n"
|
||||
|
||||
-- more haskell-ish way
|
||||
putStrLn $ unwords ["This", "is", "an", "example", "text!\n"]
|
||||
|
||||
-- now with multiple lines
|
||||
putStrLn $ unlines [
|
||||
unwords ["This", "is", "the", "first" , "line."]
|
||||
, unwords ["This", "is", "the", "second", "line."]
|
||||
, unwords ["This", "is", "the", "third" , "line."]
|
||||
]
|
||||
54
Task/Here-document/J/here-document-1.j
Normal file
54
Task/Here-document/J/here-document-1.j
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
here=:0 :0
|
||||
0 :0 will be replaced by the text on the following lines.
|
||||
This is three tokens: two instances of the number 0 and
|
||||
one instance of the explicit definition token ':'.
|
||||
Any indentation in the here document will be retained in the result.
|
||||
There must be a space to the left of : or it will combine with the
|
||||
0 on its left to form the token 0: which is something completely
|
||||
different.
|
||||
|
||||
The here document is terminated by a line which contains only a
|
||||
single right parenthesis ')' and optional white space. In J's
|
||||
documentation the family of entities which include here documents
|
||||
(and verb definitions and so on) are called 'scripts'.
|
||||
|
||||
When several scripts are referenced on the same line, they are used
|
||||
sequentially in an order determined by their appearance on the line.
|
||||
The leftmost 'script' reference gets the last script and the rightmost
|
||||
reference gets the first script. But this is a rare usage.
|
||||
|
||||
Typically, such values are assigned a name so that they can be
|
||||
used later. However, they may also be discarded and/or ignored, in
|
||||
which case they are logically equivalent to multi-line comments.
|
||||
)
|
||||
|
||||
and_here=:noun define
|
||||
'noun define' is an alternative and perhaps more "user friendly"
|
||||
way of declaring a here document. It achieves the same thing as
|
||||
0 :0 and in fact 'noun' has the value 0 and 'define' has the value :0
|
||||
And, of course, there must be a space between the word 'noun' and
|
||||
the word 'define'.
|
||||
|
||||
Other useful alternatives include verb (which has the value 3)
|
||||
and dyad (which has the value 4), and adverb (which has the value 1).
|
||||
In other words 'verb define' (if unquoted) would be replaced by a
|
||||
verb whose definition is provided in the following 'script'.
|
||||
However, all of these names are normal variables which can
|
||||
be declared to have different values by the developer. And, of course,
|
||||
note that this mechanism is significantly more verbose than using
|
||||
the underlying 0 :0 mechanism directly.
|
||||
)
|
||||
|
||||
also_here=: {{)n
|
||||
J902 introduced {{ blocks which may be {{ nested }} arbitrarily }} to
|
||||
the J interpreter. This includes {{)n blocks which are here documents.
|
||||
These {{)n blocks are not further nestable (they represent
|
||||
literal text with no internal structure), and the terminating }}
|
||||
must appear at the beginning of a line (or on the same line as
|
||||
the opening {{)n -- but that would not be a "here doc").
|
||||
|
||||
If text does not appear after the )n on the initial line, the
|
||||
initial (first) linefeed does not appear in the here doc. If
|
||||
text follows the {{)n, that text (and optional newline) would
|
||||
be included.
|
||||
}}
|
||||
11
Task/Here-document/J/here-document-2.j
Normal file
11
Task/Here-document/J/here-document-2.j
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package rosettacode.heredoc;
|
||||
public class MainApp {
|
||||
public static void main(String[] args) {
|
||||
String hereDoc = """
|
||||
This is a multiline string.
|
||||
It includes all of this text,
|
||||
but on separate lines in the code.
|
||||
""";
|
||||
System.out.println(hereDoc);
|
||||
}
|
||||
}
|
||||
6
Task/Here-document/JavaScript/here-document.js
Normal file
6
Task/Here-document/JavaScript/here-document.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
const myVar = 123;
|
||||
const tempLit = `Here is some
|
||||
multi-line string. And here is
|
||||
the value of "myVar": ${myVar}
|
||||
That's all.`;
|
||||
console.log(tempLit)
|
||||
6
Task/Here-document/Jq/here-document-1.jq
Normal file
6
Task/Here-document/Jq/here-document-1.jq
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def s:
|
||||
"x
|
||||
y
|
||||
z";
|
||||
|
||||
s
|
||||
2
Task/Here-document/Jq/here-document-2.jq
Normal file
2
Task/Here-document/Jq/here-document-2.jq
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$ jq -n s.jq
|
||||
"x\ny\nz"
|
||||
6
Task/Here-document/Jq/here-document-3.jq
Normal file
6
Task/Here-document/Jq/here-document-3.jq
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def specifier(a):
|
||||
"x
|
||||
\(a)
|
||||
z";
|
||||
|
||||
specifier("y")
|
||||
7
Task/Here-document/Jq/here-document-4.jq
Normal file
7
Task/Here-document/Jq/here-document-4.jq
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
"a
|
||||
tab: end
|
||||
parens:()
|
||||
single quotation mark:'
|
||||
double quotation mark must be escaped:\"
|
||||
b
|
||||
d"
|
||||
1
Task/Here-document/Jq/here-document-5.jq
Normal file
1
Task/Here-document/Jq/here-document-5.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
"a\ntab:\tend\nparens:()\nsingle quotation mark:'\ndouble quotation mark must be escaped:\"\nb\nd"
|
||||
5
Task/Here-document/Julia/here-document.julia
Normal file
5
Task/Here-document/Julia/here-document.julia
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
print("""\
|
||||
Usage: thingy [OPTIONS]
|
||||
-h Display this usage message
|
||||
-H hostname Hostname to connect to
|
||||
""")
|
||||
28
Task/Here-document/Kotlin/here-document.kotlin
Normal file
28
Task/Here-document/Kotlin/here-document.kotlin
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// version 1.1.0
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val ev = "embed variables"
|
||||
|
||||
val here = """
|
||||
This is a raw string literal
|
||||
which does not treat escaped characters
|
||||
(\t, \b, \n, \r, \', \", \\, \$ and \u)
|
||||
specially and can contain new lines,
|
||||
indentation and other whitespace
|
||||
within the string.
|
||||
|
||||
"Quotes" or doubled ""quotes"" can
|
||||
be included without problem but not
|
||||
tripled quotes.
|
||||
|
||||
It's also possible to $ev
|
||||
in a raw string literal using string
|
||||
interpolation.
|
||||
|
||||
If you need to include a
|
||||
literal ${'$'} sign in a raw string literal then
|
||||
don't worry you've just done it!
|
||||
"""
|
||||
|
||||
println(here)
|
||||
}
|
||||
15
Task/Here-document/Lambdatalk/here-document.lambdatalk
Normal file
15
Task/Here-document/Lambdatalk/here-document.lambdatalk
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
1) defining a variable:
|
||||
{def myVar 123}
|
||||
|
||||
2) defining some text:
|
||||
Here is some
|
||||
multi-line string. And here is
|
||||
the value of "myVar": '{myVar}
|
||||
That's all.
|
||||
|
||||
3) displays :
|
||||
|
||||
Here is some
|
||||
multi-line string. And here is
|
||||
the value of "myVar": 123
|
||||
That's all.
|
||||
4
Task/Here-document/Langur/here-document-1.langur
Normal file
4
Task/Here-document/Langur/here-document-1.langur
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
val .s = q:block END
|
||||
We put our text here.
|
||||
Here we are, Doc.
|
||||
END
|
||||
4
Task/Here-document/Langur/here-document-2.langur
Normal file
4
Task/Here-document/Langur/here-document-2.langur
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
val .re = re:block END
|
||||
a regex pattern here
|
||||
Still here, Doc.
|
||||
END
|
||||
4
Task/Here-document/Langur/here-document-3.langur
Normal file
4
Task/Here-document/Langur/here-document-3.langur
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
val .re = re:x:block END
|
||||
a free-spacing regex pattern here
|
||||
Somewhere, Doc.
|
||||
END
|
||||
5
Task/Here-document/Lingo/here-document-1.lingo
Normal file
5
Task/Here-document/Lingo/here-document-1.lingo
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
str = "This is the first line.\
|
||||
This is the second line.\
|
||||
This ""E&"line""E&" contains quotes."
|
||||
|
||||
put str
|
||||
2
Task/Here-document/Lingo/here-document-2.lingo
Normal file
2
Task/Here-document/Lingo/here-document-2.lingo
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
str = member("my long text").text
|
||||
put str
|
||||
16
Task/Here-document/Lua/here-document.lua
Normal file
16
Task/Here-document/Lua/here-document.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
print([[
|
||||
This is a long paragraph of text
|
||||
it is the simplest while using it
|
||||
with lua, however it will have the
|
||||
same line breaks and spacing as
|
||||
you set in this block.
|
||||
]])
|
||||
|
||||
print([=[by using equals signs, ]] may be embedded.]=])
|
||||
|
||||
local msg = [[this is a message that spans
|
||||
multiple lines and will have the next lines
|
||||
preserved as they were entered, so be careful
|
||||
when using this]]
|
||||
|
||||
print(msg)
|
||||
8
Task/Here-document/M2000-Interpreter/here-document.m2000
Normal file
8
Task/Here-document/M2000-Interpreter/here-document.m2000
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Module Checkit {
|
||||
a$={This is the first line
|
||||
This is the second line
|
||||
End bracket position declare indentation fortext (except for first line)
|
||||
}
|
||||
Report a$ ' print all lines, without space at the left
|
||||
}
|
||||
CheckIt
|
||||
10
Task/Here-document/MATLAB/here-document.m
Normal file
10
Task/Here-document/MATLAB/here-document.m
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
sprintf('%s\n',...
|
||||
'line1 text',...
|
||||
' line2 text',...
|
||||
' line3 text',...
|
||||
' line4 text')
|
||||
|
||||
sprintf('%s\n',...
|
||||
'Usage: thingy [OPTIONS]',...
|
||||
' -h Display this usage message',...
|
||||
' -H hostname Hostname to connect to')
|
||||
13
Task/Here-document/Mathematica/here-document.math
Normal file
13
Task/Here-document/Mathematica/here-document.math
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
Print["Mathematica
|
||||
is an
|
||||
interesing
|
||||
language,
|
||||
with its
|
||||
strings
|
||||
being
|
||||
multiline
|
||||
by\
|
||||
default
|
||||
when not
|
||||
back\
|
||||
s\\ashed!"];
|
||||
11
Task/Here-document/NewLISP/here-document.l
Normal file
11
Task/Here-document/NewLISP/here-document.l
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
; here-document.lsp
|
||||
; oofoe 2012-01-19
|
||||
; http://rosettacode.org/wiki/Here_document
|
||||
|
||||
(print (format [text]
|
||||
Blast it %s! I'm a %s,
|
||||
not a %s!
|
||||
--- %s
|
||||
[/text] "James" "magician" "doctor" "L. McCoy"))
|
||||
|
||||
(exit)
|
||||
4
Task/Here-document/Nim/here-document.nim
Normal file
4
Task/Here-document/Nim/here-document.nim
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
echo """Usage: thingy [OPTIONS]
|
||||
-h Display this usage message
|
||||
-H hostname Hostname to connect to
|
||||
"""
|
||||
8
Task/Here-document/OCaml/here-document.ocaml
Normal file
8
Task/Here-document/OCaml/here-document.ocaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
print_string {whatever|
|
||||
'hahah', `this`
|
||||
<is>
|
||||
\a\
|
||||
"Heredoc" ${example}
|
||||
in OCaml
|
||||
|whatever}
|
||||
;;
|
||||
6
Task/Here-document/PHP/here-document-1.php
Normal file
6
Task/Here-document/PHP/here-document-1.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
$address = <<<END
|
||||
1, High Street,
|
||||
$town_name,
|
||||
West Midlands.
|
||||
WM4 5HD.
|
||||
END;
|
||||
5
Task/Here-document/PHP/here-document-2.php
Normal file
5
Task/Here-document/PHP/here-document-2.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
$x = <<<'FOO'
|
||||
No
|
||||
$interpolation
|
||||
here
|
||||
FOO;
|
||||
6
Task/Here-document/Perl/here-document-1.pl
Normal file
6
Task/Here-document/Perl/here-document-1.pl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
$address = <<END;
|
||||
1, High Street,
|
||||
$town_name,
|
||||
West Midlands.
|
||||
WM4 5HD.
|
||||
END
|
||||
5
Task/Here-document/Perl/here-document-2.pl
Normal file
5
Task/Here-document/Perl/here-document-2.pl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
$pancake = <<"NO MORE INGREDIENTS";
|
||||
egg
|
||||
milk
|
||||
flour
|
||||
NO MORE INGREDIENTS
|
||||
5
Task/Here-document/Perl/here-document-3.pl
Normal file
5
Task/Here-document/Perl/here-document-3.pl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
$x = <<'FOO';
|
||||
No
|
||||
$interpolation
|
||||
here
|
||||
FOO
|
||||
3
Task/Here-document/Perl/here-document-4.pl
Normal file
3
Task/Here-document/Perl/here-document-4.pl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$output = <<`BAR`;
|
||||
ls /home
|
||||
BAR
|
||||
4
Task/Here-document/Perl/here-document-5.pl
Normal file
4
Task/Here-document/Perl/here-document-5.pl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
print(<<EOF . "lamb\n");
|
||||
Mary had
|
||||
a little
|
||||
EOF
|
||||
7
Task/Here-document/Perl/here-document-6.pl
Normal file
7
Task/Here-document/Perl/here-document-6.pl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
sub flibbertigibbet {
|
||||
print <<~END;
|
||||
Mary had
|
||||
a little
|
||||
lamb
|
||||
END
|
||||
}
|
||||
38
Task/Here-document/Phix/here-document.phix
Normal file
38
Task/Here-document/Phix/here-document.phix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
string ts1 = """
|
||||
this
|
||||
"string"\thing"""
|
||||
|
||||
string ts2 = """this
|
||||
"string"\thing"""
|
||||
|
||||
string ts3 = """
|
||||
_____________this
|
||||
"string"\thing"""
|
||||
|
||||
string ts4 = `
|
||||
this
|
||||
"string"\thing`
|
||||
|
||||
string ts5 = `this
|
||||
"string"\thing`
|
||||
|
||||
string ts6 = `
|
||||
_____________this
|
||||
"string"\thing`
|
||||
|
||||
string ts7 = "this\n\"string\"\\thing"
|
||||
|
||||
constant tests={ts1,ts2,ts3,ts4,ts5,ts6,ts7}
|
||||
for i=1 to length(tests) do
|
||||
for j=1 to length(tests) do
|
||||
if tests[i]!=tests[j] then crash("error") end if
|
||||
end for
|
||||
end for
|
||||
printf(1,"""
|
||||
____________Everything
|
||||
(all %d tests)
|
||||
works
|
||||
just
|
||||
file.""",length(tests))
|
||||
printf(1,"""`""")
|
||||
printf(1,`"""`)
|
||||
9
Task/Here-document/PicoLisp/here-document.l
Normal file
9
Task/Here-document/PicoLisp/here-document.l
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
(out "file.txt" # Write to "file.txt"
|
||||
(prinl "### This is before the text ###")
|
||||
(here "TEXT-END")
|
||||
(prinl "### This is after the text ###") )
|
||||
"There must be some way out of here", said the joker to the thief
|
||||
"There's too much confusion, I can't get no relief"
|
||||
TEXT-END
|
||||
|
||||
(in "file.txt" (echo)) # Show "file.txt"
|
||||
17
Task/Here-document/PowerShell/here-document.psh
Normal file
17
Task/Here-document/PowerShell/here-document.psh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
$XMLdata=@"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
||||
<servicing>
|
||||
<package action="configure">
|
||||
<assemblyIdentity name="Microsoft-Windows-Foundation-Package" version="${strFullVersion}" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="" />
|
||||
<selection name="RemoteServerAdministrationTools" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Roles-AD" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Roles-AD-DS" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Roles-AD-DS-SnapIns" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Features-StorageManager" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Features-Wsrm" state="true" />
|
||||
</package>
|
||||
</servicing>
|
||||
<cpi:offlineImage cpi:source="wim:d:/2008r2wim/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
|
||||
</unattend>
|
||||
"@
|
||||
5
Task/Here-document/Python/here-document.py
Normal file
5
Task/Here-document/Python/here-document.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
print("""\
|
||||
Usage: thingy [OPTIONS]
|
||||
-h Display this usage message
|
||||
-H hostname Hostname to connect to
|
||||
""")
|
||||
61
Task/Here-document/REXX/here-document.rexx
Normal file
61
Task/Here-document/REXX/here-document.rexx
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*REXX program demonstrates a method to use "here" documents in REXX. */
|
||||
parse arg doc . /*"here" name is case sensitive. */
|
||||
|
||||
do j=1 for sourceline()
|
||||
if sourceline(j)\=='◄◄'doc then iterate
|
||||
do !=j+1 to sourceline() while sourceline(!)\=='◄◄.'
|
||||
say sourceline(!)
|
||||
end /*!*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
end /*j*/
|
||||
|
||||
say doc '"here" document not found.'
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────start of "here" docs──────────────────
|
||||
◄◄rs-232
|
||||
RS─232 Signals and Pinouts ┌─────────────────────────────────────────────────┐
|
||||
│13 12 11 10 9 8 7 6 5 4 3 2 1│
|
||||
──► Interface between data └┐ 25 24 23 22 21 20 19 18 17 16 15 14┌┘
|
||||
terminal equipment (DTE/male)└───────────────────────────────────────────────┘
|
||||
and data communication equipment
|
||||
[DCE/female] employing serial ┌───────────────────────────────────────────┐
|
||||
binary data interchange. │ 12◄─secondary carrier detect [SCD] DCE │
|
||||
┌─────────────────────────────────┤ 13◄─secondary clear to send [SCS] DCE │
|
||||
│ 1◄─protective ground [PG, GND] │ 14◄─secondary transmitted data [STD] DTE │
|
||||
│ 2◄─transmitted data [TD] DTE │ 15◄─transmit clock [TC] DCE │
|
||||
│ 3◄─received data [RD] DCE │ 16◄─secondary received data [SRD] DCE │
|
||||
│ 4◄─request to send [RTS] DTE │ 17◄─receiver clock [RC] DCE │
|
||||
│ 5◄─clear to send [CTS] DCE │ 18◄─unassigned │
|
||||
│ 6◄─data set ready [DSR] DCE │ 19◄─secondary request to send [SRS] DTE │
|
||||
│ 7◄─signal ground [SG] │ 20◄─data terminal ready [DTR] DTE │
|
||||
│ (common return) │ 21◄─signal quality detector [SQD] DCE │
|
||||
│ 8◄─carrier detect [CD] DCE │ 22◄─ring indicator [RI] DCE │
|
||||
│ 9◄─positive voltage [-] │ 23◄─data rate select [DRS] DCE/DTE │
|
||||
│10◄─negative voltage [-] │ 24◄─external clock [XTC] DTE │
|
||||
│11◄─unassigned │ 25◄─unassigned │
|
||||
└─────────────────────────────────┴───────────────────────────────────────────┘
|
||||
◄◄.
|
||||
◄◄can
|
||||
┌──────┐
|
||||
│ │
|
||||
│ ├┐
|
||||
│ ├┘
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │ ┌─────┐
|
||||
└──┬┬──┘ │┌───┐│
|
||||
││ ├┤ ├┤
|
||||
││ ┌───────────────┐ ││ ││
|
||||
││ ┌┴──────────────┬┘ └┤ ├┘
|
||||
│└───┤ │ └───┘
|
||||
└────┤ ┌──┘
|
||||
│ │
|
||||
└──┐ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└─────────┘
|
||||
◄◄.
|
||||
────────────────────────────────────end of "here" docs──────────────────*/
|
||||
8
Task/Here-document/Racket/here-document-1.rkt
Normal file
8
Task/Here-document/Racket/here-document-1.rkt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#lang racket/base
|
||||
|
||||
(displayln #<<EOF
|
||||
Blah blah blah
|
||||
with indentation intact
|
||||
and "free" \punctuations\
|
||||
EOF
|
||||
)
|
||||
20
Task/Here-document/Racket/here-document-2.rkt
Normal file
20
Task/Here-document/Racket/here-document-2.rkt
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#lang at-exp racket/base
|
||||
|
||||
(require scribble/text)
|
||||
|
||||
(define excited "!!!")
|
||||
(define (shout . text) @list{>>> @text <<<})
|
||||
|
||||
(output
|
||||
@list{Blah blah blah
|
||||
with indentation intact
|
||||
but respecting the indentation of
|
||||
the whole code
|
||||
and "free" \punctuations\
|
||||
and even string interpolation-like @excited
|
||||
but really @shout{any code}
|
||||
|
||||
})
|
||||
|
||||
(output @list|<<{And customizable delimiters
|
||||
so @foo{} is just plain text}>>|)
|
||||
6
Task/Here-document/Raku/here-document-1.raku
Normal file
6
Task/Here-document/Raku/here-document-1.raku
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
my $color = 'green';
|
||||
say qq :to 'END';
|
||||
some line
|
||||
color: $color
|
||||
another line
|
||||
END
|
||||
11
Task/Here-document/Raku/here-document-2.raku
Normal file
11
Task/Here-document/Raku/here-document-2.raku
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
my $contrived_example = 'Dylan';
|
||||
sub freewheelin() {
|
||||
print q :to 'QUOTE', '-- ', qq :to 'AUTHOR';
|
||||
I'll let you be in my dream,
|
||||
if I can be in yours.
|
||||
QUOTE
|
||||
Bob $contrived_example
|
||||
AUTHOR
|
||||
}
|
||||
|
||||
freewheelin;
|
||||
6
Task/Here-document/Raku/here-document-3.raku
Normal file
6
Task/Here-document/Raku/here-document-3.raku
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
my @a = <1 2 3 4>;
|
||||
say Q :array :to 'EOH';
|
||||
123 \n '"`
|
||||
@a$bc
|
||||
@a[]
|
||||
EOH
|
||||
11
Task/Here-document/Raven/here-document-1.raven
Normal file
11
Task/Here-document/Raven/here-document-1.raven
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
'Buffy the Vampire Slayer' as sender
|
||||
'Spike' as recipient
|
||||
|
||||
[
|
||||
"Dear %(recipient)s,
|
||||
"
|
||||
"I wish you to leave Sunnydale and never return.
|
||||
"
|
||||
"Not Quite Love,
|
||||
"%(sender)s
|
||||
] "\n" join print
|
||||
11
Task/Here-document/Raven/here-document-2.raven
Normal file
11
Task/Here-document/Raven/here-document-2.raven
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
'Buffy the Vampire Slayer' as sender
|
||||
'Spike' as recipient
|
||||
|
||||
group
|
||||
"Dear %(recipient)s,
|
||||
"
|
||||
"I wish you to leave Sunnydale and never return.
|
||||
"
|
||||
"Not Quite Love,
|
||||
%(sender)s\n"
|
||||
list "\n" join print
|
||||
11
Task/Here-document/Ring/here-document.ring
Normal file
11
Task/Here-document/Ring/here-document.ring
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
text ="
|
||||
<<'FOO'
|
||||
Now
|
||||
is
|
||||
the
|
||||
time
|
||||
for
|
||||
all
|
||||
good mem
|
||||
to come to the aid of their country."
|
||||
see text + nl
|
||||
6
Task/Here-document/Ruby/here-document-1.rb
Normal file
6
Task/Here-document/Ruby/here-document-1.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
address = <<END
|
||||
1, High Street,
|
||||
#{town_name},
|
||||
West Midlands.
|
||||
WM4 5HD.
|
||||
END
|
||||
5
Task/Here-document/Ruby/here-document-2.rb
Normal file
5
Task/Here-document/Ruby/here-document-2.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
pancake = <<"NO MORE INGREDIENTS"
|
||||
egg
|
||||
milk
|
||||
flour
|
||||
NO MORE INGREDIENTS
|
||||
5
Task/Here-document/Ruby/here-document-3.rb
Normal file
5
Task/Here-document/Ruby/here-document-3.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
x = <<'FOO'
|
||||
No
|
||||
#{interpolation}
|
||||
here
|
||||
FOO
|
||||
3
Task/Here-document/Ruby/here-document-4.rb
Normal file
3
Task/Here-document/Ruby/here-document-4.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
output = <<`BAR`
|
||||
ls /home
|
||||
BAR
|
||||
4
Task/Here-document/Ruby/here-document-5.rb
Normal file
4
Task/Here-document/Ruby/here-document-5.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
puts <<EOF + "lamb"
|
||||
Mary had
|
||||
a little
|
||||
EOF
|
||||
11
Task/Here-document/Run-BASIC/here-document.basic
Normal file
11
Task/Here-document/Run-BASIC/here-document.basic
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
text$ ="
|
||||
<<'FOO'
|
||||
Now
|
||||
is
|
||||
the
|
||||
time
|
||||
for
|
||||
all
|
||||
good mem
|
||||
to come to the aid of their country."
|
||||
print text$
|
||||
7
Task/Here-document/Rust/here-document.rust
Normal file
7
Task/Here-document/Rust/here-document.rust
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
let x = r#"
|
||||
This is a "raw string literal," roughly equivalent to a heredoc.
|
||||
"#;
|
||||
|
||||
let y = r##"
|
||||
This string contains a #.
|
||||
"##;
|
||||
3
Task/Here-document/SQL-PL/here-document-1.sql
Normal file
3
Task/Here-document/SQL-PL/here-document-1.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
db2 "select 'This is the first line.
|
||||
This is the second line.
|
||||
This is the third line.' from sysibm.sysdummy1"
|
||||
3
Task/Here-document/SQL-PL/here-document-2.sql
Normal file
3
Task/Here-document/SQL-PL/here-document-2.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
select 'This is the first line.' || chr(10) ||
|
||||
'This is the second line.' || chr(10) ||
|
||||
'This is the third line.' from sysibm.sysdummy1;
|
||||
5
Task/Here-document/SQL-PL/here-document-3.sql
Normal file
5
Task/Here-document/SQL-PL/here-document-3.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
select 'This is the first line.' from sysibm.sysdummy1
|
||||
union
|
||||
select 'This is the second line.' from sysibm.sysdummy1
|
||||
union
|
||||
select 'This is the third line.' from sysibm.sysdummy1;
|
||||
4
Task/Here-document/SQL-PL/here-document-4.sql
Normal file
4
Task/Here-document/SQL-PL/here-document-4.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
SET serveroutput ON
|
||||
CALL DBMS_OUTPUT.PUT_LINE('This is the first line.' || chr(10) ||
|
||||
'This is the second line.' || chr(10) ||
|
||||
'This is the third line.');
|
||||
27
Task/Here-document/Scala/here-document.scala
Normal file
27
Task/Here-document/Scala/here-document.scala
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
object temp {
|
||||
val MemoriesOfHolland=
|
||||
"""Thinking of Holland
|
||||
|I see broad rivers
|
||||
|slowly chuntering
|
||||
|through endless lowlands,
|
||||
|rows of implausibly
|
||||
|airy poplars
|
||||
|standing like tall plumes
|
||||
|against the horizon;
|
||||
|and sunk in the unbounded
|
||||
|vastness of space
|
||||
|homesteads and boweries
|
||||
|dotted across the land,
|
||||
|copses, villages,
|
||||
|couchant towers,
|
||||
|churches and elm-trees,
|
||||
|bound in one great unity.
|
||||
|There the sky hangs low,
|
||||
|and steadily the sun
|
||||
|is smothered in a greyly
|
||||
|iridescent smirr,
|
||||
|and in every province
|
||||
|the voice of water
|
||||
|with its lapping disasters
|
||||
|is feared and hearkened.""".stripMargin
|
||||
}
|
||||
4
Task/Here-document/Sed/here-document.sed
Normal file
4
Task/Here-document/Sed/here-document.sed
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
c\
|
||||
The commands 'a', 'c', and 'i' can be followed\
|
||||
by multi-line text. Each line break in the text\
|
||||
is preceded by a backslash.
|
||||
13
Task/Here-document/SenseTalk/here-document.sensetalk
Normal file
13
Task/Here-document/SenseTalk/here-document.sensetalk
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
set script to {{SCRIPT
|
||||
put "Script demonstrating block quotes"
|
||||
|
||||
set text to {{
|
||||
"I wish it need not have happened in my time," said Frodo.
|
||||
"So do I," said Gandalf, "and so do all who live to see such times. But that is not for them to decide. All we have to decide is what to do with the time that is given us."
|
||||
}}
|
||||
|
||||
put the number of occurrences of "time" in text --> 3
|
||||
|
||||
SCRIPT}}
|
||||
|
||||
do script
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue