Common Lisp lexer can't recognize ::symbol-name

Create issue
Issue #811 resolved
Eitan Mosenkis created an issue

Because the 'symbol' regexp defined on line 736 of functional.py is expecting a complete symbol, it fails to recognize symbols that start ::, :#, and :. (those listed in the 'constituent' variable). Based on testing in SBCL, all three are understood by the Lisp parser as symbols.

Comments (5)

  1. Tim Hatch

    I don't quite grok the problem, can you provide a complete statement that doesn't work currently, that I can use to test against?

  2. Eitan Mosenkis reporter

    Sorry for the delay. The notification email accidentally got miscategorized and archived. A trivial example is (with the output when I typed them into sbcl):

    (keywordp ::junk)
      T
    (symbol-name ::junk)
      "JUNK"
    
    (symbol-name :#junk)
      "#JUNK"
    
    (symbol-name #.junk)
      "#.JUNK"
    

    These last two symbols fail to be recognized because there is no special case for symbols beginning with : - if you omit the colon, sbcl well likewise raise an error, but with the colon they are valid. The first case, with two colons, is a weird, but valid use of keywords. All symbols in the keyword package are automatically exported, making :kw, which is really a shortcut for keyword:kw, valid. However, it can be accessed without expecting it to be exported, as keyword::kw, and therefore as ::kw.

    The Common Lisp lexer needs to be updated to properly lex these weird keywords.

  3. Eitan Mosenkis reporter

    There appears to be a missing : in my last example. it should be:

    (symbol-name :#.junk)
      "#.JUNK"
    

    As you can see, BitBucket isn't lexing it properly.

  4. Log in to comment