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

lexer class helpful for debugging





>From one of Etienne's previous posts...  You'll want to fix the
imports.

From: "Etienne Gagnon" <egagnon@sprynet.com>
To: <atwoodj@cs.orst.edu>, <sablecc-list@sable.mcgill.ca>
Subject: Re: ? Ignore tokens  blank;
Date: Thu, 28 May 1998 00:03:11 -0400

[snip]

Here is a customized lexer that will help you debug your lexer.

import wig.node.*;
import wig.lexer.*;
import java.io.*;

class PrintLexer extends Lexer
{
  PrintLexer(PushbackReader reader)
  {
    super(reader);
  }

  protected void filter()
  {
    System.out.println(token.getClass() +
                       ", state : " + state.id() +
                       ", text : [" + token.getText() + "]");
  }
}

[snip]