Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
44
Task/Quoting-constructs/ALGOL-68/quoting-constructs.alg
Normal file
44
Task/Quoting-constructs/ALGOL-68/quoting-constructs.alg
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# literal strings are called string denotations in Algol 68 #
|
||||
|
||||
# string denotations start and end with a double quote character #
|
||||
# there can be 0 or more characters between the quotes #
|
||||
# within the quotes, any characters allowed by the implementation can appear #
|
||||
# If an embedded double quote is required, it should appear as two double quotes #
|
||||
# e.g.: #
|
||||
print( ( "String with an embedded "" character", newline ) );
|
||||
|
||||
# string denotations can appear anywhere an "expression" would be allowed, e.g.: #
|
||||
STRING x := "some text"; # string denotation used as an initial value #
|
||||
print( ( "quoted string", newline ) ); # string denotation used in a procedure call #
|
||||
print( ( "[[" + x + "]]", newline ) ); # string denotations used in an expression #
|
||||
|
||||
# note that technically, a single character within double quotes is a character denotation #
|
||||
# (character literal) not a string denotation, normally a character denotation will be #
|
||||
# automatically coerced to a string denotation if necessary. however it does mean that #
|
||||
# custom operators that have string parameters would also need to be defined for #
|
||||
# character parameters #
|
||||
# e.g.: #
|
||||
OP LENGTH = ( STRING a )INT: ( UPB a - LWB a ) + 1; # returns the length of a #
|
||||
# in order to make the following print "work", we need to also define : #
|
||||
OP LENGTH = ( CHAR a )INT: 1; # returns the length of a, which is always 1 #
|
||||
# ---- these are string denotations ------- #
|
||||
# vv vvvv vvvvv #
|
||||
print( ( LENGTH "", LENGTH "A", LENGTH "AB", LENGTH "BBC", newline ) );
|
||||
# ^^^ #
|
||||
# this is a character denotation #
|
||||
|
||||
# C-style escapes e.g.: \n, \", \123 are not supported #
|
||||
# ALGOL 68RS and algol68toc support "radix strings" where a string-denotation can be #
|
||||
# specified as e.g., hexadecimal codes: #
|
||||
# 16r" 0D 0A" is carriage-return line-feed #
|
||||
|
||||
# ALGOL 68 Genie allows string denotation to be continued across several lines #
|
||||
# if the lines end with \, the \ characters are not part of the string #
|
||||
# NB - this is not a standard feature of Algol 68 #
|
||||
print( ( "Hello\
|
||||
, \
|
||||
World\
|
||||
!" ) );
|
||||
|
||||
# Algol 68 does not have string-interpolation #
|
||||
SKIP
|
||||
18
Task/Quoting-constructs/Agena/quoting-constructs.agena
Normal file
18
Task/Quoting-constructs/Agena/quoting-constructs.agena
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Agena supports quoted strings, these can be used in expressions to represent literal
|
||||
# string values. A quoted string starts and ends with matching quote characters.
|
||||
# There are three possible quote characters: ', " and `
|
||||
# e.g.:
|
||||
local s1 := "an initial value";
|
||||
print( 's1 has ' & s1 & `...` );
|
||||
|
||||
# C-style escapes are supported within strings quoted with ' or "
|
||||
# Within a string quoted by ', embedded " characters need not be escaped
|
||||
# Within a string quoted by ", embedded ' characters need not be escaped
|
||||
# e.g.:
|
||||
print( "a\tb\tc" );
|
||||
print( '"double-quoted" text contained in a \' quoted string' );
|
||||
print( "'single-quoted' text contained in a \" quoted string" );
|
||||
|
||||
# Within ` quoted strings, C-style escapes are not processed, except \q which reprtesents `
|
||||
# e.g.:
|
||||
print( `Within \q...\q, these are not escape sequences: \t\\\"\n \012, \0x5f but this one is: \q` );
|
||||
10
Task/Quoting-constructs/EasyLang/quoting-constructs.easy
Normal file
10
Task/Quoting-constructs/EasyLang/quoting-constructs.easy
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
print "The computer says \"Hello world\".\n\t🙂"
|
||||
repeat
|
||||
s$ = input
|
||||
until error = 1
|
||||
print s$
|
||||
.
|
||||
print ""
|
||||
input_data
|
||||
The computer says "Hello world".
|
||||
🙂
|
||||
14
Task/Quoting-constructs/Fennel/quoting-constructs.fennel
Normal file
14
Task/Quoting-constructs/Fennel/quoting-constructs.fennel
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(local (s1 s3 s9 s1a)
|
||||
(values "This is a double-quoted 'string' with embedded single-quotes."
|
||||
"this is a double-quoted \"string\" with escaped double-quotes."
|
||||
"any \0 form \1 of \2 string \3 may \4 contain \5 raw \6 binary \7 data \xDB"
|
||||
"This is a double-quoted...
|
||||
...'string'...
|
||||
...with embedded single-quotes and newlines."
|
||||
)
|
||||
)
|
||||
(print s1)
|
||||
(print s3)
|
||||
(print s9)
|
||||
(print s1a)
|
||||
(print (.. "some raw binary:" "\t" (length s9) "\t" (s9:byte 5) "\t" (s9:byte 12) "\t" (s9:byte 17)))
|
||||
23
Task/Quoting-constructs/Pluto/quoting-constructs.pluto
Normal file
23
Task/Quoting-constructs/Pluto/quoting-constructs.pluto
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
s1 = "This is a double-quoted 'string' with embedded single-quotes."
|
||||
s2 = 'This is a single-quoted "string" with embedded double-quotes.'
|
||||
s3 = "this is a double-quoted \"string\" with escaped double-quotes."
|
||||
s4 = 'this is a single-quoted \'string\' with escaped single-quotes.'
|
||||
s5 = [[This is a long-bracket "'string'" with embedded single- and double-quotes.]]
|
||||
s6 = [=[This is a level 1 long-bracket ]]string[[ with [[embedded]] long-brackets.]=]
|
||||
s7 = [==[This is a level 2 long-bracket ]=]string[=[ with [=[embedded]=] level 1 long-brackets, etc.]==]
|
||||
s8 = [[This is
|
||||
a long-bracket string
|
||||
with embedded
|
||||
line feeds]]
|
||||
s9 = "any \0 form \1 of \2 string \3 may \4 contain \5 raw \6 binary \7 data \xDB"
|
||||
print(s1)
|
||||
print(s2)
|
||||
print(s3)
|
||||
print(s4)
|
||||
print(s5)
|
||||
print(s6)
|
||||
print(s7)
|
||||
print(s8)
|
||||
print(s9) -- with audible "bell" from \7 if supported by os
|
||||
print($'Pluto also has string-interpolation: {s1:replace("a double-quoted","an interpolated")}')
|
||||
print("some raw binary:", #s9, s9:byte(5), s9:byte(12), s9:byte(17))
|
||||
12
Task/Quoting-constructs/Rebol/quoting-constructs-1.rebol
Normal file
12
Task/Quoting-constructs/Rebol/quoting-constructs-1.rebol
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
foreach code [
|
||||
"1 + 1" ;; A plain string containing the text: 1 + 1
|
||||
{reduce ["1 + 1 =" 1 + 1]} ;; A string that, when loaded, will evaluate and build a block: ["1 + 1 =" 2]
|
||||
%{now}% ;; A raw string containing the text: now
|
||||
][
|
||||
;; PRINT outputs a sequence of values:
|
||||
;; code -> the raw value being iterated over
|
||||
;; "-->" -> a literal string arrow
|
||||
;; mold do code -> DO evaluates 'code' as Rebol code.
|
||||
;; MOLD converts the result into a textual representation
|
||||
print [code "-->" mold do code]
|
||||
]
|
||||
22
Task/Quoting-constructs/Rebol/quoting-constructs-2.rebol
Normal file
22
Task/Quoting-constructs/Rebol/quoting-constructs-2.rebol
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"tab is: ^-" ;; A string literal in double quotes.
|
||||
;; ^- inside a string is an escape for the TAB character in Rebol.
|
||||
;; So this represents: tab is: <tab>
|
||||
|
||||
"double-quote is: ^""" ;; String literal containing a double quote character.
|
||||
;; In Rebol strings, ^" is an escape sequence for a literal quote.
|
||||
;; This yields: double-quote is: "
|
||||
|
||||
{double-quote is: "} ;; String literal in curly braces { }.
|
||||
;; Inside { }, double quotes don't need escaping.
|
||||
;; This simply yields: double-quote is: "
|
||||
|
||||
"foo {" ;; String literal in double quotes that contains an opening brace {.
|
||||
;; In double-quoted strings, braces are just characters, no special meaning.
|
||||
;; Yields: foo {
|
||||
|
||||
{foo ^{} ;; String literal in curly braces containing an opening brace {.
|
||||
;; In { }, the sequence ^{ is an escape for the brace.
|
||||
;; Otherwise an unescaped } would end the string.
|
||||
;; Yields: foo {
|
||||
;; Additionally in Rebol 3:
|
||||
%%{raw string don't needs escapes for " or {}%%
|
||||
13
Task/Quoting-constructs/Uiua/quoting-constructs.uiua
Normal file
13
Task/Quoting-constructs/Uiua/quoting-constructs.uiua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"Just a string"
|
||||
# String interpolation. \ is a general escape character.
|
||||
$"_ _ _ _ _ \_" 1 @a @\" @@ "asd"
|
||||
|
||||
# multiline
|
||||
$ multi
|
||||
$ lines
|
||||
$ " ' @ \ ! $ _ are all allowed
|
||||
|
||||
# multiline with interpolation
|
||||
"ple" "...."
|
||||
$$ multi_
|
||||
$$ _lines
|
||||
Loading…
Add table
Add a link
Reference in a new issue