I am building a lexer where I have a case statement with many repeated cases 
where just the character changes and the resulting token.

Example:
    
    
    case l.ch
    of '+':
      tok = Token( Type: tkPlus, Literal: $l.ch )
    of '-':
      tok = Token( Type: tkMinus, Literal: $l.ch )
    ...
    
    Run

I would like to have a macro like 
    
    
    ( '-', tkMinus )
    
    Run

doing the work for me. How would I write such a macro? Tried with echo 
statements but it doesn't work. Also is there a compiler switch to quickly see 
the expanded macros?

Sorry for the beginner questions. 

Reply via email to