katt-0.2.0.3: Client for the Kattis judge system.

Safe HaskellNone

Utils.Katt.SourceHandler

Description

Provides searching of source code files and language identification.

Language identification is required in order to detect any inconsistencies (e.g. combining Java and C), and to tag submissions.

Java also requires identifying which file provides the main method.

Synopsis

Documentation

parseFilter :: [String] -> Maybe ([FilePath], [FilePath])Source

Parse an argument list from the +file1 -file2 style into two lists of file paths (included and ignored files).

findFiles :: IO [FilePath]Source

Locate all source files recursively from the current directory.

determineLanguage :: [FilePath] -> Maybe KattisLanguageSource

Determine source code language by studying file extensions. There is an implicit priority ordering, since C is a subset of C++.

findMainClass :: ([FilePath], KattisLanguage) -> IO (Maybe FilePath)Source

Locate main class based on source file contents. C++ and C solutions do not need to be specified, returns an empty string.

In the Java case all souce code files are parsed. All occurences of a main method defined with public static void are located.

Will return Nothing if result is ambiguous.

languageKattisName :: KattisLanguage -> ByteStringSource

Determine Kattis language string identifier.

languageContentType :: KattisLanguage -> ByteStringSource

Determine content type of submission language.