-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support of escape sequences #125
Conversation
Would it be possible to add intentionally malformed escape sequences for the test cases? |
Currently, we could add the test cases with syntax errors to
|
* false - otherwise. | ||
*/ | ||
static bool | ||
is_line_terminator (ecma_char_t c) /**< character */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this check too in the RegExp engine. Please declare it in a header, so we don't have to duplicate it. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
LGTM. |
@galpeter please check the PR. |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add test cases for different string escapes: \t \n \r \b ...
as described in the http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4 SingleEscapeCharacter rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
24b7d67
to
d379aff
Compare
@galpeter, @LaszloLango, I've updated pull request. |
…ings contained in source code buffer) to lexer token. JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
d379aff
to
8dd45eb
Compare
break; | ||
} | ||
|
||
converted_char = (ecma_char_t) char_code; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving discussion from commit notes (d379aff) to the pull request note.
@galpeter: This will convert the unit32_t to unit8_t or unit16_t is this really what we wanted? I know that we don't have full unicode support for know. Maybe a comment to describe why is this good?
@ruben-ayrapetyan
In CONFIG_ECMA_CHAR_ASCII mode this would convert to uint8_t, ignoring high part of unicode byte pair;
and in CONFIG_ECMA_CHAR_UTF16 mode this would convert to uint16_t.
Would the comment with the text above be ok?
Maybe it is better to use uint16_t instead of uint32_t here?@galpeter
Will this change after we have full unicode support?@ruben-ayrapetyan
The function's code would definitely be changed, but the idea probably would be the same, i.e.:
ecma_char_t would be uint8_t for ascii mode, and uint16_t - for utf16.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the comment is ok & we should use uint16_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I'll add the comment and change the type according to your request.
Other parts looks good to me. |
…UL>") character and cases that depend on Unicode support. JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
8dd45eb
to
8b28cac
Compare
Ok, |
Support of escape sequences with the exception of '\0' character and cases that depend on Unicode support.
Related issue: #50