diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs index f964669e9..b92fbeee6 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Abs.hs @@ -143,9 +143,9 @@ newtype BytesMetaId = BytesMetaId String newtype MetaFunctionName = MetaFunctionName String deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) -newtype DoubleSigned = DoubleSigned String +newtype IntegerSigned = IntegerSigned String deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) -newtype IntegerSigned = IntegerSigned String +newtype DoubleSigned = DoubleSigned String deriving (C.Eq, C.Ord, C.Show, C.Read, C.Data, C.Typeable, C.Generic, Data.String.IsString) diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt index ab5f82c84..803b9db59 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Doc.txt @@ -76,12 +76,12 @@ MetaFunctionName literals are recognized by the regular expression `````'@' (char - [" !'(),-.:;?[]{|}⟦⟧"])*````` -DoubleSigned literals are recognized by the regular expression -`````'-'? digit+ '.' digit+ ('e' '-'? digit+)?````` - IntegerSigned literals are recognized by the regular expression `````'-'? digit+````` +DoubleSigned literals are recognized by the regular expression +`````'-'? digit+ '.' digit+ ('e' '-'? digit+)?````` + ===Reserved words and symbols=== The set of reserved words is the set of terminals appearing in the grammar. Those reserved words that consist of non-letter characters are called symbols, and they are treated in a different way from those that are similar to identifiers. The lexer follows rules familiar from languages like Haskell, C, and Java, including longest match and spacing conventions. diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x index c9111df46..90f1522e1 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Lex.x @@ -85,14 +85,14 @@ $s [$u # [\t \n \r \ \! \' \( \) \, \. \: \; \? \[ \] \{ \| \} \⟦ \⟧]] * \@ [$u # [\t \n \r \ \! \' \( \) \, \- \. \: \; \? \[ \] \{ \| \} \⟦ \⟧]] * { tok (eitherResIdent T_MetaFunctionName) } --- token DoubleSigned -\- ? $d + \. $d + (e \- ? $d +)? - { tok (eitherResIdent T_DoubleSigned) } - -- token IntegerSigned \- ? $d + { tok (eitherResIdent T_IntegerSigned) } +-- token DoubleSigned +\- ? $d + \. $d + (e \- ? $d +)? + { tok (eitherResIdent T_DoubleSigned) } + -- Keywords and Ident $l $i* { tok (eitherResIdent TV) } @@ -132,8 +132,8 @@ data Tok | T_ObjectMetaId !String | T_BytesMetaId !String | T_MetaFunctionName !String - | T_DoubleSigned !String | T_IntegerSigned !String + | T_DoubleSigned !String deriving (Eq, Show, Ord) -- | Smart constructor for 'Tok' for the sake of backwards compatibility. @@ -206,8 +206,8 @@ tokenText t = case t of PT _ (T_ObjectMetaId s) -> s PT _ (T_BytesMetaId s) -> s PT _ (T_MetaFunctionName s) -> s - PT _ (T_DoubleSigned s) -> s PT _ (T_IntegerSigned s) -> s + PT _ (T_DoubleSigned s) -> s -- | Convert a token to a string. prToken :: Token -> String diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y index f11ca5326..fb0f57941 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Par.y @@ -83,8 +83,8 @@ import Language.EO.Phi.Syntax.Lex L_ObjectMetaId { PT _ (T_ObjectMetaId $$) } L_BytesMetaId { PT _ (T_BytesMetaId $$) } L_MetaFunctionName { PT _ (T_MetaFunctionName $$) } - L_DoubleSigned { PT _ (T_DoubleSigned $$) } L_IntegerSigned { PT _ (T_IntegerSigned $$) } + L_DoubleSigned { PT _ (T_DoubleSigned $$) } %% @@ -127,12 +127,12 @@ BytesMetaId : L_BytesMetaId { Language.EO.Phi.Syntax.Abs.BytesMetaId $1 } MetaFunctionName :: { Language.EO.Phi.Syntax.Abs.MetaFunctionName } MetaFunctionName : L_MetaFunctionName { Language.EO.Phi.Syntax.Abs.MetaFunctionName $1 } -DoubleSigned :: { Language.EO.Phi.Syntax.Abs.DoubleSigned } -DoubleSigned : L_DoubleSigned { Language.EO.Phi.Syntax.Abs.DoubleSigned $1 } - IntegerSigned :: { Language.EO.Phi.Syntax.Abs.IntegerSigned } IntegerSigned : L_IntegerSigned { Language.EO.Phi.Syntax.Abs.IntegerSigned $1 } +DoubleSigned :: { Language.EO.Phi.Syntax.Abs.DoubleSigned } +DoubleSigned : L_DoubleSigned { Language.EO.Phi.Syntax.Abs.DoubleSigned $1 } + Program :: { Language.EO.Phi.Syntax.Abs.Program } Program : '{' '⟦' ListBinding '⟧' '}' { Language.EO.Phi.Syntax.Abs.Program $3 } diff --git a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs index 19d1c25d2..778131c4d 100644 --- a/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs +++ b/eo-phi-normalizer/src/Language/EO/Phi/Syntax/Print.hs @@ -190,10 +190,10 @@ instance Print Language.EO.Phi.Syntax.Abs.BytesMetaId where prt _ (Language.EO.Phi.Syntax.Abs.BytesMetaId i) = doc $ showString i instance Print Language.EO.Phi.Syntax.Abs.MetaFunctionName where prt _ (Language.EO.Phi.Syntax.Abs.MetaFunctionName i) = doc $ showString i -instance Print Language.EO.Phi.Syntax.Abs.DoubleSigned where - prt _ (Language.EO.Phi.Syntax.Abs.DoubleSigned i) = doc $ showString i instance Print Language.EO.Phi.Syntax.Abs.IntegerSigned where prt _ (Language.EO.Phi.Syntax.Abs.IntegerSigned i) = doc $ showString i +instance Print Language.EO.Phi.Syntax.Abs.DoubleSigned where + prt _ (Language.EO.Phi.Syntax.Abs.DoubleSigned i) = doc $ showString i instance Print Language.EO.Phi.Syntax.Abs.Program where prt i = \case Language.EO.Phi.Syntax.Abs.Program bindings -> prPrec i 0 (concatD [doc (showString "{"), doc (showString "\10214"), prt 0 bindings, doc (showString "\10215"), doc (showString "}")])