| 1 |
{- |
| 2 |
- Language/Ding/Syntax.hs - general AST structures |
| 3 |
- |
| 4 |
- Copyright 2020 Einhard Leichtfuß |
| 5 |
- |
| 6 |
- This file is part of ding2tei-haskell. |
| 7 |
- |
| 8 |
- ding2tei-haskell is free software: you can redistribute it and/or modify |
| 9 |
- it under the terms of the GNU Affero General Public License as published |
| 10 |
- by the Free Software Foundation, either version 3 of the License, or |
| 11 |
- (at your option) any later version. |
| 12 |
- |
| 13 |
- ding2tei-haskell is distributed in the hope that it will be useful, |
| 14 |
- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
- GNU Affero General Public License for more details. |
| 17 |
- |
| 18 |
- You should have received a copy of the GNU Affero General Public License |
| 19 |
- along with ding2tei-haskell. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
-} |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
module Language.Ding.Syntax |
| 29 |
( Ding |
| 30 |
, Header(..) |
| 31 |
, Line(..) |
| 32 |
, Entry(..) |
| 33 |
, Group(..) |
| 34 |
, Unit(..) |
| 35 |
) where |
| 36 |
|
| 37 |
import Data.NatLang.Dictionary (Dictionary) |
| 38 |
import Data.NatLang.Example (Example) |
| 39 |
import Data.NatLang.Grammar (GrammarInfo) |
| 40 |
import Data.NatLang.InflectedForms (InflectedForms) |
| 41 |
import Data.NatLang.Usage (Usage) |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
type Ding = Dictionary Header Line |
| 47 |
|
| 48 |
|
| 49 |
data Header = Header |
| 50 |
{ headerVersion :: String |
| 51 |
, headerVersionDate :: String |
| 52 |
, headerCopyrightHolder :: String |
| 53 |
, headerCopyrightPeriod :: String |
| 54 |
, headerLicense :: String |
| 55 |
, headerURL :: String |
| 56 |
} |
| 57 |
deriving Show |
| 58 |
|
| 59 |
|
| 60 |
newtype Line = Line [Entry] |
| 61 |
deriving Show |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
data Entry = Entry Group Group |
| 67 |
deriving (Show, Eq, Ord) |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
newtype Group = Group [Unit] |
| 75 |
deriving (Show, Eq, Ord) |
| 76 |
|
| 77 |
-- TODO: ? Represent units being abbreviations differently? |
| 78 |
-- - e.g.: add UnitType argument -- @type="abbrev" |
| 79 |
-- | A single (key-)word or phrase, in one language, with annotations. |
| 80 |
data Unit = Unit |
| 81 |
{ unitHeadword :: String |
| 82 |
, unitPlain :: String |
| 83 |
, unitGrammar :: [GrammarInfo] |
| 84 |
, unitUsages :: [Usage] |
| 85 |
, unitPrefixes :: [String] |
| 86 |
, unitSuffixes :: [String] |
| 87 |
, unitAbbrevs :: [String] |
| 88 |
, unitInflected :: Maybe InflectedForms |
| 89 |
, unitReferences :: [String] -- ~tilde references |
| 90 |
, unitExamples :: [Example] -- initially none, added during enrichment |
| 91 |
} |
| 92 |
deriving (Show, Eq, Ord) |
| 93 |
|
| 94 |
|
| 95 |
-- vi: ft=haskell ts=2 sw=2 et |