Replies: 8 comments 2 replies
-
We'll have to create a composite grammar from the parts specified in the spec issue and https://tc39.es/ecma262/#prod-Pattern. Some requirements not in grammar are as in ECMAScript spec. |
Beta Was this translation helpful? Give feedback.
-
Extracting from ballerina-platform/ballerina-spec#1132 (comment)
|
Beta Was this translation helpful? Give feedback.
-
@lasinicl lets add few regexp samples supported with the mentioned syntax |
Beta Was this translation helpful? Give feedback.
-
Some examples supported with the new syntax
|
Beta Was this translation helpful? Give feedback.
-
The regexp syntax will be translated to Java syntax. But there are some differences as explained in ballerina-platform/ballerina-spec#1125 (comment). |
Beta Was this translation helpful? Give feedback.
-
Feature merged through #37916 |
Beta Was this translation helpful? Give feedback.
-
Pending tasks
|
Beta Was this translation helpful? Give feedback.
-
This consists of 4 sub-tasks.
lang.string
1. Specifying regular expression syntax and semantics
The syntax for a regular expression is as follows.
u
RegExp flag - https://tc39.es/ecma262/#sec-parsepattern\p
and\P
depend on unicode 10.
matches any character other than LF (0xA) and CR (0xD)\s
matches TAB (0x9), SPACE (0x20), LF (0xA) and CR (0xD); (as in ECMAScript,\S
matches any character not matched by\s
)ReAtom
can occur, and effectively surround the inserted regexp with(?:
and)
ReFlagsOnOff
,m
,s
andi
flags correspond to flags specified in ECMAScript after the closing/
. But the flags apply only within the scope of the group in which the flags are specified. Thex
flag causes whitespace outside character classes (which should be Ballerina white space) and comments (starting with#
and continuing to the end of the line) to be ignored as the regexp is parsed (this allows a complex regexp to be broken up over multiple lines).Please share your thoughts on this.
Note: Details on the other subtasks will be updated in due course.
Beta Was this translation helpful? Give feedback.
All reactions