Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# .github/workflows/run-tests.yml
name: Run tests

on:
Expand Down
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Ignore ENV file.
.env

# Python bytecode / caches
# Python bytecode / caches.
__pycache__/
*.py[cod]
*$py.class

# "*.py[cod]"" covers "*.pyc" too.
*.py[cod]

.pytest_cache/
.mypy_cache/

# Ignore Python linting cache.
.ruff_cache/

# Ignore compiled output (containing all emitted code and types).
dist/

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ from yini_parser import load
data = load("sample/basic.yini")
print(data["App"]["name"])

## Tests

In the dir `tests` contains some small but focused implementation-local test suite, with:

- Tests for the public API.
- Some few key semantic tests.
- Some smoke/golden tests.
54 changes: 39 additions & 15 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
version: '3'

vars:
GRAMMAR_BASE: ./grammar/v1.0.0-rc.5
GRAMMAR_BASE: ./grammar/v1.0.0-rc.5x
# BASE_FILE: YiniLexerBase.py # Target/language specific base file.

PARSER_FILE: "{{.GRAMMAR_BASE}}/YiniParser.g4"
LEXER_FILE: "{{.GRAMMAR_BASE}}/YiniLexer.g4"
ANTLR_JAR: ./libs/antlr4/antlr4-4.13.2-complete.jar
DIR_OUTPUT: ./src/grammar/generated
DIR_OUTPUT: ./src/yini_parser/grammar/generated
START_RULE: yini

tasks:
Expand All @@ -32,6 +32,11 @@ tasks:
# - python src/main.py ./sample/basic.yini
- python src/main.py sample/basic.yini

dev:
desc: Run development entrypoint
cmds:
- python src/dev.py

install:
desc: Install Python packages
cmds:
Expand All @@ -42,7 +47,7 @@ tasks:
cmds:
- python -m pip install -r requirements-dev.txt

generate-antlr:
antlr:
desc: Generate sources for the grammar (Windows only)
platforms: [windows]
cmds:
Expand Down Expand Up @@ -97,7 +102,7 @@ tasks:
# -lib {{.DIR_OUTPUT}}
# {{.PARSER_FILE}}

update-generate:
update-antlr:
desc: Generate using antlr4 wrapper (Windows only)
platforms: [windows]
cmds:
Expand Down Expand Up @@ -133,16 +138,35 @@ tasks:
typecheck:
desc: Run mypy type checking
cmds:
#- python -m mypy src
- python -m mypy src/main.py src/core

cls-gen:
# desc: Delete generated output directory contents (Windows only)
# platforms: [windows]
# cmds:
# - del "gen-output"
desc: Delete generated output directory contents (Windows only)
#- python -m mypy src
#- python -m mypy src/main.py src/yini-parser/core
#- python -m mypy src
# - python -m mypy -p src/yini_parser --explicit-package-bases --exclude "src[/\\\\]yini_parser[/\\\\]grammar[/\\\\]generated[/\\\\]" --ignore-missing-imports
- cmd /c "set MYPYPATH=src&& python -m mypy -p yini_parser --explicit-package-bases --ignore-missing-imports"

clean-gen:
desc: Delete generated ANTLR output directory contents (Windows only)
platforms: [windows]
cmds:
#- rmdir /s /q "{{.DIR_OUTPUT}}"
#- cmd /c rmdir /s /q "{{.DIR_OUTPUT}}"
- powershell -NoProfile -Command "if (Test-Path '{{.DIR_OUTPUT}}') { Remove-Item -Recurse -Force '{{.DIR_OUTPUT}}' }"

# Deletes Python caches under src:
# - __pycache__ directories
# - .pyc files
# - .pyo files, if any
clean-cache:
desc: Delete Python cache files and __pycache__ directories under src (Windows only)
platforms: [windows]
cmds:
- rmdir /s /q "{{.DIR_OUTPUT}}"

- powershell -NoProfile -Command "Get-ChildItem 'src' -Recurse -Directory -Filter '__pycache__' | Remove-Item -Recurse -Force"
- powershell -NoProfile -Command "Get-ChildItem 'src' -Recurse -File -Include *.pyc,*.pyo | Remove-Item -Force"
- powershell -NoProfile -Command "Get-ChildItem 'tests' -Recurse -Directory -Filter '__pycache__' | Remove-Item -Recurse -Force"
- powershell -NoProfile -Command "Get-ChildItem 'tests' -Recurse -File -Include *.pyc,*.pyo | Remove-Item -Force"

clean:
desc: Run all cleanup tasks
deps:
- clean-gen
- clean-cache
50 changes: 0 additions & 50 deletions src/api/load.py

This file was deleted.

41 changes: 0 additions & 41 deletions src/core/VisitorInterp.py

This file was deleted.

3 changes: 0 additions & 3 deletions src/core/parser_engine.py

This file was deleted.

Loading
Loading