Last active
April 6, 2016 07:22
-
-
Save leegee/0fc1623f41beb999005a to your computer and use it in GitHub Desktop.
Start of a Sublime syntax file Gherkin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML1.2 | |
--- | |
# See http://www.sublimetext.com/docs/3/syntax.html | |
file_extensions: | |
- feature | |
scope: source.feature | |
contexts: | |
main: | |
- match: '"' | |
scope: punctuation.definition.string.begin.feature | |
push: double_quoted_string | |
# Note that blackslashes don't need to be escaped within single quoted | |
# strings in YAML. When using single quoted strings, only single quotes | |
# need to be escaped: this is done by using two single quotes next to each | |
# other. | |
- match: '''' | |
scope: punctuation.definition.string.begin.feature | |
push: single_quoted_string | |
# Comments begin with a '#' and finish at the end of the line | |
- match: '#' | |
scope: punctuation.definition.comment.feature | |
push: line_comment | |
- match: '<[^>]+>' | |
scope: string.quoted.single.feature | |
- match: '^\s*\|.+$' | |
scope: entity.name.tag.section | |
- match: '^\s*@\S+$' | |
scope: entity.name.tag | |
- match: '^Feature:' | |
scope: keyword.control.feature | |
# push: feature_def | |
- match: '^\s*(Scenario|Scenario\s+Outline):' | |
scope: keyword.control.feature | |
- match: '^\s*(Examples|Background):' | |
scope: keyword.control.feature | |
- match: '^\s*(Given|Then|When|And|But)\s+' | |
scope: keyword.control.feature | |
# Numbers | |
- match: '\b(-)?[0-9.]+\b' | |
scope: constant.numeric.feature | |
# Brack balancing | |
- match: '<' | |
push: brackets | |
- match: '>' | |
scope: invalid.illegal.stray-bracket-end | |
single_quoted_string: | |
- meta_scope: string.quoted.single.feature | |
- match: '''' | |
scope: punctuation.definition.string.end.feature | |
pop: true | |
double_quoted_string: | |
- meta_scope: string.quoted.double.feature | |
- match: '"' | |
scope: punctuation.definition.string.end.feature | |
pop: true | |
line_comment: | |
- meta_scope: comment.line.feature | |
- match: $ | |
pop: true | |
tag: | |
- meta_scope: entity.name.tag | |
- match: $ | |
pop: true | |
# feature_def: | |
# - meta_scope: comment.block.documentation.feature | |
# meta_include_prototype: false | |
# match: '^\s*$' | |
# pop: true | |
# # ^\s*[\n\r\f] | |
brackets: | |
- match: '>' | |
pop: true | |
- include: main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A bit stumped on matching the termination of the Feature: block