File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed
Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import Data.Char (isAlpha)
1414import Data.Foldable (toList )
1515import Data.Functor (($>) )
1616import Data.Maybe (fromMaybe , mapMaybe , maybeToList )
17- import Data.Text (Text )
17+ import Data.Text (Text , pack )
1818import qualified Data.Text as Text
1919import Data.Void (Void )
2020import Nixfmt.Lexer (lexeme , takeTrivia , whole )
@@ -71,8 +71,7 @@ import Text.Megaparsec (
7171 try ,
7272 (<|>) ,
7373 )
74- import Text.Megaparsec.Char (char )
75- import qualified Text.Megaparsec.Char.Lexer as L (decimal )
74+ import Text.Megaparsec.Char (char , digitChar )
7675import Prelude hiding (String )
7776
7877-- HELPER FUNCTIONS
@@ -110,7 +109,7 @@ reserved t =
110109-- VALUES
111110
112111integer :: Parser (Ann Token )
113- integer = ann Integer L. decimal
112+ integer = ann Integer (pack <$> some digitChar)
114113
115114float :: Parser (Ann Token )
116115float = ann Float floatParse
Original file line number Diff line number Diff line change @@ -48,10 +48,9 @@ import Control.Monad.State.Strict (StateT)
4848import Data.Bifunctor (first )
4949import Data.Foldable (toList )
5050import Data.Function (on )
51- import Data.Int (Int64 )
5251import Data.List.NonEmpty as NonEmpty
5352import Data.Maybe (maybeToList )
54- import Data.Text (Text , pack )
53+ import Data.Text (Text )
5554import Data.Void (Void )
5655import Text.Megaparsec (Pos )
5756import qualified Text.Megaparsec as MP (ParseErrorBundle , Parsec , pos1 )
@@ -488,7 +487,7 @@ instance (LanguageElement a) => LanguageElement (NonEmpty a) where
488487 mapAllTokens f = NonEmpty. map (mapAllTokens f)
489488
490489data Token
491- = Integer Int64
490+ = Integer Text
492491 | Float Text
493492 | Identifier Text
494493 | EnvPath Text
@@ -588,7 +587,7 @@ operators =
588587
589588tokenText :: Token -> Text
590589tokenText (Identifier i) = i
591- tokenText (Integer i) = pack ( show i)
590+ tokenText (Integer i) = i
592591tokenText (Float f) = f
593592tokenText (EnvPath p) = " <" <> p <> " >"
594593tokenText KAssert = " assert"
Original file line number Diff line number Diff line change 33 ( - 1 )
44 0
55 1
6- # 01
7- # 0000000000000000000000000000000000000000000001
6+ # https://github.com/NixOS/nixfmt/issues/292
7+ 01
8+ 0000000000000000000000000000000000000000000001
89 9223372036854775807
10+ 55555555555555555555555555555
11+ ( - 9223372036854775808 )
12+ 9223372036854775808
913
1014 .1
1115 0.1
You can’t perform that action at this time.
0 commit comments