Class: Query::Parser::String

Inherits:
Language
  • Object
show all
Defined in:
lib/query/parser/string.rb

Instance Method Summary collapse

Instance Method Details

#backslashObject



14
15
16
# File 'lib/query/parser/string.rb', line 14

def backslash
  str("\\")
end

#double_quoteObject



6
7
8
# File 'lib/query/parser/string.rb', line 6

def double_quote
  str('"')
end

#double_quoted_stringObject



18
19
20
21
22
# File 'lib/query/parser/string.rb', line 18

def double_quoted_string
  double_quote.ignore << (
    (backslash.ignore << double_quote) | (double_quote.absent << any)
  ).repeat << double_quote.maybe.ignore
end

#rootObject



30
31
32
33
34
35
36
37
# File 'lib/query/parser/string.rb', line 30

def root
  (
    (
      double_quoted_string | single_quoted_string |
        (Special.absent << any).repeat(1)
    ) << Special.present
  ).aka(:string)
end

#single_quoteObject



10
11
12
# File 'lib/query/parser/string.rb', line 10

def single_quote
  str("'")
end

#single_quoted_stringObject



24
25
26
27
28
# File 'lib/query/parser/string.rb', line 24

def single_quoted_string
  single_quote.ignore << (
    (backslash.ignore << single_quote) | (single_quote.absent << any)
  ).repeat << single_quote.maybe.ignore
end