Created
June 9, 2009 22:16
-
-
Save carllerche/126844 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Splinter::RegexpParser | |
rule | |
\[(\^)? { state = :CCLASS ; [:LSQUARE, ss[1] && :negate] } | |
\( { [:LPAREN, text] } | |
\) { [:RPAREN, text] } | |
\| { [:PIPE, text] } | |
\+ { [:PLUS, text] } | |
\* { [:STAR, text] } | |
\? { [:QMARK, text] } | |
\. { [:DOT, text] } | |
\\?(.) { [:CHAR, ss[1]] } | |
:CCLASS \] { state = nil ; [:RSQUARE, text] } | |
:CCLASS (?:\\.|[^-])-(\\.|[^-\]]) { [:RANGE, text] } | |
:CCLASS (?:\\(.)|(.)) { [:CHAR, ss[1] || ss[2]] } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment