aboutsummaryrefslogtreecommitdiff
path: root/compiler/syntax_error.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-04-24 17:52:10 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-04-24 23:32:55 +0900
commit5708644933b364ffbcc625c2010e051ca031e867 (patch)
tree53c458938cd685b7c77a3d638920a083effc7dee /compiler/syntax_error.go
parentAdd validation of lexical specs and improve error messages (diff)
downloadtre-5708644933b364ffbcc625c2010e051ca031e867.tar.gz
tre-5708644933b364ffbcc625c2010e051ca031e867.tar.xz
Add code point expression (Meet RL1.1 of UTS #18)
\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
Diffstat (limited to 'compiler/syntax_error.go')
-rw-r--r--compiler/syntax_error.go3
1 files changed, 3 insertions, 0 deletions
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")
)