<commit_before>-----------------------------------------------------------------------------
-- |
-- Module      : Types
-- Copyright   : (c) 2012, 2013 <NAME>
-- License     : BSD-style
-- Maintainer  : <EMAIL>
-- Stability   : experimental
-- Portability : ghc
--
-- Type definitions which are used in multiple modules.
--
-----------------------------------------------------------------------------
module Types 
   ( Identifier, CompileConfig (..), VarIndex, IndexedVarSet
   , ConstantID, ConstantCache, CompileState (..), BlockState (..)
   , AnnotatedCode (..), LabelMap, Dumpable (..), VarSet
   , DefinitionScope (..), NestedScope (..), VarInfo (..)
   , ScopeIdentifier (..) ) where

import Data.Set (Set (..))
import Blip.Bytecode (Bytecode (..))
import Blip.Marshal (PyObject (..))
import Data.Word (Word32, Word16)
import qualified Data.Map as Map
import qualified Data.Set as Set
import Language.Python.Common.SrcLocation (SrcSpan)

-- information about how a variable is bound plus its offset into
-- the appropriate structure
data VarInfo
   = LocalVar VarIndex 
   | CellVar VarIndex 
   | FreeVar VarIndex 
   | GlobalVar VarIndex

type VarSet = Set Identifier

data DefinitionScope
   = DefinitionScope
     { definitionScope_params :: ![Identifier]
     , definitionScope_locals :: !VarSet
     , definitionScope_freeVars :: !VarSet
     , definitionScope_cellVars :: !VarSet
     , definitionScope_classLocals :: !VarSet
     }
     deriving Show

type ScopeIdentifier = SrcSpan

newtype NestedScope
   = NestedScope (Map.Map ScopeIdentifier (String, DefinitionScope, NestedScope))
   deriving Show

data Dumpable = DumpScope {- | something else -}
   deriving (Eq, Ord, Show)

data AnnotatedCode
   = AnnotatedCode 
     { annotatedCode_bytecode :: Bytecode
     , annotatedCode_labels :: ![Word16]   -- instruction can be labelled zero or more times
     , annotatedCode_index :: !Word16 } 
   deriving Show

type Identifier = String -- a variable name<commit_msg>Comment about the purpose of annotatedCode_index<commit_after>-----------------------------------------------------------------------------
-- |
-- Module      : Types
-- Copyright   : (c) 2012, 2013 <NAME>
-- License     : BSD-style
-- Maintainer  : <EMAIL>
-- Stability   : experimental
-- Portability : ghc
--
-- Type definitions which are used in multiple modules.
--
-----------------------------------------------------------------------------
module Types 
   ( Identifier, CompileConfig (..), VarIndex, IndexedVarSet
   , ConstantID, ConstantCache, CompileState (..), BlockState (..)
   , AnnotatedCode (..), LabelMap, Dumpable (..), VarSet
   , DefinitionScope (..), NestedScope (..), VarInfo (..)
   , ScopeIdentifier (..) ) where

import Data.Set (Set (..))
import Blip.Bytecode (Bytecode (..))
import Blip.Marshal (PyObject (..))
import Data.Word (Word32, Word16)
import qualified Data.Map as Map
import qualified Data.Set as Set
import Language.Python.Common.SrcLocation (SrcSpan)

-- information about how a variable is bound plus its offset into
-- the appropriate structure
data VarInfo
   = LocalVar VarIndex 
   | CellVar VarIndex 
   | FreeVar VarIndex 
   | GlobalVar VarIndex

type VarSet = Set Identifier

data DefinitionScope
   = DefinitionScope
     { definitionScope_params :: ![Identifier]
     , definitionScope_locals :: !VarSet
     , definitionScope_freeVars :: !VarSet
     , definitionScope_cellVars :: !VarSet
     , definitionScope_classLocals :: !VarSet
     }
     deriving Show

type ScopeIdentifier = SrcSpan

newtype NestedScope
   = NestedScope (Map.Map ScopeIdentifier (String, DefinitionScope, NestedScope))
   deriving Show

data Dumpable = DumpScope {- | something else -}
   deriving (Eq, Ord, Show)

data AnnotatedCode
   = AnnotatedCode 
     { annotatedCode_bytecode :: Bytecode
     , annotatedCode_labels :: ![Word16]   -- instruction can be labelled zero or more times
     , annotatedCode_index :: !Word16 }    -- byte offset of the instruction within this sequence of bytecode
   deriving Show

type Identifier = String -- a variable name
{'fraction_non_alphanumeric': 0.17205882352941176, 'fraction_numerical': 0.00784313725490196, 'mean_word_length': 2.4791133844842284, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1163977', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1099, 'n_words': 332}