File: grammar.rb

package info (click to toggle)
ruby-slim 5.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 828 kB
  • sloc: ruby: 5,583; makefile: 12
file content (24 lines) | stat: -rw-r--r-- 676 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true
module Slim
  # Slim expression grammar
  # @api private
  module Grammar
    extend Temple::Grammar

    TextTypes << :verbatim | :explicit | :implicit | :inline

    Expression <<
      [:slim, :control, String, Expression]                 |
      [:slim, :output, Bool, String, Expression]            |
      [:slim, :interpolate, String]                         |
      [:slim, :embedded, String, Expression, HTMLAttrGroup] |
      [:slim, :text, TextTypes, Expression]                 |
      [:slim, :attrvalue, Bool, String]

    HTMLAttr <<
      [:slim, :splat, String]

    HTMLAttrGroup <<
      [:html, :attrs, 'HTMLAttr*']
  end
end