Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vmchale/jacinda
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.3.0.0
Choose a base ref
...
head repository: vmchale/jacinda
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: canon
Choose a head ref
Loading
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 3.3.0.3

* Fix splitting with `--header` on large inputs

# 3.3.0.2

* Fix pathological performance using custom record separator on large inputs

# 3.3.0.1

* Equality on optional values no longer crashes

# 3.3.0.0

* Allow decimal specifiers in format strings
6 changes: 6 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
@@ -363,3 +363,9 @@ We could use this to pass flags to a C compiler like so:
% python3 -m site | ja "[x+' '+y]|>(sprintf'-L%s')¨.?{|\`1 ~* 1 /([^']*site-packages)/}"
-L/Users/vanessa/Library/Python/3.13/lib/python/site-packages -L/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages
```

# Count Matches in Repo

```
rg 'traverse' -c | ja -F: '(+)|>$2:i'
```
5 changes: 3 additions & 2 deletions HASKELL-EXAMPLES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Get Latest Version from Hackage

```
cabal info dom-lt | ja -R ':' -F'(\s|,)+' 'last#¨([#*x>0] #. {|(~/^\d+(\.\d+)*$/)#.`$})'
```zsh
cabal info splitmix | \
ja --header -R'\n[^:\n]*:' -F'\s*,\s*' '[x ~* 1 /(\d+(\.\d+)*)/]:?{%/Versions available:/}{[y]|>`$}'
```
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.PHONY: clean install release darwin-release fmt fix check

MAKEFLAGS += --warn-undefined-variables --no-builtin-rules -j

HC ?= ghc
@@ -38,7 +40,7 @@ install: $(HS_SRC) man/ja.1
clean:
make -C vscode clean
make -C tex clean
rm -rf tags tags.mtime dist-newstyle moddeps.svg doc/guide.html *.hp *.prof bench/data/*.txt bin
rm -rf tags tags.mtime dist-newstyle moddeps.svg doc/guide.html *.hp *.prof bench/data/*.txt bench/data/ghc bin

moddeps.svg: $(HS_SRC)
graphmod -i src | dot -Tsvg -o $@
@@ -57,7 +59,7 @@ darwin-release: bin/aarch64-darwin-ja
bin/aarch64-darwin-ja: $(HS_SRC)
mkdir -p $(dir $@)
cabal build exe:ja -w $(HC)
export BIN=$$(cabal-plan list-bins | awk '/ja$$/ {print $$2}'); \
export BIN=$$(cabal list-bin ja -v0); \
cp $$BIN $@ ; \
strip $@

@@ -102,11 +104,14 @@ tags: $(JAC_SRC) $(HS_SRC)
fd '.jac$$' prelude lib -x ja run examples/tags.jac -i >> $@
ctags --append=yes --languages=ALEX,HAPPY -R src

bench: bench/data/lines.txt bench/data/span.txt bench/data/ulysses.txt
bench: bench/data/lines.txt bench/data/span.txt bench/data/ulysses.txt bench/data/ghc

bench/data/lines.txt: test/examples/data/1.txt
perl -0777pe '$$_=$$_ x 10' $^ > $@

bench/data/ghc: test/data/ghc
perl -0777pe '$$_=$$_ x 100' $^ > $@

bench/data/span.txt: examples/span.txt
perl -0777pe '$$_=$$_ x 10000' $^ > $@

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -52,12 +52,12 @@ printenv | ja -F= '{%/^PATH/}{`2}'

# Documentation

See the [guide](https://vmchale.github.io/jacinda/) (archived on [Hackage](https://hackage.haskell.org/package/jacinda/src/doc/guide.pdf), which contains a tutorial
See the [guide](https://vmchale.github.io/jacinda/) (archived on [Hackage](https://hackage.haskell.org/package/jacinda/src/doc/guide.pdf)), which contains a tutorial
on some of the features as well as examples.

The [manpages](https://hackage.haskell.org/package/jacinda/src/man/ja.1) document the builtins and provide a syntax reference.

See the [rosetta](./ROSETTA.md) showing AWK alongside, or the [examples][./EXAMPLES.md] for its own capabilities.
See the [rosetta](./ROSETTA.md) showing AWK alongside, or the [examples](./EXAMPLES.md) for its own capabilities.

# Status

12 changes: 12 additions & 0 deletions ROSETTA.md
Original file line number Diff line number Diff line change
@@ -380,3 +380,15 @@ awk -F'[/:]+' '{ sub("^www\.", "", $2); print $2 }'
```
ja -F'[/:]+' "{|sub1 /^www\./ '' \`2}"
```

# OpenSSL Directory

```
openssl version -d | cut -f2 -d\"
/usr/local/ssl
```

```
openssl version -d | ja -F\" '$2'
/usr/local/ssl
```
6 changes: 6 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -101,6 +101,10 @@
- [ ] mach syscalls (print+summarize)
# Bugs
```
vanessa@MacBookAir jacinda % ja -F: "reintercalate '\n' \$0" -i <(echo $PATH)
ja: InternalUnexpectedStream $0
```
```
vanessa@Vanessas-Air jacinda % seq 100001 | cabal run ja -- run test/examples/evenOdd.jac
(50000 . 50001)
vanessa@Vanessas-Air jacinda % seq 1000001 | cabal run ja -- run test/examples/evenOdd.jac
@@ -140,6 +144,7 @@ vanessa@Vanessas-Air jacinda % seq 1000001 | cabal run ja -- run test/examples/e
- [ ] https://datatracker.ietf.org/doc/html/rfc4180
- [ ] checksum?
- [½] `basename`, `pathchk` (lol)
- [ ] `man join` `man jot` `man rs`
- [ ] https://github.com/curl/trurl
- [ ] https://github.com/pharmbio/ptp-project/blob/master/exp/20180426-wo-drugbank/wo_drugbank_wf.go
- [ ] https://github.com/epogrebnyak/justpath
@@ -151,6 +156,7 @@ vanessa@Vanessas-Air jacinda % seq 1000001 | cabal run ja -- run test/examples/e
- [ ] JQ_COLORS="0;90:0;37:0;37:0;37:0;32:1;37:1;37:1;34"
- [ ] https://github.com/rcoh/angle-grinder?tab=readme-ov-file#query-syntax
- [ ] https://www.brandur.org/logfmt
- [ ] https://wiki.haskell.org/index.php?title=Literate_programming/Bird_conversion_via_awk
## sed
- [ ] https://sed.sourceforge.io/grabbag/
- [ ] https://sed.sourceforge.io/
9 changes: 8 additions & 1 deletion bench/Bench.hs
Original file line number Diff line number Diff line change
@@ -3,13 +3,15 @@
module Main (main) where

import A
import qualified Data.ByteString.Lazy as BSL
import Control.DeepSeq (NFData (..))
import Criterion.Main
import Jacinda.Regex
import qualified Data.Text.IO as TIO
import File
import System.IO (IOMode (WriteMode), withFile)

hrun ifp e m fp = withFile "/dev/null" WriteMode $ \h -> runOnFile [] "(bench)" e [] m fp h
hrun ifp e m fp = withFile "/dev/null" WriteMode $ \h -> runOnFile [] Nothing e [] m fp h
runs e m fp = nfIO $ hrun "(bench)" e m fp
fruns ifp m fp = nfIO $ do { contents <- TIO.readFile ifp; hrun ifp contents m fp }

@@ -23,6 +25,11 @@ main =
[ bench "dedup" $ runs "~.{ix>1}{`8}" CSV "bench/data/food-prices.csv"
, bench "succdiff" $ runs "(%)\\. {%/Apple/}{`3:}" CSV "bench/data/food-prices.csv"
]
, let rp=tcompile "\n\n"
in bgroup "rure"
[ bench "RS" $ nfIO (do {contents <- BSL.readFile "bench/data/ghc"; pure (lazySplit rp contents)})
, bench "header" $ nfIO (do {contents <- BSL.readFile "bench/data/ghc"; pure (lazySplitH rp contents)})
]
, bgroup "report"
[ bench "ghc-filt" $ fruns "test/examples/ghc-filt.jac" awk "test/data/ghc" ]
, bgroup "stream"
9 changes: 9 additions & 0 deletions cabal.weeder.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
packages: ./

package jacinda
ghc-options: -fwrite-ide-info

tests: True
benchmarks: True

with-compiler: ghc-9.8
Loading