rawast 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rawast-0.1.0/.gitignore +45 -0
- rawast-0.1.0/CMakeLists.txt +122 -0
- rawast-0.1.0/CODE_OF_CONDUCT.md +18 -0
- rawast-0.1.0/CONTRIBUTING.md +51 -0
- rawast-0.1.0/LICENSE +21 -0
- rawast-0.1.0/PKG-INFO +493 -0
- rawast-0.1.0/README.md +461 -0
- rawast-0.1.0/SECURITY.md +44 -0
- rawast-0.1.0/docs/rawast-format.md +1123 -0
- rawast-0.1.0/examples/README.md +24 -0
- rawast-0.1.0/examples/json_edit.py +50 -0
- rawast-0.1.0/grammars/gdsii.rawast +232 -0
- rawast-0.1.0/grammars/json.json +71 -0
- rawast-0.1.0/grammars/lefdef.rawast +3537 -0
- rawast-0.1.0/grammars/rawast.json +734 -0
- rawast-0.1.0/grammars/rawast.rawast +187 -0
- rawast-0.1.0/grammars/tcl.rawast +161 -0
- rawast-0.1.0/include/rawast/grammar.hpp +356 -0
- rawast-0.1.0/include/rawast/linter.hpp +36 -0
- rawast-0.1.0/include/rawast/loader.hpp +76 -0
- rawast-0.1.0/include/rawast/node.hpp +139 -0
- rawast-0.1.0/include/rawast/parser.hpp +61 -0
- rawast-0.1.0/include/rawast/parsers.hpp +143 -0
- rawast-0.1.0/include/rawast/parsers_gdsii.hpp +55 -0
- rawast-0.1.0/include/rawast/parsers_lefdef.hpp +56 -0
- rawast-0.1.0/include/rawast/parsers_registry.hpp +73 -0
- rawast-0.1.0/include/rawast/parsers_tcl.hpp +135 -0
- rawast-0.1.0/include/rawast/pool.hpp +73 -0
- rawast-0.1.0/include/rawast/profile.hpp +65 -0
- rawast-0.1.0/include/rawast/stream.hpp +72 -0
- rawast-0.1.0/include/rawast/value.hpp +148 -0
- rawast-0.1.0/include/rawast/version.hpp +19 -0
- rawast-0.1.0/pyproject.toml +87 -0
- rawast-0.1.0/python/rawast/__init__.py +100 -0
- rawast-0.1.0/python/rawast/__main__.py +8 -0
- rawast-0.1.0/python/rawast/cli.py +487 -0
- rawast-0.1.0/python/rawast/docs.py +133 -0
- rawast-0.1.0/python/rawast/pycode.py +217 -0
- rawast-0.1.0/python/rawast/pydantic_gen.py +907 -0
- rawast-0.1.0/python/rawast/schema.py +356 -0
- rawast-0.1.0/python/src/native.cc +350 -0
- rawast-0.1.0/python/tests/data/def_spec_coverage.def +560 -0
- rawast-0.1.0/python/tests/data/lef_spec_coverage.lef +508 -0
- rawast-0.1.0/python/tests/data/sky130_fd_io_top_xres4v2.lef +4778 -0
- rawast-0.1.0/python/tests/data/sky130_fd_sc_hd_dlymetal6s2s_1.lef +150 -0
- rawast-0.1.0/python/tests/data/sky130_sram_1kbyte.lef +543 -0
- rawast-0.1.0/python/tests/data/sky130hd.tlef +792 -0
- rawast-0.1.0/python/tests/test_basic.py +184 -0
- rawast-0.1.0/python/tests/test_pydantic_gen.py +1749 -0
- rawast-0.1.0/python/tests/test_save_stack.py +117 -0
- rawast-0.1.0/src/frame.cpp +155 -0
- rawast-0.1.0/src/frame.hpp +95 -0
- rawast-0.1.0/src/grammar.cpp +1474 -0
- rawast-0.1.0/src/linter.cpp +440 -0
- rawast-0.1.0/src/loader.cpp +1085 -0
- rawast-0.1.0/src/node.cpp +7 -0
- rawast-0.1.0/src/parsers.cpp +555 -0
- rawast-0.1.0/src/parsers_gdsii.cpp +483 -0
- rawast-0.1.0/src/parsers_lefdef.cpp +124 -0
- rawast-0.1.0/src/parsers_registry.cpp +94 -0
- rawast-0.1.0/src/parsers_tcl.cpp +508 -0
- rawast-0.1.0/src/pool.cpp +84 -0
- rawast-0.1.0/src/profile.cpp +35 -0
- rawast-0.1.0/src/save_stack.cpp +1177 -0
- rawast-0.1.0/src/save_stack.hpp +36 -0
- rawast-0.1.0/src/stream.cpp +80 -0
- rawast-0.1.0/src/value.cpp +20 -0
- rawast-0.1.0/src/version.cpp +8 -0
- rawast-0.1.0/tests/CMakeLists.txt +47 -0
- rawast-0.1.0/tests/test_callbacks.cpp +246 -0
- rawast-0.1.0/tests/test_gdsii.cpp +442 -0
- rawast-0.1.0/tests/test_grammar.cpp +263 -0
- rawast-0.1.0/tests/test_json.cpp +269 -0
- rawast-0.1.0/tests/test_linter.cpp +229 -0
- rawast-0.1.0/tests/test_loader.cpp +576 -0
- rawast-0.1.0/tests/test_main.cpp +2 -0
- rawast-0.1.0/tests/test_node.cpp +62 -0
- rawast-0.1.0/tests/test_parsers.cpp +383 -0
- rawast-0.1.0/tests/test_pool.cpp +179 -0
- rawast-0.1.0/tests/test_pretty.cpp +473 -0
- rawast-0.1.0/tests/test_save.cpp +193 -0
- rawast-0.1.0/tests/test_stream.cpp +153 -0
- rawast-0.1.0/tests/test_value.cpp +79 -0
- rawast-0.1.0/tests/test_version.cpp +27 -0
rawast-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# macOS
|
|
2
|
+
.DS_Store
|
|
3
|
+
|
|
4
|
+
# CMake build artifacts
|
|
5
|
+
build/
|
|
6
|
+
build-*/
|
|
7
|
+
cmake-build-*/
|
|
8
|
+
CMakeCache.txt
|
|
9
|
+
CMakeFiles/
|
|
10
|
+
CMakeUserPresets.json
|
|
11
|
+
*.cmake.lock
|
|
12
|
+
|
|
13
|
+
# Compiled objects and binaries
|
|
14
|
+
*.o
|
|
15
|
+
*.obj
|
|
16
|
+
*.a
|
|
17
|
+
*.lib
|
|
18
|
+
*.so
|
|
19
|
+
*.so.*
|
|
20
|
+
*.dylib
|
|
21
|
+
*.dll
|
|
22
|
+
*.exe
|
|
23
|
+
|
|
24
|
+
# Editors / IDEs
|
|
25
|
+
.vscode/
|
|
26
|
+
.idea/
|
|
27
|
+
.kdev4/
|
|
28
|
+
*.kdev4
|
|
29
|
+
*.swp
|
|
30
|
+
*.swo
|
|
31
|
+
*.bak
|
|
32
|
+
*~
|
|
33
|
+
|
|
34
|
+
# Python bindings, packaging artefacts, test caches
|
|
35
|
+
__pycache__/
|
|
36
|
+
*.pyc
|
|
37
|
+
*.pyo
|
|
38
|
+
*.egg-info/
|
|
39
|
+
.venv/
|
|
40
|
+
venv/
|
|
41
|
+
dist/
|
|
42
|
+
build-py/
|
|
43
|
+
.pytest_cache/
|
|
44
|
+
_skbuild/
|
|
45
|
+
.eggs/
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.20)
|
|
2
|
+
|
|
3
|
+
project(rawast
|
|
4
|
+
# CMake's project(VERSION ...) only accepts numeric components
|
|
5
|
+
# (up to 4 dot-separated integers), so it can't carry PEP 440
|
|
6
|
+
# pre-release suffixes. The actual user-visible version lives in
|
|
7
|
+
# pyproject.toml (Python wheel) and include/rawast/version.hpp
|
|
8
|
+
# (C++ string `rawast::VERSION`); both may carry an `aN` / `bN`
|
|
9
|
+
# / `rcN` tier the CMake VERSION here cannot.
|
|
10
|
+
VERSION 0.1.0
|
|
11
|
+
DESCRIPTION "Data-driven predictive PEG parser engine and .jast container format"
|
|
12
|
+
LANGUAGES CXX
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
16
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
17
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
18
|
+
|
|
19
|
+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
20
|
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Default build type" FORCE)
|
|
21
|
+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
|
22
|
+
Debug Release RelWithDebInfo MinSizeRel)
|
|
23
|
+
endif()
|
|
24
|
+
|
|
25
|
+
option(RAWAST_BUILD_TESTS "Build tests" ON)
|
|
26
|
+
option(RAWAST_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
|
|
27
|
+
|
|
28
|
+
# Some upstream dependencies (doctest, tl::expected) still declare very old
|
|
29
|
+
# cmake_minimum_required values that modern CMake refuses outright. Tell CMake
|
|
30
|
+
# to apply at least the 3.5 policy set when configuring those sub-projects.
|
|
31
|
+
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
|
32
|
+
|
|
33
|
+
include(FetchContent)
|
|
34
|
+
|
|
35
|
+
# tl::expected — header-only error type.
|
|
36
|
+
FetchContent_Declare(tl-expected
|
|
37
|
+
GIT_REPOSITORY https://github.com/TartanLlama/expected.git
|
|
38
|
+
GIT_TAG v1.1.0
|
|
39
|
+
GIT_SHALLOW ON
|
|
40
|
+
)
|
|
41
|
+
set(EXPECTED_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
42
|
+
FetchContent_MakeAvailable(tl-expected)
|
|
43
|
+
|
|
44
|
+
# Library target.
|
|
45
|
+
add_library(rawast STATIC
|
|
46
|
+
src/version.cpp
|
|
47
|
+
src/value.cpp
|
|
48
|
+
src/node.cpp
|
|
49
|
+
src/stream.cpp
|
|
50
|
+
src/parsers.cpp
|
|
51
|
+
src/pool.cpp
|
|
52
|
+
src/frame.cpp
|
|
53
|
+
src/grammar.cpp
|
|
54
|
+
src/save_stack.cpp
|
|
55
|
+
src/loader.cpp
|
|
56
|
+
src/linter.cpp
|
|
57
|
+
src/profile.cpp
|
|
58
|
+
src/parsers_gdsii.cpp
|
|
59
|
+
src/parsers_lefdef.cpp
|
|
60
|
+
src/parsers_tcl.cpp
|
|
61
|
+
src/parsers_registry.cpp
|
|
62
|
+
)
|
|
63
|
+
add_library(rawast::rawast ALIAS rawast)
|
|
64
|
+
|
|
65
|
+
target_include_directories(rawast
|
|
66
|
+
PUBLIC
|
|
67
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
68
|
+
$<INSTALL_INTERFACE:include>
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
target_link_libraries(rawast PUBLIC tl::expected)
|
|
72
|
+
|
|
73
|
+
target_compile_features(rawast PUBLIC cxx_std_17)
|
|
74
|
+
|
|
75
|
+
if(RAWAST_WARNINGS_AS_ERRORS)
|
|
76
|
+
if(MSVC)
|
|
77
|
+
target_compile_options(rawast PRIVATE /W4 /WX)
|
|
78
|
+
else()
|
|
79
|
+
target_compile_options(rawast PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
80
|
+
endif()
|
|
81
|
+
else()
|
|
82
|
+
if(MSVC)
|
|
83
|
+
target_compile_options(rawast PRIVATE /W4)
|
|
84
|
+
else()
|
|
85
|
+
target_compile_options(rawast PRIVATE -Wall -Wextra -Wpedantic)
|
|
86
|
+
endif()
|
|
87
|
+
endif()
|
|
88
|
+
|
|
89
|
+
if(RAWAST_BUILD_TESTS)
|
|
90
|
+
enable_testing()
|
|
91
|
+
add_subdirectory(tests)
|
|
92
|
+
endif()
|
|
93
|
+
|
|
94
|
+
# -----------------------------------------------------------------------
|
|
95
|
+
# Python binding (built only when invoked via scikit-build-core).
|
|
96
|
+
# -----------------------------------------------------------------------
|
|
97
|
+
if(SKBUILD)
|
|
98
|
+
set_property(TARGET rawast PROPERTY POSITION_INDEPENDENT_CODE ON)
|
|
99
|
+
|
|
100
|
+
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
|
|
101
|
+
|
|
102
|
+
FetchContent_Declare(nanobind
|
|
103
|
+
GIT_REPOSITORY https://github.com/wjakob/nanobind.git
|
|
104
|
+
GIT_TAG v2.4.0
|
|
105
|
+
GIT_SHALLOW ON
|
|
106
|
+
)
|
|
107
|
+
FetchContent_MakeAvailable(nanobind)
|
|
108
|
+
|
|
109
|
+
nanobind_add_module(_native NB_STATIC python/src/native.cc)
|
|
110
|
+
target_link_libraries(_native PRIVATE rawast::rawast)
|
|
111
|
+
target_compile_features(_native PRIVATE cxx_std_17)
|
|
112
|
+
|
|
113
|
+
install(TARGETS _native LIBRARY DESTINATION rawast)
|
|
114
|
+
|
|
115
|
+
# Bundle the canonical grammars/ directory into the wheel under
|
|
116
|
+
# rawast/grammars/ so Grammar(name) and grammar_path(name) resolve
|
|
117
|
+
# at runtime in installed wheels (editable installs use the
|
|
118
|
+
# python/rawast/grammars symlink to the same files in the repo).
|
|
119
|
+
install(DIRECTORY ${CMAKE_SOURCE_DIR}/grammars/
|
|
120
|
+
DESTINATION rawast/grammars
|
|
121
|
+
FILES_MATCHING PATTERN "*.json" PATTERN "*.rawast")
|
|
122
|
+
endif()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
This project follows the [Contributor Covenant, version 2.1][cc]. The
|
|
4
|
+
short version: be respectful, assume good faith, focus on the work,
|
|
5
|
+
welcome contributors regardless of background or experience level.
|
|
6
|
+
|
|
7
|
+
For the full text, including enforcement guidelines, see:
|
|
8
|
+
|
|
9
|
+
https://www.contributor-covenant.org/version/2/1/code_of_conduct/
|
|
10
|
+
|
|
11
|
+
## Reporting
|
|
12
|
+
|
|
13
|
+
If you experience or witness behaviour that violates this code,
|
|
14
|
+
please email the project maintainer at the contact address listed on
|
|
15
|
+
the [org page](https://github.com/edacommons). Reports are handled
|
|
16
|
+
confidentially.
|
|
17
|
+
|
|
18
|
+
[cc]: https://www.contributor-covenant.org/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Contributing to rawast
|
|
2
|
+
|
|
3
|
+
Thanks for the interest. rawast is small enough that any thoughtful
|
|
4
|
+
issue or pull request is welcome.
|
|
5
|
+
|
|
6
|
+
## Getting set up
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
git clone https://github.com/edacommons/rawast.git
|
|
10
|
+
cd rawast
|
|
11
|
+
|
|
12
|
+
# C++ build + tests
|
|
13
|
+
cmake -B build && cmake --build build
|
|
14
|
+
ctest --test-dir build --output-on-failure
|
|
15
|
+
|
|
16
|
+
# Python build + tests
|
|
17
|
+
python -m venv .venv && source .venv/bin/activate
|
|
18
|
+
pip install -e ".[test]"
|
|
19
|
+
pytest python/tests/
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The C++ tests use [doctest](https://github.com/doctest/doctest) and
|
|
23
|
+
the Python tests use [pytest](https://pytest.org). Both run on every
|
|
24
|
+
push via the CI workflow in `.github/workflows/ci.yml`.
|
|
25
|
+
|
|
26
|
+
## What's helpful
|
|
27
|
+
|
|
28
|
+
- **Bug reports.** Open an issue with a minimal reproduction —
|
|
29
|
+
ideally a small grammar fragment and the input that misbehaves.
|
|
30
|
+
- **New grammars.** Each grammar (`grammars/*.rawast`) is mostly
|
|
31
|
+
self-contained data; a new format becomes a new file plus
|
|
32
|
+
whatever terminal parsers it needs. See `grammars/json.json` and
|
|
33
|
+
`grammars/gdsii.rawast` for examples of text and binary patterns
|
|
34
|
+
respectively, and `docs/rawast-format.md` for the language spec.
|
|
35
|
+
- **Pull requests.** For non-trivial changes, opening an issue first
|
|
36
|
+
to talk through the approach saves time. Small fixes are fine to
|
|
37
|
+
submit directly.
|
|
38
|
+
|
|
39
|
+
## Style
|
|
40
|
+
|
|
41
|
+
- C++20, `clang-format`-friendly two-space indent, no tabs.
|
|
42
|
+
- Public APIs in `include/rawast/`, implementations in `src/`.
|
|
43
|
+
- Test additions go in `tests/` (doctest) or `python/tests/` (pytest).
|
|
44
|
+
- Commit messages: imperative subject (`feat:`, `fix:`, `docs:`,
|
|
45
|
+
`refactor:`, `test:`), wrapped at ~72 columns, with body
|
|
46
|
+
explaining *why* the change exists rather than restating the diff.
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
By contributing you agree your changes are released under the
|
|
51
|
+
project's MIT license (see [LICENSE](LICENSE)).
|
rawast-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Serge Rabyking
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|