aboutsummaryrefslogtreecommitdiffstats
path: root/awk
diff options
context:
space:
mode:
authorelioat <{ID}+{username}@users.noreply.github.com>2025-07-31 22:44:37 -0400
committerelioat <{ID}+{username}@users.noreply.github.com>2025-07-31 22:44:37 -0400
commitd83c0eeefb17f2c666dfab813d77440833a000e2 (patch)
treed0e5c9637604ced04145441e9ea68452faf78d8e /awk
parentbb344902c1ab24f56a722096726b6fe453ccaa94 (diff)
downloadtour-d83c0eeefb17f2c666dfab813d77440833a000e2.tar.gz
*
Diffstat (limited to 'awk')
-rw-r--r--awk/rawk/README.md14
-rw-r--r--awk/rawk/rawk.awk2
-rw-r--r--awk/rawk/tests/simple_stdlib_test.rawk2
-rw-r--r--awk/rawk/tests/test_errors.rawk2
-rw-r--r--awk/rawk/tests/test_functional.rawk2
-rwxr-xr-xawk/rawk/tests/test_runner.sh18
6 files changed, 21 insertions, 19 deletions
diff --git a/awk/rawk/README.md b/awk/rawk/README.md
index 1656029..dc58e80 100644
--- a/awk/rawk/README.md
+++ b/awk/rawk/README.md
@@ -3,9 +3,7 @@
Rawk helps to bring some modern developer comforts to awk while maintaining awk's portability and inbuilt goodness.
-## Quick Start
-
-### 1. Create a rawk file (`example.rawk`):
+## Create a rawk file (`example.rawk`):
```rawk
BEGIN {
print "Hello from rawk!"
@@ -28,7 +26,11 @@ RAWK {
}
```
-### 2. Compile and run:
+A `.awk` file should, generally, be a totally valid `.rawk` file. Just like any valid JavaScript is valid TypeScript, likewise with awk and rawk.
+
+Rawk introduces a new semantic block to awk, so that you can write special forms wihtin the `RAWK {...}` block.
+
+## Compile and run:
```bash
# Compile to awk
awk -f rawk.awk example.rawk > example.awk
@@ -40,7 +42,7 @@ echo "test" | awk -f example.awk
echo "test" | awk -f rawk.awk example.rawk | awk -f -
```
-### 3. Try the included example:
+## How to run the example:
```bash
# Compile the example file
awk -f rawk.awk example.rawk > example_output.awk
@@ -58,7 +60,7 @@ awk -f rawk.awk example.rawk | awk -f - sample.log
## Syntax
### Function Definitions
-All functions go inside an `RAWK { ... }` block,
+All functions go inside an `RAWK { ... }` block.
```rawk
RAWK {
diff --git a/awk/rawk/rawk.awk b/awk/rawk/rawk.awk
index 5ee579b..4ef4cf8 100644
--- a/awk/rawk/rawk.awk
+++ b/awk/rawk/rawk.awk
@@ -7,7 +7,7 @@
# Version:
RAWK_VERSION = "0.0.1"
-# Lets help awk rawk
+# Lets make awk rawk
# =============================================================================
# Multi-pass compiler
diff --git a/awk/rawk/tests/simple_stdlib_test.rawk b/awk/rawk/tests/simple_stdlib_test.rawk
index 7245342..0a726df 100644
--- a/awk/rawk/tests/simple_stdlib_test.rawk
+++ b/awk/rawk/tests/simple_stdlib_test.rawk
@@ -14,7 +14,7 @@ RAWK {
expect_true(is_string("hello"), "hello should be a string");
expect_false(is_number("abc"), "abc should not be a number");
- # Test our custom function
+ # Test the custom function
expect_true(test_function(5), "5 should pass our test");
expect_false(test_function(-3), "-3 should fail our test");
expect_false(test_function("text"), "text should fail our test");
diff --git a/awk/rawk/tests/test_errors.rawk b/awk/rawk/tests/test_errors.rawk
index 233ba33..2376822 100644
--- a/awk/rawk/tests/test_errors.rawk
+++ b/awk/rawk/tests/test_errors.rawk
@@ -1,4 +1,4 @@
-# This test file should fail compilation due to missing RAWK block
+# This test file should fail compilation because it is missing a RAWK block
BEGIN {
print "This should fail because there's no RAWK block"
}
diff --git a/awk/rawk/tests/test_functional.rawk b/awk/rawk/tests/test_functional.rawk
index 9cf1b77..41020a3 100644
--- a/awk/rawk/tests/test_functional.rawk
+++ b/awk/rawk/tests/test_functional.rawk
@@ -45,7 +45,7 @@ RAWK {
texts[1] = "hello world";
texts[2] = "functional programming";
- texts[3] = "awk is awesome";
+ texts[3] = "awk is rad";
# Test map function
doubled_count = map("double", numbers, doubled);
diff --git a/awk/rawk/tests/test_runner.sh b/awk/rawk/tests/test_runner.sh
index 18f3fa2..d0b316d 100755
--- a/awk/rawk/tests/test_runner.sh
+++ b/awk/rawk/tests/test_runner.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-echo "๐Ÿงช Fixed rawk v2.0.0 Test Runner"
+echo "a rawking test runner"
echo "=================================="
# Colors for output
@@ -64,37 +64,37 @@ run_error_test() {
# Run all tests
echo ""
-echo "๐Ÿ“‹ Running basic functionality tests..."
+echo "Running basic functionality tests..."
run_test "test_basic.rawk" "Basic Functionality"
echo ""
-echo "๐Ÿ“š Running simple standard library tests..."
+echo "Running simple standard library tests..."
run_test "simple_stdlib_test.rawk" "Simple Standard Library"
echo ""
-echo "๐Ÿ”ง Running full standard library tests..."
+echo "Running full standard library tests..."
run_test "test_stdlib.rawk" "Full Standard Library"
echo ""
-echo "๐Ÿง  Running functional programming tests..."
+echo "Running functional programming tests..."
run_test "test_functional.rawk" "Functional Programming"
echo ""
-echo "โŒ Running error handling tests..."
+echo "Running error handling tests..."
run_error_test "test_errors.rawk" "Error Handling"
# Summary
echo ""
echo "=================================="
-echo "๐Ÿ“Š Test Summary:"
+echo "Test Summary:"
echo " Total tests: $TOTAL"
echo -e " ${GREEN}Passed: $PASSED${NC}"
echo -e " ${RED}Failed: $FAILED${NC}"
if [ $FAILED -eq 0 ]; then
- echo -e "\n${GREEN}๐ŸŽ‰ All tests passed!${NC}"
+ echo -e "\n${GREEN}All tests passed!${NC}"
exit 0
else
- echo -e "\n${RED}๐Ÿ’ฅ Some tests failed!${NC}"
+ echo -e "\n${RED}Some tests failed!${NC}"
exit 1
fi \ No newline at end of file