mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-10-29 22:24:35 +00:00 
			
		
		
		
	Merge pull request #2361 from Freed-Wu/main
Add Requirementstxt.sublime-syntax and its test.
This commit is contained in:
		
							
								
								
									
										120
									
								
								assets/syntaxes/02_Extra/Requirementstxt.sublime-syntax
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								assets/syntaxes/02_Extra/Requirementstxt.sublime-syntax
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,120 @@ | ||||
| %YAML 1.2 | ||||
| --- | ||||
| # http://www.sublimetext.com/docs/syntax.html | ||||
| name: Requirements.txt | ||||
| scope: source.requirements-txt | ||||
| # https://pip.pypa.io/en/stable/reference/requirements-file-format/ | ||||
| # https://github.com/raimon49/requirements.txt.vim/blob/f246bd10155fbc3b1a9e2fff6c95b21521b09116/ftdetect/requirements.vim | ||||
| file_extensions: | ||||
|   - requirements.txt | ||||
|   - requirements.in | ||||
|   - pip | ||||
| # https://github.com/sublimehq/Packages/pull/2760/files | ||||
| first_line_match: |- | ||||
|   (?xi: | ||||
|     ^ \#! .* \bpip                                        # shebang | ||||
|   | ^ \s* \# .*? -\*- .*? \bpip-requirements\b .*? -\*-   # editorconfig | ||||
|   | ^ \s* \# (vim?|ex): .*? \brequirements\b              # modeline | ||||
|   ) | ||||
| # pip install -r | ||||
| # pip-compile | ||||
|  | ||||
| variables: | ||||
|   operator: '===?|<=?|>=?|~=|!=' | ||||
|  | ||||
| contexts: | ||||
|   main: | ||||
|     - match: '(?i)\d+[\da-z\-_\.\*]*' | ||||
|       scope: constant.other.version-control.requirements-txt | ||||
|     - match: '(?i)^\[?--?[\da-z\-]*\]?' | ||||
|       scope: entity.name.function.option.requirements-txt | ||||
|     - match: '{{operator}}' | ||||
|       scope: keyword.operator.logical.requirements-txt | ||||
|     - match: '(\[)' | ||||
|       captures: | ||||
|         1: punctuation.section.braces.begin.requirements-txt | ||||
|       push: | ||||
|         - meta_scope: variable.function.extra.requirements-txt | ||||
|         - match: ',' | ||||
|           scope: punctuation.separator.requirements-txt | ||||
|         - match: '(\])' | ||||
|           captures: | ||||
|             1: punctuation.section.braces.end.requirements-txt | ||||
|           pop: true | ||||
|     - match: '(git\+?|hg\+|svn\+|bzr\+).*://.\S+' | ||||
|       scope: markup.underline.link.versioncontrols.requirements-txt | ||||
|     - match: '(@\s)?(https?|ftp|gopher)://?[^\s/$.?#].\S*' | ||||
|       scope: markup.underline.link.url.requirements-txt | ||||
|       captures: | ||||
|         1: punctuation.definition.keyword.requirements-txt | ||||
|     - match: '(?i)^[a-z\d_\-\.]*[a-z\d]' | ||||
|       scope: variable.parameter.package-name.requirements-txt | ||||
|     - match: '(;)' | ||||
|       captures: | ||||
|         1: punctuation.definition.annotation.requirements-txt | ||||
|       push: | ||||
|         - meta_scope: meta.annotation.requirements-txt | ||||
|         # https://pip.pypa.io/en/stable/reference/inspect-report/#example | ||||
|         - match: |- | ||||
|             (?x: | ||||
|               implementation_name | ||||
|             | implementation_version | ||||
|             | os_name | ||||
|             | platform_machine | ||||
|             | platform_release | ||||
|             | platform_system | ||||
|             | platform_version | ||||
|             | python_full_version | ||||
|             | platform_python_implementation | ||||
|             | python_version | ||||
|             | sys_platform | ||||
|             ) | ||||
|           scope: variable.language.requirements-txt | ||||
|         - match: '{{operator}}' | ||||
|           scope: keyword.operator.logical.requirements-txt | ||||
|           # https://pip.pypa.io/en/stable/reference/requirement-specifiers/#examples | ||||
|         - match: '(")' | ||||
|           captures: | ||||
|             1: punctuation.definition.string.begin.double.requirements-txt | ||||
|           push: | ||||
|             - meta_scope: string.quoted.double.requirements-txt | ||||
|             - match: '\\"' | ||||
|               scope: constant.character.escape.double.requirements-txt | ||||
|             - match: '(")' | ||||
|               captures: | ||||
|                 1: punctuation.definition.string.end.double.requirements-txt | ||||
|               pop: true | ||||
|         - match: "(')" | ||||
|           captures: | ||||
|             1: punctuation.definition.string.begin.single.requirements-txt | ||||
|           push: | ||||
|             - meta_scope: string.quoted.single.requirements-txt | ||||
|             - match: '\\''' | ||||
|               scope: constant.character.escape.single.requirements-txt | ||||
|             - match: "(')" | ||||
|               captures: | ||||
|                 1: punctuation.definition.string.end.single.requirements-txt | ||||
|               pop: true | ||||
|         - match: '(.(?=#)|$)' | ||||
|           pop: true | ||||
|     - match: '(\$)(\{)' | ||||
|       captures: | ||||
|         1: punctuation.definition.keyword.requirements-txt | ||||
|         2: punctuation.definition.begin.parameter.requirements-txt | ||||
|       push: | ||||
|         - meta_scope: variable.parameter.requirements-txt | ||||
|         - match: '(\})' | ||||
|           captures: | ||||
|             1: punctuation.definition.end.parameter.requirements-txt | ||||
|           pop: true | ||||
|     - match: '(#)' | ||||
|       captures: | ||||
|         1: punctuation.definition.comment.requirements-txt | ||||
|       push: | ||||
|         - meta_scope: comment.line.requirements-txt | ||||
|         - match: '(-*-) coding: .* (-*-)' | ||||
|           captures: | ||||
|             1: punctuation.definition.begin.pep263.requirements-txt | ||||
|             2: punctuation.definition.end.pep263.requirements-txt | ||||
|         - match: '$' | ||||
|           pop: true | ||||
							
								
								
									
										82
									
								
								assets/syntaxes/02_Extra/syntax_test_requirements.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								assets/syntaxes/02_Extra/syntax_test_requirements.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,82 @@ | ||||
| # SYNTAX TEST "Requirementstxt.sublime-syntax" | ||||
| # Options | ||||
| # <- punctuation.definition.comment | ||||
| # ^^^^^^^ comment.line | ||||
| --allow-external | ||||
| #^^^^^^^^^^^^^^^ entity.name.function.option | ||||
| --allow-unverified | ||||
|  | ||||
| # Freeze packages | ||||
| alabaster==0.7.6 | ||||
| Babel>=2.9.1 | ||||
| docutils==0.12 | ||||
| gevent_subprocess==0.1.2 | ||||
| gitpython==3.0.7 | ||||
| hg-diff==1.2.4 | ||||
| #^^^^^^ variable.parameter.package-name | ||||
| #      ^^ keyword.operator.logical | ||||
| #        ^^^^^ constant.other | ||||
| Jinja2>=2.8.1 | ||||
| MarkupSafe==0.23 | ||||
| Pygments==2.7.4 | ||||
| pytz==2015.7 | ||||
| six==1.10.0 | ||||
| snowballstemmer==1.2.0 | ||||
| Sphinx==1.3.3 | ||||
| sphinx-rtd-theme==0.1.9 | ||||
| svn==1.0.1 | ||||
| zope.interface==4.2.0 | ||||
|  | ||||
| # Examples from PEP508 | ||||
| # c.f. https://www.python.org/dev/peps/pep-0508/ | ||||
| requests [security,tests] >= 2.8.1, == 2.8.* ; python_version < "2.7" # Comment | ||||
| #^^^^^^^ variable.parameter.package-name | ||||
| #        ^^^^^^^^^^^^^^^^ variable.function.extra | ||||
| #        ^ punctuation.section.braces.begin | ||||
| #                 ^ punctuation.separator | ||||
| #                       ^ punctuation.section.braces.end | ||||
| #                         ^^ keyword.operator.logical | ||||
| #                            ^^^^^ constant.other | ||||
| #                                   ^^ keyword.operator.logical | ||||
| #                                      ^^^^^ constant.other | ||||
| #                                            ^ punctuation.definition.annotation | ||||
| #                                            ^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation | ||||
| #                                              ^^^^^^^^^^^^^^ variable.language | ||||
| #                                                             ^ keyword.operator.logical | ||||
| #                                                               ^ punctuation.definition.string.begin.double | ||||
| #                                                               ^^^^^ string.quoted.double.requirements-txt | ||||
| #                                                                   ^ punctuation.definition.string.end.double | ||||
| #                                                                     ^^^^^^^^^ comment.line | ||||
| pip @ https://github.com/pypa/pip/archive/1.3.1.zip#sha1=da9234ee9982d4bbb3c72346a6de940a148ea686 | ||||
| #   ^ punctuation.definition.keyword | ||||
| #   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.url | ||||
| name @ gopher:/foo/com" | ||||
| foobar[quux]<2,>=3; os_name=='a' | ||||
|  | ||||
| # VCS repositories | ||||
| -e git+git://git.myproject.org/MyProject#egg=MyProject # Git | ||||
| # <- entity.name.function.option | ||||
| #^ entity.name.function.option | ||||
| #  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.versioncontrols | ||||
| #                                       ^^^^^^^^^^^^^^^ - comment.line | ||||
| #                                                      ^^^^^ comment.line | ||||
| -e git://git.myproject.org/MyProject.git@v1.0#egg=MyProject | ||||
| #  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.versioncontrols | ||||
| -e hg+https://hg.myproject.org/MyProject#egg=MyProject # Mercurial | ||||
| #  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.versioncontrols | ||||
| #                                                      ^^^^^^^^^^^ comment.line | ||||
| -e hg+http://hg.myproject.org/MyProject@da39a3ee5e6b#egg=MyProject | ||||
| #  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.versioncontrols | ||||
| -e svn+http://svn.myproject.org/svn/MyProject/trunk@2019#egg=MyProject # Subversion | ||||
| #  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.versioncontrols | ||||
| #                                                                      ^^^^^^^^^^^^ comment.line | ||||
| -e bzr+ssh://user@myproject.org/MyProject/trunk#egg=MyProject # Bazaar | ||||
| #  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.versioncontrols | ||||
| #                                                             ^^^^^^^^ comment.line | ||||
| -e bzr+https://bzr.myproject.org/MyProject/trunk@2019#egg=MyProject | ||||
| #  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.versioncontrols | ||||
|  | ||||
| # Project or archive URL | ||||
| https://github.com/pallets/click/archive/7.0.zip#egg=click | ||||
| #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.url | ||||
| #                                               ^^^^^^^^^^ - comment.line | ||||
		Reference in New Issue
	
	Block a user