parser icon indicating copy to clipboard operation
parser copied to clipboard

LanguageKit.whitespace throws JS exception when allowTabs=True

Open brian-carroll opened this issue 8 years ago • 0 comments

Hi, Really nice library, enjoying using it! I noticed the whitespace function only works with allowTabs = False. When set to True, it looks like there's an infinite recursion somewhere. See REPL session below based on the example from the documentation comments. I'm using v2.0.1 of the library with Elm 0.18.

$ elm repl
---- elm-repl 0.18.0 -----------------------------------------------------------
 :help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------
> import Parser exposing (..)
> import Parser.LanguageKit exposing (..)
> jsWhitespace = whitespace { allowTabs = True, lineComment = LineComment "//", multiComment = UnnestableComment "/*" "*/" }
Parser <function> : Parser.Parser ()
> run jsWhitespace ""
RangeError: Maximum call stack size exceeded
> noTabsWhitespace = whitespace { allowTabs = False, lineComment = LineComment "//", multiComment = UnnestableComment "/*" "*/" }
Parser <function> : Parser.Parser ()
> run noTabsWhitespace ""
Ok () : Result.Result Parser.Error ()
>

brian-carroll avatar Nov 12 '17 13:11 brian-carroll