nmhit 0.1.5__tar.gz → 0.2.1__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 (34) hide show
  1. {nmhit-0.1.5 → nmhit-0.2.1}/.github/workflows/release.yml +5 -12
  2. {nmhit-0.1.5 → nmhit-0.2.1}/CMakeLists.txt +1 -1
  3. {nmhit-0.1.5 → nmhit-0.2.1}/PKG-INFO +31 -2
  4. {nmhit-0.1.5 → nmhit-0.2.1}/README.md +30 -1
  5. {nmhit-0.1.5 → nmhit-0.2.1}/generated/Lexer.cpp +335 -257
  6. {nmhit-0.1.5 → nmhit-0.2.1}/generated/Lexer.h +2 -0
  7. {nmhit-0.1.5 → nmhit-0.2.1}/generated/Parser.h +4 -4
  8. {nmhit-0.1.5 → nmhit-0.2.1}/generated/location.hh +4 -4
  9. {nmhit-0.1.5 → nmhit-0.2.1}/include/nmhit/Node.h +10 -1
  10. {nmhit-0.1.5 → nmhit-0.2.1}/pyproject.toml +4 -5
  11. {nmhit-0.1.5 → nmhit-0.2.1}/python/tests/test_nmhit.py +129 -0
  12. {nmhit-0.1.5 → nmhit-0.2.1}/src/Lexer.l +17 -0
  13. {nmhit-0.1.5 → nmhit-0.2.1}/src/Node.cpp +21 -4
  14. {nmhit-0.1.5 → nmhit-0.2.1}/src/ParseDriver.h +23 -2
  15. {nmhit-0.1.5 → nmhit-0.2.1}/.clang-format +0 -0
  16. {nmhit-0.1.5 → nmhit-0.2.1}/.github/workflows/ci.yml +0 -0
  17. {nmhit-0.1.5 → nmhit-0.2.1}/.gitignore +0 -0
  18. {nmhit-0.1.5 → nmhit-0.2.1}/.pre-commit-config.yaml +0 -0
  19. {nmhit-0.1.5 → nmhit-0.2.1}/.pre-commit-hooks.yaml +0 -0
  20. {nmhit-0.1.5 → nmhit-0.2.1}/CONTRIBUTING.md +0 -0
  21. {nmhit-0.1.5 → nmhit-0.2.1}/cmake/nmhit.pc.in +0 -0
  22. {nmhit-0.1.5 → nmhit-0.2.1}/cmake/nmhitConfig.cmake.in +0 -0
  23. {nmhit-0.1.5 → nmhit-0.2.1}/generated/Parser.cpp +0 -0
  24. {nmhit-0.1.5 → nmhit-0.2.1}/include/nmhit/BraceExpr.h +0 -0
  25. {nmhit-0.1.5 → nmhit-0.2.1}/include/nmhit/TypeRegistry.h +0 -0
  26. {nmhit-0.1.5 → nmhit-0.2.1}/include/nmhit/nmhit.h +0 -0
  27. {nmhit-0.1.5 → nmhit-0.2.1}/python/nmhit/__init__.py +0 -0
  28. {nmhit-0.1.5 → nmhit-0.2.1}/python/nmhit/_cli.py +0 -0
  29. {nmhit-0.1.5 → nmhit-0.2.1}/python/nmhit/py.typed +0 -0
  30. {nmhit-0.1.5 → nmhit-0.2.1}/python/src/_nmhit.cpp +0 -0
  31. {nmhit-0.1.5 → nmhit-0.2.1}/src/BraceExpr.cpp +0 -0
  32. {nmhit-0.1.5 → nmhit-0.2.1}/src/Parser.y +0 -0
  33. {nmhit-0.1.5 → nmhit-0.2.1}/tests/CMakeLists.txt +0 -0
  34. {nmhit-0.1.5 → nmhit-0.2.1}/tests/test_hit.cpp +0 -0
@@ -18,21 +18,14 @@ jobs:
18
18
  steps:
19
19
  - uses: actions/checkout@v4
20
20
 
21
- - name: Set up QEMU (Linux arm64 cross-build)
22
- if: matrix.os == 'ubuntu-24.04'
23
- uses: docker/setup-qemu-action@v3
24
- with:
25
- platforms: arm64
26
-
27
21
  - name: Build wheels
28
- uses: pypa/cibuildwheel@v2.19
22
+ uses: pypa/cibuildwheel@v2.23
29
23
  env:
30
- CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"
24
+ CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
31
25
  CIBW_SKIP: "*-musllinux* *-manylinux_i686"
32
- CIBW_ARCHS_LINUX: "x86_64 aarch64"
33
- CIBW_ARCHS_MACOS: "x86_64 arm64"
34
- CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
35
- CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
26
+ CIBW_ARCHS_LINUX: "x86_64"
27
+ CIBW_ARCHS_MACOS: "x86_64"
28
+ CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
36
29
  CIBW_TEST_REQUIRES: "pytest"
37
30
  CIBW_TEST_COMMAND: "pytest {project}/python/tests/ -v"
38
31
 
@@ -1,6 +1,6 @@
1
1
  cmake_minimum_required(VERSION 3.20)
2
2
  # Keep this version in sync with [project] version in pyproject.toml.
3
- project(neml2-hit VERSION 0.1.5 LANGUAGES CXX)
3
+ project(neml2-hit VERSION 0.2.1 LANGUAGES CXX)
4
4
 
5
5
  set(CMAKE_CXX_STANDARD 17)
6
6
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nmhit
3
- Version: 0.1.5
3
+ Version: 0.2.1
4
4
  Summary: Python bindings for the nmhit NEML2-flavored HIT parser
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -182,6 +182,33 @@ path = /usr/local/share
182
182
 
183
183
  Unquoted strings are **single-line only** — they cannot contain whitespace or newlines.
184
184
 
185
+ #### Verbatim string (triple-quoted)
186
+
187
+ A triple-quoted string stores its content **verbatim** — all whitespace, newlines, and any
188
+ mix of quote characters are preserved exactly as written. Two delimiter styles are supported:
189
+
190
+ ```
191
+ # Triple single-quote delimiter
192
+ code = '''
193
+ import torch
194
+ result = torch.tensor([1.0, 2.0, 3.0])
195
+ '''
196
+
197
+ # Triple double-quote delimiter
198
+ label = """it's a "verbatim" value"""
199
+ ```
200
+
201
+ The content between the opening and closing `'''` (or `"""`) delimiters is returned unchanged by
202
+ `param_str()`. No whitespace stripping, no brace expansion, and no quote unescaping are performed.
203
+
204
+ **Verbatim fields are string-only.** Calling `param_int()`, `param_float()`, `param_bool()`,
205
+ `param_list_*()`, or any other non-string accessor on a verbatim field raises `nmhit::Error`.
206
+ Only `param_str()` (and its `param_optional_str` variant) is allowed.
207
+
208
+ > **Tip:** Triple-quoted strings solve the classic HIT quoting problem — a `'...'` string cannot
209
+ > contain `'`, and a `"..."` string cannot contain `"`. Triple-quoted strings can contain any
210
+ > combination of single and double quotes as long as they do not form the closing triple delimiter.
211
+
185
212
  #### Array (1-D)
186
213
 
187
214
  A whitespace-delimited sequence of elements enclosed in single quotes **or double quotes** —
@@ -288,7 +315,9 @@ quote = "'" | '"' ;
288
315
  value = integer | float | bool | unquoted_str
289
316
  | brace_expr
290
317
  | quote array_row (';' array_row)* quote
291
- | quote quote ;
318
+ | quote quote
319
+ | "'''" <verbatim content> "'''"
320
+ | '"""' <verbatim content> '"""' ;
292
321
  array_row = array_elem+ ;
293
322
  array_elem = integer | float | unquoted_elem ;
294
323
  include = '!include' path ;
@@ -169,6 +169,33 @@ path = /usr/local/share
169
169
 
170
170
  Unquoted strings are **single-line only** — they cannot contain whitespace or newlines.
171
171
 
172
+ #### Verbatim string (triple-quoted)
173
+
174
+ A triple-quoted string stores its content **verbatim** — all whitespace, newlines, and any
175
+ mix of quote characters are preserved exactly as written. Two delimiter styles are supported:
176
+
177
+ ```
178
+ # Triple single-quote delimiter
179
+ code = '''
180
+ import torch
181
+ result = torch.tensor([1.0, 2.0, 3.0])
182
+ '''
183
+
184
+ # Triple double-quote delimiter
185
+ label = """it's a "verbatim" value"""
186
+ ```
187
+
188
+ The content between the opening and closing `'''` (or `"""`) delimiters is returned unchanged by
189
+ `param_str()`. No whitespace stripping, no brace expansion, and no quote unescaping are performed.
190
+
191
+ **Verbatim fields are string-only.** Calling `param_int()`, `param_float()`, `param_bool()`,
192
+ `param_list_*()`, or any other non-string accessor on a verbatim field raises `nmhit::Error`.
193
+ Only `param_str()` (and its `param_optional_str` variant) is allowed.
194
+
195
+ > **Tip:** Triple-quoted strings solve the classic HIT quoting problem — a `'...'` string cannot
196
+ > contain `'`, and a `"..."` string cannot contain `"`. Triple-quoted strings can contain any
197
+ > combination of single and double quotes as long as they do not form the closing triple delimiter.
198
+
172
199
  #### Array (1-D)
173
200
 
174
201
  A whitespace-delimited sequence of elements enclosed in single quotes **or double quotes** —
@@ -275,7 +302,9 @@ quote = "'" | '"' ;
275
302
  value = integer | float | bool | unquoted_str
276
303
  | brace_expr
277
304
  | quote array_row (';' array_row)* quote
278
- | quote quote ;
305
+ | quote quote
306
+ | "'''" <verbatim content> "'''"
307
+ | '"""' <verbatim content> '"""' ;
279
308
  array_row = array_elem+ ;
280
309
  array_elem = integer | float | unquoted_elem ;
281
310
  include = '!include' path ;