Rename onigumura to oniguruma

This change names the dependency like its called. The link to the
package was correct, but all other references were renamed where I could
find time with git grep.

Signed-off-by: Zeger-Jan van de Weg <git@zjvandeweg.nl>
This commit is contained in:
Zeger-Jan van de Weg 2018-03-28 20:52:49 +02:00
parent 0db3b4b553
commit 7923b86ebd
No known key found for this signature in database
GPG Key ID: 65F6A8D64A88ABAC
4 changed files with 17 additions and 17 deletions

View File

@ -15,15 +15,15 @@ matrix:
fast_finish: true fast_finish: true
env: env:
- ONIGUMURA=0 - ONIGURUMA=0
- ONIGUMURA=1 - ONIGURUMA=1
install: install:
- rm -rf $GOPATH/src/gopkg.in/src-d - rm -rf $GOPATH/src/gopkg.in/src-d
- mkdir -p $GOPATH/src/gopkg.in/src-d - mkdir -p $GOPATH/src/gopkg.in/src-d
- ln -s $PWD $GOPATH/src/gopkg.in/src-d/enry.v1 - ln -s $PWD $GOPATH/src/gopkg.in/src-d/enry.v1
- cd $GOPATH/src/gopkg.in/src-d/enry.v1 - cd $GOPATH/src/gopkg.in/src-d/enry.v1
- if [ "$ONIGUMURA" == "1" ]; then make onigumura; fi - if [ "$ONIGURUMA" == "1" ]; then make oniguruma; fi
- go get -v -t ./... - go get -v -t ./...
script: script:
@ -47,7 +47,7 @@ deploy:
jobs: jobs:
env: env:
- ONIGUMURA=0 - ONIGURUMA=0
include: include:
- stage: test - stage: test
language: scala language: scala

View File

@ -42,7 +42,7 @@ NATIVE_LIB=./shared/enry.go
RUBEX_PATCHED := internal/code-generator/generator/heuristics.go internal/tokenizer/tokenize.go common.go RUBEX_PATCHED := internal/code-generator/generator/heuristics.go internal/tokenizer/tokenize.go common.go
RUBEX_ORIG := $(RUBEX_PATCHED:=.orig) RUBEX_ORIG := $(RUBEX_PATCHED:=.orig)
.PHONY: revert-onigumura .PHONY: revert-oniguruma
$(LINGUIST_PATH): $(LINGUIST_PATH):
git clone https://github.com/github/linguist.git $@ git clone https://github.com/github/linguist.git $@
@ -73,9 +73,9 @@ $(RUBEX_ORIG): %.orig : %
sed -i.orig -e 's/"regexp"/regexp "github.com\/moovweb\/rubex"/g' $< sed -i.orig -e 's/"regexp"/regexp "github.com\/moovweb\/rubex"/g' $<
@touch $@ @touch $@
onigumura: $(RUBEX_ORIG) oniguruma: $(RUBEX_ORIG)
revert-onigumura: revert-oniguruma:
@for file in $(RUBEX_PATCHED); do if [ -e "$$file.orig" ]; then mv "$$file.orig" "$$file" && echo mv "$$file.orig" "$$file"; fi; done @for file in $(RUBEX_PATCHED); do if [ -e "$$file.orig" ]; then mv "$$file.orig" "$$file" && echo mv "$$file.orig" "$$file"; fi; done
build-cli: build-cli:

View File

@ -21,14 +21,14 @@ this will generate a binary in the project's root directory called `enry`. You c
### Faster regexp engine (optional) ### Faster regexp engine (optional)
[Onigumura](https://github.com/kkos/oniguruma) is CRuby's regular expression engine. [Oniguruma](https://github.com/kkos/oniguruma) is CRuby's regular expression engine.
It is very fast and performs better than the one built into Go runtime. *enry* supports swapping It is very fast and performs better than the one built into Go runtime. *enry* supports swapping
between those two engines thanks to [rubex](https://github.com/moovweb/rubex) project. between those two engines thanks to [rubex](https://github.com/moovweb/rubex) project.
The typical overall speedup from using Onigumura is 1.5-2x. However, it requires CGo and the external shared library. The typical overall speedup from using Oniguruma is 1.5-2x. However, it requires CGo and the external shared library.
On macOS with brew, it is On macOS with brew, it is
``` ```
brew install onigumura brew install oniguruma
``` ```
On Ubuntu, it is On Ubuntu, it is
@ -37,10 +37,10 @@ On Ubuntu, it is
sudo apt install libonig-dev sudo apt install libonig-dev
``` ```
To build enry with Onigumura regexps, patch the imports with To build enry with Oniguruma regexps, patch the imports with
``` ```
make onigumura make oniguruma
``` ```
and then rebuild the project. and then rebuild the project.

View File

@ -43,11 +43,11 @@ var (
extractRemainders, extractRemainders,
} }
// Differences between golang regexp and onigumura: // Differences between golang regexp and oniguruma:
// 1. no (?s) in onigumura - makes dot match \n // 1. no (?s) in oniguruma - makes dot match \n
// 2. no (?U) in onigumura - ungreedy * // 2. no (?U) in oniguruma - ungreedy *
// 3. (?m) implies dot matches \n in onigumura // 3. (?m) implies dot matches \n in oniguruma
// 4. onigumura handles \w differently - impossible, but true // 4. oniguruma handles \w differently - impossible, but true
// //
// Workarounds: // Workarounds:
// 1. (.|\n) // 1. (.|\n)