diff options
author | Sven Gothel <[email protected]> | 2009-10-12 17:12:24 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-12 17:12:24 -0700 |
commit | 3c5fe7f58a2e7816c86ab0b85fb3a4e7cd2113ce (patch) | |
tree | 5b1dfa3708f3f760d984f7cb41d847552e6b6bea /src/java/com/sun/gluegen/cgram | |
parent | 22e98bcb38d51c5f9170d4d3d5afea89647413d4 (diff) | |
parent | 03bf321dc0aac6a2bc635093d634e1c8e67f8d43 (diff) |
Merge branch 'master' of ssh://git.kenai.com/gluegen~gluegen-git
Diffstat (limited to 'src/java/com/sun/gluegen/cgram')
-rw-r--r-- | src/java/com/sun/gluegen/cgram/StdCParser.g | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/java/com/sun/gluegen/cgram/StdCParser.g b/src/java/com/sun/gluegen/cgram/StdCParser.g index e84fbfd..65e7936 100644 --- a/src/java/com/sun/gluegen/cgram/StdCParser.g +++ b/src/java/com/sun/gluegen/cgram/StdCParser.g @@ -1112,22 +1112,33 @@ options { : '#' ( ( "line" || (( ' ' | '\t' | '\014')+ '0'..'9')) => LineDirective - | ( (Space)* "define" (Space)* i:ID (Space)* (n:Number)? + | ( (Space)* "define" (Space)* i:ID (Space)* (n:DefineExpr)? nw:NonWhitespace - ("\r\n" | "\r" | "\n") ) { if (n != null) { + ("\r\n" | "\r" | "\n") ) { + if (n != null) { + //System.out.println("addDefine: #define " + i.getText() + " " + n.getText()); addDefine(i.getText(), n.getText()); } else { - setPreprocessingDirective("#define " + i.getText() + " " + - nw.getText()); + setPreprocessingDirective("#define " + i.getText() + " " + nw.getText()); } } | (~'\n')* { setPreprocessingDirective(getText()); } ) - { + { _ttype = Token.SKIP; } ; +DefineExpr: + ((LPAREN) (Space)* (DefineExpr2) (Space)* (RPAREN)) | (DefineExpr2) +; + +DefineExpr2: + (Number) + ((Space)* (LSHIFT | RSHIFT | PLUS | MINUS | STAR | DIV | MOD) (Space)* (DefineExpr))? +; + + protected Space: ( ' ' | '\t' | '\014') ; |