ParseKit - how to handle preprocessor statements correctly?
===

I wrote a C grammar for ParseKit, which does work perfectly, but what drives me crazy are preprocessor statements. What's the correct symbol definitions for preprocessor statements?

Here's the short example of what I've tried ...

    @reportsCommentTokens = YES;
    @commentState = '/';
    @singleLineComments = '//';
    @multiLineComments = '/*' '*/';
    @commentState.fallbackState = delimitState;
    @delimitState.fallbackState = symbolState;
    
    @start = Empty | comments | preprocessor;
    
    comments = comment*;
    comment = Comment;
    
    @symbols = '#include';
    
    preprocessor = preprocessorIncludes;
    
    preprocessorIncludes = preprocessorIncludeStatement*;
    preprocessorIncludeStatement = preprocessorInclude quotedFileName*;
    
    preprocessorInclude = '#include';
    quotedFileName = QuotedString;

... but it doesn't work. Take it as simplified grammar example to catch comments and include statement with quotes (not with < >). I tried this grammar on this simple file ...

    /*
     * Cryptographic API.
     *
     * RIPEMD-256 - RACE Integrity Primitives Evaluation Message Digest.
     *
     * Based on the reference implementation by Antoon Bosselaers, ESAT-COSIC
     *
     * Copyright (c) 2008 Adrian-Ken Rueegsegger <ken@codelabs.ch>
     *
     * This program is free software; you can redistribute it and/or modify it
     * under the terms of the GNU General Public License as published by the Free
     * Software Foundation; either version 2 of the License, or (at your option)
     * any later version.
     *
     */
    
    // Here's one line comment
    
    /* One line multiline comment */
    
    #include "ripemd.h"
    
    /* 2nd one line multiline comment */

... and it ends at /* One line multiline comment */, reports it as comment token and then it silently fails.

So I tried to separate '#include' symbol to ...

    @symbolState = '#' '#';
    @symbol = '#';
    numSymbol = '#';
    
    preprocessorInclude = numSymbol 'include';

... but it still doesn't help.

Maybe Todd can help, but what's the correct way to handle 'symbols' like '#include'?