Module: Travis::Conditions::V1::Helper
- Included in:
- Parser
- Defined in:
- lib/travis/conditions/v1/helper.rb
Constant Summary collapse
- QUOTE =
/["']{1}/- OPEN =
/\(/- CLOSE =
/\)/- SPACE =
/\s*/
Instance Method Summary collapse
Instance Method Details
#err(char) ⇒ Object
24 25 26 |
# File 'lib/travis/conditions/v1/helper.rb', line 24 def err(char) raise ParseError, "expected #{char} at position #{pos} in: #{string.inspect}" end |
#parens ⇒ Object
15 16 17 |
# File 'lib/travis/conditions/v1/helper.rb', line 15 def parens space { skip(OPEN) } and space { yield }.tap { skip(CLOSE) || err(')') } end |
#quoted ⇒ Object
10 11 12 13 |
# File 'lib/travis/conditions/v1/helper.rb', line 10 def quoted return unless quote = scan(QUOTE) scan(/[^#{quote}]*/).tap { scan(/#{quote}/) || err(quote) } end |