Files
mercury/tests/hard_coded/write.exp
Julien Fischer a00e86be35 Escape all control characters in io.write, deconstruct.functor etc.
The above predicates currently escape all of the C0 control characters (+
Delete).  This change modifies them to escape all of the characters in the
Unicode category `Other,control' using backslash escapes when they exist and
octal escapes otherwise.

library/term_io.m:
    Do not treat C1 control characters as Mercury source characters.

    Re-order the list of Mercury punctuation characters by codepoint
    order; it is difficult to check for completion otherwise.

    Put a list of special characters escapes in order.

runtime/mercury_ml_expand_body.h:
library/rtti_implementation.m:
   Update the implementations of functor/4 to escape all control
   characters when returning the functor of a character.

library/deconstruct.m:
    Specify that functor/4 should escape all control characters in
    the value returned for characters and strings.  (XXX TODO: it
    currently doesn't implement the new behaviour for strings; I'll
    add that separately.)

library/io.m:
library/stream.string_writer.m:
    Similar to the above but for io.write etc.

tests/hard_coded/write.{m,exp}:
tests/hard_coded/deconstruct_arg.{m,exp,exp2}:
   Extend these tests to cover the block of C1 control characters
   and the boundaries around it.
2018-06-19 17:08:20 +10:00

87 lines
1018 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var("X") + int(3) * var("X^2") ; (type)
{ type }
{ '?-' }
'?-'
{ blah }
blah ; (type), (type) * blah ; (type)
((blah ; blah), blah) * blah ; blah
(type) * blah ; (type)
TESTING DISCRIMINATED UNIONS
one
two
three
apple([9, 5, 1])
banana([three, one, two])
zop(3.3, 2.03)
zip(3, 2)
zap(3, -2.111)
wombat
foo
TESTING POLYMORPHISM
poly_one([2399.3])
poly_two(3)
poly_three(3.33, 4, poly_one(9.11))
TESTING BUILTINS
""
"Hello, world\n"
"Foo%sFoo"
"\""
"\a\b\f\t\n\r\v\"\\"
"\001\\037\\177\\200\\237\ "
'a'
'A'
'&'
'\001\'
'\a'
'\b'
'\f'
'\t'
'\n'
'\r'
'\v'
'\037\'
' '
'\''
'\\'
'\"'
'~'
'\177\'
'\200\'
'\237\'
' '
0.0
3.14159
1.128324983e-21
2.23954899e+23
-infinity
infinity
-65
4
651u
-128i8
127i8
255u8
-32768i16
32767i16
65535u16
-2147483648i32
2147483647i32
4294967295u32
-9223372036854775808i64
9223372036854775807i64
18446744073709551615u64
univ_cons(["hi! I\'m a univ!"])
'<<predicate>>'
TESTING OTHER TYPES
var(1)
var_supply(0)
var_supply(1)
empty
qwerty(4)
array([1, 2, 3, 4])
version_array([1, 2, 3, 4])