swift-emacs / swift-mode

Emacs support for Apple's Swift programming language.
GNU General Public License v3.0
372 stars 47 forks source link

I hit an infinite (ish?) loop in the scanner #129

Closed aufflick closed 8 years ago

aufflick commented 8 years ago

I'll try to reduce the case, but I get this a bit - I have to hit ^g a lot to get it to Quit. Here's the debug-on-quit trace when I do:

Debugger entered--Lisp error: (quit)
  looking-at("\\([\n     ]\\|.\\)+?\\(where.*[,]\\|:\\)")
  swift-smie--forward-token()
  smie--opener/closer-at-point()
  #[0 "\306 \211\205\243\204 \211@\203\307\202\310\311A@    \"8\247?\205\243\211@\203C\312\313!`@?\205>\n \210A@\3108B\235`E\266\202\202\216\314\313!A@@\203|\310\311  \"8\3108\311  \"A@\247\205w=\205wA@b\210`\f \210\315`E\262\266\203\202\214`\f \210\3108B\235`E\262\266\202
\3108\3168A@\3108@?\257\241\262\207" [smie-blink-matching-inners smie-grammar smie-backward-token-function smie-closer-alist smie-forward-token-function smie--matching-block-data-cache smie--opener/closer-at-point 1 2 assoc smie-forward-sexp halfsexp smie-backward-sexp t 3] 10 "\n\n(fn)"]()
  funcall(#[0 "\306 \211\205\243\204 \211@\203\307\202\310\311A@    \"8\247?\205\243\211@\203C\312\313!`@?\205>\n \210A@\3108B\235`E\266\202\202\216\314\313!A@@\203|\310\311  \"8\3108\311  \"A@\247\205w=\205wA@b\210`\f \210\315`E\262\266\203\202\214`\f \210\3108B\235`E\262\266\202
\3108\3168A@\3108@?\257\241\262\207" [smie-blink-matching-inners smie-grammar smie-backward-token-function smie-closer-alist smie-forward-token-function smie--matching-block-data-cache smie--opener/closer-at-point 1 2 assoc smie-forward-sexp halfsexp smie-backward-sexp t 3] 10 "\n\n(fn)"])
  smie--matching-block-data(#[128 "\301\302\300!\"\207" [show-paren-data-function apply default-value] 4 "\n\n(fn &rest ARGS)"])
  apply(smie--matching-block-data #[128 "\301\302\300!\"\207" [show-paren-data-function apply default-value] 4 "\n\n(fn &rest ARGS)"] nil)
  #[128 "\300\301\302#\207" [apply smie--matching-block-data #[128 "\301\302\300!\"\207" [show-paren-data-function apply default-value] 4 "\n\n(fn &rest ARGS)"] nil] 5 nil]()
  show-paren-function()
  apply(show-paren-function nil)
  byte-code("r\301\302H\303H\"\210)\301\207" [timer apply 5 6] 4)
  timer-event-handler([t 0 0 125000 t show-paren-function nil idle 0])
aufflick commented 8 years ago

Oh, this is on the latest from elpa as of today, 2016 something, but has been there since 2015*. I'll also try HEAD when I get a chance.

dougbeal commented 8 years ago

Did you have any luck with this? I'm running into it as well, though with swift-smie--backward-token.

Debugger entered--Lisp error: (quit)
  looking-at("\\([\n     ]\\|.\\)+?\\(where.*[,]\\|:\\)")
  swift-smie--backward-token()
  smie--opener/closer-at-point()
  #[0 "\306 \211\205\243\204 \211@\203\307\202\310\311A@    \"8\247?\205\243\211@\203C\312\313!`@?\205>\n \210A@\3108B\235`E\266\202\202\216\314\313!A@@\203|\310\311  \"8\3108\311  \"A@\247\205w=\205wA@b\210`\f \210\315`E\262\266\203\202\214`\f \210\3108B\235`E\262\266\202
\3108\3168A@\3108@?\257\241\262\207" [smie-blink-matching-inners smie-grammar smie-backward-token-function smie-closer-alist smie-forward-token-function smie--matching-block-data-cache smie--opener/closer-at-point 1 2 assoc smie-forward-sexp halfsexp smie-backward-sexp t 3] 10 "\n\n(fn)"]()
  funcall(#[0 "\306 \211\205\243\204 \211@\203\307\202\310\311A@    \"8\247?\205\243\211@\203C\312\313!`@?\205>\n \210A@\3108B\235`E\266\202\202\216\314\313!A@@\203|\310\311  \"8\3108\311  \"A@\247\205w=\205wA@b\210`\f \210\315`E\262\266\203\202\214`\f \210\3108B\235`E\262\266\202
\3108\3168A@\3108@?\257\241\262\207" [smie-blink-matching-inners smie-grammar smie-backward-token-function smie-closer-alist smie-forward-token-function smie--matching-block-data-cache smie--opener/closer-at-point 1 2 assoc smie-forward-sexp halfsexp smie-backward-sexp t 3] 10 "\n\n(fn)"])
  smie--matching-block-data(#[128 "\301\302\300!\"\207" [show-paren-data-function apply default-value] 4 "\n\n(fn &rest ARGS)"])
  apply(smie--matching-block-data #[128 "\301\302\300!\"\207" [show-paren-data-function apply default-value] 4 "\n\n(fn &rest ARGS)"] nil)
  #[128 "\300\301\302#\207" [apply smie--matching-block-data #[128 "\301\302\300!\"\207" [show-paren-data-function apply default-value] 4 "\n\n(fn &rest ARGS)"] nil] 5 nil]()
  show-paren-function()
  apply(show-paren-function nil)
  byte-code("r\301\302H\303H\"\210)\301\207" [timer apply 5 6] 4)
  timer-event-handler([t 0 0 125000 t show-paren-function nil idle 0])
taku0 commented 8 years ago

Fixed by the new indentation logic.