yasuyuky/autocomplete-clang

Uncaught SyntaxError: Invalid regular expression: /^Dumping\s(?:[A-Za-z_]*::)*?):/: Unmatched ')'

Closed this issue · 2 comments

jchia commented

Navigated some C++14 code, pressed F3 on something. No matter how to repro, the 'Dumping' regex just looks wrong with unbalanced parantheses.

Atom Version: 1.7.3
System: "Fedora release
Thrown From: autocomplete-clang package, v0.9.3

Stack Trace

Uncaught SyntaxError: Invalid regular expression: /^Dumping\s(?:[A-Za-z_]::)?):/: Unmatched ')'

At /home/jchia/.atom/packages/autocomplete-clang/lib/autocomplete-clang.coffee:172

SyntaxError: Invalid regular expression: /^Dumping\s(?:[A-Za-z_]*::)*?):/: Unmatched ')'
    at new RegExp (native)
    at RegExp (native)
    at Object.module.exports.parseAstDump (/home/jchia/.atom/packages/autocomplete-clang/lib/autocomplete-clang.coffee:172:31)
    at Object.module.exports.handleGoDeclarationResult (/home/jchia/.atom/packages/autocomplete-clang/lib/autocomplete-clang.coffee:153:15)
    at exit (/home/jchia/.atom/packages/autocomplete-clang/lib/autocomplete-clang.coffee:89:18)
    at triggerExitCallback (/usr/share/atom/resources/app.asar/src/buffered-process.js:215:47)
    at /usr/share/atom/resources/app.asar/src/buffered-process.js:229:18
    at Socket.<anonymous> (/usr/share/atom/resources/app.asar/src/buffered-process.js:100:18)
    at emitOne (events.js:82:20)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)

Commands

     -1:10.9.0 core:undo (atom-text-editor.editor.is-focused)
     -1:09.8.0 core:move-right (atom-text-editor.editor.is-focused)
     -1:09.4.0 core:move-left (atom-text-editor.editor.is-focused)
     -1:09.1.0 core:move-right (atom-text-editor.editor.is-focused)
  2x -0:41.2.0 core:move-left (atom-text-editor.editor.is-focused)
  4x -0:40.8.0 core:select-left (atom-text-editor.editor.is-focused)
     -0:39.5.0 core:save (atom-text-editor.editor.is-focused.autocomplete-active)
     -0:38.7.0 pane:show-item-2 (atom-text-editor.editor.is-focused)
     -0:36.8.0 autocomplete-clang:emit-pch (atom-text-editor.editor.is-focused)
     -0:30.6.0 pane:show-item-2 (atom-text-editor.editor.is-focused)
  4x -0:28.8.0 autocomplete-clang:go-declaration (atom-text-editor.editor.is-focused)
     -0:15.2.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -0:15.2.0 core:cancel (atom-text-editor.editor.mini.is-focused)
  9x -0:13.4.0 autocomplete-clang:go-declaration (atom-text-editor.editor.is-focused)
     -0:03.6.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -0:03.6.0 core:cancel (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {
    "packagesWithKeymapsDisabled": [
      "autocomplete-clang"
    ],
    "themes": [
      "atom-dark-ui",
      "solarized-dark-syntax"
    ]
  },
  "autocomplete-clang": {
    "includePaths": [
      "/home/jchia/git/tms/include"
    ],
    "std c  ": "c  14"
  }
}

Installed Packages

# User
autocomplete-clang, v0.9.3
autocomplete-python, v1.7.2
clang-format, v1.25.0
file-watcher, v0.4.0
ide-haskell-stack, v0.0.3
language-cpp14, v0.6.1
language-haskell, v1.7.13
merge-conflicts, v1.4.2
open-recent, v5.0.0
quick-highlight, v0.4.0

# Dev
No dev packages
jchia commented

The offending code line is like this:
match = candidate.match ///^Dumping\s(?:[A-Za-z_]*::)*?#{term}:///

It seems that term was ')' and when adding it to the regex, no escaping was performed. I'm not familiar with this plugin, so I don't know whether term is supposed to have this value in the first place but it looks suspicious.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.