Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phadej/tarzan-server
Everybody stand back. I know regular expressions.
https://github.com/phadej/tarzan-server
Last synced: about 7 hours ago
JSON representation
Everybody stand back. I know regular expressions.
- Host: GitHub
- URL: https://github.com/phadej/tarzan-server
- Owner: phadej
- License: mit
- Created: 2014-02-09T13:46:08.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-05T14:18:26.000Z (about 10 years ago)
- Last Synced: 2024-10-11T23:53:31.465Z (26 days ago)
- Language: Haskell
- Size: 1.26 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tarzan
> Everybody stand back. I know regular expressions.
[![Build Status](https://travis-ci.org/phadej/tarzan.svg?branch=master)](https://travis-ci.org/phadej/tarzan)
## Try out:
http://tarzanre.herokuapp.com/
## Disclaimer
- Output format resembles JavaScript to high extend, however
- Tarzan doesn't know about greedy or non-greedy stuff (`(...)*?` etc), it treats them as the same.
- Also Tarzan has no prefered hand, so `(fu|fuuuu)` and `(fuuu|fu)` are the same.
- It doesn't really matter as regexp are full match by default
- _they are (kind of) in POSIX regexps (longest match), but not in JavaScript (left-biased)_.
- Output regexp could be cleaner still.## operator.tarzan
```js
// fn := /[-=]>/
var fn = /^[\-=]>$/;
// assign := /[-+*/%<>&|^!?=]=/
var assign = /^[!%&\*\+\-\/<-\?\^\|]=$/;
// zerofillrs := />>>=??/
var zerofillrs = /^>>>(?:=)?$/;
// doubles := "--" | "++" | "::"
var doubles = /^(?:\+\+|\-\-|::)$/;
// logic := ("&&" | "||" | "<<" | ">>") /=?/
var logic = /^(?:&&|<<|>>|\|\|)(?:=)?$/;
// soak := "?."
var soak = /^\?\.$/;
// range := ".." | "..."
var range = /^(?:\.\.|\.\.\.)$/;
// operator := fn | assign | zerofillrs | doubles | logic | soak | range
var operator = /^(?:[!%&\*\+\-\/<-\?\^\|]=|\+\+|\-\-|[\-=]>|\.\.|\.\.\.|::|>>>(?:=)?|\?\.|(?:&&|<<|>>|\|\|)(?:=)?)$/;
```