<commit_before>module Main where

import J2s.Scanner
import qualified AG.Sintax as AGS

testTree :: AGS.Tree
testTree = AGS.Node (AGS.Tip 1) (AGS.Node (AGS.Tip 2)(AGS.Tip 3))

test :: Int
test = AGS.sem_Tree testTree

-- Para  imports
testJ2sImport :: AGS.J2s
testJ2sImport = AGS.J2s AGS.NilPackageDeclaration
    (AGS.ImportDeclarations (AGS.TypeImportOnDemandDeclaration
        (AGS.PackageOrTypeName "java" (AGS.PackageOrTypeName "lang" (AGS.PackageOrTypeName "reflect"
        (AGS.PackageOrTypeName "Field" AGS.NilPackageOrTypeName))))) AGS.NilImportDeclarations) []


testJ2s :: String
testJ2s = AGS.sem_J2s testJ2sImport

main  :: IO()
main =
     do
     putStrLn " Import result AG is .....  "
     print (show testJ2s)<commit_msg>begin read and write file<commit_after>module Main where

import J2s.Scanner
import qualified AG.Sintax as AGS
import System.Environment

--import Data.Set
import Data.Maybe
import Text.Printf
import System.IO
import System.Environment
import System.Posix.Temp

testTree :: AGS.Tree
testTree = AGS.Node (AGS.Tip 1) (AGS.Node (AGS.Tip 2)(AGS.Tip 3))

test :: Int
test = AGS.sem_Tree testTree

-- Para  imports
testJ2sImport :: AGS.J2s
testJ2sImport = AGS.J2s AGS.NilPackageDeclaration
    (AGS.ImportDeclarations (AGS.TypeImportOnDemandDeclaration
        (AGS.PackageOrTypeName "java" (AGS.PackageOrTypeName "lang" (AGS.PackageOrTypeName "reflect"
        (AGS.PackageOrTypeName "Field" AGS.NilPackageOrTypeName))))) AGS.NilImportDeclarations) []


testJ2s :: String
testJ2s = AGS.sem_J2s testJ2sImport

main  :: IO()
-- main =
--     do
--     putStrLn " Import result AG is .....  "
--     print (show testJ2s)
main = do
       g <- readJavaFile
       let conv = testJ2s
       writeScalaFile [conv]

readJavaFile = do
        [s] <- getArgs
        g   <- readFile s
        return g

writeScalaFile content = do
        (t,h) <- mkstemp "MyFile.scala"
        mapM_ (hPutStrLn h) content
        hClose h
        printf "%d writing scala file  '%s'\n" (length content) t
{'fraction_non_alphanumeric': 0.10664682539682539, 'fraction_numerical': 0.013392857142857142, 'mean_word_length': 3.2914893617021277, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '7336567', 'n_tokens_mistral': 743, 'n_tokens_neox': 732, 'n_words': 178}