mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 13:23:04 +00:00
syntax: introducing %gprec for precedence groups
It is now possible to introduce precedence groups, with precedence
relationships inside the group, but not with the outside tokens. Ex:
%gprec arith {
%left '+' '-'
%left '*' '/'
%right '^'
}
%gprec {
%left OR
%left AND
}
%left OTHER
%precedence OTHER2
Here, the arithmetical operators (in the "arith" group) can be compared, the
boolean operators can be compared, but OTHER can only be compared to OTHER2.
* src/gram.c, src/gram.h, src/scan-gram.l, src/parse-gram.y: {} blocks after
%gprec are understood by the lexer
* src/parse-gram.y: New syntax
* tests/input.at, tests/regression.at: Fix due to lexer change
This commit is contained in:
@@ -64,14 +64,13 @@ AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
|
||||
AT_BISON_CHECK([input.y], [1], [],
|
||||
[[input.y:1.1-2: error: invalid characters: '\0\001\002\377?'
|
||||
input.y:3.1: error: invalid character: '?'
|
||||
input.y:4.14: error: invalid character: '}'
|
||||
input.y:4.14: error: syntax error, unexpected }
|
||||
input.y:5.1: error: invalid character: '%'
|
||||
input.y:5.2: error: invalid character: '&'
|
||||
input.y:6.1-17: error: invalid directive: '%a-does-not-exist'
|
||||
input.y:7.1: error: invalid character: '%'
|
||||
input.y:7.2: error: invalid character: '-'
|
||||
input.y:8.1-9.0: error: missing '%}' at end of file
|
||||
input.y:8.1-9.0: error: syntax error, unexpected %{...%}
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -405,14 +405,13 @@ default: 'a' }
|
||||
|
||||
AT_BISON_CHECK([input.y], [1], [],
|
||||
[[input.y:2.1: error: invalid character: '?'
|
||||
input.y:3.14: error: invalid character: '}'
|
||||
input.y:3.14: error: syntax error, unexpected }
|
||||
input.y:4.1: error: invalid character: '%'
|
||||
input.y:4.2: error: invalid character: '&'
|
||||
input.y:5.1-17: error: invalid directive: '%a-does-not-exist'
|
||||
input.y:6.1: error: invalid character: '%'
|
||||
input.y:6.2: error: invalid character: '-'
|
||||
input.y:7.1-8.0: error: missing '%}' at end of file
|
||||
input.y:7.1-8.0: error: syntax error, unexpected %{...%}
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user