[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coldsync-hackers] Weirdness when adding new tokens to parser



[Sorry for not answering earlier. Stuff came up.]

On Sat, Mar 24, 2001 at 10:22:35AM -0500, Brian Holdsworth wrote:
> I used the listen types of NET and SERIAL as a model for adding the new one.
> I believe I have made all the right changes in parser.y and lexer.l.  And
> yet, it does not work.  When the new keyword is encountered in a listen
> block in my coldsyncrc file, the trace just says "Found word [myword],"
> followed by "Unrecognized listen type."

	Have you added a clause to the definition of 'comm_type' in
"parser.y"? That's where the "Unrecognized listen type" message comes
from.
	Adding a new listen type isn't too hard, but it isn't entirely
trivial either: the simple part is adding a new LISTEN_FOO constant to
"include/pconn/PConnection.h".
	The hard part is adding the handlers: the PConnection type is
really a generic connection class; you use a specific subclass
(serial, USB, TCP) depending on the type of connection you really
have.
	The function pointers in the definition of PConnection in
"include/pconn/PConnection.h" are the methods that the rest of the
code uses to interact with the connection. You'll need to define each
one for your new listen type, then add glue to
"libpconn/PConnection.c" to initialize them as appropriate.

> Feeling curious, I tried to make a simpler change and just changed one line
> in lexer.l
> From: "serial" { KEYWORD(SERIAL) }
> To:   "serialtwo" { KEYWORD(SERIAL) }
> 
> I thought that after re-building, this change *should* allow me to
> substitute
> 
> "listen serial {" with
> "listen serialtwo {"
> 
> in my coldsyncrc file.  Yet, this does not work either.  So, it seems I am
> missing something major about how to add a new keyword (or modify an
> existing one) in lexer.l.  Does anyone have a notion where I am going wrong?

	Hm. This _should_ have worked. The only thing I can think of
is that perhaps there's a problem in the Makefile dependencies. (You
_are_ familiar with lex and yacc, right?)

-- 
Andrew Arensburger                      This message *does* represent the
arensb@ooblick.com                      views of ooblick.com
      Hmph! Seriousness. Hmph! Sobriety. A Jedi craves them not!

-- 
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.