Module: Coradoc::AsciiDoc::Parser::AttributeList
- Defined in:
- lib/coradoc/asciidoc/parser/attribute_list.rb
Instance Method Summary collapse
- #attribute_list(name = :attribute_list) ⇒ Object
- #named_attribute ⇒ Object
- #named_attribute_name ⇒ Object
- #named_key ⇒ Object
- #named_many ⇒ Object
- #named_value ⇒ Object
- #named_value_double_quote ⇒ Object
- #named_value_noquote ⇒ Object
- #named_value_single_quote ⇒ Object
- #positional_attribute ⇒ Object
- #positional_many ⇒ Object
- #positional_many_named_many ⇒ Object
- #positional_one_named_many ⇒ Object
- #positional_value_double_quote ⇒ Object
- #positional_value_single_quote ⇒ Object
- #positional_value_unquoted ⇒ Object
- #positional_zero_or_one ⇒ Object
Instance Method Details
#attribute_list(name = :attribute_list) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 96 def attribute_list(name = :attribute_list) str('[').present? >> str('[') >> str('[').absent? >> (named_many | positional_one_named_many | positional_many_named_many | positional_many | positional_zero_or_one ).as(:attribute_array).as(name) >> str(']') end |
#named_attribute ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 38 def named_attribute (named_key >> str(' ').maybe >> str('=') >> str(' ').maybe >> named_value >> str(' ').maybe ).as(:named) end |
#named_attribute_name ⇒ Object
7 8 9 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 7 def named_attribute_name attribute_name end |
#named_key ⇒ Object
34 35 36 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 34 def named_key match('[a-zA-Z0-9_-]').repeat(1).as(:named_key) end |
#named_many ⇒ Object
71 72 73 74 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 71 def named_many (named_attribute.repeat(1, 1) >> (str(',') >> space.maybe >> named_attribute).repeat(0)) end |
#named_value ⇒ Object
27 28 29 30 31 32 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 27 def named_value (named_value_single_quote | named_value_double_quote | named_value_noquote ).as(:named_value) end |
#named_value_double_quote ⇒ Object
21 22 23 24 25 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 21 def named_value_double_quote str('"') >> match('[^"]').repeat(1) >> str('"') end |
#named_value_noquote ⇒ Object
11 12 13 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 11 def named_value_noquote match('[^\],]').repeat(1) end |
#named_value_single_quote ⇒ Object
15 16 17 18 19 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 15 def named_value_single_quote str("'") >> match("[^']").repeat(1) >> str("'") end |
#positional_attribute ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 62 def positional_attribute ((positional_value_single_quote | positional_value_double_quote | positional_value_unquoted ) >> str('=').absent? ).as(:positional) end |
#positional_many ⇒ Object
87 88 89 90 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 87 def positional_many (positional_attribute.repeat(1, 1) >> (str(',') >> space.maybe >> positional_attribute).repeat(0)) end |
#positional_many_named_many ⇒ Object
81 82 83 84 85 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 81 def positional_many_named_many (positional_attribute.repeat(1, 1) >> (str(',') >> space.maybe >> positional_attribute).repeat(1) >> (str(',') >> space.maybe >> named_attribute).repeat(1)) end |
#positional_one_named_many ⇒ Object
76 77 78 79 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 76 def positional_one_named_many (positional_attribute.repeat(1, 1) >> (str(',') >> space.maybe >> named_attribute).repeat(1)) end |
#positional_value_double_quote ⇒ Object
56 57 58 59 60 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 56 def positional_value_double_quote str('"') >> match('[^"]').repeat(1) >> str('"') end |
#positional_value_single_quote ⇒ Object
50 51 52 53 54 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 50 def positional_value_single_quote str("'") >> match("[^']").repeat(1) >> str("'") end |
#positional_value_unquoted ⇒ Object
46 47 48 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 46 def positional_value_unquoted match['a-zA-Z0-9_\-%.'].repeat(1) end |
#positional_zero_or_one ⇒ Object
92 93 94 |
# File 'lib/coradoc/asciidoc/parser/attribute_list.rb', line 92 def positional_zero_or_one positional_attribute.repeat(0, 1) end |