         comment: "second section of the file - rules"
         end: "^(?=%%$)"
         name: "meta.section.rules.jisonlex"
-        patterns: [
-          {
-            begin: "^(?!$)"
-            end: "$"
-            name: "meta.rule.jisonlex"
-            patterns: [
-              {
-                include: "#includes"
-              }
-              {
-                begin: "(?i)^(<(?:(?:[a-z_][a-z0-9_-]*,)*[a-z_][a-z0-9_-]|\\*)>)?(?:(<<EOF>>)(\\s*))?(?=\\S)"
-                beginCaptures:
-                  1:
-                    name: "keyword.other.start-condition.jisonlex"
-                  2:
-                    name: "keyword.operator.eof.jisonlex"
-                  3:
-                    name: "invalid.illegal.regexp.jisonlex"
-                comment: "rule pattern"
-                end: "(?=\\s)|$"
-                patterns: [
-                  {
-                    include: "#regexp"
-                  }
-                ]
-              }
-              {
-                begin: "(%\\{)"
-                beginCaptures:
-                  1:
-                    name: "punctuation.definition.code.jisonlex"
-                comment: "TODO: %} should override embedded scopes"
-                end: "(%\\})(.*)"
-                endCaptures:
-                  1:
-                    name: "punctuation.terminator.code.jisonlex"
-                  2:
-                    name: "invalid.illegal.ignored.jisonlex"
-                patterns: [
-                  {
-                    include: "#jssource"
-                  }
-                ]
-              }
-              {
-                begin: "(?=\\S)"
-                comment: "TODO: eol should override embedded scopes"
-                end: "$"
-                name: "meta.rule.action.jisonlex"
-                patterns: [
-                  {
-                    include: "#jssource"
-                  }
-                ]
-              }
-            ]
-          }
-        ]
+        patterns: [include: "#rules_section"]
       }
       {
         begin: "^(%%)$"

        comment: "third section of the file - user code"
        contentName: "meta.section.user-code.jisonlex"
        end: "\\Z.\\A(?# never end)"
        patterns: [
          {
            include: "#jssource"
          }
        ]
      }
    ]
  }
]
repository:
  jssource:
    patterns: [
      {

    comment: "first section of the file - definitions"
    end: "^(?=%%$)"
    name: "meta.section.definitions.jisonlex"
    patterns: [include: "#definitions_section"]
  }
  {
    begin: "^(%%)$"
