snail-lang 0.5.3__tar.gz → 0.6.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 (57) hide show
  1. {snail_lang-0.5.3 → snail_lang-0.6.1}/Cargo.lock +7 -7
  2. {snail_lang-0.5.3 → snail_lang-0.6.1}/PKG-INFO +38 -6
  3. {snail_lang-0.5.3 → snail_lang-0.6.1}/README.md +37 -5
  4. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-ast/Cargo.toml +1 -1
  5. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-ast/src/ast.rs +33 -0
  6. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-ast/src/awk.rs +1 -0
  7. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-core/Cargo.toml +1 -1
  8. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-core/src/lib.rs +39 -0
  9. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-error/Cargo.toml +1 -1
  10. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/Cargo.toml +1 -1
  11. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/README.md +1 -1
  12. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/src/constants.rs +21 -0
  13. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/src/expr.rs +349 -1
  14. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/src/lib.rs +4 -0
  15. snail_lang-0.6.1/crates/snail-lower/src/map.rs +284 -0
  16. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/src/operators.rs +29 -1
  17. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/Cargo.toml +1 -1
  18. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/src/expr.rs +184 -24
  19. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/src/lib.rs +400 -1
  20. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/src/snail.pest +18 -9
  21. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/src/stmt.rs +4 -1
  22. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/src/string.rs +59 -1
  23. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/src/util.rs +3 -0
  24. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/tests/errors.rs +35 -0
  25. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/tests/parser.rs +221 -1
  26. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-python/Cargo.toml +1 -1
  27. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-python/src/lib.rs +94 -8
  28. {snail_lang-0.5.3 → snail_lang-0.6.1}/pyproject.toml +1 -1
  29. {snail_lang-0.5.3 → snail_lang-0.6.1}/python/snail/__init__.py +10 -2
  30. {snail_lang-0.5.3 → snail_lang-0.6.1}/python/snail/cli.py +105 -13
  31. {snail_lang-0.5.3 → snail_lang-0.6.1}/python/snail/runtime/__init__.py +71 -0
  32. snail_lang-0.6.1/python/snail/runtime/augmented.py +49 -0
  33. snail_lang-0.6.1/python/snail/runtime/lazy_text.py +50 -0
  34. {snail_lang-0.5.3 → snail_lang-0.6.1}/Cargo.toml +0 -0
  35. {snail_lang-0.5.3 → snail_lang-0.6.1}/LICENSE +0 -0
  36. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-ast/README.md +0 -0
  37. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-ast/src/lib.rs +0 -0
  38. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-core/README.md +0 -0
  39. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-error/README.md +0 -0
  40. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-error/src/lib.rs +0 -0
  41. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/src/awk.rs +0 -0
  42. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/src/helpers.rs +0 -0
  43. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/src/program.rs +0 -0
  44. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/src/py_ast.rs +0 -0
  45. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-lower/src/stmt.rs +0 -0
  46. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/README.md +0 -0
  47. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/src/awk.rs +0 -0
  48. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/src/literal.rs +0 -0
  49. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/tests/common.rs +0 -0
  50. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/tests/statements.rs +0 -0
  51. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/tests/syntax_expressions.rs +0 -0
  52. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-parser/tests/syntax_strings.rs +0 -0
  53. {snail_lang-0.5.3 → snail_lang-0.6.1}/crates/snail-python/build.rs +0 -0
  54. {snail_lang-0.5.3 → snail_lang-0.6.1}/python/snail/runtime/compact_try.py +0 -0
  55. {snail_lang-0.5.3 → snail_lang-0.6.1}/python/snail/runtime/regex.py +0 -0
  56. {snail_lang-0.5.3 → snail_lang-0.6.1}/python/snail/runtime/structured_accessor.py +0 -0
  57. {snail_lang-0.5.3 → snail_lang-0.6.1}/python/snail/runtime/subprocess.py +0 -0
@@ -485,11 +485,11 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
485
485
 
486
486
  [[package]]
487
487
  name = "snail-ast"
488
- version = "0.5.3"
488
+ version = "0.6.1"
489
489
 
490
490
  [[package]]
491
491
  name = "snail-core"
492
- version = "0.5.3"
492
+ version = "0.6.1"
493
493
  dependencies = [
494
494
  "pyo3",
495
495
  "snail-ast",
@@ -500,14 +500,14 @@ dependencies = [
500
500
 
501
501
  [[package]]
502
502
  name = "snail-error"
503
- version = "0.5.3"
503
+ version = "0.6.1"
504
504
  dependencies = [
505
505
  "snail-ast",
506
506
  ]
507
507
 
508
508
  [[package]]
509
509
  name = "snail-lower"
510
- version = "0.5.3"
510
+ version = "0.6.1"
511
511
  dependencies = [
512
512
  "pyo3",
513
513
  "snail-ast",
@@ -516,7 +516,7 @@ dependencies = [
516
516
 
517
517
  [[package]]
518
518
  name = "snail-parser"
519
- version = "0.5.3"
519
+ version = "0.6.1"
520
520
  dependencies = [
521
521
  "pest",
522
522
  "pest_derive",
@@ -526,7 +526,7 @@ dependencies = [
526
526
 
527
527
  [[package]]
528
528
  name = "snail-proptest"
529
- version = "0.5.3"
529
+ version = "0.6.1"
530
530
  dependencies = [
531
531
  "proptest",
532
532
  "pyo3",
@@ -540,7 +540,7 @@ dependencies = [
540
540
 
541
541
  [[package]]
542
542
  name = "snail-python"
543
- version = "0.5.3"
543
+ version = "0.6.1"
544
544
  dependencies = [
545
545
  "pyo3",
546
546
  "snail-core",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: snail-lang
3
- Version: 0.5.3
3
+ Version: 0.6.1
4
4
  Requires-Dist: jmespath>=1.0.1
5
5
  Requires-Dist: maturin>=1.5 ; extra == 'dev'
6
6
  Requires-Dist: pytest ; extra == 'dev'
@@ -13,11 +13,10 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
13
13
  <p align="center">
14
14
  <img src="logo.png" alt="Snail logo" width="200">
15
15
  </p>
16
- <p align="center"><em>What do you get when you shove a snake in a shell?</em></p>
17
16
 
18
17
  <h1 align="center">Snail</h1>
19
18
 
20
- **Snail** is a programming language that compiles to Python, combining Python's familiarity and extensive libraries with Perl/awk-inspired syntax for quick scripts and one-liners.
19
+ **Snail** is a programming language that compiles to Python, combining Python's familiarity and extensive libraries with Perl/awk-inspired syntax for quick scripts and one-liners. Its what you get when you shove a snake in a shell.
21
20
 
22
21
  ## AI Slop!
23
22
 
@@ -62,11 +61,43 @@ Process files line-by-line with familiar awk semantics:
62
61
  { print($1, "->", $2) }
63
62
  ```
64
63
 
65
- Built-in variables: `$0` (line), `$1`, `$2` etc (access fields), `$n` (line number), `$fn` (per-file line number), `$p` (file path), `$m` (last match).
64
+ **Built-in variables:**
66
65
 
67
- Begin/end blocks use CLI flags for setup and teardown:
66
+ | Variable | Description |
67
+ |----------|-------------|
68
+ | `$0` | Current line (with newline stripped) |
69
+ | `$1`, `$2`, ... | Individual fields (whitespace-split) |
70
+ | `$f` | All fields as a list |
71
+ | `$n` | Global line number (across all files) |
72
+ | `$fn` | Per-file line number |
73
+ | `$p` | Current file path |
74
+ | `$m` | Last regex match object |
75
+
76
+ Begin/end blocks use CLI flags (`-b`/`--begin`, `-e`/`--end`) for setup and teardown:
77
+ ```bash
78
+ echo -e "5\n4\n3\n2\n1" | snail --awk --begin 'total = 0' --end 'print("Sum:", total)' '/^[0-9]+/ { total = total + int($1) }'
79
+ ```
80
+
81
+ ### Map Mode
82
+
83
+ Process files one at a time instead of line-by-line:
84
+
85
+ ```snail-map
86
+ print("File:", $src)
87
+ print("Size:", len($text), "bytes")
88
+ ```
89
+
90
+ **Built-in variables:**
91
+
92
+ | Variable | Description |
93
+ |----------|-------------|
94
+ | `$src` | Current file path |
95
+ | `$fd` | Open file handle for the current file |
96
+ | `$text` | Lazy text view of the current file contents |
97
+
98
+ Begin/end blocks use CLI flags (`-b`/`--begin`, `-e`/`--end`) for setup and teardown:
68
99
  ```bash
69
- echo -e "5\n4\n3\n2\n1" | snail --awk -b 'total = 0' -e 'print("Sum:", total)' '/^[0-9]+/ { total = total + int($1) }'
100
+ snail --map --begin "print('start')" --end "print('done')" "print($src)" *.txt
70
101
  ```
71
102
 
72
103
  ### Compact Error Handling
@@ -228,6 +259,7 @@ Documentation is WIP
228
259
  - **[Language Reference](docs/REFERENCE.md)** — Complete syntax and semantics
229
260
  - **[examples/all_syntax.snail](examples/all_syntax.snail)** — Every feature in one file
230
261
  - **[examples/awk.snail](examples/awk.snail)** — Awk mode examples
262
+ - **[examples/map.snail](examples/map.snail)** — Map mode examples
231
263
 
232
264
  ## 🔌 Editor Support
233
265
 
@@ -1,11 +1,10 @@
1
1
  <p align="center">
2
2
  <img src="logo.png" alt="Snail logo" width="200">
3
3
  </p>
4
- <p align="center"><em>What do you get when you shove a snake in a shell?</em></p>
5
4
 
6
5
  <h1 align="center">Snail</h1>
7
6
 
8
- **Snail** is a programming language that compiles to Python, combining Python's familiarity and extensive libraries with Perl/awk-inspired syntax for quick scripts and one-liners.
7
+ **Snail** is a programming language that compiles to Python, combining Python's familiarity and extensive libraries with Perl/awk-inspired syntax for quick scripts and one-liners. Its what you get when you shove a snake in a shell.
9
8
 
10
9
  ## AI Slop!
11
10
 
@@ -50,11 +49,43 @@ Process files line-by-line with familiar awk semantics:
50
49
  { print($1, "->", $2) }
51
50
  ```
52
51
 
53
- Built-in variables: `$0` (line), `$1`, `$2` etc (access fields), `$n` (line number), `$fn` (per-file line number), `$p` (file path), `$m` (last match).
52
+ **Built-in variables:**
54
53
 
55
- Begin/end blocks use CLI flags for setup and teardown:
54
+ | Variable | Description |
55
+ |----------|-------------|
56
+ | `$0` | Current line (with newline stripped) |
57
+ | `$1`, `$2`, ... | Individual fields (whitespace-split) |
58
+ | `$f` | All fields as a list |
59
+ | `$n` | Global line number (across all files) |
60
+ | `$fn` | Per-file line number |
61
+ | `$p` | Current file path |
62
+ | `$m` | Last regex match object |
63
+
64
+ Begin/end blocks use CLI flags (`-b`/`--begin`, `-e`/`--end`) for setup and teardown:
65
+ ```bash
66
+ echo -e "5\n4\n3\n2\n1" | snail --awk --begin 'total = 0' --end 'print("Sum:", total)' '/^[0-9]+/ { total = total + int($1) }'
67
+ ```
68
+
69
+ ### Map Mode
70
+
71
+ Process files one at a time instead of line-by-line:
72
+
73
+ ```snail-map
74
+ print("File:", $src)
75
+ print("Size:", len($text), "bytes")
76
+ ```
77
+
78
+ **Built-in variables:**
79
+
80
+ | Variable | Description |
81
+ |----------|-------------|
82
+ | `$src` | Current file path |
83
+ | `$fd` | Open file handle for the current file |
84
+ | `$text` | Lazy text view of the current file contents |
85
+
86
+ Begin/end blocks use CLI flags (`-b`/`--begin`, `-e`/`--end`) for setup and teardown:
56
87
  ```bash
57
- echo -e "5\n4\n3\n2\n1" | snail --awk -b 'total = 0' -e 'print("Sum:", total)' '/^[0-9]+/ { total = total + int($1) }'
88
+ snail --map --begin "print('start')" --end "print('done')" "print($src)" *.txt
58
89
  ```
59
90
 
60
91
  ### Compact Error Handling
@@ -216,6 +247,7 @@ Documentation is WIP
216
247
  - **[Language Reference](docs/REFERENCE.md)** — Complete syntax and semantics
217
248
  - **[examples/all_syntax.snail](examples/all_syntax.snail)** — Every feature in one file
218
249
  - **[examples/awk.snail](examples/awk.snail)** — Awk mode examples
250
+ - **[examples/map.snail](examples/map.snail)** — Map mode examples
219
251
 
220
252
  ## 🔌 Editor Support
221
253
 
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "snail-ast"
3
- version = "0.5.3"
3
+ version = "0.6.1"
4
4
  edition = "2024"
5
5
  readme = "README.md"
6
6
 
@@ -216,6 +216,22 @@ pub enum Expr {
216
216
  right: Box<Expr>,
217
217
  span: SourceSpan,
218
218
  },
219
+ AugAssign {
220
+ target: Box<AssignTarget>,
221
+ op: AugAssignOp,
222
+ value: Box<Expr>,
223
+ span: SourceSpan,
224
+ },
225
+ PrefixIncr {
226
+ op: IncrOp,
227
+ target: Box<AssignTarget>,
228
+ span: SourceSpan,
229
+ },
230
+ PostfixIncr {
231
+ op: IncrOp,
232
+ target: Box<AssignTarget>,
233
+ span: SourceSpan,
234
+ },
219
235
  Compare {
220
236
  left: Box<Expr>,
221
237
  ops: Vec<CompareOp>,
@@ -403,6 +419,23 @@ pub enum BinaryOp {
403
419
  Pipeline,
404
420
  }
405
421
 
422
+ #[derive(Debug, Clone, Copy, PartialEq, Eq)]
423
+ pub enum AugAssignOp {
424
+ Add,
425
+ Sub,
426
+ Mul,
427
+ Div,
428
+ FloorDiv,
429
+ Mod,
430
+ Pow,
431
+ }
432
+
433
+ #[derive(Debug, Clone, Copy, PartialEq, Eq)]
434
+ pub enum IncrOp {
435
+ Increment,
436
+ Decrement,
437
+ }
438
+
406
439
  #[derive(Debug, Clone, Copy, PartialEq, Eq)]
407
440
  pub enum CompareOp {
408
441
  Eq,
@@ -4,6 +4,7 @@ use crate::ast::{Expr, SourceSpan, Stmt};
4
4
  pub enum CompileMode {
5
5
  Snail,
6
6
  Awk,
7
+ Map,
7
8
  }
8
9
 
9
10
  #[derive(Debug, Clone, PartialEq)]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "snail-core"
3
- version = "0.5.3"
3
+ version = "0.6.1"
4
4
  edition.workspace = true
5
5
  readme = "README.md"
6
6
 
@@ -32,6 +32,11 @@ pub fn compile_snail_source_with_auto_print(
32
32
  let module = lower_awk_program_with_auto_print(py, &program, auto_print_last)?;
33
33
  Ok(module)
34
34
  }
35
+ CompileMode::Map => {
36
+ let program = parse_map_program(source)?;
37
+ let module = lower_map_program_with_auto_print(py, &program, auto_print_last)?;
38
+ Ok(module)
39
+ }
35
40
  }
36
41
  }
37
42
 
@@ -48,3 +53,37 @@ pub fn compile_awk_source_with_begin_end(
48
53
  let module = lower_awk_program_with_auto_print(py, &program, auto_print_last)?;
49
54
  Ok(module)
50
55
  }
56
+
57
+ /// Compile a map program with separate begin and end code blocks.
58
+ /// Each begin/end source is parsed as a map program.
59
+ pub fn compile_map_source_with_begin_end(
60
+ py: Python<'_>,
61
+ main_source: &str,
62
+ begin_sources: &[&str],
63
+ end_sources: &[&str],
64
+ auto_print_last: bool,
65
+ ) -> Result<PyObject, SnailError> {
66
+ let program = parse_map_program(main_source)?;
67
+ let mut begin_blocks = Vec::new();
68
+ for source in begin_sources {
69
+ let begin_program = parse_map_program(source)?;
70
+ if !begin_program.stmts.is_empty() {
71
+ begin_blocks.push(begin_program.stmts);
72
+ }
73
+ }
74
+ let mut end_blocks = Vec::new();
75
+ for source in end_sources {
76
+ let end_program = parse_map_program(source)?;
77
+ if !end_program.stmts.is_empty() {
78
+ end_blocks.push(end_program.stmts);
79
+ }
80
+ }
81
+ let module = lower_map_program_with_begin_end(
82
+ py,
83
+ &program,
84
+ &begin_blocks,
85
+ &end_blocks,
86
+ auto_print_last,
87
+ )?;
88
+ Ok(module)
89
+ }
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "snail-error"
3
- version = "0.5.3"
3
+ version = "0.6.1"
4
4
  edition = "2024"
5
5
  readme = "README.md"
6
6
 
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "snail-lower"
3
- version = "0.5.3"
3
+ version = "0.6.1"
4
4
  edition = "2024"
5
5
  readme = "README.md"
6
6
 
@@ -27,7 +27,7 @@ This crate is the semantic transformation core of the Snail compiler. It takes S
27
27
  - **Regex expressions** (`/pattern/`): Transformed into `__snail_regex_compile(pattern)` call
28
28
  - **Regex matching** (`string in /pattern/`): Transformed into `__snail_regex_search(string, pattern)` call
29
29
  - **Structured accessors** (`$[query]`): Transformed into `__SnailStructuredAccessor(query)` instance
30
- - **Awk variables**: `$0`, `$<num>`, `$n`, `$fn`, `$p`, `$m` mapped to Python variable names
30
+ - **Awk variables**: `$0`, `$<num>`, `$n`, `$fn`, `$f`, `$p`, `$m` mapped to Python variable names
31
31
 
32
32
  ## Awk Mode Lowering
33
33
 
@@ -9,17 +9,23 @@ pub const SNAIL_JMESPATH_QUERY: &str = "__snail_jmespath_query";
9
9
  pub const SNAIL_PARTIAL_HELPER: &str = "__snail_partial";
10
10
  pub const SNAIL_CONTAINS_HELPER: &str = "__snail_contains__";
11
11
  pub const SNAIL_CONTAINS_NOT_HELPER: &str = "__snail_contains_not__";
12
+ pub const SNAIL_INCR_ATTR: &str = "__snail_incr_attr";
13
+ pub const SNAIL_INCR_INDEX: &str = "__snail_incr_index";
14
+ pub const SNAIL_AUG_ATTR: &str = "__snail_aug_attr";
15
+ pub const SNAIL_AUG_INDEX: &str = "__snail_aug_index";
12
16
  pub(crate) const SNAIL_LET_VALUE: &str = "__snail_let_value";
13
17
  pub(crate) const SNAIL_LET_OK: &str = "__snail_let_ok";
14
18
  pub(crate) const SNAIL_LET_KEEP: &str = "__snail_let_keep";
15
19
  pub(crate) const SNAIL_COMPARE_LEFT: &str = "__snail_compare_left";
16
20
  pub(crate) const SNAIL_COMPARE_RIGHT: &str = "__snail_compare_right";
21
+ pub(crate) const SNAIL_INCR_TMP: &str = "__snail_incr_tmp";
17
22
 
18
23
  // Awk-related constants (public within crate)
19
24
  pub(crate) const SNAIL_AWK_NR: &str = "$n";
20
25
  pub(crate) const SNAIL_AWK_FNR: &str = "$fn";
21
26
  pub(crate) const SNAIL_AWK_PATH: &str = "$p";
22
27
  pub(crate) const SNAIL_AWK_MATCH: &str = "$m";
28
+ pub(crate) const SNAIL_AWK_FIELDS: &str = "$f";
23
29
  pub(crate) const SNAIL_AWK_LINE_PYVAR: &str = "__snail_line";
24
30
  pub(crate) const SNAIL_AWK_FIELDS_PYVAR: &str = "__snail_fields";
25
31
  pub(crate) const SNAIL_AWK_NR_PYVAR: &str = "__snail_nr_user";
@@ -27,12 +33,27 @@ pub(crate) const SNAIL_AWK_FNR_PYVAR: &str = "__snail_fnr_user";
27
33
  pub(crate) const SNAIL_AWK_PATH_PYVAR: &str = "__snail_path_user";
28
34
  pub(crate) const SNAIL_AWK_MATCH_PYVAR: &str = "__snail_match";
29
35
 
36
+ // Map-related constants (public within crate)
37
+ pub(crate) const SNAIL_MAP_SRC: &str = "$src";
38
+ pub(crate) const SNAIL_MAP_FD: &str = "$fd";
39
+ pub(crate) const SNAIL_MAP_TEXT: &str = "$text";
40
+ pub(crate) const SNAIL_MAP_SRC_PYVAR: &str = "__snail_src";
41
+ pub(crate) const SNAIL_MAP_FD_PYVAR: &str = "__snail_fd";
42
+ pub(crate) const SNAIL_MAP_TEXT_PYVAR: &str = "__snail_text";
43
+ pub const SNAIL_LAZY_TEXT_CLASS: &str = "__SnailLazyText";
44
+
30
45
  pub(crate) fn injected_py_name(name: &str) -> Option<&'static str> {
31
46
  match name {
47
+ // Awk variables
32
48
  SNAIL_AWK_NR => Some(SNAIL_AWK_NR_PYVAR),
33
49
  SNAIL_AWK_FNR => Some(SNAIL_AWK_FNR_PYVAR),
34
50
  SNAIL_AWK_PATH => Some(SNAIL_AWK_PATH_PYVAR),
35
51
  SNAIL_AWK_MATCH => Some(SNAIL_AWK_MATCH_PYVAR),
52
+ SNAIL_AWK_FIELDS => Some(SNAIL_AWK_FIELDS_PYVAR),
53
+ // Map variables
54
+ SNAIL_MAP_SRC => Some(SNAIL_MAP_SRC_PYVAR),
55
+ SNAIL_MAP_FD => Some(SNAIL_MAP_FD_PYVAR),
56
+ SNAIL_MAP_TEXT => Some(SNAIL_MAP_TEXT_PYVAR),
36
57
  _ => None,
37
58
  }
38
59
  }