-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
207 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
= Reginald | ||
= Regin | ||
|
||
Reginald is a Ruby Reginald syntax parser. | ||
Regin allows you to introspect on Ruby Regexps. | ||
|
||
Its parser and tokenizer are written in racc/rexical. Since racc is part of Ruby's standard library, there are no extra runtime dependencies. | ||
Powered by an over the top regexp syntax parser written in racc/rexical. | ||
|
||
=== Examples | ||
|
||
Determine if a Regexp could be treated as a literal String | ||
|
||
Reginald.parse(/foo/).literal? # => true | ||
Reginald.parse(/ba./).literal? # => false | ||
Regin.parse(/foo/).literal? # => true | ||
Regin.parse(/ba./).literal? # => false | ||
|
||
Determine whether a character could match a part of a Regexp | ||
|
||
Reginald.parse(/foo\/bar/).include?("/") # => true | ||
Reginald.parse(/foo.bar/).include?("/") # => true | ||
Reginald.parse(/foo[a-z]bar/).include?("/") # => false | ||
Regin.parse(/foo\/bar/).include?("/") # => true | ||
Regin.parse(/foo.bar/).include?("/") # => true | ||
Regin.parse(/foo[a-z]bar/).include?("/") # => false | ||
|
||
Extract a substring of a Regexp | ||
|
||
Reginald.parse(/foobar/)[3..6] => #<Expression "bar"> | ||
Reginald.parse(/fo{2}[bB]ar/)[2..5] => #<Expression "[bB]ar"> | ||
Regin.parse(/foobar/)[3..6] => #<Expression "bar"> | ||
Regin.parse(/fo{2}[bB]ar/)[2..5] => #<Expression "[bB]ar"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Reginald | ||
module Regin | ||
class Anchor < Atom | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Reginald | ||
module Regin | ||
class Character < Atom | ||
attr_reader :quantifier | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Reginald | ||
module Regin | ||
class Collection | ||
include Enumerable | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Reginald | ||
module Regin | ||
class Group | ||
attr_reader :expression, :quantifier, :capture, :index, :name | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Reginald | ||
module Regin | ||
class Options | ||
def self.from_int(flags) | ||
multiline = flags & Regexp::MULTILINE != 0 | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Reginald | ||
module Regin | ||
Version = '0.2.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.