Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Absent Operator #82

Closed
k-takata opened this issue Dec 14, 2016 · 5 comments
Closed

Implement Absent Operator #82

k-takata opened this issue Dec 14, 2016 · 5 comments
Labels

Comments

@k-takata
Copy link
Owner

k-takata commented Dec 14, 2016

Slide and paper by Akira Tanaka (@akr) (both Japanese):

TODO:

  • Syntax:
    Maybe the form of (?...) should be used. For example (?~...)?
  • Implementation:
    Is it easy?
@k-takata
Copy link
Owner Author

k-takata commented Dec 15, 2016

Akira's paper says that look-ahead assertion doesn't have theoretical backgrounds. However @sinya8282 says that look-ahead assertion is a regular expression (in context of formal language theory), and it can be proved by using boolean automaton.
Then absent operator can be a syntax sugar of (?:(?!expr)(?m:.))*?

@k-takata
Copy link
Owner Author

k-takata commented Dec 15, 2016

It seems that (?~expr) is different from (?:(?!expr).)*.
\A(?~abc)c should match abc (because (?~abc) matches ab), but \A(?:(?!abc).)*c doesn't match.

https://twitter.com/nalsh/status/809375869626150912

k-takata added a commit that referenced this issue Dec 23, 2016
(?~subexp) matches any string which doesn't have subexp as its suffix.

This is based on Tanaka Akira's paper and slide:
* https://staff.aist.go.jp/tanaka-akira/pub/prosym49-akr-paper.pdf
* https://staff.aist.go.jp/tanaka-akira/pub/prosym49-akr-presen.pdf
@k-takata k-takata added the todo label Dec 23, 2016
@k-takata
Copy link
Owner Author

topic/absent-operator branch was merged into the master branch.
Maybe more tests are needed, but closing for now.

@k-takata
Copy link
Owner Author

However @sinya8282 says that look-ahead assertion is a regular expression

This is discussed in a paper by Akimasa MORIHATA:

@k-takata
Copy link
Owner Author

hsbt pushed a commit to ruby/ruby that referenced this issue Feb 11, 2017
* Support absent operator k-takata/Onigmo#82
* https://github.com/k-takata/Onigmo/blob/Onigmo-6.1.1/HISTORY

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
hsbt pushed a commit to ruby/ruby that referenced this issue Mar 13, 2017
	Merge Onigmo 6.1.1

	* Support absent operator k-takata/Onigmo#82
	* https://github.com/k-takata/Onigmo/blob/Onigmo-6.1.1/HISTORY

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@headius headius mentioned this issue Dec 1, 2017
75 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant