poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] pkl: add `\r\n' sequence to newline definition


From: Mohammad-Reza Nabipoor
Subject: [PATCH v2] pkl: add `\r\n' sequence to newline definition
Date: Sat, 9 Sep 2023 21:28:59 +0330

2023-09-09  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>

        * libpoke/pkl-lex.l (NEWLINE): Add `\r\n' sequence to newline
        definition.
        * doc/poke.texi (The Poke Language): Add a new section `Source Code
        Encoding'.
---
 ChangeLog         |  7 +++++++
 doc/poke.texi     | 11 +++++++++++
 libpoke/pkl-lex.l |  2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 83c51e09..e5669b86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-09-09  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
+
+       * libpoke/pkl-lex.l (NEWLINE): Add `\r\n' sequence to newline
+       definition.
+       * doc/poke.texi (The Poke Language): Add a new section `Source Code
+       Encoding'.
+
 2023-09-08  Jose E. Marchesi  <jemarch@gnu.org>
 
        * libpoke/pkl-typify.c (pkl_typify1_ps_trimmer): The type of the
diff --git a/doc/poke.texi b/doc/poke.texi
index c9b89b20..4f8f1923 100644
--- a/doc/poke.texi
+++ b/doc/poke.texi
@@ -9487,6 +9487,7 @@ The IO space to where write the scrabbled data.  Defaults 
to
 @chapter The Poke Language
 
 @menu
+* Source Code Encoding::        Encoding of Poke source file.
 * Integers::                   Whole numbers.
 * Offsets::                    Memory sizes and offsets.
 * Strings::                    NULL-terminated strings.
@@ -9512,6 +9513,16 @@ The IO space to where write the scrabbled data.  
Defaults to
 * Debugging::                   Debugging Poke programs.
 @end menu
 
+@node Source Code Encoding
+@section Source Code Encoding
+@cindex source code encoding
+
+@code{poke} reads program source as UTF-8 encoded text.  Program sources
+can span over multiple lines.  A line is a sequence of characters
+terminated by an end-of-line.  End-of-line can be a signle new-line
+character (ASCII LF or @code{\n}), the UNIX form, or pair of ASCII CR
+and ASCII LF (@code{\r\n}) characters, the Windows form.
+
 @node Integers
 @section Integers
 @cindex integers
diff --git a/libpoke/pkl-lex.l b/libpoke/pkl-lex.l
index 283bacd5..0af3406a 100644
--- a/libpoke/pkl-lex.l
+++ b/libpoke/pkl-lex.l
@@ -189,7 +189,7 @@ build_overflow_error_msg (uint64_t value, int width)
 
 %}
 
-NEWLINE            \n
+NEWLINE            (\r\n)|\n
 BLANK              [ \t]
 LETTER             [a-zA-Z]
 FIELD_NAME         {LETTER}[a-zA-Z0-9_]*
-- 
2.42.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]