Skip to content

Commit

Permalink
feat: DAIDE parser for any pattern and automatic validation (#37)
Browse files Browse the repository at this point in the history
feat: daide parser for any pattern and automatic validation

The parser can now parse not just messages and arrangements, but any
DAIDE pattern.

Keyword objects are now automatically validated upon instantiation.

Closes: #36, #29
  • Loading branch information
mjspeck authored Nov 28, 2022
1 parent 3e2918d commit a0d016e
Show file tree
Hide file tree
Showing 10 changed files with 636 additions and 392 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test-pr

on:
pull_request:
branches:
- "main"

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set Up Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install daidepp
run: |
pip install -e .[dev]
- name: Test
run: |
pytest
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File All Code",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
}
]
}
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = daidepp
version = 0.2.0
version = 1.0.0
author = Byung Oh
author_email = byung.oh@cynnovative.com
description = "DAIDE Parser"
Expand Down
22 changes: 11 additions & 11 deletions src/daidepp/constants.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing_extensions import Literal

POWER = Literal["AUS", "ENG", "FRA", "GER", "ITA", "RUS", "TUR"]
UNIT_TYPE = Literal["AMY", "FLT"]
Power = Literal["AUS", "ENG", "FRA", "GER", "ITA", "RUS", "TUR"]
UnitType = Literal["AMY", "FLT"]

PROVINCE_LAND_SEA = Literal[
ProvinceLandSea = Literal[
"ALB",
"ANK",
"APU",
Expand Down Expand Up @@ -47,7 +47,7 @@
"YOR",
"WAL",
]
PROVINCE_LANDLOCK = Literal[
ProvinceLandlock = Literal[
"BOH",
"BUD",
"BUR",
Expand All @@ -63,7 +63,7 @@
"VIE",
"WAR",
]
PROVINCE_SEA = Literal[
ProvinceSea = Literal[
"ADR",
"AEG",
"BAL",
Expand All @@ -84,15 +84,15 @@
"TYS",
"WES",
]
PROVINCE_COAST = Literal[
ProvinceCoast = Literal[
"STP NCS", "STP SCS", "SPA NCS", "SPA SCS", "BUL ECS", "BUL SCS"
]
PROVINCE = Literal[PROVINCE_LAND_SEA, PROVINCE_LANDLOCK, PROVINCE_SEA, PROVINCE_COAST]
PROVINCE_NO_COAST = Literal[PROVINCE_LAND_SEA, PROVINCE_LANDLOCK, PROVINCE_SEA]
Province = Literal[ProvinceLandSea, ProvinceLandlock, ProvinceSea, ProvinceCoast]
ProvinceNoCoast = Literal[ProvinceLandSea, ProvinceLandlock, ProvinceSea]

SEASON = Literal["SPR", "SUM", "FAL", "AUT", "WIN"]
Season = Literal["SPR", "SUM", "FAL", "AUT", "WIN"]

TRY_TOKENS = Literal[
TryTokens = Literal[
"PRP",
"PCE",
"ALY",
Expand Down Expand Up @@ -132,7 +132,7 @@
"POB",
]

SUPPLY_CENTER = Literal[
SupplyCenter = Literal[
"ANK",
"BEL",
"BER",
Expand Down
Loading

0 comments on commit a0d016e

Please sign in to comment.