nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix syntax highlighting regex of C labels


From: Hussam al-Homsi
Subject: Re: [PATCH] Fix syntax highlighting regex of C labels
Date: Sat, 13 Mar 2021 15:34:46 -0500

C++ slipped my mind. Sorry.
Fixing :: is easy, but fixing the range-based for statement seems impossible.
So because the labels syntax highlighting for both languages is coupled, and because the latter of them seems broken and unfixable, I suggest dropping it.
Doing that also fixes colored : at the end of stuff like default: and private:

i guess the current style encourages you to not write labels like that

Syntax highlighting should constrain syntax, not style.

On Fri, Mar 12, 2021 at 11:18 PM Mike Frysinger <vapier@gentoo.org> wrote:
On 12 Mar 2021 17:58, Hussam al-Homsi wrote:
> With this patch, a valid label like label1 in the following C code will now
> be highlighted:
>
> #include <stdio.h>
>
> int main(void) {
>
> goto label1;
>
> puts("skipped"); label1 : puts("reached");
>
> }
>
> The changes that enable this are described in the attached patch.

this handles C++ very very poorly :)

bool GetUserCrashDirectories(
    org::chromium::SessionManagerInterfaceProxyInterface* session_manager_proxy,
    std::vector<base::FilePath>* directories) {
  directories->clear();

  brillo::ErrorPtr error;
  std::map<std::string, std::string> sessions;
  session_manager_proxy->RetrieveActiveSessions(&sessions, &error);

  if (error) {
    LOG(ERROR) << "Error calling D-Bus proxy call to interface "
               << "'" << session_manager_proxy->GetObjectPath().value()
               << "': " << error->GetMessage();
    return false;
  }

  for (auto iter : sessions) {
    directories->push_back(
        paths::Get(brillo::cryptohome::home::GetHashedUserPath(iter.second)
                       .Append("crash")
                       .value()));
  }

  return true;
}

i guess the current style encourages you to not write labels like that
-mike

reply via email to

[Prev in Thread] Current Thread [Next in Thread]