From 394a5852d7f23bfc4edea01a2220b711352b2b3f Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 7 May 2016 22:58:12 -0400 Subject: [PATCH 01/56] [LaTeX] rewrite syntaxes --- LaTeX/Indentation Rules.tmPreferences | 14 + LaTeX/LaTeX Beamer.sublime-syntax | 36 - LaTeX/LaTeX Memoir.sublime-syntax | 68 -- LaTeX/LaTeX.sublime-syntax | 935 ++++++++++-------- .../Item[description].sublime-snippet | 2 +- LaTeX/Symbol List - Labels.tmPreferences | 24 + LaTeX/Symbol List - Sections.tmPreferences | 24 + LaTeX/TeX Math.sublime-syntax | 41 - LaTeX/TeX.sublime-syntax | 207 +++- 9 files changed, 746 insertions(+), 605 deletions(-) create mode 100644 LaTeX/Indentation Rules.tmPreferences delete mode 100644 LaTeX/LaTeX Beamer.sublime-syntax delete mode 100644 LaTeX/LaTeX Memoir.sublime-syntax create mode 100644 LaTeX/Symbol List - Labels.tmPreferences create mode 100644 LaTeX/Symbol List - Sections.tmPreferences delete mode 100644 LaTeX/TeX Math.sublime-syntax diff --git a/LaTeX/Indentation Rules.tmPreferences b/LaTeX/Indentation Rules.tmPreferences new file mode 100644 index 0000000000..2810f8a8d3 --- /dev/null +++ b/LaTeX/Indentation Rules.tmPreferences @@ -0,0 +1,14 @@ + + + + scope + text.tex + settings + + decreaseIndentPattern + ^\s*\\end\s*\{(?:itemize|enumerate|description)\*?\}\s*$ + increaseIndentPattern + ^\s*\\begin\s*\{(?:itemize|enumerate|description)\*?\}\s*$ + + + diff --git a/LaTeX/LaTeX Beamer.sublime-syntax b/LaTeX/LaTeX Beamer.sublime-syntax deleted file mode 100644 index 89e3c06303..0000000000 --- a/LaTeX/LaTeX Beamer.sublime-syntax +++ /dev/null @@ -1,36 +0,0 @@ -%YAML 1.2 ---- -# http://www.sublimetext.com/docs/3/syntax.html -name: LaTeX Beamer -file_extensions: [] -first_line_match: '^\\documentclass(\[.*\])?\{beamer\}' -scope: text.tex.latex.beamer -contexts: - main: - - match: '(?:\s*)((\\)begin)(\{)(frame)(\})' - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - push: - - meta_scope: meta.function.environment.frame.latex - - match: '((\\)end)(\{)(frame)(\})' - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - pop: true - - include: main - - match: '((\\)frametitle)(\{)(.*)(\})' - scope: meta.function.frametitle.latex - captures: - 1: support.function.frametitle.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: entity.name.function.frame.latex - 5: punctuation.definition.arguments.end.latex - - include: scope:text.tex.latex diff --git a/LaTeX/LaTeX Memoir.sublime-syntax b/LaTeX/LaTeX Memoir.sublime-syntax deleted file mode 100644 index 76e9c6bc79..0000000000 --- a/LaTeX/LaTeX Memoir.sublime-syntax +++ /dev/null @@ -1,68 +0,0 @@ -%YAML 1.2 ---- -# http://www.sublimetext.com/docs/3/syntax.html -name: LaTeX Memoir -file_extensions: [] -first_line_match: '^\\documentclass(\[.*\])?\{memoir\}' -scope: text.tex.latex.memoir -contexts: - main: - - match: '(?:\s*)((\\)begin)(\{)(framed|shaded|leftbar)(\})' - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - push: - - meta_scope: meta.function.memoir-fbox.latex - - match: '((\\)end)(\{)(\4)(\})' - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - pop: true - - include: main - - match: '(?:\s*)((\\)begin)(\{)((?:fboxv|boxedv|V)erbatim)(\})' - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - push: - - meta_scope: meta.function.memoir-verbatim.latex - - meta_content_scope: markup.raw.verbatim.latex - - match: '((\\)end)(\{)(\4)(\})' - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - pop: true - - match: '(?:\s*)((\\)begin)(\{)(alltt)(\})' - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - push: - - meta_scope: meta.function.memoir-alltt.latex - - meta_content_scope: markup.raw.verbatim.latex - - match: '((\\)end)(\{)(alltt)(\})' - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - pop: true - - match: '(\\)[A-Za-z]+' - scope: support.function.general.tex - captures: - 1: punctuation.definition.function.tex - - include: scope:text.tex.latex diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 5f6e590610..d8dff7148e 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -4,554 +4,673 @@ name: LaTeX file_extensions: - tex + - ltx first_line_match: '^\\documentclass(?!.*\{beamer\})' scope: text.tex.latex contexts: + prototype: + - include: comments + main: - - match: '(?=\s)(?<=\\[\w@]|\\[\w@]{2}|\\[\w@]{3}|\\[\w@]{4}|\\[\w@]{5}|\\[\w@]{6})\s' - scope: meta.space-after-command.latex - - match: '((\\)(?:usepackage|documentclass))(?:(\[)([^\]]*)(\]))?(\{)' + # unique to latex + - include: preamble + - include: structure + - include: includes + - include: sections + - include: text-decorators + - include: references + - include: verbatim + - include: url + - include: invalid-quotations + - include: lists + + # external packages + - include: external-packages + + # extended from tex + - include: macros + - include: controls + - include: catcode + - include: braces + - include: boxes + - include: block-math + - include: inline-math + - include: constants + + # unique to latex + - include: begin-end-commands + # extended from tex + - include: general-commands + + comments: + - include: scope:text.tex#comments + + macros: + - include: scope:text.tex#macros + - match: |- + (?x) + ( + (\\) + (?:(?:re)?newcommand) + ) + (?: + (\{)(\\[a-zA-Z@]+)(\}) + | (\\[a-zA-Z@])+ + ) + (?:(\[)(?:[^\]]*)(\]))? + (\{) + captures: + 1: support.function.newcommand.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: support.function.latex + 5: punctuation.definition.brace.end.latex + 6: support.function.latex + 7: punctuation.definition.brace.optional.begin.latex + 8: punctuation.definition.brace.optional.end.latex + 9: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.function.newcommand.tex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: constants + - include: general-commands + - include: command-only-braces + + command-only-braces: + - match: '\{' + scope: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.group.braces.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: constants + - include: general-commands + - include: command-only-braces + + controls: + - include: scope:text.tex#controls + + catcode: + - include: scope:text.tex#catcode + + constants: + - match: '(\\\\)(?:(\[)\s*-?([0-9]*)\s*(\w*)\s*(\]))?' + captures: + 1: constant.character.newline.latex + 2: punctuation.definition.brace.begin.newline.latex + 3: constant.numeric.newline.latex + 4: keyword.other.newline.latex + 5: punctuation.definition.brace.begin.newline.latex + - include: scope:text.tex#constants + + general-commands: + - include: scope:text.tex#general-commands + + boxes: + - include: scope:text.tex#boxes + - match: '((\\)[mf]box)\s*(\{)' + captures: + 1: support.function.box.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.function.box.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + - match: '((\\)(?:framebox|makebox))(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' + captures: + 1: support.function.box.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.optional.begin.latex + 4: punctuation.definition.brace.optional.end.latex + 5: punctuation.definition.brace.optional.begin.latex + 6: punctuation.definition.brace.optional.end.latex + 7: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.function.box.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + - match: '((\\)parbox)(?:(\[)[^\]]*?(\]))?(\{)[^\}]*?(\})(\{)' + captures: + 1: support.function.box.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.optional.begin.latex + 4: punctuation.definition.brace.optional.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.brace.end.latex + 7: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.function.box.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + - match: '((\\)raisebox)(\{)[^\}]*?(\})(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' + captures: + 1: support.function.box.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.optional.begin.latex + 6: punctuation.definition.brace.optional.end.latex + 7: punctuation.definition.brace.optional.begin.latex + 8: punctuation.definition.brace.optional.end.latex + 9: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.function.box.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + + braces: + - match: '\{' + scope: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.group.braces.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + + preamble: + - match: '((\\)(?:documentclass|usepackage))\s*(?:(\[)(?:[^\]]*)(\]))?(\{)' captures: 1: keyword.control.preamble.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.latex - 5: punctuation.definition.arguments.end.latex - 6: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.bracket.begin.latex + 4: punctuation.definition.bracket.end.latex + 5: punctuation.definition.brace.begin.latex push: - meta_scope: meta.preamble.latex - - meta_content_scope: support.class.latex - match: '\}' - captures: - 0: punctuation.definition.arguments.end.latex + scope: punctuation.definition.brace.end.latex pop: true - - include: main - - match: '((\\)(?:include|input))(\{)' + + includes: + - match: '((\\)(?:include|includeonly))(\{)' + scope: meta.function.include.latex captures: 1: keyword.control.include.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.include.latex - - meta_content_scope: support.class.latex - match: '\}' - captures: - 0: punctuation.definition.arguments.end.latex + scope: punctuation.definition.brace.end.latex pop: true - - include: main + + sections: - match: |- (?x) - ( # Capture 1 - (\\) # Marker - (?: - (?:sub){0,2}section # Functions - | (?:sub)?paragraph - | chapter|part|addpart - | addchap|addsec|minisec - ) - (?:\*)? # Optional Unnumbered + ( + (\\) + (?: + (?:sub){0,2}section + | (?:sub)?paragraph + | chapter|part|addpart + | addchap|addsec|minisec + ) + (?:\*)? ) (?: - (\[)([^\[]*?)(\]) # Optional Title - )?? - (\{) # Opening Bracket - comment: this works OK with all kinds of crazy stuff as long as section is one line + (\[)([^\[]*?)(\]) # optional Title + )? + (\{) captures: 1: support.function.section.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.optional.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: entity.name.section.latex - 5: punctuation.definition.arguments.optional.end.latex - 6: punctuation.definition.arguments.begin.latex + 5: punctuation.definition.brace.end.latex + 6: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.section.latex - meta_content_scope: entity.name.section.latex - match: '\}' - captures: - 0: punctuation.definition.arguments.end.latex + scope: punctuation.definition.brace.end.latex pop: true - include: main - - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Java)\n?)' + + structure: + - match: ((\\)(?:frontmatter|mainmatter|backmatter|appendix|printindex))\b + captures: + 1: keyword.control.latex + 2: punctuation.definition.backslash.function.latex + + verbatim: + - match: '((\\)begin)(\{)\s*((?:[vV]erbatim|alltt)\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - 6: punctuation.definition.arguments.optional.begin.latex - 7: punctuation.definition.arguments.optional.end.latex - 8: comment.line.percentage.latex + 5: punctuation.definition.brace.end.latex push: - - meta_scope: meta.function.embedded.java.latex - - meta_content_scope: source.java.embedded - - match: '((\\)end)(\{)(lstlisting)(\})' + - meta_include_prototype: false + - meta_scope: meta.function.verbatim.latex + - meta_content_scope: markup.raw.verbatim.latex + - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - 6: punctuation.definition.arguments.optional.begin.latex - 7: punctuation.definition.arguments.optional.end.latex - 8: comment.line.percentage.latex + 5: punctuation.definition.brace.end.latex pop: true - - include: scope:source.java - - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Python)\n?)' - comment: Put the lstlisting match before the more general environment listing. Someday it would be nice to make this rule general enough to figure out which language is inside the lstlisting environment rather than my own personal use for python. --Brad + + lists: + - match: '((\\)begin)(\{)\s*(itemize\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - 6: punctuation.definition.arguments.optional.begin.latex - 7: punctuation.definition.arguments.optional.end.latex - 8: comment.line.percentage.latex + 5: punctuation.definition.brace.end.latex push: - - meta_scope: meta.function.embedded.python.latex - - meta_content_scope: source.python.embedded - - match: '((\\)end)(\{)(lstlisting)(\})' + - meta_scope: meta.environment.list.itemize.latex + - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - 6: punctuation.definition.arguments.optional.begin.latex - 7: punctuation.definition.arguments.optional.end.latex - 8: comment.line.percentage.latex + 5: punctuation.definition.brace.end.latex pop: true - - include: scope:source.python - - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%.*\n?)?' - comment: Put the lstlisting match before the more general environment listing. Someday it would be nice to make this rule general enough to figure out which language is inside the lstlisting environment rather than my own personal use for python. --Brad + - include: main + - match: '((\\)begin)(\{)\s*(enumerate\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - 6: punctuation.definition.arguments.optional.begin.latex - 7: punctuation.definition.arguments.optional.end.latex - 8: comment.line.percentage.latex + 5: punctuation.definition.brace.end.latex push: - - meta_scope: meta.function.embedded.generic.latex - - meta_content_scope: source.generic.embedded - - match: '((\\)end)(\{)(lstlisting)(\})' + - meta_scope: meta.environment.list.enumerate.latex + - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - 6: punctuation.definition.arguments.optional.begin.latex - 7: punctuation.definition.arguments.optional.end.latex - 8: comment.line.percentage.latex + 5: punctuation.definition.brace.end.latex pop: true - - match: '(?:\s*)((\\)begin)(\{)((?:V|v)erbatim|alltt)(\})' + - include: main + - match: '((\\)begin)(\{)\s*(list\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex + 5: punctuation.definition.brace.end.latex push: - - meta_scope: meta.function.verbatim.latex - - meta_content_scope: markup.raw.verbatim.latex - - match: '((\\)end)(\{)(\4)(\})' + - meta_scope: meta.environment.list.list.latex + - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex + 5: punctuation.definition.brace.end.latex pop: true - - match: '(?:\s*)((\\)(?:url|href))(\{)([^}]*)(\})' - scope: meta.function.link.url.latex - captures: - 1: support.function.url.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: markup.underline.link.latex - 5: punctuation.definition.arguments.end.latex - - match: '(?:\s*)((\\)begin)(\{)(document)(\})' - comment: 'These two patterns match the \begin{document} and \end{document} commands, so that the environment matching pattern following them will ignore those commands.' - scope: meta.function.begin-document.latex - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - - match: '(?:\s*)((\\)end)(\{)(document)(\})' - scope: meta.function.end-document.latex - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - - match: |- - (?x) - (?:\s*) # Optional whitespace - ((\\)begin) # Marker - Function - (\{) # Open Bracket - ( - (?: - align|equation|eqnarray # Argument - | multline|aligned|alignat - | split|gather|gathered - ) - (?:\*)? # Optional Unnumbered - ) - (\}) # Close Bracket - (\s*\n)? # Match to end of line absent of content + - include: main + - match: '((\\)begin)(\{)\s*(description\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - push: - - meta_scope: meta.function.environment.math.latex - - meta_content_scope: string.other.math.block.environment.latex - - match: |- - (?x) - (?:\s*) # Optional whitespace - ((\\)end) # Marker - Function - (\{) # Open Bracket - (\4) # Previous capture from begin - (\}) # Close Bracket - (?:\s*\n)? # Match to end of line absent of content + 5: punctuation.definition.brace.end.latex + push: + - meta_scope: meta.environment.list.description.latex + - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex + 5: punctuation.definition.brace.end.latex pop: true - - include: $top_level_main - - match: |- - (?x) - (?:\s*) # Optional whitespace - ((\\)begin) # Marker - Function - (\{) # Open Bracket - (array|tabular[xy*]?) - (\}) # Close Bracket - (\s*\n)? # Match to end of line absent of content - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - push: - - meta_scope: meta.function.environment.tabular.latex - - meta_content_scope: meta.data.environment.tabular.latex - - match: |- - (?x) - (?:\s*) # Optional whitespace - ((\\)end) # Marker - Function - (\{) # Open Bracket - (\4) # Previous capture from begin - (\}) # Close Bracket - (?:\s*\n)? # Match to end of line absent of content - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.end.latex - pop: true - - match: \\ - scope: punctuation.definition.table.row.latex - - match: '(?:^|(?<=\\\\))(?!\\\\|\s*\\end\{(?:tabular|array))' - push: - - meta_scope: meta.row.environment.tabular.latex - - match: '(?=\\\\|\s*\\end\{(?:tabular|array))' - pop: true - - match: "&" - scope: punctuation.definition.table.cell.latex - - match: (?:^|(?<=&))((?!&|\\\\|$)) - push: - - meta_scope: meta.cell.environment.tabular.latex - - match: '(?=&|\\\\|\s*\\end\{(?:tabular|array))' - pop: true - - include: $top_level_main - - include: $top_level_main - - include: $top_level_main - - match: '(?:\s*)((\\)begin)(\{)(itemize|enumerate|description|list)(\})' + - include: main + + math-braces: + - match: '\{' + scope: punctuation.definition.brace.begin.math.latex + push: + - meta_scope: meta.group.braces.math.latex + - match: '\}' + scope: punctuation.definition.brace.end.math.latex + pop: true + - include: math-content + + math-content: + # unique to latex + - include: verb + - include: text-decorators + - include: references + - include: begin-end-commands + # extended from tex + - include: scope:text.tex#greeks + - include: scope:text.tex#math-brackets + - include: math-braces + - include: boxes + - include: scope:text.tex#math-commands + - include: scope:text.tex#math-operators + - include: scope:text.tex#math-characters + - include: scope:text.tex#math-constants + - include: constants + + inline-math: + - match: \$ + scope: string.other.math.latex punctuation.definition.string.begin.latex + push: + - meta_scope: meta.environment.math.latex + - match: \$ + scope: string.other.math.latex punctuation.definition.string.end.latex + pop: true + - include: math-content + + block-math: + - match: \$\$ + scope: string.other.math.latex punctuation.definition.string.begin.latex + push: + - meta_scope: meta.environment.math.latex + - match: \$\$ + scope: string.other.math.latex punctuation.definition.string.end.latex + pop: true + - include: math-content + + - match: '(\\\[)' + scope: string.other.math.latex punctuation.definition.string.begin.latex + push: + - meta_scope: meta.environment.math.latex + - match: '(\\\])' + scope: string.other.math.latex punctuation.definition.string.end.latex + pop: true + - include: math-content + + - match: (\\\() + scope: string.other.math.latex captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.latex + 1: punctuation.definition.string.begin.latex push: - - meta_scope: meta.function.environment.list.latex - - match: '((\\)end)(\{)(\4)(\})(?:\s*\n)?' - captures: - 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.latex + - meta_scope: meta.environment.math.latex + - match: (\\\)) + scope: string.other.math.latex punctuation.definition.string.end.latex pop: true - - include: $top_level_main - - match: '(?:\s*)((\\)begin)(\{)(\w+[*]?)(\})' + - include: math-content + + - match: '((\\)begin)(\{)\s*((?:align|alignat|aligned|alignedat|displaymath|displaymath|eqnarray|equation|flalign|gather|gathered|math|multline|xalignat)\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.latex + 5: punctuation.definition.brace.end.latex push: - - meta_scope: meta.function.environment.general.latex - - match: '((\\)end)(\{)(\4)(\})(?:\s*\n)?' + - meta_scope: meta.environment.math.latex + - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.arguments.latex + 5: punctuation.definition.brace.end.latex pop: true - - include: $top_level_main - - match: (\\)(newcommand|renewcommand)\b - scope: storage.type.function.latex - captures: - 1: punctuation.definition.function.latex - - match: '((\\)marginpar)(\{)' + - include: math-content + + url: + - match: '(?:\s*)((\\)(?:url|href))(\{)([^}]*)(\})' + scope: meta.function.link.url.latex captures: - 1: support.function.marginpar.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.marginpar.begin.latex - push: - - meta_content_scope: meta.paragraph.margin.latex - - match: '\}' - captures: - 0: punctuation.definition.marginpar.end.latex - pop: true - - include: $top_level_main - - match: '((\\)footnote)(\{)' + 1: support.function.url.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: markup.underline.link.latex + 5: punctuation.definition.brace.end.latex + + invalid-quotations: + - match: (?' + 1: support.function.be.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex + - match: '((\\)end)(\{)\s*(\w*)\*?\s*(\})' + captures: + 1: support.function.be.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex + + # external packages supports + external-packages: + - include: 1stlisting + - include: beamer + + # 1stlisting + 1stlisting: + - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Java)\n?)' captures: - 0: punctuation.definition.string.begin.latex + 1: support.function.be.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex + 6: punctuation.definition.brace.optional.begin.latex + 7: punctuation.definition.brace.optional.end.latex + 8: comment.line.percentage.latex push: - - meta_scope: string.quoted.double.guillemot.latex - - match: '"<' + - meta_scope: meta.environment.embedded.java.latex + - meta_content_scope: source.java.embedded + - match: '((\\)end)(\{)(lstlisting)(\})' captures: - 0: punctuation.definition.string.end.latex + 1: support.function.be.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex pop: true - - include: $top_level_main - - match: '"<' + - include: scope:source.java + - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Python)\n?)' captures: - 0: punctuation.definition.string.begin.latex + 1: support.function.be.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex + 6: punctuation.definition.brace.optional.begin.latex + 7: punctuation.definition.brace.optional.end.latex + 8: comment.line.percentage.latex push: - - meta_scope: string.quoted.double.guillemot.latex - - match: '">' + - meta_scope: meta.environment.embedded.python.latex + - meta_content_scope: source.python.embedded + - match: '((\\)end)(\{)(lstlisting)(\})' captures: - 0: punctuation.definition.string.end.latex + 1: support.function.be.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex pop: true - - include: $top_level_main - - match: \\\( + - include: scope:source.python + - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%.*\n?)?' captures: - 0: punctuation.definition.string.begin.latex + 1: support.function.be.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex + 6: punctuation.definition.brace.optional.begin.latex + 7: punctuation.definition.brace.optional.end.latex + 8: comment.line.percentage.latex push: - - meta_scope: string.other.math.latex - - match: \\\) + - meta_scope: meta.environment.embedded.generic.latex + - meta_content_scope: source.generic.embedded + - match: '((\\)end)(\{)(lstlisting)(\})' captures: - 0: punctuation.definition.string.end.latex + 1: support.function.be.latex + 2: punctuation.definition.backslash.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex pop: true - - include: $top_level_main - - match: '\\\[' + + # beamer support + beamer: + - match: '(?:\s*)((\\)begin)(\{)(frame)(\})' captures: - 0: punctuation.definition.string.begin.latex + 1: support.function.be.latex + 2: punctuation.definition.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex push: - - meta_scope: string.other.math.latex - - match: '\\\]' + - meta_scope: meta.environment.frame.latex + - match: '((\\)end)(\{)(frame)(\})' captures: - 0: punctuation.definition.string.end.latex + 1: support.function.be.latex + 2: punctuation.definition.function.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex pop: true - - include: $top_level_main - - match: (?)(\{)\$(\})' - scope: meta.column-specials.latex - captures: - 1: punctuation.definition.column-specials.begin.latex - 2: punctuation.definition.column-specials.end.latex - - include: scope:text.tex + - include: frametitles + - include: main + + frametitles: + - match: '((\\)frametitle)(\{)(.*)(\})' + scope: meta.function.frametitle.latex + captures: + 1: support.function.frametitle.latex + 2: punctuation.definition.function.latex + 3: punctuation.definition.brace.begin.latex + 4: entity.name.function.frame.latex + 5: punctuation.definition.brace.end.latex diff --git a/LaTeX/Snippets/Item[description].sublime-snippet b/LaTeX/Snippets/Item[description].sublime-snippet index 210b8fba52..60ee52bb1a 100644 --- a/LaTeX/Snippets/Item[description].sublime-snippet +++ b/LaTeX/Snippets/Item[description].sublime-snippet @@ -1,6 +1,6 @@ itd - text.tex.latex meta.function.environment.list + text.tex.latex meta.environment.list \item[description] diff --git a/LaTeX/Symbol List - Labels.tmPreferences b/LaTeX/Symbol List - Labels.tmPreferences new file mode 100644 index 0000000000..7c8ae315e7 --- /dev/null +++ b/LaTeX/Symbol List - Labels.tmPreferences @@ -0,0 +1,24 @@ + + + + name + Symbol List + scope + meta.function.label.latex + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + symbolTransformation + + s/\\label\{([^\}]+)\}/Label: $1/g; + + symbolIndexTransformation + + s/\\label\{([^\}]+)\}/Label: $1/g; + + + + diff --git a/LaTeX/Symbol List - Sections.tmPreferences b/LaTeX/Symbol List - Sections.tmPreferences new file mode 100644 index 0000000000..3fbc3948de --- /dev/null +++ b/LaTeX/Symbol List - Sections.tmPreferences @@ -0,0 +1,24 @@ + + + + name + Symbol List + scope + meta.function.section.latex + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + symbolTransformation + + s/\\((?:sub)*(?:section|chapter)(?:\*)?)(?:\[[^\]]*\])?\{(.*)\}/\u$1: $2/g; + + symbolIndexTransformation + + s/\\((?:sub)*(?:section|chapter)(?:\*)?)(?:\[[^\]]*\])?\{(.*)\}/\u$1: $2/g; + + + + diff --git a/LaTeX/TeX Math.sublime-syntax b/LaTeX/TeX Math.sublime-syntax deleted file mode 100644 index dcc282b48c..0000000000 --- a/LaTeX/TeX Math.sublime-syntax +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.2 ---- -# http://www.sublimetext.com/docs/3/syntax.html -name: TeX Math -file_extensions: [] -scope: text.tex.math -contexts: - main: - - match: (\\)(s(s(earrow|warrow|lash)|h(ort(downarrow|uparrow|parallel|leftarrow|rightarrow|mid)|arp)|tar|i(gma|m(eq)?)|u(cc(sim|n(sim|approx)|curlyeq|eq|approx)?|pset(neq(q)?|plus(eq)?|eq(q)?)?|rd|m|bset(neq(q)?|plus(eq)?|eq(q)?)?)|p(hericalangle|adesuit)|e(tminus|arrow)|q(su(pset(eq)?|bset(eq)?)|c(up|ap)|uare)|warrow|m(ile|all(s(etminus|mile)|frown)))|h(slash|ook(leftarrow|rightarrow)|eartsuit|bar)|R(sh|ightarrow|e|bag)|Gam(e|ma)|n(s(hort(parallel|mid)|im|u(cc(eq)?|pseteq(q)?|bseteq))|Rightarrow|n(earrow|warrow)|cong|triangle(left(eq(slant)?)?|right(eq(slant)?)?)|i(plus)?|u|p(lus|arallel|rec(eq)?)|e(q|arrow|g|xists)|v(dash|Dash)|warrow|le(ss|q(slant|q)?|ft(arrow|rightarrow))|a(tural|bla)|VDash|rightarrow|g(tr|eq(slant|q)?)|mid|Left(arrow|rightarrow))|c(hi|irc(eq|le(d(circ|S|dash|ast)|arrow(left|right)))?|o(ng|prod|lon|mplement)|dot(s|p)?|u(p|r(vearrow(left|right)|ly(eq(succ|prec)|vee(downarrow|uparrow)?|wedge(downarrow|uparrow)?)))|enterdot|lubsuit|ap)|Xi|Maps(to(char)?|from(char)?)|B(ox|umpeq|bbk)|t(h(ick(sim|approx)|e(ta|refore))|imes|op|wohead(leftarrow|rightarrow)|a(u|lloblong)|riangle(down|q|left(eq(slant)?)?|right(eq(slant)?)?)?)|i(n(t(er(cal|leave))?|plus|fty)?|ota|math)|S(igma|u(pset|bset))|zeta|o(slash|times|int|dot|plus|vee|wedge|lessthan|greaterthan|m(inus|ega)|b(slash|long|ar))|d(i(v(ideontimes)?|a(g(down|up)|mond(suit)?)|gamma)|o(t(plus|eq(dot)?)|ublebarwedge|wn(harpoon(left|right)|downarrows|arrow))|d(ots|agger)|elta|a(sh(v|leftarrow|rightarrow)|leth|gger))|Y(down|up|left|right)|C(up|ap)|u(n(lhd|rhd)|p(silon|harpoon(left|right)|downarrow|uparrows|lus|arrow)|lcorner|rcorner)|jmath|Theta|Im|p(si|hi|i(tchfork)?|erp|ar(tial|allel)|r(ime|o(d|pto)|ec(sim|n(sim|approx)|curlyeq|eq|approx)?)|m)|e(t(h|a)|psilon|q(slant(less|gtr)|circ|uiv)|ll|xists|mptyset)|Omega|D(iamond|ownarrow|elta)|v(d(ots|ash)|ee(bar)?|Dash|ar(s(igma|u(psetneq(q)?|bsetneq(q)?))|nothing|curly(vee|wedge)|t(heta|imes|riangle(left|right)?)|o(slash|circle|times|dot|plus|vee|wedge|lessthan|ast|greaterthan|minus|b(slash|ar))|p(hi|i|ropto)|epsilon|kappa|rho|bigcirc))|kappa|Up(silon|downarrow|arrow)|Join|f(orall|lat|a(t(s(emi|lash)|bslash)|llingdotseq)|rown)|P(si|hi|i)|w(p|edge|r)|l(hd|n(sim|eq(q)?|approx)|ceil|times|ightning|o(ng(left(arrow|rightarrow)|rightarrow|maps(to|from))|zenge|oparrow(left|right))|dot(s|p)|e(ss(sim|dot|eq(qgtr|gtr)|approx|gtr)|q(slant|q)?|ft(slice|harpoon(down|up)|threetimes|leftarrows|arrow(t(ail|riangle))?|right(squigarrow|harpoons|arrow(s|triangle|eq)?))|adsto)|vertneqq|floor|l(c(orner|eil)|floor|l|bracket)?|a(ngle|mbda)|rcorner|bag)|a(s(ymp|t)|ngle|pprox(eq)?|l(pha|eph)|rrownot|malg)|V(dash|vdash)|r(h(o|d)|ceil|times|i(singdotseq|ght(s(quigarrow|lice)|harpoon(down|up)|threetimes|left(harpoons|arrows)|arrow(t(ail|riangle))?|rightarrows))|floor|angle|r(ceil|parenthesis|floor|bracket)|bag)|g(n(sim|eq(q)?|approx)|tr(sim|dot|eq(qless|less)|less|approx)|imel|eq(slant|q)?|vertneqq|amma|g(g)?)|Finv|xi|m(ho|i(nuso|d)|o(o|dels)|u(ltimap)?|p|e(asuredangle|rge)|aps(to|from(char)?))|b(i(n(dnasrepma|ampersand)|g(s(tar|qc(up|ap))|nplus|c(irc|u(p|rly(vee|wedge))|ap)|triangle(down|up)|interleave|o(times|dot|plus)|uplus|parallel|vee|wedge|box))|o(t|wtie|x(slash|circle|times|dot|plus|empty|ast|minus|b(slash|ox|ar)))|u(llet|mpeq)|e(cause|t(h|ween|a))|lack(square|triangle(down|left|right)?|lozenge)|a(ck(s(im(eq)?|lash)|prime|epsilon)|r(o|wedge))|bslash)|L(sh|ong(left(arrow|rightarrow)|rightarrow|maps(to|from))|eft(arrow|rightarrow)|leftarrow|ambda|bag)|Arrownot)\b - scope: constant.character.math.tex - captures: - 1: punctuation.definition.constant.math.tex - - match: (\\)(sum|prod|coprod|int|oint|bigcap|bigcup|bigsqcup|bigvee|bigwedge|bigodot|bigotimes|bogoplus|biguplus)\b - scope: constant.character.math.tex - captures: - 1: punctuation.definition.constant.math.tex - - match: (\\)(arccos|arcsin|arctan|arg|cos|cosh|cot|coth|csc|deg|det|dim|exp|gcd|hom|inf|ker|lg|lim|liminf|limsup|ln|log|max|min|pr|sec|sin|sinh|sup|tan|tanh)\b - scope: constant.other.math.tex - captures: - 1: punctuation.definition.constant.math.tex - - match: '((\\)Sexpr)(\{)' - captures: - 1: support.function.sexpr.math.tex - 2: punctuation.definition.function.math.tex - 3: punctuation.section.embedded.begin.math.tex - push: - - meta_scope: meta.function.sexpr.math.tex - - meta_content_scope: source.r.embedded.math.tex - - match: '(\})' - captures: - 1: punctuation.section.embedded.end.math.tex - pop: true - - include: scope:source.r - - match: '(\\)([^a-zA-Z]|[A-Za-z]+)(?=\b|\}|\]|\^|\_)' - scope: constant.other.general.math.tex - captures: - 1: punctuation.definition.constant.math.tex - - match: '(([0-9]*[\.][0-9]+)|[0-9]+)' - scope: constant.numeric.math.tex - - match: "«press a-z and space for greek letter»[a-zA-Z]*" - scope: meta.placeholder.greek.math.tex diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 7ced7ce42d..9bd604ca95 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -7,73 +7,178 @@ file_extensions: - cls scope: text.tex contexts: + prototype: + - include: comments + main: - - match: (\\)(backmatter|else|fi|frontmatter|ftrue|mainmatter|if(case|cat|dim|eof|false|hbox|hmode|inner|mmode|num|odd|undefined|vbox|vmode|void|x)?)\b - scope: keyword.control.tex - captures: - 1: punctuation.definition.keyword.tex - - match: ((\\)catcode)`(?:\\)?.(=)(\d+) - scope: meta.catcode.tex + - include: macros + - include: controls + - include: catcode + - include: braces + - include: boxes + - include: block-math + - include: inline-math + - include: constants + - include: general-commands + + general-commands: + - match: '(\\)[A-Za-z@]+' + scope: support.function.general.tex captures: - 1: keyword.control.catcode.tex - 2: punctuation.definition.keyword.tex - 3: punctuation.separator.key-value.tex - 4: constant.numeric.category.tex - - match: (%:).*$\n? - scope: comment.line.percentage.semicolon.texshop.tex + 1: punctuation.definition.backslash.function.tex + + constants: + - match: \\\\ + scope: constant.character.newline.tex + - match: '(\\)[^a-zA-Z@]' + scope: constant.character.escape.tex captures: - 1: punctuation.definition.comment.tex - - match: ^%!TEX (\S*) =\s*(.*)\s*$ - scope: comment.line.percentage.directive.texshop.tex - - match: (%).*$\n? + 1: punctuation.definition.keyword.tex + - match: '&' + scope: constant.character.ampersand.latex + + comments: + - match: '%.*$\n?' scope: comment.line.percentage.tex + + controls: + - match: ((\\)(else|fi|ftrue|if(case|cat|dim|eof|false|hbox|hmode|inner|mmode|num|odd|undefined|vbox|vmode|void|x)?))\b captures: - 1: punctuation.definition.comment.tex - - match: '\{' + 1: keyword.control.tex + 2: punctuation.definition.backslash.function.tex + + catcode: + - match: ((\\)catcode)`(?:\\)?.=(\d+) + scope: meta.function.catcode.tex captures: - 0: punctuation.section.group.tex + 1: keyword.control.catcode.tex + 2: punctuation.definition.backslash.function.tex + 3: constant.numeric.category.tex + + braces: + - match: '\{' + scope: punctuation.definition.brace.begin.tex push: - meta_scope: meta.group.braces.tex - match: '\}' - captures: - 0: punctuation.section.group.tex + scope: punctuation.definition.brace.end.tex pop: true - - include: $top_level_main - - match: '[\[\]]' - scope: punctuation.definition.brackets.tex - - match: \$\$ + - include: main + + command-only-braces: + - match: '\{' + scope: punctuation.definition.brace.begin.tex + push: + - meta_scope: meta.group.braces.tex + - match: '\}' + scope: punctuation.definition.brace.end.tex + pop: true + - include: constants + - include: general-commands + - include: command-only-braces + + boxes: + - match: '((\\)[hv]box)\s*(\{)' captures: - 0: punctuation.definition.string.begin.tex + 1: support.function.box.tex + 2: punctuation.definition.backslash.function.tex + 3: punctuation.definition.brace.begin.tex push: - - meta_scope: string.other.math.block.tex - - match: \$\$ - captures: - 0: punctuation.definition.string.end.tex + - meta_scope: meta.function.box.tex + - match: '\}' + scope: punctuation.definition.brace.end.tex pop: true - - include: scope:text.tex.math - include: main - - match: \\\\ - scope: constant.character.newline.tex - - match: \$ + + macros: + - match: '(\\def)\s*((\\)[a-zA-Z@]+)\s*[^\{]*?\s*(\{)' captures: - 0: punctuation.definition.string.begin.tex + 1: support.function.definition.tex + 2: support.function.general.definition.tex + 3: punctuation.definition.backslash.function.tex + 4: punctuation.definition.brace.begin.definition.tex push: - - meta_scope: string.other.math.tex - - match: \$ - captures: - 0: punctuation.definition.string.end.tex + - meta_scope: meta.function.definition.tex + - match: '\}' + scope: punctuation.definition.brace.end.definition.tex pop: true - - match: \\\$ - scope: constant.character.escape.tex - - include: scope:text.tex.math - - include: main - - match: '(\\)[A-Za-z@]+' - scope: support.function.general.tex + - include: constants + - include: general-commands + - include: command-only-braces + + greeks: + - match: ((\\)(alpha|beta|gamma|delta|epsilon|varepsilon|zeta|eta|theta|vartheta|gamma|kappa|lambda|mu|nu|xi|pi|varpi|rho|varrho|sigma|varsigma|tau|upsilon|phi|varphi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega))\b captures: - 1: punctuation.definition.function.tex - - match: '(\\)[^a-zA-Z@]' - scope: constant.character.escape.tex + 1: keyword.other.greek.math.tex + 2: punctuation.definition.backslash.function.tex + + math-commands: + - match: '((\\)[a-zA-Z@]+)' captures: - 1: punctuation.definition.keyword.tex - - match: "«press a-z and space for greek letter»[a-zA-Z]*" - scope: meta.placeholder.greek.tex + 1: support.function.math.tex + 2: punctuation.definition.backslash.function.tex + + math-operators: + - match: \+|\-|=|-|\*|/|\^|_|<|> + scope: keyword.operator.math.tex + + math-braces: + - match: '\{' + scope: punctuation.definition.brace.begin.math.tex + push: + - meta_scope: meta.group.braces.math.tex + - match: '\}' + scope: punctuation.definition.brace.end.math.tex + pop: true + - include: math-content + + math-brackets: + - match: '[\(\)\[\]]' + scope: punctuation.definition.bracket.math.tex + - match: '(\\)[\(\)\[\]{}]' + scope: punctuation.definition.bracket.escape.math.tex + captures: + 1: punctuation.definition.backslash.bracket.escape.math.tex + + math-constants: + - match: '(([0-9]*[\.][0-9]+)|[0-9]+)' + scope: constant.numeric.math.tex + - match: '(\\)([^a-zA-Z]|[A-Za-z]+)(?=\b|\}|\]|\^|\_)' + scope: constant.other.general.math.tex + captures: + 1: punctuation.definition.backslash.constant.math.tex + + math-characters: + - match: "[a-zA-Z]+" + scope: variable.other.math.tex + + math-content: + - include: greeks + - include: math-brackets + - include: math-braces + - include: boxes + - include: math-commands + - include: math-operators + - include: math-characters + - include: math-constants + - include: constants + + inline-math: + - match: \$ + scope: string.other.math.tex punctuation.definition.string.begin.tex + push: + - meta_scope: meta.environment.math.tex + - match: \$ + scope: string.other.math.tex punctuation.definition.string.end.tex + pop: true + - include: math-content + + block-math: + - match: \$\$ + scope: string.other.math.tex punctuation.definition.string.begin.tex + push: + - meta_scope: meta.environment.math.tex + - match: \$\$ + scope: string.other.math.tex punctuation.definition.string.end.tex + pop: true + - include: math-content From e66e87c366d262ae1e571e00d9fdf56763e6e2a6 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Wed, 11 May 2016 00:14:23 -0400 Subject: [PATCH 02/56] [R] fix rd syntax, use new LaTeX syntax --- R/Rd (R Documentation).sublime-syntax | 151 +++++++++++++++++++------- 1 file changed, 113 insertions(+), 38 deletions(-) diff --git a/R/Rd (R Documentation).sublime-syntax b/R/Rd (R Documentation).sublime-syntax index 84762c8dc8..a711db079f 100644 --- a/R/Rd (R Documentation).sublime-syntax +++ b/R/Rd (R Documentation).sublime-syntax @@ -6,66 +6,141 @@ file_extensions: - rd scope: text.tex.latex.rd contexts: + prototype: + - include: comments + main: - - match: '((\\)(?:alias|docType|keyword|name|title))(\{)' - captures: - 1: keyword.other.section.rd - 2: punctuation.definition.function.rd - 3: punctuation.definition.arguments.begin.rd + - include: stucture + - include: r-code + - include: equations + # exteneded from latex + - include: scope:text.tex.latex#invalid-quotations + - include: scope:text.tex.latex#macros + - include: global-braces + - include: scope:text.tex.latex#general-constants + - include: scope:text.tex.latex#general-commands + + comments: + - include: scope:text.tex#comments + + global-braces: + - match: '\{' + scope: punctuation.definition.brace.begin.latex push: - - meta_scope: meta.section.rd - - meta_content_scope: entity.name.tag.rd - - match: '(\})' - captures: - 1: punctuation.definition.arguments.end.rd + - meta_scope: meta.group.braces.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex pop: true - include: main - - match: '((\\)(?:details|format|references|source))(\{)' + + equations: + - include: deqn + - include: eqn + + deqn: + - match: '((\\)(?:deqn))(\{)' captures: - 1: keyword.other.section.rd - 2: punctuation.definition.function.rd - 3: punctuation.definition.arguments.begin.rd + 1: support.function.deqn.rd + 2: punctuation.definition.backslash.rd + 3: punctuation.definition.brace.begin.rd push: - - meta_scope: meta.section.rd - - match: '(\})' - captures: - 1: punctuation.definition.arguments.end.rd + - meta_scope: meta.function.deqn.rd + - meta_content_scope: meta.environment.math.latex + - include: scope:text.tex.latex#math-content + - match: '\}' + scope: punctuation.definition.brace.end.rd pop: true - - include: main + + eqn: + - match: '((\\)(?:eqn))(\{)' + captures: + 1: support.function.eqn.rd + 2: punctuation.definition.backslash.rd + 3: punctuation.definition.brace.begin.rd + push: + - meta_scope: meta.function.eqn.rd + - meta_content_scope: meta.environment.math.latex + - include: scope:text.tex.latex#math-content + - match: '\}' + scope: punctuation.definition.brace.end.rd + pop: true + + r-code: + - match: '((\\)(?:code))(\{)' + captures: + 1: support.function.code.rd + 2: punctuation.definition.backslash.rd + 3: punctuation.definition.brace.begin.rd + push: + - meta_scope: meta.function.code.rd + - meta_content_scope: source.r.embedded + - match: '\}' + scope: punctuation.definition.brace.end.rd + pop: true + - include: scope:source.r + - match: '((\\)(?:Sexpr))(?:(\[)(?:[^\]]*)(\]))?(\{)' + captures: + 1: support.function.sexpr.rd + 2: punctuation.definition.backslash.rd + 3: punctuation.definition.bracket.begin.rd + 4: punctuation.definition.bracket.end.rd + 5: punctuation.definition.brace.begin.rd + push: + - meta_scope: meta.function.sexpr.rd + - meta_content_scope: source.r.embedded + - match: '\}' + scope: punctuation.definition.brace.end.rd + pop: true + - include: scope:source.r - match: '((\\)(?:usage))(\{)(?:\n)?' captures: - 1: keyword.other.usage.rd - 2: punctuation.definition.function.rd - 3: punctuation.definition.arguments.begin.rd + 1: support.function.usage.rd + 2: punctuation.definition.backslash.rd + 3: punctuation.definition.brace.begin.rd push: - - meta_scope: meta.usage.rd + - meta_scope: meta.function.usage.rd - meta_content_scope: source.r.embedded - - match: '(\})' - captures: - 1: punctuation.definition.arguments.end.rd + - match: '\}' + scope: punctuation.definition.brace.end.rd pop: true - include: scope:source.r - match: '((\\)(?:examples))(\{)(?:\n)?' captures: - 1: keyword.other.examples.rd + 1: support.function.examples.rd + 2: punctuation.definition.backslash.rd + 3: punctuation.definition.brace.begin.rd + push: + - meta_scope: meta.function.examples.rd + - meta_content_scope: source.r.embedded + - match: '\}' + scope: punctuation.definition.brace.end.rd + pop: true + - include: scope:source.r + + stucture: + - match: '((\\)name)(\{)' + captures: + 1: keyword.other.section.rd 2: punctuation.definition.function.rd 3: punctuation.definition.arguments.begin.rd push: - - meta_scope: meta.examples.rd - - meta_content_scope: source.r.embedded + - meta_scope: meta.section.rd + - meta_content_scope: entity.name.function.rd - match: '(\})' captures: 1: punctuation.definition.arguments.end.rd pop: true - - include: scope:source.r - - match: '((\\)(?:author))(\{)([\w\s]+?)\s+(<)([^>]*)(>)' - scope: meta.author.rd + - include: main + + - match: '((\\)(?:alias|docType|keyword|title))(\{)' captures: - 1: keyword.other.author.rd + 1: keyword.other.section.rd 2: punctuation.definition.function.rd 3: punctuation.definition.arguments.begin.rd - 4: entity.name.tag.author.rd - 5: punctuation.definition.link.rd - 6: markup.underline.link.rd - 7: punctuation.definition.link.rd - - include: scope:text.tex.latex + push: + - meta_scope: meta.section.rd + - match: '(\})' + captures: + 1: punctuation.definition.arguments.end.rd + pop: true + - include: main From bd3b91e3d11a69b2b428877d64e4ad2379e5261d Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Wed, 11 May 2016 00:53:42 -0400 Subject: [PATCH 03/56] [LaTeX] some improvements --- LaTeX/LaTeX.sublime-syntax | 124 ++++++++++++++++++++++--------------- LaTeX/TeX.sublime-syntax | 21 ++++--- 2 files changed, 87 insertions(+), 58 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index d8dff7148e..08c6f662a5 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -5,7 +5,6 @@ name: LaTeX file_extensions: - tex - ltx -first_line_match: '^\\documentclass(?!.*\{beamer\})' scope: text.tex.latex contexts: prototype: @@ -20,12 +19,13 @@ contexts: - include: text-decorators - include: references - include: verbatim + - include: verb - include: url - include: invalid-quotations - include: lists # external packages - - include: external-packages + - include: packages # extended from tex - include: macros @@ -61,7 +61,7 @@ contexts: (\{) captures: 1: support.function.newcommand.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: support.function.latex 5: punctuation.definition.brace.end.latex @@ -114,7 +114,7 @@ contexts: - match: '((\\)[mf]box)\s*(\{)' captures: 1: support.function.box.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.box.latex @@ -125,7 +125,7 @@ contexts: - match: '((\\)(?:framebox|makebox))(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' captures: 1: support.function.box.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.optional.begin.latex 4: punctuation.definition.brace.optional.end.latex 5: punctuation.definition.brace.optional.begin.latex @@ -140,7 +140,7 @@ contexts: - match: '((\\)parbox)(?:(\[)[^\]]*?(\]))?(\{)[^\}]*?(\})(\{)' captures: 1: support.function.box.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.optional.begin.latex 4: punctuation.definition.brace.optional.end.latex 5: punctuation.definition.brace.begin.latex @@ -155,7 +155,7 @@ contexts: - match: '((\\)raisebox)(\{)[^\}]*?(\})(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' captures: 1: support.function.box.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: punctuation.definition.brace.end.latex 5: punctuation.definition.brace.optional.begin.latex @@ -184,7 +184,7 @@ contexts: - match: '((\\)(?:documentclass|usepackage))\s*(?:(\[)(?:[^\]]*)(\]))?(\{)' captures: 1: keyword.control.preamble.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.bracket.begin.latex 4: punctuation.definition.bracket.end.latex 5: punctuation.definition.brace.begin.latex @@ -199,7 +199,7 @@ contexts: scope: meta.function.include.latex captures: 1: keyword.control.include.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.include.latex @@ -226,13 +226,13 @@ contexts: (\{) captures: 1: support.function.section.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: entity.name.section.latex 5: punctuation.definition.brace.end.latex 6: punctuation.definition.brace.begin.latex push: - - meta_scope: meta.function.section.latex + - meta_scope: meta.section.latex - meta_content_scope: entity.name.section.latex - match: '\}' scope: punctuation.definition.brace.end.latex @@ -243,24 +243,24 @@ contexts: - match: ((\\)(?:frontmatter|mainmatter|backmatter|appendix|printindex))\b captures: 1: keyword.control.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex verbatim: - match: '((\\)begin)(\{)\s*((?:[vV]erbatim|alltt)\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex push: - meta_include_prototype: false - - meta_scope: meta.function.verbatim.latex + - meta_scope: meta.environment.verbatim.latex - meta_content_scope: markup.raw.verbatim.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -270,7 +270,7 @@ contexts: - match: '((\\)begin)(\{)\s*(itemize\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -279,7 +279,7 @@ contexts: - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -288,7 +288,7 @@ contexts: - match: '((\\)begin)(\{)\s*(enumerate\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -297,7 +297,7 @@ contexts: - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -306,7 +306,7 @@ contexts: - match: '((\\)begin)(\{)\s*(list\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -315,7 +315,7 @@ contexts: - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -324,7 +324,7 @@ contexts: - match: '((\\)begin)(\{)\s*(description\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -333,7 +333,7 @@ contexts: - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -376,6 +376,18 @@ contexts: scope: string.other.math.latex punctuation.definition.string.end.latex pop: true - include: math-content + - match: '((\\)ensuremath)(\{)' + captures: + 1: support.function.ensuremath.latex + 2: punctuation.definition.backslash.latex + 3: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.function.ensuremath.latex + - meta_content_scope: meta.environment.math.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: math-content block-math: - match: \$\$ @@ -410,7 +422,7 @@ contexts: - match: '((\\)begin)(\{)\s*((?:align|alignat|aligned|alignedat|displaymath|displaymath|eqnarray|equation|flalign|gather|gathered|math|multline|xalignat)\*?)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -419,7 +431,7 @@ contexts: - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -431,7 +443,7 @@ contexts: scope: meta.function.link.url.latex captures: 1: support.function.url.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: markup.underline.link.latex 5: punctuation.definition.brace.end.latex @@ -447,7 +459,7 @@ contexts: scope: meta.function.verbatim.latex captures: 1: support.function.verb.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.verb.latex 4: markup.raw.verb.latex 5: punctuation.definition.verb.latex @@ -456,7 +468,7 @@ contexts: - match: '((\\)emph)(\{)' captures: 1: support.function.emph.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.emph.latex @@ -468,7 +480,7 @@ contexts: - match: '((\\)textit)(\{)' captures: 1: support.function.textit.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.textit.latex @@ -480,7 +492,7 @@ contexts: - match: '((\\)textbf)(\{)' captures: 1: support.function.textbf.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.textbf.latex @@ -492,7 +504,7 @@ contexts: - match: '((\\)texttt)(\{)' captures: 1: support.function.texttt.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.texttt.latex @@ -501,10 +513,22 @@ contexts: scope: punctuation.definition.brace.end.latex pop: true - include: main - - match: '((\\)(?:(?:\w+)?text(?:\w+)?|[mhf]box))(\{)' + - match: '((\\)textsl)(\{)' + captures: + 1: support.function.textsl.latex + 2: punctuation.definition.backslash.latex + 3: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.function.textsl.latex + - meta_content_scope: markup.italic.textsl.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + - match: '((\\)text)(\{)' captures: 1: support.function.text.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex push: - match: '\}' @@ -516,7 +540,7 @@ contexts: - match: '((\\)[Cc]ite\w*\*?)(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' captures: 1: support.function.cite.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.optional.begin.latex 4: punctuation.definition.brace.optional.end.latex 5: punctuation.definition.brace.optional.begin.latex @@ -528,10 +552,10 @@ contexts: scope: punctuation.definition.brace.end.latex pop: true - include: main - - match: '((\\)\w*[Rr]ef\*?)(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' + - match: '((\\)(?:eq|page)?ref\*?)(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' captures: - 1: support.function.ref.latex - 2: punctuation.definition.backslash.function.latex + 1: support.function.reference.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.optional.begin.latex 4: punctuation.definition.brace.optional.end.latex 5: punctuation.definition.brace.optional.begin.latex @@ -546,7 +570,7 @@ contexts: - match: '((\\)label)(\{)' captures: 1: support.function.label.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.label.latex @@ -558,20 +582,20 @@ contexts: - match: '((\\)begin)(\{)\s*(\w*)\*?\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex - match: '((\\)end)(\{)\s*(\w*)\*?\s*(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex # external packages supports - external-packages: + packages: - include: 1stlisting - include: beamer @@ -580,7 +604,7 @@ contexts: - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Java)\n?)' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -593,7 +617,7 @@ contexts: - match: '((\\)end)(\{)(lstlisting)(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -602,7 +626,7 @@ contexts: - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Python)\n?)' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -615,7 +639,7 @@ contexts: - match: '((\\)end)(\{)(lstlisting)(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -624,7 +648,7 @@ contexts: - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%.*\n?)?' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -637,7 +661,7 @@ contexts: - match: '((\\)end)(\{)(lstlisting)(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.backslash.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -648,7 +672,7 @@ contexts: - match: '(?:\s*)((\\)begin)(\{)(frame)(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -657,7 +681,7 @@ contexts: - match: '((\\)end)(\{)(frame)(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex @@ -670,7 +694,7 @@ contexts: scope: meta.function.frametitle.latex captures: 1: support.function.frametitle.latex - 2: punctuation.definition.function.latex + 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: entity.name.function.frame.latex 5: punctuation.definition.brace.end.latex diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 9bd604ca95..bb2f5ab9d8 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -25,7 +25,7 @@ contexts: - match: '(\\)[A-Za-z@]+' scope: support.function.general.tex captures: - 1: punctuation.definition.backslash.function.tex + 1: punctuation.definition.backslash.tex constants: - match: \\\\ @@ -35,7 +35,7 @@ contexts: captures: 1: punctuation.definition.keyword.tex - match: '&' - scope: constant.character.ampersand.latex + scope: constant.character.ampersand.tex comments: - match: '%.*$\n?' @@ -45,14 +45,19 @@ contexts: - match: ((\\)(else|fi|ftrue|if(case|cat|dim|eof|false|hbox|hmode|inner|mmode|num|odd|undefined|vbox|vmode|void|x)?))\b captures: 1: keyword.control.tex - 2: punctuation.definition.backslash.function.tex + 2: punctuation.definition.backslash.tex + - match: '((\\)(?:input))' + scope: meta.function.input.tex + captures: + 1: keyword.control.input.tex + 2: punctuation.definition.backslash.tex catcode: - match: ((\\)catcode)`(?:\\)?.=(\d+) scope: meta.function.catcode.tex captures: 1: keyword.control.catcode.tex - 2: punctuation.definition.backslash.function.tex + 2: punctuation.definition.backslash.tex 3: constant.numeric.category.tex braces: @@ -81,7 +86,7 @@ contexts: - match: '((\\)[hv]box)\s*(\{)' captures: 1: support.function.box.tex - 2: punctuation.definition.backslash.function.tex + 2: punctuation.definition.backslash.tex 3: punctuation.definition.brace.begin.tex push: - meta_scope: meta.function.box.tex @@ -95,7 +100,7 @@ contexts: captures: 1: support.function.definition.tex 2: support.function.general.definition.tex - 3: punctuation.definition.backslash.function.tex + 3: punctuation.definition.backslash.tex 4: punctuation.definition.brace.begin.definition.tex push: - meta_scope: meta.function.definition.tex @@ -110,13 +115,13 @@ contexts: - match: ((\\)(alpha|beta|gamma|delta|epsilon|varepsilon|zeta|eta|theta|vartheta|gamma|kappa|lambda|mu|nu|xi|pi|varpi|rho|varrho|sigma|varsigma|tau|upsilon|phi|varphi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega))\b captures: 1: keyword.other.greek.math.tex - 2: punctuation.definition.backslash.function.tex + 2: punctuation.definition.backslash.tex math-commands: - match: '((\\)[a-zA-Z@]+)' captures: 1: support.function.math.tex - 2: punctuation.definition.backslash.function.tex + 2: punctuation.definition.backslash.tex math-operators: - match: \+|\-|=|-|\*|/|\^|_|<|> From d15caa11359c1866d375481b79b11c36d748e692 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Wed, 11 May 2016 12:26:22 +0200 Subject: [PATCH 04/56] [LaTeX] Tests initial import --- LaTeX/syntax_test_latex.tex | 106 ++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 LaTeX/syntax_test_latex.tex diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex new file mode 100644 index 0000000000..114b62622b --- /dev/null +++ b/LaTeX/syntax_test_latex.tex @@ -0,0 +1,106 @@ +% SYNTAX TEST "Packages/LaTeX/LaTeX.sublime-syntax" + +% <- text.tex.latex + +\documentclass[12pt]{article} +% ^ keyword.control.preamble.latex +% ^ variable.parameter.latex +% ^ support.class.latex + +\usepackage[args]{mypackage} +% ^ keyword.control.preamble.latex +% ^ variable.parameter.latex +% ^ support.class.latex + +% line comment +% <- comment.line.percentage.tex + +\begin{document} +% ^ support.function.be.latex +% ^ variable.parameter.function.latex + +% SECTION COMMANDS + +\part{name} +% <- meta.section.latex +% ^ support.function.section.latex +% ^ entity.name.section.latex +\chapter{name} +% <- meta.section.latex +% ^ support.function.section.latex +% ^ entity.name.section.latex +\section{name} +% <- meta.section.latex +% ^ support.function.section.latex +% ^ entity.name.section.latex +\subsection{name} +% <- meta.section.latex +% ^ support.function.section.latex +% ^ entity.name.section.latex +\subsubsection{name} +% <- meta.section.latex +% ^ support.function.section.latex +% ^ entity.name.section.latex +\paragraph{name} +% <- meta.section.latex +% ^ support.function.section.latex +% ^ entity.name.section.latex +\subparagraph{name} +% <- meta.section.latex +% ^ support.function.section.latex +% ^ entity.name.section.latex + + +% MARKUP COMMANDS + +\emph{text} +% ^ markup.italic.emph.latex +\textbf{text} +% ^ markup.bold.textbf.latex +\textit{text} +% ^ markup.italic.textit.latex +\texttt{text} +% ^ markup.raw.texttt.latex +\textsl{text} +% ^ markup.italic.textsl.latex +\textbf{\textit{text}} +% ^ markup.bold.textbf.latex markup.italic.textit.latex +\textit{\textbf{text}} +% ^ markup.italic.textit.latex markup.bold.textbf.latex +\underline{text} +% ^ markup.underline.underline.latex + + +% VERBATIM + +\command{} +% ^ support.function.general.latex +\verb{\command{}} +% ^ markup.raw.verb.latex +% ^ meta.environment.verbatim.latex +% ^ - support.function.general.latex +\verb|\command{}| +% ^ markup.raw.verb.latex +% ^ meta.environment.verbatim.latex +% ^ - support.function.general.latex +\verb+\command{}+ +% ^ markup.raw.verb.latex +% ^ meta.environment.verbatim.latex +% ^ - support.function.general.latex + +\begin{verbatim} +% ^ support.function.be.latex +% ^ variable.parameter.function.latex +The \emph{verbatim} environment sets everything in verbatim. +% <- meta.environment.verbatim.latex +% ^ markup.raw.verbatim.latex +% ^ - markup.italic.emph.latex +\command{} +% ^ - support.function.general.latex +% This is not a comment +% <- - comment.line.percentage.tex +\end{verbatim} + +\end{document} +% ^ support.function.be.latex +% ^ variable.parameter.function.latex From 7d278689900d29bbb9339482b8617ee15508cb3d Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Wed, 11 May 2016 12:36:26 +0200 Subject: [PATCH 05/56] [LaTeX] Tests for commands inside arguments --- LaTeX/syntax_test_latex.tex | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 114b62622b..92d54a2894 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -101,6 +101,17 @@ \subsubsection{name} % <- - comment.line.percentage.tex \end{verbatim} + +% COMMANDS INSIDE ARGUMENTS + +\makebox[\linewidth]{...} +% ^ support.function.box.latex +% ^ support.function.general.latex + +\includegraphics[width=0.33\textwidth, angle=30]{test.png} +% ^ support.function.general.latex +% ^ support.function.general.latex + \end{document} % ^ support.function.be.latex % ^ variable.parameter.function.latex From c1ff87caf07ceb86398b9505c0432be02e282fd0 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Wed, 11 May 2016 12:37:29 +0200 Subject: [PATCH 06/56] [LaTeX] Test support for package `comment` --- LaTeX/syntax_test_latex.tex | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 92d54a2894..b0f197ff1b 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -112,6 +112,33 @@ \subsubsection{name} % ^ support.function.general.latex % ^ support.function.general.latex + +% PACKAGE: comment +% The comment package can be used to write block comment +% using an environment. + +\begin{comment} +% ^ support.function.be.latex +% ^ variable.parameter.function.latex +This environment can be used to write +% <- comment.block.environment.comment.latex +block comments. +% <- comment.block.environment.comment.latex +\end{comment} + + +\comment +% <- comment.block.command.comment.latex +% ^ punctuation.definition.comment.start.latex +This block comment can be done with +% <- comment.block.command.comment.latex +opening and closing commands. +% <- comment.block.command.comment.latex +\endcomment +% <- comment.block.command.comment.latex +% ^ punctuation.definition.comment.end.latex + + \end{document} % ^ support.function.be.latex % ^ variable.parameter.function.latex From 31fb48a45e6336c4277ece8e926fd7e96f8bfff1 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Wed, 11 May 2016 13:08:54 +0200 Subject: [PATCH 07/56] [LaTeX] Test support for packages `listings` --- LaTeX/syntax_test_latex.tex | 45 +++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index b0f197ff1b..ab4903843c 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -77,22 +77,22 @@ \subsubsection{name} % ^ support.function.general.latex \verb{\command{}} % ^ markup.raw.verb.latex -% ^ meta.environment.verbatim.latex +% ^ meta.environment.verbatim.verbatim.latex % ^ - support.function.general.latex \verb|\command{}| % ^ markup.raw.verb.latex -% ^ meta.environment.verbatim.latex +% ^ meta.environment.verbatim.verbatim.latex % ^ - support.function.general.latex \verb+\command{}+ % ^ markup.raw.verb.latex -% ^ meta.environment.verbatim.latex +% ^ meta.environment.verbatim.verbatim.latex % ^ - support.function.general.latex \begin{verbatim} % ^ support.function.be.latex % ^ variable.parameter.function.latex The \emph{verbatim} environment sets everything in verbatim. -% <- meta.environment.verbatim.latex +% <- meta.environment.verbatim.verbatim.latex % ^ markup.raw.verbatim.latex % ^ - markup.italic.emph.latex \command{} @@ -139,6 +139,43 @@ \subsubsection{name} % ^ punctuation.definition.comment.end.latex +% PACKAGE: listings +% The listings package is used to highlight source code. +% supported languages: +% - python +% - java + +\begin{lstlisting} % Python + +def my_function(): + pass +% <- meta.environment.verbatim.lstlisting.latex +% <- meta.environment.embedded.python.latex +% <- source.python.embedded +% ^ keyword.control.flow.python +\end{lstlisting} + +\begin{lstlisting}[frame=single, + language=python] +def my_function(): + pass +% <- meta.environment.verbatim.lstlisting.latex +% <- meta.environment.embedded.python.latex +% <- source.python.embedded +% ^ keyword.control.flow.python +\end{lstlisting} + +\begin{lstlisting} % Java + +class MyClass() { +% <- meta.environment.verbatim.lstlisting.latex +% <- meta.environment.embedded.java.latex +% <- source.java.embedded +% ^ storage.modifier.java +} +\end{lstlisting} + + \end{document} % ^ support.function.be.latex % ^ variable.parameter.function.latex From a79e9671ac0c73220fd18898e619b3bfabb4169e Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Wed, 11 May 2016 13:12:41 +0200 Subject: [PATCH 08/56] [LaTeX] Test support for packages `minted` --- LaTeX/syntax_test_latex.tex | 39 ++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index ab4903843c..f0803d3bd9 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -141,7 +141,7 @@ \subsubsection{name} % PACKAGE: listings % The listings package is used to highlight source code. -% supported languages: +% Supported languages: % - python % - java @@ -176,6 +176,43 @@ \subsubsection{name} \end{lstlisting} +% PACKAGE: minted +% The minted package is used to highlight source code using +% the Pygments library. + +\begin{minted}[linenos=true]{python} +def my_function(): + pass +% <- meta.environment.verbatim.minted.latex +% <- meta.function.embedded.python.latex +% <- source.python.embedded +% ^ keyword.control.flow.python +\end{minted} + + +\mint{python}{import this} +% ^ meta.environment.verbatim.minted.latex +% ^ meta.function.embedded.python.latex +% ^ source.python.embedded +% ^ keyword.control.import.python + +% instead of embedding the code into { and } it is also possible +% to use an arbitrary character +\mint{python}|import this| +% ^ meta.environment.verbatim.minted.latex +% ^ source.python.embedded + + +\mintinline {python}{print(x ** 2)} +% ^ meta.environment.verbatim.minted.latex +% ^ meta.function.embedded.python.latex +% ^ source.python.embedded +% ^ keyword.other.python + +\mintinline {python}+print(x ** 2)+ +% ^ source.python.embedded + + \end{document} % ^ support.function.be.latex % ^ variable.parameter.function.latex From 7b4c6756bddba9e99997ce80410798856f41dc60 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Wed, 11 May 2016 13:16:32 +0200 Subject: [PATCH 09/56] [LaTeX] Tests for latex math support - All math environments should share the same scope --- LaTeX/syntax_test_latex.tex | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index f0803d3bd9..2423e0df69 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -113,6 +113,28 @@ \subsubsection{name} % ^ support.function.general.latex +% MATH + +% Check we have always a shared environment + +$f(x) = x^2$ +% ^ meta.environment.math.latex +$$f(x) = x^2$$ +% ^ meta.environment.math.latex +\(f(x) = x^2\) +% ^ meta.environment.math.latex +\[ + f(x) = x^2 +% ^ meta.environment.math.latex +\] +\ensuremath{f(x) = x^2} +% ^ meta.environment.math.latex +\begin{equation} +f(x) = x^2 +% ^ meta.environment.math.latex +\end{equation} + + % PACKAGE: comment % The comment package can be used to write block comment % using an environment. From 045e6795aa9a3bf1bb3146cc20345dcddf81b899 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Wed, 11 May 2016 14:53:32 +0200 Subject: [PATCH 10/56] [LaTeX] Fix section symbols list - Fix the scope selector for the section symbol list - add paragraph and part to the symbol transformation --- LaTeX/Symbol List - Sections.tmPreferences | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LaTeX/Symbol List - Sections.tmPreferences b/LaTeX/Symbol List - Sections.tmPreferences index 3fbc3948de..dcb4512121 100644 --- a/LaTeX/Symbol List - Sections.tmPreferences +++ b/LaTeX/Symbol List - Sections.tmPreferences @@ -4,7 +4,7 @@ name Symbol List scope - meta.function.section.latex + meta.section.latex settings showInSymbolList @@ -13,12 +13,12 @@ 1 symbolTransformation - s/\\((?:sub)*(?:section|chapter)(?:\*)?)(?:\[[^\]]*\])?\{(.*)\}/\u$1: $2/g; + s/\\((?:sub)*(?:paragraph|section|chapter|part)(?:\*)?)(?:\[[^\]]*\])?\{(.*)\}/\u$1: $2/g; symbolIndexTransformation - s/\\((?:sub)*(?:section|chapter)(?:\*)?)(?:\[[^\]]*\])?\{(.*)\}/\u$1: $2/g; - + s/\\((?:sub)*(?:paragraph|section|chapter|part)(?:\*)?)(?:\[[^\]]*\])?\{(.*)\}/\u$1: $2/g; + From 2bcbc5bbe10fc1888096cc698dd4a58b02f3af8e Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Thu, 12 May 2016 14:17:08 -0400 Subject: [PATCH 11/56] [LaTeX] Update the way of detecting arguments --- LaTeX/LaTeX.sublime-syntax | 246 ++++++++++++++++++++++--------------- LaTeX/TeX.sublime-syntax | 40 +++--- 2 files changed, 165 insertions(+), 121 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 08c6f662a5..707f8b5f3a 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -29,13 +29,13 @@ contexts: # extended from tex - include: macros - - include: controls - - include: catcode - - include: braces + - include: scope:text.tex#controls + - include: scope:text.tex#catcode + - include: global-braces - include: boxes - include: block-math - include: inline-math - - include: constants + - include: general-constants # unique to latex - include: begin-end-commands @@ -45,6 +45,115 @@ contexts: comments: - include: scope:text.tex#comments + global-braces: + - match: '\{' + scope: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.group.braces.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + + # these are used to identify arguments in commands + general-optional-arguments: + - match: '\[' + scope: punctuation.definition.bracket.begin.latex + push: + - meta_scope: meta.group.argument.optional.latex + - match: '\]' + scope: punctuation.definition.bracket.end.latex + pop: true + - include: general-constants + - include: general-commands + + _general-1-more-argument: + - match: '(\})(\{)' + captures: + 1: punctuation.definition.brace.end.latex + 2: punctuation.definition.brace.begin.latex + set: + - match: '(?<=\{)' + push: + - meta_scope: meta.group.argument.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + - match: '(?<=\})' + pop: true + + _general-2-more-arguments: + - match: '(\})(\{)' + captures: + 1: punctuation.definition.brace.end.latex + 2: punctuation.definition.brace.begin.latex + set: + - match: '(?<=\{)' + push: + - meta_scope: meta.group.argument.latex + - include: _general-1-more-argument + - include: main + - match: '(?<=\})' + pop: true + + general-1-argument: + - match: '(?<=\})' + pop: true + - match: '\{' + scope: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.group.argument.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + + general-2-arguments: + - match: '(?<=\})' + pop: true + - match: '\{' + scope: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.group.argument.latex + - include: _general-1-more-argument + - include: main + + general-3-arguments: + - match: '(?<=\})' + pop: true + - match: '\{' + scope: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.group.argument.latex + - include: _general-2-more-arguments + - include: main + + general-1-argument-with-options: + - include: general-optional-arguments + - include: general-1-argument + + general-2-arguments-with-options: + - include: general-optional-arguments + - include: general-2-arguments + + general-3-arguments-with-options: + - include: general-optional-arguments + - include: general-3-arguments + + # used in macros to prevent matching of \begin{env}...\end{env} + macro-braces: + - match: '\{' + scope: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.group.braces.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: general-constants + - include: general-commands + - include: macro-braces + macros: - include: scope:text.tex#macros - match: |- @@ -66,37 +175,19 @@ contexts: 4: support.function.latex 5: punctuation.definition.brace.end.latex 6: support.function.latex - 7: punctuation.definition.brace.optional.begin.latex - 8: punctuation.definition.brace.optional.end.latex + 7: punctuation.definition.bracket.begin.latex + 8: punctuation.definition.bracket.end.latex 9: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.newcommand.tex - match: '\}' scope: punctuation.definition.brace.end.latex pop: true - - include: constants - - include: general-commands - - include: command-only-braces - - command-only-braces: - - match: '\{' - scope: punctuation.definition.brace.begin.latex - push: - - meta_scope: meta.group.braces.latex - - match: '\}' - scope: punctuation.definition.brace.end.latex - pop: true - - include: constants + - include: general-constants - include: general-commands - - include: command-only-braces - - controls: - - include: scope:text.tex#controls + - include: macro-braces - catcode: - - include: scope:text.tex#catcode - - constants: + general-constants: - match: '(\\\\)(?:(\[)\s*-?([0-9]*)\s*(\w*)\s*(\]))?' captures: 1: constant.character.newline.latex @@ -104,14 +195,13 @@ contexts: 3: constant.numeric.newline.latex 4: keyword.other.newline.latex 5: punctuation.definition.brace.begin.newline.latex - - include: scope:text.tex#constants + - include: scope:text.tex#general-constants general-commands: - include: scope:text.tex#general-commands boxes: - - include: scope:text.tex#boxes - - match: '((\\)[mf]box)\s*(\{)' + - match: '((\\)[hvmf]box)\s*(\{)' captures: 1: support.function.box.latex 2: punctuation.definition.backslash.latex @@ -122,63 +212,27 @@ contexts: scope: punctuation.definition.brace.end.latex pop: true - include: main - - match: '((\\)(?:framebox|makebox))(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' + - match: '((\\)(?:framebox|makebox))(?=(?:\[[^\]]*?\])*\{)' captures: 1: support.function.box.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.optional.begin.latex - 4: punctuation.definition.brace.optional.end.latex - 5: punctuation.definition.brace.optional.begin.latex - 6: punctuation.definition.brace.optional.end.latex - 7: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.box.latex - - match: '\}' - scope: punctuation.definition.brace.end.latex - pop: true - - include: main - - match: '((\\)parbox)(?:(\[)[^\]]*?(\]))?(\{)[^\}]*?(\})(\{)' + - include: general-1-argument-with-options + - match: '((\\)parbox)(?=(?:\[[^\]]*?\])*(?:\{[^\}]*\}){2})' captures: 1: support.function.box.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.optional.begin.latex - 4: punctuation.definition.brace.optional.end.latex - 5: punctuation.definition.brace.begin.latex - 6: punctuation.definition.brace.end.latex - 7: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.box.latex - - match: '\}' - scope: punctuation.definition.brace.end.latex - pop: true - - include: main - - match: '((\\)raisebox)(\{)[^\}]*?(\})(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' + - include: general-2-arguments-with-options + - match: '((\\)raisebox)(?=(?:\[[^\]]*?\])*\{)' captures: 1: support.function.box.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex - 4: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.optional.begin.latex - 6: punctuation.definition.brace.optional.end.latex - 7: punctuation.definition.brace.optional.begin.latex - 8: punctuation.definition.brace.optional.end.latex - 9: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.box.latex - - match: '\}' - scope: punctuation.definition.brace.end.latex - pop: true - - include: main - - braces: - - match: '\{' - scope: punctuation.definition.brace.begin.latex - push: - - meta_scope: meta.group.braces.latex - - match: '\}' - scope: punctuation.definition.brace.end.latex - pop: true - - include: main + - include: general-1-argument-with-options preamble: - match: '((\\)(?:documentclass|usepackage))\s*(?:(\[)(?:[^\]]*)(\]))?(\{)' @@ -342,11 +396,11 @@ contexts: math-braces: - match: '\{' - scope: punctuation.definition.brace.begin.math.latex + scope: punctuation.definition.brace.begin.latex push: - - meta_scope: meta.group.braces.math.latex + - meta_scope: meta.group.braces.latex - match: '\}' - scope: punctuation.definition.brace.end.math.latex + scope: punctuation.definition.brace.end.latex pop: true - include: math-content @@ -365,7 +419,7 @@ contexts: - include: scope:text.tex#math-operators - include: scope:text.tex#math-characters - include: scope:text.tex#math-constants - - include: constants + - include: general-constants inline-math: - match: \$ @@ -537,36 +591,20 @@ contexts: - include: main references: - - match: '((\\)[Cc]ite\w*\*?)(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' + - match: '((\\)[Cc]ite\w*\*?)(?=(?:\[[^\]]*?\])*\{)' captures: 1: support.function.cite.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.optional.begin.latex - 4: punctuation.definition.brace.optional.end.latex - 5: punctuation.definition.brace.optional.begin.latex - 6: punctuation.definition.brace.optional.end.latex - 7: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.citation.latex - - match: '\}' - scope: punctuation.definition.brace.end.latex - pop: true - - include: main - - match: '((\\)(?:eq|page)?ref\*?)(?:(\[)[^\]]*?(\]))?(?:(\[)[^\]]*?(\]))?(\{)' + - include: general-1-argument-with-options + - match: '((\\)(?:eq|c?page|[vV]|auto|name|[cC])?ref\*?)(?=(?:\[[^\]]*?\])*\{)' captures: 1: support.function.reference.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.optional.begin.latex - 4: punctuation.definition.brace.optional.end.latex - 5: punctuation.definition.brace.optional.begin.latex - 6: punctuation.definition.brace.optional.end.latex - 7: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.reference.latex - - match: '\}' - scope: punctuation.definition.brace.end.latex - pop: true - - include: main + include: general-1-argument-with-options - match: '((\\)label)(\{)' captures: 1: support.function.label.latex @@ -586,6 +624,10 @@ contexts: 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex + set: + - include: general-optional-arguments + - match: '' + pop: true - match: '((\\)end)(\{)\s*(\w*)\*?\s*(\})' captures: 1: support.function.be.latex @@ -608,8 +650,8 @@ contexts: 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex - 6: punctuation.definition.brace.optional.begin.latex - 7: punctuation.definition.brace.optional.end.latex + 6: punctuation.definition.bracket.begin.latex + 7: punctuation.definition.bracket.end.latex 8: comment.line.percentage.latex push: - meta_scope: meta.environment.embedded.java.latex @@ -630,8 +672,8 @@ contexts: 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex - 6: punctuation.definition.brace.optional.begin.latex - 7: punctuation.definition.brace.optional.end.latex + 6: punctuation.definition.bracket.begin.latex + 7: punctuation.definition.bracket.end.latex 8: comment.line.percentage.latex push: - meta_scope: meta.environment.embedded.python.latex @@ -652,8 +694,8 @@ contexts: 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex - 6: punctuation.definition.brace.optional.begin.latex - 7: punctuation.definition.brace.optional.end.latex + 6: punctuation.definition.bracket.begin.latex + 7: punctuation.definition.bracket.end.latex 8: comment.line.percentage.latex push: - meta_scope: meta.environment.embedded.generic.latex diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index bb2f5ab9d8..a9b02d8f54 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -18,7 +18,7 @@ contexts: - include: boxes - include: block-math - include: inline-math - - include: constants + - include: general-constants - include: general-commands general-commands: @@ -27,13 +27,13 @@ contexts: captures: 1: punctuation.definition.backslash.tex - constants: + general-constants: - match: \\\\ scope: constant.character.newline.tex - match: '(\\)[^a-zA-Z@]' scope: constant.character.escape.tex captures: - 1: punctuation.definition.keyword.tex + 1: punctuation.definition.backslash.tex - match: '&' scope: constant.character.ampersand.tex @@ -70,7 +70,7 @@ contexts: pop: true - include: main - command-only-braces: + macro-braces: - match: '\{' scope: punctuation.definition.brace.begin.tex push: @@ -78,9 +78,9 @@ contexts: - match: '\}' scope: punctuation.definition.brace.end.tex pop: true - - include: constants + - include: general-constants - include: general-commands - - include: command-only-braces + - include: macro-braces boxes: - match: '((\\)[hv]box)\s*(\{)' @@ -99,17 +99,17 @@ contexts: - match: '(\\def)\s*((\\)[a-zA-Z@]+)\s*[^\{]*?\s*(\{)' captures: 1: support.function.definition.tex - 2: support.function.general.definition.tex + 2: support.function.general.tex 3: punctuation.definition.backslash.tex - 4: punctuation.definition.brace.begin.definition.tex + 4: punctuation.definition.brace.begin.tex push: - meta_scope: meta.function.definition.tex - match: '\}' scope: punctuation.definition.brace.end.definition.tex pop: true - - include: constants + - include: general-constants - include: general-commands - - include: command-only-braces + - include: macro-braces greeks: - match: ((\\)(alpha|beta|gamma|delta|epsilon|varepsilon|zeta|eta|theta|vartheta|gamma|kappa|lambda|mu|nu|xi|pi|varpi|rho|varrho|sigma|varsigma|tau|upsilon|phi|varphi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega))\b @@ -129,21 +129,23 @@ contexts: math-braces: - match: '\{' - scope: punctuation.definition.brace.begin.math.tex + scope: punctuation.definition.brace.begin.tex push: - - meta_scope: meta.group.braces.math.tex + - meta_scope: meta.group.braces.tex - match: '\}' - scope: punctuation.definition.brace.end.math.tex + scope: punctuation.definition.brace.end.tex pop: true - include: math-content math-brackets: - - match: '[\(\)\[\]]' - scope: punctuation.definition.bracket.math.tex - - match: '(\\)[\(\)\[\]{}]' - scope: punctuation.definition.bracket.escape.math.tex + - match: '[\(\)]' + scope: constant.character.parenthesis.escape.tex + - match: '[\[\]]' + scope: constant.character.escape.bracket.tex + - match: '(\\)[\{\}]' + scope: constant.character.brace.escape.tex captures: - 1: punctuation.definition.backslash.bracket.escape.math.tex + 1: punctuation.definition.backslash.brace.escape.tex math-constants: - match: '(([0-9]*[\.][0-9]+)|[0-9]+)' @@ -166,7 +168,7 @@ contexts: - include: math-operators - include: math-characters - include: math-constants - - include: constants + - include: general-constants inline-math: - match: \$ From ae42e4df8e03f165b573ee9fa9e26168f5fdd477 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 13 May 2016 03:03:41 -0400 Subject: [PATCH 12/56] [LaTeX] fix regex compatability --- LaTeX/LaTeX.sublime-syntax | 59 +++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 707f8b5f3a..f20216acc9 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -68,49 +68,49 @@ contexts: - include: general-commands _general-1-more-argument: - - match: '(\})(\{)' - captures: - 1: punctuation.definition.brace.end.latex - 2: punctuation.definition.brace.begin.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex set: - - match: '(?<=\{)' + - match: '\{' + scope: punctuation.definition.brace.begin.latex push: - meta_scope: meta.group.argument.latex - - match: '\}' - scope: punctuation.definition.brace.end.latex + - match: '(?=\})' pop: true - include: main - - match: '(?<=\})' + - match: '(?=\})' pop: true _general-2-more-arguments: - - match: '(\})(\{)' - captures: - 1: punctuation.definition.brace.end.latex - 2: punctuation.definition.brace.begin.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex set: - - match: '(?<=\{)' + - match: '\{' + scope: punctuation.definition.brace.begin.latex push: - meta_scope: meta.group.argument.latex - include: _general-1-more-argument + - match: '(?=\})' + pop: true - include: main - - match: '(?<=\})' + - match: '(?=\})' pop: true general-1-argument: - - match: '(?<=\})' + - match: '\}' + scope: meta.group.argument.latex punctuation.definition.brace.end.latex pop: true - match: '\{' scope: punctuation.definition.brace.begin.latex push: - meta_scope: meta.group.argument.latex - - match: '\}' - scope: punctuation.definition.brace.end.latex + - match: '(?=\})' pop: true - include: main general-2-arguments: - - match: '(?<=\})' + - match: '\}' + scope: meta.group.argument.latex punctuation.definition.brace.end.latex pop: true - match: '\{' scope: punctuation.definition.brace.begin.latex @@ -120,7 +120,8 @@ contexts: - include: main general-3-arguments: - - match: '(?<=\})' + - match: '\}' + scope: meta.group.argument.latex punctuation.definition.brace.end.latex pop: true - match: '\{' scope: punctuation.definition.brace.begin.latex @@ -503,20 +504,26 @@ contexts: 5: punctuation.definition.brace.end.latex invalid-quotations: - - match: (? Date: Fri, 13 May 2016 11:44:39 -0400 Subject: [PATCH 13/56] [LaTeX] use POSIX regex --- LaTeX/LaTeX.sublime-syntax | 12 ++++++------ LaTeX/TeX.sublime-syntax | 26 +++++++++++--------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index f20216acc9..d8f3f1f0ce 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -164,8 +164,8 @@ contexts: (?:(?:re)?newcommand) ) (?: - (\{)(\\[a-zA-Z@]+)(\}) - | (\\[a-zA-Z@])+ + (\{)(\\[[:alpha:]@]+)(\}) + | (\\[[:alpha:]@])+ ) (?:(\[)(?:[^\]]*)(\]))? (\{) @@ -189,13 +189,13 @@ contexts: - include: macro-braces general-constants: - - match: '(\\\\)(?:(\[)\s*-?([0-9]*)\s*(\w*)\s*(\]))?' + - match: '(\\\\)(?:(\[)\s*-?([[:digit:]]*)\s*(\w*)\s*(\]))?' captures: 1: constant.character.newline.latex - 2: punctuation.definition.brace.begin.newline.latex + 2: punctuation.definition.bracket.begin.newline.latex 3: constant.numeric.newline.latex 4: keyword.other.newline.latex - 5: punctuation.definition.brace.begin.newline.latex + 5: punctuation.definition.bracket.begin.newline.latex - include: scope:text.tex#general-constants general-commands: @@ -419,7 +419,7 @@ contexts: - include: scope:text.tex#math-commands - include: scope:text.tex#math-operators - include: scope:text.tex#math-characters - - include: scope:text.tex#math-constants + - include: scope:text.tex#math-numerics - include: general-constants inline-math: diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index a9b02d8f54..566116b2b0 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -22,7 +22,7 @@ contexts: - include: general-commands general-commands: - - match: '(\\)[A-Za-z@]+' + - match: '(\\)[[:alpha:]@]+' scope: support.function.general.tex captures: 1: punctuation.definition.backslash.tex @@ -30,7 +30,7 @@ contexts: general-constants: - match: \\\\ scope: constant.character.newline.tex - - match: '(\\)[^a-zA-Z@]' + - match: '(\\)[^[:alpha:]@]' scope: constant.character.escape.tex captures: 1: punctuation.definition.backslash.tex @@ -96,7 +96,7 @@ contexts: - include: main macros: - - match: '(\\def)\s*((\\)[a-zA-Z@]+)\s*[^\{]*?\s*(\{)' + - match: '(\\def)\s*((\\)[[:alpha:]@]+)\s*[^\{]*?\s*(\{)' captures: 1: support.function.definition.tex 2: support.function.general.tex @@ -105,7 +105,7 @@ contexts: push: - meta_scope: meta.function.definition.tex - match: '\}' - scope: punctuation.definition.brace.end.definition.tex + scope: punctuation.definition.brace.end.tex pop: true - include: general-constants - include: general-commands @@ -118,7 +118,7 @@ contexts: 2: punctuation.definition.backslash.tex math-commands: - - match: '((\\)[a-zA-Z@]+)' + - match: '((\\)[[:alpha:]@]+)' captures: 1: support.function.math.tex 2: punctuation.definition.backslash.tex @@ -139,24 +139,20 @@ contexts: math-brackets: - match: '[\(\)]' - scope: constant.character.parenthesis.escape.tex + scope: constant.character.parenthesis.tex - match: '[\[\]]' - scope: constant.character.escape.bracket.tex + scope: constant.character.bracket.tex - match: '(\\)[\{\}]' scope: constant.character.brace.escape.tex captures: 1: punctuation.definition.backslash.brace.escape.tex - math-constants: - - match: '(([0-9]*[\.][0-9]+)|[0-9]+)' + math-numerics: + - match: '(([[:digit:]]*\.[[:digit:]]+)|[[:digit:]]+)' scope: constant.numeric.math.tex - - match: '(\\)([^a-zA-Z]|[A-Za-z]+)(?=\b|\}|\]|\^|\_)' - scope: constant.other.general.math.tex - captures: - 1: punctuation.definition.backslash.constant.math.tex math-characters: - - match: "[a-zA-Z]+" + - match: "[[:alpha:]]+" scope: variable.other.math.tex math-content: @@ -167,7 +163,7 @@ contexts: - include: math-commands - include: math-operators - include: math-characters - - include: math-constants + - include: math-numerics - include: general-constants inline-math: From 31b89c1c7af120385184e85b4bb34a8a3e3d10e0 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Tue, 24 May 2016 23:50:20 +0200 Subject: [PATCH 14/56] [LaTeX] Add support for LaTeX package `comment` --- LaTeX/LaTeX.sublime-syntax | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index d8f3f1f0ce..64d56f4bdc 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -646,6 +646,7 @@ contexts: # external packages supports packages: - include: 1stlisting + - include: pkgcomment - include: beamer # 1stlisting @@ -716,6 +717,38 @@ contexts: 5: punctuation.definition.brace.end.latex pop: true + # comment package + pkgcomment: + - match: '^(\\)comment' + captures: + 0: punctuation.definition.comment.start.latex + 1: punctuation.definition.backslash.latex + push: + - meta_scope: meta.environment.comment.latex comment.block.command.comment.latex + - match: '^(\\)endcomment' + captures: + 0: punctuation.definition.comment.end.latex + 1: punctuation.definition.backslash.latex + pop: true + - match: '((\\)begin)(\{)\s*(comment)\s*(\})' + captures: + 1: support.function.be.latex + 2: punctuation.definition.backslash.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex + push: + - meta_scope: meta.environment.comment.latex + - meta_content_scope: comment.block.environment.comment.latex + - match: '((\\)end)(\{)\s*(comment)\s*(\})' + captures: + 1: support.function.be.latex + 2: punctuation.definition.backslash.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex + pop: true + # beamer support beamer: - match: '(?:\s*)((\\)begin)(\{)(frame)(\})' From b4ee6862c30c614e52d2a54670644d18954391a6 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Tue, 24 May 2016 19:47:14 -0400 Subject: [PATCH 15/56] [LaTeX] refactor the main section --- LaTeX/LaTeX.sublime-syntax | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 64d56f4bdc..92123f1eef 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -11,7 +11,15 @@ contexts: - include: comments main: - # unique to latex + - include: unique-latex + # external packages + - include: packages + - include: plain-tex + - include: begin-end-commands + - include: general-commands + - include: global-braces + + unique-latex: - include: preamble - include: structure - include: includes @@ -24,24 +32,16 @@ contexts: - include: invalid-quotations - include: lists - # external packages - - include: packages - + plain-tex: # extended from tex - include: macros - include: scope:text.tex#controls - include: scope:text.tex#catcode - - include: global-braces - include: boxes - include: block-math - include: inline-math - include: general-constants - # unique to latex - - include: begin-end-commands - # extended from tex - - include: general-commands - comments: - include: scope:text.tex#comments @@ -643,7 +643,7 @@ contexts: 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex - # external packages supports + # external packages packages: - include: 1stlisting - include: pkgcomment From f621e7e1c944f0bc0f41d2614513fa7cdcabb717 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Tue, 24 May 2016 19:46:17 -0400 Subject: [PATCH 16/56] [Haskell] use the new latex syntax --- Haskell/Literate Haskell.sublime-syntax | 38 +++++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/Haskell/Literate Haskell.sublime-syntax b/Haskell/Literate Haskell.sublime-syntax index 82d232809a..fe1a3383b9 100644 --- a/Haskell/Literate Haskell.sublime-syntax +++ b/Haskell/Literate Haskell.sublime-syntax @@ -7,21 +7,41 @@ file_extensions: scope: text.tex.latex.haskell contexts: main: - - match: '^((\\)begin)({)code(})(\s*\n)?' + - include: scope:text.tex.latex#unique-latex + - include: scope:text.tex.latex#upackages + - include: haskell-code + - include: scope:text.tex.latex#plain-tex + - include: scope:text.tex.latex#begin-end-commands + - include: scope:text.tex.latex#general-commands + - include: global-braces + + global-braces: + - match: '\{' + scope: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.group.braces.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main + + haskell-code: + - match: '(?:\s*)((\\)begin)(\{)(code)(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: punctuation.definition.arguments.end.latex + 2: punctuation.definition.backslash.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex push: - meta_scope: meta.function.embedded.haskell.latex - meta_content_scope: source.haskell.embedded.latex - - match: '^((\\)end)({)code(})' + - match: '((\\)end)(\{)(code)(\})' captures: 1: support.function.be.latex - 2: punctuation.definition.function.latex - 3: punctuation.definition.arguments.begin.latex - 4: punctuation.definition.arguments.end.latex + 2: punctuation.definition.backslash.latex + 3: punctuation.definition.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.brace.end.latex pop: true - include: scope:source.haskell - - include: scope:text.tex.latex From 243cde5a31531b7f3e3b16d784cb742a4bf9ca69 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Wed, 25 May 2016 00:03:46 -0400 Subject: [PATCH 17/56] [LaTeX] list of biblatex commands --- LaTeX/LaTeX.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 92123f1eef..812bf0620d 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -598,7 +598,7 @@ contexts: - include: main references: - - match: '((\\)[Cc]ite\w*\*?)(?=(?:\[[^\]]*?\])*\{)' + - match: '((\\)(?:[cC]ite(?:author|title|year|date|url)?|(?:[pP]aren|foot|[tT]ext|[sS]mart|super|[aA]|no|full|footfull)cite|footcitetext)\*?)(?=(?:\[[^\]]*?\])*\{)' captures: 1: support.function.cite.latex 2: punctuation.definition.backslash.latex From 3b7eafa1a6542b499e3760f7ce8ac1fc54c967c8 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Thu, 26 May 2016 12:13:32 -0400 Subject: [PATCH 18/56] [LaTeX] rename 1stlisting to pkglistings --- LaTeX/LaTeX.sublime-syntax | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 812bf0620d..a87315f836 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -645,12 +645,12 @@ contexts: # external packages packages: - - include: 1stlisting + - include: pkglistings - include: pkgcomment - include: beamer - # 1stlisting - 1stlisting: + # pkglistings + pkglistings: - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Java)\n?)' captures: 1: support.function.be.latex From 36f0ef427a03395db4e8838ddde2d8f25792d1b2 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 27 May 2016 23:18:28 -0400 Subject: [PATCH 19/56] [LaTeX] should be push --- LaTeX/LaTeX.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index a87315f836..b9d9169a88 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -631,7 +631,7 @@ contexts: 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex - set: + push: - include: general-optional-arguments - match: '' pop: true From 3dc93a43dfc593605bbba6be86d37d981a8eb0d0 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 28 May 2016 00:49:46 -0400 Subject: [PATCH 20/56] [LaTeX] added minted and fixed some syntax tests --- LaTeX/LaTeX.sublime-syntax | 123 +++++++++++++++++++++++++----------- LaTeX/syntax_test_latex.tex | 22 +++---- 2 files changed, 94 insertions(+), 51 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index b9d9169a88..185432f97b 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -199,7 +199,10 @@ contexts: - include: scope:text.tex#general-constants general-commands: - - include: scope:text.tex#general-commands + - match: '(\\)[[:alpha:]@]+' + scope: support.function.general.latex + captures: + 1: punctuation.definition.backslash.latex boxes: - match: '((\\)[hvmf]box)\s*(\{)' @@ -305,12 +308,12 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.brace.bebgin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex push: - meta_include_prototype: false - - meta_scope: meta.environment.verbatim.latex + - meta_scope: meta.environment.verbatim.verbatim.latex - meta_content_scope: markup.raw.verbatim.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: @@ -513,12 +516,12 @@ contexts: verb: - match: ((\\)verb)(\W) - scope: meta.function.verbatim.latex captures: 1: support.function.verb.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.verb.latex push: + - meta_scope: meta.environment.verbatim.verb.latex - meta_content_scope: markup.raw.verb.latex - match: '\3' scope: punctuation.definition.verb.latex @@ -596,6 +599,18 @@ contexts: scope: punctuation.definition.brace.end.latex pop: true - include: main + - match: '((\\)underline)(\{)' + captures: + 1: support.function.text.latex + 2: punctuation.definition.backslash.latex + 3: punctuation.definition.brace.begin.latex + push: + - meta_scope: meta.function.underline.latex + - meta_content_scope: markup.underline.underline.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: main references: - match: '((\\)(?:[cC]ite(?:author|title|year|date|url)?|(?:[pP]aren|foot|[tT]ext|[sS]mart|super|[aA]|no|full|footfull)cite|footcitetext)\*?)(?=(?:\[[^\]]*?\])*\{)' @@ -646,46 +661,34 @@ contexts: # external packages packages: - include: pkglistings + - include: minted - include: pkgcomment - include: beamer - # pkglistings + # listings package pkglistings: - - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Java)\n?)' + - match: ((\\)lstinline)(\W) captures: - 1: support.function.be.latex + 1: support.function.lstinline.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex - 6: punctuation.definition.bracket.begin.latex - 7: punctuation.definition.bracket.end.latex - 8: comment.line.percentage.latex + 3: punctuation.definition.verb.latex push: - - meta_scope: meta.environment.embedded.java.latex - - meta_content_scope: source.java.embedded - - match: '((\\)end)(\{)(lstlisting)(\})' - captures: - 1: support.function.be.latex - 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + - meta_scope: meta.environment.verbatim.lstinline.latex + - meta_content_scope: markup.raw.verb.latex + - match: '\3' + scope: punctuation.definition.verb.latex pop: true - - include: scope:source.java - - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%\s*(?i:Python)\n?)' + + - match: ((\\)begin)(\{)(lstlisting)(\}) captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex - 6: punctuation.definition.bracket.begin.latex - 7: punctuation.definition.bracket.end.latex - 8: comment.line.percentage.latex push: - - meta_scope: meta.environment.embedded.python.latex - - meta_content_scope: source.python.embedded + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.lstlisting.latex - match: '((\\)end)(\{)(lstlisting)(\})' captures: 1: support.function.be.latex @@ -694,21 +697,44 @@ contexts: 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex pop: true - - include: scope:source.python - - match: '(?:\s*)((\\)begin)(\{)(lstlisting)(\})(?:(\[).*(\]))?(\s*%.*\n?)?' + - include: general-optional-arguments + - match: '.*(%\s*(?i:python|py))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_scope: meta.environment.embedded.python.latex + - meta_content_scope: source.python.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.python + - match: '.*(%\s*(?i:java))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_scope: meta.environment.embedded.java.latex + - meta_content_scope: source.java.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.java + - match: '' + push: + - match: '(?=\\end\{lstlisting\})' + pop: true + + minted: + - match: ((\\)begin)(\{)(minted)(\}) captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex - 6: punctuation.definition.bracket.begin.latex - 7: punctuation.definition.bracket.end.latex - 8: comment.line.percentage.latex push: - - meta_scope: meta.environment.embedded.generic.latex - - meta_content_scope: source.generic.embedded - - match: '((\\)end)(\{)(lstlisting)(\})' + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - match: '((\\)end)(\{)(minted)(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex @@ -716,6 +742,29 @@ contexts: 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex pop: true + - include: general-optional-arguments + - match: '\{python\}' + push: + - meta_include_prototype: false + - meta_scope: meta.environment.embedded.python.latex + - meta_content_scope: source.python.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.python + - match: '\{java\}' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_scope: meta.environment.embedded.java.latex + - meta_content_scope: source.java.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.java + - match: '' + push: + - match: '(?=\\end\{minted\})' + pop: true # comment package pkgcomment: diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 2423e0df69..f127ee1582 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -75,17 +75,13 @@ \subsubsection{name} \command{} % ^ support.function.general.latex -\verb{\command{}} -% ^ markup.raw.verb.latex -% ^ meta.environment.verbatim.verbatim.latex -% ^ - support.function.general.latex \verb|\command{}| % ^ markup.raw.verb.latex -% ^ meta.environment.verbatim.verbatim.latex +% ^ meta.environment.verbatim.verb.latex % ^ - support.function.general.latex \verb+\command{}+ % ^ markup.raw.verb.latex -% ^ meta.environment.verbatim.verbatim.latex +% ^ meta.environment.verbatim.verb.latex % ^ - support.function.general.latex \begin{verbatim} @@ -167,8 +163,7 @@ \subsubsection{name} % - python % - java -\begin{lstlisting} % Python - +\begin{lstlisting} % python def my_function(): pass % <- meta.environment.verbatim.lstlisting.latex @@ -178,7 +173,7 @@ \subsubsection{name} \end{lstlisting} \begin{lstlisting}[frame=single, - language=python] + language=python] %python def my_function(): pass % <- meta.environment.verbatim.lstlisting.latex @@ -187,8 +182,7 @@ \subsubsection{name} % ^ keyword.control.flow.python \end{lstlisting} -\begin{lstlisting} % Java - +\begin{lstlisting} %java class MyClass() { % <- meta.environment.verbatim.lstlisting.latex % <- meta.environment.embedded.java.latex @@ -206,7 +200,7 @@ \subsubsection{name} def my_function(): pass % <- meta.environment.verbatim.minted.latex -% <- meta.function.embedded.python.latex +% <- meta.environment.embedded.python.latex % <- source.python.embedded % ^ keyword.control.flow.python \end{minted} @@ -214,7 +208,7 @@ \subsubsection{name} \mint{python}{import this} % ^ meta.environment.verbatim.minted.latex -% ^ meta.function.embedded.python.latex +% ^ meta.environment.embedded.python.latex % ^ source.python.embedded % ^ keyword.control.import.python @@ -227,7 +221,7 @@ \subsubsection{name} \mintinline {python}{print(x ** 2)} % ^ meta.environment.verbatim.minted.latex -% ^ meta.function.embedded.python.latex +% ^ meta.environment.embedded.python.latex % ^ source.python.embedded % ^ keyword.other.python From 16aa4bc5dd4efcd665da5e44588e7bb8c4c5c7aa Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 28 May 2016 12:12:26 -0400 Subject: [PATCH 21/56] [LaTeX] use A-Za-z instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit as @r-stein has pointed out > Remark: [:alpha:] is different from A-Za-z. In python you can add the flag re.UNICODE and ST seems to do something similar. Hence [:alpha:] does also capture non-ascii word characters like ä, ö, ü... Therefore we should better use A-Za-z in most cases. --- LaTeX/LaTeX.sublime-syntax | 7 ++++--- LaTeX/TeX.sublime-syntax | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 185432f97b..d3157d8672 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -164,8 +164,8 @@ contexts: (?:(?:re)?newcommand) ) (?: - (\{)(\\[[:alpha:]@]+)(\}) - | (\\[[:alpha:]@])+ + (\{)(\\[A-Za-z@]+)(\}) + | (\\[A-Za-z@])+ ) (?:(\[)(?:[^\]]*)(\]))? (\{) @@ -199,7 +199,7 @@ contexts: - include: scope:text.tex#general-constants general-commands: - - match: '(\\)[[:alpha:]@]+' + - match: '(\\)[A-Za-z@]+' scope: support.function.general.latex captures: 1: punctuation.definition.backslash.latex @@ -763,6 +763,7 @@ contexts: - include: scope:source.java - match: '' push: + - meta_scope: meta.environment.embedded.generic.latex - match: '(?=\\end\{minted\})' pop: true diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 566116b2b0..a87f1271a7 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -22,7 +22,7 @@ contexts: - include: general-commands general-commands: - - match: '(\\)[[:alpha:]@]+' + - match: '(\\)[A-Za-z@]+' scope: support.function.general.tex captures: 1: punctuation.definition.backslash.tex @@ -30,7 +30,7 @@ contexts: general-constants: - match: \\\\ scope: constant.character.newline.tex - - match: '(\\)[^[:alpha:]@]' + - match: '(\\)[^A-Za-z@]' scope: constant.character.escape.tex captures: 1: punctuation.definition.backslash.tex @@ -96,7 +96,7 @@ contexts: - include: main macros: - - match: '(\\def)\s*((\\)[[:alpha:]@]+)\s*[^\{]*?\s*(\{)' + - match: '(\\def)\s*((\\)[A-Za-z@]+)\s*[^\{]*?\s*(\{)' captures: 1: support.function.definition.tex 2: support.function.general.tex @@ -118,7 +118,7 @@ contexts: 2: punctuation.definition.backslash.tex math-commands: - - match: '((\\)[[:alpha:]@]+)' + - match: '((\\)[A-Za-z@]+)' captures: 1: support.function.math.tex 2: punctuation.definition.backslash.tex @@ -152,7 +152,7 @@ contexts: scope: constant.numeric.math.tex math-characters: - - match: "[[:alpha:]]+" + - match: "[A-Za-z]+" scope: variable.other.math.tex math-content: From 76e3c75d0630d6b5edf4b373d4c1d9cc4e62d9fd Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 28 May 2016 14:30:16 -0400 Subject: [PATCH 22/56] [LaTeX] add mint/mintinline and fix all tests --- LaTeX/LaTeX.sublime-syntax | 134 ++++++++++++++++++++++++++++-------- LaTeX/syntax_test_latex.tex | 20 ++++-- 2 files changed, 120 insertions(+), 34 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index d3157d8672..2b130deade 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -239,18 +239,37 @@ contexts: - include: general-1-argument-with-options preamble: - - match: '((\\)(?:documentclass|usepackage))\s*(?:(\[)(?:[^\]]*)(\]))?(\{)' + - match: '(\\)documentclass\b' captures: - 1: keyword.control.preamble.latex - 2: punctuation.definition.backslash.latex - 3: punctuation.definition.bracket.begin.latex - 4: punctuation.definition.bracket.end.latex - 5: punctuation.definition.brace.begin.latex + 0: keyword.control.preamble.latex + 1: punctuation.definition.backslash.latex + push: + - meta_scope: meta.preamble.documentclass.latex + - match: '\}' + scope: punctuation.definition.brace.end.latex + pop: true + - include: general-optional-arguments + - match: '\{' + set: + - meta_content_scope: support.class.latex + - match: (?=\}) + pop: true + - match: '(\\)usepackage\b' + captures: + 0: keyword.control.preamble.latex + 1: punctuation.definition.backslash.latex push: - - meta_scope: meta.preamble.latex + - meta_scope: meta.preamble.usepackage.latex - match: '\}' scope: punctuation.definition.brace.end.latex pop: true + - include: general-optional-arguments + - match: '\{' + set: + - match: '[A-Za-z[:digit:]-]*' + scope: support.class.latex + - match: (?=\}) + pop: true includes: - match: '((\\)(?:include|includeonly))(\{)' @@ -667,17 +686,22 @@ contexts: # listings package pkglistings: - - match: ((\\)lstinline)(\W) + - match: (\\)lstinline\b captures: - 1: support.function.lstinline.latex - 2: punctuation.definition.backslash.latex - 3: punctuation.definition.verb.latex + 0: support.function.lstinline.latex + 1: punctuation.definition.backslash.latex push: + - meta_include_prototype: false - meta_scope: meta.environment.verbatim.lstinline.latex - - meta_content_scope: markup.raw.verb.latex - - match: '\3' + - include: general-optional-arguments + - match: '(\W)' scope: punctuation.definition.verb.latex - pop: true + set: + - meta_include_prototype: false + - meta_content_scope: meta.environment.verbatim.lstinline.latex markup.raw.verb.latex + - match: '\1' + scope: meta.environment.verbatim.lstinline.latex punctuation.definition.verb.latex + pop: true - match: ((\\)begin)(\{)(lstlisting)(\}) captures: @@ -703,8 +727,7 @@ contexts: 1: comment.line.percentage.latex push: - meta_include_prototype: false - - meta_scope: meta.environment.embedded.python.latex - - meta_content_scope: source.python.embedded + - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded - match: '(?=\\end\{lstlisting\})' pop: true - include: scope:source.python @@ -713,17 +736,21 @@ contexts: 1: comment.line.percentage.latex push: - meta_include_prototype: false - - meta_scope: meta.environment.embedded.java.latex - - meta_content_scope: source.java.embedded + - meta_content_scope: meta.environment.embedded.java.latex source.java.embedded - match: '(?=\\end\{lstlisting\})' pop: true - include: scope:source.java - match: '' push: + - meta_scope: meta.environment.embedded.generic.latex markup.raw.verb.latex - match: '(?=\\end\{lstlisting\})' pop: true minted: + - include: minted-env + - include: mint + + minted-env: - match: ((\\)begin)(\{)(minted)(\}) captures: 1: support.function.be.latex @@ -743,39 +770,90 @@ contexts: 5: punctuation.definition.brace.end.latex pop: true - include: general-optional-arguments - - match: '\{python\}' + - match: '(\{)(python)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex push: - meta_include_prototype: false - - meta_scope: meta.environment.embedded.python.latex - - meta_content_scope: source.python.embedded + - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded - match: '(?=\\end\{minted\})' pop: true - include: scope:source.python - - match: '\{java\}' + - match: '(\{)(java)(\})' captures: - 1: comment.line.percentage.latex + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex push: - meta_include_prototype: false - - meta_scope: meta.environment.embedded.java.latex - - meta_content_scope: source.java.embedded + - meta_content_scope: meta.environment.embedded.java.latex source.java.embedded - match: '(?=\\end\{minted\})' pop: true - include: scope:source.java - match: '' push: - - meta_scope: meta.environment.embedded.generic.latex + - meta_scope: meta.environment.embedded.generic.latex markup.raw.verb.latex - match: '(?=\\end\{minted\})' pop: true + mint: + - match: ((\\)mint)\b|((\\)mintinline)\b + captures: + 1: support.function.mint.latex + 2: punctuation.definition.backslash.latex + 3: support.function.mintinline.latex + 4: punctuation.definition.backslash.latex + push: + - meta_scope: meta.environment.verbatim.minted.latex + - include: general-optional-arguments + - match: '(\{)(python)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.python + - match: '(\{)(java)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.java.latex source.java.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.java + - match: '' + pop: true + # comment package pkgcomment: - - match: '^(\\)comment' + - match: '^(\\)comment\b' captures: 0: punctuation.definition.comment.start.latex 1: punctuation.definition.backslash.latex push: - meta_scope: meta.environment.comment.latex comment.block.command.comment.latex - - match: '^(\\)endcomment' + - match: '^(\\)endcomment\b' captures: 0: punctuation.definition.comment.end.latex 1: punctuation.definition.backslash.latex diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index f127ee1582..71859d47aa 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -4,13 +4,12 @@ \documentclass[12pt]{article} % ^ keyword.control.preamble.latex -% ^ variable.parameter.latex % ^ support.class.latex -\usepackage[args]{mypackage} +\usepackage[args]{mypackage, anotherpackage} % ^ keyword.control.preamble.latex -% ^ variable.parameter.latex % ^ support.class.latex +% ^ support.class.latex % line comment % <- comment.line.percentage.tex @@ -120,7 +119,7 @@ \subsubsection{name} \(f(x) = x^2\) % ^ meta.environment.math.latex \[ - f(x) = x^2 + f(x) = x^2 \text{ $f$ is a function} % ^ meta.environment.math.latex \] \ensuremath{f(x) = x^2} @@ -131,6 +130,15 @@ \subsubsection{name} \end{equation} +% Boxes +\mbox{text}{text} +% ^ meta.function.box.latex +% ^ -meta.function.box.latex +\parbox{text}{text} +% ^ meta.function.box.latex +% ^ meta.function.box.latex + + % PACKAGE: comment % The comment package can be used to write block comment % using an environment. @@ -219,13 +227,13 @@ \subsubsection{name} % ^ source.python.embedded -\mintinline {python}{print(x ** 2)} +\mintinline{python}{print(x ** 2)} % ^ meta.environment.verbatim.minted.latex % ^ meta.environment.embedded.python.latex % ^ source.python.embedded % ^ keyword.other.python -\mintinline {python}+print(x ** 2)+ +\mintinline{python}+print(x ** 2)+ % ^ source.python.embedded From b6d3f84f44d6e5e795d1525648d6d046861e47bd Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 28 May 2016 19:25:01 -0400 Subject: [PATCH 23/56] [LaTeX] fix ref issue --- LaTeX/LaTeX.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 2b130deade..e30c241e33 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -645,7 +645,7 @@ contexts: 2: punctuation.definition.backslash.latex push: - meta_scope: meta.function.reference.latex - include: general-1-argument-with-options + - include: general-1-argument-with-options - match: '((\\)label)(\{)' captures: 1: support.function.label.latex From acaf9f60d019a9357de9815a0a72fa8a769691a4 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Sat, 28 May 2016 23:30:26 +0200 Subject: [PATCH 24/56] [LaTeX] Add tests for label/ref/cite and url --- LaTeX/syntax_test_latex.tex | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 71859d47aa..6a2f1e8167 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -50,6 +50,49 @@ \subsubsection{name} % ^ entity.name.section.latex +% REF/LABEL/CITE COMMANDS + +\label{sec:name} +% ^ meta.function.label.latex +% ^ support.function.label.latex + +\ref{sec:name} +% ^ meta.function.reference.latex +% ^ support.function.reference.latex + +\cite{my:bib:key} +% ^ meta.function.citation.latex +% ^ support.function.cite.latex + + +% URL COMMAND + +\url{https://www.sublimetext.com/} +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.link.url.latex +% ^ support.function.url.latex +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.latex + +\href{https://www.sublimetext.com/} +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.link.url.latex +% ^ support.function.url.latex +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.latex + + +% INCLUDE COMMANDS + +\include{path/to/file} +% ^ meta.function.include.latex +% ^ keyword.control.include.latex + +\includeonly{path/to/file.tex} +% ^ meta.function.include.latex +% ^ keyword.control.include.latex + +\input{path/to/file.tex} +% ^ meta.function.input.tex +% ^ keyword.control.input.tex + + % MARKUP COMMANDS \emph{text} From a4f70ea13867bc47bbeef1fcf867635f09350796 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Sat, 28 May 2016 23:51:12 +0200 Subject: [PATCH 25/56] [LaTeX] Add tests for list environments --- LaTeX/syntax_test_latex.tex | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 6a2f1e8167..0ddf9af927 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -113,6 +113,28 @@ \subsubsection{name} % ^ markup.underline.underline.latex +% LIST ENVIRONMENTS + +\begin{itemize} +\item first item +% <- meta.environment.list.itemize.latex +\end{itemize} + +\begin{enumerate} +\item first item +% <- meta.environment.list.enumerate.latex +\end{enumerate} + +\begin{description} +\item[item] description of item +% <- meta.environment.list.description.latex +\end{description} + +\begin{list}{(\arabic{listcounter})}{\usecounter{listcounter}} +\item first item +% <- meta.environment.list.list.latex +\end{list} + % VERBATIM \command{} From a32bc57db30adcec640c7a567e0d01318fcc6eb9 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sun, 29 May 2016 12:10:36 -0400 Subject: [PATCH 26/56] [LaTeX] Improve style --- Haskell/Literate Haskell.sublime-syntax | 5 ++++- LaTeX/LaTeX.sublime-syntax | 2 -- R/Rd (R Documentation).sublime-syntax | 25 ++++++++++++------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Haskell/Literate Haskell.sublime-syntax b/Haskell/Literate Haskell.sublime-syntax index fe1a3383b9..11d500114d 100644 --- a/Haskell/Literate Haskell.sublime-syntax +++ b/Haskell/Literate Haskell.sublime-syntax @@ -6,9 +6,12 @@ file_extensions: - lhs scope: text.tex.latex.haskell contexts: + prototype: + - include: scope:text.tex.latex#comments + main: - include: scope:text.tex.latex#unique-latex - - include: scope:text.tex.latex#upackages + - include: scope:text.tex.latex#packages - include: haskell-code - include: scope:text.tex.latex#plain-tex - include: scope:text.tex.latex#begin-end-commands diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index e30c241e33..a2f961d28a 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -12,7 +12,6 @@ contexts: main: - include: unique-latex - # external packages - include: packages - include: plain-tex - include: begin-end-commands @@ -33,7 +32,6 @@ contexts: - include: lists plain-tex: - # extended from tex - include: macros - include: scope:text.tex#controls - include: scope:text.tex#catcode diff --git a/R/Rd (R Documentation).sublime-syntax b/R/Rd (R Documentation).sublime-syntax index a711db079f..b8a937c7d8 100644 --- a/R/Rd (R Documentation).sublime-syntax +++ b/R/Rd (R Documentation).sublime-syntax @@ -7,21 +7,16 @@ file_extensions: scope: text.tex.latex.rd contexts: prototype: - - include: comments + - include: scope:text.tex.latex#comments main: - - include: stucture + - include: rd-stucture - include: r-code - - include: equations - # exteneded from latex - - include: scope:text.tex.latex#invalid-quotations - - include: scope:text.tex.latex#macros - - include: global-braces - - include: scope:text.tex.latex#general-constants + - include: latex-equations + - include: scope:text.tex.latex#plain-tex + - include: scope:text.tex.latex#begin-end-commands - include: scope:text.tex.latex#general-commands - - comments: - - include: scope:text.tex#comments + - include: global-braces global-braces: - match: '\{' @@ -33,7 +28,7 @@ contexts: pop: true - include: main - equations: + latex-equations: - include: deqn - include: eqn @@ -77,6 +72,7 @@ contexts: - match: '\}' scope: punctuation.definition.brace.end.rd pop: true + - match: \\% - include: scope:source.r - match: '((\\)(?:Sexpr))(?:(\[)(?:[^\]]*)(\]))?(\{)' captures: @@ -91,6 +87,7 @@ contexts: - match: '\}' scope: punctuation.definition.brace.end.rd pop: true + - match: \\% - include: scope:source.r - match: '((\\)(?:usage))(\{)(?:\n)?' captures: @@ -103,6 +100,7 @@ contexts: - match: '\}' scope: punctuation.definition.brace.end.rd pop: true + - match: \\% - include: scope:source.r - match: '((\\)(?:examples))(\{)(?:\n)?' captures: @@ -115,9 +113,10 @@ contexts: - match: '\}' scope: punctuation.definition.brace.end.rd pop: true + - match: \\% - include: scope:source.r - stucture: + rd-stucture: - match: '((\\)name)(\{)' captures: 1: keyword.other.section.rd From 4221cdfc7cceaae6431ef043f551ef588fc539b2 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Mon, 30 May 2016 14:30:30 -0400 Subject: [PATCH 27/56] [LaTeX] lstlisting supported languages --- LaTeX/LaTeX.sublime-syntax | 123 ++++++++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 3 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index a2f961d28a..d755c609b4 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -720,15 +720,33 @@ contexts: 5: punctuation.definition.brace.end.latex pop: true - include: general-optional-arguments - - match: '.*(%\s*(?i:python|py))$' + - match: '.*(%\s*(?i:c))$' captures: 1: comment.line.percentage.latex push: - meta_include_prototype: false - - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded + - meta_content_scope: meta.environment.embedded.c.latex source.c.embedded - match: '(?=\\end\{lstlisting\})' pop: true - - include: scope:source.python + - include: scope:source.c + - match: '.*(%\s*(?i:cpp|c\+\+))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.c++.latex source.c++.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.c++ + - match: '.*(%\s*(?i:haskell))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.haskell.latex source.haskell.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.haskell - match: '.*(%\s*(?i:java))$' captures: 1: comment.line.percentage.latex @@ -738,6 +756,105 @@ contexts: - match: '(?=\\end\{lstlisting\})' pop: true - include: scope:source.java + - match: '.*(%\s*(?i:tex|latex))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.latex.latex source.latex.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:text.tex.latex + - match: '.*(%\s*(?i:lisp))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.lisp.latex source.lisp.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.lisp + - match: '.*(%\s*(?i:lua))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.lua.latex source.lua.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.lua + - match: '.*(%\s*(?i:perl))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.perl.latex source.perl.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.perl + - match: '.*(%\s*(?i:php))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.php.latex source.php.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.php + - match: '.*(%\s*(?i:python|py))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.python + - match: '.*(%\s*(?i:r))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.r.latex source.r.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.r + - match: '.*(%\s*(?i:ruby))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.ruby.latex source.ruby.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.ruby + - match: '.*(%\s*(?i:sh|shell|bash ))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.shell.latex source.shell.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.shell + - match: '.*(%\s*(?i:sql|mysql|ddl|dml))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.sql.latex source.sql.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.sql + - match: '.*(%\s*(?i:yaml))$' + captures: + 1: comment.line.percentage.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.yaml.latex source.yaml.embedded + - match: '(?=\\end\{lstlisting\})' + pop: true + - include: scope:source.yaml - match: '' push: - meta_scope: meta.environment.embedded.generic.latex markup.raw.verb.latex From 741ae1679afad025cc44686b598ffb8efd5deb3d Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Mon, 30 May 2016 14:51:30 -0400 Subject: [PATCH 28/56] [LaTeX] minted supported languages --- LaTeX/LaTeX.sublime-syntax | 546 ++++++++++++++++++++++++++++++++++++- 1 file changed, 539 insertions(+), 7 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index d755c609b4..57d3262113 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -738,7 +738,7 @@ contexts: - match: '(?=\\end\{lstlisting\})' pop: true - include: scope:source.c++ - - match: '.*(%\s*(?i:haskell))$' + - match: '.*(%\s*(?i:haskell|hs))$' captures: 1: comment.line.percentage.latex push: @@ -885,17 +885,61 @@ contexts: 5: punctuation.definition.brace.end.latex pop: true - include: general-optional-arguments - - match: '(\{)(python)(\})' + - match: '(\{)(c)(\})' captures: 1: punctuation.definition.brace.begin.latex 2: variable.parameter.function.latex 3: punctuation.definition.brace.end.latex push: - meta_include_prototype: false - - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded + - meta_content_scope: meta.environment.embedded.c.latex source.c.embedded - match: '(?=\\end\{minted\})' pop: true - - include: scope:source.python + - include: scope:source.c + - match: '(\{)(cpp|c\+\+)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.c++.latex source.c++.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.c++ + - match: '(\{)(diff)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.diff.latex source.diff.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.diff + - match: '(\{)(go|golang)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.go.latex source.go.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.go + - match: '(\{)(haskell|hs)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.haskell.latex source.haskell.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.haskell - match: '(\{)(java)(\})' captures: 1: punctuation.definition.brace.begin.latex @@ -907,6 +951,171 @@ contexts: - match: '(?=\\end\{minted\})' pop: true - include: scope:source.java + - match: '(\{)(javascript|js)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.js.latex source.js.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.js + - match: '(\{)(json)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.json.latex source.json.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.json + - match: '(\{)(tex|latex)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.latex.latex text.tex.latex.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:text.tex.latex + - match: '(\{)(lisp)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.lisp.latex source.lisp.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.lisp + - match: '(\{)(lua)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.lua.latex source.lua.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.lua + - match: '(\{)(obj(?:ective\-|)c)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.objc.latex source.objc.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.objc + - match: '(\{)(obj(?:ective\-|)c\+\+)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.objc++.latex source.objc++.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.objc++ + - match: '(\{)(perl)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.perl.latex source.perl.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.perl + - match: '(\{)(php)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.php.latex source.php.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.php + - match: '(\{)(python|py)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.python + - match: '(\{)(r)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.r.latex source.r.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.r + - match: '(\{)(ruby)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.ruby.latex source.ruby.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.ruby + - match: '(\{)(sh|shell|bash )(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.shell.latex source.shell.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.shell + - match: '(\{)(sql|mysql|ddl|dml)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.sql.latex source.sql.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.sql + - match: '(\{)(yaml)(\})' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + push: + - meta_include_prototype: false + - meta_content_scope: meta.environment.embedded.yaml.latex source.yaml.embedded + - match: '(?=\\end\{minted\})' + pop: true + - include: scope:source.yaml - match: '' push: - meta_scope: meta.environment.embedded.generic.latex markup.raw.verb.latex @@ -923,7 +1132,7 @@ contexts: push: - meta_scope: meta.environment.verbatim.minted.latex - include: general-optional-arguments - - match: '(\{)(python)(\})((\{)|(\W))' + - match: '(\{)(c)(\})((\{)|(\W))' captures: 1: punctuation.definition.brace.begin.latex 2: variable.parameter.function.latex @@ -933,13 +1142,81 @@ contexts: set: - meta_include_prototype: false - meta_scope: meta.environment.verbatim.minted.latex - - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded + - meta_content_scope: meta.environment.embedded.c.latex source.c.embedded - match: '(\})|(\4)' captures: 1: punctuation.definition.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - - include: scope:source.python + - include: scope:source.c + - match: '(\{)(cpp|c\+\+)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.c++.latex source.c++.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.c++ + - match: '(\{)(diff)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.diff.latex source.diff.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.diff + - match: '(\{)(go|golang)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.go.latex source.go.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.go + - match: '(\{)(haskell|hs)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.haskell.latex source.haskell.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.haskell - match: '(\{)(java)(\})((\{)|(\W))' captures: 1: punctuation.definition.brace.begin.latex @@ -957,6 +1234,261 @@ contexts: 2: punctuation.definition.verb.latex pop: true - include: scope:source.java + - match: '(\{)(javascript|js)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.js.latex source.js.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.js + - match: '(\{)(json)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.json.latex source.json.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.json + - match: '(\{)(tex|latex)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.latex.latex text.tex.latex.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:text.tex.latex + - match: '(\{)(lisp)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.lisp.latex source.lisp.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.lisp + - match: '(\{)(lua)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.lua.latex source.lua.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.lua + - match: '(\{)(obj(?:ective\-|)c)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.objc.latex source.objc.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.objc + - match: '(\{)(obj(?:ective\-|)c\+\+)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.objc++.latex source.objc++.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.objc++ + - match: '(\{)(perl)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.perl.latex source.perl.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.perl + - match: '(\{)(php)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.php.latex source.php.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.php + - match: '(\{)(python|py)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.python + - match: '(\{)(r)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.r.latex source.r.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.r + - match: '(\{)(ruby)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.ruby.latex source.ruby.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.ruby + - match: '(\{)(sh|shell|bash )(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.shell.latex source.shell.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.shell + - match: '(\{)(sql|mysql|ddl|dml)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.sql.latex source.sql.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.sql + - match: '(\{)(yaml)(\})((\{)|(\W))' + captures: + 1: punctuation.definition.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.brace.end.latex + 5: punctuation.definition.brace.begin.latex + 6: punctuation.definition.verb.latex + set: + - meta_include_prototype: false + - meta_scope: meta.environment.verbatim.minted.latex + - meta_content_scope: meta.environment.embedded.yaml.latex source.yaml.embedded + - match: '(\})|(\4)' + captures: + 1: punctuation.definition.brace.begin.latex + 2: punctuation.definition.verb.latex + pop: true + - include: scope:source.yaml - match: '' pop: true From 61a8ba61539384c40b9de5defd233df9f3d1e3aa Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Mon, 30 May 2016 14:54:50 -0400 Subject: [PATCH 29/56] [LaTeX] specific inline and block math env --- LaTeX/LaTeX.sublime-syntax | 12 ++++++------ LaTeX/syntax_test_latex.tex | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 57d3262113..f4b0161598 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -446,7 +446,7 @@ contexts: - match: \$ scope: string.other.math.latex punctuation.definition.string.begin.latex push: - - meta_scope: meta.environment.math.latex + - meta_scope: meta.environment.math.latex meta.environment.math.inline.latex - match: \$ scope: string.other.math.latex punctuation.definition.string.end.latex pop: true @@ -458,7 +458,7 @@ contexts: 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.ensuremath.latex - - meta_content_scope: meta.environment.math.latex + - meta_content_scope: meta.environment.math.latex meta.environment.math.inline.latex - match: '\}' scope: punctuation.definition.brace.end.latex pop: true @@ -468,7 +468,7 @@ contexts: - match: \$\$ scope: string.other.math.latex punctuation.definition.string.begin.latex push: - - meta_scope: meta.environment.math.latex + - meta_scope: meta.environment.math.latex meta.environment.math.block.latex - match: \$\$ scope: string.other.math.latex punctuation.definition.string.end.latex pop: true @@ -477,7 +477,7 @@ contexts: - match: '(\\\[)' scope: string.other.math.latex punctuation.definition.string.begin.latex push: - - meta_scope: meta.environment.math.latex + - meta_scope: meta.environment.math.latex meta.environment.math.block.latex - match: '(\\\])' scope: string.other.math.latex punctuation.definition.string.end.latex pop: true @@ -488,7 +488,7 @@ contexts: captures: 1: punctuation.definition.string.begin.latex push: - - meta_scope: meta.environment.math.latex + - meta_scope: meta.environment.math.latex meta.environment.math.block.latex - match: (\\\)) scope: string.other.math.latex punctuation.definition.string.end.latex pop: true @@ -502,7 +502,7 @@ contexts: 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex push: - - meta_scope: meta.environment.math.latex + - meta_scope: meta.environment.math.latex meta.environment.math.block.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 0ddf9af927..14930c1cdd 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -178,20 +178,20 @@ \subsubsection{name} % Check we have always a shared environment $f(x) = x^2$ -% ^ meta.environment.math.latex +% ^ meta.environment.math.latex meta.environment.math.inline.latex $$f(x) = x^2$$ -% ^ meta.environment.math.latex +% ^ meta.environment.math.latex meta.environment.math.block.latex \(f(x) = x^2\) -% ^ meta.environment.math.latex +% ^ meta.environment.math.latex meta.environment.math.block.latex \[ f(x) = x^2 \text{ $f$ is a function} -% ^ meta.environment.math.latex +% ^ meta.environment.math.latex meta.environment.math.block.latex \] \ensuremath{f(x) = x^2} -% ^ meta.environment.math.latex +% ^ meta.environment.math.latex meta.environment.math.inline.latex \begin{equation} f(x) = x^2 -% ^ meta.environment.math.latex +% ^ meta.environment.math.latex meta.environment.math.block.latex \end{equation} From d3a646ad083138573fccba417f456c6bc67f1bc1 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Mon, 30 May 2016 17:00:19 -0400 Subject: [PATCH 30/56] [LaTeX] improve inline and block math env --- LaTeX/LaTeX.sublime-syntax | 34 +++++++++++++++++----------------- LaTeX/TeX.sublime-syntax | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index f4b0161598..beb651a3d3 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -446,7 +446,7 @@ contexts: - match: \$ scope: string.other.math.latex punctuation.definition.string.begin.latex push: - - meta_scope: meta.environment.math.latex meta.environment.math.inline.latex + - meta_scope: meta.environment.math.inline.dollar.latex - match: \$ scope: string.other.math.latex punctuation.definition.string.end.latex pop: true @@ -458,17 +458,28 @@ contexts: 3: punctuation.definition.brace.begin.latex push: - meta_scope: meta.function.ensuremath.latex - - meta_content_scope: meta.environment.math.latex meta.environment.math.inline.latex + - meta_content_scope: meta.environment.math.inline.ensuremath.latex - match: '\}' scope: punctuation.definition.brace.end.latex pop: true - include: math-content + - match: (\\\() + scope: string.other.math.latex + captures: + 1: punctuation.definition.string.begin.latex + push: + - meta_scope: meta.environment.math.inline.paren.latex + - match: (\\\)) + scope: string.other.math.latex punctuation.definition.string.end.latex + pop: true + - include: math-content + block-math: - match: \$\$ scope: string.other.math.latex punctuation.definition.string.begin.latex push: - - meta_scope: meta.environment.math.latex meta.environment.math.block.latex + - meta_scope: meta.environment.math.block.dollar.latex - match: \$\$ scope: string.other.math.latex punctuation.definition.string.end.latex pop: true @@ -477,24 +488,13 @@ contexts: - match: '(\\\[)' scope: string.other.math.latex punctuation.definition.string.begin.latex push: - - meta_scope: meta.environment.math.latex meta.environment.math.block.latex + - meta_scope: meta.environment.math.block.bracket.latex - match: '(\\\])' scope: string.other.math.latex punctuation.definition.string.end.latex pop: true - include: math-content - - match: (\\\() - scope: string.other.math.latex - captures: - 1: punctuation.definition.string.begin.latex - push: - - meta_scope: meta.environment.math.latex meta.environment.math.block.latex - - match: (\\\)) - scope: string.other.math.latex punctuation.definition.string.end.latex - pop: true - - include: math-content - - - match: '((\\)begin)(\{)\s*((?:align|alignat|aligned|alignedat|displaymath|displaymath|eqnarray|equation|flalign|gather|gathered|math|multline|xalignat)\*?)\s*(\})' + - match: '((\\)begin)(\{)\s*((?:align|alignat|aligned|alignedat|displaymath|eqnarray|equation|flalign|gather|gathered|math|multline|x?xalignat|split)\*?)\s*(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex @@ -502,7 +502,7 @@ contexts: 4: variable.parameter.function.latex 5: punctuation.definition.brace.end.latex push: - - meta_scope: meta.environment.math.latex meta.environment.math.block.latex + - meta_scope: meta.environment.math.block.be.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index a87f1271a7..923df3c88c 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -170,7 +170,7 @@ contexts: - match: \$ scope: string.other.math.tex punctuation.definition.string.begin.tex push: - - meta_scope: meta.environment.math.tex + - meta_scope: meta.environment.math.inline.dollar.tex - match: \$ scope: string.other.math.tex punctuation.definition.string.end.tex pop: true @@ -180,7 +180,7 @@ contexts: - match: \$\$ scope: string.other.math.tex punctuation.definition.string.begin.tex push: - - meta_scope: meta.environment.math.tex + - meta_scope: meta.environment.math.block.dollar.tex - match: \$\$ scope: string.other.math.tex punctuation.definition.string.end.tex pop: true From 73c15bfc7b50e75865eb1dd81abb3c245a06a56b Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Wed, 1 Jun 2016 17:21:37 -0400 Subject: [PATCH 31/56] [LaTeX] allow newcommand* --- LaTeX/LaTeX.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index beb651a3d3..6ec15dfcfa 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -159,7 +159,7 @@ contexts: (?x) ( (\\) - (?:(?:re)?newcommand) + (?:(?:re)?newcommand\*?) ) (?: (\{)(\\[A-Za-z@]+)(\}) From b1c7b6b47295215c43bf4b41882b259dbfc95128 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Thu, 2 Jun 2016 12:37:57 -0400 Subject: [PATCH 32/56] [Haskell] Use meta.group.brace and meta.group.bracket --- Haskell/Literate Haskell.sublime-syntax | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Haskell/Literate Haskell.sublime-syntax b/Haskell/Literate Haskell.sublime-syntax index 11d500114d..482ba775a2 100644 --- a/Haskell/Literate Haskell.sublime-syntax +++ b/Haskell/Literate Haskell.sublime-syntax @@ -20,11 +20,11 @@ contexts: global-braces: - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.braces.latex + - meta_scope: meta.group.brace.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main @@ -33,9 +33,9 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_scope: meta.function.embedded.haskell.latex - meta_content_scope: source.haskell.embedded.latex @@ -43,8 +43,8 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true - include: scope:source.haskell From 22909f2bea388a673642214e52ca1cb8dc364217 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Thu, 2 Jun 2016 12:38:07 -0400 Subject: [PATCH 33/56] [R] Use meta.group.brace and meta.group.bracket --- R/Rd (R Documentation).sublime-syntax | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/R/Rd (R Documentation).sublime-syntax b/R/Rd (R Documentation).sublime-syntax index b8a937c7d8..9e01b5eae7 100644 --- a/R/Rd (R Documentation).sublime-syntax +++ b/R/Rd (R Documentation).sublime-syntax @@ -20,11 +20,11 @@ contexts: global-braces: - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.braces.latex + - meta_scope: meta.group.brace.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main @@ -37,13 +37,13 @@ contexts: captures: 1: support.function.deqn.rd 2: punctuation.definition.backslash.rd - 3: punctuation.definition.brace.begin.rd + 3: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.function.deqn.rd - meta_content_scope: meta.environment.math.latex - include: scope:text.tex.latex#math-content - match: '\}' - scope: punctuation.definition.brace.end.rd + scope: punctuation.definition.group.brace.end.rd pop: true eqn: @@ -51,13 +51,13 @@ contexts: captures: 1: support.function.eqn.rd 2: punctuation.definition.backslash.rd - 3: punctuation.definition.brace.begin.rd + 3: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.function.eqn.rd - meta_content_scope: meta.environment.math.latex - include: scope:text.tex.latex#math-content - match: '\}' - scope: punctuation.definition.brace.end.rd + scope: punctuation.definition.group.brace.end.rd pop: true r-code: @@ -65,12 +65,12 @@ contexts: captures: 1: support.function.code.rd 2: punctuation.definition.backslash.rd - 3: punctuation.definition.brace.begin.rd + 3: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.function.code.rd - meta_content_scope: source.r.embedded - match: '\}' - scope: punctuation.definition.brace.end.rd + scope: punctuation.definition.group.brace.end.rd pop: true - match: \\% - include: scope:source.r @@ -78,14 +78,14 @@ contexts: captures: 1: support.function.sexpr.rd 2: punctuation.definition.backslash.rd - 3: punctuation.definition.bracket.begin.rd - 4: punctuation.definition.bracket.end.rd - 5: punctuation.definition.brace.begin.rd + 3: punctuation.definition.group.bracket.begin.rd + 4: punctuation.definition.group.bracket.end.rd + 5: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.function.sexpr.rd - meta_content_scope: source.r.embedded - match: '\}' - scope: punctuation.definition.brace.end.rd + scope: punctuation.definition.group.brace.end.rd pop: true - match: \\% - include: scope:source.r @@ -93,12 +93,12 @@ contexts: captures: 1: support.function.usage.rd 2: punctuation.definition.backslash.rd - 3: punctuation.definition.brace.begin.rd + 3: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.function.usage.rd - meta_content_scope: source.r.embedded - match: '\}' - scope: punctuation.definition.brace.end.rd + scope: punctuation.definition.group.brace.end.rd pop: true - match: \\% - include: scope:source.r @@ -106,12 +106,12 @@ contexts: captures: 1: support.function.examples.rd 2: punctuation.definition.backslash.rd - 3: punctuation.definition.brace.begin.rd + 3: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.function.examples.rd - meta_content_scope: source.r.embedded - match: '\}' - scope: punctuation.definition.brace.end.rd + scope: punctuation.definition.group.brace.end.rd pop: true - match: \\% - include: scope:source.r @@ -121,13 +121,13 @@ contexts: captures: 1: keyword.other.section.rd 2: punctuation.definition.function.rd - 3: punctuation.definition.arguments.begin.rd + 3: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.section.rd - meta_content_scope: entity.name.function.rd - match: '(\})' captures: - 1: punctuation.definition.arguments.end.rd + 1: punctuation.definition.group.brace.end.rd pop: true - include: main @@ -135,11 +135,11 @@ contexts: captures: 1: keyword.other.section.rd 2: punctuation.definition.function.rd - 3: punctuation.definition.arguments.begin.rd + 3: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.section.rd - match: '(\})' captures: - 1: punctuation.definition.arguments.end.rd + 1: punctuation.definition.group.brace.end.rd pop: true - include: main From 726ba7bbc7ea3b31518d5435ced1873641aec2ae Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Thu, 2 Jun 2016 12:38:17 -0400 Subject: [PATCH 34/56] [LaTeX] Use meta.group.brace and meta.group.bracket --- LaTeX/LaTeX.sublime-syntax | 472 ++++++++++++++++++------------------- LaTeX/TeX.sublime-syntax | 26 +- 2 files changed, 249 insertions(+), 249 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 6ec15dfcfa..8ccc23d44b 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -45,34 +45,34 @@ contexts: global-braces: - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.braces.latex + - meta_scope: meta.group.brace.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main # these are used to identify arguments in commands general-optional-arguments: - match: '\[' - scope: punctuation.definition.bracket.begin.latex + scope: punctuation.definition.group.bracket.begin.latex push: - - meta_scope: meta.group.argument.optional.latex + - meta_scope: meta.group.bracket.latex - match: '\]' - scope: punctuation.definition.bracket.end.latex + scope: punctuation.definition.group.bracket.end.latex pop: true - include: general-constants - include: general-commands _general-1-more-argument: - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex set: - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.argument.latex + - meta_scope: meta.group.brace.latex - match: '(?=\})' pop: true - include: main @@ -81,12 +81,12 @@ contexts: _general-2-more-arguments: - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex set: - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.argument.latex + - meta_scope: meta.group.brace.latex - include: _general-1-more-argument - match: '(?=\})' pop: true @@ -96,35 +96,35 @@ contexts: general-1-argument: - match: '\}' - scope: meta.group.argument.latex punctuation.definition.brace.end.latex + scope: meta.group.brace.latex punctuation.definition.group.brace.end.latex pop: true - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.argument.latex + - meta_scope: meta.group.brace.latex - match: '(?=\})' pop: true - include: main general-2-arguments: - match: '\}' - scope: meta.group.argument.latex punctuation.definition.brace.end.latex + scope: meta.group.brace.latex punctuation.definition.group.brace.end.latex pop: true - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.argument.latex + - meta_scope: meta.group.brace.latex - include: _general-1-more-argument - include: main general-3-arguments: - match: '\}' - scope: meta.group.argument.latex punctuation.definition.brace.end.latex + scope: meta.group.brace.latex punctuation.definition.group.brace.end.latex pop: true - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.argument.latex + - meta_scope: meta.group.brace.latex - include: _general-2-more-arguments - include: main @@ -143,11 +143,11 @@ contexts: # used in macros to prevent matching of \begin{env}...\end{env} macro-braces: - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.braces.latex + - meta_scope: meta.group.brace.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: general-constants - include: general-commands @@ -170,17 +170,17 @@ contexts: captures: 1: support.function.newcommand.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: support.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex 6: support.function.latex - 7: punctuation.definition.bracket.begin.latex - 8: punctuation.definition.bracket.end.latex - 9: punctuation.definition.brace.begin.latex + 7: punctuation.definition.group.bracket.begin.latex + 8: punctuation.definition.group.bracket.end.latex + 9: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.newcommand.tex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: general-constants - include: general-commands @@ -190,10 +190,10 @@ contexts: - match: '(\\\\)(?:(\[)\s*-?([[:digit:]]*)\s*(\w*)\s*(\]))?' captures: 1: constant.character.newline.latex - 2: punctuation.definition.bracket.begin.newline.latex + 2: punctuation.definition.group.bracket.begin.newline.latex 3: constant.numeric.newline.latex 4: keyword.other.newline.latex - 5: punctuation.definition.bracket.begin.newline.latex + 5: punctuation.definition.group.bracket.begin.newline.latex - include: scope:text.tex#general-constants general-commands: @@ -207,11 +207,11 @@ contexts: captures: 1: support.function.box.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.box.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)(?:framebox|makebox))(?=(?:\[[^\]]*?\])*\{)' @@ -244,7 +244,7 @@ contexts: push: - meta_scope: meta.preamble.documentclass.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: general-optional-arguments - match: '\{' @@ -259,7 +259,7 @@ contexts: push: - meta_scope: meta.preamble.usepackage.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: general-optional-arguments - match: '\{' @@ -275,11 +275,11 @@ contexts: captures: 1: keyword.control.include.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.include.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true sections: @@ -302,15 +302,15 @@ contexts: captures: 1: support.function.section.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: entity.name.section.latex - 5: punctuation.definition.brace.end.latex - 6: punctuation.definition.brace.begin.latex + 5: punctuation.definition.group.brace.end.latex + 6: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.section.latex - meta_content_scope: entity.name.section.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main @@ -327,7 +327,7 @@ contexts: 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.bebgin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_scope: meta.environment.verbatim.verbatim.latex @@ -336,9 +336,9 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true lists: @@ -346,82 +346,82 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_scope: meta.environment.list.itemize.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)begin)(\{)\s*(enumerate\*?)\s*(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_scope: meta.environment.list.enumerate.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)begin)(\{)\s*(list\*?)\s*(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_scope: meta.environment.list.list.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)begin)(\{)\s*(description\*?)\s*(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_scope: meta.environment.list.description.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true - include: main math-braces: - match: '\{' - scope: punctuation.definition.brace.begin.latex + scope: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.group.braces.latex + - meta_scope: meta.group.brace.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: math-content @@ -455,12 +455,12 @@ contexts: captures: 1: support.function.ensuremath.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.ensuremath.latex - meta_content_scope: meta.environment.math.inline.ensuremath.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: math-content @@ -498,18 +498,18 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_scope: meta.environment.math.block.be.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true - include: math-content @@ -519,9 +519,9 @@ contexts: captures: 1: support.function.url.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: markup.underline.link.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex invalid-quotations: - match: "(?:^|[^\\S])('.*?')" @@ -550,82 +550,82 @@ contexts: captures: 1: support.function.emph.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.emph.latex - meta_content_scope: markup.italic.emph.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)textit)(\{)' captures: 1: support.function.textit.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.textit.latex - meta_content_scope: markup.italic.textit.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)textbf)(\{)' captures: 1: support.function.textbf.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.textbf.latex - meta_content_scope: markup.bold.textbf.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)texttt)(\{)' captures: 1: support.function.texttt.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.texttt.latex - meta_content_scope: markup.raw.texttt.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)textsl)(\{)' captures: 1: support.function.textsl.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.textsl.latex - meta_content_scope: markup.italic.textsl.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)text)(\{)' captures: 1: support.function.text.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main - match: '((\\)underline)(\{)' captures: 1: support.function.text.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.underline.latex - meta_content_scope: markup.underline.underline.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true - include: main @@ -648,11 +648,11 @@ contexts: captures: 1: support.function.label.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.label.latex - match: '\}' - scope: punctuation.definition.brace.end.latex + scope: punctuation.definition.group.brace.end.latex pop: true begin-end-commands: @@ -660,9 +660,9 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - include: general-optional-arguments - match: '' @@ -671,9 +671,9 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex # external packages packages: @@ -705,9 +705,9 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_scope: meta.environment.verbatim.lstlisting.latex @@ -715,9 +715,9 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true - include: general-optional-arguments - match: '.*(%\s*(?i:c))$' @@ -870,9 +870,9 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_scope: meta.environment.verbatim.minted.latex @@ -880,16 +880,16 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true - include: general-optional-arguments - match: '(\{)(c)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.c.latex source.c.embedded @@ -898,9 +898,9 @@ contexts: - include: scope:source.c - match: '(\{)(cpp|c\+\+)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.c++.latex source.c++.embedded @@ -909,9 +909,9 @@ contexts: - include: scope:source.c++ - match: '(\{)(diff)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.diff.latex source.diff.embedded @@ -920,9 +920,9 @@ contexts: - include: scope:source.diff - match: '(\{)(go|golang)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.go.latex source.go.embedded @@ -931,9 +931,9 @@ contexts: - include: scope:source.go - match: '(\{)(haskell|hs)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.haskell.latex source.haskell.embedded @@ -942,9 +942,9 @@ contexts: - include: scope:source.haskell - match: '(\{)(java)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.java.latex source.java.embedded @@ -953,9 +953,9 @@ contexts: - include: scope:source.java - match: '(\{)(javascript|js)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.js.latex source.js.embedded @@ -964,9 +964,9 @@ contexts: - include: scope:source.js - match: '(\{)(json)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.json.latex source.json.embedded @@ -975,9 +975,9 @@ contexts: - include: scope:source.json - match: '(\{)(tex|latex)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.latex.latex text.tex.latex.embedded @@ -986,9 +986,9 @@ contexts: - include: scope:text.tex.latex - match: '(\{)(lisp)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.lisp.latex source.lisp.embedded @@ -997,9 +997,9 @@ contexts: - include: scope:source.lisp - match: '(\{)(lua)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.lua.latex source.lua.embedded @@ -1008,9 +1008,9 @@ contexts: - include: scope:source.lua - match: '(\{)(obj(?:ective\-|)c)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.objc.latex source.objc.embedded @@ -1019,9 +1019,9 @@ contexts: - include: scope:source.objc - match: '(\{)(obj(?:ective\-|)c\+\+)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.objc++.latex source.objc++.embedded @@ -1030,9 +1030,9 @@ contexts: - include: scope:source.objc++ - match: '(\{)(perl)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.perl.latex source.perl.embedded @@ -1041,9 +1041,9 @@ contexts: - include: scope:source.perl - match: '(\{)(php)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.php.latex source.php.embedded @@ -1052,9 +1052,9 @@ contexts: - include: scope:source.php - match: '(\{)(python|py)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded @@ -1063,9 +1063,9 @@ contexts: - include: scope:source.python - match: '(\{)(r)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.r.latex source.r.embedded @@ -1074,9 +1074,9 @@ contexts: - include: scope:source.r - match: '(\{)(ruby)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.ruby.latex source.ruby.embedded @@ -1085,9 +1085,9 @@ contexts: - include: scope:source.ruby - match: '(\{)(sh|shell|bash )(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.shell.latex source.shell.embedded @@ -1096,9 +1096,9 @@ contexts: - include: scope:source.shell - match: '(\{)(sql|mysql|ddl|dml)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.sql.latex source.sql.embedded @@ -1107,9 +1107,9 @@ contexts: - include: scope:source.sql - match: '(\{)(yaml)(\})' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex + 3: punctuation.definition.group.brace.end.latex push: - meta_include_prototype: false - meta_content_scope: meta.environment.embedded.yaml.latex source.yaml.embedded @@ -1134,10 +1134,10 @@ contexts: - include: general-optional-arguments - match: '(\{)(c)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1145,16 +1145,16 @@ contexts: - meta_content_scope: meta.environment.embedded.c.latex source.c.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.c - match: '(\{)(cpp|c\+\+)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1162,16 +1162,16 @@ contexts: - meta_content_scope: meta.environment.embedded.c++.latex source.c++.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.c++ - match: '(\{)(diff)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1179,16 +1179,16 @@ contexts: - meta_content_scope: meta.environment.embedded.diff.latex source.diff.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.diff - match: '(\{)(go|golang)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1196,16 +1196,16 @@ contexts: - meta_content_scope: meta.environment.embedded.go.latex source.go.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.go - match: '(\{)(haskell|hs)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1213,16 +1213,16 @@ contexts: - meta_content_scope: meta.environment.embedded.haskell.latex source.haskell.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.haskell - match: '(\{)(java)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1230,16 +1230,16 @@ contexts: - meta_content_scope: meta.environment.embedded.java.latex source.java.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.java - match: '(\{)(javascript|js)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1247,16 +1247,16 @@ contexts: - meta_content_scope: meta.environment.embedded.js.latex source.js.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.js - match: '(\{)(json)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1264,16 +1264,16 @@ contexts: - meta_content_scope: meta.environment.embedded.json.latex source.json.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.json - match: '(\{)(tex|latex)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1281,16 +1281,16 @@ contexts: - meta_content_scope: meta.environment.embedded.latex.latex text.tex.latex.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:text.tex.latex - match: '(\{)(lisp)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1298,16 +1298,16 @@ contexts: - meta_content_scope: meta.environment.embedded.lisp.latex source.lisp.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.lisp - match: '(\{)(lua)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1315,16 +1315,16 @@ contexts: - meta_content_scope: meta.environment.embedded.lua.latex source.lua.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.lua - match: '(\{)(obj(?:ective\-|)c)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1332,16 +1332,16 @@ contexts: - meta_content_scope: meta.environment.embedded.objc.latex source.objc.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.objc - match: '(\{)(obj(?:ective\-|)c\+\+)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1349,16 +1349,16 @@ contexts: - meta_content_scope: meta.environment.embedded.objc++.latex source.objc++.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.objc++ - match: '(\{)(perl)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1366,16 +1366,16 @@ contexts: - meta_content_scope: meta.environment.embedded.perl.latex source.perl.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.perl - match: '(\{)(php)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1383,16 +1383,16 @@ contexts: - meta_content_scope: meta.environment.embedded.php.latex source.php.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.php - match: '(\{)(python|py)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1400,16 +1400,16 @@ contexts: - meta_content_scope: meta.environment.embedded.python.latex source.python.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.python - match: '(\{)(r)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1417,16 +1417,16 @@ contexts: - meta_content_scope: meta.environment.embedded.r.latex source.r.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.r - match: '(\{)(ruby)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1434,16 +1434,16 @@ contexts: - meta_content_scope: meta.environment.embedded.ruby.latex source.ruby.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.ruby - match: '(\{)(sh|shell|bash )(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1451,16 +1451,16 @@ contexts: - meta_content_scope: meta.environment.embedded.shell.latex source.shell.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.shell - match: '(\{)(sql|mysql|ddl|dml)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1468,16 +1468,16 @@ contexts: - meta_content_scope: meta.environment.embedded.sql.latex source.sql.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.sql - match: '(\{)(yaml)(\})((\{)|(\W))' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: variable.parameter.function.latex - 3: punctuation.definition.brace.end.latex - 5: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex 6: punctuation.definition.verb.latex set: - meta_include_prototype: false @@ -1485,7 +1485,7 @@ contexts: - meta_content_scope: meta.environment.embedded.yaml.latex source.yaml.embedded - match: '(\})|(\4)' captures: - 1: punctuation.definition.brace.begin.latex + 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex pop: true - include: scope:source.yaml @@ -1509,9 +1509,9 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_scope: meta.environment.comment.latex - meta_content_scope: comment.block.environment.comment.latex @@ -1519,9 +1519,9 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true # beamer support @@ -1530,18 +1530,18 @@ contexts: captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex push: - meta_scope: meta.environment.frame.latex - match: '((\\)end)(\{)(frame)(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex pop: true - include: frametitles - include: main @@ -1552,6 +1552,6 @@ contexts: captures: 1: support.function.frametitle.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.brace.begin.latex + 3: punctuation.definition.group.brace.begin.latex 4: entity.name.function.frame.latex - 5: punctuation.definition.brace.end.latex + 5: punctuation.definition.group.brace.end.latex diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 923df3c88c..e977e85275 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -62,21 +62,21 @@ contexts: braces: - match: '\{' - scope: punctuation.definition.brace.begin.tex + scope: punctuation.definition.group.brace.begin.tex push: - - meta_scope: meta.group.braces.tex + - meta_scope: meta.group.brace.tex - match: '\}' - scope: punctuation.definition.brace.end.tex + scope: punctuation.definition.group.brace.end.tex pop: true - include: main macro-braces: - match: '\{' - scope: punctuation.definition.brace.begin.tex + scope: punctuation.definition.group.brace.begin.tex push: - - meta_scope: meta.group.braces.tex + - meta_scope: meta.group.brace.tex - match: '\}' - scope: punctuation.definition.brace.end.tex + scope: punctuation.definition.group.brace.end.tex pop: true - include: general-constants - include: general-commands @@ -87,11 +87,11 @@ contexts: captures: 1: support.function.box.tex 2: punctuation.definition.backslash.tex - 3: punctuation.definition.brace.begin.tex + 3: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.function.box.tex - match: '\}' - scope: punctuation.definition.brace.end.tex + scope: punctuation.definition.group.brace.end.tex pop: true - include: main @@ -101,11 +101,11 @@ contexts: 1: support.function.definition.tex 2: support.function.general.tex 3: punctuation.definition.backslash.tex - 4: punctuation.definition.brace.begin.tex + 4: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.function.definition.tex - match: '\}' - scope: punctuation.definition.brace.end.tex + scope: punctuation.definition.group.brace.end.tex pop: true - include: general-constants - include: general-commands @@ -129,11 +129,11 @@ contexts: math-braces: - match: '\{' - scope: punctuation.definition.brace.begin.tex + scope: punctuation.definition.group.brace.begin.tex push: - - meta_scope: meta.group.braces.tex + - meta_scope: meta.group.brace.tex - match: '\}' - scope: punctuation.definition.brace.end.tex + scope: punctuation.definition.group.brace.end.tex pop: true - include: math-content From 85678707eddb571a2a506c7b6387243ef8bc99f4 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 4 Jun 2016 00:07:54 -0400 Subject: [PATCH 35/56] [LaTeX] fix tests --- LaTeX/syntax_test_latex.tex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 14930c1cdd..0b098e3b28 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -178,20 +178,20 @@ \subsubsection{name} % Check we have always a shared environment $f(x) = x^2$ -% ^ meta.environment.math.latex meta.environment.math.inline.latex +% ^ meta.environment.math.inline $$f(x) = x^2$$ -% ^ meta.environment.math.latex meta.environment.math.block.latex +% ^ meta.environment.math.block \(f(x) = x^2\) -% ^ meta.environment.math.latex meta.environment.math.block.latex +% ^ meta.environment.math.inline \[ f(x) = x^2 \text{ $f$ is a function} -% ^ meta.environment.math.latex meta.environment.math.block.latex +% ^ meta.environment.math.block \] \ensuremath{f(x) = x^2} -% ^ meta.environment.math.latex meta.environment.math.inline.latex +% ^ meta.environment.math.inline \begin{equation} f(x) = x^2 -% ^ meta.environment.math.latex meta.environment.math.block.latex +% ^ meta.environment.math.block \end{equation} From 3a98fff7831dc053137ca84ce6d3ad34a9ab997c Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Mon, 13 Jun 2016 17:42:57 -0400 Subject: [PATCH 36/56] [LaTeX] remove invalid quotation --- LaTeX/LaTeX.sublime-syntax | 9 --------- 1 file changed, 9 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 8ccc23d44b..6bea6ef623 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -28,7 +28,6 @@ contexts: - include: verbatim - include: verb - include: url - - include: invalid-quotations - include: lists plain-tex: @@ -523,14 +522,6 @@ contexts: 4: markup.underline.link.latex 5: punctuation.definition.group.brace.end.latex - invalid-quotations: - - match: "(?:^|[^\\S])('.*?')" - captures: - 1: invalid.illegal.string.quoted.single.latex - - match: '(?:^|[^\\S])(".*?")' - captures: - 1: invalid.illegal.string.quoted.single.latex - verb: - match: ((\\)verb)(\W) captures: From ea31302623688a98c7256d21d409777266582b9b Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 25 Jun 2016 09:57:52 -0400 Subject: [PATCH 37/56] [R] update math scope name --- R/Rd (R Documentation).sublime-syntax | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/Rd (R Documentation).sublime-syntax b/R/Rd (R Documentation).sublime-syntax index 9e01b5eae7..804364bc9f 100644 --- a/R/Rd (R Documentation).sublime-syntax +++ b/R/Rd (R Documentation).sublime-syntax @@ -40,7 +40,7 @@ contexts: 3: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.function.deqn.rd - - meta_content_scope: meta.environment.math.latex + - meta_content_scope: meta.environment.math - include: scope:text.tex.latex#math-content - match: '\}' scope: punctuation.definition.group.brace.end.rd @@ -54,7 +54,7 @@ contexts: 3: punctuation.definition.group.brace.begin.rd push: - meta_scope: meta.function.eqn.rd - - meta_content_scope: meta.environment.math.latex + - meta_content_scope: meta.environment.math - include: scope:text.tex.latex#math-content - match: '\}' scope: punctuation.definition.group.brace.end.rd From 05f94e913caf3b5b77a664ae662faac0b2ee9ad2 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Tue, 28 Jun 2016 21:40:27 +0200 Subject: [PATCH 38/56] [LaTeX] Let \input end with word boundaries --- LaTeX/TeX.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index e977e85275..5c0d3bd0ed 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -46,7 +46,7 @@ contexts: captures: 1: keyword.control.tex 2: punctuation.definition.backslash.tex - - match: '((\\)(?:input))' + - match: '((\\)(?:input))\b' scope: meta.function.input.tex captures: 1: keyword.control.input.tex From 8eb7a8cb3316264d8fb5bdebfe4c2267bf6d8876 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 1 Jul 2016 15:06:54 -0400 Subject: [PATCH 39/56] [LaTeX] apply storage.modifier and entity.name to \def and \newcommand --- LaTeX/LaTeX.sublime-syntax | 4 ++-- LaTeX/Symbol List - Commands.tmPreferences | 16 ++++++++++++++++ LaTeX/TeX.sublime-syntax | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 LaTeX/Symbol List - Commands.tmPreferences diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 6bea6ef623..090a9ddb03 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -167,10 +167,10 @@ contexts: (?:(\[)(?:[^\]]*)(\]))? (\{) captures: - 1: support.function.newcommand.latex + 1: support.function.newcommand.latex storage.modifier.newcommand.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex - 4: support.function.latex + 4: support.function.latex entity.name.newcommand.latex 5: punctuation.definition.group.brace.end.latex 6: support.function.latex 7: punctuation.definition.group.bracket.begin.latex diff --git a/LaTeX/Symbol List - Commands.tmPreferences b/LaTeX/Symbol List - Commands.tmPreferences new file mode 100644 index 0000000000..022d409add --- /dev/null +++ b/LaTeX/Symbol List - Commands.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List + scope + entity.name.newcommand.latex, entity.name.definition.latex + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 5c0d3bd0ed..6d1d6a1dfe 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -98,8 +98,8 @@ contexts: macros: - match: '(\\def)\s*((\\)[A-Za-z@]+)\s*[^\{]*?\s*(\{)' captures: - 1: support.function.definition.tex - 2: support.function.general.tex + 1: support.function.definition.tex storage.modifier.definition.tex + 2: support.function.general.tex entity.name.definition.tex 3: punctuation.definition.backslash.tex 4: punctuation.definition.group.brace.begin.tex push: From e5ba2774468088954d941c3a45e1d6a217b50ef5 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 1 Jul 2016 15:13:29 -0400 Subject: [PATCH 40/56] [LaTeX] add DeclareMathOperator --- LaTeX/LaTeX.sublime-syntax | 32 +++++++++++++++++++++- LaTeX/Symbol List - Commands.tmPreferences | 6 ++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 090a9ddb03..cfbfb9cd56 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -177,7 +177,37 @@ contexts: 8: punctuation.definition.group.bracket.end.latex 9: punctuation.definition.group.brace.begin.latex push: - - meta_scope: meta.function.newcommand.tex + - meta_scope: meta.function.newcommand.latex + - match: '\}' + scope: punctuation.definition.group.brace.end.latex + pop: true + - include: general-constants + - include: general-commands + - include: macro-braces + - match: |- + (?x) + ( + (\\) + DeclareMathOperator\*? + ) + (?: + (\{)(\\[A-Za-z@]+)(\}) + | (\\[A-Za-z@])+ + ) + (?:(\[)(?:[^\]]*)(\]))? + (\{) + captures: + 1: support.function.declare-math-operator.latex storage.modifier.declare-math-operator.latex + 2: punctuation.definition.backslash.latex + 3: punctuation.definition.group.brace.begin.latex + 4: support.function.latex entity.name.declare-math-operator.latex + 5: punctuation.definition.group.brace.end.latex + 6: support.function.latex + 7: punctuation.definition.group.bracket.begin.latex + 8: punctuation.definition.group.bracket.end.latex + 9: punctuation.definition.group.brace.begin.latex + push: + - meta_scope: meta.function.declare-math-operator.latex - match: '\}' scope: punctuation.definition.group.brace.end.latex pop: true diff --git a/LaTeX/Symbol List - Commands.tmPreferences b/LaTeX/Symbol List - Commands.tmPreferences index 022d409add..b5e7f119a8 100644 --- a/LaTeX/Symbol List - Commands.tmPreferences +++ b/LaTeX/Symbol List - Commands.tmPreferences @@ -4,13 +4,13 @@ name Symbol List scope - entity.name.newcommand.latex, entity.name.definition.latex + entity.name.newcommand.latex, entity.name.declare-math-operator.latex, entity.name.definition.tex settings showInSymbolList 1 - showInIndexedSymbolList - 1 + showInIndexedSymbolList + 1 From b187f783ac9f2d5e7b059b32ee4ec6139820d113 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 1 Jul 2016 16:17:35 -0400 Subject: [PATCH 41/56] [LaTeX] capture the content of \cite, \label and \ref --- LaTeX/LaTeX.sublime-syntax | 43 ++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index cfbfb9cd56..606e07953d 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -651,20 +651,53 @@ contexts: - include: main references: - - match: '((\\)(?:[cC]ite(?:author|title|year|date|url)?|(?:[pP]aren|foot|[tT]ext|[sS]mart|super|[aA]|no|full|footfull)cite|footcitetext)\*?)(?=(?:\[[^\]]*?\])*\{)' + - match: |- + (?x) + ( + (\\) + (?: + [cC]ite(?:author|title|year|date|url)? + | (?:[pP]aren|foot|[tT]ext|[sS]mart|super|[aA]|no|full|footfull)cite|footcitetext + ) + \*? + ) + (?:(\[)(?:[^\]]*)(\])){0,2} + (\{) captures: 1: support.function.cite.latex 2: punctuation.definition.backslash.latex + 3: punctuation.definition.group.bracket.begin.latex + 4: punctuation.definition.group.bracket.end.latex + 5: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.citation.latex - - include: general-1-argument-with-options - - match: '((\\)(?:eq|c?page|[vV]|auto|name|[cC])?ref\*?)(?=(?:\[[^\]]*?\])*\{)' + - match: '[a-zA-Z0-9\.:/*!^_-]+' + scope: constant.other.citation.latex + - match: '\}' + scope: punctuation.definition.group.brace.end.latex + pop: true + - match: |- + (?x) + ( + (\\) + (?:eq|c?page|[vV]|auto|name|[cC])?ref + \*? + ) + (?:(\[)(?:[^\]]*)(\])){0,2} + (\{) captures: 1: support.function.reference.latex 2: punctuation.definition.backslash.latex + 3: punctuation.definition.group.bracket.begin.latex + 4: punctuation.definition.group.bracket.end.latex + 5: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.reference.latex - - include: general-1-argument-with-options + - match: '[a-zA-Z0-9\.:/*!^_-]+' + scope: constant.other.reference.latex + - match: '\}' + scope: punctuation.definition.group.brace.end.latex + pop: true - match: '((\\)label)(\{)' captures: 1: support.function.label.latex @@ -672,6 +705,8 @@ contexts: 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.label.latex + - match: '[a-zA-Z0-9\.:/*!^_-]+' + scope: constant.other.label.latex - match: '\}' scope: punctuation.definition.group.brace.end.latex pop: true From 786c0b98ed8433e11030c144d740ed190c989b90 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 1 Jul 2016 17:12:46 -0400 Subject: [PATCH 42/56] [LaTeX] apply entity.name.label to label and add spelling_selector --- LaTeX/LaTeX.sublime-settings | 4 ++++ LaTeX/LaTeX.sublime-syntax | 8 ++++---- LaTeX/Symbol List - Labels.tmPreferences | 10 +--------- 3 files changed, 9 insertions(+), 13 deletions(-) create mode 100644 LaTeX/LaTeX.sublime-settings diff --git a/LaTeX/LaTeX.sublime-settings b/LaTeX/LaTeX.sublime-settings new file mode 100644 index 0000000000..551a0f401c --- /dev/null +++ b/LaTeX/LaTeX.sublime-settings @@ -0,0 +1,4 @@ +{ + "spelling_selector": "-(comment, source, constant, keyword, storage, support, variable, markup.underline.link, meta.tag, meta.preamble, meta.include, meta.function.citation, meta.function.reference, meta.function.label)", + "word_separators": "_./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?" +} diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 606e07953d..93547c70a7 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -278,7 +278,7 @@ contexts: - include: general-optional-arguments - match: '\{' set: - - meta_content_scope: support.class.latex + - meta_content_scope: meta.preamble.documentclass.latex support.class.latex - match: (?=\}) pop: true - match: '(\\)usepackage\b' @@ -294,7 +294,7 @@ contexts: - match: '\{' set: - match: '[A-Za-z[:digit:]-]*' - scope: support.class.latex + scope: meta.preamble.usepackage.latex support.class.latex - match: (?=\}) pop: true @@ -656,7 +656,7 @@ contexts: ( (\\) (?: - [cC]ite(?:author|title|year|date|url)? + [cC]ite(?:author|title|year|date|url|t|p|alt|alp|text)? | (?:[pP]aren|foot|[tT]ext|[sS]mart|super|[aA]|no|full|footfull)cite|footcitetext ) \*? @@ -706,7 +706,7 @@ contexts: push: - meta_scope: meta.function.label.latex - match: '[a-zA-Z0-9\.:/*!^_-]+' - scope: constant.other.label.latex + scope: entity.name.label.latex - match: '\}' scope: punctuation.definition.group.brace.end.latex pop: true diff --git a/LaTeX/Symbol List - Labels.tmPreferences b/LaTeX/Symbol List - Labels.tmPreferences index 7c8ae315e7..6f435bf2eb 100644 --- a/LaTeX/Symbol List - Labels.tmPreferences +++ b/LaTeX/Symbol List - Labels.tmPreferences @@ -4,21 +4,13 @@ name Symbol List scope - meta.function.label.latex + entity.name.label.latex settings showInSymbolList 1 showInIndexedSymbolList 1 - symbolTransformation - - s/\\label\{([^\}]+)\}/Label: $1/g; - - symbolIndexTransformation - - s/\\label\{([^\}]+)\}/Label: $1/g; - From c5defddf90b95353cca1d423b197681d80208f38 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 1 Jul 2016 18:22:58 -0400 Subject: [PATCH 43/56] [LaTeX] highlight the options in usepackage and documentclass --- LaTeX/LaTeX.sublime-syntax | 58 +++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 93547c70a7..a72d6ad758 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -266,37 +266,58 @@ contexts: - include: general-1-argument-with-options preamble: - - match: '(\\)documentclass\b' + - match: '(\\)documentclass(?=(?:\[[^\]]*?\])*\{)' captures: 0: keyword.control.preamble.latex 1: punctuation.definition.backslash.latex push: - meta_scope: meta.preamble.documentclass.latex - - match: '\}' - scope: punctuation.definition.group.brace.end.latex - pop: true - - include: general-optional-arguments + - match: '\[' + scope: punctuation.definition.group.bracket.begin.latex + push: + - meta_scope: meta.group.bracket.latex + - meta_content_scope: variable.parameter.documentclass.latex + - match: '\]' + scope: punctuation.definition.group.bracket.end.latex + pop: true + - include: general-constants + - include: general-commands - match: '\{' + scope: punctuation.definition.group.brace.begin.latex set: - - meta_content_scope: meta.preamble.documentclass.latex support.class.latex - - match: (?=\}) + - meta_scope: meta.preamble.documentclass.latex meta.group.brace.latex + - match: '[A-Za-z[:digit:]-]*' + scope: support.class.latex + - match: '\}' + scope: punctuation.definition.group.brace.end.latex pop: true - - match: '(\\)usepackage\b' + + - match: '(\\)usepackage(?=(?:\[[^\]]*?\])*\{)' captures: 0: keyword.control.preamble.latex 1: punctuation.definition.backslash.latex push: - meta_scope: meta.preamble.usepackage.latex - - match: '\}' - scope: punctuation.definition.group.brace.end.latex - pop: true - - include: general-optional-arguments + - match: '\[' + scope: punctuation.definition.group.bracket.begin.latex + push: + - meta_scope: meta.group.bracket.latex + - match: '[A-Za-z[:digit:]-]*' + scope: variable.parameter.usepackage.latex + - match: '\]' + scope: punctuation.definition.group.bracket.end.latex + pop: true + - include: general-constants + - include: general-commands - match: '\{' + scope: punctuation.definition.group.brace.begin.latex set: - - match: '[A-Za-z[:digit:]-]*' - scope: meta.preamble.usepackage.latex support.class.latex - - match: (?=\}) + - meta_scope: meta.preamble.usepackage.latex meta.group.brace.latex + - match: '\}' + scope: punctuation.definition.group.brace.end.latex pop: true + - match: '[A-Za-z[:digit:]-]*' + scope: support.class.latex includes: - match: '((\\)(?:include|includeonly))(\{)' @@ -523,7 +544,12 @@ contexts: pop: true - include: math-content - - match: '((\\)begin)(\{)\s*((?:align|alignat|aligned|alignedat|displaymath|eqnarray|equation|flalign|gather|gathered|math|multline|x?xalignat|split)\*?)\s*(\})' + - match: |- + ((\\)begin)(\{)\s*((?: + align|alignat|aligned|alignedat|displaymath + |eqnarray|equation|flalign|gather|gathered + |math|multline|x?xalignat|split + )\*?)\s*(\}) captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex From 22536a778ab5c9e7041cb87915870e5f85a22566 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 1 Jul 2016 20:06:41 -0400 Subject: [PATCH 44/56] [LaTeX] forgot to enabe extended mode --- LaTeX/LaTeX.sublime-syntax | 1 + 1 file changed, 1 insertion(+) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index a72d6ad758..dc33c80aa9 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -545,6 +545,7 @@ contexts: - include: math-content - match: |- + (:x) ((\\)begin)(\{)\s*((?: align|alignat|aligned|alignedat|displaymath |eqnarray|equation|flalign|gather|gathered From bfe402b50ffe37645bbde26e90e12bf753361c2a Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 1 Jul 2016 20:23:24 -0400 Subject: [PATCH 45/56] [LaTeX] typo.. --- LaTeX/LaTeX.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index dc33c80aa9..10b6153418 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -545,7 +545,7 @@ contexts: - include: math-content - match: |- - (:x) + (?x) ((\\)begin)(\{)\s*((?: align|alignat|aligned|alignedat|displaymath |eqnarray|equation|flalign|gather|gathered From 6af159307ccf31ae38286be0d96259e10a8b3bec Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 2 Jul 2016 16:48:57 -0400 Subject: [PATCH 46/56] [LaTeX] improve documentclass and usepackage options highlight --- LaTeX/LaTeX.sublime-syntax | 47 ++++++++++++++++--------------------- LaTeX/syntax_test_latex.tex | 13 ++++++++++ 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 10b6153418..258595956d 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -63,6 +63,8 @@ contexts: pop: true - include: general-constants - include: general-commands + - match: '[A-Za-z[:digit:]-]*(?=\s*\=)' + scope: variable.parameter.bracket.latex _general-1-more-argument: - match: '\}' @@ -243,72 +245,61 @@ contexts: scope: punctuation.definition.group.brace.end.latex pop: true - include: main - - match: '((\\)(?:framebox|makebox))(?=(?:\[[^\]]*?\])*\{)' + - match: '((\\)(?:framebox|makebox))\b' captures: 1: support.function.box.latex 2: punctuation.definition.backslash.latex push: - meta_scope: meta.function.box.latex - include: general-1-argument-with-options - - match: '((\\)parbox)(?=(?:\[[^\]]*?\])*(?:\{[^\}]*\}){2})' + - match: '\S' + pop: true + - match: '((\\)parbox)\b' captures: 1: support.function.box.latex 2: punctuation.definition.backslash.latex push: - meta_scope: meta.function.box.latex - include: general-2-arguments-with-options - - match: '((\\)raisebox)(?=(?:\[[^\]]*?\])*\{)' + - match: '\S' + pop: true + - match: '((\\)raisebox)\b' captures: 1: support.function.box.latex 2: punctuation.definition.backslash.latex push: - meta_scope: meta.function.box.latex - include: general-1-argument-with-options + - match: '\S' + pop: true preamble: - - match: '(\\)documentclass(?=(?:\[[^\]]*?\])*\{)' + - match: '(\\)documentclass\b' captures: 0: keyword.control.preamble.latex 1: punctuation.definition.backslash.latex push: - meta_scope: meta.preamble.documentclass.latex - - match: '\[' - scope: punctuation.definition.group.bracket.begin.latex - push: - - meta_scope: meta.group.bracket.latex - - meta_content_scope: variable.parameter.documentclass.latex - - match: '\]' - scope: punctuation.definition.group.bracket.end.latex - pop: true - - include: general-constants - - include: general-commands + - include: general-optional-arguments - match: '\{' scope: punctuation.definition.group.brace.begin.latex set: - meta_scope: meta.preamble.documentclass.latex meta.group.brace.latex - - match: '[A-Za-z[:digit:]-]*' + - match: '[A-Za-z[:digit:]-]' scope: support.class.latex - match: '\}' scope: punctuation.definition.group.brace.end.latex pop: true + - match: '\S' + pop: true - - match: '(\\)usepackage(?=(?:\[[^\]]*?\])*\{)' + - match: '(\\)usepackage\b' captures: 0: keyword.control.preamble.latex 1: punctuation.definition.backslash.latex push: - meta_scope: meta.preamble.usepackage.latex - - match: '\[' - scope: punctuation.definition.group.bracket.begin.latex - push: - - meta_scope: meta.group.bracket.latex - - match: '[A-Za-z[:digit:]-]*' - scope: variable.parameter.usepackage.latex - - match: '\]' - scope: punctuation.definition.group.bracket.end.latex - pop: true - - include: general-constants - - include: general-commands + - include: general-optional-arguments - match: '\{' scope: punctuation.definition.group.brace.begin.latex set: @@ -318,6 +309,8 @@ contexts: pop: true - match: '[A-Za-z[:digit:]-]*' scope: support.class.latex + - match: '\S' + pop: true includes: - match: '((\\)(?:include|includeonly))(\{)' diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 0b098e3b28..dce0c746a8 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -9,8 +9,21 @@ \usepackage[args]{mypackage, anotherpackage} % ^ keyword.control.preamble.latex % ^ support.class.latex +% ^ -support.class.latex % ^ support.class.latex +\usepackage[pdftex, + %plainpages={false}, +% ^ comment.line + bookmarks=true, +% ^ variable.parameter + unicode=true, + bookmarksnumbered={true}, + % pagebackref=true, + breaklinks=true, + pdfstartview={FitBH}]{hyperref} +% ^ support.class.latex + % line comment % <- comment.line.percentage.tex From 5dae6aeb8b0f2a1f1d9e645c076ad2ccf4a4c17d Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 2 Jul 2016 20:21:49 -0400 Subject: [PATCH 47/56] [LaTeX] dont spell check includegrpahics --- LaTeX/LaTeX.sublime-settings | 2 +- LaTeX/LaTeX.sublime-syntax | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/LaTeX/LaTeX.sublime-settings b/LaTeX/LaTeX.sublime-settings index 551a0f401c..ebdd55fede 100644 --- a/LaTeX/LaTeX.sublime-settings +++ b/LaTeX/LaTeX.sublime-settings @@ -1,4 +1,4 @@ { - "spelling_selector": "-(comment, source, constant, keyword, storage, support, variable, markup.underline.link, meta.tag, meta.preamble, meta.include, meta.function.citation, meta.function.reference, meta.function.label)", + "spelling_selector": "-(comment, source, constant, keyword, storage, support, variable, markup.underline.link, meta.tag, meta.preamble, meta.include, meta.function.citation, meta.function.reference, meta.function.label, meta.function.includegraphics)", "word_separators": "_./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?" } diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 258595956d..7426a7e3ec 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -28,6 +28,7 @@ contexts: - include: verbatim - include: verb - include: url + - include: graphics - include: lists plain-tex: @@ -562,8 +563,19 @@ contexts: pop: true - include: math-content + graphics: + - match: '((\\)includegraphics)\b' + captures: + 1: support.function.includegraphics.latex + 2: punctuation.definition.backslash.latex + push: + - meta_scope: meta.function.includegraphics.latex + - include: general-1-argument-with-options + - match: '\S' + pop: true + url: - - match: '(?:\s*)((\\)(?:url|href))(\{)([^}]*)(\})' + - match: '((\\)(?:url|href))(\{)([^}]*)(\})' scope: meta.function.link.url.latex captures: 1: support.function.url.latex @@ -1602,7 +1614,7 @@ contexts: # beamer support beamer: - - match: '(?:\s*)((\\)begin)(\{)(frame)(\})' + - match: '((\\)begin)(\{)(frame)(\})' captures: 1: support.function.be.latex 2: punctuation.definition.backslash.latex From bd319676db445dc39ea5fe390a9e9db64e104099 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sun, 3 Jul 2016 02:12:38 -0400 Subject: [PATCH 48/56] [LaTeX] fix includegraphics test --- LaTeX/syntax_test_latex.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index dce0c746a8..ad2648076a 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -182,7 +182,7 @@ \subsubsection{name} % ^ support.function.general.latex \includegraphics[width=0.33\textwidth, angle=30]{test.png} -% ^ support.function.general.latex +% ^ support.function.includegraphics.latex % ^ support.function.general.latex From cdb726548374ca29ea80fd0bf308e0efb4ee881e Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sun, 3 Jul 2016 02:29:20 -0400 Subject: [PATCH 49/56] [LaTeX] improve optional arguments match --- LaTeX/LaTeX.sublime-syntax | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 7426a7e3ec..d6a2c82006 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -107,6 +107,8 @@ contexts: - match: '(?=\})' pop: true - include: main + - match: '(?=\S)' + pop: true general-2-arguments: - match: '\}' @@ -118,6 +120,8 @@ contexts: - meta_scope: meta.group.brace.latex - include: _general-1-more-argument - include: main + - match: '(?=\S)' + pop: true general-3-arguments: - match: '\}' @@ -129,6 +133,8 @@ contexts: - meta_scope: meta.group.brace.latex - include: _general-2-more-arguments - include: main + - match: '(?=\S)' + pop: true general-1-argument-with-options: - include: general-optional-arguments @@ -253,8 +259,6 @@ contexts: push: - meta_scope: meta.function.box.latex - include: general-1-argument-with-options - - match: '\S' - pop: true - match: '((\\)parbox)\b' captures: 1: support.function.box.latex @@ -262,8 +266,6 @@ contexts: push: - meta_scope: meta.function.box.latex - include: general-2-arguments-with-options - - match: '\S' - pop: true - match: '((\\)raisebox)\b' captures: 1: support.function.box.latex @@ -271,8 +273,6 @@ contexts: push: - meta_scope: meta.function.box.latex - include: general-1-argument-with-options - - match: '\S' - pop: true preamble: - match: '(\\)documentclass\b' @@ -291,7 +291,7 @@ contexts: - match: '\}' scope: punctuation.definition.group.brace.end.latex pop: true - - match: '\S' + - match: '(?=\S)' pop: true - match: '(\\)usepackage\b' @@ -310,7 +310,7 @@ contexts: pop: true - match: '[A-Za-z[:digit:]-]*' scope: support.class.latex - - match: '\S' + - match: '(?=\S)' pop: true includes: @@ -571,8 +571,6 @@ contexts: push: - meta_scope: meta.function.includegraphics.latex - include: general-1-argument-with-options - - match: '\S' - pop: true url: - match: '((\\)(?:url|href))(\{)([^}]*)(\})' From a1f6ed9cb6f3b90e745c5fb86bf5d39e62d96b35 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Tue, 12 Jul 2016 21:00:04 -0400 Subject: [PATCH 50/56] [LaTeX] hightlight non-breaking space --- LaTeX/TeX.sublime-syntax | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 6d1d6a1dfe..51c458a496 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -36,6 +36,8 @@ contexts: 1: punctuation.definition.backslash.tex - match: '&' scope: constant.character.ampersand.tex + - match: '~' + scope: constant.character.space.tex comments: - match: '%.*$\n?' From fb7a6221d4842f057aac60260bb37a7c02b6475c Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Wed, 13 Jul 2016 10:21:30 -0400 Subject: [PATCH 51/56] use keyword and storange to scope cite/ref/label --- LaTeX/LaTeX.sublime-syntax | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index d6a2c82006..403d8c8b6a 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -694,7 +694,7 @@ contexts: (?:(\[)(?:[^\]]*)(\])){0,2} (\{) captures: - 1: support.function.cite.latex + 1: support.function.cite.latex keyword.other.cite.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.bracket.begin.latex 4: punctuation.definition.group.bracket.end.latex @@ -716,7 +716,7 @@ contexts: (?:(\[)(?:[^\]]*)(\])){0,2} (\{) captures: - 1: support.function.reference.latex + 1: support.function.reference.latex keyword.other.reference.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.bracket.begin.latex 4: punctuation.definition.group.bracket.end.latex @@ -730,7 +730,7 @@ contexts: pop: true - match: '((\\)label)(\{)' captures: - 1: support.function.label.latex + 1: support.function.label.latex storage.type.label.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex push: From ade66e0df77608f39262dd6dcbc85d5710c41dea Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Wed, 13 Jul 2016 10:24:44 -0400 Subject: [PATCH 52/56] apply keyword.control.flow to begin/end pair --- LaTeX/LaTeX.sublime-syntax | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 403d8c8b6a..bc18b46e08 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -744,7 +744,7 @@ contexts: begin-end-commands: - match: '((\\)begin)(\{)\s*(\w*)\*?\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -755,7 +755,7 @@ contexts: pop: true - match: '((\\)end)(\{)\s*(\w*)\*?\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.end.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -789,7 +789,7 @@ contexts: - match: ((\\)begin)(\{)(lstlisting)(\}) captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -799,7 +799,7 @@ contexts: - meta_scope: meta.environment.verbatim.lstlisting.latex - match: '((\\)end)(\{)(lstlisting)(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.end.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -954,7 +954,7 @@ contexts: minted-env: - match: ((\\)begin)(\{)(minted)(\}) captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -964,7 +964,7 @@ contexts: - meta_scope: meta.environment.verbatim.minted.latex - match: '((\\)end)(\{)(minted)(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.end.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -1593,7 +1593,7 @@ contexts: pop: true - match: '((\\)begin)(\{)\s*(comment)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -1603,7 +1603,7 @@ contexts: - meta_content_scope: comment.block.environment.comment.latex - match: '((\\)end)(\{)\s*(comment)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.end.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -1614,7 +1614,7 @@ contexts: beamer: - match: '((\\)begin)(\{)(frame)(\})' captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -1623,7 +1623,7 @@ contexts: - meta_scope: meta.environment.frame.latex - match: '((\\)end)(\{)(frame)(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.end.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex From 1c75ac8aa15b020a3be74524424c2ebf19a0776d Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Fri, 15 Jul 2016 14:47:42 -0400 Subject: [PATCH 53/56] [LaTeX] more matches for begin/end pair --- LaTeX/LaTeX.sublime-syntax | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index bc18b46e08..59dff7a7a6 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -367,7 +367,7 @@ contexts: verbatim: - match: '((\\)begin)(\{)\s*((?:[vV]erbatim|alltt)\*?)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.brace.bebgin.latex 4: variable.parameter.function.latex @@ -378,7 +378,7 @@ contexts: - meta_content_scope: markup.raw.verbatim.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -388,7 +388,7 @@ contexts: lists: - match: '((\\)begin)(\{)\s*(itemize\*?)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -397,7 +397,7 @@ contexts: - meta_scope: meta.environment.list.itemize.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -406,7 +406,7 @@ contexts: - include: main - match: '((\\)begin)(\{)\s*(enumerate\*?)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -415,7 +415,7 @@ contexts: - meta_scope: meta.environment.list.enumerate.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -424,7 +424,7 @@ contexts: - include: main - match: '((\\)begin)(\{)\s*(list\*?)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -433,7 +433,7 @@ contexts: - meta_scope: meta.environment.list.list.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -442,7 +442,7 @@ contexts: - include: main - match: '((\\)begin)(\{)\s*(description\*?)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -451,7 +451,7 @@ contexts: - meta_scope: meta.environment.list.description.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -546,7 +546,7 @@ contexts: |math|multline|x?xalignat|split )\*?)\s*(\}) captures: - 1: support.function.be.latex + 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex @@ -555,7 +555,7 @@ contexts: - meta_scope: meta.environment.math.block.be.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: - 1: support.function.be.latex + 1: support.function.end.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex From a113bd1240718b055f4d4c164ef545bcf4f30ae5 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Fri, 15 Jul 2016 22:08:19 +0200 Subject: [PATCH 54/56] [LaTeX] Change math be envs to only scope the content The math scope in begin-end environments will only applied to the content and not to \begin{...} and \end{....} (`meta_scope` -> `meta_content_scope`). --- LaTeX/LaTeX.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 59dff7a7a6..af3872d2c4 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -552,7 +552,7 @@ contexts: 4: variable.parameter.function.latex 5: punctuation.definition.group.brace.end.latex push: - - meta_scope: meta.environment.math.block.be.latex + - meta_content_scope: meta.environment.math.block.be.latex - match: '((\\)end)(\{)\s*(\4)\s*(\})' captures: 1: support.function.end.latex keyword.control.flow.begin.latex From b85b54fffa66c9577d79e9033b3d5fbb70c6fdd8 Mon Sep 17 00:00:00 2001 From: Richard Stein Date: Sat, 16 Jul 2016 00:34:34 +0200 Subject: [PATCH 55/56] [LaTeX] Adapt syntax text to recent changes --- LaTeX/syntax_test_latex.tex | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index ad2648076a..7fa490bf99 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -28,7 +28,7 @@ % <- comment.line.percentage.tex \begin{document} -% ^ support.function.be.latex +% ^ support.function.begin.latex keyword.control.flow.begin.latex % ^ variable.parameter.function.latex % SECTION COMMANDS @@ -71,11 +71,11 @@ \subsubsection{name} \ref{sec:name} % ^ meta.function.reference.latex -% ^ support.function.reference.latex +% ^ support.function.reference.latex keyword.other.reference.latex \cite{my:bib:key} % ^ meta.function.citation.latex -% ^ support.function.cite.latex +% ^ support.function.cite.latex keyword.other.cite.latex % URL COMMAND @@ -105,6 +105,12 @@ \subsubsection{name} % ^ meta.function.input.tex % ^ keyword.control.input.tex +\includecommand{...} +% ^^^^^^^^^^ support.function.general.latex + +\inputminted{py}{path/to/file.py} +% ^^^^^^^^^^ support.function.general.latex + % MARKUP COMMANDS @@ -162,7 +168,7 @@ \subsubsection{name} % ^ - support.function.general.latex \begin{verbatim} -% ^ support.function.be.latex +% ^ support.function.begin.latex keyword.control.flow.begin.latex % ^ variable.parameter.function.latex The \emph{verbatim} environment sets everything in verbatim. % <- meta.environment.verbatim.verbatim.latex @@ -222,7 +228,7 @@ \subsubsection{name} % using an environment. \begin{comment} -% ^ support.function.be.latex +% ^ support.function.begin.latex keyword.control.flow.begin.latex % ^ variable.parameter.function.latex This environment can be used to write % <- comment.block.environment.comment.latex @@ -316,5 +322,5 @@ \subsubsection{name} \end{document} -% ^ support.function.be.latex +% ^ support.function.end.latex keyword.control.flow.end.latex % ^ variable.parameter.function.latex From 23f17cb25d9957ba30b2888bd5b86cd5d20f8a57 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Sat, 16 Jul 2016 22:31:00 -0400 Subject: [PATCH 56/56] [LaTeX] match cite/ref optional arguments --- LaTeX/LaTeX.sublime-syntax | 44 ++++++++++++++++++++----------------- LaTeX/syntax_test_latex.tex | 10 +++++++++ 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index af3872d2c4..cc567c43bf 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -690,21 +690,23 @@ contexts: | (?:[pP]aren|foot|[tT]ext|[sS]mart|super|[aA]|no|full|footfull)cite|footcitetext ) \*? - ) - (?:(\[)(?:[^\]]*)(\])){0,2} - (\{) + )\b captures: 1: support.function.cite.latex keyword.other.cite.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.group.bracket.begin.latex - 4: punctuation.definition.group.bracket.end.latex - 5: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.citation.latex - - match: '[a-zA-Z0-9\.:/*!^_-]+' - scope: constant.other.citation.latex - - match: '\}' - scope: punctuation.definition.group.brace.end.latex + - include: general-optional-arguments + - match: '\{' + scope: punctuation.definition.group.brace.begin.latex + set: + - meta_scope: meta.function.citation.latex meta.group.brace.latex + - match: '[a-zA-Z0-9\.:/*!^_-]+' + scope: constant.other.citation.latex + - match: '\}' + scope: punctuation.definition.group.brace.end.latex + pop: true + - match: '(?=\S)' pop: true - match: |- (?x) @@ -712,21 +714,23 @@ contexts: (\\) (?:eq|c?page|[vV]|auto|name|[cC])?ref \*? - ) - (?:(\[)(?:[^\]]*)(\])){0,2} - (\{) + )\b captures: 1: support.function.reference.latex keyword.other.reference.latex 2: punctuation.definition.backslash.latex - 3: punctuation.definition.group.bracket.begin.latex - 4: punctuation.definition.group.bracket.end.latex - 5: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.reference.latex - - match: '[a-zA-Z0-9\.:/*!^_-]+' - scope: constant.other.reference.latex - - match: '\}' - scope: punctuation.definition.group.brace.end.latex + - include: general-optional-arguments + - match: '\{' + scope: punctuation.definition.group.brace.begin.latex + set: + - meta_scope: meta.function.reference.latex meta.group.brace.latex + - match: '[a-zA-Z0-9\.:/*!^_-]+' + scope: constant.other.reference.latex + - match: '\}' + scope: punctuation.definition.group.brace.end.latex + pop: true + - match: '(?=\S)' pop: true - match: '((\\)label)(\{)' captures: diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 7fa490bf99..a40da1e69c 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -68,14 +68,24 @@ \subsubsection{name} \label{sec:name} % ^ meta.function.label.latex % ^ support.function.label.latex +% ^ entity.name \ref{sec:name} % ^ meta.function.reference.latex % ^ support.function.reference.latex keyword.other.reference.latex +% ^ constant.other.reference \cite{my:bib:key} % ^ meta.function.citation.latex % ^ support.function.cite.latex keyword.other.cite.latex +% ^ constant.other.citation + + +\cite[\command]{my:bib:key} +% ^ meta.function.citation.latex +% ^ support.function.cite.latex +% ^ support.function +% % URL COMMAND