diff --git a/SQL/MySQL.sublime-syntax b/SQL/MySQL.sublime-syntax index 9357806dfe..6bec5d2a8b 100644 --- a/SQL/MySQL.sublime-syntax +++ b/SQL/MySQL.sublime-syntax @@ -597,7 +597,10 @@ contexts: dml-statements: - meta_append: true - include: index-hint-lists - - match: \b(?i:insert(\s+(?:ignore\s+)?into)?)\b + - match: \b(?i:insert(?:\s+ignore)?(?:\s+into)?)\b + scope: keyword.other.dml.sql + push: expect-table-name + - match: \b(?i:replace\s+(?:into)?)\b scope: keyword.other.dml.sql push: expect-table-name - match: \b(?i:limit)\b diff --git a/SQL/tests/syntax/syntax_test_mysql.sql b/SQL/tests/syntax/syntax_test_mysql.sql index bc1ff92d5d..ff8a00c15e 100644 --- a/SQL/tests/syntax/syntax_test_mysql.sql +++ b/SQL/tests/syntax/syntax_test_mysql.sql @@ -4651,3 +4651,35 @@ EXPLAIN ANALYZE FORMAT=TREE SELECT * FROM t3 WHERE pk > 17; CREATE USER 'read' IDENTIFIED BY 'toor'; GRANT SELECT ON * . * TO 'read'; FLUSH PRIVILEGES; + + +REPLACE INTO test2 VALUES (1, 'Old', '2014-08-20 18:47:00'); +-- ^^^^^^^^^ keyword.other.dml +-- ^^^^^ meta.table-name +-- ^^^^^^ keyword.other +REPLACE test2 VALUES (1, 'Old', '2014-08-20 18:47:00'); +-- ^^^^ keyword.other.dml +-- ^^^^^ meta.table-name +-- ^^^^^^ keyword.other + +INSERT IGNORE INTO users_partners (uid,pid) VALUES (1,1); +-- ^^^^^^^^^^^^^^^ keyword.other.dml +-- ^^^^^^^^^^^^^^ meta.table-name +-- ^^^^^^^^^ meta.group +-- ^ punctuation.section.group.begin +-- ^^^ meta.column-name +-- ^ punctuation.separator.sequence +-- ^^^ meta.column-name +-- ^ punctuation.section.group.end +-- ^^^^^^ keyword.other +-- ^^^^^ meta.group +-- ^ punctuation.section.group.begin +-- ^ meta.number.integer.decimal constant.numeric.value +-- ^ punctuation.separator.sequence +-- ^ meta.number.integer.decimal constant.numeric.value +-- ^ punctuation.section.group.end +-- ^ punctuation.terminator.statement + +INSERT IGNORE users_partners (uid,pid) VALUES (1,1); +-- ^^^^^^^^^^ keyword.other.dml +-- ^^^^^^^^^^^^^^ meta.table-name