Skip to content

List pattern matching might not be working with LFE 0.9.0 #1

@jfacorro

Description

@jfacorro

While trying the LFE example out I couldn't get the generated parser code to be different from the include/spell1inc.lfe template. I tracked the problem down to the patterns used in this case:

     (case line
       (`(,@"##module" . ,_) (output-module out st))
       (`(,@"##code" . ,_) (output-user-code out st))
       (`(,@"##entry" . ,_) (output-entry out st))
       (`(,@"##table" . ,_) (output-table out st))
       (`(,@"##reduce" . ,_) (output-reduce out st))
       (_ (io:put_chars out line)))

I tried a similar approach in the shell and I got the following result:

> (set `(,@"hello" . ,_) "hello!")
1: Warning: deprecated pattern
1: Warning: deprecated pattern
exception error: #(badmatch "hello!")

If I change the patterns to the actual contents of the line (with the newline char and all) then everything the generated code gets inserted as expected:

     (case line
       ("##module\n" (output-module out st))
       ("##code\n" (output-user-code out st))
       ("##entry\n" (output-entry out st))
       ("##table\n" (output-table out st))
       ("##reduce" (output-reduce out st))
       (_ (io:put_chars out line)))

I might be doing something really wrong though.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions