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

Re: typedefs



Hi Guy,

I am not sure I understand all, but a strange "delay" seems to appear
between CustomLexer and CustomParser.

Thanks for the defect report. Please submit a bug at
http://sourceforge.net/tracker/?group_id=5704&atid=105704 , maybe with
the contents of your previous email also.

Unfortunately I can't give the defect much attention as I now only work
with SableCC in my spare time, but please keep track of any patches you
make so I can apply the fixes!

Are you instantiating the Parser using the custom Lexer and Parser like
the code in org.sablecc.isoc.Compiler?

       /* HashSet to keep track of typedefs */
        HashSet typedefs = new HashSet();
        Hashtable enumIdentifiers = new Hashtable();

        try {
            Parser p =
            new CustomParser (
                new CustomLexer (
                    new PushbackReader (
                        new InputStreamReader (System.in), 1024),
                    typedefs, enumIdentifiers),
                typedefs, enumIdentifiers);

            Start tree = p.parse();
            tree.apply(new ASTPrinter());
        } catch (Exception e) {

            System.out.println(e.getMessage());
        }

Cheers,

Roger

In my context, your example below

---------------------------
typedef int A;
typedef struct
{
 char a;
 int b;
 char c;
 short d;
 double e;
 char f;
} T;

T x;
A z;
---------------------------

produces the problem I reported you yesterday.

But if I add something before the two last declarations :

---------------------------
typedef int A;
typedef struct
{
 char a;
 int b;
 char c;
 short d;
 double e;
 char f;
} T;

int anything ;
T x;
A z;
---------------------------

The problem disappears.

Have you a suggestion ? It would greatly help me :)

Thanks in advance for your help !

Regards.

--Guy Durrieu.




-- ------------------------------------------------------------- Ninth Avenue Software p: +61 7 3870 8494 f: +61 7 3870 8491 _ _ _ m: +61 405 048 371 __(@)< __(@)> __(@), w: http://www.ninthave.net \___) \___) \___) e: r.keays@ninthave.net -------------------------------------------------------------

PO Box 4179                             Send your spam to Sam
St Lucia South                               sam@ninthave.net
Queensland 4067
Australia                         http://www.ninthave.net/sam