cabal-version:       3.0
build-type:          Custom

name:                tlex-encoding
version:             0.3.0.0
license:             Apache-2.0 OR MPL-2.0
license-file:        LICENSE
copyright:           (c) 2021 Mizunashi Mana
author:              Mizunashi Mana
maintainer:          mizunashi-mana@noreply.git

category:            Parsing
homepage:            https://github.com/mizunashi-mana/tlex
bug-reports:         https://github.com/mizunashi-mana/tlex/issues
synopsis:            Encoding plugin for Tlex
description:
    Tlex is haskell libraries and toolchains for generating lexical analyzer.
    See also: https://github.com/mizunashi-mana/tlex

extra-source-files:
    README.md
    CHANGELOG.md

source-repository head
  type:     git
  location: https://github.com/mizunashi-mana/tlex.git

flag develop
    default:     False
    manual:      True
    description: Turn on some options for development

common general
    default-language:
        Haskell2010
    default-extensions:
        NoImplicitPrelude
        BangPatterns
        BinaryLiterals
        BlockArguments
        ConstraintKinds
        DataKinds
        DefaultSignatures
        DeriveFoldable
        DeriveFunctor
        DeriveGeneric
        DeriveLift
        DeriveTraversable
        DerivingVia
        DuplicateRecordFields
        EmptyCase
        FlexibleContexts
        FlexibleInstances
        FunctionalDependencies
        GADTs
        InstanceSigs
        LambdaCase
        MagicHash
        MultiParamTypeClasses
        MultiWayIf
        NamedFieldPuns
        NegativeLiterals
        NumericUnderscores
        OverloadedLabels
        PackageImports
        PatternSynonyms
        PolyKinds
        RankNTypes
        ScopedTypeVariables
        StandaloneDeriving
        Strict
        TypeApplications
        TypeFamilies
        TypeOperators
        UnboxedSums
        UnboxedTuples

    if flag(develop)
        ghc-options:
            -Wall
            -Wcompat
            -Wincomplete-uni-patterns
            -Wmonomorphism-restriction
            -Wpartial-fields

            -fprint-explicit-foralls
            -frefinement-level-hole-fits=1

            -dcore-lint

    build-depends:
        base                 >= 4.12.0 && < 4.15,

        -- project depends
        tlex-core            >= 0.3.0 && < 0.4,
        tlex                 >= 0.3.0 && < 0.4,
        charset              >= 0.3.7 && < 0.4,
        containers           >= 0.6.0 && < 0.7,
        enummapset-th        >= 0.6.0 && < 0.7,

    autogen-modules:
        Paths_tlex_encoding
    other-modules:
        Paths_tlex_encoding

custom-setup
    setup-depends:
        base,
        Cabal,
        cabal-doctest,

library
    import:
        general,
    hs-source-dirs:
        src
    exposed-modules:
        Language.Lexer.Tlex.Plugin.Encoding
        Language.Lexer.Tlex.Plugin.Encoding.CharSetP
        Language.Lexer.Tlex.Plugin.Encoding.UTF8
        Language.Lexer.Tlex.Data.Reporter

    other-modules:
        Language.Lexer.Tlex.Data.NonEmptyEnumStringSet

test-suite doctest
    import:
        general,
    type:
        exitcode-stdio-1.0
    hs-source-dirs:
        test/doctest
    main-is:
        Doctest.hs
    build-depends:
        doctest,
        QuickCheck,
    autogen-modules:
        Build_doctests
    other-modules:
        Build_doctests

test-suite spec
    import:
        general,
    type:
        exitcode-stdio-1.0
    hs-source-dirs:
        test/spec
    main-is:
        HSpecDriver.hs
    ghc-options:
        -Wno-missing-home-modules
    build-tool-depends:
        hspec-discover:hspec-discover,
    build-depends:
        tlex-encoding,

        hspec,
        QuickCheck,
