Guest User

Untitled

a guest
Feb 19th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. (?x)^
  2. (\s*
  3. (module|class|def
  4. |unless|if|else|elsif
  5. |case|when
  6. |begin|rescue|ensure
  7. |for|while|until
  8. |(?= .*? \b(do|begin|case|if|unless)\b )
  9. # the look-ahead above is to quickly discard non-candidates
  10. ( "(\\.|[^"])*+" # eat a double quoted string
  11. | ''(\\.|[^''])*+'' # eat a single quoted string
  12. | [^#"''] # eat all but comments and strings
  13. )*
  14. ( \s (do|begin|case)
  15. | [-+=&|*/~%^<>~] \s*+ (if|unless)
  16. )
  17. )\b
  18. (?! [^;]*+ ; .*? \bend\b )
  19. |( "(\\.|[^"])*+" # eat a double quoted string
  20. | ''(\\.|[^''])*+'' # eat a single quoted string
  21. | [^#"''] # eat all but comments and strings
  22. )*
  23. ( \{ (?! [^}]*+ \} )
  24. | \[ (?! [^\]]*+ \] )
  25. )
  26. ).*$
Add Comment
Please, Sign In to add comment