%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Java Server Page (JSP)
file_extensions:
- jsp
scope: text.html.jsp
contexts:
main:
- match: <%--
scope: punctuation.definition.comment.jsp
push:
- meta_scope: comment.block.jsp
- match: "--%>"
scope: punctuation.definition.comment.jsp
pop: true
- match: <%@
scope: punctuation.section.directive.jsp
push:
- meta_scope: meta.directive.jsp
- match: "%>"
scope: punctuation.section.directive.jsp
pop: true
- match: \w+
scope: keyword.other.directive.jsp
push:
- match: \w+
scope: constant.other.directive.attribute.jsp
- match: "="
scope: keyword.operator.assignment.jsp
- match: '"'
scope: punctuation.definition.string.begin.jsp
push:
- meta_scope: string.quoted.double.jsp
- match: '"'
scope: punctuation.definition.string.end.jsp
pop: true
- match: \\.
scope: constant.character.escape.jsp
- match: "'"
scope: punctuation.definition.string.begin.jsp
push:
- meta_scope: string.quoted.single.jsp
- match: "'"
scope: punctuation.definition.string.end.jsp
pop: true
- match: \\.
scope: constant.character.escape.jsp
- match: '(?=\S)'
pop: true
- match: "(<%[!=]?)|(||)"
captures:
1: punctuation.section.embedded.begin.jsp
2: meta.tag.block.jsp
push:
- match: (||)|(%>)
captures:
1: meta.tag.block.jsp
2: punctuation.section.embedded.end.jsp
pop: true
- match: '(?|||%>|\{|\})'
push:
- meta_scope: source.java.embedded.html
- match: '(?=|||%>|\{|\})|\n'
pop: true
- include: scope:source.java
- match: "{"
push:
- match: "}"
pop: true
- match: (||)|(%>)
captures:
1: meta.tag.block.jsp
2: punctuation.section.embedded.end.jsp
push:
- match: "(||)|(<%(?!--)[!=]?)"
captures:
1: meta.tag.block.jsp
2: punctuation.section.embedded.begin.jsp
pop: true
- include: scope:text.html.jsp
- include: scope:source.java
# Prevent stray brace detection since brace matching won't work with
# %> pop pattern
- match: "}"
- include: scope:source.java
- include: scope:text.html.basic