lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

JavaDoc.sublime-syntax (6624B)


      1 %YAML 1.2
      2 ---
      3 # http://www.sublimetext.com/docs/3/syntax.html
      4 name: Javadoc
      5 file_extensions: []
      6 scope: text.html.javadoc
      7 hidden: true
      8 
      9 variables:
     10   id: '(?:[\p{L}_$][\p{L}\p{N}_$]*)'
     11   javadoc_block_tag_terminator: (?=^\s*\*?\s*@)
     12 
     13 contexts:
     14   prototype:
     15     # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#leadingasterisks
     16     - match: ^\s*(\*)\s*(?!\s*@)
     17       captures:
     18         1: punctuation.definition.comment.javadoc
     19 
     20   main:
     21     - meta_include_prototype: false
     22     - match: /\*\*
     23       scope: comment.block.documentation.javadoc punctuation.definition.comment.begin.javadoc
     24       embed: contents
     25       embed_scope: comment.block.documentation.javadoc text.html.javadoc
     26       escape: \*/
     27       escape_captures:
     28         0: comment.block.documentation.javadoc punctuation.definition.comment.end.javadoc
     29 
     30   contents:
     31     - meta_include_prototype: false
     32 
     33     # Block tag in the first line (immediately after '/**').
     34     - match: \s*(?=@)
     35       embed: javadoc-block-tags
     36       escape: '{{javadoc_block_tag_terminator}}'
     37 
     38     # We rely on 'escape' to pop the inner context out.
     39     # 'set' unfortunately will mess up the meta scopes.
     40     - match: ''
     41       push:
     42         - match: ^\s*(\*)?\s*(?=@)
     43           captures:
     44             1: punctuation.definition.comment.javadoc
     45           embed: javadoc-block-tags
     46           escape: '{{javadoc_block_tag_terminator}}'
     47         - include: inline-formatting
     48 
     49   inline-formatting:
     50     - include: javadoc-inline-tags
     51     - include: scope:text.html.basic
     52 
     53   javadoc-block-tag-base:
     54     - meta_scope: meta.block-tag.javadoc
     55     - include: inline-formatting
     56 
     57   javadoc-block-tags:
     58     # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#param
     59     - match: (@)param\b
     60       scope: keyword.other.documentation.param.javadoc
     61       captures:
     62         1: punctuation.definition.keyword.javadoc
     63       push: [javadoc-block-tag-base, param-tag-parameter]
     64     # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#see
     65     - match: (@)see\b
     66       scope: keyword.other.documentation.see.javadoc
     67       captures:
     68         1: punctuation.definition.keyword.javadoc
     69       push: [javadoc-block-tag-base, see-tag-content]
     70     # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#throws
     71     - match: (@)(throws|exception)\b
     72       scope: keyword.other.documentation.throws.javadoc
     73       captures:
     74         1: punctuation.definition.keyword.javadoc
     75       push: [javadoc-block-tag-base, reference]
     76     - match: (@)(uses|provides)\b
     77       scope: keyword.other.documentation.uses-or-provides.javadoc
     78       captures:
     79         1: punctuation.definition.keyword.javadoc
     80       push: [javadoc-block-tag-base, reference]
     81     - match: (@)(return|deprecated|author|version|since|apiNote|impl(?:Note|Spec)|moduleGraph|serial(?:Field|Data)?)\b
     82       scope: keyword.other.documentation.javadoc
     83       captures:
     84         1: punctuation.definition.keyword.javadoc
     85       push: javadoc-block-tag-base
     86     - match: '@'
     87       pop: true
     88 
     89   param-tag-parameter:
     90     - match: \S+
     91       scope: variable.parameter.javadoc
     92       pop: true
     93 
     94   see-tag-content:
     95     - match: (?=['<])
     96       pop: true
     97     - match: (?=\S)
     98       set: reference
     99 
    100   reference:
    101     - match: (?:{{id}}\.)*{{id}}(?:#{{id}})?|#{{id}}
    102       scope: markup.underline.link.javadoc
    103       set:
    104         - match: \(
    105           scope: markup.underline.link.javadoc
    106           set:
    107           - match: \)
    108             scope: markup.underline.link.javadoc
    109             pop: true
    110           - match: .
    111             scope: markup.underline.link.javadoc
    112         - match: ''
    113           pop: true
    114 
    115   javadoc-inline-tag-terminator:
    116     - match: \}
    117       scope: punctuation.section.inline-tag.end.javadoc
    118       pop: true
    119 
    120   javadoc-inline-tag-base:
    121     - meta_scope: meta.inline-tag.javadoc
    122     - include: javadoc-inline-tag-terminator
    123 
    124   # Multi-line tags mustn't highlight leading asterisk.
    125   javadoc-inline-tags:
    126     # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#code
    127     # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#literal
    128     - match: ({)((@)(?:code|literal))(?:\s+|(?=\}))
    129       captures:
    130         1: punctuation.section.inline-tag.begin.javadoc
    131         2: keyword.other.documentation.code-or-literal.javadoc
    132         3: punctuation.definition.keyword.javadoc
    133       push:
    134         - meta_scope: meta.inline-tag.javadoc
    135         - include: javadoc-inline-tag-terminator
    136         - include: code-tag-bracket-balancing
    137         - match: ^\s+
    138         - match: .
    139           scope: markup.raw.javadoc
    140     # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#link
    141     - match: ({)((@)link(?:plain)?)\b
    142       captures:
    143         1: punctuation.section.inline-tag.begin.javadoc
    144         2: keyword.other.documentation.link.javadoc
    145         3: punctuation.definition.keyword.javadoc
    146       push: [javadoc-inline-tag-base, link-tag-label, reference-in-inline-tag]
    147     # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#value
    148     - match: ({)((@)value)\b
    149       captures:
    150         1: punctuation.section.inline-tag.begin.javadoc
    151         2: keyword.other.documentation.value.javadoc
    152         3: punctuation.definition.keyword.javadoc
    153       push: [javadoc-inline-tag-base, reference-in-inline-tag]
    154     # http://openjdk.java.net/jeps/225
    155     # https://bugs.openjdk.java.net/browse/JDK-8178725
    156     - match: ({)((@)(?:index|extLink))\b
    157       captures:
    158         1: punctuation.section.inline-tag.begin.javadoc
    159         2: keyword.other.documentation.javadoc
    160         3: punctuation.definition.keyword.javadoc
    161       push: javadoc-inline-tag-base
    162     # https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#inheritDoc
    163     - match: ({)((@)inheritDoc)(})
    164       scope: meta.inline-tag.javadoc
    165       captures:
    166         1: punctuation.section.inline-tag.begin.javadoc
    167         2: keyword.other.documentation.javadoc
    168         3: punctuation.definition.keyword.javadoc
    169         4: punctuation.section.inline-tag.end.javadoc
    170 
    171   code-tag-bracket-balancing:
    172     - match: \{
    173       scope: markup.raw.javadoc
    174       push:
    175         - match: \}
    176           scope: markup.raw.javadoc
    177           pop: true
    178         - include: code-tag-bracket-balancing
    179         - match: .
    180           scope: markup.raw.javadoc
    181 
    182   link-tag-label:
    183     - match: \s*
    184       set:
    185         - meta_content_scope: meta.label.javadoc
    186         - include: scope:text.html.basic
    187         - match: (?=\})
    188           pop: true
    189 
    190   reference-in-inline-tag:
    191     - match: ''
    192       set: reference
    193       with_prototype:
    194         - match: (?=\})
    195           pop: true