@@ -41,7 +41,7 @@ JERRY_STATIC_ASSERT (LEXER_NUMBER_BINARY > LEXER_NUMBER_OCTAL,
4141/**
4242 * Check whether the UTF-8 intermediate is an octet or not
4343 */
44- #define IS_UTF8_INTERMEDIATE_OCTET (byte ) (((byte) &LIT_UTF8_EXTRA_BYTE_MASK) == LIT_UTF8_2_BYTE_CODE_POINT_MIN)
44+ #define IS_UTF8_INTERMEDIATE_OCTET (byte ) (((byte) & LIT_UTF8_EXTRA_BYTE_MASK) == LIT_UTF8_2_BYTE_CODE_POINT_MIN)
4545
4646/**
4747 * Align column to the next tab position.
@@ -381,6 +381,29 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
381381 }
382382} /* lexer_skip_spaces */
383383
384+ /**
385+ * Checks the next token start character.
386+ *
387+ * @return LIT_INVALID_CP - if there is no more characters to read
388+ * next byte - otherwise
389+ */
390+ lit_code_point_t
391+ lexer_peek_next_character (parser_context_t * context_p ) /**< context */
392+ {
393+ if (!(context_p -> token .flags & LEXER_NO_SKIP_SPACES ))
394+ {
395+ lexer_skip_spaces (context_p );
396+ context_p -> token .flags = (uint8_t ) (context_p -> token .flags | LEXER_NO_SKIP_SPACES );
397+ }
398+
399+ if (context_p -> source_p < context_p -> source_end_p )
400+ {
401+ return context_p -> source_p [0 ];
402+ }
403+
404+ return LIT_INVALID_CP ;
405+ } /* lexer_check_next_character */
406+
384407/**
385408 * Skip all the continuous empty statements.
386409 */
@@ -418,10 +441,7 @@ typedef struct
418441 * @{
419442 * Keyword defines
420443 */
421- #define LEXER_KEYWORD (name , type ) \
422- { \
423- (const uint8_t *) (name), (type) \
424- }
444+ #define LEXER_KEYWORD (name , type ) { (const uint8_t *) (name), (type) }
425445#define LEXER_KEYWORD_LIST_LENGTH (name ) (const uint8_t) (sizeof ((name)) / sizeof ((name)[0]))
426446/** @} */
427447
@@ -1738,6 +1758,13 @@ lexer_next_token (parser_context_t *context_p) /**< context */
17381758 length = 2 ;
17391759 break ;
17401760 }
1761+ if (context_p -> source_p [1 ] == (uint8_t ) LIT_CHAR_DOT
1762+ && (length < 3 || !lit_char_is_decimal_digit (context_p -> source_p [2 ])))
1763+ {
1764+ context_p -> token .type = LEXER_QUESTION_MARK_DOT ;
1765+ length = 2 ;
1766+ break ;
1767+ }
17411768 }
17421769
17431770 context_p -> token .type = LEXER_QUESTION_MARK ;
0 commit comments