atom / language-c

C support in Atom
Other
118 stars 153 forks source link

Function-like calls break string formatting inside parentheses #309

Open Siguza opened 5 years ago

Siguza commented 5 years ago

Prerequisites

Description / Steps to Reproduce

Let's start with this code:

__asm__
(
    "_func:\n"

    "orr x2, x2, " M1(M2(2)) "\n"
    "nop\n"
);

This renders as I would expect:

screen shot 2018-11-21 at 13 03 30

Add one empty line and the formatting of M1 and M2 changes from beige to red (my color for constants):

screen shot 2018-11-21 at 13 03 49

Add another line and string formatting breaks after the nested macro invocation:

screen shot 2018-11-21 at 13 04 04

Some arbitrary changes seem to bypass this issue, like adding spaces before the parentheses, or having just one function-like expression:

screen shot 2018-11-21 at 13 06 20 screen shot 2018-11-21 at 13 06 37 screen shot 2018-11-21 at 13 30 26

Additional info:

Another test case:

some_identifier_that_is_way_longer_than_any_sane_person_would_ever_make_it_of_their_own_free_will
(
    "_func:\n"
    "nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n"
    "nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n"
    "nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n"
    "nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n"
    "orr x2, x2, " M1(M2(2)) "\n"
    "nop\n"
);

Result:

screen shot 2018-11-21 at 13 43 24

Versions

OS: macOS High Sierra 10.13.6 (17G3025)

$ atom --version
Atom    : 1.32.2
Electron: 2.0.9
Chrome  : 61.0.3163.100
Node    : 8.9.3
$ apm --version
apm  2.1.2
npm  6.2.0
node 8.9.3 x64
atom 1.32.2
python 2.7.10
git 2.17.2

language-c package version: 0.60.13

rsese commented 5 years ago

Thanks for the report! I can reproduce on macOS 10.12.6 with 1.35.0-nightly1.