diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-04-30 01:54:02 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-04-30 01:54:02 +0900 |
commit | 43fdbf94ad87ea91a173c72688cad70a0a5f1ab4 (patch) | |
tree | 655f651e39f13b5e415445d1ef24f4ecb7511041 /compiler/syntax_error.go | |
parent | Add code point expression (Meet RL1.1 of UTS #18) (diff) | |
download | tre-43fdbf94ad87ea91a173c72688cad70a0a5f1ab4.tar.gz tre-43fdbf94ad87ea91a173c72688cad70a0a5f1ab4.tar.xz |
Add character property expression (Meet RL1.2 of UTS #18 partially)
\p{property name=property value} matches a character has the property.
When the property name is General_Category, it can be omitted.
That is, \p{Letter} equals \p{General_Category=Letter}.
Currently, only General_Category is supported.
This feature meets RL1.2 of UTS #18 partially.
RL1.2 Properties: https://unicode.org/reports/tr18/#RL1.2
Diffstat (limited to 'compiler/syntax_error.go')
-rw-r--r-- | compiler/syntax_error.go | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/compiler/syntax_error.go b/compiler/syntax_error.go index df8977d..d784995 100644 --- a/compiler/syntax_error.go +++ b/compiler/syntax_error.go @@ -18,23 +18,26 @@ func (e *SyntaxError) Error() string { 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") + 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") + synErrCharPropInvalidSymbol = newSyntaxError("invalid character property symbol") // syntax errors - synErrUnexpectedToken = newSyntaxError("unexpected token") - synErrNullPattern = newSyntaxError("a pattern must be a non-empty byte sequence") - synErrAltLackOfOperand = newSyntaxError("an alternation expression must have operands") - synErrRepNoTarget = newSyntaxError("a repeat expression must have an operand") - synErrGroupNoElem = newSyntaxError("a grouping expression must include at least one character") - synErrGroupUnclosed = newSyntaxError("unclosed grouping expression") - synErrGroupNoInitiator = newSyntaxError(") needs preceding (") - synErrGroupInvalidForm = newSyntaxError("invalid grouping expression") - synErrBExpNoElem = newSyntaxError("a bracket expression must include at least one character") - 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") + synErrUnexpectedToken = newSyntaxError("unexpected token") + synErrNullPattern = newSyntaxError("a pattern must be a non-empty byte sequence") + synErrAltLackOfOperand = newSyntaxError("an alternation expression must have operands") + synErrRepNoTarget = newSyntaxError("a repeat expression must have an operand") + synErrGroupNoElem = newSyntaxError("a grouping expression must include at least one character") + synErrGroupUnclosed = newSyntaxError("unclosed grouping expression") + synErrGroupNoInitiator = newSyntaxError(") needs preceding (") + synErrGroupInvalidForm = newSyntaxError("invalid grouping expression") + synErrBExpNoElem = newSyntaxError("a bracket expression must include at least one character") + 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") + synErrCharPropExpInvalidForm = newSyntaxError("invalid character property expression") + synErrCharPropUnsupported = newSyntaxError("unsupported character property") ) |