diff --git a/README.md b/README.md index b5edcc780..7bfd6bbee 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ What does Prog8 provide? - fast execution speed due to compilation to native assembly code. It's possible to write certain raster interrupt 'demoscene' effects purely in Prog8. - modularity, symbol scoping, subroutines - various data types other than just bytes (16-bit words, floats, strings) +- Strings can contain excaped characters but also many symbols directly if they have a petscii equivalent, such as "♠♥♣♦π▚●○╳". Characters like ^, _, \, {, } and | are also accepted and converted to the closest petscii equivalents. - automatic static variable allocations, automatic string and array variables and string sharing - subroutines with input parameters and result values - high-level program optimizations diff --git a/docs/source/index.rst b/docs/source/index.rst index 7e51a9bba..855e5cb4e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -56,6 +56,7 @@ Language features - Variables are allocated statically - Nested subroutines can access variables from outer scopes to avoids the overhead to pass everything via parameters - Variable data types include signed and unsigned bytes and words, arrays, strings and floats. +- Strings can contain excaped characters but also many symbols directly if they have a petscii equivalent, such as "♠♥♣♦π▚●○╳". Characters like ^, _, \\, {, } and | are also accepted and converted to the closest petscii equivalents. - High-level code optimizations, such as const-folding, expression and statement simplifications/rewriting. - Many built-in functions, such as ``sin``, ``cos``, ``rnd``, ``abs``, ``min``, ``max``, ``sqrt``, ``msb``, ``rol``, ``ror``, ``swap``, ``sort`` and ``reverse`` - Programs can be run multiple times without reloading because of automatic variable (re)initializations. diff --git a/docs/source/syntaxreference.rst b/docs/source/syntaxreference.rst index ce603a242..cf21096dc 100644 --- a/docs/source/syntaxreference.rst +++ b/docs/source/syntaxreference.rst @@ -425,6 +425,9 @@ There are several escape sequences available to put special characters into your - ``\uHHHH`` - a unicode codepoint \u0000 - \uffff (16-bit hexadecimal) - ``\xHH`` - 8-bit hex value that will be copied verbatim *without encoding* +- String literals can contain many symbols directly if they have a petscii equivalent, such as "♠♥♣♦π▚●○╳". + Characters like ^, _, \\, {, } and | (that have no direct PETSCII counterpart) are still accepted and converted to the closest PETSCII equivalents. (Make sure you save the source file in UTF-8 encoding if you use this.) + Operators --------- diff --git a/examples/test.p8 b/examples/test.p8 index 4aad839ca..42a9c65ca 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -5,12 +5,7 @@ main { sub start() { - txt.print("^\n") - txt.print("_\n") - txt.print("{\n") - txt.print("}\n") - txt.print("|\n") - txt.print("\\\n") + txt.print("♠♥♣♦π▚●○╳") } }