Class: Code::Parser::String
- Defined in:
- lib/code/parser/string.rb
Instance Method Summary collapse
- #backslash ⇒ Object
- #closing_curly_bracket ⇒ Object
- #code ⇒ Object
- #code_part ⇒ Object
- #colon ⇒ Object
- #double_quote ⇒ Object
- #double_quoted_string ⇒ Object
- #double_quoted_text_part ⇒ Object
- #name ⇒ Object
- #opening_curly_bracket ⇒ Object
- #root ⇒ Object
- #single_quote ⇒ Object
- #single_quoted_string ⇒ Object
- #single_quoted_text_part ⇒ Object
- #symbol ⇒ Object
Instance Method Details
#backslash ⇒ Object
22 23 24 |
# File 'lib/code/parser/string.rb', line 22 def backslash str('\\') end |
#closing_curly_bracket ⇒ Object
30 31 32 |
# File 'lib/code/parser/string.rb', line 30 def closing_curly_bracket str("}") end |
#code_part ⇒ Object
38 39 40 |
# File 'lib/code/parser/string.rb', line 38 def code_part opening_curly_bracket << code << closing_curly_bracket.maybe end |
#colon ⇒ Object
34 35 36 |
# File 'lib/code/parser/string.rb', line 34 def colon str(":") end |
#double_quote ⇒ Object
18 19 20 |
# File 'lib/code/parser/string.rb', line 18 def double_quote str('"') end |
#double_quoted_string ⇒ Object
64 65 66 67 68 |
# File 'lib/code/parser/string.rb', line 64 def double_quoted_string double_quote.ignore << ( code_part.aka(:code) | double_quoted_text_part.aka(:text) ).repeat << double_quote.ignore.maybe end |
#double_quoted_text_part ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/code/parser/string.rb', line 50 def double_quoted_text_part ( (backslash.ignore << opening_curly_bracket) | (backslash.ignore << double_quote) | (double_quote.absent << opening_curly_bracket.absent << any) ).repeat(1) end |
#opening_curly_bracket ⇒ Object
26 27 28 |
# File 'lib/code/parser/string.rb', line 26 def opening_curly_bracket str("{") end |
#root ⇒ Object
74 75 76 77 |
# File 'lib/code/parser/string.rb', line 74 def root (single_quoted_string | double_quoted_string | symbol).aka(:string) | Number end |
#single_quote ⇒ Object
14 15 16 |
# File 'lib/code/parser/string.rb', line 14 def single_quote str("'") end |
#single_quoted_string ⇒ Object
58 59 60 61 62 |
# File 'lib/code/parser/string.rb', line 58 def single_quoted_string single_quote.ignore << ( code_part.aka(:code) | single_quoted_text_part.aka(:text) ).repeat << single_quote.ignore.maybe end |
#single_quoted_text_part ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/code/parser/string.rb', line 42 def single_quoted_text_part ( (backslash.ignore << opening_curly_bracket) | (backslash.ignore << single_quote) | (single_quote.absent << opening_curly_bracket.absent << any) ).repeat(1) end |
#symbol ⇒ Object
70 71 72 |
# File 'lib/code/parser/string.rb', line 70 def symbol (colon.ignore << name).aka(:text).repeat(1, 1) end |