Package: cl-lexer
Version: 1-4
Severity: normal

I am attempting to use cl-lexer/cl-yacc to realize the syntax of
DMTF's CIM information model - the one that is used to define MOF files
for the DMTF data model.  This is just to inform you that the lex rules
in the example are not arbitrary - they are part of a real-life project.

I observe a mysterious problem; when I tried to reduce the input to this
bug report I ended up with a 10-rule lexer that works like a charm, while
an 11-rule lexer fails in an area that is completely unrelated to the
failure.

First the failure:

CL-USER> (lexer:deflexer test-lexer
     ("[+-]?[01][01]*[bB]"
       (return (values 'binaryValue lexer:%0)))
     ("[+-]?0[xX][0-9a-fA-F][0-9a-fA-F]*"
      (return (values 'hexValue lexer:%0)))
     ("[+-]?[0-9]*[.][0-9][0-9]*"
       (return (values 'flt lexer:%0)))
     ("[+-]?0[0-7][0-7]*"
      (return (values 'octalValue lexer:%0)))
     ("[1-9][0-9]*"
       (return (values 'positive lexer:%0)))
     ("[+-]?[0-9][0-9]*"
       (return (values 'decimal lexer:%0)))
     ("[:alpha:][:alnum:]*"
       (return (values 'name lexer:%0)))
     ("any" (return (values 'ANY lexer:%0)))
     ("as" (return (values 'AS lexer:%0)))
     ("association" (return (values 'ASSOCIATION lexer:%0)))
     ("[:space:]+") )
TEST-LEXER
CL-USER> (defparameter lex (test-lexer "1.0"))
LEX
CL-USER> (funcall lex)
POSITIVE
"1"

This response is wrong:  the text "1.0" should match the 3rd rule, not
the 5th.

If I remove a single rule (the 10th) from the lexer, it works correctly:

CL-USER> (lexer:deflexer test-lexer
     ("[+-]?[01][01]*[bB]"
       (return (values 'binaryValue lexer:%0)))
     ("[+-]?0[xX][0-9a-fA-F][0-9a-fA-F]*"
      (return (values 'hexValue lexer:%0)))
     ("[+-]?[0-9]*[.][0-9][0-9]*"
       (return (values 'flt lexer:%0)))
     ("[+-]?0[0-7][0-7]*"
      (return (values 'octalValue lexer:%0)))
     ("[1-9][0-9]*"
       (return (values 'positive lexer:%0)))
     ("[+-]?[0-9][0-9]*"
       (return (values 'decimal lexer:%0)))
     ("[:alpha:][:alnum:]*"
       (return (values 'name lexer:%0)))
     ("any" (return (values 'ANY lexer:%0)))
     ("as" (return (values 'AS lexer:%0)))
     ("[:space:]+") )
STYLE-WARNING: redefining TEST-LEXER in DEFUN
TEST-LEXER
CL-USER> (defparameter lex (test-lexer "1.0"))
LEX
CL-USER> (funcall lex)
FLT
"1.0"

At a guess, I would say that this is a problem with the underlying cl-regex,
not with cl-lexer itself.  I will continue along this path if I can find the
time.  But I thought I would throw this piece of intelligence to the BTS, in
the hope that someone with more insight in the two packages can tell me what
happens.


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.28-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages cl-lexer depends on:
ii  cl-regex                      1-3        Common Lisp regular expression com
ii  common-lisp-controller        6.17       Common Lisp source and compiler ma

cl-lexer recommends no packages.

cl-lexer suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to