RegexpTree

RegexpTree represents regular expression. It can be converted to Regexp.

class methods

RegexpTree.str(string)
returns an instance of RegexpTree which only matches string
RegexpTree.alt(*regexp_trees)
returns an instance of RegexpTree which is alternation of regexp_trees.
RegexpTree.seq(*regexp_trees)
returns an instance of RegexpTree which is concatination of regexp_trees.
RegexpTree.rep(regexp_tree, min=0, max=nil, greedy=true)
returns an instance of RegexpTree which is reptation of regexp_tree.
RegexpTree.charclass(natset)
returns an instance of RegexpTree which matches characters in natset.

methods

regexp(anchored=false)

convert to Regexp.

If anchored is true, the Regexp is anchored by \A and \z.

to_s
convert to String.
empty_set?
returns true iff self never matches.
empty_sequence?
returns true iff self only matches empty string.
self | other
returns alternation of self and other.
self + other
returns concatination of self and other.
self * n
returns n times repetation of self.
rep(min=0, max=nil, greedy=true)
returns min to max times repetation of self.