rawast 0.1.0a2__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.
Files changed (84) hide show
  1. rawast-0.1.0a2/.gitignore +45 -0
  2. rawast-0.1.0a2/CMakeLists.txt +122 -0
  3. rawast-0.1.0a2/CODE_OF_CONDUCT.md +18 -0
  4. rawast-0.1.0a2/CONTRIBUTING.md +51 -0
  5. rawast-0.1.0a2/LICENSE +21 -0
  6. rawast-0.1.0a2/PKG-INFO +469 -0
  7. rawast-0.1.0a2/README.md +437 -0
  8. rawast-0.1.0a2/SECURITY.md +44 -0
  9. rawast-0.1.0a2/docs/rawast-format.md +1123 -0
  10. rawast-0.1.0a2/examples/README.md +24 -0
  11. rawast-0.1.0a2/examples/json_edit.py +50 -0
  12. rawast-0.1.0a2/grammars/gdsii.rawast +232 -0
  13. rawast-0.1.0a2/grammars/json.json +71 -0
  14. rawast-0.1.0a2/grammars/lefdef.rawast +3537 -0
  15. rawast-0.1.0a2/grammars/rawast.json +734 -0
  16. rawast-0.1.0a2/grammars/rawast.rawast +187 -0
  17. rawast-0.1.0a2/grammars/tcl.rawast +161 -0
  18. rawast-0.1.0a2/include/rawast/grammar.hpp +356 -0
  19. rawast-0.1.0a2/include/rawast/linter.hpp +36 -0
  20. rawast-0.1.0a2/include/rawast/loader.hpp +76 -0
  21. rawast-0.1.0a2/include/rawast/node.hpp +139 -0
  22. rawast-0.1.0a2/include/rawast/parser.hpp +61 -0
  23. rawast-0.1.0a2/include/rawast/parsers.hpp +143 -0
  24. rawast-0.1.0a2/include/rawast/parsers_gdsii.hpp +55 -0
  25. rawast-0.1.0a2/include/rawast/parsers_lefdef.hpp +56 -0
  26. rawast-0.1.0a2/include/rawast/parsers_registry.hpp +73 -0
  27. rawast-0.1.0a2/include/rawast/parsers_tcl.hpp +135 -0
  28. rawast-0.1.0a2/include/rawast/pool.hpp +73 -0
  29. rawast-0.1.0a2/include/rawast/profile.hpp +65 -0
  30. rawast-0.1.0a2/include/rawast/stream.hpp +72 -0
  31. rawast-0.1.0a2/include/rawast/value.hpp +148 -0
  32. rawast-0.1.0a2/include/rawast/version.hpp +19 -0
  33. rawast-0.1.0a2/pyproject.toml +87 -0
  34. rawast-0.1.0a2/python/rawast/__init__.py +100 -0
  35. rawast-0.1.0a2/python/rawast/__main__.py +8 -0
  36. rawast-0.1.0a2/python/rawast/cli.py +487 -0
  37. rawast-0.1.0a2/python/rawast/docs.py +133 -0
  38. rawast-0.1.0a2/python/rawast/pycode.py +217 -0
  39. rawast-0.1.0a2/python/rawast/pydantic_gen.py +907 -0
  40. rawast-0.1.0a2/python/rawast/schema.py +356 -0
  41. rawast-0.1.0a2/python/src/native.cc +350 -0
  42. rawast-0.1.0a2/python/tests/data/def_spec_coverage.def +560 -0
  43. rawast-0.1.0a2/python/tests/data/lef_spec_coverage.lef +508 -0
  44. rawast-0.1.0a2/python/tests/data/sky130_fd_io_top_xres4v2.lef +4778 -0
  45. rawast-0.1.0a2/python/tests/data/sky130_fd_sc_hd_dlymetal6s2s_1.lef +150 -0
  46. rawast-0.1.0a2/python/tests/data/sky130_sram_1kbyte.lef +543 -0
  47. rawast-0.1.0a2/python/tests/data/sky130hd.tlef +792 -0
  48. rawast-0.1.0a2/python/tests/test_basic.py +184 -0
  49. rawast-0.1.0a2/python/tests/test_pydantic_gen.py +1749 -0
  50. rawast-0.1.0a2/python/tests/test_save_stack.py +117 -0
  51. rawast-0.1.0a2/src/frame.cpp +155 -0
  52. rawast-0.1.0a2/src/frame.hpp +95 -0
  53. rawast-0.1.0a2/src/grammar.cpp +1474 -0
  54. rawast-0.1.0a2/src/linter.cpp +440 -0
  55. rawast-0.1.0a2/src/loader.cpp +1085 -0
  56. rawast-0.1.0a2/src/node.cpp +7 -0
  57. rawast-0.1.0a2/src/parsers.cpp +555 -0
  58. rawast-0.1.0a2/src/parsers_gdsii.cpp +483 -0
  59. rawast-0.1.0a2/src/parsers_lefdef.cpp +124 -0
  60. rawast-0.1.0a2/src/parsers_registry.cpp +94 -0
  61. rawast-0.1.0a2/src/parsers_tcl.cpp +508 -0
  62. rawast-0.1.0a2/src/pool.cpp +84 -0
  63. rawast-0.1.0a2/src/profile.cpp +35 -0
  64. rawast-0.1.0a2/src/save_stack.cpp +1177 -0
  65. rawast-0.1.0a2/src/save_stack.hpp +36 -0
  66. rawast-0.1.0a2/src/stream.cpp +80 -0
  67. rawast-0.1.0a2/src/value.cpp +20 -0
  68. rawast-0.1.0a2/src/version.cpp +8 -0
  69. rawast-0.1.0a2/tests/CMakeLists.txt +47 -0
  70. rawast-0.1.0a2/tests/test_callbacks.cpp +246 -0
  71. rawast-0.1.0a2/tests/test_gdsii.cpp +442 -0
  72. rawast-0.1.0a2/tests/test_grammar.cpp +263 -0
  73. rawast-0.1.0a2/tests/test_json.cpp +269 -0
  74. rawast-0.1.0a2/tests/test_linter.cpp +229 -0
  75. rawast-0.1.0a2/tests/test_loader.cpp +576 -0
  76. rawast-0.1.0a2/tests/test_main.cpp +2 -0
  77. rawast-0.1.0a2/tests/test_node.cpp +62 -0
  78. rawast-0.1.0a2/tests/test_parsers.cpp +383 -0
  79. rawast-0.1.0a2/tests/test_pool.cpp +179 -0
  80. rawast-0.1.0a2/tests/test_pretty.cpp +473 -0
  81. rawast-0.1.0a2/tests/test_save.cpp +193 -0
  82. rawast-0.1.0a2/tests/test_stream.cpp +153 -0
  83. rawast-0.1.0a2/tests/test_value.cpp +79 -0
  84. rawast-0.1.0a2/tests/test_version.cpp +27 -0
@@ -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.0a2/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.