PLY problem.

H Jansen <[email protected]> Tue, 17 Jun 2003 14:58:52 +0200
Newsgroups gmane.comp.python.parser
Organization TNO-FEL
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------43667F51BB4EEF5143BAA9CC
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The correct regular expression for a C-style comment in PLY seems to be:

# C-style comment

def t_comment(t):
    r'\/\*(.|\n)*?\*\/'
    t.lineno += t.value.count('\n')

Since no return value is passed, the lexer should ignore this. However,
when parsing the multiline comment


"""

 /* O
    K  */

"""


the lexer issues the following error:

...
(<function t_newline at 0x4054317c>, 'newline') 


None /* O
    K */
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/tmp/python-XYAtGu.py", line 148, in ?
    yacc.parse(s, lexer=lexer, debug=1)
  File "yacc.py", line 197, in parse
    lookahead = get_token()     # Get the next token
  File "lex.py", line 307, in realtoken
    # If token is processed by a function, call it
TypeError: unpack non-sequence
>>> 


Anybody a guess what's wrong?
--------------43667F51BB4EEF5143BAA9CC
Content-Type: text/x-vcard; charset=us-ascii;
 name="h.jansen.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for H Jansen
Content-Disposition: attachment;
 filename="h.jansen.vcf"

begin:vcard 
n:Jansen;Henk
tel;fax:+31(0)70 328 09 61
tel;work:+31(0)70 374 02 15
x-mozilla-html:FALSE
org:TNO Physics and Electronics Laboratory;Maritime Command and Control
version:2.1
email;internet:[email protected]
adr;quoted-printable:;;Oude Waalsdorperweg 63=0D=0AP.O.Box 96864, 2509 JG;The Hague;;;The Netherlands
note;quoted-printable:Research Areas:=0D=0A- Target Tracking=0D=0A- Optimal Control=0D=0A- Decision Support
x-mozilla-cpt:;-31648
fn:Henk Jansen
end:vcard

--------------43667F51BB4EEF5143BAA9CC--