This repository has been archived on 2024-06-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
coffee.pygments/tests/examplefiles/clay/example.clay
Oleh Prypin 6f43092173
Also add auto-updatable output-based tests to examplefiles (#1689)
Co-authored-by: Georg Brandl <georg@python.org>
2021-01-20 10:48:45 +01:00

33 lines
781 B
Text
Raw Permalink 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.

/// @section StringLiteralRef
record StringLiteralRef (
sizep : Pointer[SizeT],
);
/// @section predicates
overload ContiguousSequence?(#StringLiteralRef) : Bool = true;
[s when StringLiteral?(s)]
overload ContiguousSequence?(#Static[s]) : Bool = true;
/// @section size, begin, end, index
forceinline overload size(a:StringLiteralRef) = a.sizep^;
forceinline overload begin(a:StringLiteralRef) : Pointer[Char] = Pointer[Char](a.sizep + 1);
forceinline overload end(a:StringLiteralRef) = begin(a) + size(a);
[I when Integer?(I)]
forceinline overload index(a:StringLiteralRef, i:I) : ByRef[Char] {
assert["boundsChecks"](i >= 0 and i < size(a), "StringLiteralRef index out of bounds");
return ref (begin(a) + i)^;
}
foo() = """
long\tlong
story
"""