aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-08-10 10:47:22 +0200
committerSven Gothel <[email protected]>2023-08-10 10:47:22 +0200
commitf8752c59945205b717c4b21ceeb4044ae9a0e9df (patch)
treed4260a0a69f523d2a2fe8db4c817f2b3d7b28744 /src
parentb5ec911572aa0c07228fcb02976a8e848cc90391 (diff)
Bug 1450: Fix 'Number' rule, i.e. only consume positive numbers as `additiveExpr` and `unaryExpr` consume the '-' operator
n GlueGen commit 10032c0115f2794a254cffc2a1cd5e48ca8ff0b8 in branch JOGL_2_SANDBOX Ken hacked in consuming a '-' prefix to have negative numbers covered by 'Number'. This is wrong, as it breaks deduction of `additiveExpr` and 'unaryExpr' rules, which want to consume '-' and '+'. The latter is used to completely resolve constant expressions starting from the 'constExpr' rule. See ISO 9899:202x Programming Language - C https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf
Diffstat (limited to 'src')
-rw-r--r--src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g b/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g
index 88dbc1e..a7670ad 100644
--- a/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g
+++ b/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g
@@ -801,7 +801,7 @@ protected NumberSuffix
;
Number
- : ( ('-')? ( Digit )+ ( '.' | 'e' | 'E' ) )=> ('-')? ( Digit )+
+ : ( ( Digit )+ ( '.' | 'e' | 'E' ) )=> ( Digit )+
( '.' ( Digit )* ( Exponent )?
| Exponent
)
@@ -821,7 +821,7 @@ Number
( NumberSuffix
)*
- | ('-')? '1'..'9' ( Digit )*
+ | '1'..'9' ( Digit )*
( NumberSuffix
)*