From 5708644933b364ffbcc625c2010e051ca031e867 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sat, 24 Apr 2021 17:52:10 +0900 Subject: Add code point expression (Meet RL1.1 of UTS #18) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit \u{hex string} matches a character has the code point represented by the hex string. For instance, \u{3042} matches hiragana あ (U+3042). The hex string must have 4 or 6 digits. This feature meets RL1.1 of UTS #18. RL1.1 Hex Notation: https://unicode.org/reports/tr18/#RL1.1 --- compiler/syntax_error.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'compiler/syntax_error.go') diff --git a/compiler/syntax_error.go b/compiler/syntax_error.go index be2dc38..df8977d 100644 --- a/compiler/syntax_error.go +++ b/compiler/syntax_error.go @@ -20,6 +20,7 @@ var ( // lexical errors synErrIncompletedEscSeq = newSyntaxError("incompleted escape sequence; unexpected EOF following \\") synErrInvalidEscSeq = newSyntaxError("invalid escape sequence") + synErrInvalidCodePoint = newSyntaxError("code points must consist of just 4 or 6 hex digits") // syntax errors synErrUnexpectedToken = newSyntaxError("unexpected token") @@ -34,4 +35,6 @@ var ( synErrBExpUnclosed = newSyntaxError("unclosed bracket expression") synErrBExpInvalidForm = newSyntaxError("invalid bracket expression") synErrRangeInvalidOrder = newSyntaxError("a range expression with invalid order") + synErrCPExpInvalidForm = newSyntaxError("invalid code point expression") + synErrCPExpOutOfRange = newSyntaxError("a code point must be between U+0000 to U+10FFFF") ) -- cgit v1.2.3