[commit: ghc] master: Lexer: delete dead code for binary character literals (2eddcd9)

git at git.haskell.org git at git.haskell.org
Wed Sep 30 19:47:18 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2eddcd9b65b7baf70dd3cc5a0b02cf0076c75560/ghc

>---------------------------------------------------------------

commit 2eddcd9b65b7baf70dd3cc5a0b02cf0076c75560
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Tue Sep 29 17:54:32 2015 +0200

    Lexer: delete dead code for binary character literals
    
    The Haskell 2010 report chapter 2.6 (Characters and String Literals)
    says:
    
      "Numeric escapes such as \137 are used to designate the character with
      decimal representation 137; octal (e.g. \o137) and hexadecimal (e.g.
      \x37) representations are also allowed."
    
    Commit 1c0b5fdc9f2b6ea8166cc565383d4cd20432343c added syntax for writing
    character literals using binary notation (e.g. '\b100100'). But this
    code can never be reached, because '\b' already represents "backspace".
    
    Turn on -fwarn-overlapping-patterns to catch such bugs in the future.
    
    Reviewed by: hvr
    
    Differential Revision: https://phabricator.haskell.org/D1291


>---------------------------------------------------------------

2eddcd9b65b7baf70dd3cc5a0b02cf0076c75560
 compiler/parser/Lexer.x | 2 --
 1 file changed, 2 deletions(-)

diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 7dce81c..ae2e966 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -50,7 +50,6 @@
 {-# OPTIONS_GHC -fno-warn-tabs #-}
 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
 
-{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}
 {-# OPTIONS_GHC -funbox-strict-fields #-}
 
 module Lexer (
@@ -1495,7 +1494,6 @@ lex_escape = do
 
         'x'   -> readNum is_hexdigit 16 hexDigit
         'o'   -> readNum is_octdigit  8 octDecDigit
-        'b'   -> readNum is_bindigit  2 octDecDigit
         x | is_decdigit x -> readNum2 is_decdigit 10 octDecDigit (octDecDigit x)
 
         c1 ->  do



More information about the ghc-commits mailing list