atom/language-php

Unclosed parentheses in MySQL string breaks highlighting

Opened this issue · 1 comments

Prerequisites

Description

Failing to close parentheses in a MySQL string causes syntax highlighting to break (it remains in "string" mode).

Steps to Reproduce

  1. Create a new file with the contents:
    <?php
    
    // Unclosed parentheses break highlighting
    echo "SELECT ()"; // This is a comment :)
    echo "SELECT ( "; // This is a comment? Hack to fix: ")";
    
    // Closing parentheses in different type of quote breaks highlighting
    echo "SELECT (".")"; // This is a comment :)
    echo "SELECT (".')'; // This is a comment? Hack to fix: ")";
  2. Change the syntax highlighting mode to "PHP"

Expected behavior:

  • Comments in all four examples should all highlight as comments
  • First semicolon in each example should highlight as such
  • Closing parenthesis in last example (echo "SELECT (".')'; ///...) should highlight as a closing parentheses (or a basic string if saving state between MySQL statements proves difficult)
  • Period in third and fourth examples should highlight as such

Actual behavior:

  • First semicolon and comments in second and fourth example are highlighted as strings
  • Closing parenthesis in fourth example is highlighted as a normal string
  • Period in third and fourth examples is highlighted as a string

Reproduces how often:

100%

Versions

$ atom --version
Atom    : 1.41.0
Electron: 4.2.7
Chrome  : 69.0.3497.128
Node    : 10.11.0

$ apm --version
apm  2.4.3
npm  6.2.0
node 10.2.1 x64
atom 1.41.0
python 2.7.17rc1
git 2.20.1

OS: Pop!_OS 19.10

Additional Information

Oh, forgot to add: this may be related to #331