diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2016-01-04 15:48:54 +0100 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2016-01-09 18:39:48 +0100 |
commit | 831102f004b1314ff3a0a7bf807f73cc5d0da16c (patch) | |
tree | 63e3055fac76fa04a9b2e5deedbb357760354066 /compiler/parser | |
parent | a84c21ebaa5c56a222d69f245ef4daa77054fdcb (diff) | |
download | haskell-831102f004b1314ff3a0a7bf807f73cc5d0da16c.tar.gz |
Parser: delete rule numbers + validate shift/reduce conlicts
Rule numbers tend to go out-of-date, and aren't useful.
And during validate, the actual number of shift/reduce
conflicts is now checked against the number stated in Parser.y.
Reviewed by: bgamari
Differential Revision: https://phabricator.haskell.org/D1754
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/Parser.y | 99 |
1 files changed, 49 insertions, 50 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 380fd3c3cb..7c9aea899b 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -86,9 +86,9 @@ import Prelude import qualified GHC.LanguageExtensions as LangExt } -{- Last updated: 18 Nov 2015 +%expect 36 -- shift/reduce conflicts -Conflicts: 36 shift/reduce +{- Last updated: 9 Jan 2016 If you modify this parser and add a conflict, please update this comment. You can learn more about the conflicts by passing 'happy' the -i flag: @@ -96,17 +96,16 @@ You can learn more about the conflicts by passing 'happy' the -i flag: happy -agc --strict compiler/parser/Parser.y -idetailed-info How is this section formatted? Look up the state the conflict is -reported at, and copy the list of applicable rules (at the top). Mark -*** for the rule that is the conflicting reduction (that is, the -interpretation which is NOT taken). NB: Happy doesn't print a rule in a -state if it is empty, but you should include it in the list (you can +reported at, and copy the list of applicable rules (at the top, without the +rule numbers). Mark *** for the rule that is the conflicting reduction (that +is, the interpretation which is NOT taken). NB: Happy doesn't print a rule +in a state if it is empty, but you should include it in the list (you can look these up in the Grammar section of the info file). Obviously the state numbers are not stable across modifications to the parser, the idea is to reproduce enough information on each conflict so you can figure out what happened if the states were renumbered. Try not to gratuitously move -productions around in this file. It's probably less important to keep -the rule annotations up-to-date. +productions around in this file. ------------------------------------------------------------------------------- @@ -122,8 +121,8 @@ follows. Shift parses as if the 'module' keyword follows. state 46 contains 2 shift/reduce conflicts. - *** strict_mark -> unpackedness . (rule 268) - strict_mark -> unpackedness . strictness (rule 269) + *** strict_mark -> unpackedness . + strict_mark -> unpackedness . strictness Conflicts: '~' '!' @@ -131,9 +130,9 @@ state 46 contains 2 shift/reduce conflicts. state 50 contains 1 shift/reduce conflict. - context -> btype . (rule 295) - *** type -> btype . (rule 297) - type -> btype . '->' ctype (rule 298) + context -> btype . + *** type -> btype . + type -> btype . '->' ctype Conflicts: '->' @@ -141,8 +140,8 @@ state 50 contains 1 shift/reduce conflict. state 51 contains 9 shift/reduce conflicts. - *** btype -> tyapps . (rule 303) - tyapps -> tyapps . tyapp (rule 307) + *** btype -> tyapps . + tyapps -> tyapps . tyapp Conflicts: ':' '-' '!' '.' '`' VARSYM CONSYM QVARSYM QCONSYM @@ -150,13 +149,13 @@ state 51 contains 9 shift/reduce conflicts. state 132 contains 14 shift/reduce conflicts. - exp -> infixexp . '::' sigtype (rule 416) - exp -> infixexp . '-<' exp (rule 417) - exp -> infixexp . '>-' exp (rule 418) - exp -> infixexp . '-<<' exp (rule 419) - exp -> infixexp . '>>-' exp (rule 420) - *** exp -> infixexp . (rule 421) - infixexp -> infixexp . qop exp10 (rule 423) + exp -> infixexp . '::' sigtype + exp -> infixexp . '-<' exp + exp -> infixexp . '>-' exp + exp -> infixexp . '-<<' exp + exp -> infixexp . '>>-' exp + *** exp -> infixexp . + infixexp -> infixexp . qop exp10 Conflicts: ':' '::' '-' '!' '-<' '>-' '-<<' '>>-' '.' '`' VARSYM CONSYM QVARSYM QCONSYM @@ -173,9 +172,9 @@ Shift parses as (per longest-parse rule): ------------------------------------------------------------------------------- -state 292 contains 1 shift/reduce conflicts. +state 295 contains 1 shift/reduce conflicts. - rule -> STRING . rule_activation rule_forall infixexp '=' exp (rule 215) + rule -> STRING . rule_activation rule_forall infixexp '=' exp Conflict: '[' (empty rule_activation reduces) @@ -191,10 +190,10 @@ a rule instructing how to rewrite the expression '[0] f'. ------------------------------------------------------------------------------- -state 301 contains 1 shift/reduce conflict. +state 304 contains 1 shift/reduce conflict. - *** type -> btype . (rule 297) - type -> btype . '->' ctype (rule 298) + *** type -> btype . + type -> btype . '->' ctype Conflict: '->' @@ -202,11 +201,11 @@ Same as state 50 but without contexts. ------------------------------------------------------------------------------- -state 337 contains 1 shift/reduce conflicts. +state 340 contains 1 shift/reduce conflicts. - tup_exprs -> commas . tup_tail (rule 505) - sysdcon_nolist -> '(' commas . ')' (rule 616) - commas -> commas . ',' (rule 734) + tup_exprs -> commas . tup_tail + sysdcon_nolist -> '(' commas . ')' + commas -> commas . ',' Conflict: ')' (empty tup_tail reduces) @@ -217,11 +216,11 @@ if -XTupleSections is not specified. ------------------------------------------------------------------------------- -state 388 contains 1 shift/reduce conflicts. +state 391 contains 1 shift/reduce conflicts. - tup_exprs -> commas . tup_tail (rule 505) - sysdcon_nolist -> '(#' commas . '#)' (rule 618) - commas -> commas . ',' (rule 734) + tup_exprs -> commas . tup_tail + sysdcon_nolist -> '(#' commas . '#)' + commas -> commas . ',' Conflict: '#)' (empty tup_tail reduces) @@ -229,10 +228,10 @@ Same as State 324 for unboxed tuples. ------------------------------------------------------------------------------- -state 460 contains 1 shift/reduce conflict. +state 465 contains 1 shift/reduce conflict. - oqtycon -> '(' qtyconsym . ')' (rule 621) - *** qtyconop -> qtyconsym . (rule 628) + oqtycon -> '(' qtyconsym . ')' + *** qtyconop -> qtyconsym . Conflict: ')' @@ -240,10 +239,10 @@ TODO: Why? ------------------------------------------------------------------------------- -state 635 contains 1 shift/reduce conflicts. +state 639 contains 1 shift/reduce conflicts. - *** aexp2 -> ipvar . (rule 466) - dbind -> ipvar . '=' exp (rule 590) + *** aexp2 -> ipvar . + dbind -> ipvar . '=' exp Conflict: '=' @@ -255,9 +254,9 @@ sensible meaning, namely the lhs of an implicit binding. ------------------------------------------------------------------------------- -state 702 contains 1 shift/reduce conflicts. +state 707 contains 1 shift/reduce conflicts. - rule -> STRING rule_activation . rule_forall infixexp '=' exp (rule 215) + rule -> STRING rule_activation . rule_forall infixexp '=' exp Conflict: 'forall' (empty rule_forall reduces) @@ -272,20 +271,20 @@ doesn't include 'forall'. ------------------------------------------------------------------------------- -state 930 contains 1 shift/reduce conflicts. +state 933 contains 1 shift/reduce conflicts. - transformqual -> 'then' 'group' . 'using' exp (rule 528) - transformqual -> 'then' 'group' . 'by' exp 'using' exp (rule 529) - *** special_id -> 'group' . (rule 711) + transformqual -> 'then' 'group' . 'using' exp + transformqual -> 'then' 'group' . 'by' exp 'using' exp + *** special_id -> 'group' . Conflict: 'by' ------------------------------------------------------------------------------- -state 1270 contains 1 shift/reduce conflict. +state 1269 contains 1 shift/reduce conflict. - *** atype -> tyvar . (rule 314) - tv_bndr -> '(' tyvar . '::' kind ')' (rule 346) + *** atype -> tyvar . + tv_bndr -> '(' tyvar . '::' kind ')' Conflict: '::' |