Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Function-like calls break string formatting inside parentheses #309

Open
1 task done
Siguza opened this issue Nov 21, 2018 · 1 comment
Open
1 task done

Function-like calls break string formatting inside parentheses #309

Siguza opened this issue Nov 21, 2018 · 1 comment

Comments

@Siguza
Copy link

Siguza commented Nov 21, 2018

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:

  • The __asm__ part can be any identifier, but its length seems to be related to how many newlines are required for string formatting to break.
  • The lines before the function-like expression don't have to be empty, and having content on them makes the required number of lines smaller before string formatting starts to break.
  • M1 and M2 don't have to be macros (i.e. all-uppercase). Any function-like expression will work.
  • This only happens with C and C++ grammars, but not with Objective-C or Objective-C++.

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
Copy link

rsese commented Nov 30, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants