diff --git a/AsciiDoc.tmLanguage b/AsciiDoc.tmLanguage index 7adb76b..4a23b5a 100644 --- a/AsciiDoc.tmLanguage +++ b/AsciiDoc.tmLanguage @@ -1 +1,706 @@ - comment A very early hack. Mostly ripped from other syntaxes. Only the very basic stuff is working. fileTypes asc foldingStartMarker (?x) (([/+-.*_=]){4,} |<!--(?!.*-->) ) foldingStopMarker (?x) (([/+-.*_=]){4,} |^\s*--> ) keyEquivalent ^~A name AsciiDoc patterns include #heading_inline include #heading-block include #heading-blockattr begin \$\$(?!\$) end \$\$(?!\$) name comment.block.passthrough.macro.doubledollar.asciidoc begin \+\+\+(?!\+) end \+\+\+(?!\+) name comment.block.passthrough.macro.tripeplus.asciidoc match (//).*$\n? name comment.line.double-slash.asciidoc begin (?x)^ (?= ([/+-.*_=]{4,})\s*$ | ([ \t]{1,}) | [=]{1,6}\s*+ | [ ]{,3}(?<marker>[-*_])([ ]{,2}\k<marker>){2,}[ \t]*+$ ) end (?x)^ (?! \1 | ([ \t]{1,}) | [=]{1,6}\s*+ | [ ]{,3}(?<marker>[-*_])([ ]{,2}\k<marker>){2,}[ \t]*+$ ) name meta.block-level.asciidoc patterns include #block_quote include #block_raw include #heading_inline include #heading-block include #separator begin ^[ ]{0,3}([*+-])(?=\s) captures 1 name punctuation.definition.list_item.asciidoc end ^(?=\S) name markup.list.unnumbered.asciidoc patterns include #list-paragraph begin ^[ ]{0,3}[0-9]+(\.)(?=\s) captures 1 name punctuation.definition.list_item.asciidoc end ^(?=\S) name markup.list.numbered.asciidoc patterns include #list-paragraph begin ^([/+-.*_=]){4,}\s*$ end ^\1{4,}\s*$ name comment.block.asciidoc begin ^([/+.]){4,}\s*$ comment asciidoc formatting is disabled inside certain blocks. end ^[/+.]{4,}\s*$ name meta.disable-asciidoc begin ^(?=\S)(?![=-]{3,}(?=$))(?!\.\S+) end ^(?:\s*$|(?=[ ]{,3}>.))|(?=[ \t]*\n)(?<=^===|^====|=====|^---|^----|-----)[ \t]*\n name meta.paragraph.asciidoc patterns include #inline include text.basic captures 1 name punctuation.definition.heading.asciidoc match ^(={3,})(?=[ \t]*$) name markup.heading.0.asciidoc captures 1 name punctuation.definition.heading.asciidoc match ^(-{3,})(?=[ \t]*$) name markup.heading.1.asciidoc captures 1 name punctuation.definition.heading.asciidoc match ^(~{3,})(?=[ \t]*$) name markup.heading.2.asciidoc captures 1 name punctuation.definition.heading.asciidoc match ^(\^{3,})(?=[ \t]*$) name markup.heading.3.asciidoc captures 1 name punctuation.definition.heading.asciidoc match ^(\+{3,})(?=[ \t]*$) name markup.heading.4.asciidoc repository attribute-entry match ^:[-_. A-Za-z0-9]+:\s*(.*)\s*$ name variable.other attribute-reference match {[-_. A-Za-z0-9]+} name variable.other attribute-reference-predefined match {(?i:amp|asciidoc-dir|asciidoc-file|asciidoc-version|author|authored|authorinitials|backend-docbook|backend-xhtml11|backend-html4|docbook-article|xhtml11-article|html4-article|docbook-book|xhtml11-book|html4-book|docbook-manpage|xhtml11-manpage|html4-manpage|backend|backslash|basebackend|brvbar|date|docdate|doctime|docname|docfile|docdir|doctitle|doctype-article|doctype-book|doctype-manpage|doctype|email|empty|encoding|filetype|firstname|gt|id|indir|infile|lastname|level|listindex|localdate|localtime|lt|manname|manpurpose|mantitle|manvolnum|middlename|nbsp|outdir|outfile|reftext|revision|sectnum|showcomments|title|two_colons|two_semicolons|user-dir|verbose)} name support.variable block_quote begin ^([/+-.*_=]){4,}\s*$ end ^\1{4,}\s*$ name comment.block.asciidoc block_raw match \G([ ]{4}|\t).*$\n? name markup.raw.block.asciidoc bracket comment asciidoc will convert this for us. We match it so that the HTML grammar will not mark it up as invalid. match <(?![a-z/?\$!]) name meta.other.valid-bracket.asciidoc character-replacements match \(C\)|\(R\)|\(TM\)|--(?!-)|\.\.\.(?!\.)|->|<-|=>|<= name constant.character.asciidoc escape match \\[-`*_#+.!(){}\[\]\\>:] name constant.character.escape.asciidoc heading captures 1 name punctuation.definition.heading.asciidoc contentName entity.name.section.asciidoc match (?m)^(\S+)$([=-~^+])+\s*$ name markup.heading.asciidoc heading-block captures 1 name punctuation.definition.heading.asciidoc match ^\.(\w.*)$ name markup.heading.asciidoc heading-blockattr captures 1 name punctuation.definition.heading.asciidoc match ^\[\[?(\w.*)\]$ name markup.heading.asciidoc heading_inline begin \G(={1,6})(?!=)\s*(?=\S) captures 1 name punctuation.definition.heading.asciidoc contentName entity.name.section.asciidoc end \s*(=*)$\n? name markup.heading.asciidoc patterns include #inline inline patterns include #line-break include #line-page-break include #line-ruler include #escape include #passthrough-macro-trippleplus-inline include #passthrough-macro-doubledollar-inline include #character-replacements include #bracket include #raw include #text-quote-single include #text-quote-double include #text-quote-other include #text-bold-unconstrained include #text-italic-unconstrained include #text-monospace-unconstrained include #text-unquoted-unconstrained include #text-bold include #text-italic include #text-monospace include #text-unquoted include #attribute-entry include #attribute-reference-predefined include #attribute-reference line-break match (?<=\S)\s+\+$ name constant.character.escape.asciidoc line-page-break match ^<{3,}$ name constant.character.escape.asciidoc line-ruler match ^'{3,}$ name constant.character.escape.asciidoc list-paragraph patterns begin \G\s+(?=\S) end ^\s*$ name meta.paragraph.list.asciidoc patterns include #inline passthrough-macro-doubledollar-inline match (?:\[.*\])?\$\$(?!\$).+\$\$(?!\$) name comment.block.passthrough.asciidoc passthrough-macro-trippleplus-inline match (?:\[.*\])?\+\+\+(?!\+).+\+\+\+(?!\+) name comment.block.passthrough.asciidoc raw captures 1 name punctuation.definition.raw.asciidoc 3 name punctuation.definition.raw.asciidoc match (`+)([^`]|(?!(?<!`)\1(?!`))`)*+(\1) name markup.raw.inline.asciidoc separator match \G[ ]{,3}([-*_])([ ]{,2}\1){2,}[ \t]*$\n? name meta.separator.asciidoc text-bold begin (?<!\w)(\*)(?=\S) captures 1 name punctuation.definition.bold.asciidoc end (?<=\S)(\1)(?!\w) name markup.bold.asciidoc text-bold-unconstrained begin (\*\*)(?=\S) captures 1 name punctuation.definition.bold.asciidoc end (?<=\S)(\1) name markup.bold.asciidoc text-italic begin (?<!\w)('|_)(?=\S) captures 1 name punctuation.definition.italic.asciidoc end (?<=\S)(\1)((?!\1)|(?=\1\1))(?!\w) name markup.italic.asciidoc text-italic-unconstrained begin (__)(?=\S) captures 1 name punctuation.definition.italic.asciidoc end (?<=\S)(\1) name markup.italic.asciidoc text-monospace match (?<!\w)([\+`])[^\+`]*(\1)(?!\w) name string.interpolated.asciidoc text-monospace-unconstrained match (\+\+).*(\1) name string.interpolated.asciidoc text-quote-double match (?<!\w)(?:\[.*\])?``(?!`).*''(?!')(?!\w) name string.quoted.double.asciidoc text-quote-other match (?<!\w)(?:\[.*\])?([~^]).*(\1)(?!\w) name string.quoted.single.asciidoc text-quote-single comment TODO: Sub- and Superscript are really unconstrained match (?<!\w)(?:\[.*\])?`(?!`).*'(?!')(?!\w) name string.quoted.single.asciidoc text-unquoted match (?<!\w)(#).*(\1)(?!\w) name string.unquoted.asciidoc text-unquoted-unconstrained match (##).*(\1) name string.unquoted.asciidoc scopeName text.asciidoc uuid 090F38B8-2CEB-4956-A627-E24C7AA16ED6 \ No newline at end of file + + + + + comment + + A very early hack. Mostly ripped from other syntaxes. + Only the very basic stuff is working. + + fileTypes + + asc + asciidoc + + foldingStartMarker + (?x) + (([/+-.*_=]){4,} + |<!--(?!.*-->) + ) + foldingStopMarker + (?x) + (([/+-.*_=]){4,} + |^\s*--> + ) + keyEquivalent + ^~A + name + AsciiDoc + patterns + + + include + #heading_inline + + + include + #heading-block + + + include + #heading-blockattr + + + begin + \$\$(?!\$) + end + \$\$(?!\$) + name + comment.block.passthrough.macro.doubledollar.asciidoc + + + begin + \+\+\+(?!\+) + end + \+\+\+(?!\+) + name + comment.block.passthrough.macro.tripeplus.asciidoc + + + match + (//).*$\n? + name + comment.line.double-slash.asciidoc + + + begin + (?x)^ + (?= ([/+-.*_=]{4,})\s*$ + | ([ \t]{1,}) + | [=]{1,6}\s*+ + | [ ]{,3}(?<marker>[-*_])([ ]{,2}\k<marker>){2,}[ \t]*+$ + ) + end + (?x)^ + (?! \1 + | ([ \t]{1,}) + | [=]{1,6}\s*+ + | [ ]{,3}(?<marker>[-*_])([ ]{,2}\k<marker>){2,}[ \t]*+$ + ) + name + meta.block-level.asciidoc + patterns + + + include + #block_quote + + + include + #block_raw + + + include + #heading_inline + + + include + #heading-block + + + include + #separator + + + + + begin + ^[ ]{0,3}([*+-])(?=\s) + captures + + 1 + + name + punctuation.definition.list_item.asciidoc + + + end + ^(?=\S) + name + markup.list.unnumbered.asciidoc + patterns + + + include + #list-paragraph + + + + + begin + ^[ ]{0,3}[0-9]+(\.)(?=\s) + captures + + 1 + + name + punctuation.definition.list_item.asciidoc + + + end + ^(?=\S) + name + markup.list.numbered.asciidoc + patterns + + + include + #list-paragraph + + + + + begin + ^([/+-.*_=]){4,}\s*$ + end + ^\1{4,}\s*$ + name + comment.block.asciidoc + + + begin + ^([/+.]){4,}\s*$ + comment + + asciidoc formatting is disabled inside certain blocks. + + end + ^[/+.]{4,}\s*$ + name + meta.disable-asciidoc + + + begin + ^(?=\S)(?![=-]{3,}(?=$))(?!\.\S+) + end + ^(?:\s*$|(?=[ ]{,3}>.))|(?=[ \t]*\n)(?<=^===|^====|=====|^---|^----|-----)[ \t]*\n + name + meta.paragraph.asciidoc + patterns + + + include + #inline + + + include + text.basic + + + captures + + 1 + + name + punctuation.definition.heading.asciidoc + + + match + ^(={3,})(?=[ \t]*$) + name + markup.heading.0.asciidoc + + + captures + + 1 + + name + punctuation.definition.heading.asciidoc + + + match + ^(-{3,})(?=[ \t]*$) + name + markup.heading.1.asciidoc + + + captures + + 1 + + name + punctuation.definition.heading.asciidoc + + + match + ^(~{3,})(?=[ \t]*$) + name + markup.heading.2.asciidoc + + + captures + + 1 + + name + punctuation.definition.heading.asciidoc + + + match + ^(\^{3,})(?=[ \t]*$) + name + markup.heading.3.asciidoc + + + captures + + 1 + + name + punctuation.definition.heading.asciidoc + + + match + ^(\+{3,})(?=[ \t]*$) + name + markup.heading.4.asciidoc + + + + + repository + + attribute-entry + + match + ^:[-_. A-Za-z0-9]+:\s*(.*)\s*$ + name + variable.other + + attribute-reference + + match + {[-_. A-Za-z0-9]+} + name + variable.other + + attribute-reference-predefined + + match + {(?i:amp|asciidoc-dir|asciidoc-file|asciidoc-version|author|authored|authorinitials|backend-docbook|backend-xhtml11|backend-html4|docbook-article|xhtml11-article|html4-article|docbook-book|xhtml11-book|html4-book|docbook-manpage|xhtml11-manpage|html4-manpage|backend|backslash|basebackend|brvbar|date|docdate|doctime|docname|docfile|docdir|doctitle|doctype-article|doctype-book|doctype-manpage|doctype|email|empty|encoding|filetype|firstname|gt|id|indir|infile|lastname|level|listindex|localdate|localtime|lt|manname|manpurpose|mantitle|manvolnum|middlename|nbsp|outdir|outfile|reftext|revision|sectnum|showcomments|title|two_colons|two_semicolons|user-dir|verbose)} + name + support.variable + + block_quote + + begin + ^([/+-.*_=]){4,}\s*$ + end + ^\1{4,}\s*$ + name + comment.block.asciidoc + + block_raw + + match + \G([ ]{4}|\t).*$\n? + name + markup.raw.block.asciidoc + + bracket + + comment + + asciidoc will convert this for us. We match it so that the + HTML grammar will not mark it up as invalid. + + match + <(?![a-z/?\$!]) + name + meta.other.valid-bracket.asciidoc + + character-replacements + + match + \(C\)|\(R\)|\(TM\)|--(?!-)|\.\.\.(?!\.)|->|<-|=>|<= + name + constant.character.asciidoc + + escape + + match + \\[-`*_#+.!(){}\[\]\\>:] + name + constant.character.escape.asciidoc + + heading + + captures + + 1 + + name + punctuation.definition.heading.asciidoc + + + contentName + entity.name.section.asciidoc + match + (?m)^(\S+)$([=-~^+])+\s*$ + name + markup.heading.asciidoc + + heading-block + + captures + + 1 + + name + punctuation.definition.heading.asciidoc + + + match + ^\.(\w.*)$ + name + markup.heading.asciidoc + + heading-blockattr + + captures + + 1 + + name + punctuation.definition.heading.asciidoc + + + match + ^\[\[?(\w.*)\]$ + name + markup.heading.asciidoc + + heading_inline + + begin + \G(={1,6})(?!=)\s*(?=\S) + captures + + 1 + + name + punctuation.definition.heading.asciidoc + + + contentName + entity.name.section.asciidoc + end + \s*(=*)$\n? + name + markup.heading.asciidoc + patterns + + + include + #inline + + + + inline + + patterns + + + include + #line-break + + + include + #line-page-break + + + include + #line-ruler + + + include + #escape + + + include + #passthrough-macro-trippleplus-inline + + + include + #passthrough-macro-doubledollar-inline + + + include + #character-replacements + + + include + #bracket + + + include + #raw + + + include + #text-quote-single + + + include + #text-quote-double + + + include + #text-quote-other + + + include + #text-bold-unconstrained + + + include + #text-italic-unconstrained + + + include + #text-monospace-unconstrained + + + include + #text-unquoted-unconstrained + + + include + #text-bold + + + include + #text-italic + + + include + #text-monospace + + + include + #text-unquoted + + + include + #attribute-entry + + + include + #attribute-reference-predefined + + + include + #attribute-reference + + + + line-break + + match + (?<=\S)\s+\+$ + name + constant.character.escape.asciidoc + + line-page-break + + match + ^<{3,}$ + name + constant.character.escape.asciidoc + + line-ruler + + match + ^'{3,}$ + name + constant.character.escape.asciidoc + + list-paragraph + + patterns + + + begin + \G\s+(?=\S) + end + ^\s*$ + name + meta.paragraph.list.asciidoc + patterns + + + include + #inline + + + + + + passthrough-macro-doubledollar-inline + + match + (?:\[.*\])?\$\$(?!\$).+\$\$(?!\$) + name + comment.block.passthrough.asciidoc + + passthrough-macro-trippleplus-inline + + match + (?:\[.*\])?\+\+\+(?!\+).+\+\+\+(?!\+) + name + comment.block.passthrough.asciidoc + + raw + + captures + + 1 + + name + punctuation.definition.raw.asciidoc + + 3 + + name + punctuation.definition.raw.asciidoc + + + match + (`+)([^`]|(?!(?<!`)\1(?!`))`)*+(\1) + name + markup.raw.inline.asciidoc + + separator + + match + \G[ ]{,3}([-*_])([ ]{,2}\1){2,}[ \t]*$\n? + name + meta.separator.asciidoc + + text-bold + + begin + (?<!\w)(\*)(?=\S) + captures + + 1 + + name + punctuation.definition.bold.asciidoc + + + end + (?<=\S)(\1)(?!\w) + name + markup.bold.asciidoc + + text-bold-unconstrained + + begin + (\*\*)(?=\S) + captures + + 1 + + name + punctuation.definition.bold.asciidoc + + + end + (?<=\S)(\1) + name + markup.bold.asciidoc + + text-italic + + begin + (?<!\w)('|_)(?=\S) + captures + + 1 + + name + punctuation.definition.italic.asciidoc + + + end + (?<=\S)(\1)((?!\1)|(?=\1\1))(?!\w) + name + markup.italic.asciidoc + + text-italic-unconstrained + + begin + (__)(?=\S) + captures + + 1 + + name + punctuation.definition.italic.asciidoc + + + end + (?<=\S)(\1) + name + markup.italic.asciidoc + + text-monospace + + match + (?<!\w)([\+`])[^\+`]*(\1)(?!\w) + name + string.interpolated.asciidoc + + text-monospace-unconstrained + + match + (\+\+).*(\1) + name + string.interpolated.asciidoc + + text-quote-double + + match + (?<!\w)(?:\[.*\])?``(?!`).*''(?!')(?!\w) + name + string.quoted.double.asciidoc + + text-quote-other + + match + (?<!\w)(?:\[.*\])?([~^]).*(\1)(?!\w) + name + string.quoted.single.asciidoc + + text-quote-single + + comment + TODO: Sub- and Superscript are really unconstrained + match + (?<!\w)(?:\[.*\])?`(?!`).*'(?!')(?!\w) + name + string.quoted.single.asciidoc + + text-unquoted + + match + (?<!\w)(#).*(\1)(?!\w) + name + string.unquoted.asciidoc + + text-unquoted-unconstrained + + match + (##).*(\1) + name + string.unquoted.asciidoc + + + scopeName + text.asciidoc + uuid + 090F38B8-2CEB-4956-A627-E24C7AA16ED6 + + \ No newline at end of file