Author: kjs
Date: Thu Feb 21 12:11:25 2008
New Revision: 25947
Modified:
trunk/languages/c99/src/parser/grammar.pg
Log:
[c99]
It's important to set the precedence of "term:" special rule tighter than the
tightest operator; otherwise this won't work. Note to self: add this to
operator table guide.
Modified: trunk/languages/c99/src/parser/grammar.pg
==============================================================================
--- trunk/languages/c99/src/parser/grammar.pg (original)
+++ trunk/languages/c99/src/parser/grammar.pg Thu Feb 21 12:11:25 2008
@@ -372,21 +372,23 @@
## A.1.5 Constants
##
token constant {
- | <integer_constant>
- | <floating_constant>
- | <enumeration_constant>
- | <character_constant>
+ | <floating_constant>
+ | <integer_constant>
+ | <enumeration_constant>
+ | <character_constant>
}
token integer_constant {
- [ <decimal_constant>
- | <octal_constant>
- | <hexadecimal_constant>
- ] <integer_suffix>?
+ [ <decimal_constant>
+ | <octal_constant>
+ | <hexadecimal_constant>
+ ] <integer_suffix>?
}
token decimal_constant {
- <[1..9]> <digit>*
+ \d+
+ #| 0
+ #| <[1..9]> <digit>*
}
token octal_constant {
@@ -523,7 +525,8 @@
proto 'infix:/' is equal('infix:*') { ... }
proto 'infix:%' is equal('infix:*') { ... }
-proto 'term:' is parsed(&cast_expression) { ... }
+proto 'term:' is tighter('infix:*')
+ is parsed(&cast_expression) { ... }
rule postfix_expression {
@@ -531,7 +534,7 @@
| <primary_expression>
| '(' <type_name> ')' '{' <initializer_list> [',']? '}'
]
- <postfix_expression_suffix>
+ <postfix_expression_suffix>*
}
rule postfix_expression_suffix {