diff options
| author | Stepan Koltsov <yozh@mx1.ru> | 2013-04-04 01:45:46 +0400 |
|---|---|---|
| committer | Stepan Koltsov <yozh@mx1.ru> | 2013-04-04 01:45:46 +0400 |
| commit | da36a257dcec00a797b0b2164e032107f8f00a91 (patch) | |
| tree | ac46a05bd269c133ca165c6e53dbe146a8490aa8 /tests/examplefiles/example.clay | |
| parent | e71998052c832120301e56ed799f0ea77207354a (diff) | |
| download | pygments-da36a257dcec00a797b0b2164e032107f8f00a91.tar.gz | |
Lexer for Clay programming language.
https://github.com/jckarter/clay/
Diffstat (limited to 'tests/examplefiles/example.clay')
| -rw-r--r-- | tests/examplefiles/example.clay | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/examplefiles/example.clay b/tests/examplefiles/example.clay new file mode 100644 index 00000000..784752c6 --- /dev/null +++ b/tests/examplefiles/example.clay @@ -0,0 +1,33 @@ + +/// @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 +""" |
