diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..e69de29bb diff --git a/Cargo.lock b/Cargo.lock index 4e1dcb249..4a568eb00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -579,6 +579,30 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" @@ -1324,6 +1348,7 @@ dependencies = [ "grass", "hostname", "http", + "indoc", "iron", "kuchiki", "log 0.4.17", @@ -1359,6 +1384,7 @@ dependencies = [ "string_cache", "string_cache_codegen", "strum", + "syntect", "systemstat", "tempfile", "tera", @@ -1485,6 +1511,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +[[package]] +name = "fancy-regex" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf" +dependencies = [ + "bit-set", + "regex", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -2616,6 +2652,12 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indoc" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adab1eaa3408fb7f0c777a73e7465fd5656136fc93b670eb6df3c88c2c1344e3" + [[package]] name = "instant" version = "0.1.12" @@ -2797,6 +2839,12 @@ dependencies = [ "cc", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.0.46" @@ -4808,6 +4856,28 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "syntect" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8" +dependencies = [ + "bincode", + "bitflags", + "fancy-regex", + "flate2", + "fnv", + "lazy_static", + "once_cell", + "regex-syntax", + "serde", + "serde_derive", + "serde_json", + "thiserror", + "walkdir", + "yaml-rust", +] + [[package]] name = "systemstat" version = "0.2.2" @@ -5842,6 +5912,15 @@ version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "114ba2b24d2167ef6d67d7d04c8cc86522b87f490025f39f0303b7db5bf5e3d8" +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "yansi" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index f1e06cead..da7250cdd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,6 +46,7 @@ backtrace = "0.3.61" failure = "0.1.8" thiserror = "1.0.26" comrak = { version = "0.14.0", default-features = false } +syntect = { version = "5.0.0", default-features = false, features = ["parsing", "html", "dump-load", "regex-fancy"] } toml = "0.5" schemamama = "0.3" schemamama_postgres = "0.3" @@ -120,6 +121,7 @@ fn-error-context = "0.2.0" aws-smithy-client = { version = "0.49.0", features = ["test-util"]} aws-smithy-http = "0.49.0" tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] } +indoc = "1.0.7" [build-dependencies] time = "0.3" @@ -129,6 +131,7 @@ walkdir = "2" anyhow = { version = "1.0.42", features = ["backtrace"] } grass = { version = "0.11.0", default-features = false } once_cell = { version = "1.4.0", features = ["parking_lot"] } +syntect = { version = "5.0.0", default-features = false, features = ["parsing", "dump-create", "yaml-load", "regex-fancy"] } [[bench]] name = "compression" diff --git a/README.md b/README.md index 1998fdc47..4b1ca25b0 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ docker is installed and the service is running. ```sh git clone https://github.com/rust-lang/docs.rs.git docs.rs cd docs.rs +git submodule update --init # Configure the default settings for external services cp .env.sample .env # Create the DOCSRS_PREFIX directory diff --git a/assets/syntaxes/Extras/TOML/.gitignore b/assets/syntaxes/Extras/TOML/.gitignore new file mode 100644 index 000000000..5ebd21a16 --- /dev/null +++ b/assets/syntaxes/Extras/TOML/.gitignore @@ -0,0 +1,163 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/assets/syntaxes/Extras/TOML/Comments.YAML-tmPreferences b/assets/syntaxes/Extras/TOML/Comments.YAML-tmPreferences new file mode 100644 index 000000000..401e97061 --- /dev/null +++ b/assets/syntaxes/Extras/TOML/Comments.YAML-tmPreferences @@ -0,0 +1,7 @@ +name: Comments +scope: source.toml +settings: + shellVariables: + - name: TM_COMMENT_START + value: "# " +uuid: 1756cf6c-a968-4b8d-91ce-89478b6ab636 \ No newline at end of file diff --git a/assets/syntaxes/Extras/TOML/Comments.tmPreferences b/assets/syntaxes/Extras/TOML/Comments.tmPreferences new file mode 100644 index 000000000..56f807f5b --- /dev/null +++ b/assets/syntaxes/Extras/TOML/Comments.tmPreferences @@ -0,0 +1,24 @@ + + + + + name + Comments + scope + source.toml + settings + + shellVariables + + + name + TM_COMMENT_START + value + # + + + + uuid + 1756cf6c-a968-4b8d-91ce-89478b6ab636 + + diff --git a/assets/syntaxes/Extras/TOML/LICENSE b/assets/syntaxes/Extras/TOML/LICENSE new file mode 100644 index 000000000..b582f0906 --- /dev/null +++ b/assets/syntaxes/Extras/TOML/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Jason Williams + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/assets/syntaxes/Extras/TOML/README.md b/assets/syntaxes/Extras/TOML/README.md new file mode 100644 index 000000000..713a8366a --- /dev/null +++ b/assets/syntaxes/Extras/TOML/README.md @@ -0,0 +1,9 @@ +# TOML Highlighting for Sublime Text + +Sublime Text syntax highlight for [TOML](https://github.com/mojombo/toml) format on Sublime Text 3. + +## Installation +The easiest way to install it is to use [Package Control](http://wbond.net/sublime_packages/package_control). Alternatively, install it manually as described below. + +### Manual install +Download the repository as a zip file. Unzip the content into a folder named `TOML`. Copy the folder into Sublime Text's `Packages` folder. diff --git a/assets/syntaxes/Extras/TOML/Symbol List.tmPreferences b/assets/syntaxes/Extras/TOML/Symbol List.tmPreferences new file mode 100644 index 000000000..f80e15fd1 --- /dev/null +++ b/assets/syntaxes/Extras/TOML/Symbol List.tmPreferences @@ -0,0 +1,15 @@ + + + + + name + Symbol List + scope + meta.tag.key.toml, meta.tag.table.toml + settings + + showInSymbolList + 1 + + + diff --git a/assets/syntaxes/Extras/TOML/TOML.sublime-syntax b/assets/syntaxes/Extras/TOML/TOML.sublime-syntax new file mode 100644 index 000000000..b6fefc911 --- /dev/null +++ b/assets/syntaxes/Extras/TOML/TOML.sublime-syntax @@ -0,0 +1,406 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: TOML + +file_extensions: + - toml + - tml + - Cargo.lock + - Gopkg.lock + - Pipfile + - poetry.lock + +scope: source.toml + +variables: + ws: '[ \t]*' + wsnl: '([ \t\n])*' + + # Used to detect the possible start of a key. + peek_key_start: '(?=[A-Za-z0-9_''"-])' + dot_peek_key: '{{ws}}(\.){{ws}}{{peek_key_start}}' + + # integer = [ "-" / "+" ] int + # int = DIGIT / digit1-9 1*( DIGIT / "_" DIGIT ) + integer: '([\+\-]?) (?: [0-9] | [1-9] (?: [0-9] | _ [0-9] )+ )' + + HEXDIG: '[0-9A-Fa-f]' + hex_int: '0x{{HEXDIG}}(?:{{HEXDIG}}|_{{HEXDIG}})*' + oct_int: '0o[0-7](?:[0-7]|_[0-7])*' + bin_int: '0b[0-1](?:[0-1]|_[0-1])*' + + # zero-prefixable-int = DIGIT *( DIGIT / underscore DIGIT ) + zero_prefixable_int: '[0-9] (?: [0-9] | _ [0-9] )*' + # frac = decimal-point zero-prefixable-int + frac: '\. {{zero_prefixable_int}}' + # exp = "e" float-exp-part + # float-exp-part = [ minus / plus ] zero-prefixable-int + exp: '[eE] [\+\-]? {{zero_prefixable_int}}' + + # date-time = offset-date-time / local-date-time / local-date / local-time + date_time: '{{offset_date_time}} | {{local_date_time}} | {{local_date}} | {{local_time}}' + # date-fullyear = 4DIGIT + date_fullyear: '[0-9]{4}' + # date-month = 2DIGIT ; 01-12 + date_month: '[0-1][0-9]' + # date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year + date_mday: '[0-3][0-9]' + # time-hour = 2DIGIT ; 00-23 + time_hour: '[0-2][0-9]' + # time-minute = 2DIGIT ; 00-59 + time_minute: '[0-5][0-9]' + # time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second rules + time_second: '[0-6][0-9]' + # time-secfrac = "." 1*DIGIT + time_secfrac: '\.[0-9]+' + # time-numoffset = ( "+" / "-" ) time-hour ":" time-minute + time_numoffset: '[+-] {{time_hour}} : {{time_minute}}' + # time-offset = "Z" / time-numoffset + time_offset: '(?: [zZ] | {{time_numoffset}} )' + # partial-time = time-hour ":" time-minute ":" time-second [time-secfrac] + partial_time: '{{time_hour}} : {{time_minute}} : {{time_second}} (?: {{time_secfrac}} )?' + # full-date = date-fullyear "-" date-month "-" date-mday + full_date: '{{date_fullyear}} - {{date_month}} - {{date_mday}}' + # full-time = partial-time time-offset + full_time: '{{partial_time}} {{time_offset}}' + # offset-date-time = full-date T|%20 full-time + offset_date_time: '{{full_date}} [tT ] {{full_time}}' + # local-date-time = full-date T|%20 partial-time + local_date_time: '{{full_date}} [tT ] {{partial_time}}' + # local-date = full-date + local_date: '{{full_date}}' + # local-time = partial-time + local_time: '{{partial_time}}' + +contexts: + main: + - match: '^{{ws}}' + # Ignore leading whitespace for all expressions. + - include: comments + - include: tables + - include: keyval + - include: illegal + + illegal: + - match: (.*) + # Invalid things -> everything unmatched + captures: + 1: invalid.illegal.toml + + comments: + - match: '{{ws}}((#).*)' + captures: + 1: comment.line.number-sign.toml + 2: punctuation.definition.comment.toml + + data-types: + - include: inline-table + - include: array + - include: string + - include: date-time + - include: float + - include: integer + - include: boolean + - match: '{{ws}}$' + # Don't show an incomplete line as invalid to avoid frequent red + # highlighting while typing. + pop: true + - match: '\w+|.' + scope: invalid.illegal.value.toml + pop: true + + boolean: + - match: (true|false) + captures: + 1: constant.language.toml + pop: true + + integer: + - match: |- + (?x) + (?' +# ^^^^^^^^^^^^ string.quoted.single.literal +# ^ punctuation.definition.string.begin +# ^ punctuation.definition.string.end +str1 = """ +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.begin +Roses are red +#^^^^^^^^^^^^^ string.quoted.triple.basic.block +Violets are blue""" +#^^^^^^^^^^^^^^^ string.quoted.triple.basic.block +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.end +str2 = """ +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.begin +The quick brown \ +#^^^^^^^^^^^^^^^^^ string.quoted.triple.basic.block + + fox jumps over \ + the lazy dog.""" +#^^^^^^^^^^^^^^^^ string.quoted.triple.basic.block +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.end +str3 = """\ +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.begin +# ^^ string.quoted.triple.basic.block + The quick brown \ +#^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.triple.basic.block + fox jumps over \ + the lazy dog.\ + """ +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.end +s = """\b\t\n\f\r\"\\\u1234\U12345678""" +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.begin +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.triple.basic.block constant.character.escape +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.end +s = """""" +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.begin +# ^^^ string.quoted.triple.basic.block punctuation.definition.string.end +regex2 = '''I [dw]on't need \d{2} apples''' +# ^^^ string.quoted.triple.literal.block punctuation.definition.string.begin +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.triple.literal.block +# ^^^ string.quoted.triple.literal.block punctuation.definition.string.end +lines = ''' +# ^^^ string.quoted.triple.literal.block punctuation.definition.string.begin +The first newline is +#^^^^^^^^^^^^^^^^^^^^ string.quoted.triple.literal.block +trimmed in raw strings. + All other whitespace + is preserved. +''' +#^^ string.quoted.triple.literal.block punctuation.definition.string.end +s = '''''' +# ^^^ string.quoted.triple.literal.block punctuation.definition.string.begin +# ^^^ string.quoted.triple.literal.block punctuation.definition.string.end + +#----------------------------------------------------------------------------- +# Invalid string +#----------------------------------------------------------------------------- +s = " +# ^ invalid.illegal.string.non-terminated +s = "\a\x12" +# ^^^^ invalid.illegal.string.escape +s = "\u" +# ^^ invalid.illegal.string.escape +s = "\u1" +# ^^ invalid.illegal.string.escape +s = "\uasdf" +# ^^ invalid.illegal.string.escape +s = "\U" +# ^^ invalid.illegal.string.escape +s = "\U1234" +# ^^ invalid.illegal.string.escape +s = ' +# ^ invalid.illegal +s = '' true +# ^^^^^ invalid.illegal +s = '''''''''''' +# ^^^^^^ invalid.illegal +s = """""""" +# ^^ invalid.illegal + + +############################################################################## +# Array +############################################################################## +empty = [] # Comment +# ^ punctuation.definition.array.begin +# ^ punctuation.definition.array.end +# ^^^^^^^^^ comment.line.number-sign +empty = [ +# ^ punctuation.definition.array.begin +# Interior comment +#^^^^^^^^^^^^^^^^^ comment.line.number-sign +] +#<- punctuation.definition.array.end + +a = [ # Comment +# ^^^^^^^^^ comment.line.number-sign +# ^ punctuation.definition.array.begin + + 1, +# ^ constant.numeric.integer +# ^ punctuation.separator.array + +] +#<- punctuation.definition.array.end + +arr1 = [ 1, 2, 3 ] # Comment +# ^ punctuation.definition.array.begin +# ^ constant.numeric.integer +# ^ punctuation.separator.array +# ^ constant.numeric.integer +# ^ punctuation.separator.array +# ^ constant.numeric.integer +# ^ punctuation.definition.array.end +# ^^^^^^^^^ comment.line.number-sign +arr2 = [ "red", "yellow", "green" ] +# ^ punctuation.definition.array.begin +# ^^^^^ string.quoted.double.basic +# ^ punctuation.separator.array +# ^^^^^^^^ string.quoted.double.basic +# ^^^^^^^ string.quoted.double.basic +# ^ punctuation.definition.array.end +arr3 = [ [ 1, 2 ], [3, 4, 5] ] +# ^ punctuation.definition.array.begin +# ^ punctuation.definition.array.begin +# ^ constant.numeric.integer +# ^ punctuation.separator.array +# ^ constant.numeric.integer +# ^ punctuation.definition.array.end +# ^ punctuation.separator.array +# ^ punctuation.definition.array.begin +# ^ constant.numeric.integer +# ^ punctuation.separator.array +# ^ constant.numeric.integer +# ^ punctuation.separator.array +# ^ constant.numeric.integer +# ^ punctuation.definition.array.end +# ^ punctuation.definition.array.end +arr4 = [ "all", 'strings', """are the same""", '''type'''] +# ^^^^^ string.quoted.double.basic +# ^^^^^^^^^ string.quoted.single.literal +# ^^^^^^^^^^^^^^^^^^ string.quoted.triple.basic.block +# ^^^^^^^^^^ string.quoted.triple.literal.block +# ^ punctuation.definition.array.end +arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] +# ^ punctuation.definition.array.begin +# ^ punctuation.definition.array.begin +# ^ punctuation.definition.array.end +# ^ punctuation.separator.array +# ^ punctuation.definition.array.begin +# ^ punctuation.definition.array.end +# ^ punctuation.definition.array.end +arr7 = [ +# ^ punctuation.definition.array.begin + 1, 2, 3 +# ^ constant.numeric.integer +# ^ punctuation.separator.array +] +#<- punctuation.definition.array.end +arr8 = [ + 1, +# ^ constant.numeric.integer +# ^ punctuation.separator.array + 2, # this is ok +# ^ constant.numeric.integer +# ^ punctuation.separator.array +# ^^^^^^^^^^^^ comment.line.number-sign +] +# <- punctuation.definition.array.end + +#----------------------------------------------------------------------------- +# Invalid array (but accepted) +#----------------------------------------------------------------------------- +# Mixed types aren't allowed. +arr6 = [ 1, 2.0, true, 1999-12-31, +# ^ punctuation.definition.array.begin +# ^ constant.numeric.integer +# ^ punctuation.separator.array +# ^^^ constant.numeric.float + 's', "s", '''s''', """s""", +# ^^^ string.quoted.single.literal +# ^ punctuation.separator.array +# ^^^ string.quoted.double.basic +# ^ punctuation.separator.array +# ^^^^^^^ string.quoted.triple.literal.block +# ^ punctuation.separator.array +# ^^^^^^^ string.quoted.triple.basic.block +# ^ punctuation.separator.array + [], {}, +# ^^ punctuation.definition.array +# ^ punctuation.separator.array +# ^ punctuation.definition.inline-table.begin +# ^ punctuation.definition.inline-table.end +# ^ punctuation.separator.array +] +# <- punctuation.definition.array.end +a = ["s" asdf] +# ^ punctuation.definition.array.begin +# ^^^ string.quoted.double.basic +# ^^^^ invalid.illegal.array +# ^ punctuation.definition.array.end + +#----------------------------------------------------------------------------- +# Invalid array +#----------------------------------------------------------------------------- +a = [,] +# ^ punctuation.definition.array.begin +# ^ invalid.illegal +# ^ punctuation.definition.array.end +a = [1,,2] +# ^ punctuation.separator.array +# ^ invalid.illegal.value +# ^ punctuation.definition.array.end +a = [&*^%$*] +# ^ punctuation.definition.array.begin +# ^ invalid.illegal.value +a = [1, 2, name] +# ^^^^ invalid.illegal.value +# ^ punctuation.definition.array.end + + +############################################################################## +# Inline Table +############################################################################## +table = { } # Comment +#^^^^ entity.name.tag +# ^ punctuation.definition.key-value +# ^ punctuation.definition.inline-table.begin +# ^ punctuation.definition.inline-table.end +# ^^^^^^^^^ comment.line.number-sign +table = {key = 123} # Comment +# ^ punctuation.definition.inline-table.begin +# ^^^ entity.name.tag +# ^ punctuation.definition.key-value +# ^ punctuation.definition.inline-table.end +# ^^^^^^^^^ comment.line.number-sign +name = { first = "Tom", last = "Preston-Werner" } +#^^^ entity.name.tag +# ^^^^^ entity.name.tag +# ^ punctuation.definition.key-value +# ^^^^^ string.quoted.double.basic +# ^ punctuation.separator.inline-table +# ^^^^ entity.name.tag +# ^ punctuation.definition.key-value +# ^^^^^^^^^^^^^^^^ string.quoted.double.basic +# ^ punctuation.definition.inline-table.end +point = { x = 1, y = 2 } +# ^ punctuation.definition.inline-table.begin +# ^ entity.name.tag +# ^ punctuation.definition.key-value +# ^ constant.numeric.integer +# ^ punctuation.separator.inline-table +# ^ entity.name.tag +# ^ punctuation.definition.key-value +# ^ constant.numeric.integer +# ^ punctuation.definition.inline-table.end +t = {b=true, i=1, f=1.0, dt=1979-05-27T07:32:00Z, s1='s', s2="s", s3='''s''', s4="""s""", a=[1], t={k=1}} +# ^ punctuation.definition.inline-table.begin +# ^ entity.name.tag +# ^ punctuation.definition.key-value +# ^^^^ constant.language +# ^ punctuation.separator.inline-table +# ^ entity.name.tag +# ^ punctuation.definition.key-value +# ^ constant.numeric.integer +# ^ punctuation.separator.inline-table +# ^ entity.name.tag +# ^ punctuation.definition.key-value +# ^^^ constant.numeric.float +# ^ punctuation.separator.inline-table +# ^^ entity.name.tag +# ^ punctuation.definition.key-value +# ^^^^^^^^^^^^^^^^^^^^ constant.other.datetime +# ^ punctuation.separator.inline-table +# ^^ entity.name.tag +# ^ punctuation.definition.key-value +# ^^^ string.quoted.single.literal +# ^ punctuation.separator.inline-table +# ^^ entity.name.tag +# ^ punctuation.definition.key-value +# ^^^ string.quoted.double.basic +# ^ punctuation.separator.inline-table +# ^^ entity.name.tag +# ^ punctuation.definition.key-value +# ^^^^^^^ string.quoted.triple.literal.block +# ^ punctuation.separator.inline-table +# ^^ entity.name.tag +# ^ punctuation.definition.key-value +# ^^^^^^^ string.quoted.triple.basic.block +# ^ punctuation.separator.inline-table +# ^ entity.name.tag +# ^ punctuation.definition.key-value +# ^ punctuation.definition.array.begin +# ^ constant.numeric.integer +# ^ punctuation.definition.array.end +# ^ punctuation.separator.inline-table +# ^ entity.name.tag +# ^ punctuation.definition.key-value +# ^ punctuation.definition.inline-table.begin +# ^ entity.name.tag +# ^ punctuation.definition.key-value +# ^ constant.numeric.integer +# ^^ punctuation.definition.inline-table.end + +#----------------------------------------------------------------------------- +# Invalid inline table +#----------------------------------------------------------------------------- +t = {,} +# ^^ invalid.illegal +t = {=} +# ^ invalid.illegal +t = { +} # comment to clear scope +#<- invalid.illegal +t = {key=1,} +# ^ invalid.illegal +t = {key} +# ^ invalid.illegal +t = {key=1 asdf} +# ^^^^^ invalid.illegal +t = {key=1, asdf} +# ^ invalid.illegal +t = {key=invalid} +# ^^^^^^^ invalid.illegal.value +t = {!=123} +# ^ invalid.illegal.key diff --git a/assets/syntaxes/Packages/.github/ISSUE_TEMPLATE/01-bug-syntax-highlighting.md b/assets/syntaxes/Packages/.github/ISSUE_TEMPLATE/01-bug-syntax-highlighting.md new file mode 100644 index 000000000..c95c3e13e --- /dev/null +++ b/assets/syntaxes/Packages/.github/ISSUE_TEMPLATE/01-bug-syntax-highlighting.md @@ -0,0 +1,25 @@ +--- +name: Syntax Highlighting problem +about: Create a bug report for mis-highlighted code in one of the default languages. + +--- + + + +- Sublime Version: +- OS Version: + + + +``` lang +# Minimum code snippet to demonstrate the issue +``` + + diff --git a/assets/syntaxes/Packages/.github/ISSUE_TEMPLATE/02-bug-file-indexing.md b/assets/syntaxes/Packages/.github/ISSUE_TEMPLATE/02-bug-file-indexing.md new file mode 100644 index 000000000..44996ffb9 --- /dev/null +++ b/assets/syntaxes/Packages/.github/ISSUE_TEMPLATE/02-bug-file-indexing.md @@ -0,0 +1,26 @@ +--- +name: Go to Symbol problem +about: Create a bug report for file indexing in one of the default languages. + +--- + + + +- Sublime Version: +- OS Version: + +## Expected behavior + +## Actual behavior + +## Steps to reproduce + +1. +2. diff --git a/assets/syntaxes/Packages/.github/ISSUE_TEMPLATE/03-supporting-files.md b/assets/syntaxes/Packages/.github/ISSUE_TEMPLATE/03-supporting-files.md new file mode 100644 index 000000000..f574ed342 --- /dev/null +++ b/assets/syntaxes/Packages/.github/ISSUE_TEMPLATE/03-supporting-files.md @@ -0,0 +1,26 @@ +--- +name: Snippet, Completion, Indentation, or Build problem +about: Suggest improvements for one of the default language support files. + +--- + + + +- Sublime Version: +- OS Version: + +## Expected behavior + +## Actual behavior + +## Steps to reproduce + +1. +2. diff --git a/assets/syntaxes/Packages/.github/PULL_REQUEST_TEMPLATE/01-syntax-update-small.md b/assets/syntaxes/Packages/.github/PULL_REQUEST_TEMPLATE/01-syntax-update-small.md new file mode 100644 index 000000000..ccc3d92a7 --- /dev/null +++ b/assets/syntaxes/Packages/.github/PULL_REQUEST_TEMPLATE/01-syntax-update-small.md @@ -0,0 +1,11 @@ +--- +name: Small update to Syntax definition +about: I have made easily-reviewable changes to a `.sublime-syntax` file. +title: [PackageName] update_summary + +--- + +- [ ] My commit messages start with the package name in square brackets, e.g. `[XML]`. +- [ ] I have included new or enhanced [syntax tests][] to cover the changes. + +[syntax tests]: https://www.sublimetext.com/docs/3/syntax.html#testing diff --git a/assets/syntaxes/Packages/.github/PULL_REQUEST_TEMPLATE/02-syntax-update-significant.md b/assets/syntaxes/Packages/.github/PULL_REQUEST_TEMPLATE/02-syntax-update-significant.md new file mode 100644 index 000000000..c369c92db --- /dev/null +++ b/assets/syntaxes/Packages/.github/PULL_REQUEST_TEMPLATE/02-syntax-update-significant.md @@ -0,0 +1,33 @@ +--- +name: Large update to Syntax definition +about: I have made significant changes to a `.sublime-syntax` file. +title: [PackageName] update_summary + +--- + +- [ ] My commit messages start with the package name in square brackets, e.g. `[XML]`. +- [ ] I have included new or enhanced [syntax tests][] to cover the changes. +- [ ] I have included a performance comparison below: + + +## Performance + + +### Before changes + +``` +Syntax "Packages/PackageName/lang.sublime-syntax" took an average of 10.0ms over 10 runs +Syntax "Packages/PackageName/lang-types.sublime-syntax" took an average of 2.0ms over 10 runs +``` + +### After changes + +``` +Syntax "Packages/PackageName/lang.sublime-syntax" took an average of 10.2ms over 10 runs +Syntax "Packages/PackageName/lang-types.sublime-syntax" took an average of 2.0ms over 10 runs +``` + +[syntax tests]: https://www.sublimetext.com/docs/3/syntax.html#testing diff --git a/assets/syntaxes/Packages/.github/PULL_REQUEST_TEMPLATE/03-supporting-files.md b/assets/syntaxes/Packages/.github/PULL_REQUEST_TEMPLATE/03-supporting-files.md new file mode 100644 index 000000000..741b9fb00 --- /dev/null +++ b/assets/syntaxes/Packages/.github/PULL_REQUEST_TEMPLATE/03-supporting-files.md @@ -0,0 +1,8 @@ +--- +name: Update to supporting files +about: My changes do not include any `.sublime-syntax` file. +title: [PackageName] update_summary + +--- + +- [ ] My commit messages start with the package name in square brackets, e.g. `[XML]`. diff --git a/assets/syntaxes/Packages/.travis.yml b/assets/syntaxes/Packages/.travis.yml new file mode 100644 index 000000000..74c85d2d8 --- /dev/null +++ b/assets/syntaxes/Packages/.travis.yml @@ -0,0 +1,15 @@ +sudo: false +language: c +branches: + except: + - /^v[0-9]{4}$/ +install: + - wget --content-disposition https://download.sublimetext.com/latest/dev/linux/x64/syntax_tests + - tar xf "$(ls st3_syntax_tests_build_*_x64.tar.bz2)" + - mv st3_syntax_tests/syntax_tests ./ + - rm -R st3_syntax_tests* +before_script: + - mkdir -p Data/Packages/ + - find . -maxdepth 1 -mindepth 1 -type d -not -name 'Data' -exec mv '{}' Data/Packages/ \; +script: + - ./syntax_tests diff --git a/assets/syntaxes/Packages/ASP/ASP.sublime-syntax b/assets/syntaxes/Packages/ASP/ASP.sublime-syntax new file mode 100644 index 000000000..01811e5b7 --- /dev/null +++ b/assets/syntaxes/Packages/ASP/ASP.sublime-syntax @@ -0,0 +1,694 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: ASP +file_extensions: + - asa # asp is handled by HTML-ASP.sublime-syntax +scope: source.asp +variables: + apostrophe_comment_begin: "'" + rem_comment_begin: '\b(?i:REM)\b' + whitespace_or_end_of_statement: '(?=\s|$|:|{{apostrophe_comment_begin}}|{{rem_comment_begin}}|%>)' + identifier: '[a-zA-Z]\w*|\[(?:(?!%>|\]).)*(?:\]|(\n|(?=%>)))' # reserved words can be used if enclosed in square brackets, as can other characters not normally accepted + comparison_operators: '[=><]' + math_operators: '(?:[+*^&/\\-]|\b(?i:Mod)\b)' + logical_operators: '\b(?i:And|Not|Or|Xor|Is)\b' + operators: '{{comparison_operators}}|{{math_operators}}|{{logical_operators}}' + literal_number_hex: '(&[hH])\h+(&)?(?={{whitespace_or_end_of_statement}}|{{operators}}|[,)_])' + literal_number_decimal: '(?:(?:\d+\.\d*|\.?\d+)(?i:e[+-]?\d+)?)(?={{whitespace_or_end_of_statement}}|{{operators}}|[,)_])' + reserved_words: '\b(?i:Class|Sub|Function|Const|Dim|ReDim|Public|Private|End|Preserve|Select|Case|If|Else|ElseIf|Then|For|Each|Next|ByRef|ByVal|Set|Call|New|Option|With|To|In|While|Wend|Until|Loop|On|GoTo|Resume|Let|Get|Exit|Do)\b' # Default|Step|Error|Property are not reserved words + keywords: '\b(?i:Empty|False|Nothing|Null|True)\b' + constants: '\b(?i:vbTrue|vbFalse|vbCr|vbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbBinaryCompare|vbTextCompare|vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek|vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime|vbObjectError|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant|vbDataObject|vbDecimal|vbByte|vbArray|vbOkCancel|vbOkOnly|vbYesNo|vbYesNoCancel|vbAbortRetryIgnore|vbRetryCancel|vbYes|vbNo|vbAbort|vbCancel|vbIgnore|vbRetry|vbCritical|vbExclamation|vbInformation|vbQuestion|vbDefaultButton[123])\b' + functions: '\b(?i:Abs|Array|Add|Asc|Atn|CBool|CByte|CCur|CDate|CDbl|Chr|CInt|CLng|Conversions|Cos|CreateObject|CSng|CStr|Date|DateAdd|DateDiff|DatePart|DateSerial|DateValue|Day|Derived|Math|Escape|Eval|Exists|Exp|Filter|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent|GetLocale|GetObject|GetRef|Hex|Hour|InputBox|InStr|InStrRev|Int|Fix|IsArray|IsDate|IsEmpty|IsNull|IsNumeric|IsObject|Item|Items|Join|Keys|LBound|LCase|Left|Len|LoadPicture|Log|LTrim|RTrim|Trim|Maths|Mid|Minute|Month|MonthName|MsgBox|Now|Oct|Remove|RemoveAll|Replace|RGB|Right|Rnd|Round|ScriptEngine|ScriptEngineBuildVersion|ScriptEngineMajorVersion|ScriptEngineMinorVersion|Second|SetLocale|Sgn|Sin|Space|Split|Sqr|StrComp|String|StrReverse|Tan|Time|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year)\b' + asp_builtin_classes: '\b(?i:Application|ObjectContext|Request|Response|Server|Session)\b' + asp_builtin_events: '\b(?i:Application_OnEnd|Application_OnStart|OnTransactionAbort|OnTransactionCommit|Session_OnEnd|Session_OnStart)\b' + class_magic_funcs: '\b(?i:Class_Initialize|Class_Terminate)\b' + +contexts: + root_asp: + - match: '(?=%>)' + pop: true + + main: + - match: '\b(?i:End){{whitespace_or_end_of_statement}}' + scope: invalid.illegal.unexpected-token.asp + - match: '(?i:Option\s+Explicit)' + scope: keyword.asp + - include: definitions + - include: statements + + comments: + - match: '{{apostrophe_comment_begin}}' + scope: punctuation.definition.comment.asp + push: + - meta_scope: comment.line.apostrophe.asp + - include: root_asp + - match: \n + pop: true + - match: '{{rem_comment_begin}}' + scope: punctuation.definition.comment.asp + push: + - meta_scope: comment.line.rem.asp + - include: root_asp + - match: \n + pop: true + + line_continuation_char: + - match: '\b_' + scope: punctuation.separator.continuation.line.asp + push: + - match: '\S.*' + scope: invalid.illegal.expected-end-of-line.asp + - match: $ + set: + - match: '(?=\S)' # for VBS, use ^, but ASP allows multiple whitespace-only lines after the _, so we use (?=\S) + pop: true + + allow_line_continuation: + - match: '[\t ]+' + scope: '' + - include: line_continuation_char + - include: comments + + not_end_of_statement: + - match: ':' + scope: invalid.illegal.unexpected-end-of-statement.asp + pop: true + - match: \n + scope: invalid.illegal.unexpected-end-of-statement.asp + pop: true + - match: '{{rem_comment_begin}}|{{apostrophe_comment_begin}}' + set: + - meta_scope: invalid.illegal.unexpected-end-of-statement.asp + - match: \n + pop: true + - include: allow_line_continuation + + expect_not_end_of_statement: + - match: '' # this match pattern has been added to disable the illegal highlighting where a statement ends unexpectedly - to more closely match other syntaxes + pop: true + - include: not_end_of_statement + - match: '\s*(?=\S)' + pop: true + + expect_identifier_member_reference: + - match: '\s*({{identifier}})' + captures: + 1: variable.other.member.asp + pop: true + - match: '' # this match pattern has been added to disable the illegal highlighting where a statement ends unexpectedly - to more closely match other syntaxes + pop: true + - include: unexpected_token + + expect_identifier_reference: + - match: '\s*({{identifier}})' + captures: + 1: variable.other.asp + # 2: invalid.illegal.unclosed-variable-identifier.asp + pop: true + - match: '' # this match pattern has been added to disable the illegal highlighting where a statement ends unexpectedly - to more closely match other syntaxes + pop: true + - include: unexpected_token + + inside_string: + - meta_scope: string.quoted.double.asp + - include: root_asp + - match: \n + scope: invalid.illegal.unclosed-string.asp + pop: true + - match: '""' + scope: constant.character.escape.apostrophe.asp + - match: '"' + scope: punctuation.definition.string.end.asp + pop: true + + illegal_names: + - match: '{{keywords}}|{{constants}}|{{reserved_words}}|{{functions}}|{{asp_builtin_classes}}' + scope: invalid.illegal.name.asp + pop: true + + allow_statement_separator: + - match: ':' + scope: punctuation.terminator.statement.asp + pop: true + + unexpected_token: + - match: \n + scope: invalid.illegal.missing-token.asp + pop: true + - match: '\S+' + scope: invalid.illegal.unexpected-token.asp + pop: true + + statements: + - include: variable_definitions + - include: allow_line_continuation + - match: '\b(?i:On\s+Error\s+)' + scope: storage.type.asp + push: + - include: not_end_of_statement + - match: '\b(?i:Resume\s+Next){{whitespace_or_end_of_statement}}' + scope: storage.type.asp + pop: true + - match: '\b(?i:Goto\s+0){{whitespace_or_end_of_statement}}' + scope: storage.type.asp + pop: true + - include: unexpected_token + - match: '\b(?i:Randomize\s+Timer){{whitespace_or_end_of_statement}}' + scope: storage.type.asp + - match: '\b(?i:(Call)|(Set)){{whitespace_or_end_of_statement}}' + captures: + 1: keyword.other.call.asp + 2: keyword.other.set.asp + push: expect_identifier_reference + - match: '\b(?i:Exit\s+(?:Sub|Function|Property|For|Do)){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + - include: control_flow + - include: expression + + definitions: + - include: class_definitions + - include: method_definitions + - include: variable_definitions + + class_definitions: + - match: '\b(?i:Class)[ \t]+' + scope: storage.type.asp + push: class_name + + class_name: + - meta_scope: meta.class.asp meta.class.identifier.asp + - include: allow_line_continuation + - include: illegal_names + - match: '{{identifier}}' + scope: entity.name.class.asp + set: inside_class + - include: unexpected_token + + inside_class: + - meta_content_scope: meta.class.asp meta.class.body.asp + - match: '\b(?i:End){{whitespace_or_end_of_statement}}' + set: + - meta_scope: meta.class.asp meta.class.body.asp storage.type.class.end.asp + - include: allow_line_continuation + - match: '\b(?i:Class){{whitespace_or_end_of_statement}}' + pop: true + - include: unexpected_token + - include: method_definitions + - match: '\b((?i:Public(?:\s+Default)?|Private)\s+)?((?i:Property)){{whitespace_or_end_of_statement}}' + captures: + 1: storage.modifier.asp + 2: storage.type.function.asp + push: + - meta_scope: meta.method.asp meta.method.identifier.asp + - meta_content_scope: storage.type.function.asp + - include: not_end_of_statement + - match: '\b(?i:Get|Let|Set){{whitespace_or_end_of_statement}}' + set: [inside_method_without_meta, method_name_without_meta] + - include: unexpected_token + - include: variable_definitions + - include: allow_line_continuation + - match: '\S' # only field/method/property definitions allowed inside a class definition + scope: invalid.illegal.unexpected-token.asp + + inside_method_without_meta: + - match: '' + set: inside_method + + method_name_without_meta: + - match: '' + set: method_name + + variable_definitions: + - match: '\b(?i:(?:(?:Public|Private)\s+)?Const){{whitespace_or_end_of_statement}}' + scope: storage.modifier.asp + push: constant_body + - match: '\b(?i:Dim|ReDim(?:\s+Preserve)?){{whitespace_or_end_of_statement}}' + scope: storage.modifier.asp + push: dim_body + - match: '\b(?i:Private|Public(?!\s+Default))\s+(?!(?i:Function|Sub|Property))' + scope: storage.modifier.asp + push: dim_body + + constant_body: + - include: not_end_of_statement + - include: illegal_names + - match: '{{identifier}}' + scope: entity.name.constant.asp + set: + - include: not_end_of_statement + - match: '\s*(=)\s*' + captures: + 1: keyword.operator.assignment.asp + set: [constant_separator, constant_value] + - include: unexpected_token + + constant_separator: + - match: '\s*(,)\s*' + captures: + 1: punctuation.separator.variable-declaration.asp + set: constant_body + - include: allow_statement_separator + - match: '' + pop: true + + constant_value: + #- include: not_end_of_statement # this include has been commented out to disable the illegal highlighting where a statement ends unexpectedly - to more closely match other syntaxes + - include: allow_line_continuation # as the above include has been commented out, this one has been added in it's place + - match: '{{whitespace_or_end_of_statement}}' # as the above include has been commented out, this match pattern has been added to pop at the end of the logical statement + pop: true + - match: '{{literal_number_hex}}' + scope: constant.numeric.integer.hexadecimal.asp + captures: + 1: punctuation.definition.numeric.hexadecimal.asp + 2: punctuation.definition.numeric.hexadecimal.asp + pop: true + - match: '{{literal_number_decimal}}' + scope: constant.numeric.float.decimal.asp + pop: true + - match: '{{constants}}' + scope: constant.language.asp + pop: true + - match: '{{keywords}}' + scope: support.type.vb.asp # maybe should be keyword or constant? + pop: true + - match: '"' + scope: punctuation.definition.string.begin.asp + set: inside_string + - include: unexpected_token + + dim_body: + - include: not_end_of_statement + - include: illegal_names + - match: '{{identifier}}' + scope: variable.other.asp + set: + - include: allow_line_continuation + - match: '\(' + scope: punctuation.section.array.begin.asp + push: + - meta_scope: meta.array.definition.asp + - include: not_end_of_statement + - match: \) + scope: punctuation.section.array.end.asp + pop: true + - include: expression + - match: ',' + scope: punctuation.separator.array.asp + - match: '\s*(,)\s*' + captures: + 1: punctuation.separator.variable-declaration.asp + set: dim_body + - match: '' + pop: true + - include: unexpected_token + + method_definitions: + - match: '\b((?i:Public(?:\s+Default)?|Private)\s+)?((?i:Sub|Function)){{whitespace_or_end_of_statement}}' + captures: + 0: meta.method.asp meta.method.identifier.asp + 1: storage.modifier.asp + 2: storage.type.function.asp + push: [inside_method_without_meta, method_name_without_meta] + + method_name: + - meta_content_scope: meta.method.asp meta.method.identifier.asp + - include: allow_line_continuation + - include: illegal_names + - match: '{{asp_builtin_events}}|{{class_magic_funcs}}' + scope: entity.name.function.asp support.function.magic.event.asp + set: after_method_name + - match: '{{identifier}}' + scope: entity.name.function.asp + set: after_method_name + - match: $ + set: inside_method + + after_method_name: + - meta_content_scope: meta.method.asp meta.method.identifier.asp + - match: \( + scope: punctuation.section.parens.begin.asp + set: + - match: \) + scope: meta.method.asp meta.method.identifier.asp punctuation.section.parens.end.asp + pop: true + - match: $ + set: not_end_of_statement + - match: '(?=\S)' + push: + - meta_scope: meta.method.asp meta.method.identifier.asp + - match: '(?=\)|$)' + pop: true + - include: not_end_of_statement + - match: '((?i:ByRef|ByVal)\s+)?({{identifier}})' + captures: + 1: storage.modifier.reference.asp + 2: variable.parameter.function.asp + push: + - match: '\s*(\()(\))\s*' + captures: + 1: punctuation.section.array.begin.asp + 2: punctuation.section.array.end.asp + set: after_method_param_name + - include: after_method_param_name + - match: '(?:(?![,)])\S)+' + scope: invalid.illegal.unexpected-token.asp + - match: '\s+' + - match: ':' + scope: meta.method.asp punctuation.terminator.statement.asp + pop: true + - include: allow_line_continuation + - match: $ + pop: true + - include: unexpected_token + + after_method_param_name: + - match: '(?=\)|$)' + pop: true + - include: not_end_of_statement + - match: '\s*(,)\s*' + captures: + 1: punctuation.separator.parameter-declaration.asp + pop: true + - match: '(?:(?![,)])\S)+' + scope: invalid.illegal.unexpected-token.asp + pop: true + + inside_method: + - meta_content_scope: meta.method.asp meta.method.body.asp + - include: inside_block + - match: '\b(?i:End){{whitespace_or_end_of_statement}}' + scope: storage.type.function.end.asp + set: + - meta_content_scope: meta.method.asp storage.type.function.end.asp + - include: allow_line_continuation + - match: '\b(?i:Function|Sub|Property){{whitespace_or_end_of_statement}}' + scope: meta.method.asp storage.type.function.end.asp + pop: true + - include: unexpected_token + - include: statements + + control_flow: + - match: '\b(?i:If){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + push: then_could_be_block_or_single_line + - match: '\b(?i:With){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + push: [inside_control_flow_with, expression_until_end_of_statement, expect_not_end_of_statement] + - match: '\b(?i:Select\s+Case){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + push: [inside_control_flow_select, expression_until_end_of_statement, expect_not_end_of_statement] + - match: '\b(?i:Do){{whitespace_or_end_of_statement}}' + scope: meta.do.block.asp keyword.control.flow.asp + push: + - match: '\s+(?i:While|Until){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + set: [inside_control_flow_do, expression_until_end_of_statement, expect_not_end_of_statement] + - match: '' + set: inside_control_flow_do + - match: '\b(?i:While){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + push: [inside_control_flow_while, expression_until_end_of_statement, expect_not_end_of_statement] + - match: '\b(?i:For\s+Each){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + push: [control_flow_foreach_in, expect_identifier_reference] + - match: '\b(?i:For){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + push: [control_flow_forto, expect_identifier_reference] + + then_could_be_block_or_single_line: + - meta_content_scope: meta.between-if-and-then.asp + - match: '[\t ]+' + scope: '' # so that the meta_content_scope will apply to whitespace + - match: '\b(?i:Then){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + set: + - match: '\s*(?=$|{{apostrophe_comment_begin}}|{{rem_comment_begin}}|%>)' + set: inside_control_flow_if_block + - match: '' # if the above didn't match, then it is a single line if block + set: inside_control_flow_if_single_line + #- include: not_end_of_statement # this include has been commented out to disable the illegal highlighting where a statement ends unexpectedly - to more closely match other syntaxes + - match: '{{whitespace_or_end_of_statement}}' # the above commented out include has been replaced with this, to exit the if scope if there is no `Then` on the same logical line + pop: true + - include: expression + + elseif_then_block: + - meta_content_scope: meta.between-if-and-then.asp + - match: '\b(?i:Then){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + set: inside_control_flow_if_block + - include: expression + - include: not_end_of_statement + + expression: + - match: \) + scope: invalid.illegal.stray-close-bracket.asp + - match: '{{literal_number_hex}}' + scope: constant.numeric.integer.hexadecimal.asp + captures: + 1: punctuation.definition.numeric.hexadecimal.asp + 2: punctuation.definition.numeric.hexadecimal.asp + - match: '{{literal_number_decimal}}' + scope: constant.numeric.float.decimal.asp + - match: '{{constants}}' + scope: support.type.vb.asp # maybe this should be constant.language.asp + - match: '{{functions}}' + scope: support.function.vb.asp # TODO: scope opening and closing parens i.e. LBound(var_name) but needs to handle (ignore) nested parens LBound((var_name)). Will also apply to things like Response.Write below. Note that parens are optional (when return value is not used) i.e. on it's own line, `LBound var_name` is valid. In other cases the parens can't be accurately scoped, because we don't know if they are for array access or method params + - match: '{{keywords}}' + scope: storage.type.asp + - include: operators + - match: '\b(?i:New){{whitespace_or_end_of_statement}}' + scope: keyword.other.new.asp + push: expect_identifier_reference + - match: '{{reserved_words}}' + scope: invalid.illegal.unexpected-token.literal.asp + - match: '"' + scope: punctuation.definition.string.begin.asp + push: inside_string + - match: '\b((?i:Request))\b(?:(?i:(\.)\s*(?:(BinaryRead)|(ClientCertificate|Cookies|Form|QueryString|ServerVariables)|(TotalBytes)))\b)?' + captures: # https://msdn.microsoft.com/en-us/library/ms524948%28v=vs.90%29.aspx + 1: support.class.asp + 2: punctuation.accessor.dot.asp + 3: support.function.asp + 4: support.class.collection.asp + 5: support.property.asp + - match: '\b((?i:Response))\b(?:(?i:(\.)\s*(?:(AddHeader|AppendToLog|BinaryWrite|Clear|End|Flush|Redirect|Write)|(Buffer|CacheControl|Charset|CodePage|ContentType|Expires|ExpiresAbsolute|IsClientConnected|LCID|PICS|Status)|(Cookies)))\b)?' + captures: # https://msdn.microsoft.com/en-us/library/ms525405%28v=vs.90%29.aspx + 1: support.class.asp + 2: punctuation.accessor.dot.asp + 3: support.function.asp + 4: support.property.asp + 5: support.class.collection.asp + - match: '\b((?i:Server))\b(?:(?i:(\.)\s*(?:(CreateObject|Execute|GetLastError|HTMLEncode|MapPath|Transfer|URLEncode)|(ScriptTimeout)))\b)?' + captures: # https://msdn.microsoft.com/en-us/library/ms525541%28v=vs.90%29.aspx + 1: support.class.asp + 2: punctuation.accessor.dot.asp + 3: support.function.asp + 4: support.property.asp + - match: '\b((?i:Server))\b(?:(?i:(\.)\s*(?:(Abandon)|(CodePage|LCID|SessionID|Timeout)|(Contents|StaticObjects)))\b)?' + captures: # https://msdn.microsoft.com/en-us/library/ms524319%28v=vs.90%29.aspx + 1: support.class.asp + 2: punctuation.accessor.dot.asp + 3: support.function.asp + 4: support.property.asp + 5: support.class.collection.asp + - match: '\b((?i:ObjectContext))\b(?:(?i:(\.)\s*(SetAbort|SetComplete))\b)?' + captures: # https://msdn.microsoft.com/en-us/library/ms525667%28v=vs.90%29.aspx + 1: support.class.asp + 2: punctuation.accessor.dot.asp + 3: support.function.asp + - match: '\b((?i:Application))\b(?:(?i:(\.)\s*(?:(Lock|Unlock)|(Contents|StaticObjects)))\b)?' + captures: # https://msdn.microsoft.com/en-us/library/ms524319%28v=vs.90%29.aspx + 1: support.class.asp + 2: punctuation.accessor.dot.asp + 3: support.function.asp + 4: support.class.collection.asp + - match: '{{identifier}}' + captures: + 0: variable.other.asp + #1: invalid.illegal.unclosed-variable-identifier.asp + push: + - match: '\s+(?=\.)' + scope: invalid.illegal.unexpected-token.asp # . punctuation accessor must come immediately after an identifier + pop: true + - match: '' + pop: true + - match: \( + scope: punctuation.section.parens.begin.asp + push: inside_parens + - include: allow_line_continuation + + inside_parens: + - match: \) + scope: punctuation.section.parens.end.asp + pop: true + - match: '\s+' # this match pattern has been added to disable the illegal highlighting where a statement ends unexpectedly - to more closely match other syntaxes + scope: '' + - match: '{{whitespace_or_end_of_statement}}' # this match pattern has been added to disable the illegal highlighting where a statement ends unexpectedly - to more closely match other syntaxes + pop: true + - match: $\n + scope: invalid.illegal.missing-close-bracket.asp + pop: true + - include: expression + + operators: + - match: '(?i:Is\s+Not\b)' # the correct syntax is: If Not (x Is y) Then ' the parens are optional but make it clearer + scope: invalid.illegal.unexpected-token.asp + - match: '{{math_operators}}\s*=' # ASP does not support shorthand + scope: invalid.illegal.unexpected-token.asp + - match: '><' # ASP not equal comparison is <> + scope: invalid.illegal.unexpected-token.asp + - match: '({{math_operators}}|{{comparison_operators}})|({{logical_operators}})' + captures: + 1: keyword.operator.asp + 2: keyword.operator.logical.asp + push: expect_not_end_of_statement + - match: ':' + scope: punctuation.terminator.statement.asp + - match: (\.)(\.)? + captures: + 1: punctuation.accessor.dot.asp + 2: invalid.illegal.unexpected-token.asp + push: expect_identifier_member_reference + + inside_control_flow_with: + - meta_scope: meta.with.block.asp + - include: inside_block + - match: '\b(?i:End){{whitespace_or_end_of_statement}}' + set: + - meta_scope: keyword.control.flow.asp + - include: allow_line_continuation + - match: '\b(?i:With){{whitespace_or_end_of_statement}}' + pop: true + - include: unexpected_token + - include: statements + + inside_control_flow_if_single_line: + - meta_scope: meta.if.line.asp + - match: $ + pop: true + - include: inside_control_flow_if_common + + inside_control_flow_if_block: + - meta_scope: meta.if.block.asp + - match: '\b(?i:ElseIf){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + set: elseif_then_block + - match: '\b(?i:End){{whitespace_or_end_of_statement}}' + set: + - meta_scope: keyword.control.flow.asp + - include: allow_line_continuation + - match: '\b(?i:If){{whitespace_or_end_of_statement}}' + pop: true + - include: unexpected_token + - include: inside_control_flow_if_common + + inside_control_flow_if_common: + - include: inside_block + - match: '\b(?i:Else){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + # the else retains the block or single line mode of the opening if statement, so we don't set a different context + - include: statements + + inside_control_flow_select: + - meta_scope: meta.select.block.asp + - include: inside_block + - match: '\b(?i:End){{whitespace_or_end_of_statement}}' + set: + - meta_scope: keyword.control.flow.asp + - include: allow_line_continuation + - match: '\b(?i:Select){{whitespace_or_end_of_statement}}' + pop: true + - include: unexpected_token + - match: '\b(?i:Case\s+Else){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + - match: '\b(?i:Case){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + push: [expression_until_end_of_statement, expect_not_end_of_statement] + - include: statements + + expression_until_end_of_statement: + - include: allow_statement_separator + - include: root_asp + - match: $ + pop: true + - include: expression + + inside_control_flow_do: + - meta_scope: meta.do.block.asp + - include: inside_block + - match: '\b(?i:Loop){{whitespace_or_end_of_statement}}' + set: + - meta_scope: keyword.control.flow.asp + - include: allow_line_continuation + - match: '\b(?i:While|Until){{whitespace_or_end_of_statement}}' + set: expression_until_end_of_statement + - match: '' + pop: true + - include: statements + + inside_control_flow_while: + - meta_scope: meta.while.block.asp + - include: inside_block + - match: '\b(?i:Wend){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + pop: true + - include: statements + + inside_control_flow_for: + - meta_scope: meta.for.block.asp + - include: inside_block + - match: '\b(?i:Next){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + pop: true + - include: statements + + control_flow_foreach_in: + - meta_scope: meta.for.block.asp + - match: '\b(?i:In){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + set: [inside_control_flow_for, expression_until_end_of_statement] + + control_flow_forto: + - meta_scope: meta.for.block.asp + - match: '\b(?i:To){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + set: [inside_control_flow_for, for_after_to, expect_not_end_of_statement] + - include: not_end_of_statement + - include: expression + + for_after_to: + - match: '\b(?i:Step){{whitespace_or_end_of_statement}}' + scope: keyword.control.flow.asp + set: [expression_until_end_of_statement, expect_not_end_of_statement] + - include: expression_until_end_of_statement + + inside_block: + - match: '%>' + scope: punctuation.section.embedded.end.inside-block.asp + push: + - clear_scopes: true + - meta_scope: text.html.asp + - match: '<%=?' + scope: punctuation.section.embedded.begin.inside-block.asp + pop: true + - match: '\s+$' # eat whitespace so that the lookahead on the next match pattern can match the next line if appropriate + push: + - match: ^ + pop: true + - match: '(\s*")?(?=[^<>]*>|\s+\w+=\s*")' # if the next occurrence of a < or > is a >, we are inside a tag. If it looks like an attribute is being defined, we are probably in a tag + scope: string.quoted.double.html punctuation.definition.string.end.html + push: # use a push and an include so that the root scope (text.html.basic) isn't applied + - meta_scope: meta.tag.after-embedded-asp.any.html + - match: '>' + scope: punctuation.definition.tag.end.html + set: scope:text.html.asp#html + - include: scope:text.html.basic#tag-attributes + with_prototype: + - match: '(?=<%)' + pop: true + - match: '' + push: scope:text.html.asp#html + with_prototype: + - match: '(?=<%)' + pop: true diff --git a/assets/syntaxes/Packages/ASP/Comments.tmPreferences b/assets/syntaxes/Packages/ASP/Comments.tmPreferences new file mode 100644 index 000000000..2419e5684 --- /dev/null +++ b/assets/syntaxes/Packages/ASP/Comments.tmPreferences @@ -0,0 +1,21 @@ + + + + name + Comments + scope + source.asp + settings + + shellVariables + + + name + TM_COMMENT_START + value + ' + + + + + diff --git a/assets/syntaxes/Packages/ASP/HTML-ASP.sublime-syntax b/assets/syntaxes/Packages/ASP/HTML-ASP.sublime-syntax new file mode 100644 index 000000000..36e4b5d17 --- /dev/null +++ b/assets/syntaxes/Packages/ASP/HTML-ASP.sublime-syntax @@ -0,0 +1,60 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: HTML (ASP) +file_extensions: + - asp +scope: text.html.asp +contexts: + main: + - include: html + + asp_punctuation_begin: + - match: '<%' + scope: punctuation.section.embedded.begin.asp + push: + - match: '@' # https://msdn.microsoft.com/en-us/library/ms525579%28v=vs.90%29.aspx + set: asp_directive + - match: '=' + scope: punctuation.section.embedded.begin.asp + set: [close_embedded_asp, begin_embedded_asp_expression] + - match: '(?=\S)' + set: [close_embedded_asp, begin_embedded_asp] + + asp_directive: + - match: '@?\s*\b((?i:ENABLESESSIONSTATE|LANGUAGE|LCID|TRANSACTION))\b' + captures: + 1: constant.language.processing-directive.asp + push: + - match: '\s*(=)\s*' + scope: punctuation.separator.key-value.asp + pop: true + - match: '(?=%>)' + pop: true + - match: '%>' + scope: punctuation.section.embedded.end.asp + pop: true + + html: + - match: '' + set: + - include: scope:text.html.basic + with_prototype: + - include: asp_punctuation_begin + + begin_embedded_asp: + - meta_content_scope: source.asp.embedded.html + - match: '(?=%>)' + pop: true + - include: scope:source.asp + + begin_embedded_asp_expression: + - meta_content_scope: source.asp.embedded.html + - match: '(?=%>)' + pop: true + - include: scope:source.asp#expression + + close_embedded_asp: + - match: '%>' + scope: punctuation.section.embedded.end.asp + pop: true diff --git a/assets/syntaxes/Packages/ASP/Indentation Rules.tmPreferences b/assets/syntaxes/Packages/ASP/Indentation Rules.tmPreferences new file mode 100644 index 000000000..a9f20adfc --- /dev/null +++ b/assets/syntaxes/Packages/ASP/Indentation Rules.tmPreferences @@ -0,0 +1,20 @@ + + + + name + Indentation Rules + scope + source.asp - comment + settings + + decreaseIndentPattern + ^\s*(?i:end|else|elseif|loop|wend|next)(\s|$) + increaseIndentPattern + (?x)(^\s*( + ((?i:private|public(?!\s+default))\s+)?(?i:function|sub|property)\s + | + (?i:class|if|select\s+case|with|do|for|while)\s + )) + + + diff --git a/assets/syntaxes/Packages/ASP/Indexed Symbol List.tmPreferences b/assets/syntaxes/Packages/ASP/Indexed Symbol List.tmPreferences new file mode 100644 index 000000000..005739f0e --- /dev/null +++ b/assets/syntaxes/Packages/ASP/Indexed Symbol List.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List + scope + source.asp entity.name.class.asp, source.asp entity.name.method.asp + settings + + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/ASP/Symbol List.tmPreferences b/assets/syntaxes/Packages/ASP/Symbol List.tmPreferences new file mode 100644 index 000000000..53f655cba --- /dev/null +++ b/assets/syntaxes/Packages/ASP/Symbol List.tmPreferences @@ -0,0 +1,22 @@ + + + + name + Symbol List + scope + source.asp meta.class.identifier.asp, source.asp meta.method.identifier.asp + settings + + showInSymbolList + 1 + symbolTransformation + + + + diff --git a/assets/syntaxes/Packages/ASP/syntax_test_asp.asp b/assets/syntaxes/Packages/ASP/syntax_test_asp.asp new file mode 100644 index 000000000..f1b00b05b --- /dev/null +++ b/assets/syntaxes/Packages/ASP/syntax_test_asp.asp @@ -0,0 +1,1135 @@ +' SYNTAX TEST "Packages/ASP/HTML-ASP.sublime-syntax" + + +'<- meta.tag.structure.any.html punctuation.definition.tag.begin.html - source.asp.embedded.html +'^^^^ meta.tag.structure.any.html entity.name.tag.structure.any.html +' ^ meta.tag.structure.any.html punctuation.definition.tag.end.html + <%@ TRANSACTION = Required %> +'^^ punctuation.section.embedded.begin.asp +' ^^^^^^^^^^^ constant.language.processing-directive.asp +' ^ punctuation.separator.key-value.asp +' ^^ punctuation.section.embedded.end.asp +<% + @language = VBScript ENABLESESSIONSTATE=False @@LCID=1033 +' ^^^^^^^^ constant.language.processing-directive.asp +' ^ punctuation.separator.key-value.asp +' ^^^^^^^^^^^^^^^^^^ constant.language.processing-directive.asp +' ^ punctuation.separator.key-value.asp +' ^^^^ constant.language.processing-directive.asp +' ^ punctuation.separator.key-value.asp +' comments are not supported here +'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - comment +%> +<% @ + transaction +' ^^^^^^^^^^^ constant.language.processing-directive.asp += required +'<- punctuation.separator.key-value.asp +%> +<% transaction=required %> +' ^^^^^^^^^^^ variable.other.asp - constant.language.processing-directive.asp + +'<- meta.tag + ASP Test Page: <%=Request.ServerVariables("SCRIPT_NAME")%> + ' ^^^ punctuation.section.embedded.begin.asp - source.asp + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.asp + ' ^^^^^^^ support.class.asp + ' ^ punctuation.accessor.dot.asp + ' ^^^^^^^^^^^^^^^ support.class.collection.asp + ' ^^ punctuation.section.embedded.end.asp - source.asp + ' ^^^^^^^^ meta.tag + + + <% + '^^ punctuation.section.embedded.begin.asp + 'this is a comment + '^ punctuation.definition.comment.asp + '^^^^^^^^^^^^^^^^^^^ comment.line.apostrophe.asp + + Option Explicit + '^^^^^^^^^^^^^^^ keyword + + Class TestClass + '^^^^^^^^^^^^^^^ meta.class.asp meta.class.identifier.asp - meta.class.body.asp + '^^^^^ storage.type.asp + ' ^^^^^^^^^ meta.class.asp meta.class.identifier.asp entity.name.class.asp + ' comment + '^^^^^^^^^^ comment.line.apostrophe.asp + '<- meta.class.body.asp - meta.class.identifier.asp + Private m_NameVar + '^^^^^^^ storage.modifier.asp - meta.method.identifier.asp + ' ^^^^^^^^^ variable.other.asp + Private m_CategoryVar + Public Const a = 2e-3, b2="c""": const c = 4, const = + '^^^^^^^^^^^^ storage.modifier.asp + ' ^ entity.name.constant.asp + ' ^ keyword.operator.assignment.asp + ' ^^^^ constant.numeric.float.decimal.asp + ' ^ punctuation.separator.variable-declaration.asp + ' ^^ entity.name.constant.asp + ' ^ keyword.operator.assignment.asp + ' ^^^^^ string.quoted.double.asp + ' ^ punctuation.terminator.statement.asp + ' ^^^^^ storage.modifier.asp + ' ^^^^^ invalid.illegal.name.asp - entity.name.constant.asp +'<- - invalid.illegal.unexpected-token.asp + Const d = &HAB + '^^^^^ storage.modifier.asp + ' ^^^^ constant.numeric.integer.hexadecimal.asp + ' ^^ punctuation.definition.numeric.hexadecimal.asp + Const e = "I am an unclosed string + ' ^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.asp + ' ^ invalid.illegal.unclosed-string.asp +'<- - invalid.illegal.unclosed-string.asp + + private sub Class_Initialize () + '^^^^^^^ storage.modifier.asp + ' ^^^ storage.type.function.asp + ' ^^^^^^^^^^^^^^^^ support.function.magic.event.asp + m_NameVar = "" + '^^^^^^^^^ variable.other.asp + ' ^ punctuation.definition.string.begin.asp + ' ^ punctuation.definition.string.end.asp + ' ^^ string.quoted.double.asp + ' ^ - string + End Sub + + Public Property Get Name() + '^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + '^^^^^^ storage.modifier.asp + ' ^^^^^^^^^^^^ storage.type.function.asp + ' ^^^^ entity.name.function.asp + ' ^ punctuation.section.parens.begin.asp - entity.name.function.asp + ' ^ punctuation.section.parens.end.asp + Name = m_NameVar +'<- meta.method.asp meta.method.body.asp - meta.method.identifier.asp + End Property + '^^^^^^^^^^^^ meta.method.asp + '^^^^^^^^^^^^ storage.type.function.end.asp + ' ^ - meta.method.asp - meta.method.body.asp - storage.type.function.end.asp + + public property let Name(nameParam) + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + '^^^^^^ storage.modifier.asp + ' ^^^^^^^^^^^^ storage.type.function.asp + ' ^^^^ entity.name.function.asp - storage.type.function.asp + ' ^ punctuation.section.parens.begin.asp - entity.name.function.asp + ' ^^^^^^^^^ variable.parameter.function.asp + ' ^ punctuation.section.parens.end.asp + m_NameVar = nameParam + End Property + + Public Property Get Category + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + ' ^^^^^^^^^^^^ storage.type.function.asp + ' ^^^^^^^^ entity.name.function.asp + Category = m_CategoryVar +'<- meta.method.asp meta.method.body.asp - meta.method.identifier.asp + End Property + + Property Let Category(categoryParam + '^^^^^^^^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + '^^^^^^^^^^^^ storage.type.function.asp + ' ^^^^^^^^ entity.name.function.asp + ' ^ punctuation.section.parens.begin.asp + ' ^^^^^^^^^^^^^ variable.parameter.function.asp + ' ^ invalid.illegal.unexpected-end-of-statement.asp + m_CategoryVar = categoryParam +'<- meta.method.asp meta.method.body.asp - meta.method.identifier.asp + End Property + '^^^^^^^^^^^^ meta.method.asp + '^^^^^^^^^^^^ storage.type.function.end.asp + ' ^ - meta.method.asp - meta.method.body.asp - storage.type.function.end.asp + + Private Property Set Category(categoryParam) Set m_CategoryVar = categoryParam End Property + '^^^^^^^ storage.modifier.asp + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.asp meta.class.body.asp meta.method.asp meta.method.identifier.asp - meta.method.identifier.asp meta.method.identifier.asp - meta.method.body.asp + ' ^^^^^^^^^^^^ storage.type.function.asp + ' ^^^^^^^^ entity.name.function.asp + ' ^ punctuation.section.parens.begin.asp + ' ^^^^^^^^^^^^^ variable.parameter.function.asp + ' ^ punctuation.section.parens.end.asp + ' ^^^ storage.type.function.asp - keyword - storage.type.asp + ' ^ meta.method.asp meta.method.body.asp - meta.method.identifier.asp + ' ^^^^^^^^^^^^ storage.type.function.end.asp + ' ^ - meta.method + + Public Default Function Go rem no parens + '^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + '^^^^^^^^^^^^^^ storage.modifier.asp + ' ^^^^^^^^ storage.type.function.asp + ' ^^ entity.name.function.asp + ' ^^^^^^^^^^^^^ comment.line.rem.asp + Go = "going... going... gone!" +'<- meta.method.asp meta.method.body.asp - meta.method.identifier.asp + '^^ - invalid + ' ^ keyword.operator.asp + End Function + '^^^^^^^^^^^^ meta.method.asp + '^^^^^^^^^^^^ storage.type.function.end.asp + ' ^ - meta.method + + Sub Test123:Call DoSomething:End Sub + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.asp + '^^^ meta.method.asp meta.method.identifier.asp storage.type.function.asp + ' ^^^^^^^ meta.method.identifier.asp entity.name.function.asp + ' ^ punctuation.terminator.statement.asp + ' ^^^^^^^^^^^^^^^^ meta.method.body.asp + ' ^^^^^^^ storage.type.function.end.asp + ' ^ - meta.method + + Class SubClass ' nested classes are not allowed +'<- - invalid.illegal.unexpected-token.asp + '^^^^^ invalid.illegal.unexpected-token.asp + ' ^^^^^^^^ invalid.illegal.unexpected-token.asp + ' ^ comment.line.apostrophe.asp - invalid.illegal.unexpected-token.asp + + Sub Test1234 Set x = y + '^^^ invalid.illegal.unexpected-token.asp + End Sub + '^^^^^^^ meta.class.asp meta.method.asp storage.type.function.end.asp + + code_in_class_definition_but_outside_of_a_method = "invalid" + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid.illegal.unexpected-token.asp + ' ^ invalid.illegal.unexpected-token.asp + ' ^^^^^^^^^ invalid.illegal.unexpected-token.asp + End Class + '^^^^^^^^^ storage.type.class.end.asp + '^^^^^^^^^ meta.class.body.asp + ' ^ - storage.type.class.end.asp - meta.class.body.asp + + Const blah = _ + + "blah"rem-"testing" + ' ^^^^^^ string.quoted.double.asp + ' ^^^^^^^^^^^^^^ comment.line.rem.asp - string + + Class TestClass2 Public Sub TestSub () Response.Write("wow") End Sub End Class + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.asp + '^^^^^^^^^^^^^^^^ meta.class.identifier.asp - meta.class.body.asp - meta.class.identifier.asp meta.class.identifier.asp + '^^^^^ storage.type.asp + ' ^^^^^^^^^^ entity.name.class.asp + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.body.asp - meta.class.identifier.asp + ' ^^^^^^^^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + ' ^^^^^^ storage.modifier.asp + ' ^^^ storage.type.function.asp + ' ^^^^^^^ entity.name.function.asp + ' ^^ punctuation.section.parens - meta.method.identifier.asp meta.method.identifier.asp + ' ^ meta.method.asp meta.method.body.asp - meta.method.identifier.asp + ' ^^^^^^ storage.type.function.end.asp + ' ^^^^^^^^^ meta.class.body.asp + ' ^^^^^^^^^ storage.type.class.end.asp + ' ^ - meta.class + + Const abc = 'fgfg + '^^^^^ storage.modifier.asp + ' ^^^ entity.name.constant.asp + Private a, b + '^^^^^^^ storage.modifier.asp + ' ^ variable.other.asp + ' ^ punctuation.separator.variable-declaration.asp + ' ^ variable.other.asp + Set a = new TestClass + '^^^ keyword.other.set.asp - storage.type.function.asp + ' ^ variable.other.asp + ' ^^^ keyword.other.new.asp + a.Name = blah + '^ variable.other.asp + ' ^ punctuation.accessor.dot.asp + + Function GetModifiedDate(path) ' test function + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + ' ^ punctuation.definition.comment.asp + ' ^^^^^^^^^^^^^^^^ comment.line.apostrophe.asp + ' ^ - meta.method.identifier.asp + '^^^^^^^^ storage.type.function.asp + ' ^^^^^^^^^^^^^^^ entity.name.function.asp + ' ^ punctuation.section.parens.begin.asp + ' ^^^^ variable.parameter.function.asp + ' ^ punctuation.section.parens.end.asp + On Error Resume Next +'<- meta.method.body.asp - comment + '^^^^^^^^^^^^^^^^^^^^ storage.type.asp + Set fs = Server.CreateObject("Scripting.FileSystemObject") + '^^^ keyword.other.set.asp + ' ^ keyword.operator.asp + ' ^^^^^^ support.class.asp + ' ^ punctuation.accessor.dot.asp + ' ^^^^^^^^^^^^ support.function + ' ^ punctuation.definition.string.begin.asp + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.asp - punctuation.accessor.dot.asp + ' ^ punctuation.definition.string.end.asp + With fs + '^^^^ keyword.control.flow.asp + ' ^^ variable.other.asp + ' ^ meta.with.block.asp + Set rs = .GetFile(Server.MapPath(path)) + ' ^ meta.with.block.asp punctuation.accessor.dot.asp + ' ^ meta.with.block.asp punctuation.accessor.dot.asp + GetModifiedDate = rs.DateLastModified + Set rs = Nothing + '^^^ keyword.other.set.asp + ' ^ keyword.operator.asp + ' ^^^^^^^ storage.type.asp + .Close + '^ punctuation.accessor.dot.asp + ' ^^^^^ variable + . Close + '^ punctuation.accessor.dot.asp + ' ^ - invalid + ' ^^^^^ variable + End With + '^^^^^^^^ keyword.control.flow.asp + ' ^ - meta.with.block.asp + + Set fs = Nothing + On Error Goto 0 + '^^^^^^^^^^^^^^^ storage.type.asp + ' ^ - storage.type.asp + End Function + '^^^^^^^^^^^^ storage.type.function.end.asp + + modified = GetModifiedDate("demo_lastmodified.asp") + ' ^^^^^^^^^^^^^^^ variable + + Sub Example () + '^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + '^^^ storage.type.function.asp + ' ^^^^^^^ entity.name.function.asp + ' ^ - entity.name.function.asp + ' ^^ punctuation.section.parens + div = 4 + ' ^ keyword.operator.asp + ' ^ constant.numeric + + If 1
1 Then ' if block + '^^ keyword.control.flow.asp + ' ^^^^^^^^^^^^^^^ meta.between-if-and-then.asp + ' ^ keyword.operator.asp - punctuation.definition.tag.begin.html + ' ^^^ keyword.operator.logical.asp + ' ^ keyword.operator.asp - punctuation.definition.tag.end.html + ' ^^^^ keyword.control.flow.asp + ' ^ meta.if.block.asp + Exit Sub + '^^^^^^^^ keyword.control.flow.asp + ElseIf "abc>"<>"def= then " Then + '^^^^^^ keyword.control.flow.asp + ' ^^^^^^^^^^^^^^^^^^^^^^ meta.between-if-and-then.asp + ' ^ string.quoted.double.asp - keyword.operator.asp + ' ^^ keyword.operator.asp + ' ^ string.quoted.double.asp - keyword.operator + ' ^^^^ string.quoted.double.asp - keyword.control.flow.asp + ' ^^^^ keyword.control.flow.asp + ' ^ meta.if.block.asp + ElseIf new TestClass Then + ' ^^^ keyword.other.new.asp + ' ^^^^^^^^^ variable + Else + '^^^^ keyword.control.flow.asp + ' ^ meta.if.block.asp + example = example - 1 + ' ^ keyword.operator.asp + example -= 1 + ' ^^ invalid.illegal.unexpected-token.asp + example = example \ 5 + ' ^ keyword.operator.asp + End If + '^^^^^^ keyword.control.flow.asp + ' ^ - meta.if.block.asp + End Sub + '^^^^^^^ storage.type.function.end.asp + + If 1 _ + = 2 Then Call DoSomething + ' ^^^^ keyword.control.flow.asp + ' ^^^^^^^^^^^^^^^^^ meta.if.line.asp - meta.if.block.asp + ' ^^^^ keyword.other.call.asp + ' ^^^^^^^^^^^ variable + ' ^ - meta.if.line.asp + + Function IIf(expr, true_part, false_part) ' https://support.microsoft.com/en-us/kb/219271 + ' ^^^^ variable.parameter.function.asp + ' ^^^^^^^^^ variable.parameter.function.asp + ' ^^^^^^^^^^ variable.parameter.function.asp + If expr Then IIf = true_part Else IIf = false_part + ' ^^^^^^^^^^^^^^^^^ meta.if.line.asp + ' ^^ - keyword.control.flow.asp + ' ^^^^^^^^^^^^^^^^^ meta.if.line.asp + ' ^ - meta.if.line.asp + End Function + + If a is not nothing then a.b = a.b + 2 + ' ^^^^^^ invalid.illegal.unexpected-token.asp + ' ^^^^^^^ storage.type.asp + ' ^^^^ keyword.control.flow.asp + ' ^^^^^^^^^^^^^^^^^^ meta.between-if-and-then.asp + ' ^^^^^^^^^^^^^^ meta.if.line.asp + ' ^ - meta.if.line.asp + If not a is nothing then a.b = a.b + 2 + ' ^^^^^^^^^^^^^^^^^^ meta.between-if-and-then.asp + ' ^^^^^^^^^^^^^^ meta.if.line.asp + ' ^ variable.other.asp + ' ^ punctuation.accessor.dot.asp + ' ^ variable + ' ^ - meta.if.line.asp + ' ^^^^^^ - invalid + ' ^^ keyword.operator.logical.asp + ' ^^^^^^^ storage.type.asp + + If a Then + ' ^ meta.if.block.asp - meta.if.line.asp + DoSomething ( invalid_token_inside_parens, 2, if ) + ' ^^ invalid.illegal.unexpected-token.literal.asp + '^^^^^^^^^^^ variable + ' ^ punctuation.section.parens.begin.asp + ' ^ punctuation.section.parens.end.asp + ElseIf a = b Then AnotherSomething ' despite this being on the same line as the ElseIf, the End If is still required because the opening if statement was a block + ' ^ meta.if.block.asp - meta.if.line.asp + Else DoSomethingElse ' despite this being on the same line as the Else, the End If is still required because the opening if statement was a block + '^^^^ keyword.control.flow.asp + ' ^^^^^^^^^^^^^^^^ meta.if.block.asp + End If + ' ^ - meta.if.block.asp + + If a Then Call + + Dim str1_ REM example + '^^^ storage.modifier.asp + ' ^ - constant.numeric.asp + ' ^ - punctuation.separator.continuation.line.asp + ' ^^^ punctuation.definition.comment.asp + ' ^^^^^^^^^^^^ comment.line.rem.asp + str1 = "this is a ""hello-world""" & " " &"""" + "test" +_ 'continue on next line, comments not allowed here +'<- - comment.line.rem.asp + ' ^^ string.quoted.double.asp constant.character.escape.apostrophe.asp + ' ^ string.quoted.double.asp - keyword.operator.asp + ' ^^ string.quoted.double.asp constant.character.escape.apostrophe.asp - punctuation.definition.string.end.asp + ' ^ string.quoted.double.asp punctuation.definition.string.end.asp + ' ^ keyword.operator.asp + ' ^^^ string.quoted.double.asp + ' ^ keyword.operator.asp + ' ^^^^ string.quoted.double.asp + ' ^^ constant.character.escape.apostrophe.asp - punctuation.definition.string.end.asp + ' ^ keyword.operator.asp + ' ^ punctuation.separator.continuation.line.asp + ' ^^^^^^^^^^^^^ invalid.illegal.expected-end-of-line.asp - comment + Chr(34) & vbCrLf _ + + ' ^^^ support.function.vb.asp + ' ^ punctuation.section.parens.begin.asp + ' ^ punctuation.section.parens.end.asp + ' ^^^^^^ support.type.vb.asp + ' ^ punctuation.separator.continuation.line.asp + ' ^ invalid.illegal.expected-end-of-line.asp + + value = 1/2 + ' ^ keyword.operator.asp + value = &HFF mod 3 + ' ^^^^ constant.numeric.integer.hexadecimal.asp + ' ^^^ keyword.operator.asp + Select Case call value:Case 1 + '^^^^^^^^^^^ keyword.control.flow.asp + ' ^^^^ meta.select.block.asp invalid.illegal.unexpected-token.literal.asp + ' ^ meta.select.block.asp punctuation.terminator.statement.asp + ' ^^^^ keyword.control.flow.asp + Case 2 + '^^^^ keyword.control.flow.asp +'<- meta.select.block.asp + Case + Case vbNullString + '^^^^ keyword.control.flow.asp + ' ^^^^^^^^^^^^ support.type.vb.asp + Case Else + '^^^^^^^^^ keyword.control.flow.asp + If value >= 4 and Value<=5 Then MsgBox("no end if required here") + ' ^^ keyword.operator.asp + ' ^^ keyword.operator.asp + ' ^^^^^^ support.function.vb.asp + If Not (value Is Nothing) then valueis = vbFalse + ' ^^^ keyword.operator.logical.asp + ' ^ punctuation.section.parens.begin.asp + ' ^^ keyword.operator.logical.asp + ' ^ punctuation.section.parens.end.asp + ' ^^ - keyword.operator + ' ^^^^^^^ support.type.vb.asp +'<- meta.select.block.asp + End Select + '^^^^^^^^^^ keyword.control.flow.asp + ' ^ - meta.select.block.asp + 'the underscore in this comment should be ignored _ as should the colon : + ' ^ comment.line.apostrophe.asp - keyword - invalid - punctuation + ' ^ comment.line.apostrophe.asp - keyword - punctuation - invalid + + Sub Test _ + _ ' ^ punctuation.separator.continuation.line.asp + _ '^^^ storage.type.function.asp + _ ' ^^^^ entity.name.function.asp + _ '^^^^^^^^^ meta.method.asp meta.method.identifier.asp + (_ + _ ' ^ meta.method.asp meta.method.identifier.asp punctuation.section.parens.begin.asp + _ ' ^ punctuation.separator.continuation.line.asp + abc, ByRef def _ + _ '^^^ meta.method.asp meta.method.identifier.asp variable.parameter.function.asp + _ ' ^ meta.method.asp meta.method.identifier.asp punctuation.separator.parameter-declaration.asp + _ ' ^^^^^ meta.method.asp meta.method.identifier.asp storage.modifier.reference.asp + _ ' ^^^ meta.method.asp meta.method.identifier.asp variable.parameter.function.asp + _ ' ^ meta.method.asp meta.method.identifier.asp punctuation.separator.continuation.line.asp + ) + '^ meta.method.asp meta.method.identifier.asp punctuation.section.parens.end.asp + + Dim x _ + ,y() + ' ^^ meta.array.definition.asp punctuation.section.array + a) + '^ invalid.illegal.stray-close-bracket.asp + a( + ReDim arr(2,b) + '^^^^^ storage.modifier.asp + ' ^^^ variable.other.asp + ' ^^^^^ meta.array.definition.asp + ' ^ constant.numeric + ' ^ punctuation.separator.array.asp + ' ^ variable.other.asp - invalid - constant.numeric + ' ^ punctuation.section.array.end.asp + + ReDim arr(dim, other) + ' ^^^ invalid.illegal + ' ^ - invalid + ' ^^^^^^^^ - invalid + ReDim Dim(2,4) + ' ^^^ invalid.illegal.name.asp + +'<- - invalid + + Dim a(0,&H5&) + ' ^^^^^^^ meta.array.definition.asp + ' ^ punctuation.section.array.begin.asp + ' ^ constant.numeric + ' ^ punctuation.separator.array.asp + ' ^^^^ constant.numeric.integer.hexadecimal.asp + ' ^^ punctuation.definition.numeric.hexadecimal.asp + ' ^ punctuation.definition.numeric.hexadecimal.asp + ' ^ punctuation.section.array.end.asp + b = a Is Empty : Dim loop,nope : Dim foobar + '^^^^^^^^^^^^^^^^^^^^^ - invalid.illegal.unexpected-token.asp - invalid.illegal.name.asp + ' ^^^^^^^^^^^^^ - invalid + ' ^ punctuation.terminator.statement.asp + ' ^^^ storage.modifier.asp + ' ^^^^ invalid.illegal.name.asp - variable.other.asp + ' ^ punctuation.terminator.statement.asp + ' ^^^ storage.modifier.asp + Dim hello_world, 2 + ' ^ invalid.illegal.unexpected-token.asp - variable + ' ^ - invalid + + ReDim Preserve arr ( &HA,c) + '^^^^^^^^^^^^^^ storage.modifier.asp + ' ^^^ variable.other.asp + ' ^^^^^^^^ meta.array.definition.asp + ' ^ punctuation.section.array.begin.asp + ' ^^^ constant.numeric.integer.hexadecimal.asp + ' ^ punctuation.separator.array.asp + ' ^ punctuation.section.array.end.asp + For x = LBound(a) to UBound(a) Step 2 'test + '^^^ keyword.control.flow.asp + ' ^ variable.other.asp + ' ^ keyword.operator.asp + ' ^^^^^^ support.function.vb.asp + ' ^ punctuation.section.parens.begin.asp + ' ^ variable.other.asp + ' ^ punctuation.section.parens.end.asp + ' ^ punctuation.section.parens.begin.asp + ' ^ variable.other.asp + ' ^ punctuation.section.parens.end.asp + ' ^^ keyword.control.flow.asp + ' ^^^^^^ support.function.vb.asp + ' ^^^^ keyword.control.flow.asp + ' ^ constant.numeric + ' ^ meta.for.block.asp + ' ^^^^^^ comment.line.apostrophe.asp + a(x) = x * 10 + '^ variable.other.asp + ' ^ variable.other.asp + ' ^ punctuation.section.parens.begin.asp - variable.other.asp + ' ^ punctuation.section.parens.end.asp - variable.other.asp + ' ^ variable.other.asp + ' ^ keyword.operator.asp + Next + '^^^^ keyword.control.flow.asp + ' ^ - meta.for.block.asp + End Sub + + Sub NoParens fg + ' ^^^^^^^^ meta.method.asp meta.method.identifier.asp entity.name.function.asp + ' ^^ invalid.illegal.unexpected-token.asp - meta.method.identifier.asp + End Sub + + Function NoParams'() + '^^^^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + ' ^^^^^^^^ entity.name.function.asp + ' ^^^ comment.line.apostrophe.asp - entity.name.function.asp - invalid.illegal.unexpected-token-after-method-declaration.asp - punctuation.section.parens + NoParams = InStr(1, "hello_'", "L", vbTextCompare) +'<- meta.method.body.asp - invalid.illegal.unexpected-token-after-method-declaration.asp - meta.method.identifier.asp + '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - invalid.illegal.unexpected-token-after-method-declaration.asp - meta.method.asp meta.method.identifier.asp - invalid.illegal.expected-end-of-line.asp - comment.line.rem.asp + ' ^^^^^ support.function.vb.asp + ' ^ punctuation.section.parens.begin.asp + ' ^^^^^^^^^^^^^ support.type.vb.asp + ' ^ punctuation.section.parens.end.asp + Test = True Xor False + ' ^^^^ storage.type.asp + ' ^^^ keyword.operator.logical.asp + ' ^^^^^ storage.type.asp + End Function + Sub Test2 + '^^^ meta.method.asp meta.method.identifier.asp storage.type.function.asp + ' ^^^^^ meta.method.asp meta.method.identifier.asp entity.name.function.asp + hello = world + '^ - entity.name.function.asp - meta.method.asp meta.method.identifier.asp + End Sub + Call Test + '^^^^ keyword.other.call.asp + Call NoParams + + Sub Wow (test _ 'test + ,def _ '^^^^^^^^^^^^^^^^^^^^^^ meta.method.asp meta.method.identifier.asp + _ '^^^ storage.type.function.asp + ' ^^^ entity.name.function.asp + ' ^^^^^ invalid.illegal.expected-end-of-line.asp + ) ' this bracket doesn't form part of the method declaration - the line above is missing a _ and contains non-whitespace + '^ meta.method.body.asp - meta.method.identifier.asp - punctuation.section.parens.end.asp + MsgBox "hi", vbOkCancel or vbExclamation or vbDefaultButton1, "title" + ' ^^^^^^^^^^ support.type.vb.asp - variable.other.asp + ' ^^ keyword.operator.logical.asp + ' ^^^^^^^^^^^^^ support.type.vb.asp + ' ^^^^^^^^^^^^^^^^ support.type.vb.asp + End Sub + + Dim [], [ažė+, (], [dim], [a(4)] + ' ^^ variable.other.asp + ' ^ punctuation.separator.variable-declaration.asp - meta.variable-definition.asp + ' ^^^^^^^^^ variable.other.asp - keyword - punctuation + ' ^^^^^ variable.other.asp + ' ^ punctuation.separator.variable-declaration.asp + ' ^^^^^^ variable.other.asp - meta.array.definition.asp - punctuation.section.array + [dim] = 5 ^ 2 + '^^^^^ variable.other.asp + ' ^ keyword.operator.asp + + Function [abcdef()hij] (blah) + '^^^^^^^^ storage.type.function.asp + ' ^^^^^^^^^^^^^ entity.name.function.asp + ' ^ - entity.name.function.asp + ' ^^^^ variable.parameter.function.asp + [abcdef()hij] = blah + '^^^^^^^^^^^^^ variable.other.asp + ' ^^^^ variable.other.asp + End Function + '^^^^^^^^^^^^ storage.type.function.end.asp + Response.Write [abcdef()hij]("hello") + ' ^^^^^^^^^^^^^ variable.other.asp + ' ^ punctuation.section.parens.begin.asp + ' ^ punctuation.section.parens.end.asp + + End If ' nothing to end + '^^^ invalid.illegal.unexpected-token.asp +' check that the incomplete if gets dropped off after the end of the line +'<- - meta.between-if-and-then.asp invalid.illegal.unexpected-end-of-statement.asp + + For Each cookie In Request.Cookies + '<- - meta.between-if-and-then.asp + '^^^^^^^^ keyword.control.flow.asp + ' ^^^^^^ variable.other.asp + ' ^^ keyword.control.flow.asp + ' ^ meta.for.block.asp + Response.Write(vbCrLf & cookie) + '^^^^^^^^ support.class.asp + ' ^ punctuation.accessor.dot.asp + ' ^^^^^^ support.type.vb.asp + ' ^ keyword.operator.asp + ' ^^^^^^ variable.other.asp + If x = y Then Exit For + '^^ keyword.control.flow.asp + ' ^ variable.other.asp + ' ^ variable.other.asp + ' ^^^^ keyword.control.flow.asp + ' ^^^^^^^^^ meta.if.line.asp + ' ^^^^^^^^ keyword.control.flow.asp + ' ^ - meta.if.line.asp + Response.Write("----" & vbCrLf) + '^^^^^^^^ support.class.asp + ' ^ punctuation.section.parens.begin.asp + ' ^ punctuation.section.parens.end.asp + + abc = x >< y + ' ^^ invalid.illegal.unexpected-token.asp + abc = x <> y + ' ^^ keyword.operator.asp + Next + '^^^^ keyword.control.flow.asp + ' ^ - meta.for.block.asp + + If + '^^ keyword.control.flow.asp + ' ^ meta.between-if-and-then.asp + ' the above if statement has no "Then" + '^ - meta.between-if-and-then.asp + + Do + '^^ meta.do.block.asp keyword.control.flow.asp + Exit Do + '^^^^^^^ meta.do.block.asp keyword.control.flow.asp + Loop + '^^^^ keyword.control.flow.asp + ' ^ - meta.do.block.asp + + Do + Exit Do + Loop Until x = y + '^^^^^^^^^^ keyword.control.flow.asp + ' ^ variable.other.asp + ' ^ keyword.operator.asp + ' ^ variable.other.asp + ' ^ - meta.do.block.asp + + Do + Exit Do + Loop While x <> y + '^^^^^^^^^^ keyword.control.flow.asp + ' ^ variable.other.asp + ' ^ variable.other.asp + ' ^ - meta.do.block.asp - meta.while.block.asp + + While True + '^^^^^ meta.while.block.asp keyword.control.flow.asp + ' ^^^^ storage.type.asp - variable.other.asp + Wend + '^^^^ keyword.control.flow.asp + ' ^ - meta.while.block.asp + + Application.Lock + '^^^^^^^^^^^ support.class.asp - variable.other.asp + ' ^ punctuation.accessor.dot.asp + ' ^^^^ support.function.asp - variable.other.asp + Application("NumVisits") = Application("NumVisits") + 1 + '^^^^^^^^^^^ support.class.asp + ' ^ punctuation.section.parens.begin.asp + ' ^ punctuation.section.parens.end.asp + ' ^ punctuation.section.parens.begin.asp + ' ^ punctuation.section.parens.end.asp + Application.Unlock + '^^^^^^^^^^^ support.class.asp + ' ^ punctuation.accessor.dot.asp + ' ^^^^^^ support.function.asp + %> + This application page has been visited + <%= Application("NumVisits") %> times! + <% + + Sub Application_OnStart() + '^^^ storage.type.function.asp + ' ^^^^^^^^^^^^^^^^^^^ entity.name.function.asp support.function.magic.event.asp + Application("NumVisits") = 0 + ' ^ punctuation.section.parens.begin.asp + ' ^ punctuation.section.parens.end.asp + End Sub + '^^^^^^^ storage.type.function.end.asp + + Sub Application_OnStartup() + ' ^^^^^^^^^^^^^^^^^^^^^ entity.name.function.asp - support.function.magic.event.asp + End Sub + + Sub Func_With_Explicit_Arrays(ByRef array_variable(), blah ()) + ' ^ punctuation.section.array.begin.asp + ' ^ punctuation.section.array.end.asp + ' ^^^^^^^^^^^^ - invalid + ' ^ punctuation.separator.parameter-declaration.asp + ' ^^^^ variable.parameter.function.asp + ' ^ punctuation.section.array.begin.asp + ' ^ punctuation.section.array.end.asp + ' ^ punctuation.section.parens.end.asp + End Sub + + Sub Another_Test()rem + '^^^ storage.type.function.asp + ' ^^^^^^^^^^^^ entity.name.function.asp + ' ^^ punctuation.section.parens + ' ^^^^ comment.line.rem.asp - meta.method.identifier.asp + Const ForAppending = 8 + '^^^^^ meta.method.body.asp storage.modifier.asp + + Set objFSO = CreateObject("Scripting.FileSystemObject") + ' ^^^^^^ variable.other.asp + Set objTextFile = objFSO.OpenTextFile("d:\logfile.c", ForAppending, True) + ' ^^^^^^^^^^^^ variable.other.asp + + Dim Line + ' ^^^^ variable.other.asp + Line = 0 + '^^^^ variable.other.asp + Do While Line < 2000 + '^^^^^^^^ keyword.control.flow.asp + '^^^^^^^^^^^^^^^^^^^^^ meta.do.block.asp - meta.while.block.asp + ' ^^^^ variable.other.asp + ' ^ keyword.operator.asp + ' ^^^^ constant.numeric + objTextFile.WriteLine("long l" & Line & " = " & Line) + '^^^^^^^^^^^ variable.other.asp + ' ^^^^^^^^^ variable + Line = Line + 1 + Dim WshShell 'http://stackoverflow.com/a/2237479/4473405 + Set WshShell=Server.CreateObject("WScript.Shell") + WshShell.Run "waitfor /T " & numberOfSecond & "SignalThatWontHappen", , True + + do until Line = Line + '^^^^^^^^ keyword.control.flow.asp + ' ^^^^ variable.other.asp + ' ^^^^ variable.other.asp + '^^^^^^^^^^^^^^^^^^^^^ meta.do.block.asp meta.do.block.asp - invalid + ' this code will never run + loop + '^^^^ keyword.control.flow.asp + Loop + '^^^^ keyword.control.flow.asp + ' ^ - meta.do.block.asp + + objTextFile.Close + + Set objTextFile = Nothing + Set objFSO = Nothing + End _ + Sub + ' ^^^ storage.type.function.end.asp - meta.method.identifier.asp + + a=3.4*.5*6.*0.25 + ' ^^^ constant.numeric.float.decimal.asp + ' ^^ constant.numeric.float.decimal.asp + ' ^^ constant.numeric.float.decimal.asp + ' ^^^^ constant.numeric.float.decimal.asp + a=a+0.8 + ' ^^^ constant.numeric.float.decimal.asp + ExampleSub 3.4,.5,6.,&HA,&H2,7*2.1e2,9,-3.402823E+38, 3.402823E38 ,1.401298E-45,Round(4.94065645841247E-324),a2,2a,123.456.789.321.654.321 + ' ^^^ constant.numeric.float.decimal.asp + ' ^^ constant.numeric.float.decimal.asp + ' ^^ constant.numeric.float.decimal.asp + ' ^^^ constant.numeric.integer.hexadecimal.asp + ' ^^^ constant.numeric.integer.hexadecimal.asp + ' ^ constant.numeric + ' ^^^^^ constant.numeric.float.decimal.asp + ' ^ constant.numeric + ' ^^^^^^^^^^^^ constant.numeric.float.decimal.asp + ' ^^^^^^^^^^^ constant.numeric.float.decimal.asp + ' ^^^^^^^^^^^^ constant.numeric.float.decimal.asp + ' ^^^^^ support.function.vb.asp + ' ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal.asp + ' ^^ - constant.numeric + ' ^ - constant.numeric + ' ^^^^^^^^ - constant.numeric + + response.write(test..b) + ' ^ punctuation.accessor.dot.asp + ' ^ invalid.illegal.unexpected-token.asp + + [abc=123:def] = 4 + '^^^^^^^^^^^^^ variable.other.asp - punctuation - keyword - constant + + Randomize Timer + '^^^^^^^^^^^^^^^ storage.type.asp + a=Abs(-6)*Rnd()*2+Fix(2.75) + Int(3.14)/Sin(30)+Cos(20)+Tan(40)+Sqr(4)+Log(6)+Sgn(3) + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + + b=Oct(12) & Hex(12) + ' ^^^ support.function.vb.asp + ' ^^^ support.function.vb.asp + c = CSng("123") + CDbl("123") + CInt("123")+CLng("123") + ' ^^^^ support.function.vb.asp + ' ^^^^ support.function.vb.asp + ' ^^^^ support.function.vb.asp + ' ^^^^ support.function.vb.asp + d = Time + ' ^^^^ support.function.vb.asp + e = Date() + ' ^^^^ support.function.vb.asp + + submit = 2 + '^^^^^^ variable.other.asp - storage.type.function.asp + function_hello = 2 + '^^^^^^^^^^^^^^ variable.other.asp - storage.type.function.asp + + %> + '^^ punctuation.section.embedded.end.asp + ' ^ - source.asp.embedded.html + This file was last modified on: <%response.write(modified) + '^ - source.asp.embedded.html + ' ^^ punctuation.section.embedded.begin.asp + ' ^ source.asp.embedded.html + ' ^^^^^^^^ support.class.asp + ' ^^^^^ support.function.asp + %> + +

foobar

+ '^^^ text.html.asp meta.tag.block.any.html - source.asp.embedded.html + <%='test %> + '^^^ punctuation.section.embedded.begin.asp - source.asp + ' ^^^^^^ comment.line.apostrophe.asp + ' ^^ punctuation.section.embedded.end.asp - comment + ' ^^^ - source.asp.embedded.html + <%= "this" + Chr(32) + "that" %> + '^^^ punctuation.section.embedded.begin.asp - source.asp.embedded.html + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.asp.embedded.html + ' ^^^^^^ string.quoted.double.asp + ' ^ keyword.operator.asp + ' ^^^ support.function.vb.asp + ' ^^ punctuation.section.embedded.end.asp - source.asp +<% + +Class ClassContainingMethodsWithReservedWords + Sub [Select]() + '^^^ storage.type.function.asp + ' ^^^^^^^^ entity.name.function.asp + ' ^ - entity.name.function.asp + + End Sub + + Sub [End]() + '^^^ storage.type.function.asp + ' ^^^^^ entity.name.function.asp + ' ^ - entity.name.function.asp + + End Sub +End Class +Set ccmwrw = new ClassContainingMethodsWithReservedWords +ccmwrw.Select() +' ^ punctuation.accessor.dot.asp +' ^^^^^^ variable.other.member.asp - invalid - keyword +' ^^ - variable - invalid - keyword +ccmwrw. Select() ' spaces are not allowed after the . +' ^ punctuation.accessor.dot.asp +' ^ - invalid +' ^^^^^^ variable.other.member.asp - invalid - keyword +' ^^ - variable - invalid - keyword +ccmwrw.End +' ^ punctuation.accessor.dot.asp +' ^^^ variable.other.member.asp - invalid - keyword +' ^ - invalid - variable +ccmwrw .End +' ^ invalid.illegal.unexpected-token.asp +' ^ punctuation.accessor.dot.asp +' ^^^ variable.other.member.asp - invalid - keyword +' ^ - invalid +ccmwrw.[End] () +' ^ punctuation.accessor.dot.asp +' ^^^^^ variable.other.member.asp - invalid - keyword +' ^^^ - variable - invalid - keyword +ccmwrw. [End] () +' ^ punctuation.accessor.dot.asp +' ^ - invalid - variable +' ^^^^^ variable.other.member.asp - invalid - keyword +' ^^^ - variable - invalid - keyword + +_ + 'a line continuation char can be followed by just a comment on the next non blank line + ' ^ punctuation.definition.comment.asp + ' ^^^^^^ comment.line.apostrophe.asp + +t = [unclosed variable identifier +' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.other.asp +Dim test +'<- storage.modifier.asp - variable + rem the syntax on the next line will cause an unterminated string constant error +'^^^^^^ comment.line.rem.asp +test = "hello%> +' ^^^^^^ source.asp.embedded.html string.quoted.double.asp +' ^^ punctuation.section.embedded.end.asp - string.quoted.double.asp +' ^ - source.asp.embedded.html + +<% [%>
+' ^^ punctuation.section.embedded.end.asp +' ^^ text.html.asp meta.tag.inline.any.html entity.name.tag.inline.any.html +<% Sub InventiveMethodNameHere(list) %> +' ^^^ meta.method.identifier.asp storage.type.function.asp +' ^ text.html.asp source.asp.embedded.html meta.method.asp meta.method.body.asp +' ^^ text.html.asp punctuation.section.embedded.end.inside-block.asp + +<% End Sub %> +' ^^^^^^^ text.html.asp source.asp.embedded.html meta.method.asp storage.type.function.end.asp +' ^ - meta.method.asp +

+'^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.block.any.html +' ^^^^^^^^^ meta.tag.block.any.html +' ^^^^^ meta.attribute-with-value.class.html entity.other.attribute-name.class.html +' ^^^ meta.attribute-with-value.class.html string.quoted.double.html +' ^^^^^^^^^^ meta.attribute-with-value.class.html string.quoted.double.html +' ^ - string +' ^^^^^^^^^^^^^^^^ meta.class-name.html +' ^^^^^^^^^^ meta.class-name.html +' ^^ punctuation.section.embedded.begin.asp +' ^^^^^^^^^^^^^ source.asp.embedded.html +' ^^ keyword.control.flow.asp +' ^^^^ meta.between-if-and-then.asp storage.type.asp +' ^^^^ keyword.control.flow.asp +' ^ meta.if.block.asp +' ^ meta.if.block.asp +' ^^ punctuation.section.embedded.end.inside-block.asp +' ^^ punctuation.section.embedded.begin.inside-block.asp +' ^^^^^^ keyword.control.flow.asp +' ^^ punctuation.section.embedded.end.asp - meta.if.block.asp +' ^ punctuation.definition.tag.end.html + +

id="test1">

+'^^^ meta.tag.block.any.html +' ^^^^^^^^^^^^^^^^ meta.tag.block.any.html +'^ punctuation.definition.tag.begin.html +' ^ entity.name.tag.block.any.html +' ^^^ punctuation.section.embedded.begin.asp +' ^^^^^^^^^^^^^^^^ string.quoted.double.asp +' ^^ punctuation.section.embedded.end.asp +' ^^ meta.attribute-with-value.id.html entity.other.attribute-name.id.html +' ^^^^^ meta.attribute-with-value.id.html string.quoted.double.html meta.toc-list.id.html +' ^ punctuation.definition.tag.end.html +' ^ - meta.tag.block.any.html +<% If True Then + Do + %> + id="test2"> + '^^^^^^ meta.tag.inline.any.html + '^ punctuation.definition.tag.begin.html + ' ^^^^ entity.name.tag.inline.any.html + ' ^^^ punctuation.section.embedded.begin.inside-block.asp + ' ^^^^^^^^^^^^^^^^ string.quoted.double.asp + ' ^^ punctuation.section.embedded.end.inside-block.asp + ' ^^^^^^^^^^^^ meta.tag + ' ^^ meta.attribute-with-value.id.html entity.other.attribute-name.id.html + ' ^^^^^ meta.attribute-with-value.id.html string.quoted.double.html meta.toc-list.id.html + ' ^ punctuation.definition.tag.end.html + ' ^^^^^^^ meta.tag.inline.any.html - meta.tag.after-embedded-asp.any.html + ' ^^ punctuation.definition.tag.begin.html + ' ^^^^ entity.name.tag.inline.any.html + ' ^ punctuation.definition.tag.end.html +<% Loop + End If %> + '^^^^^^ keyword.control.flow.asp + + class="test" <% End If %> id="test3"> +'^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.any.html +' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.inline.any.html +'^ punctuation.definition.tag.begin.html +' ^^^^ entity.name.tag.inline.any.html +' ^^ punctuation.section.embedded.begin.asp +' ^^ keyword.control.flow.asp +' ^^^^^ meta.between-if-and-then.asp storage.type.asp +' ^^^^ keyword.control.flow.asp +' ^^ punctuation.section.embedded.end.inside-block.asp +' ^^^^^^^^^^^^ meta.attribute-with-value.class.html +' ^^^^^ entity.other.attribute-name.class.html +' ^ punctuation.separator.key-value.html +' ^ string.quoted.double.html punctuation.definition.string.begin.html +' ^^^^ string.quoted.double.html meta.class-name.html +' ^ string.quoted.double.html punctuation.definition.string.end.html +' ^^ punctuation.section.embedded.begin.inside-block.asp +' ^^^^^^ keyword.control.flow.asp +' ^^ punctuation.section.embedded.end.asp +' ^^ meta.attribute-with-value.id.html entity.other.attribute-name.id.html +' ^^^^^ meta.attribute-with-value.id.html string.quoted.double.html meta.toc-list.id.html +' ^ punctuation.definition.tag.end.html + + class="test" +'^^^^^^^^^^^^^^ meta.tag +' ^^^^^^^^^^^^ meta.attribute-with-value.class.html +' ^^^^^ entity.other.attribute-name.class.html +' ^ punctuation.separator.key-value.html +' ^ string.quoted.double.html punctuation.definition.string.begin.html +' ^^^^ string.quoted.double.html meta.class-name.html +' ^ string.quoted.double.html punctuation.definition.string.end.html + <% End If %> +'^^ punctuation.section.embedded.begin.inside-block.asp +' ^^^^^^ keyword.control.flow.asp +' ^^ punctuation.section.embedded.end.asp + id="test4"> +'^^^^^^^^^^^ meta.tag +'^^ meta.attribute-with-value.id.html entity.other.attribute-name.id.html +' ^^^^^ meta.attribute-with-value.id.html string.quoted.double.html meta.toc-list.id.html +' ^ punctuation.definition.tag.end.html +' ^^^^^^^ meta.tag.inline.any.html - meta.tag.after-embedded-asp.any.html +' ^^ punctuation.definition.tag.begin.html +' ^^^^ entity.name.tag.inline.any.html +' ^ punctuation.definition.tag.end.html + <% If True Then %> +'^^ punctuation.section.embedded.begin.asp +' ^^ punctuation.section.embedded.end.inside-block.asp + " id="test5"> +'^^^^^^^^^^^^^ meta.tag.inline.any.html +' ^ string.quoted.double.html punctuation.definition.string.begin.html +' ^^^ punctuation.section.embedded.begin.inside-block.asp +' ^^ punctuation.section.embedded.end.inside-block.asp +' ^^^^^^^^^^^^^ meta.tag +' ^ string.quoted.double.html punctuation.definition.string.end.html +' ^^ meta.attribute-with-value.id.html entity.other.attribute-name.id.html +' ^^^^^ meta.attribute-with-value.id.html string.quoted.double.html meta.toc-list.id.html +' ^ punctuation.definition.tag.end.html +' ^^^^^^^ meta.tag.inline.any.html - meta.tag.after-embedded-asp.any.html +' ^^ punctuation.definition.tag.begin.html +' ^^^^ entity.name.tag.inline.any.html +' ^ punctuation.definition.tag.end.html + <% End If %> +'^^ punctuation.section.embedded.begin.inside-block.asp +' ^^^^^^ keyword.control.flow.asp +' ^^ punctuation.section.embedded.end.asp + <% + = hi = 2 ' will output a boolean expression - True or False %> +' ^ punctuation.section.embedded.begin.asp +' ^^^^^^^^^^ source.asp.embedded.html +' ^^ variable.other.asp +' ^ keyword.operator.asp +' ^ constant.numeric +' ^ comment + +'<- - comment - source.asp.embedded.html + +'^^^^^^^ meta.tag.structure.any.html + + diff --git a/assets/syntaxes/Packages/ActionScript/ActionScript.sublime-build b/assets/syntaxes/Packages/ActionScript/ActionScript.sublime-build new file mode 100644 index 000000000..4532cea65 --- /dev/null +++ b/assets/syntaxes/Packages/ActionScript/ActionScript.sublime-build @@ -0,0 +1,12 @@ +{ + "selector": "source.actionscript", + "cmd": [ + "mxmlc", + "${file}", + "-library-path+=${project_path}/libs", + "-output", "${project_path}/bin/${project_base_name}.swf", + "-debug=false", + "-static-link-runtime-shared-libraries=true" + ], + "file_regex": "^(.+?)\\(([0-9]+)\\): col: (([0-9]+))(.*)$" +} \ No newline at end of file diff --git a/assets/syntaxes/Packages/ActionScript/ActionScript.sublime-syntax b/assets/syntaxes/Packages/ActionScript/ActionScript.sublime-syntax new file mode 100644 index 000000000..a1f0ae038 --- /dev/null +++ b/assets/syntaxes/Packages/ActionScript/ActionScript.sublime-syntax @@ -0,0 +1,91 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: ActionScript +file_extensions: + - as +scope: source.actionscript.2 +contexts: + main: + - match: \b(R(ecordset|DBMSResolver|adioButton(Group)?)|X(ML(Socket|Node|Connector)?|UpdateResolverDataHolder)|M(M(Save|Execute)|icrophoneMicrophone|o(use|vieClip(Loader)?)|e(nu(Bar)?|dia(Controller|Display|Playback))|ath)|B(yName|inding|utton)|S(haredObject|ystem|crollPane|t(yleSheet|age|ream)|ound|e(ndEvent|rviceObject)|OAPCall|lide)|N(umericStepper|et(stream|S(tream|ervices)|Connection|Debug(Config)?))|C(heckBox|o(ntextMenu(Item)?|okie|lor|m(ponentMixins|boBox))|ustomActions|lient|amera)|T(ypedValue|ext(Snapshot|Input|F(ield|ormat)|Area)|ree|AB)|Object|D(ownload|elta(Item|Packet)?|at(e(Chooser|Field)?|a(G(lue|rid)|Set|Type)))|U(RL|TC|IScrollBar)|P(opUpManager|endingCall|r(intJob|o(duct|gressBar)))|E(ndPoint|rror)|Video|Key|F(RadioButton|GridColumn|MessageBox|BarChart|S(croll(Bar|Pane)|tyleFormat|plitView)|orm|C(heckbox|omboBox|alendar)|unction|T(icker|ooltip(Lite)?|ree(Node)?)|IconButton|D(ataGrid|raggablePane)|P(ieChart|ushButton|ro(gressBar|mptBox))|L(i(stBox|neChart)|oadingBox)|AdvancedMessageBox)|W(indow|SDLURL|ebService(Connector)?)|L(ist|o(calConnection|ad(er|Vars)|g)|a(unch|bel))|A(sBroadcaster|cc(ordion|essibility)|S(Set(Native|PropFlags)|N(ew|ative)|C(onstructor|lamp(2)?)|InstanceOf)|pplication|lert|rray))\b + scope: support.class.actionscript.2 + - match: \b(s(h(ift|ow(GridLines|Menu|Border|Settings|Headers|ColumnHeaders|Today|Preferences)?|ad(ow|ePane))|c(hema|ale(X|Mode|Y|Content)|r(oll(Track|Drag)?|een(Resolution|Color|DPI)))|t(yleSheet|op(Drag|A(nimation|llSounds|gent))?|epSize|a(tus|rt(Drag|A(nimation|gent))?))|i(n|ze|lence(TimeOut|Level))|o(ngname|urce|rt(Items(By)?|On(HeaderRelease)?|able(Columns)?)?)|u(ppressInvalidCalls|bstr(ing)?)|p(li(ce|t)|aceCol(umnsEqually|lumnsEqually))|e(nd(DefaultPushButtonEvent|AndLoad)?|curity|t(R(GB|o(otNode|w(Height|Count))|esizable(Columns)?|a(nge|te))|G(ain|roupName)|X(AxisTitle)?|M(i(n(imum|utes)|lliseconds)|o(nth(Names)?|tionLevel|de)|ultilineMode|e(ssage|nu(ItemEnabled(At)?|EnabledAt)|dia)|a(sk|ximum))|B(u(tton(s|Width)|fferTime)|a(seTabIndex|ndwidthLimit|ckground))|S(howAsDisabled|croll(ing|Speed|Content|Target|P(osition|roperties)|barState|Location)|t(yle(Property)?|opOnFocus|at(us|e))|i(ze|lenceLevel)|ort(able(Columns)?|Function)|p(litterBarPosition|acing)|e(conds|lect(Multiple|ion(Required|Type)?|Style|Color|ed(Node(s)?|Cell|I(nd(ices|ex)|tem(s)?))?|able))|kin|m(oothness|allScroll))|H(ighlight(s|Color)|Scroll|o(urs|rizontal)|eader(Symbol|Height|Text|Property|Format|Width|Location)?|as(Shader|CloseBox))|Y(ear|AxisTitle)?|N(ode(Properties|ExpansionHandler)|ewTextFormat)|C(h(ildNodes|a(ngeHandler|rt(Title|EventHandler)))|o(ntent(Size)?|okie|lumns)|ell(Symbol|Data)|l(i(ckHandler|pboard)|oseHandler)|redentials)|T(ype(dVaule)?|i(tle(barHeight)?|p(Target|Offset)?|me(out(Handler)?)?)|oggle|extFormat|ransform)|I(s(Branch|Open)|n(terval|putProperty)|con(SymbolName)?|te(rator|m(ByKey|Symbol)))|Orientation|D(i(splay(Range|Graphics|Mode|Clip|Text|edMonth)|rection)|uration|e(pth(Below|To|Above)|fault(GatewayURL|Mappings|NodeIconSymbolName)|l(iveryMode|ay)|bug(ID)?)|a(yOfWeekNames|t(e(Filter)?|a(Mapping(s)?|Item(Text|Property|Format)|Provider|All(Height|Property|Format|Width))?))|ra(wConnectors|gContent))|U(se(Shadow|HandCursor|EchoSuppression|rInput|Fade)|TC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear))|P(osition|ercentComplete|an(e(M(inimumSize|aximumSize)|Size|Title))?|ro(pert(y(Data)?|iesAt)|gress))|E(nabled|dit(Handler|able)|xpand(NodeTrigger|erSymbolName))|V(Scroll|olume|alue(Source)?)|KeyFrameInterval|Quality|F(i(eld|rst(DayOfWeek|VisibleNode))|ocus|ullYear|ps|ade(InLength|OutLength)|rame(Color|Width))|Width|L(ine(Color|Weight)|o(opback|adTarget)|a(rgeScroll|bel(Source|Placement)?))|A(s(Boolean|String|Number)|n(yTypedValue|imation)|ctiv(e(State(Handler)?|Handler)|ateHandler)|utoH(ideScrollBar|eight)))?|paratorBefore|ek|lect(ion(Disabled|Unfocused)?|ed(Node(s)?|Child|I(nd(ices|ex)|tem(s)?)|Dat(e|a))?|able(Ranges)?)|rver(String)?)|kip|qrt|wapDepths|lice|aveToSharedObj|moothing)|h(scroll(Policy)?|tml(Text)?|i(t(Test(TextNearPos)?|Area)|de(BuiltInItems|Child)?|ghlight(2D|3D)?)|orizontal|e(ight|ader(Re(nderer|lease)|Height|Text))|P(osition|ageScrollSize)|a(s(childNodes|MP3|S(creen(Broadcast|Playback)|treaming(Video|Audio)|ort)|Next|OwnProperty|Pr(inting|evious)|EmbeddedVideo|VideoEncoder|A(ccesibility|udio(Encoder)?))|ndlerName)|LineScrollSize)|ye(sLabel|ar)|n(o(t|de(Name|Close|Type|Open|Value)|Label)|u(llValue|mChild(S(creens|lides)|ren|Forms))|e(w(Item|line|Value|LocationDialog)|xt(S(cene|ibling|lide)|TabIndex|Value|Frame)?)?|ame(s)?)|c(h(ildNodes|eck|a(nge(sPending)?|r(CodeAt|At))|r)|o(s|n(st(ant|ructor)|nect|c(urrency|at)|t(ent(Type|Path)?|ains|rol(Placement|lerPolicy))|denseWhite|version)|py|l(or|umn(Stretch|Name(s)?|Count))|m(p(onent|lete)|ment))|u(stomItems|ePoint(s)?|r(veTo|Value|rent(Slide|ChildSlide|Item|F(ocused(S(creen|lide)|Form)|ps))))|e(il|ll(Renderer|Press|Edit|Focus(In|Out)))|l(i(ck|ents)|o(se(Button|Pane)?|ne(Node)?)|ear(S(haredObjects|treams)|Timeout|Interval)?)|a(ncelLabel|tch|p(tion|abilities)|l(cFields|l(e(e|r))?))|reate(GatewayConnection|Menu|Se(rver|gment)|C(hild(AtDepth)?|l(ient|ass(ChildAtDepth|Object(AtDepth)?))|all)|Text(Node|Field)|Item|Object(AtDepth)?|PopUp|E(lement|mptyMovieClip)))|t(h(is|row)|ype(of|Name)?|i(tle(StyleDeclaration)?|me(out)?)|o(talTime|String|olTipText|p|UpperCase|ggle(HighQuality)?|Lo(caleString|werCase))|e(st|llTarget|xt(RightMargin|Bold|S(ize|elected)|Height|Color|I(ndent|talic)|Disabled|Underline|F(ield|ont)|Width|LeftMargin|Align)?)|a(n|rget(Path)?|b(Stops|Children|Index|Enabled|leName))|r(y|igger|ac(e|k(AsMenu)?)))|i(s(Running|Branch|NaN|Con(soleOpen|nected)|Toggled|Installed|Open|D(own|ebugger)|P(urchased|ro(totypeOf|pertyEnumerable))|Empty|F(inite|ullyPopulated)|Local|Active)|n(s(tall|ertBefore)|cludeDeltaPacketInfo|t|it(ialize|Component|Pod|A(pplication|gent))?|de(nt|terminate|x(InParent(Slide|Form)?|Of)?)|put|validate|finity|LocalInternetCache)?|con(F(ield|unction))?|t(e(ratorScrolled|m(s|RollO(ut|ver)|ClassName))|alic)|d3|p|fFrameLoaded|gnore(Case|White))|o(s|n(R(ollO(ut|ver)|e(s(ize|ult)|l(ease(Outside)?|aseOutside)))|XML|Mouse(Move|Down|Up|Wheel)|S(ync|croller|tatus|oundComplete|e(tFocus|lect(edItem)?))|N(oticeEvent|etworkChange)|C(hanged|onnect|l(ipEvent|ose))|ID3|D(isconnect|eactivate|ata|ragO(ut|ver))|Un(install|load)|P(aymentResult|ress)|EnterFrame|K(illFocus|ey(Down|Up))|Fault|Lo(ad|g)|A(ctiv(ity|ate)|ppSt(op|art)))?|pe(n|ration)|verLayChildren|kLabel|ldValue|r(d)?)|d(i(s(connect|play(Normal|ed(Month|Year)|Full)|able(Shader|d(Ranges|Days)|CloseBox|Events))|rection)|o(cTypeDecl|tall|Decoding|main|LazyDecoding)|u(plicateMovieClip|ration)|e(stroy(ChildAt|Object)|code|fault(PushButton(Enabled)?|KeydownHandler)?|l(ta(Packet(Changed)?)?|ete(PopUp|All)?)|blocking)|a(shBoardSave|yNames|ta(Provider)?|rkshadow)|r(opdown(Width)?|a(w|gO(ut|ver))))|u(se(Sort|HandCursor|Codepage|EchoSuppression)|n(shift|install|derline|escape|format|watch|lo(ck|ad(Movie(Num)?)?))|pdate(Results|Mode|I(nputProperties|tem(ByIndex)?)|P(acket|roperties)|View|AfterEvent)|rl)|join|p(ixelAspectRatio|o(sition|p|w)|u(sh|rge|blish)|ercen(tComplete|Loaded)|lay(head(Change|Time)|ing|Hidden|erType)?|a(ssword|use|r(se(XML|CSS|Int|Float)|ent(Node|Is(S(creen|lide)|Form))|ams))|r(int(Num|AsBitmap(Num)?)?|o(to(type)?|pert(y|ies)|gress)|e(ss|v(ious(S(ibling|lide)|Value)?|Scene|Frame)|ferred(Height|Width))))|e(scape|n(code(r)?|ter(Frame)?|dFill|able(Shader|d|CloseBox|Events))|dit(able|Field|LocationDialog)|v(ent|al(uate)?)|q|x(tended|p|ec(ute)?|actSettings)|m(phasized(StyleDeclaration)?|bedFonts))|v(i(sible|ewPod)|ScrollPolicy|o(id|lume)|ersion|P(osition|ageScrollSize)|a(l(idat(ionError|e(Property|ActivationKey)?)|ue(Of)?)|riable)|LineScrollSize)|k(ind|ey(Down|Up|Press|FrameInterval))|q(sort|uality)|f(scommand|i(n(d(Text|First|Last)?|ally)|eldInfo|lter(ed|Func)?|rst(Slide|Child|DayOfWeek|VisibleNode)?)|o(nt|cus(In|edCell|Out|Enabled)|r(egroundDisabled|mat(ter)?))|unctionName|ps|l(oor|ush)|ace|romCharCode)|w(i(th|dth)|ordWrap|atch|riteAccess)|l(t|i(st(Owner)?|ne(Style|To))|o(c(k|a(t(ion|eByld)|l(ToGlobal|FileReadDisable)))|opback|ad(Movie(Num)?|S(crollContent|ound)|ed|Variables(Num)?|Application)?|g(Changes)?)|e(ngth|ft(Margin)?|ading)?|a(st(Slide|Child|Index(Of)?)?|nguage|b(el(Placement|F(ield|unction))?|leField)))|a(s(scociate(Controller|Display)|in|pectRatio|function)|nd|c(ceptConnection|tiv(ityLevel|ePlayControl)|os)|t(t(ach(Movie|Sound|Video|Audio)|ributes)|an(2)?)|dd(header|RequestHeader|Menu(Item(At)?|At)?|Sort|Header|No(tice|de(At)?)|C(olumn(At)?|uePoint)|T(oLocalInternetCache|reeNode(At)?)|I(con|tem(s(At)?|At)?)|DeltaItem|P(od|age|roperty)|EventListener|View|FieldInfo|Listener|Animation)?|uto(Size|Play|KeyNav|Load)|pp(endChild|ly(Changes|Updates)?)|vHardwareDisable|fterLoaded|l(ternateRowColors|ign|l(ow(InsecureDomain|Domain)|Transitions(InDone|OutDone))|bum)|r(tist|row|g(uments|List))|gent|bs)|r(ight(Margin)?|o(ot(S(creen|lide)|Form)|und|w(Height|Count)|llO(ut|ver))|e(s(yncDepth|t(orePane|artAnimation|rict)|iz(e|able(Columns)?)|olveDelta|ult(s)?|ponse)|c(o(ncile(Results|Updates)|rd)|eive(Video|Audio))|draw|jectConnection|place(Sel|ItemAt|AllItems)?|ve(al(Child)?|rse)|quest(SizeChange|Payment)?|f(errer|resh(ScrollContent|Destinations|Pane|FromSources)?)|lease(Outside)?|ad(Only|Access)|gister(SkinElement|C(olor(Style|Name)|lass)|InheritingStyle|Proxy)|move(Range|M(ovieClip|enu(Item(At)?|At))|Background|Sort|No(tice|de(sAt|At)?)|C(olum(nAt|At)|uePoints)|T(extField|reeNode(At)?)|Item(At)?|Pod|EventListener|FromLocalInternetCache|Listener|All(C(olumns|uePoints)|Items)?))|a(ndom|te|dioDot))|g(t|oto(Slide|NextSlide|PreviousSlide|FirstSlide|LastSlide|And(Stop|Play))|e(nre|t(R(GB|o(otNode|wCount)|e(sizable|mote))|X(AxisTitle)?|M(i(n(imum(Size)?|utes)|lliseconds)|onth(Names)?|ultilineMode|e(ssage|nu(ItemAt|EnabledAt|At))|aximum(Size)?)|B(ytes(Total|Loaded)|ounds|utton(s|Width)|eginIndex|a(ndwidthLimit|ckground))|S(howAsDisabled|croll(ing|Speed|Content|Position|barState|Location)|t(yle(Names)?|opOnFocus|ate)|ize|o(urce|rtState)|p(litterBarPosition|acing)|e(conds|lect(Multiple|ion(Required|Type)|Style|ed(Node(s)?|Cell|Text|I(nd(ices|ex)|tem(s)?))?)|rvice)|moothness|WFVersion)|H(ighlight(s|Color)|ours|e(ight|ader(Height|Text|Property|Format|Width|Location)?)|as(Shader|CloseBox))|Y(ear|AxisTitle)?|N(o(tices|de(DisplayedAt|At))|um(Children|berAvailable)|e(wTextFormat|xtHighestDepth))|C(h(ild(S(creen|lide)|Nodes|Form|At)|artTitle)|o(n(tent|figInfo)|okie|de|unt|lumn(Names|Count|Index|At))|uePoint|ellIndex|loseHandler|a(ll|retIndex))|T(ypedValue|i(tle(barHeight)?|p(Target|Offset)?|me(stamp|zoneOffset|out(State|Handler)|r)?)|oggle|ext(Extent|Format)?|r(ee(NodeAt|Length)|ans(form|actionId)))|I(s(Branch|Open)|n(stanceAtDepth|d(icesByKey|exByKey))|con(SymbolName)?|te(rator|m(sByKey|By(Name|Key)|id|ID|At))|d)|O(utput(Parameter(s|ByName)?|Value(s)?)|peration|ri(entation|ginalCellData))|D(i(s(play(Range|Mode|Clip|Index|edMonth)|kUsage)|rection)|uration|e(pth|faultNodeIconSymbolName|l(taPacket|ay)|bug(Config|ID)?)|a(y(OfWeekNames)?|t(e|a(Mapping(s)?|Item(Text|Property|Format)|Label|All(Height|Property|Format|Width))?))|rawConnectors)|U(se(Shadow|HandCursor|rInput|Fade)|RL|TC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear))|P(o(sition|ds)|ercentComplete|a(n(e(M(inimums|aximums)|Height|Title|Width))?|rentNode)|r(operty(Name|Data)?|efer(ences|red(Height|Width))))|E(n(dIndex|abled)|ditingData|x(panderSymbolName|andNodeTrigger))|V(iewed(Pods|Applications)|olume|ersion|alue(Source)?)|F(i(eld|rst(DayOfWeek|VisibleNode))|o(ntList|cus)|ullYear|ade(InLength|OutLength)|rame(Color|Width))|Width|L(ine(Color|Weight)|o(cal|adTarget)|ength|a(stTabIndex|bel(Source)?))|A(s(cii|Boolean|String|Number)|n(yTypedValue|imation)|ctiv(eState(Handler)?|ateHandler)|utoH(ideScrollBar|eight)|llItems|gent))?)?|lobal(StyleFormat|ToLocal)?|ain|roupName)|x(updatePackety|mlDecl)?|m(y(MethodName|Call)|in(imum)?|o(nthNames|tion(TimeOut|Level)|de(lChanged)?|use(Move|O(ut|ver)|Down(Somewhere|Outside)?|Up(Somewhere)?|WheelEnabled)|ve(To)?)|u(ted|lti(pleS(imultaneousAllowed|elections)|line))|e(ssage|nu(Show|Hide)?|th(od)?|diaType)|a(nufacturer|tch|x(scroll|hscroll|imum|HPosition|Chars|VPosition)?)|b(substring|chr|ord|length))|b(ytes(Total|Loaded)|indFormat(Strings|Function)|o(ttom(Scroll)?|ld|rder(Color)?)|u(tton(Height|Width)|iltInItems|ffer(Time|Length)|llet)|e(foreApplyUpdates|gin(GradientFill|Fill))|lockIndent|a(ndwidth|ckground(Style|Color|Disabled)?)|roadcastMessage)|onHTTPStatus)\b + scope: support.function.actionscript.2 + - match: \b(__proto__|__resolve|_accProps|_alpha|_changed|_currentframe|_droptarget|_flash|_focusrect|_framesloaded|_global|_height|_highquality|_level|_listeners|_lockroot|_name|_parent|_quality|_root|_rotation|_soundbuftime|_target|_totalframes|_url|_visible|_width|_x|_xmouse|_xscale|_y|_ymouse|_yscale)\b + scope: support.constant.actionscript.2 + - match: \b(dynamic|extends|import|implements|interface|public|private|new|static|super|var|for|in|break|continue|while|do|return|if|else|case|switch)\b + scope: keyword.control.actionscript.2 + - match: \b(Boolean|Number|String|Void)\b + scope: storage.type.actionscript.2 + - match: \b(null|undefined|true|false)\b + scope: constant.language.actionscript.2 + - match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\b' + scope: constant.numeric.actionscript.2 + - match: '"' + captures: + 0: punctuation.definition.string.begin.actionscript.2 + push: + - meta_scope: string.quoted.double.actionscript.2 + - match: '"' + captures: + 0: punctuation.definition.string.end.actionscript.2 + pop: true + - match: \\. + scope: constant.character.escape.actionscript.2 + - match: "'" + captures: + 0: punctuation.definition.string.begin.actionscript.2 + push: + - meta_scope: string.quoted.single.actionscript.2 + - match: "'" + captures: + 0: punctuation.definition.string.end.actionscript.2 + pop: true + - match: \\. + scope: constant.character.escape.actionscript.2 + - match: \b(BACKSPACE|CAPSLOCK|CONTROL|DELETEKEY|DOWN|END|ENTER|HOME|INSERT|LEFT|LN10|LN2|LOG10E|LOG2E|MAX_VALUE|MIN_VALUE|NEGATIVE_INFINITY|NaN|PGDN|PGUP|PI|POSITIVE_INFINITY|RIGHT|SPACE|SQRT1_2|SQRT2|UP)\b + scope: support.constant.actionscript.2 + - match: /\* + captures: + 0: punctuation.definition.comment.actionscript.2 + push: + - meta_scope: comment.block.actionscript.2 + - match: \*/ + captures: + 0: punctuation.definition.comment.actionscript.2 + pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.actionscript.2 + - match: (//).*$\n? + scope: comment.line.double-slash.actionscript.2 + captures: + 1: punctuation.definition.comment.actionscript.2 + - match: \b(instanceof)\b + scope: keyword.operator.actionscript.2 + - match: "[-!%&*+=/?:]" + scope: keyword.operator.symbolic.actionscript.2 + - match: '^[ \t]*(#)[a-zA-Z]+' + scope: meta.preprocessor.actionscript.2 + captures: + 1: punctuation.definition.preprocessor.actionscript.2 + - match: '\b(function)\s+([a-zA-Z_]\w*)\s*(\()' + captures: + 1: storage.type.function.actionscript.2 + 2: entity.name.function.actionscript.2 + 3: punctuation.definition.parameters.begin.actionscript.2 + push: + - meta_scope: meta.function.actionscript.2 + - match: \) + captures: + 0: punctuation.definition.parameters.end.actionscript.2 + pop: true + - match: '[^,)\n]+' + scope: variable.parameter.function.actionscript.2 + - match: '\b(class)\s+([a-zA-Z_](?:\w|\.)*)(?:\s+(extends)\s+([a-zA-Z_](?:\w|\.)*))?' + scope: meta.class.actionscript.2 + captures: + 1: storage.type.class.actionscript.2 + 2: entity.name.type.class.actionscript.2 + 3: storage.modifier.extends.actionscript.2 + 4: entity.other.inherited-class.actionscript.2 diff --git a/assets/syntaxes/Packages/ActionScript/syntax_test_as.as b/assets/syntaxes/Packages/ActionScript/syntax_test_as.as new file mode 100644 index 000000000..97a9ade07 --- /dev/null +++ b/assets/syntaxes/Packages/ActionScript/syntax_test_as.as @@ -0,0 +1,5 @@ +/* SYNTAX TEST "Packages/ActionScript/ActionScript.sublime-syntax" */ + +/** + * +/* ^ comment.block.actionscript.2 punctuation.definition.comment.actionscript.2 */ \ No newline at end of file diff --git a/assets/syntaxes/Packages/AppleScript/AppleScript.sublime-syntax b/assets/syntaxes/Packages/AppleScript/AppleScript.sublime-syntax new file mode 100644 index 000000000..d39aa257b --- /dev/null +++ b/assets/syntaxes/Packages/AppleScript/AppleScript.sublime-syntax @@ -0,0 +1,723 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: AppleScript +file_extensions: + - applescript + - script editor +first_line_match: ^#!.*(osascript) +scope: source.applescript +contexts: + main: + - include: blocks + - include: inline + attributes.considering-ignoring: + - match: "," + scope: punctuation.separator.array.attributes.applescript + - match: \b(and)\b + scope: keyword.control.attributes.and.applescript + - match: \b(?i:case|diacriticals|hyphens|numeric\s+strings|punctuation|white\s+space)\b + scope: constant.other.attributes.text.applescript + - match: \b(?i:application\s+responses)\b + scope: constant.other.attributes.application.applescript + blocks: + - match: ^\s*(script)\s+(\w+) + captures: + 1: keyword.control.script.applescript + 2: entity.name.type.script-object.applescript + push: + - meta_scope: meta.block.script.applescript + - match: ^\s*(end(?:\s+script)?)(?=\s*(--.*?)?$) + captures: + 1: keyword.control.script.applescript + pop: true + - include: main + - match: |- + ^(?x) + \s*(to|on)\s+ # "on" or "to" + (\w+) # function name + (\() # opening paren + ((?:[\s,:\{\}]*(?:\w+)?)*) # parameters + (\)) # closing paren + comment: | + This is not a very well-designed rule. For now, + we can leave it like this though, as it sorta works. + captures: + 1: keyword.control.function.applescript + 2: entity.name.function.handler.applescript + 3: punctuation.definition.parameters.applescript + 4: variable.parameter.handler.applescript + 5: punctuation.definition.parameters.applescript + push: + - meta_scope: meta.function.positional.applescript + - match: ^\s*(end)(?:\s+(\2))?(?=\s*(--.*?)?$) + captures: + 1: keyword.control.function.applescript + pop: true + - include: main + - match: |- + ^(?x) + \s*(to|on)\s+ # "on" or "to" + (\w+) # function name + (?:\s+ + (of|in)\s+ # "of" or "in" + (\w+) # direct parameter + )? + (?=\s+(above|against|apart\s+from|around|aside\s+from|at|below|beneath|beside|between|by|for|from|instead\s+of|into|on|onto|out\s+of|over|thru|under)\b) + comment: "TODO: match `given` parameters" + captures: + 1: keyword.control.function.applescript + 2: entity.name.function.handler.applescript + 3: keyword.control.function.applescript + 4: variable.parameter.handler.direct.applescript + push: + - meta_scope: meta.function.prepositional.applescript + - match: ^\s*(end)(?:\s+(\2))?(?=\s*(--.*?)?$) + captures: + 1: keyword.control.function.applescript + pop: true + - match: \b(?i:above|against|apart\s+from|around|aside\s+from|at|below|beneath|beside|between|by|for|from|instead\s+of|into|on|onto|out\s+of|over|thru|under)\s+(\w+)\b + captures: + 1: keyword.control.preposition.applescript + 2: variable.parameter.handler.applescript + - include: main + - match: |- + ^(?x) + \s*(to|on)\s+ # "on" or "to" + (\w+) # function name + (?=\s*(--.*?)?$) # nothing else + captures: + 1: keyword.control.function.applescript + 2: entity.name.function.handler.applescript + push: + - meta_scope: meta.function.parameterless.applescript + - match: ^\s*(end)(?:\s+(\2))?(?=\s*(--.*?)?$) + captures: + 1: keyword.control.function.applescript + pop: true + - include: main + - include: blocks.tell + - include: blocks.repeat + - include: blocks.statement + - include: blocks.other + blocks.other: + - match: ^\s*(considering)\b + push: + - meta_scope: meta.block.considering.applescript + - match: ^\s*(end(?:\s+considering)?)(?=\s*(--.*?)?$) + pop: true + - match: (?<=considering) + push: + - meta_scope: meta.array.attributes.considering.applescript + - match: (?|<|≥|>=|≤|<=) + scope: keyword.operator.comparison.applescript + - match: |- + (?ix)\b + (and|or|div|mod|as|not + |(a\s+)?(ref(\s+to)?|reference\s+to) + |equal(s|\s+to)|contains?|comes\s+(after|before)|(start|begin|end)s?\s+with + ) + \b + scope: keyword.operator.word.applescript + - match: |- + (?ix)\b + (is(n't|\s+not)?(\s+(equal(\s+to)?|(less|greater)\s+than(\s+or\s+equal(\s+to)?)?|in|contained\s+by))? + |does(n't|\s+not)\s+(equal|come\s+(before|after)|contain) + ) + \b + comment: In double quotes so we can use a single quote in the keywords. + scope: keyword.operator.word.applescript + - match: \b(?i:some|every|whose|where|that|id|index|\d+(st|nd|rd|th)|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|last|front|back|middle|named|beginning|end|from|to|thr(u|ough)|before|(front|back|beginning|end)\s+of|after|behind|in\s+(front|back|beginning|end)\s+of)\b + scope: keyword.operator.reference.applescript + - match: \b(?i:continue|return|exit(\s+repeat)?)\b + scope: keyword.control.loop.applescript + - match: \b(?i:about|above|after|against|and|apart\s+from|around|as|aside\s+from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|contains|copy|div|does|eighth|else|end|equal|equals|error|every|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead\s+of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out\s+of|over|prop|property|put|ref|reference|repeat|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b + scope: keyword.other.applescript + built-in.punctuation: + - match: ¬ + scope: punctuation.separator.continuation.line.applescript + - match: ":" + comment: "the : in property assignments" + scope: punctuation.separator.key-value.property.applescript + - match: "[()]" + comment: the parentheses in groups + scope: punctuation.section.group.applescript + built-in.support: + - match: \b(?i:POSIX\s+path|frontmost|id|name|running|version|days?|weekdays?|months?|years?|time|date\s+string|time\s+string|length|rest|reverse|items?|contents|quoted\s+form|characters?|paragraphs?|words?)\b + scope: support.function.built-in.property.applescript + - match: \b(?i:activate|log|clipboard\s+info|set\s+the\s+clipboard\s+to|the\s+clipboard|info\s+for|list\s+(disks|folder)|mount\s+volume|path\s+to(\s+resource)?|close\s+access|get\s+eof|open\s+for\s+access|read|set\s+eof|write|open\s+location|current\s+date|do\s+shell\s+script|get\s+volume\s+settings|random\s+number|round|set\s+volume|system\s+(attribute|info)|time\s+to\s+GMT|load\s+script|run\s+script|scripting\s+components|store\s+script|copy|count|get|launch|run|set|ASCII\s+(character|number)|localized\s+string|offset|summarize|beep|choose\s+(application|color|file(\s+name)?|folder|from\s+list|remote\s+application|URL)|delay|display\s+(alert|dialog)|say)\b + scope: support.function.built-in.command.applescript + - match: \b(?i:get|run)\b + scope: support.function.built-in.applescript + - match: \b(?i:anything|data|text|upper\s+case|propert(y|ies))\b + scope: support.class.built-in.applescript + - match: \b(?i:alias|class)(es)?\b + scope: support.class.built-in.applescript + - match: \b(?i:app(lication)?|boolean|character|constant|date|event|file(\s+specification)?|handler|integer|item|keystroke|linked\s+list|list|machine|number|picture|preposition|POSIX\s+file|real|record|reference(\s+form)?|RGB\s+color|script|sound|text\s+item|type\s+class|vector|writing\s+code(\s+info)?|zone|((international|styled(\s+(Clipboard|Unicode))?|Unicode)\s+)?text|((C|encoded|Pascal)\s+)?string)s?\b + scope: support.class.built-in.applescript + - match: |- + (?ix)\b + ( (cubic\s+(centi)?|square\s+(kilo)?|centi|kilo)met(er|re)s + | square\s+(yards|feet|miles)|cubic\s+(yards|feet|inches)|miles|inches + | lit(re|er)s|gallons|quarts + | (kilo)?grams|ounces|pounds + | degrees\s+(Celsius|Fahrenheit|Kelvin) + ) + \b + scope: support.class.built-in.unit.applescript + - match: \b(?i:seconds|minutes|hours|days)\b + scope: support.class.built-in.time.applescript + comments: + - match: ^\s*(#!).*$\n? + scope: comment.line.number-sign.applescript + captures: + 1: punctuation.definition.comment.applescript + - match: (--).*$\n? + scope: comment.line.double-dash.applescript + captures: + 1: punctuation.definition.comment.applescript + - match: \(\* + captures: + 0: punctuation.definition.comment.applescript + push: + - meta_scope: comment.block.applescript + - match: \*\) + captures: + 0: punctuation.definition.comment.applescript + pop: true + - include: comments.nested + comments.nested: + - match: \(\* + captures: + 0: punctuation.definition.comment.applescript + push: + - meta_scope: comment.block.applescript + - match: \*\) + captures: + 0: punctuation.definition.comment.applescript + pop: true + - include: comments.nested + data-structures: + - match: '(\{)' + comment: We cannot necessarily distinguish "records" from "arrays", and so this could be either. + captures: + 1: punctuation.section.array.applescript + push: + - meta_scope: meta.array.applescript + - match: '(\})' + captures: + 1: punctuation.section.array.applescript + pop: true + - match: '(\w+|((\|)[^|\n]*(\|)))\s*(:)' + captures: + 1: constant.other.key.applescript + 2: meta.identifier.applescript + 3: punctuation.definition.identifier.applescript + 4: punctuation.definition.identifier.applescript + 5: punctuation.separator.key-value.applescript + - match: ":" + scope: punctuation.separator.key-value.applescript + - match: "," + scope: punctuation.separator.array.applescript + - include: inline + - match: (?:(?<=application )|(?<=app ))(") + captures: + 1: punctuation.definition.string.applescript + push: + - meta_scope: string.quoted.double.application-name.applescript + - match: (") + captures: + 1: punctuation.definition.string.applescript + pop: true + - match: \\. + scope: constant.character.escape.applescript + - match: (") + captures: + 1: punctuation.definition.string.applescript + push: + - meta_scope: string.quoted.double.applescript + - match: (") + captures: + 1: punctuation.definition.string.applescript + pop: true + - match: \\. + scope: constant.character.escape.applescript + - match: '(\|)[^|\n]*(\|)' + scope: meta.identifier.applescript + captures: + 1: punctuation.definition.identifier.applescript + 2: punctuation.definition.identifier.applescript + - match: '(«)(data) (utxt|utf8)([[:xdigit:]]*)(»)(?:\s+(as)\s+(?i:Unicode\s+text))?' + scope: constant.other.data.utxt.applescript + captures: + 1: punctuation.definition.data.applescript + 2: support.class.built-in.applescript + 3: storage.type.utxt.applescript + 4: string.unquoted.data.applescript + 5: punctuation.definition.data.applescript + 6: keyword.operator.applescript + 7: support.class.built-in.applescript + - match: («)(\w+)\b(?=\s) + captures: + 1: punctuation.definition.data.applescript + 2: support.class.built-in.applescript + push: + - meta_scope: constant.other.data.raw.applescript + - match: (») + captures: + 1: punctuation.definition.data.applescript + pop: true + - match: "(«)[^»]*(»)" + scope: invalid.illegal.data.applescript + captures: + 1: punctuation.definition.data.applescript + 2: punctuation.definition.data.applescript + finder: + - match: \b(item|container|(computer|disk|trash)-object|disk|folder|((alias|application|document|internet location) )?file|clipping|package)s?\b + scope: support.class.finder.items.applescript + - match: \b((Finder|desktop|information|preferences|clipping) )windows?\b + scope: support.class.finder.window-classes.applescript + - match: \b(preferences|(icon|column|list) view options|(label|column|alias list)s?)\b + scope: support.class.finder.type-definitions.applescript + - match: \b(copy|find|sort|clean up|eject|empty( trash)|erase|reveal|update)\b + scope: support.function.finder.items.applescript + - match: \b(insertion location|product version|startup disk|desktop|trash|home|computer container|finder preferences)\b + scope: support.constant.finder.applescript + - match: \b(visible)\b + scope: support.variable.finder.applescript + inline: + - include: comments + - include: data-structures + - include: built-in + - include: standardadditions + itunes: + - match: \b(artwork|application|encoder|EQ preset|item|source|visual|(EQ |browser )?window|((audio CD|device|shared|URL|file) )?track|playlist window|((audio CD|device|radio tuner|library|folder|user) )?playlist)s?\b + scope: support.class.itunes.applescript + - match: \b(add|back track|convert|fast forward|(next|previous) track|pause|play(pause)?|refresh|resume|rewind|search|stop|update|eject|subscribe|update(Podcast|AllPodcasts)|download)\b + scope: support.function.itunes.applescript + - match: \b(current (playlist|stream (title|URL)|track)|player state)\b + scope: support.constant.itunes.applescript + - match: \b(current (encoder|EQ preset|visual)|EQ enabled|fixed indexing|full screen|mute|player position|sound volume|visuals enabled|visual size)\b + scope: support.variable.itunes.applescript + standard-suite: + - match: \b(colors?|documents?|items?|windows?)\b + scope: support.class.standard-suite.applescript + - match: \b(close|count|delete|duplicate|exists|make|move|open|print|quit|save|activate|select|data size)\b + scope: support.function.standard-suite.applescript + - match: \b(name|frontmost|version)\b + scope: support.constant.standard-suite.applescript + - match: \b(selection)\b + scope: support.variable.standard-suite.applescript + - match: \b(attachments?|attribute runs?|characters?|paragraphs?|texts?|words?)\b + scope: support.class.text-suite.applescript + standardadditions: + - match: \b((alert|dialog) reply)\b + scope: support.class.standardadditions.user-interaction.applescript + - match: \b(file information)\b + scope: support.class.standardadditions.file.applescript + - match: \b(POSIX files?|system information|volume settings)\b + scope: support.class.standardadditions.miscellaneous.applescript + - match: \b(URLs?|internet address(es)?|web pages?|FTP items?)\b + scope: support.class.standardadditions.internet.applescript + - match: \b(info for|list (disks|folder)|mount volume|path to( resource)?)\b + scope: support.function.standardadditions.file.applescript + - match: \b(beep|choose (application|color|file( name)?|folder|from list|remote application|URL)|delay|display (alert|dialog)|say)\b + scope: support.function.standardadditions.user-interaction.applescript + - match: \b(ASCII (character|number)|localized string|offset|summarize)\b + scope: support.function.standardadditions.string.applescript + - match: \b(set the clipboard to|the clipboard|clipboard info)\b + scope: support.function.standardadditions.clipboard.applescript + - match: \b(open for access|close access|read|write|get eof|set eof)\b + scope: support.function.standardadditions.file-i-o.applescript + - match: \b((load|store|run) script|scripting components)\b + scope: support.function.standardadditions.scripting.applescript + - match: \b(current date|do shell script|get volume settings|random number|round|set volume|system attribute|system info|time to GMT)\b + scope: support.function.standardadditions.miscellaneous.applescript + - match: \b(opening folder|(closing|moving) folder window for|adding folder items to|removing folder items from)\b + scope: support.function.standardadditions.folder-actions.applescript + - match: \b(open location|handle CGI request)\b + scope: support.function.standardadditions.internet.applescript + system-events: + - match: \b(audio (data|file))\b + scope: support.class.system-events.audio-file.applescript + - match: \b(alias(es)?|(Classic|local|network|system|user) domain objects?|disk( item)?s?|domains?|file( package)?s?|folders?|items?)\b + scope: support.class.system-events.disk-folder-file.applescript + - match: \b(delete|open|move)\b + scope: support.function.system-events.disk-folder-file.applescript + - match: \b(folder actions?|scripts?)\b + scope: support.class.system-events.folder-actions.applescript + - match: \b(attach action to|attached scripts|edit action of|remove action from)\b + scope: support.function.system-events.folder-actions.applescript + - match: \b(movie data|movie file)\b + scope: support.class.system-events.movie-file.applescript + - match: \b(log out|restart|shut down|sleep)\b + scope: support.function.system-events.power.applescript + - match: \b(((application |desk accessory )?process|(check|combo )?box)(es)?|(action|attribute|browser|(busy|progress|relevance) indicator|color well|column|drawer|group|grow area|image|incrementor|list|menu( bar)?( item)?|(menu |pop up |radio )?button|outline|(radio|tab|splitter) group|row|scroll (area|bar)|sheet|slider|splitter|static text|table|text (area|field)|tool bar|UI element|window)s?)\b + scope: support.class.system-events.processes.applescript + - match: \b(click|key code|keystroke|perform|select)\b + scope: support.function.system-events.processes.applescript + - match: \b(property list (file|item))\b + scope: support.class.system-events.property-list.applescript + - match: \b(annotation|QuickTime (data|file)|track)s?\b + scope: support.class.system-events.quicktime-file.applescript + - match: \b((abort|begin|end) transaction)\b + scope: support.function.system-events.system-events.applescript + - match: \b(XML (attribute|data|element|file)s?)\b + scope: support.class.system-events.xml.applescript + - match: \b(print settings|users?|login items?)\b + scope: support.class.system-events.other.applescript + textmate: + - match: \b(print settings)\b + scope: support.class.textmate.applescript + - match: \b(get url|insert|reload bundles)\b + scope: support.function.textmate.applescript diff --git a/assets/syntaxes/Packages/AppleScript/Comments.tmPreferences b/assets/syntaxes/Packages/AppleScript/Comments.tmPreferences new file mode 100644 index 000000000..2af4afb33 --- /dev/null +++ b/assets/syntaxes/Packages/AppleScript/Comments.tmPreferences @@ -0,0 +1,45 @@ + + + + name + Comments + scope + source.applescript + settings + + shellVariables + + + name + TM_COMMENT_START + value + -- + + + name + TM_COMMENT_START_2 + value + #! + + + name + TM_COMMENT_START_3 + value + /* + + + name + TM_COMMENT_END_3 + value + */ + + + name + TM_COMMENT_DISABLE_INDENT_3 + value + yes + + + + + diff --git a/assets/syntaxes/Packages/Batch File/Batch File.sublime-settings b/assets/syntaxes/Packages/Batch File/Batch File.sublime-settings new file mode 100644 index 000000000..804ffcd95 --- /dev/null +++ b/assets/syntaxes/Packages/Batch File/Batch File.sublime-settings @@ -0,0 +1,6 @@ +{ + // Determines what character(s) are used to terminate each line in new files. + // Valid values are 'system' (whatever the OS uses), 'windows' (CRLF) and + // 'unix' (LF only). + "default_line_ending": "windows" +} diff --git a/assets/syntaxes/Packages/Batch File/Batch File.sublime-syntax b/assets/syntaxes/Packages/Batch File/Batch File.sublime-syntax new file mode 100644 index 000000000..315aab42d --- /dev/null +++ b/assets/syntaxes/Packages/Batch File/Batch File.sublime-syntax @@ -0,0 +1,424 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Batch File +file_extensions: + - bat + - cmd +scope: source.dosbatch +variables: + colon_comment_start: '(?::[+=,;: ])' + command_terminators: (?=$\n|[&|><)]) + set_arithmetic_operators_unquoted: (?:\+|-|\*|/|%%|~) + set_arithmetic_operators_quoted: (?:\||<<|>>|&|\^) + +contexts: + main: + - include: expressions + + expressions: + - include: comments + - include: labels + - include: strings + - include: parens + - include: numbers + - include: constants + - include: operators + - include: escaped_characters + - include: variables + - include: commands + - match: \b(?i)exit\b + scope: keyword.control.statement.dosbatch + - match: \b(?i)(goto|call)\b(?:\s*(:)?(?:(eof)|(\w+)))? + captures: + 1: keyword.control.statement.dosbatch + 2: punctuation.separator.dosbatch + 3: keyword.control.flow.return.dosbatch + 4: meta.function-call.dosbatch variable.function.dosbatch + - match: \b(?i)(if)\s+(?:(not)\s+)?(exist|defined|errorlevel|cmdextversion)\b + captures: + 1: keyword.control.conditional.dosbatch + 2: keyword.operator.logical.dosbatch + 3: keyword.other.dosbatch + - match: \b(?i)(?:if|else)\b + scope: keyword.control.conditional.dosbatch + - match: \b(?i)for\b + scope: keyword.control.repeat.dosbatch + + commands: + - match: \b(?i:echo)\b + scope: keyword.command.dosbatch + push: + - match: '{{command_terminators}}' + pop: true + - include: escaped_characters + - include: variables + - include: numbers + - include: strings + - include: command_set + - match: \b(?i:aciniupd|adprep|append|arp|assoc|at|atmadm|attrib|autofail|backup|basica|bcdedit|bootcfg|break|cacls|cd|cdburn|certreq|certutil|change logon|change port|change user|change|chcp|chdir|chglogon|chgport|chgusr|chkdsk|chkntfs|choice|cipher|cleanmgr|clip|cls|cluadmin|cluster|cmd|cmdkey|cmstp|color|comp|compact|control|convert|copy|cprofile|cscript|csvde|ctty|date|dcgpofix|debug|defrag|del|deltree|devcon|dfscmd|dhcploc|diantz|dir|diskcomp|diskcopy|diskpart|doskey|dpath|driverquery|dsadd|dsget|dsmod|dsmove|dsquery|dsrm|dvdburn|edit|edlin|endlocal|epal|erase|eventcreate|eventtriggers|evntcmd|exe2bin|expand|explorer|extract|fastopen|fc|fdisk|filever|find|findramd|findstr|finger|flattemp|forcedos|forfiles|format|freedisk|fsutil|ftp|ftype|getmac|gettype|gpresult|gpupdate|graftabl|gwbasic|help|helpctr|hostname|icacls|iexpress|ifconfig|iisreset|inuse|ipconfig|ipxroute|irftp|jt|keyb|label|ldifde|lfnfor|lh|loadhigh|lock|lodctr|logman|logoff|lpq|lpr|macfile|makecab|md|mem|mkdir|mklink|mmc|mode|more|mountvol|move|mrinfo|msd|msg|msiexec|msinfo32|mstsc|mtrace|nbtstat|net accounts|net computer|net config|net continue|net file|net group|net help|net helpmsg|net localgroup|net name|net pause|net print|net send|net session|net share|net start|net statistics|net stop|net time|net use|net user|net view|net|netdom|netsh|netstat|nlb|nlbmgr|nltest|notepad|nslookup|ntbackup|ntcmdprompt|ntdsutil|ntsd|ocsetup|odbcconf|openfiles|path|pathping|pause|pbadmin|pentnt|perfmon|ping|ping6|pkgmgr|popd|powercfg|print|prompt|pushd|qappsrv|qbasic|qchain|qfarm|qprocess|qserver|query process|query session|query termserver|query user|query|quser|qwinsta|rasdial|rasphone|rcp|rd|readline|recimg|recover|reg|regedit|regedt32|regini|register|regsvr32|relog|rem|ren|rename|replace|reset session|reset|restore|rexec|risetup|rmdir|robocopy|route|rsh|rsm|rss|runas|rundll|rundll32|sc|schtasks|secedit|set|setlocal|setx|sfc|shadow|shift|shutdown|sort|start|subinacl|subst|sysocmgr|systeminfo|takeown|tapicfg|taskkill|tasklist|tcmsetup|tftp|time|timeout|title|tracerpt|tracert|tracert6|tracerte|tree|truename|tscon|tsdiscon|tsecimp|tskill|tsprof|tsshutdn|type|typeperf|tzchange|unlock|unlodctr|ver|verify|vhdmount|vol|vssadmin|w32tm|waitfor|where|whoami|winmsd|winmsdp|winnt|winnt32|winpop|winsat|wlbs|wmic|wscript|wupdmgr|xcacls|xcopy)\b + scope: keyword.command.dosbatch + + command_set: + - match: '(?i)\bSET\b' + scope: keyword.command.dosbatch + push: inside_command_set + + inside_command_set: + - match: '{{command_terminators}}' + pop: true + - include: escaped_characters + - include: variables + - match: (")\s*([^ ][^=]*)(=) + captures: + 1: punctuation.definition.string.begin.dosbatch + 2: variable.other.readwrite.dosbatch + 3: keyword.operator.assignment.dosbatch + push: + - meta_scope: string.quoted.double.dosbatch + - match: '"(?=\s*(?:{{command_terminators}}))' + scope: punctuation.definition.string.end.dosbatch + pop: true + - include: escaped_characters + - include: variables + - include: numbers + - include: parens + - match: ([^ ][^=]*)(=) + captures: + 1: variable.other.readwrite.dosbatch + 2: keyword.operator.assignment.dosbatch + push: + - meta_content_scope: string.unquoted.dosbatch + - match: '{{command_terminators}}' + pop: true + - include: variables + - match: '"' + scope: punctuation.definition.string.begin.dosbatch + push: + - meta_scope: string.quoted.double.dosbatch + - clear_scopes: 1 + - match: '"' + scope: punctuation.definition.string.end.dosbatch + pop: true + - include: escaped_characters + - include: variables + - include: numbers + - include: parens + - match: \b([^ ][^=\n]*)$ + scope: variable.other.readwrite.dosbatch + - include: strings + - match: '\s+/[aA]\s+' # SET arithmetic + push: + - meta_content_scope: meta.expression.set.dosbatch + - include: set_arithmetic_unquoted + - match: '\s+/[pP]\s+' # SET from standard input + push: + - match: '{{command_terminators}}' + pop: true + - match: ([^ ][^=]*)(=) + captures: + 1: variable.other.readwrite.dosbatch + 2: keyword.operator.assignment.dosbatch + set: + - meta_scope: meta.prompt.set.dosbatch + - match: '{{command_terminators}}' + pop: true + - match: (?=") + push: + - include: strings + - match: '{{command_terminators}}' + pop: true + - match: . + scope: comment.line.ignored.dosbatch + - match: '' + push: + - meta_content_scope: string.unquoted.dosbatch + - match: '{{command_terminators}}' + pop: true + - include: variables + + set_arithmetic_unquoted: + - match: '{{command_terminators}}' + pop: true + - include: set_arithmetic_operator_common + - match: \( + scope: punctuation.section.group.begin.dosbatch + push: command_set_group_unquoted + - match: '"' + scope: punctuation.definition.string.begin.dosbatch + push: set_arithmetic_quoted + - include: inside_command_set_arithmetic + + command_set_group_unquoted: + - meta_scope: meta.group.dosbatch + - match: \) + scope: punctuation.section.group.end.dosbatch + pop: true + - match: '"' + scope: punctuation.definition.string.begin.dosbatch + set: command_set_group_newly_quoted + - include: set_arithmetic_unquoted + + set_arithmetic_operator_common: + - match: ({{set_arithmetic_operators_unquoted}})= + scope: keyword.operator.assignment.augmented.dosbatch + - match: (\^)(\^=) + captures: + 1: constant.character.escape.dosbatch + 2: keyword.operator.assignment.augmented.dosbatch + - match: ({{set_arithmetic_operators_unquoted}}) + scope: keyword.operator.arithmetic.dosbatch + - match: (\^)(\^) + captures: + 1: constant.character.escape.dosbatch + 2: keyword.operator.arithmetic.dosbatch + - match: = + scope: keyword.operator.assignment.dosbatch + + set_arithmetic_operator_quoted: + - match: ({{set_arithmetic_operators_quoted}})= + scope: keyword.operator.assignment.augmented.dosbatch + - match: ({{set_arithmetic_operators_quoted}}) + scope: keyword.operator.arithmetic.dosbatch + - include: set_arithmetic_operator_common + + set_arithmetic_quoted: + - meta_scope: string.quoted.double.dosbatch + - match: $ + pop: true + - match: '"' + scope: punctuation.definition.string.end.dosbatch + pop: true + - match: \( + scope: punctuation.section.group.begin.dosbatch + set: + - meta_scope: meta.group.dosbatch + - match: '' + set: command_set_group_newly_quoted + - include: set_arithmetic_operator_quoted + - include: inside_command_set_arithmetic + + command_set_group_already_quoted: + - meta_scope: meta.group.dosbatch + - match: \) + scope: punctuation.section.group.end.dosbatch + pop: true + - match: '"' + scope: punctuation.definition.string.end.dosbatch + set: + - match: '' + set: command_set_group_unquoted + - include: set_arithmetic_quoted + + command_set_group_newly_quoted: + - meta_scope: string.quoted.double.dosbatch meta.group.dosbatch + - match: \( + scope: punctuation.section.group.begin.dosbatch + push: command_set_group_already_quoted + - match: \) + scope: punctuation.section.group.end.dosbatch + set: + - match: '' + set: set_arithmetic_quoted + - include: command_set_group_already_quoted + + inside_command_set_arithmetic: + - match: '!' + scope: keyword.operator.logical.dosbatch + - include: numbers + - include: comma_separator + - include: variables + - include: escaped_characters + - match: (?:(?!{{set_arithmetic_operators_unquoted}}|{{set_arithmetic_operators_quoted}}|[=")])\S)+ + scope: variable.other.readwrite.dosbatch + + variables: + # global parameters + - match: '(%)((~([fdpnxsatz]|\$PATH:)*)?\d|\*)' + scope: variable.parameter.dosbatch + captures: + 1: punctuation.definition.variable.dosbatch + - match: (?i)(%)errorlevel(%) + scope: variable.language.dosbatch + captures: + 1: punctuation.definition.variable.begin.dosbatch + 2: punctuation.definition.variable.end.dosbatch + - include: variable + - include: variable_delayed_expansion + + variable: + # variable + - match: '%(?=[^%]+%)' + scope: punctuation.definition.variable.begin.dosbatch + push: + - meta_scope: variable.other.readwrite.dosbatch + - match: '(%)|\n' + captures: + 1: punctuation.definition.variable.end.dosbatch + pop: true + # substring expansion + - match: ':~' + scope: punctuation.separator.dosbatch + push: + - meta_content_scope: meta.variable.substring.dosbatch + - match: '(?=%|\n)' + pop: true + - include: inside_variable_substring + # string substitution + - match: ':' + scope: punctuation.separator.dosbatch + push: + - meta_content_scope: meta.variable.substitution.dosbatch + - match: '(?=%|\n)' + pop: true + - include: variable_substitution_replacee + - match: '=' + scope: punctuation.separator.dosbatch + push: + - match: '(?=%|\n)' + pop: true + - include: variable_delayed_expansion + - match: '[^%]+' + scope: string.unquoted.dosbatch + + variable_delayed_expansion: + # variable with delayed expansion + - match: '!(?=[^!]+!)' + scope: punctuation.definition.variable.begin.dosbatch + push: + - meta_scope: variable.other.readwrite.dosbatch + - match: '(!)|\n' + captures: + 1: punctuation.definition.variable.end.dosbatch + pop: true + # substring expansion + - match: ':~' + scope: punctuation.separator.dosbatch + push: + - meta_content_scope: meta.variable.substring.dosbatch + - match: '(?=!|\n)' + pop: true + - include: inside_variable_substring + # string substitution + - match: ':' + scope: punctuation.separator.dosbatch + push: + - meta_content_scope: meta.variable.substitution.dosbatch + - match: '(?=!|\n)' + pop: true + - include: variable + - include: variable_substitution_replacee + - match: '=' + scope: punctuation.separator.dosbatch + push: + - match: '(?=!|\n)' + pop: true + - include: variable + - match: '[^!]+' + scope: string.unquoted.dosbatch + + variable_substitution_replacee: + - match: '[^=]+' + scope: string.unquoted.dosbatch + + inside_variable_substring: + - match: '[+-]?\d+' + scope: constant.numeric.dosbatch + - include: comma_separator + + comma_separator: + - match: ',' + scope: punctuation.separator.dosbatch + + numbers: + - match: '\b(0[xX])\h*\b' + scope: constant.numeric.integer.hexadecimal.dosbatch + captures: + 1: punctuation.definition.numeric.hexadecimal.dosbatch + - match: '\b(0)[0-7]+\b' + scope: constant.numeric.integer.octal.dosbatch + captures: + 1: punctuation.definition.numeric.octal.dosbatch + - match: '\b(?:0|[1-9][0-9]*)\b' + scope: constant.numeric.integer.decimal.dosbatch + + constants: + - match: \b(?i:NUL)\b + scope: constant.language.dosbatch + + operators: + - match: '@(?=\S)' + scope: keyword.operator.at.dosbatch + - match: \b(?i:EQU|NEQ|LSS|LEQ|GTR|GEQ)\b|== + scope: keyword.operator.comparison.dosbatch + - match: \b(?i:NOT)\b + scope: keyword.operator.logical.dosbatch + - match: '&&?|\|\|' + scope: keyword.operator.conditional.dosbatch + - match: '\|' + scope: keyword.operator.pipe.dosbatch + - match: '<&?|>[&>]?' + scope: keyword.operator.redirection.dosbatch + + labels: + - match: '^\s*(:)([^+=,;:\s].*)$' + captures: + 1: punctuation.separator.dosbatch + 2: entity.name.label.dosbatch + + comments: + - match: '(?:^|(&))\s*(?=({{colon_comment_start}}))' + captures: + 1: keyword.operator.conditional.dosbatch + push: + - match: '\n' + scope: comment.line.rem.dosbatch + pop: true + - match: '({{colon_comment_start}})' + scope: punctuation.definition.comment.dosbatch + push: + - meta_scope: comment.line.colon.dosbatch + - match: '(?=\n)' + pop: true + # REM command + # https://technet.microsoft.com/en-us/library/bb490986.aspx + - match: \b(?i)rem\b + scope: keyword.command.rem.dosbatch + push: + # meta_content_scope is used since rem should not be + # highlighted as a comment, but a command + - meta_content_scope: comment.line.rem.dosbatch + - match: \n + scope: comment.line.rem.dosbatch + pop: true + - match: '[(|)]' + scope: invalid.illegal.unexpected-character.dosbatch + + strings: + - match: '"' + scope: punctuation.definition.string.begin.dosbatch + push: + - meta_scope: string.quoted.double.dosbatch + - match: (")|(\n) + captures: + 1: punctuation.definition.string.end.dosbatch + 2: invalid.illegal.newline.dosbatch + pop: true + - include: escaped_characters + - include: variables + + parens: + - match: \( + scope: punctuation.section.group.begin.dosbatch + push: + - meta_scope: meta.group.dosbatch + - match: \) + scope: punctuation.section.group.end.dosbatch + pop: true + - match: ',|;' + scope: punctuation.separator.dosbatch + - include: expressions + + escaped_characters: + - match: '%%|\^\^!|\^.|\^\n' + scope: constant.character.escape.dosbatch diff --git a/assets/syntaxes/Packages/Batch File/Comments.tmPreferences b/assets/syntaxes/Packages/Batch File/Comments.tmPreferences new file mode 100644 index 000000000..697567334 --- /dev/null +++ b/assets/syntaxes/Packages/Batch File/Comments.tmPreferences @@ -0,0 +1,27 @@ + + + + name + Comments + scope + source.dosbatch + settings + + shellVariables + + + name + TM_COMMENT_START + value + rem + + + name + TM_COMMENT_START_2 + value + :: + + + + + diff --git a/assets/syntaxes/Packages/Batch File/Symbol List.tmPreferences b/assets/syntaxes/Packages/Batch File/Symbol List.tmPreferences new file mode 100644 index 000000000..c9efab6d7 --- /dev/null +++ b/assets/syntaxes/Packages/Batch File/Symbol List.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List + scope + source.dosbatch entity.name.label - meta.function-call + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/Batch File/syntax_test_batch_file.bat b/assets/syntaxes/Packages/Batch File/syntax_test_batch_file.bat new file mode 100644 index 000000000..0495bcb4e --- /dev/null +++ b/assets/syntaxes/Packages/Batch File/syntax_test_batch_file.bat @@ -0,0 +1,770 @@ +:: SYNTAX TEST "Packages/Batch File/Batch File.sublime-syntax" + + REM I'm a (com|ment) +:: ^^^ keyword.command.rem.dosbatch +:: ^^^^^^^^^^^^^^^^ comment.line.rem.dosbatch +:: ^ invalid.illegal.unexpected-character.dosbatch +:: ^ invalid.illegal.unexpected-character.dosbatch +:: ^ invalid.illegal.unexpected-character.dosbatch + +REM + not a comment +:: ^^^^^^^^^^^^^ - comment.line.rem.dosbatch + +REM This follows a REM command +:: <- keyword.command - comment +:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line + + :: Me too! +:: ^^ punctuation.definition.comment.dosbatch +:: ^^^^^^^^^^ comment.line.colon.dosbatch + + :+ Me too! +:: ^^ punctuation.definition.comment.dosbatch + + := Me too! +:: ^^ punctuation.definition.comment.dosbatch + + :, Me too! +:: ^^ punctuation.definition.comment.dosbatch + + :; Me too! +:: ^^ punctuation.definition.comment.dosbatch + + : Me too! +:: ^^ punctuation.definition.comment.dosbatch + +ECHO : Not a comment +:: ^^^^^^^^^^^^^^^ - comment + +ECHO : Not a comment ^ + do not break out of an echo with an escaped newline +:: ^^^ - keyword.operator +:: ^^^^^ - keyword.command + +ECHO &:: A comment +:: ^ keyword.operator.conditional.dosbatch +:: ^^ punctuation.definition.comment.dosbatch +:: ^^^^^^^^^^^^ comment.line.colon.dosbatch + + :: an indented comment +::^^ punctuation.definition.comment.dosbatch +::^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch + + ECHO "foo" +:: ^ punctuation.definition.string.begin.dosbatch +:: ^^^^^ string.quoted.double.dosbatch +:: ^ punctuation.definition.string.end.dosbatch + +ECHO " +:: ^ invalid.illegal.newline.dosbatch + + @ECHO OFF +:: ^ keyword.operator.at.dosbatch + + @ +:: ^ - keyword.operator.at.dosbatch + + GOTO:EOF +:: ^^^^ keyword.control.statement.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^ keyword.control.flow.return.dosbatch + + GOTO :End +:: ^^^^ keyword.control.statement.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^ meta.function-call.dosbatch variable.function.dosbatch + + GOTO:End +:: ^^^^ keyword.control.statement.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^ meta.function-call.dosbatch variable.function.dosbatch + +:: Redirection + ECHO Hello World! > hello.txt +:: ^^^^ keyword.command.dosbatch +:: ^ keyword.operator.redirection.dosbatch + + ECHO >> NUL +:: ^^ keyword.operator.redirection.dosbatch +:: ^^^ constant.language + + dir > f.txt 2>&1 +:: ^ keyword.operator.redirection.dosbatch +:: ^^ keyword.operator.redirection.dosbatch + + ECHO || ECHO && ECHO & +:: ^^ keyword.operator.conditional.dosbatch +:: ^^ keyword.operator.conditional.dosbatch +:: ^ keyword.operator.conditional.dosbatch + +:: Conditionals + IF foo EQU bar +:: ^^ keyword.control.conditional.dosbatch +:: ^^^ keyword.operator.comparison.dosbatch + + IF NOT foo EQU bar +:: ^^ keyword.control.conditional.dosbatch +:: ^^^ keyword.operator.logical.dosbatch +:: ^^^ keyword.operator.comparison.dosbatch + + + IF %ERRORLEVEL% NEQ 0 EXIT /B 1 +:: ^^ keyword.control.conditional.dosbatch +:: ^^^^^^^^^^^^ variable.language.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^ variable.language.dosbatch punctuation.definition.variable.end.dosbatch + + IF foo == bar +:: ^^ keyword.control.conditional.dosbatch +:: ^^ keyword.operator.comparison.dosbatch + + FOR %%G IN (0,9) DO (md %%G) +:: ^^^ keyword.control.repeat.dosbatch +:: ^ constant.numeric.integer.decimal.dosbatch + + FIND "a" | +:: ^ keyword.operator.pipe.dosbatch + + :This is a #%@$虎 strange label +::^ punctuation.separator.dosbatch +:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.label.dosbatch + + :End +::^ punctuation.separator.dosbatch +:: ^^^ entity.name.label.dosbatch + + ECHO %1 %* %~dpf$PATH:5 %~1 +:: ^ punctuation.definition.variable.dosbatch +:: ^^ variable.parameter.dosbatch +:: ^ punctuation.definition.variable.dosbatch +:: ^^ variable.parameter.dosbatch +:: ^ punctuation.definition.variable.dosbatch +:: ^^^^^^^^^^^ variable.parameter.dosbatch +:: ^ punctuation.definition.variable.dosbatch +:: ^^^ variable.parameter.dosbatch + + ECHO %variable% !variable! +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^^^^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^^^^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch + +ECHO %sub:str1=str2% !sub:str1=str2! +:: ^^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^^^^^^^ meta.variable.substitution.dosbatch +:: ^^^^ string.unquoted.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^^ string.unquoted.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch +:: ^^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^^^^^^^ meta.variable.substitution.dosbatch +:: ^^^^ string.unquoted.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^^ string.unquoted.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch + + +ECHO %substr:~0,-2% !substr:~0,-2! +:: ^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^^ punctuation.separator.dosbatch +:: ^^^^ meta.variable.substring.dosbatch +:: ^ constant.numeric.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^ constant.numeric.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch +:: ^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^^ punctuation.separator.dosbatch +:: ^^^^ meta.variable.substring.dosbatch +:: ^ constant.numeric.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^ constant.numeric.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch + +ECHO %b:~-5% !b:~+5! +:: ^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^^ punctuation.separator.dosbatch +:: ^^ meta.variable.substring.dosbatch +:: ^^ constant.numeric.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch +:: ^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^^ punctuation.separator.dosbatch +:: ^^ meta.variable.substring.dosbatch +:: ^^ constant.numeric.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch + +ECHO !t:%foo%=%bar:~0,-4%! +:: ^^^^^^^^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^^^^^ meta.variable.substitution.dosbatch variable.other.readwrite.dosbatch +:: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.begin.dosbatch +:: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.end.dosbatch +:: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.begin.dosbatch +:: ^^^^^^^^^^^ meta.variable.substitution.dosbatch variable.other.readwrite.dosbatch +:: ^^^^ meta.variable.substitution.dosbatch meta.variable.substring.dosbatch +:: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.end.dosbatch +:: ^^ meta.variable.substitution.dosbatch constant.numeric.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch + +ECHO %t:foo=!bar:~0,-4!% +:: ^^^^^^^^^^^^^^^^^^^ variable.other.readwrite.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.begin.dosbatch +:: ^^^^^^^^^^^ meta.variable.substitution.dosbatch variable.other.readwrite.dosbatch +:: ^^^^ meta.variable.substitution.dosbatch meta.variable.substring.dosbatch +:: ^ meta.variable.substitution.dosbatch punctuation.definition.variable.end.dosbatch +:: ^^ meta.variable.substitution.dosbatch constant.numeric.dosbatch +:: ^ punctuation.definition.variable.end.dosbatch + +ECHO Not% a variable +:: ^^^^^^^^^^^^ - variable.other.readwrite.dosbatch +:: ^^^ - keyword.operator.logical.dosbatch + +ECHO Not! a variable +:: ^^^^^^^^^^^^ - variable.other.readwrite.dosbatch +:: ^^^ - keyword.operator.logical.dosbatch + +:: Numerics +SET /A r = 010 + 0x20 - 24 +:: ^^^ constant.numeric.integer.octal.dosbatch +:: ^ punctuation.definition.numeric.octal.dosbatch +:: ^^^^ constant.numeric.integer.hexadecimal.dosbatch +:: ^^ punctuation.definition.numeric.hexadecimal.dosbatch +:: ^^ constant.numeric.integer.decimal.dosbatch + +:: Escape Characters +ECHO %% ^^! ^& +:: ^^ constant.character.escape.dosbatch +:: ^^^ constant.character.escape.dosbatch +:: ^^ constant.character.escape.dosbatch + +:: command SET /A specific operators + set /a "num%%=5" +:: ^^^^^^^^^ meta.expression.set.dosbatch +:: ^^^ keyword.operator.assignment.augmented.dosbatch + + set /a "num&=3" +:: ^^ keyword.operator.assignment.augmented.dosbatch + + set /a "num*=5" +:: ^^ keyword.operator.assignment.augmented.dosbatch + + set /a "num+=5" +:: ^^ keyword.operator.assignment.augmented.dosbatch + + set /a "num-=5" +:: ^^ keyword.operator.assignment.augmented.dosbatch + + set /a "num/=5" +:: ^^ keyword.operator.assignment.augmented.dosbatch + + set /a "num<<=2" +:: ^^^ keyword.operator.assignment.augmented.dosbatch + + set /a "num=!5" +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.logical.dosbatch + + set /a "num=(2+3)*5" +:: ^^^^^ meta.group.dosbatch +:: ^ punctuation.section.group.begin.dosbatch +:: ^ punctuation.section.group.end.dosbatch +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num=2,result=num*5" +:: ^ keyword.operator.assignment.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num=2<<3" +:: ^ keyword.operator.assignment.dosbatch +:: ^^ keyword.operator.arithmetic.dosbatch + + set /a "num=2>>3" +:: ^ keyword.operator.assignment.dosbatch +:: ^^ keyword.operator.arithmetic.dosbatch + + set /a "num=5%%2" +:: ^ keyword.operator.assignment.dosbatch +:: ^^ keyword.operator.arithmetic.dosbatch + + set /a "num=5&3" +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num=5^3" +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num=5|3" +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num^=3" +:: ^^ keyword.operator.assignment.augmented.dosbatch + + set /a "num=num*5" +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num=num+5" +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num=num-5" +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num=num/5" +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num=~5" +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + set /a "num>>=2" +:: ^^^ keyword.operator.assignment.augmented.dosbatch + + set /a "num|=3" +:: ^^ keyword.operator.assignment.augmented.dosbatch + + set /a century=year/100, next=century+1 +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^ keyword.operator.assignment.dosbatch +:: ^ keyword.operator.arithmetic.dosbatch + + SET T=%TIME: =0% +::^^^ keyword.command +:: ^ variable.other.readwrite +:: ^ keyword.operator.assignment +:: ^^^^^^^^^^ variable.other.readwrite + +IF "%FOO%" == "BAR" ( SET BAZ=42 ) +:: ^ punctuation.section.group.begin +:: ^^^^^^^^^^^^^^ meta.group +:: ^ punctuation.section.group.end +:: ^^ string.unquoted + +:: See http://ss64.com/nt/syntax-brackets.html +IF EXIST MyFile.txt (ECHO Some(more)Potatoes) +:: <- keyword.control +:: ^ keyword.other +:: ^^^^^^^^^^^^^^^^ meta.group +:: ^ keyword.command +:: ^ - meta.group + +IF EXIST MyFile.txt (ECHO Some[more]Potatoes) +:: <- keyword.control +:: ^ keyword.other +:: ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +:: ^ keyword.command + +set "hello"="world" +:: <- keyword.command +:: ^ - variable.other.readwrite +:: ^^^^^^ variable.other.readwrite +:: ^ keyword.operator.assignment +:: ^ - punctuation +:: ^ punctuation.definition.string.end +:: ^ - string + +set foo=bar +:: <- keyword.command +:: ^^^ variable.other.readwrite +:: ^ keyword.operator.assignment +:: ^^^ string.unquoted + +set foo = bar +:: <- keyword.command +:: ^ - variable.other.readwrite +:: ^^^^ variable.other.readwrite +:: ^ keyword.operator.assignment +:: ^^^ string.unquoted + +set hello world = bar +:: <- keyword.command +:: ^ - variable.other.readwrite +:: ^^^^^^^^^^^^ variable.other.readwrite +:: ^ keyword.operator.assignment +:: ^^^ string.unquoted + +set abc /a = 1+2 +:: <- keyword.command +:: ^^^^^^^ variable.other.readwrite +:: ^ keyword.operator.assignment - meta.expression.set +:: ^^^ string.unquoted + +set "foobar=test" +:: <- keyword.command +:: ^ - variable.other.readwrite +:: ^^^^^^ variable.other.readwrite +:: ^ keyword.operator.assignment +:: ^ punctuation.definition.string.end + +set " foo = bar" +:: <- keyword.command +:: ^^ - variable.other.readwrite +:: ^^^^ variable.other.readwrite +:: ^ keyword.operator.assignment +:: ^ punctuation.definition.string.end + +set test rem = hi +:: <- keyword.command +:: ^^^^^^^^^ - comment +:: ^^^^^^^^^ variable.other.readwrite +:: ^ keyword.operator.assignment +:: ^^ - variable.other + +set hello_world +:: <- keyword.command +:: ^^^^^^^^^^^ variable.other.readwrite.dosbatch + +set /A hello_world +:: <- keyword.command +:: ^^^^^^^^^^^ meta.expression.set +:: ^ - meta.expression.set + +powershell get-date -uformat "%%Y%%m%%d" > today.txt +:: ^^^^^^^^^^^ string.quoted.double.dosbatch +:: ^^ constant.character.escape.dosbatch +:: ^ - constant.character.escape.dosbatch +:: ^^ constant.character.escape.dosbatch +:: ^ - constant.character.escape.dosbatch +:: ^^ constant.character.escape.dosbatch +:: ^ - constant.character.escape.dosbatch + +:: the following example was inspired by http://stackoverflow.com/a/14634551/4473405 +set /p today=" +:: ^ punctuation.definition.string.begin +:: ^ - punctuation +:: ^^^^^^^ variable.other.readwrite +:: ^ - punctuation +:: ^ - punctuation +:: ^^^^^^^ variable.other.readwrite +:: ^ - punctuation +:: ^ punctuation.definition.string.end + +set folder=%TEMP%\subfolder\ +:: ^^^^^^ variable.other.readwrite.dosbatch +:: ^^^^^^ variable.other.readwrite.dosbatch +:: ^^^^^^^^^^^ string.unquoted - variable.other + +set test="c:\program files (x86)\%example%_%%test"abc +:: ^^^^ variable.other.readwrite.dosbatch +:: ^ keyword.operator.assignment.dosbatch +:: ^ punctuation.definition.string.begin.dosbatch +:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.dosbatch +:: ^^^^^^^^^ variable.other.readwrite.dosbatch +:: ^^ constant.character.escape.dosbatch +:: ^ punctuation.definition.string.end.dosbatch +:: ^^^ string.unquoted.dosbatch + +SETLOCAL EnableDelayedExpansion +::^^^^^^ keyword.command.dosbatch + SET /P example="what is the answer? ;) " & echo you have answered: !example! +:: ^^^^ - variable.other.readwrite.dosbatch +:: ^^^^^^^ variable.other.readwrite.dosbatch +:: ^ keyword.operator.assignment.dosbatch +:: ^ punctuation.definition.string.begin.dosbatch +:: ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.prompt.set.dosbatch string.quoted +:: ^ punctuation.definition.string.end.dosbatch +:: ^ keyword.operator.conditional.dosbatch - meta.prompt.set.dosbatch - string +:: ^^^^ keyword.command.dosbatch +:: ^^^^^^^^^ variable.other.readwrite.dosbatch +ENDLOCAL +::^^^^^^ keyword.command.dosbatch + +set "X=" +:: ^^^^ string.quoted.double +:: ^ punctuation.definition.string.begin +:: ^ variable.other.readwrite +:: ^ keyword.operator.assignment +:: ^ punctuation.definition.string.end +:: ^ - string + +set /p OUTPUT="( ... )|&... " +:: ^^^^^^^^^^^^^^^ meta.prompt.set string.quoted.double - string.unquoted +set /p OUTPUT=hi|echo +:: ^^ meta.prompt.set string.unquoted +:: ^ keyword.operator.pipe - meta.prompt +:: ^^^^ keyword.command +set /p OUTPUT="( ... )|&... "ignored & echo +:: ^^^^^^^^^^^^^^^ meta.prompt.set string.quoted.double - string.unquoted +:: ^^^^^^^ meta.prompt.set comment.line.ignored +:: ^ keyword.operator.conditional - comment +:: ^^^^ keyword.command +set /p today="enter a date: " REM :: this is a comment & echo !today! +:: ^^^^ - variable.other.readwrite.dosbatch +:: ^^^^^ variable.other.readwrite.dosbatch +:: ^ keyword.operator.assignment.dosbatch - variable.other.readwrite.dosbatch +:: ^^^^^^^^^^^^^^^^ meta.prompt.set.dosbatch string.quoted - variable.other.readwrite.dosbatch - comment +:: ^^^^^^^^^^^^^^^^^^^^^^^^ comment +:: ^ keyword.operator.conditional - comment - meta.prompt +:: ^^^^ keyword.command +:: ^^^^^^^ variable.other.readwrite + +set hello=4 +set wow=2 +set /A hello*=wow*=2 +:: ^^^^^ variable.other.readwrite +:: ^^ keyword.operator.assignment.augmented +:: ^^^ variable.other.readwrite +:: ^^ keyword.operator.assignment.augmented +:: ^ constant.numeric.integer.decimal + +set /A "hello*=wow" +:: ^^^^^^^^^^^^ meta.expression.set string.quoted.double +:: ^ punctuation.definition.string.begin +:: ^^^^^ variable.other.readwrite +:: ^^ keyword.operator.assignment.augmented +:: ^ punctuation.definition.string.end + +set /A "%hello%+%wow%" +:: ^^^^^^^^^^^^^^^ meta.expression.set string.quoted.double +:: ^ punctuation.definition.string.begin +:: ^^^^^^^ variable.other.readwrite +:: ^ punctuation.definition.variable.begin +:: ^ punctuation.definition.variable.end +:: ^ keyword.operator.arithmetic +:: ^^^^^ variable.other.readwrite +:: ^ punctuation.definition.variable.begin +:: ^^^ variable.other.readwrite +:: ^ punctuation.definition.variable.end +:: ^ punctuation.definition.string.end +set /A "%hello%+wow" +:: ^^^^^^^^^^^^^ meta.expression.set string.quoted.double +:: ^^^^^^^ variable.other.readwrite +:: ^ punctuation.definition.variable.begin +:: ^ punctuation.definition.variable.end +:: ^ keyword.operator.arithmetic + +set /A 1+"%hello%" +:: ^ constant.numeric.integer.decimal +:: ^ keyword.operator.arithmetic +:: ^^^^^^^^^ string.quoted.double +:: ^ punctuation.definition.string.begin +:: ^ punctuation.definition.variable.begin +:: ^^^^^ variable.other.readwrite +:: ^ punctuation.definition.variable.end +:: ^ punctuation.definition.string.end + +set a12b=21 +REM the line below is actually invalid, as % is not expected to be used in variables before an augmented operator +set /a %a12b%*=2 +:: ^^^^ variable.other.readwrite +:: ^^ keyword.operator.assignment.augmented +:: ^ constant.numeric.integer.decimal + +set /a a12b*=2 +:: ^^^^ variable.other.readwrite +:: ^^ keyword.operator.assignment.augmented +:: ^ constant.numeric.integer.decimal +set /a a12b *= 2 +:: ^ - variable +:: ^^^^ variable.other.readwrite +:: ^ - variable +:: ^^ meta.expression.set keyword.operator.assignment.augmented +:: ^ constant.numeric.integer.decimal + +set /a ! a12b +:: ^ keyword.operator.logical +:: ^^^^ variable.other.readwrite +set /a !a12b +:: ^ keyword.operator.logical +:: ^^^^ variable.other.readwrite +set /a "! a12b" +:: ^^^^^^^^ meta.expression.set string.quoted.double +:: ^ punctuation.definition.string.begin +:: ^ keyword.operator.logical +:: ^^^^ variable.other.readwrite +:: ^ punctuation.definition.string.end +set /a "! %a12b%" +:: ^^^^^^^^^^ meta.expression.set string.quoted.double +:: ^ punctuation.definition.string.begin +:: ^ keyword.operator.logical +:: ^^^^^^ variable.other.readwrite +:: ^ punctuation.definition.variable.begin +:: ^ punctuation.definition.variable.end +:: ^ punctuation.definition.string.end +set /a ! "a12b" +:: ^ keyword.operator.logical +:: ^ punctuation.definition.string.begin +:: ^^^^ variable.other.readwrite +:: ^ punctuation.definition.string.end +set /a !"%a12b%" +:: ^ keyword.operator.logical +:: ^ punctuation.definition.string.begin +:: ^^^^^^ variable.other.readwrite +:: ^ punctuation.definition.string.end + +set /a a&=a12b +:: ^ keyword.operator.conditional - meta.expression.set +set /a " world"=12 +:: ^^^^^^^^ string.quoted.double +:: ^^^^^ variable.other.readwrite +:: ^ punctuation.definition.string.end +:: ^ keyword.operator.assignment +:: ^^ constant.numeric.integer.decimal + +set /a "wow"+="2" +:: ^^^^^ string.quoted.double +:: ^^^ variable.other.readwrite +:: ^^ keyword.operator.assignment.augmented - string +:: ^^^ string.quoted.double +:: ^ constant.numeric.integer.decimal +set /a wow"+="2 +:: ^^^ variable.other.readwrite +:: ^^^^ string.quoted.double +:: ^^ keyword.operator.assignment.augmented +:: ^ constant.numeric.integer.decimal - string +set /a 4*"2+-wow+(3"-2) +:: ^^^^^^^^^^^^^^^^ meta.expression.set - string string - meta.group meta.group +:: ^ constant.numeric.integer.decimal +:: ^ keyword.operator.arithmetic +:: ^^^^^^^^^^^ string.quoted.double +:: ^ punctuation.definition.string.begin +:: ^ constant.numeric.integer.decimal +:: ^^ keyword.operator.arithmetic +:: ^^^ variable.other.readwrite +:: ^ keyword.operator.arithmetic +:: ^^^^^^ meta.group +:: ^ punctuation.section.group.begin +:: ^ constant.numeric.integer.decimal +:: ^ punctuation.definition.string.end +:: ^ keyword.operator.arithmetic +:: ^ constant.numeric.integer.decimal +:: ^ punctuation.section.group.end +:: ^^^ - string +:: ^^^ string.quoted.double meta.group + +set /a (8"2") +:: ^^^^^^ meta.group +:: ^ punctuation.section.group.begin +:: ^ constant.numeric.integer.decimal +:: ^ punctuation.definition.string.begin +:: ^^^ string.quoted.double +:: ^ constant.numeric.integer.decimal +:: ^ punctuation.definition.string.end +:: ^ punctuation.section.group.end + +set /a 4*"2+1"1 +:: ^ constant.numeric.integer.decimal +:: ^ keyword.operator.arithmetic +:: ^^^^^ string.quoted.double +:: ^ constant.numeric.integer.decimal +:: ^ keyword.operator.arithmetic +:: ^ constant.numeric.integer.decimal +:: ^ constant.numeric.integer.decimal +set /a 4*"2++1" +:: ^ constant.numeric.integer.decimal +:: ^ keyword.operator.arithmetic +:: ^^^^^^ string.quoted.double +:: ^ constant.numeric.integer.decimal +:: ^^ keyword.operator.arithmetic +:: ^ constant.numeric.integer.decimal +set /a 4*"2++w"ow +:: ^^^^^^ string.quoted.double +:: ^ constant.numeric.integer.decimal +:: ^^ keyword.operator.arithmetic +:: ^ variable.other.readwrite +:: ^^ variable.other.readwrite +set /a (8"2")^^1 +:: ^ constant.character.escape +:: ^ keyword.operator.arithmetic +set /a (8"2")^ ++1 +:: <- keyword.operator.arithmetic +set /a (abc*(def-(2))/4)"+((1))" +:: ^^^^^^^^^^^^^^^^^ meta.group +:: ^ - meta.group +:: ^^^^^^^^^ meta.group meta.group +:: ^^^ meta.group meta.group meta.group +:: ^ punctuation.section.group.begin +:: ^^^ variable.other.readwrite +:: ^ keyword.operator.arithmetic +:: ^ punctuation.section.group.begin +:: ^^^ variable.other.readwrite +:: ^ keyword.operator.arithmetic +:: ^ punctuation.section.group.begin +:: ^ constant.numeric.integer.decimal +:: ^ punctuation.section.group.end +:: ^ punctuation.section.group.end +:: ^ keyword.operator.arithmetic +:: ^ constant.numeric.integer.decimal +:: ^ punctuation.section.group.end +:: ^^^^^^^^ string.quoted.double +:: ^ punctuation.definition.string.begin +:: ^ keyword.operator.arithmetic +:: ^ meta.group punctuation.section.group.begin +:: ^ meta.group meta.group punctuation.section.group.begin +:: ^ meta.group meta.group constant.numeric.integer.decimal +:: ^ meta.group meta.group punctuation.section.group.end +:: ^ meta.group punctuation.section.group.end +:: ^ punctuation.definition.string.end - meta.group +set /a ("a"+b&"c+d") +:: ^^^^^^ meta.expression.set meta.group +:: ^^^ string.quoted.double +:: ^ variable.other.readwrite +:: ^ keyword.operator.arithmetic +:: ^ variable.other.readwrite +:: ^ keyword.operator.conditional +:: ^^^^^ string.quoted.double - keyword - variable +set /a (a+"b)*2"-1 +:: ^^^^^^ meta.group +:: ^ punctuation.section.group.begin +:: ^ variable.other.readwrite +:: ^ keyword.operator.arithmetic +:: ^ punctuation.definition.string.begin +:: ^^^^^^ string.quoted.double +:: ^ variable.other.readwrite +:: ^ punctuation.section.group.end +:: ^ keyword.operator.arithmetic - meta.group +:: ^ constant.numeric.integer.decimal +:: ^ punctuation.definition.string.end +:: ^ keyword.operator.arithmetic - meta.group +:: ^ constant.numeric.integer.decimal diff --git a/assets/syntaxes/Packages/C#/Build.sublime-syntax b/assets/syntaxes/Packages/C#/Build.sublime-syntax new file mode 100644 index 000000000..f7b0e7ef6 --- /dev/null +++ b/assets/syntaxes/Packages/C#/Build.sublime-syntax @@ -0,0 +1,56 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: NAnt Build File +file_extensions: + - build +scope: source.nant-build +contexts: + main: + - match: " + captures: + 0: punctuation.definition.comment.nant + pop: true + - match: "() + captures: + 1: punctuation.definition.tag.nant + 2: entity.name.tag.nant + pop: true + - match: " ([a-zA-Z-]+)" + scope: entity.other.attribute-name.nant + - match: '"' + captures: + 0: punctuation.definition.string.begin.nant + push: + - meta_scope: string.quoted.double.nant + - match: '"' + captures: + 0: punctuation.definition.string.end.nant + pop: true + - match: "'" + captures: + 0: punctuation.definition.string.begin.nant + push: + - meta_scope: string.quoted.single.nant + - match: "'" + captures: + 0: punctuation.definition.string.end.nant + pop: true + - match: "(&)([a-zA-Z]+|#[0-9]+|#x[0-9a-fA-F]+)(;)" + scope: constant.character.entity.nant + captures: + 1: punctuation.definition.constant.nant + 3: punctuation.definition.constant.nant + - match: "&" + scope: invalid.illegal.bad-ampersand.nant diff --git a/assets/syntaxes/Packages/C#/C#.sublime-syntax b/assets/syntaxes/Packages/C#/C#.sublime-syntax new file mode 100644 index 000000000..ed494f8b2 --- /dev/null +++ b/assets/syntaxes/Packages/C#/C#.sublime-syntax @@ -0,0 +1,2119 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +# Copyright (c) 2016 Sublime Text HQ Pty, @gwenzek, +# Matthew Winter @wintermi, Adam Lickel @lickel +# MIT license: https://opensource.org/licenses/mit-license.php + +name: C# +file_extensions: + - cs + - csx +scope: source.cs + +variables: + + bin_op: '(?:\+|->|-|\*|/|%|\|\||&&|\||&|\^|<<|>>|=>|<=|<|>=|>|==|!=|\?\?)' + unary_op: '(?:\+\+|--|-|~|!|&|\*)' + + # numbers + dec_digits: (?:[\d_]*\d) + dec_exponent: (?:[eE][-+]??{{dec_digits}}) + float_suffix: '[fFdDmM]' + integer_suffix: '[uU][lL]?|[lL][uU]?' + + # characters + unicode_char: '(?:\\u\h{4}|\\U\h{8})' + escaped_char: '(?:\\[abfnrtv"''\\]|{{unicode_char}}|\\x[0-9a-fA-F]{1,4}|\\[0-9]{1,3})' + + visibility: \b(?:public|private|protected|internal|protected\s+internal)\b + base_type: (?:(?:bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|short|ushort|object|string|void)\b) + type_suffix: (?:\s*(?:\[,*\]|\*|\?)*) + generic_declaration: \s*(<[^(={};<]*>)?\s* + + brackets_capture: '((\[)(,*)(\]))' + type_suffix_capture: '(\?)?{{brackets_capture}}?(?:\s*(\*))?' + + reserved: '(?:abstract|as|base|break|case|catch|checked|class|const|continue|default|delegate|do|else|enum|event|explicit|extern|finally|fixed|for|foreach|goto|if|implicit|in|interface|internal|is|lock|nameof|namespace|new|null|operator|out|override|params|private|protected|public|readonly|ref|return|sealed|sizeof|stackalloc|static|string|struct|switch|this|throw|try|typeof|unchecked|unsafe|using|virtual|volatile|while)' + name: '(?:@{{reserved}}|@{{base_type}}|@var|@?{{name_normal}})' + namespaced_name: (?:(?:{{name}}{{generic_declaration}}\s*\.\s*)*{{name}}{{generic_declaration}}) + + start_char: '(?:{{unicode_char}}|[_\p{L}])' + other_char: '(?:{{unicode_char}}|[_0-9\p{L}])' + name_normal: '{{start_char}}{{other_char}}*\b' + cap_name: '(\p{Lu}{{other_char}})' + +contexts: + prototype: + - include: comments + - match: '^\s*((#)\s*)' + captures: + 1: keyword.other.preprocessor.cs + 2: punctuation.definition.preprocessor.cs + push: preprocessor_option + + # comments + comments: + - match: '^\s*(///)' + captures: + 1: comment.block.documentation.cs punctuation.definition.comment.documentation.cs + push: documentation + - match: '//' + scope: punctuation.definition.comment.cs + push: + - meta_scope: comment.line.double-slash.cs + - match: $\n? + pop: true + - include: comments_in + - match: '/\*' + scope: punctuation.definition.comment.begin.cs + push: + - meta_scope: comment.block.cs + - match: '\*/' + scope: punctuation.definition.comment.end.cs + pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.cs + - include: comments_in + + comments_in: + - match: \b(?i:todo|hack|xxx)\b + scope: comment.line.todo.cs + - match: '/!\\' + scope: comment.line.todo.cs + - match: \b(https?://\S*)\b + scope: markup.underline.link.cs + + preprocessor_option: + - meta_scope: meta.preprocessor.cs + - match: '\b(define|undef)\s+({{name}})\b' + captures: + 1: keyword.control.preprocessor.cs + 2: entity.name.constant.cs + - match: '\b(el)?if\b' + scope: keyword.control.preprocessor.cs + push: + - match: '\(|\)' + scope: punctuation.section.parens.cs + - match: '&&|\|\||!' + scope: keyword.operator.logical.cs + - match: '\b(true|false)\b' + scope: constant.language.cs + - match: '{{name}}' + scope: constant.other.flag.cs + - include: option_done + - match: '\b(else|endif)\b' + scope: keyword.control.preprocessor.cs + push: option_done + # error, warning, region and endregion may be followed by any text. + # Comments doesn't apply in this case, see ECMA C# specification. + - match: '\b(error|warning)\b\s*(.*)' + captures: + 1: keyword.other.preprocessor.cs + 2: string.unquoted.cs + - match: '\b(region)\b\s*(.*)' + captures: + 1: keyword.other.preprocessor.cs + 2: entity.name.section.cs + - match: '\b(endregion)\b\s*(.*)' + captures: + 1: keyword.other.preprocessor.cs + 2: variable.other.section.cs + + - match: '\b(line)\s+(default|hidden)\b' + captures: + 1: keyword.other.preprocessor.cs + 2: keyword.other.preprocessor.cs + push: option_done + - match: '\b(line)\s+(\d*)\s+((").*("))?' + captures: + 1: keyword.other.preprocessor.cs + 2: constant.numeric.integer.decimal.cs + 3: string.quoted.double.cs + 4: punctuation.definition.string.begin.cs + 5: punctuation.definition.string.end.cs + push: option_done + - match: '\b(pragma)\s+(checksum)\s+' + captures: + 1: keyword.other.preprocessor.cs + 2: keyword.other.preprocessor.cs + push: + - match: '"{' + scope: punctuation.definition.string.begin.cs + push: + - meta_scope: string.quoted.double.hash.cs + - match: '[-\h]+' + scope: constant.numeric.integer.hexadecimal.cs + - match: '}"' + scope: punctuation.definition.string.end.cs + pop: true + - match: \. + scope: invalid.illegal.cs + pop: true + - match: '"' + scope: punctuation.definition.string.begin.cs + push: string + - include: option_done + + - match: '(pragma)\s+(warning)\b' + captures: + 1: keyword.other.preprocessor.cs + 2: keyword.other.preprocessor.cs + push: + - match: \b(disable|restore)\b(?:\s+([\p{L}_-]+))? + captures: + 1: keyword.other.preprocessor.cs + 2: string.unquoted.warning.cs + - include: comments + - match: $ + pop: true + - match: .* + scope: invalid.illegal.cs + - match: $ + pop: true + + # Pops out at the end of the line and handles comments. + # Marks the rest of the line as invalid. + option_done: + - include: comments + - match: $ + pop: true + - match: \S + scope: invalid.illegal.cs + + main: + - include: stray_close_bracket + - match: '\{' + scope: punctuation.section.block.begin.cs + push: + - meta_scope: meta.block.cs + - match: '\}' + scope: punctuation.section.block.end.cs + pop: true + - include: main + - include: attribute + - include: using + - include: class_declaration + - include: interface_declaration + - include: namespace_declaration + - include: delegate_declaration + # allows coloration of code outside a class + - match: (?=\S) + push: + - match: (?={{visibility}}|\b(?:class|delegate|interface|namespace|readonly)\b) + pop: true + - include: line_of_code + + stray_close_bracket: + - match: '[})\]]' + scope: invalid.illegal.stray.brace.cs + + using: + - match: '\b(using)\s+(?={{name}}\s*=\s*)' + captures: + 1: keyword.control.import.cs + 2: meta.path.cs + 3: keyword.operator.assignment.cs + push: using_namespace + - match: '\b(using)(?!\s*\()(?:\s+(static))?\b' + captures: + 1: keyword.control.import.cs + 2: keyword.control.import.cs + 3: meta.path.cs + push: using_namespace + + namespace_alias: + - match: '(?:(global)|({{name}}))\s*(::)' + captures: + 1: support.namespace.cs + 2: variable.other.namespace.cs + 3: punctuation.accessor.double-colon.namespace.cs + + using_namespace: + - include: namespace_alias + - match: '{{name}}' + scope: meta.path.cs + - match: '=' + scope: keyword.operator.assignment.cs + - match: \. + scope: punctuation.separator.namespace.cs + - match: '<' + scope: meta.generic.cs punctuation.definition.generic.begin.cs + push: type_argument + - match: ';' + scope: punctuation.terminator.cs + pop: true + - match: '[^\s;]+' + scope: invalid.illegal.expected-namespace.cs + - match: '$' + pop: true + + namespace_declaration: + # package declaration + - match: '\b(namespace)\b' + scope: storage.type.namespace.cs + push: + - meta_scope: meta.namespace.cs + - match: '(?={{name}})' + push: + - meta_content_scope: entity.name.namespace.cs + - match: '{{name}}' + - match: \. + scope: punctuation.separator.namespace.cs + - match: '' + pop: true + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.namespace.cs meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: main + - match: (?=\S) + pop: true + + class_declaration: + - match: '\b(static|unsafe|abstract|partial|sealed)\b' + scope: storage.modifier.cs + - match: '{{visibility}}' + scope: storage.modifier.access.cs + - match: '\b(class)\s+({{name}})' + captures: + 1: storage.type.class.cs + 2: entity.name.class.cs + push: [class_signature, data_type_signature] + - match: '(?:\b(readonly)\s+)?(?:\b(ref)\s+)?\b(struct)\s+({{name}})' + captures: + 1: storage.modifier.cs + 2: storage.modifier.cs + 3: storage.type.struct.cs + 4: entity.name.struct.cs + push: [struct_signature, data_type_signature] + - match: '\b(enum)\s+({{name}})\s*(?:(:)\s*(byte|sbyte|short|ushort|int|uint|long|ulong))?' + scope: meta.enum.cs + captures: + 1: storage.type.enum.cs + 2: entity.name.enum.cs + 3: punctuation.separator.key-value.type.cs + 4: storage.type.cs + push: + - meta_content_scope: meta.enum.cs + - match: (?=\{) + set: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.enum.body.cs meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + set: + - match: ';' + scope: punctuation.terminator.statement.cs + pop: true + - match: '(?=\S)' + pop: true + - include: attribute + - match: '{{name}}' + scope: constant.other.enum.cs + - match: '=' + scope: keyword.operator.assignment.cs + push: line_of_code_in + - match: ',' + scope: punctuation.separator.enum.cs + + interface_declaration: + - match: '(interface)\s+({{name}})' + captures: + 1: storage.type.interface.cs + 2: entity.name.interface.cs + push: [interface_signature, data_type_signature] + + delegate_declaration: + - match: \b(delegate)\b\s+ + captures: + 1: storage.type.delegate.cs + push: delegate_type + + delegate_type: + - meta_scope: meta.delegate.cs + - match: \s + set: delegate_name + - include: type + + delegate_name: + - match: '\s+' + scope: meta.delegate.cs + - match: '({{name}})(\s*)(<)' + captures: + 1: meta.delegate.cs variable.other.member.delegate.cs + 2: meta.delegate.cs + 3: meta.delegate.cs meta.generic.cs punctuation.definition.generic.begin.cs + set: + - meta_content_scope: meta.delegate.cs meta.generic.cs + - match: '>' + scope: meta.delegate.cs meta.generic.cs punctuation.definition.generic.end.cs + set: + - match: '\s+' + scope: meta.delegate.cs + - match: \( + scope: meta.delegate.parameters.cs punctuation.section.parameters.begin.cs + set: delegate_params + - include: type_parameter + - match: '({{name}})(\s*)(\()' + captures: + 1: meta.delegate.cs variable.other.member.delegate.cs + 2: meta.delegate.cs + 3: meta.delegate.parameters.cs punctuation.section.parameters.begin.cs + set: delegate_params + - match: '(?=\S)' + pop: true + + delegate_params: + - meta_content_scope: meta.delegate.parameters.cs + - match: \) + scope: punctuation.section.parameters.end.cs + set: delegate_end + - match: (?=\S) + push: [method_param, method_param_type] + + delegate_end: + - match: ';' + scope: punctuation.terminator.cs + pop: true + - match: (\s+(?=\S)|\S) + scope: invalid.illegal.expected.colon + pop: true + + struct_signature: + - meta_scope: meta.struct.cs + - match: '' + set: [struct_body, data_type_body] + + class_signature: + - meta_scope: meta.class.cs + - match: '' + set: [class_body, data_type_body] + + interface_signature: + - meta_scope: meta.interface.cs + - match: '' + set: [interface_body, data_type_body] + + struct_body: + - meta_content_scope: meta.struct.body.cs + - match: '' + pop: true + + class_body: + - meta_content_scope: meta.class.body.cs + - match: '' + pop: true + + interface_body: + - meta_content_scope: meta.interface.body.cs + - match: '' + pop: true + + data_type_body: + - match: \{ + scope: punctuation.section.block.begin.cs + push: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: attribute + - include: class_declaration + - include: interface_declaration + - include: delegate_declaration + - include: method_declaration + - include: stray_close_bracket + - match: \S* + scope: invalid.illegal + pop: true + + data_type_signature: + - match: '<' + scope: meta.generic.cs punctuation.definition.generic.begin.cs + push: + - meta_content_scope: meta.generic.cs + - include: type_parameter + - match: ':' + scope: punctuation.separator.type.cs + set: type_constraint + - match: (?=where\b) + set: type_constraint + - match: (?=\{) + pop: true + + type_constraint: + - include: type_constraint_common + - match: '{{name}}' + scope: entity.other.inherited-class.cs + - include: type + + type_constraint_common: + - match: (?=\{) + pop: true + - match: '\b(where)\s+(?:({{base_type}})|({{name}}))\s*(:)' + captures: + 1: storage.modifier.cs + 2: storage.type.cs + 3: support.type.cs + 4: punctuation.separator.type.cs + - match: '(?:(global)|({{name}}))\s*(::)' + captures: + 1: support.namespace.cs + 2: meta.path.cs + 3: punctuation.accessor.double-colon.namespace.cs + - match: '(class|struct|interface)' + scope: storage.type.cs + - match: 'new\s*\(\s*\)' + scope: keyword.operator.new.cs + - match: '{{base_type}}' + scope: storage.type.cs + - match: '({{name}})?(\.)' + captures: + 1: meta.path.cs + 2: punctuation.accessor.dot.namespace.cs + - match: ',' + scope: punctuation.separator.inherited-class.cs + + event_handler_declaration: + - match: '({{name}})(\.)' + captures: + 1: entity.other.inherited-class.cs + 2: punctuation.accessor.dot.cs + - match: '{{name}}' + scope: variable.other.member.cs + set: + - match: ';' + scope: punctuation.terminator.statement.cs + pop: true + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - match: \b(add)\b + scope: storage.type.function.accessor.add.cs + push: method_body + - match: \b(remove)\b + scope: storage.type.function.accessor.remove.cs + push: method_body + - match: (?=\S) + pop: true + - match: (?=\S) + pop: true + + method_declaration: + - match: '\b(abstract|async|const|extern|new|override|readonly|ref|sealed|static|unsafe|virtual|volatile)\b' + scope: storage.modifier.cs + - match: \b(event)\b\s* + captures: + 1: storage.modifier.cs + push: [event_handler_declaration, type_no_space] + - match: \bdelegate\b + scope: storage.type.delegate.cs + - match: '\b(implicit|explicit)\b' + scope: storage.modifier.cs + - match: '{{visibility}}' + scope: storage.modifier.access.cs + - match: '({{name}})\s*(<)' + captures: + 1: support.type.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + push: [method_name, type_argument] + - match: '(~{{name}})(\s*)(\()' + captures: + 1: meta.method.cs entity.name.function.destructor.cs + 2: meta.method.cs + 3: meta.method.parameters.cs punctuation.section.parameters.begin.cs + push: [constructor_prebody, method_params] + - match: '({{name}})\s*(\()' + captures: + 1: entity.name.function.constructor.cs + 2: meta.method.parameters.cs punctuation.section.parameters.begin.cs + push: [constructor_prebody, method_params] + - match: '({{name}})\s*(\.)' + captures: + 1: entity.other.inherited-class.cs + 2: punctuation.accessor.dot.cs + - match: \b(?:({{base_type}})|({{name}})) + captures: + 1: storage.type.cs + 2: support.type.cs + push: + - match: '{{type_suffix_capture}}' + captures: + 1: storage.type.nullable.cs + 2: meta.brackets.cs + 3: punctuation.section.brackets.begin.cs + 4: punctuation.separator.cs + 5: punctuation.section.brackets.end.cs + 6: keyword.operator.pointer.cs + - match: '' + set: method_name + - match: '\b(operator)\b' + scope: storage.modifier.cs + push: method_name + - match: (?=\() + push: [method_name, type_tuple] + + method_name: # also matches member variables + - match: '\.' + scope: punctuation.accessor.dot.cs + - match: '(operator)\s*({{unary_op}}|{{bin_op}})\s*(\()' + captures: + 1: storage.modifier.other.cs + 2: meta.method.cs entity.name.function.cs + 3: meta.method.parameters.cs punctuation.section.parameters.begin.cs + set: [method_body_transition, method_params] + - match: '({{name}}\s*)?((=>)\s*)' + captures: + 1: variable.other.member.cs + 2: meta.method.cs + 3: storage.type.function.accessor.get.cs + set: + - meta_scope: meta.property.cs + - meta_content_scope: meta.method.cs + - include: line_of_code_in + - match: '({{name}})\s*(?==[^>])' + captures: + 1: variable.other.member.cs + set: member_variables_declaration + - match: '({{name}})?\s*(\()' + # here the name is optionnal since it may already have been match by + # '{{name}}\s*(<)' (see rule below) + captures: + 1: meta.method.cs entity.name.function.cs + 2: meta.method.parameters.cs punctuation.section.parameters.begin.cs + set: [method_body_transition, method_params] + - match: '({{name}})\s*(;)' + captures: + 1: variable.other.member.cs + 2: punctuation.terminator.statement.cs + pop: true + - match: '({{name}})\s*(<)(?=[^(]*>\.)' + scope: meta.method.cs + captures: + 1: entity.other.inherited-class.cs + 2: meta.generic.cs punctuation.section.generic.begin.cs + push: + - meta_content_scope: meta.method.cs meta.generic.cs + - match: '(>)\s*(\.)' + scope: meta.method.cs meta.generic.cs + captures: + 1: punctuation.definition.generic.end.cs + 2: punctuation.accessor.dot.cs + pop: true + - match: ',' + scope: punctuation.separator.parameter.type.cs + - include: type + - match: '({{name}})\s*(<)' + captures: + 1: entity.name.function.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + push: + - meta_scope: meta.method.cs + - meta_content_scope: meta.generic.cs + - include: type_parameter + - match: '(this)\s*(\[)' + captures: + 1: variable.language.cs + 2: meta.brackets.cs punctuation.section.brackets.begin.cs + set: [method_accessor, method_params_bracket] + - match: '({{name}})\s*(\.)' + scope: meta.method.cs + captures: + 1: entity.other.inherited-class.cs + 2: punctuation.accessor.dot.cs + - match: '{{name}}' + scope: meta.property.cs variable.other.member.cs + push: + - match: \s*(,) + captures: + 1: punctuation.separator.variables.cs + pop: true + - match: '' + pop: true + - match: '(?=\s*\{)' + set: method_accessor + + method_body_transition: + - match: '' + set: method_body + + method_params: + - meta_content_scope: meta.method.parameters.cs + - match: \) + scope: meta.method.parameters.cs punctuation.section.parameters.end.cs + pop: true + - match: (?=\S) + push: [method_param, method_param_type] + + method_params_bracket: + - meta_content_scope: meta.brackets.cs + - match: \] + scope: meta.brackets.cs punctuation.section.brackets.end.cs + pop: true + - match: (?=\S) + push: [method_param, method_param_type] + + method_param: + - match: '{{name}}' + scope: variable.parameter.cs + - match: '=' + scope: keyword.operator.assignment.default-value.cs + push: line_of_code_in + - match: ',' + scope: punctuation.separator.parameter.function.cs + pop: true + - match: (?=\}|\)|>|\]|;) + pop: true + + method_param_type: + - include: attribute + - match: (?=[^\s\[]) + set: + - match: '\s*\b(out|ref|this|params|in)\s+' + captures: + 1: storage.modifier.parameter.cs + - match: \s + pop: true + - include: type + - match: (?=\}|\)|>|\]|;) + pop: true + + constructor_prebody: + - meta_scope: meta.method.constructor.cs + - match: ':' + scope: meta.method.constructor.prebody.cs punctuation.separator.function.cs + set: + - match: \s+ + scope: meta.method.constructor.prebody.cs + - match: (this|base)\s*(\() + captures: + 1: variable.language.cs + 2: meta.group.cs punctuation.section.group.begin.cs + set: [constructor_initializer, arguments] + - match: '(?=\{)' + set: method_body + - match: '(?=\{|=>)' + set: method_body + + constructor_initializer: + - meta_scope: meta.method.constructor.prebody.cs + - meta_content_scope: meta.group.cs + - match: '\)' + scope: punctuation.section.group.end.cs + - match: '' + set: constructor_initializer_after + + constructor_initializer_after: + - meta_content_scope: meta.method.constructor.prebody.cs + - match: '(?=\{)' + set: method_body + - match: '(?=\S)' + pop: true + + method_body: + - meta_scope: meta.method.cs + - match: (?=where\b) + scope: storage.modifier.other.cs + push: type_constraint + - match: (=>) + scope: storage.type.function.cs + set: + - meta_content_scope: meta.method.cs + - include: line_of_code_in + - match: '(?=\{)' + set: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.method.body.cs meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: stray_close_bracket + - include: code_block_in + - match: ; + scope: punctuation.terminator.cs + pop: true + - match: \S+ + scope: invalid.illegal.cs + pop: true + + method_accessor: + - meta_scope: meta.property.cs + - match: \{ + scope: meta.block.cs punctuation.section.block.begin.cs + set: + - meta_content_scope: meta.property.cs meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + set: + - meta_content_scope: meta.property.cs + - match: = + scope: keyword.operator.assignment.cs + set: + - meta_content_scope: meta.property.cs + - include: line_of_code_in + - match: (?=\S) + pop: true + - match: \b(get)\b + scope: storage.type.function.accessor.get.cs + push: method_body + - match: \b(set)\b + scope: storage.type.function.accessor.set.cs + push: method_body + - match: '{{visibility}}' + scope: storage.modifier.access.cs + - include: attribute + - match: '=>' + scope: storage.type.function.cs + set: + - meta_content_scope: meta.method.cs + - include: line_of_code_in + - match: \S + scope: invalid.illegal.cs + pop: true + + attribute: + - match: (\[)\s*(assembly|module|field|event|method|param|property|return|type)\s*(:) + captures: + 1: punctuation.definition.annotation.begin.cs + 2: storage.modifier.target.cs + 3: punctuation.separator.key-value.cs + push: attribute_in + - match: \[ + scope: punctuation.definition.annotation.begin.cs + push: attribute_in + + attribute_in: + - meta_scope: meta.annotation.cs + - match: '({{name}})(\()' + captures: + 1: variable.annotation.cs + 2: meta.group.cs punctuation.section.group.begin.cs + set: [attribute_arguments, arguments] + - match: '({{name}})\s*(\.)' + captures: + 1: variable.other.namespace.cs + 2: punctuation.accessor.dot.namespace.cs + - match: '(?:(global)|({{name}}))\s*(::)' + captures: + 1: support.namespace.cs + 2: support.namespace.cs + 3: punctuation.accessor.double-colon.namespace.cs + - match: '{{name}}' + scope: variable.annotation.cs + - match: ',' + scope: punctuation.separator.annotation.cs + - match: \] + scope: punctuation.definition.annotation.end.cs + pop: true + + code_block_in: + - match: (?=\S) + push: line_of_code + + line_of_code: + # language keywords + - match: \b(if)\b + captures: + 1: keyword.control.conditional.if.cs + set: [else_block, if_block, if_condition] + - match: \b(switch)\b + captures: + 1: keyword.control.flow.switch.cs + set: [switch_block, if_condition] + - match: \b(for)\s*(\()(?=(?:{{name}}|var)\s(?!=)) + captures: + 1: keyword.control.loop.for.cs + 2: meta.group.cs punctuation.section.group.begin.cs + set: [for_block, line_of_code_in, line_of_code_in, for_var_assignment, var_declaration] + - match: \b(for)\s*(\() + captures: + 1: keyword.control.loop.for.cs + 2: meta.group.cs punctuation.section.group.begin.cs + set: [for_block, line_of_code_in, line_of_code_in, line_of_code_in_no_semicolon] + - match: \b(foreach)\s*(\() + captures: + 1: keyword.control.loop.foreach.cs + 2: meta.group.cs punctuation.section.group.begin.cs + set: [for_block, foreach_var_assignment, var_declaration] + - match: \b(try)\b + scope: keyword.control.trycatch.try.cs + set: [finally_block, catch_expr, try_block] + - match: \b(using)\s*(\() + captures: + 1: keyword.control.using.cs + 2: meta.group.cs punctuation.section.group.begin.cs + set: [using_block, line_of_code] + - match: \b(fixed)\s*(\() + captures: + 1: keyword.control.other.fixed.cs + 2: meta.group.cs punctuation.section.group.begin.cs + set: [expression_block, line_of_code] + - match: \b(lock)\s*(\() + captures: + 1: keyword.control.other.lock.cs + 2: meta.group.cs punctuation.section.group.begin.cs + set: [expression_block, line_of_code] + - match: \bdo\b + scope: keyword.control.loop.do.cs + set: [do_condition, while_block] + - match: \bwhile\b + scope: keyword.control.loop.while.cs + set: [while_block, while_condition] + - match: \b(else|case|catch|finally)\b + scope: keyword.control.cs invalid.illegal.unexpected.keyword.cs + - match: \b(return|yield\s+return)\b + scope: keyword.control.flow.return.cs + set: line_of_code_in + - match: \b(continue|break|yield\s+break)\b\s*(;)? + captures: + 1: keyword.control.flow.break.cs + 2: punctuation.terminator.statement.cs + pop: true + - match: \b(throw)\b + scope: keyword.control.trycatch.throw.cs + set: line_of_code_in + - match: \b(goto)\s+(case)\b + captures: + 1: keyword.control.flow.goto.cs + 2: keyword.control.switch.case.cs + set: line_of_code_in + - match: '\b(goto)\s+({{name}})\s*(;)' + captures: + 1: keyword.control.flow.goto.cs + 2: constant.other.label.cs + 3: punctuation.terminator.statement.cs + pop: true + - include: keywords + # C#7, nested method + - match: '(?=(?:\b(?:async|ref)\s+)?{{name}}(?:{{generic_declaration}})?{{type_suffix}}\s+{{name}}{{generic_declaration}}\()' + push: + - include: method_declaration + - match: '' + pop: true + - match: '({{name}})\s*(<)(?=([^(={};]*>){{type_suffix}}\s+{{name}}{{generic_declaration}}\()' + captures: + 1: support.type.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + push: [method_name, type_argument] + - match: '({{name}})\s*(<)(?=[^(={};]*>\()' + scope: meta.function-call.cs + captures: + 1: variable.function.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + push: + - meta_content_scope: meta.generic.cs + - match: ',' + scope: punctuation.separator.type.cs + - match: '>' + scope: meta.generic.cs punctuation.definition.generic.end.cs + pop: true + - include: type + - match: '({{name}})(<)' + captures: + 1: support.type.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + set: + - meta_content_scope: meta.generic.cs + - match: '>' + scope: meta.generic.cs punctuation.definition.generic.end.cs + set: + - match: \. + set: line_of_code + scope: punctuation.accessor.dot.namespace.cs + - match: \s+ + set: variables_declaration + - match: (?=\S) + set: line_of_code + - include: type_argument + - match: \bconst\b + scope: storage.modifier.cs + - match: '(var|dynamic)\s+({{reserved}}|{{base_type}})\s*(=)' + captures: + 1: storage.type.variable.cs + 2: invalid.illegal.cs + 3: keyword.operator.assignment.variable.cs + - match: '(var|dynamic)\s+({{name}})\s*(=)' + captures: + 1: storage.type.variable.cs + 2: variable.other.cs + 3: keyword.operator.assignment.variable.cs + set: line_of_code_in + - match: (?=var\s*\() + push: var_declaration + - include: lambdas + - match: (?:\b(ref)\s+)?\b(?={{namespaced_name}}{{type_suffix}}\s+{{name}}(?!\s*(?:[(:]))) + captures: + 1: storage.modifier.cs + set: [variables_declaration, type_no_space] + - match: '(?:\b(ref)\s+)?\b(?:({{base_type}})|({{name}}))(?={{type_suffix}}\s+{{name}}(?!\s*:))' # avoid picking up `test ? something : something_else` as a variable declaration of `something` with nullable type `test`. + captures: + 1: storage.modifier.cs + 2: storage.type.cs + 3: support.type.cs + set: [variables_declaration, type_no_space] + - match: '({{name}})\s*(:)(?!:)' + captures: + 1: entity.name.label.cs + 2: punctuation.separator.cs + pop: true + - include: namespace_alias + - match: '({{name}})\s+({{name}})' + captures: + 1: support.type.cs + 2: variable.other.cs + set: variables_declaration + - match: \. + scope: punctuation.accessor.dot.cs + - match: '(?=\S)' + set: line_of_code_in + + lambdas: + - match: ({{name}})\s+(=>)\s* + captures: + 1: variable.parameter.cs + 2: storage.type.function.lambda.cs + push: + - meta_scope: meta.function.anonymous.cs + - match: '(?=;)' + pop: true + - include: line_of_code_in + - match: \((?=[^()]*\)\s+=>) + scope: meta.function.anonymous.cs meta.group.cs punctuation.section.group.begin.cs + push: + - meta_content_scope: meta.function.anonymous.cs meta.group.cs + - match: '{{name}}(?=\s*[\),/])' + scope: variable.parameter.cs + - match: ',' + scope: punctuation.separator.parameter.function.cs + - match: (\))\s*(=>) + captures: + 1: meta.group.cs punctuation.section.group.end.cs + 2: storage.type.function.lambda.cs + set: + - meta_content_scope: meta.function.anonymous.cs + - match: '(?=;)' + pop: true + - include: line_of_code_in + + member_variables_declaration: + - match: '=' + scope: keyword.operator.assignment.variable.cs + push: + - match: (?=;|,) + pop: true + - include: line_of_code_in + - match: '(?=\{)' + push: method_accessor + - match: '{{name}}' + scope: variable.other.member.cs + - match: ',' + scope: punctuation.separator.variables.cs + - match: ';' + scope: punctuation.terminator.statement.cs + pop: true + - match: (?=\}|\)|>|\]) + pop: true + + variables_declaration: + - match: '=' + scope: keyword.operator.assignment.variable.cs + push: + - match: (?=;|,) + pop: true + - match: (?=\{) + push: + - match: (?=[^,\s{}]) + pop: true + - include: initializer_constructor + - include: line_of_code_in + - match: '{{name}}' + scope: variable.other.cs + - match: ',' + scope: punctuation.separator.variables.cs + - match: ';' + scope: punctuation.terminator.statement.cs + pop: true + - match: (?=\{|\}|\)|>|\]) + pop: true + + keywords: + - match: '\b(this|base)\s*(\[)' + captures: + 1: variable.language.cs + 2: meta.brackets.cs punctuation.section.brackets.begin.cs + push: accessor_arguments + - match: \b(this|base)\b + scope: variable.language.cs + - match: \b(await)\b + scope: keyword.control.other.cs + - match: \b(nameof)(\() + captures: + 1: keyword.other.cs + 2: meta.group.cs punctuation.section.group.begin.cs + push: + - meta_content_scope: meta.group.cs + - match: \) + scope: meta.group.cs punctuation.section.group.end.cs + pop: true + - match: '({{base_type}})\b' + scope: storage.type.cs + # We don't if these are types of variables, so we guess that + # uppercase names are types, and others are variables + - match: '(?=\p{Ll}){{name}}(?=\s*\))' + scope: variable.other.cs + - include: type + - match: \b(typeof|default)(\() + captures: + 1: keyword.operator.reflection.cs + 2: meta.group.cs punctuation.section.group.begin.cs + push: + - meta_content_scope: meta.group.cs + - match: \) + scope: meta.group.cs punctuation.section.group.end.cs + pop: true + - include: type + - match: '\b(as|is)\s+' + captures: + 1: keyword.operator.reflection.cs + push: type_no_space + - match: \b(checked|unchecked)\b + scope: keyword.other.cs + push: + - match: \( + scope: punctuation.section.group.begin.cs + set: + - meta_scope: meta.group.cs + - match: \) + scope: punctuation.section.group.end.cs + pop: true + - include: line_of_code_in + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: code_block_in + - match: \S + scope: invalid.illegal.expected.block.cs + - match: \b(unsafe)\b + scope: keyword.other.cs + push: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: code_block_in + - match: \S + scope: invalid.illegal.expected.block.cs + - match: \b(new)\b + scope: meta.instance.cs keyword.operator.new.cs + push: maybe_an_anonymous_class + - match: '{{visibility}}' + scope: storage.modifier.access.cs + + maybe_an_anonymous_class: + - meta_content_scope: meta.instance.cs + - match: \{ + scope: punctuation.section.block.begin.cs + # Found an anounymous class + set: + - meta_scope: meta.instance.cs meta.class.body.anonymous.cs meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - match: ',' + scope: punctuation.separator.class.cs + - match: '({{name}})\s*(=)' + captures: + 1: variable.other.member.cs + 2: keyword.operator.assignment.cs + push: line_of_code_in + - match: (?=\S) + push: line_of_code_in + - match: (?=[^{\s]) + # This is not an anounymous class + set: + - meta_content_scope: meta.instance.cs + - match: '{{brackets_capture}}' + captures: + 1: meta.brackets.cs + 2: punctuation.section.brackets.begin.cs + 3: punctuation.separator.cs + 4: punctuation.section.brackets.end.cs + - match: \[ + scope: punctuation.section.brackets.begin.cs + push: + - meta_scope: meta.brackets.cs + - match: ',' + scope: punctuation.separator.argument.cs + push: line_of_code_in + - match: \] + scope: punctuation.section.brackets.end.cs + pop: true + - match: '(?=\S)' + push: line_of_code_in + - match: (?:\s*((\()\s*(\)))\s*)?(\{) + scope: meta.instance.cs + captures: + 1: meta.group.cs + 2: punctuation.section.group.begin.cs + 3: punctuation.section.group.end.cs + 4: meta.braces.cs punctuation.section.braces.begin.cs + set: initializer_constructor + - match: \( + scope: meta.group.cs punctuation.section.group.begin.cs + set: [constructor_arguments, arguments] + - include: type + + line_of_code_in: + - include: line_of_code_in_no_semicolon + - match: ';' + scope: punctuation.terminator.statement.cs + pop: true + + line_of_code_in_no_semicolon: + - match: \b(value)\b + scope: variable.language.cs + - include: keywords + # Cannot neg-ahead "(" because clauses can follow several of the sql words + - match: \b(let|select|equals|from|in|where|join|orderby|group|by|on|into|into|ascending|descending)\b(?!\s*[.,;+=&\|\[\]\)]) + scope: keyword.other.sql.cs + - match: \?\. + scope: punctuation.accessor.null-coalescing.cs + - match: \. + scope: punctuation.accessor.dot.cs + # Match this before {{bin_op}} to scope specially in the generic context + - match: '->' + scope: punctuation.accessor.arrow.cs + - match: '{{bin_op}}=' + scope: keyword.operator.cs + - match: '{{bin_op}}|{{unary_op}}' + scope: keyword.operator.cs + - match: '=' + scope: keyword.operator.assignment.cs + - include: literals + # interpolated strings + - match: '\$"' + scope: punctuation.definition.string.begin.cs + push: format_string + # multi-line strings + - match: '@"' + scope: punctuation.definition.string.begin.cs + push: long_string + # interpolated multi-line strings + - match: '(@\$|\$@)"' + scope: punctuation.definition.string.begin.cs + push: long_format_string + - match: '({{name}})(<)(?=[^(]*>\s*\()' + captures: + 1: variable.function.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + push: + - meta_scope: meta.function-call.cs + - meta_content_scope: meta.generic.cs + - match: ',' + scope: punctuation.separator.type.cs + - match: '(>)\s*(\()' + scope: meta.function-call.cs + captures: + 1: meta.generic.cs punctuation.definition.generic.end.cs + 2: meta.group.cs punctuation.section.group.begin.cs + set: [function_call_arguments, arguments] + - include: type + - match: ({{name}})(<)(?={{namespaced_name}}>\s*\.) + captures: + 1: support.type.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + push: + - meta_content_scope: meta.generic.cs + - match: ',' + scope: punctuation.separator.type.cs + - match: '>' + scope: meta.generic.cs punctuation.definition.generic.end.cs + pop: true + - include: type + - match: '((?!{{reserved}}\b){{name}})\s*(\()' + scope: meta.function-call.cs + captures: + 1: variable.function.cs + 2: meta.group.cs punctuation.section.group.begin.cs + push: [function_call_arguments, arguments] + - match: '({{name}})\s*(\??\[)' + captures: + 1: variable.other.cs + 2: meta.brackets.cs punctuation.section.brackets.begin.cs + push: accessor_arguments + - include: lambdas + - match: '\s*(\??\[)' + captures: + 1: meta.brackets.cs punctuation.section.brackets.begin.cs + push: accessor_arguments + - match: '({{base_type}})\b' + scope: storage.type.cs + - match: '({{reserved}})\b' + scope: keyword.other.cs + - match: '(?:(global)|({{name}}))\s*(::)' + captures: + 1: support.namespace.cs + 2: support.namespace.cs + 3: punctuation.accessor.double-colon.namespace.cs + - match: '{{name}}' + scope: variable.other.cs + - match: '@' + scope: invalid.illegal.reserved-char.cs + - match: \? + scope: keyword.operator.ternary.cs + push: + - match: ':' + scope: keyword.operator.ternary.cs + pop: true + - include: line_of_code_in + - match: '(\()\s*(\*)\s*({{name}})\s*(\))' + captures: + 1: punctuation.section.group.begin.cs + 2: keyword.operator.pointer.cs + 3: variable.other.cs + 4: punctuation.section.group.end.cs + - match: '(\()(?={{namespaced_name}}\s*\))' + captures: + 1: punctuation.section.group.begin.cs + push: + - meta_scope: meta.cast.cs + - match: \) + scope: punctuation.section.group.end.cs + pop: true + - match: '{{base_type}}' + scope: storage.type.cs + - match: '{{name}}' + scope: support.type.cs + - match: '\.' + scope: punctuation.separator.namespace.cs + - match: '{{type_suffix_capture}}' + captures: + 1: punctuation.section.brackets.begin.cs + 2: punctuation.separator.cs + 3: punctuation.section.brackets.end.cs + 4: keyword.operator.pointer.cs + - match: \((?=(?:[^,)(]*|\([^\)]*\))*,) + scope: punctuation.section.group.begin.cs + push: + - meta_scope: meta.group.tuple.cs + - match: \) + scope: punctuation.section.group.end.cs + pop: true + - match: ',' + scope: punctuation.separator.tuple.cs + - match: ':' + scope: keyword.operator.assignment.cs + - match: _\b + scope: variable.language.deconstruction.discard.cs + - match: (?!{{reserved}})(?={{namespaced_name}}{{type_suffix}}\s+{{name}}\s*[:,]) + push: var_declaration_explicit + - match: '({{name}})(<)' + captures: + 1: support.type.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + push: + - meta_content_scope: meta.generic.cs + - match: ',' + scope: punctuation.separator.type.cs + - match: '>' + scope: meta.generic.cs punctuation.definition.generic.end.cs + pop: true + - include: type + - include: line_of_code_in_no_semicolon + - match: \( + scope: punctuation.section.group.begin.cs + push: + - meta_scope: meta.group.cs + - match: \) + scope: punctuation.section.group.end.cs + pop: true + - include: lambdas + - include: line_of_code_in_no_semicolon + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: code_block_in + - match: (?=\}|\)|>|\]|,|{{reserved}}) + pop: true + + attribute_arguments: + - meta_content_scope: meta.annotation.cs meta.group.cs + - match: '' + set: attribute_in + + constructor_arguments: + - meta_content_scope: meta.instance.cs meta.group.cs + - match: '(?=[^\s{])' + pop: true + - match: '\{' + scope: punctuation.section.braces.begin.cs + set: initializer_constructor + + function_call_arguments: + - meta_content_scope: meta.function-call.cs meta.group.cs + - match: '' + pop: true + + arguments: + - match: (out)\s + captures: + 1: storage.modifier.argument.cs + push: + - match: (ref)\s + captures: + 1: storage.modifier.argument.cs + - match: (?!{{namespaced_name}}{{type_suffix}}\s+{{name}}) + pop: true + - include: var_declaration + - match: (ref)\s + captures: + 1: storage.modifier.argument.cs + - match: '({{name}})\s*(=)(?=[^>=])' + captures: + 1: variable.parameter.cs + 2: keyword.operator.assignment.cs + push: line_of_code_in + - match: '({{name}})\s*(:)' + captures: + 1: variable.parameter.cs + 2: punctuation.separator.argument.value.cs + push: line_of_code_in + - match: ',' + scope: punctuation.separator.argument.cs + - match: \) + scope: punctuation.section.group.end.cs + pop: true + - match: ; + scope: invalid.illegal.expected-close-paren.cs + pop: true + - include: stray_close_bracket + - match: '(?=\S)' + push: + - include: line_of_code_in_no_semicolon + - match: (?=;) + pop: true + + accessor_arguments: + - meta_content_scope: meta.brackets.cs + - match: '({{name}})\s*(:)' + captures: + 1: variable.other.parameter.cs + 2: punctuation.separator.key-value.parameter.cs + - match: ',' + scope: punctuation.separator.accessor.cs + - match: \] + scope: meta.brackets.cs punctuation.section.brackets.end.cs + pop: true + - include: line_of_code_in + + type: + - include: type_common + - match: (?=\() + push: type_tuple + + type_tuple: + - match: \( + scope: punctuation.section.group.begin.cs + set: + - meta_scope: meta.group.tuple.cs + - match: (\)) + captures: + 1: punctuation.section.group.end.cs + pop: true + - match: ',' + scope: punctuation.separator.tuple.cs + - match: (?=\S) + push: var_declaration_explicit + + type_common: + - include: namespace_alias + - match: '(class|struct|enum)' + scope: storage.type.other.cs + - match: 'new\s*\(\s*\)' + scope: keyword.operator.new.cs + - match: '{{base_type}}' + scope: storage.type.cs + - match: '{{brackets_capture}}' + captures: + 1: meta.brackets.cs + 2: punctuation.section.brackets.begin.cs + 3: punctuation.separator.cs + 4: punctuation.section.brackets.end.cs + - match: \s*(\.)\s* + captures: + 1: punctuation.accessor.dot.namespace.cs + - match: '\*' + scope: keyword.operator.pointer.cs + - match: \s*(\?) + captures: + 1: storage.type.nullable.cs + - match: \s*(<) + captures: + 1: meta.generic.cs punctuation.definition.generic.begin.cs + push: type_argument + - match: '{{name}}' + scope: support.type.cs + - match: '[{:]' + scope: invalid.illegal + pop: true + - match: (?=\}|\)|>|\]|,|;|>|=>) + pop: true + + type_arg_param_common: + - match: ',' + scope: punctuation.separator.type.cs + - match: '(>){{type_suffix_capture}}' + captures: + 1: meta.generic.cs punctuation.definition.generic.end.cs + 2: storage.type.nullable.cs + 3: meta.brackets.cs + 4: punctuation.section.brackets.begin.cs + 5: punctuation.separator.cs + 6: punctuation.section.brackets.end.cs + 7: keyword.operator.pointer.cs + pop: true + - include: type + + type_argument: + - meta_content_scope: meta.generic.cs + - include: type_arg_param_common + + type_parameter: + - match: '(in|out)\b' + scope: storage.modifier.cs + - include: type_arg_param_common + - match: '{{name}}' + scope: support.type.cs + + type_no_space: + - include: type + - match: \s + pop: true + + # bools, numbers, chars, simple strings + literals: + # language constants + - match: \b(true|false|null)\b + scope: constant.language.cs + # characters + - match: '''\''' + scope: invalid.illegal.lone-escape.cs + - match: (')({{escaped_char}})(') + scope: constant.character.cs + captures: + 2: constant.character.escape.cs + - match: (').(') + scope: constant.character.cs + - match: (')[^']+(') + scope: invalid.illegal.not_a_char.cs + # numbers + - match: (0[xX])[\h_]*\h + scope: constant.numeric.integer.hexadecimal.cs + captures: + 1: punctuation.definition.numeric.base.cs + - match: (0[bB])[01_]*[01] + scope: constant.numeric.integer.binary.cs + captures: + 1: punctuation.definition.numeric.base.cs + - match: '{{dec_digits}}(?:(?:(?:(\.){{dec_digits}}){{dec_exponent}}?|{{dec_exponent}})({{float_suffix}})?|({{float_suffix}}))' + scope: constant.numeric.float.decimal.cs + captures: + 1: punctuation.separator.decimal.cs + 2: storage.type.numeric.cs + 3: storage.type.numeric.cs + - match: (?:0|[1-9]{{dec_digits}}?)({{integer_suffix}})? + scope: constant.numeric.integer.decimal.cs + captures: + 1: storage.type.numeric.cs + # strings + - match: '"' + scope: punctuation.definition.string.begin.cs + push: string + + string: + - meta_include_prototype: false + - meta_scope: string.quoted.double.cs + - include: string_escaped + - match: '"' + scope: punctuation.definition.string.end.cs + pop: true + - include: string_placeholders + - match: '(\{)(\d+)' + captures: + 1: punctuation.definition.placeholder.begin.cs + 2: constant.numeric.integer.decimal.cs + push: string_placeholder + - match: $\n? + scope: invalid.illegal.unclosed-string.cs + pop: true + + format_string: + - meta_include_prototype: false + - meta_scope: meta.string.interpolated.cs string.quoted.double.cs + - match: '"' + scope: punctuation.definition.string.end.cs + pop: true + - include: string_escaped + - include: string_placeholder_escape + - match: \{ + scope: punctuation.section.interpolation.begin.cs + push: + - meta_scope: meta.string.interpolated.cs + - meta_content_scope: source.cs + - clear_scopes: 2 + - match: $ + pop: true + - include: string_placeholder_format + - include: string_interpolation + - match: $\n? + scope: invalid.illegal.unclosed-string.cs + pop: true + + long_format_string: + - meta_include_prototype: false + - meta_scope: meta.string.interpolated.cs string.quoted.double.raw.cs + - include: long_string_escaped + - match: '"' + scope: punctuation.definition.string.end.cs + pop: true + - include: string_placeholder_escape + - match: \{ + scope: punctuation.section.interpolation.begin.cs + push: + - meta_scope: meta.string.interpolated.cs + - meta_content_scope: source.cs + - clear_scopes: 2 + - include: long_string_placeholder_format + - include: string_interpolation + + string_placeholder_escape: + - match: '\{\{|\}\}' + scope: constant.character.escape.cs + + string_placeholders: + - include: string_placeholder_escape + - match: \{\h{8}-(?:\h{4}-){3}\h{12}\} + scope: constant.other.guid.cs + - match: '(\{)(\d+)(?=")' + scope: constant.other.placeholder.cs + captures: + 1: punctuation.definition.placeholder.begin.cs + 2: constant.numeric.integer.decimal.cs invalid.illegal.unclosed-string-placeholder.cs + + inside_string_placeholder: + - match: '(\})(\}(?!\}))?' + captures: + 1: punctuation.definition.placeholder.end.cs + 2: invalid.illegal.unescaped-placeholder.cs + pop: true + - match: (?=[}"]) + pop: true + + string_placeholder: + - meta_scope: constant.other.placeholder.cs + - include: inside_string_placeholder + - include: string_placeholder_format + - match: '[^"}]+' + scope: invalid.illegal.unexpected-character-in-placeholder.cs + + long_string_placeholder: + - meta_scope: constant.other.placeholder.cs + - include: inside_string_placeholder + - include: long_string_placeholder_format + - match: '[^"}]+' + scope: invalid.illegal.unexpected-character-in-placeholder.cs + + string_placeholder_format: + - match: '\s*(?:(,)\s*(-?\d+)\s*)?' + captures: + 1: punctuation.separator.arguments.cs + 2: constant.numeric.integer.decimal.formatting.cs + - match: ':(?=")' + scope: invalid.illegal.unclosed-string-placeholder.cs + pop: true + - match: ':' + scope: punctuation.separator.cs + push: + - meta_scope: constant.other.format-spec.cs + - include: string_placeholder_escape + - include: string_escaped + - match: '(?=\})' + pop: true + - match: '([^}"\\]+(\\.)*)+(?=")' + scope: invalid.illegal.unclosed-string-placeholder.cs + pop: true + - match: '\{' + scope: invalid.illegal.unescaped-placeholder.cs + + long_string_placeholder_format: + - match: '\s*(?:(,)\s*(-?\d+)\s*)?' + captures: + 1: punctuation.separator.arguments.cs + 2: constant.numeric.integer.decimal.formatting.cs + - match: ':(?="(?!"))' + scope: invalid.illegal.unclosed-string-placeholder.cs + pop: true + - match: ':' + scope: punctuation.separator.cs + push: + - meta_scope: constant.other.format-spec.cs + - include: string_placeholder_escape + - include: long_string_escaped + - match: (?=\}) + pop: true + - match: \\(?:""|[^"]) + scope: constant.character.escape.cs + - match: (?:[^}"]+|"")+(?="(?!")) + scope: invalid.illegal.unclosed-string-placeholder.cs + pop: true + - match: \{ + scope: invalid.illegal.unescaped-placeholder.cs + + string_interpolation: + - match: '\}' + scope: punctuation.section.interpolation.end.cs + pop: true + - include: line_of_code_in + + long_string: + - meta_include_prototype: false + - meta_scope: string.quoted.double.raw.cs + - include: long_string_escaped + - include: string_placeholders + - match: '(\{)(\d+)' + captures: + 1: punctuation.definition.placeholder.begin.cs + 2: constant.numeric.integer.decimal.cs + push: long_string_placeholder + - match: '"' + scope: punctuation.definition.string.end.cs + pop: true + + escaped: + - match: '{{escaped_char}}' + scope: constant.character.escape.cs + + string_escaped: + - include: escaped + - match: \\ + scope: invalid.illegal.lone-escape.cs + + long_string_escaped: + - match: '""' + scope: constant.character.escape.cs + + initializer_constructor: + - meta_content_scope: meta.instance.cs meta.braces.cs + - match: \} + scope: meta.instance.cs meta.braces.cs punctuation.section.braces.end.cs + pop: true + - match: \{ + scope: punctuation.section.braces.begin.cs + push: initializer_constructor + - match: ',' + scope: punctuation.separator.array-element.cs + - match: (?=[^,\s{}]) + push: line_of_code_in + + try_block: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: main + - match: (?=\S) + set: + - match: \s*$ + pop: true + - include: main + + catch_expr: + - match: '(catch)\s*(\()' + captures: + 1: keyword.control.trycatch.catch.cs + 2: meta.group.cs punctuation.section.group.begin.cs + push: [catch_block, var_declaration_explicit] + - match: 'catch' + scope: keyword.control.trycatch.catch.cs + push: trycatch_block + - match: (?=\S) + pop: true + + catch_block: + - meta_content_scope: meta.group.cs + - match: \) + scope: meta.group.cs punctuation.section.group.end.cs + set: catch_when + + catch_when: + - match: \bwhen\b + scope: keyword.control.trycatch.when.cs + set: + - match: \( + scope: punctuation.section.group.begin.cs + set: + - meta_scope: meta.group.cs + - match: \) + scope: punctuation.section.group.end.cs + set: trycatch_block + - include: line_of_code_in + - match: (?=\S) + set: trycatch_block + - match: '(?=\S)' + set: trycatch_block + + finally_block: + - meta_scope: meta.block.trycatch.cs + - match: finally\b + scope: keyword.control.trycatch.finally.cs + set: trycatch_block + - match: (?=\S) + pop: true + + trycatch_block: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: code_block_in + - match: (?=\S) + pop: true + + using_block: + - meta_content_scope: meta.group.cs + - match: \) + scope: meta.group.cs punctuation.section.group.end.cs + set: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: code_block_in + - match: (?=\S) + pop: true + - match: (?=\S) + pop: true + + expression_block: + - meta_content_scope: meta.group.cs + - match: \) + scope: meta.group.cs punctuation.section.group.end.cs + set: + - match: \{ + scope: meta.block.cs punctuation.section.block.begin.cs + set: + - meta_content_scope: meta.block.cs + - match: \} + scope: meta.block.cs punctuation.section.block.end.cs + pop: true + - include: code_block_in + - match: (?=\S) + set: line_of_code + + if_condition: + - match: '\s*(\()' + captures: + 1: meta.group.cs punctuation.section.group.begin.cs + set: + - meta_content_scope: meta.group.cs + - match: '\s*(\))' + captures: + 1: meta.group.cs punctuation.section.group.end.cs + pop: true + - include: line_of_code_in + - match: (?=[^(]) + pop: true + + if_block: + - match: \{ + scope: meta.block.cs punctuation.section.block.begin.cs + set: + - meta_content_scope: meta.block.cs + - match: \} + scope: meta.block.cs punctuation.section.block.end.cs + pop: true + - include: main + - match: (?=\S) + set: + - match: (?=else\b) + pop: true + - include: line_of_code + + else_block: + - match: (else\s+if)\b\s* + captures: + 1: keyword.control.conditional.elseif.cs + push: [if_block, if_condition] + - match: (else)\s* + scope: keyword.control.conditional.else.cs + set: + - match: \s*(\{) + captures: + 1: meta.block.cs punctuation.section.block.begin.cs + set: + - meta_content_scope: meta.block.cs + - match: \} + scope: meta.block.cs punctuation.section.block.end.cs + pop: true + - include: main + - match: (?=\S) + set: + - include: line_of_code + - match: (?=\S) + pop: true + + switch_condition: + - match: '\(' + scope: punctuation.section.group.begin.cs + set: + - meta_scope: meta.group.cs + - match: '\)' + scope: punctuation.section.group.end.cs + pop: true + - include: line_of_code_in + - match: (?=\S) + pop: true + + switch_block: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - match: '\b(default)\s*(:)' + captures: + 1: keyword.control.switch.case.cs + 2: punctuation.separator.case-statement.cs + - match: '\b(case)\b' + scope: keyword.control.switch.case.cs + push: + - match: '{{name}}(?=\s*:)' + scope: constant.other.cs + - match: '\bwhen\b' + scope: keyword.control.switch.case.when.cs + - match: '(?={{namespaced_name}}{{type_suffix}}\s+{{name}}\s+when\b)' + push: var_declaration_explicit + - match: ':' + scope: punctuation.separator.case-statement.cs + pop: true + - include: line_of_code_in + - match: $ + pop: true + - include: code_block_in + - match: '(?=\S)' + pop: true + + for_var_assignment: + - match: '=' + scope: keyword.operator.assignment.variable.loop.cs + set: line_of_code_in + - match: (?=;|\)|\}) + pop: true + + foreach_var_assignment: + - match: '\b(in)\b' + scope: keyword.control.flow.cs + set: line_of_code_in + - match: (?=\)|\}) + pop: true + + var_declaration: + - match: (var)\s*(\() + captures: + 1: storage.type.variable.cs + 2: meta.group.tuple.cs punctuation.definition.group.begin.cs + set: + - meta_content_scope: meta.group.tuple.cs + - match: \) + scope: meta.group.tuple.cs punctuation.definition.group.end.cs + pop: true + - match: _\b + scope: variable.language.deconstruction.discard.cs + - match: '{{name}}' + scope: variable.other.cs + - match: ',' + scope: punctuation.separator.tuple.cs + - match: '(var)\s+({{name}})\s*' + captures: + 1: storage.type.variable.cs + 2: variable.other.cs + pop: true + - include: var_declaration_explicit + + var_declaration_explicit: + - match: '({{name}})\s*(\.)' + captures: + 1: support.type.cs + 2: punctuation.accessor.dot.namespace.cs + - match: '({{name}})\s*(<)' + captures: + 1: support.type.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + set: + - meta_content_scope: meta.generic.cs + - match: '>' + scope: meta.generic.cs punctuation.definition.generic.end.cs + set: + - match: '({{name}})\s*' + captures: + 1: variable.other.cs + pop: true + - match: (?=[,);}]) + pop: true + - include: type_argument + - match: '({{base_type}}){{type_suffix_capture}}' + captures: + 1: storage.type.cs + 2: storage.type.nullable.cs + 3: meta.brackets.cs + 4: punctuation.section.brackets.begin.cs + 5: punctuation.separator.cs + 6: punctuation.section.brackets.end.cs + 7: keyword.operator.pointer.cs + set: + - match: '({{name}})\s*' + captures: + 1: variable.other.cs + pop: true + - match: (?=[,);}]) + pop: true + - match: '(?:({{name}}){{type_suffix_capture}})(?:\s+({{name}}))?\s*' + captures: + 1: support.type.cs + 2: storage.type.nullable.cs + 3: meta.brackets.cs + 4: punctuation.section.brackets.begin.cs + 5: punctuation.separator.cs + 6: punctuation.section.brackets.end.cs + 7: keyword.operator.pointer.cs + 8: variable.other.cs + pop: true + - match: (?=\)) + pop: true + + using_var_assignment: + - match: '=' + scope: keyword.operator.assignment.variable.using.cs + push: line_of_code_in + - match: (?=;|\)|\}) + pop: true + - match: ',' + scope: punctuation.separator.expression.cs + push: line_of_code_in + + for_block: + - meta_content_scope: meta.group.cs + - match: \) + scope: punctuation.section.group.end.cs + set: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: code_block_in + - match: (?=\S) + set: + - include: line_of_code + + while_block: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: '\}' + scope: punctuation.section.block.end.cs + pop: true + - include: code_block_in + - match: (?=\S) + set: + - include: line_of_code + + do_condition: + - match: \b(while)\b + scope: keyword.control.loop.while.cs + set: while_condition + - match: (?=\S) + pop: true + + while_condition: + - match: \( + scope: punctuation.section.group.begin.cs + set: + - meta_scope: meta.group.cs + - match: '\)' + scope: punctuation.section.group.end.cs + pop: true + - include: line_of_code_in + - match: (?=\S) + pop: true + + documentation: + - meta_include_prototype: false + - meta_content_scope: comment.block.documentation.cs + - match: '(<)({{name}})' + captures: + 1: punctuation.definition.tag.begin.cs + 2: entity.name.tag.begin.cs + push: + - meta_include_prototype: false + - match: '({{name}})\s*(=)' + captures: + 1: entity.other.attribute-name.cs + 2: punctuation.separator.argument.value.cs + - match: '/?>' + scope: punctuation.definition.tag.end.cs + pop: true + - match: '"[^"]*"' + scope: string.quoted.double.cs + - match: $ + pop: true + - match: '()' + captures: + 1: punctuation.definition.tag.begin.cs + 2: entity.name.tag.end.cs + 3: punctuation.definition.tag.end.cs + - match: '^\s*(///)' + captures: + 1: punctuation.definition.comment.documentation.cs + - match: '^\s*(?!///)' + pop: true + - include: comments_in + - match: '[\w\s]+|.' + scope: text.documentation.cs diff --git a/assets/syntaxes/Packages/C#/Comments.tmPreferences b/assets/syntaxes/Packages/C#/Comments.tmPreferences new file mode 100644 index 000000000..295dc7048 --- /dev/null +++ b/assets/syntaxes/Packages/C#/Comments.tmPreferences @@ -0,0 +1,39 @@ + + + + name + Comments + scope + source.cs + settings + + shellVariables + + + name + TM_COMMENT_START + value + // + + + name + TM_COMMENT_START_2 + value + /* + + + name + TM_COMMENT_END_2 + value + */ + + + name + TM_COMMENT_DISABLE_INDENT_2 + value + yes + + + + + diff --git a/assets/syntaxes/Packages/C#/Indentation.tmPreferences b/assets/syntaxes/Packages/C#/Indentation.tmPreferences new file mode 100644 index 000000000..d55a1fa75 --- /dev/null +++ b/assets/syntaxes/Packages/C#/Indentation.tmPreferences @@ -0,0 +1,45 @@ + + + + name + Indentation Rules + scope + source.cs + settings + + decreaseIndentPattern + (?x) + ^ # the beginning of the line + (.*\*/)? # optionally followed by the end of a block comment + \s* # followed by any amount of whitespace + \} # followed by a closing brace + ( # followed by + [^}{"']* \{ # - anything thats not a brace or a string (or nothing), followed by an opening brace + | \s* while \s* \( .* # - or any whitespace followed by `while` followed by any whitespace followed by an opening paren + | , # - or a comma + )? # optional + [;\s]* # followed by any number of semi-colons or whitespace characters + (//.*|/\*.*\*/\s*)? # optionally followed by a comment + $ # the end of the line + + increaseIndentPattern + (?x) + ^ # the beginning of the line + .* # followed by anything + \{ # followed by an open brace + [^}"']* # followed by any number of characters that isn't a close brace or a string + $ # the end of the line + + indentNextLinePattern + (?x)^ + (?! .* [;:{}] # do not indent when line ends with ;, :, {, or } + \s* (//|/[*] .* [*]/ \s* $) # …account for potential trailing comment + ) + .* [^\s;:{}] \s* $ # indent next if this one isn’t + # terminated with ;, :, {, or } + + unIndentedLinePattern + ^\s*((/\*|\*/|//|#).*)?$ + + + diff --git a/assets/syntaxes/Packages/C#/Symbol List Classes.tmPreferences b/assets/syntaxes/Packages/C#/Symbol List Classes.tmPreferences new file mode 100644 index 000000000..b7320d3ec --- /dev/null +++ b/assets/syntaxes/Packages/C#/Symbol List Classes.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Classes + scope + source.cs entity.name.class + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/C#/Symbol List Constructors.tmPreferences b/assets/syntaxes/Packages/C#/Symbol List Constructors.tmPreferences new file mode 100644 index 000000000..298f7715c --- /dev/null +++ b/assets/syntaxes/Packages/C#/Symbol List Constructors.tmPreferences @@ -0,0 +1,21 @@ + + + + name + Symbol List: Constructor + scope + source.cs meta.method.constructor - meta.method.constructor.prebody + settings + + showInSymbolList + 1 + symbolTransformation + + s/\s{2,}/ /g; # collapse whitespace + s/\/\*.*\*\///g; # remove block comments + s/\/\/.*$\n?//g; # remove line comments + s/^\s*/ /; # indent by two spaces + + + + diff --git a/assets/syntaxes/Packages/C#/Symbol List Enums.tmPreferences b/assets/syntaxes/Packages/C#/Symbol List Enums.tmPreferences new file mode 100644 index 000000000..78d3c43fe --- /dev/null +++ b/assets/syntaxes/Packages/C#/Symbol List Enums.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Enums + scope + source.cs entity.name.enum + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/C#/Symbol List Index Constructors.tmPreferences b/assets/syntaxes/Packages/C#/Symbol List Index Constructors.tmPreferences new file mode 100644 index 000000000..42aa25d51 --- /dev/null +++ b/assets/syntaxes/Packages/C#/Symbol List Index Constructors.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Constructor + scope + entity.name.function.constructor.cs + settings + + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/C#/Symbol List Inner Function.tmPreferences b/assets/syntaxes/Packages/C#/Symbol List Inner Function.tmPreferences new file mode 100644 index 000000000..3c38f7f6d --- /dev/null +++ b/assets/syntaxes/Packages/C#/Symbol List Inner Function.tmPreferences @@ -0,0 +1,21 @@ + + + + name + Symbol List: Method + scope + + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + symbolTransformation + + s/\s{2,}/ /g; # collapse whitespace + s/^\s*/ /; # indent by two spaces + + + + diff --git a/assets/syntaxes/Packages/C#/Symbol List Interfaces.tmPreferences b/assets/syntaxes/Packages/C#/Symbol List Interfaces.tmPreferences new file mode 100644 index 000000000..95b950da6 --- /dev/null +++ b/assets/syntaxes/Packages/C#/Symbol List Interfaces.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Interfaces + scope + source.cs entity.name.interface + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/C#/Symbol List Namespace.tmPreferences b/assets/syntaxes/Packages/C#/Symbol List Namespace.tmPreferences new file mode 100644 index 000000000..54128ce21 --- /dev/null +++ b/assets/syntaxes/Packages/C#/Symbol List Namespace.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Namespace + scope + source.cs entity.name.namespace + settings + + showInSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/C#/Symbol List Region.tmPreferences b/assets/syntaxes/Packages/C#/Symbol List Region.tmPreferences new file mode 100644 index 000000000..a917fe895 --- /dev/null +++ b/assets/syntaxes/Packages/C#/Symbol List Region.tmPreferences @@ -0,0 +1,19 @@ + + + + name + Symbol List: Region + scope + source.cs entity.name.section + settings + + showInSymbolList + 1 + symbolTransformation + + s/\s{2,}/ /g; # collapse whitespace + s/^/#region /;# prepend "#region " to the region name + + + + diff --git a/assets/syntaxes/Packages/C#/Symbol List Structs.tmPreferences b/assets/syntaxes/Packages/C#/Symbol List Structs.tmPreferences new file mode 100644 index 000000000..80ce2026a --- /dev/null +++ b/assets/syntaxes/Packages/C#/Symbol List Structs.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Struct + scope + source.cs entity.name.struct + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/C#/doc_params.sublime-snippet b/assets/syntaxes/Packages/C#/doc_params.sublime-snippet new file mode 100644 index 000000000..7a6edaa35 --- /dev/null +++ b/assets/syntaxes/Packages/C#/doc_params.sublime-snippet @@ -0,0 +1,9 @@ + + ${2:use} +]]> + + ///p + + source.cs + diff --git a/assets/syntaxes/Packages/C#/doc_see.sublime-snippet b/assets/syntaxes/Packages/C#/doc_see.sublime-snippet new file mode 100644 index 000000000..1ae68ad5e --- /dev/null +++ b/assets/syntaxes/Packages/C#/doc_see.sublime-snippet @@ -0,0 +1,9 @@ + + ${1:ref} +]]> + + see + + source.cs comment.block.documentation + diff --git a/assets/syntaxes/Packages/C#/doc_summary.sublime-snippet b/assets/syntaxes/Packages/C#/doc_summary.sublime-snippet new file mode 100644 index 000000000..128d851cf --- /dev/null +++ b/assets/syntaxes/Packages/C#/doc_summary.sublime-snippet @@ -0,0 +1,9 @@ + + ${1:summary} +]]> + + ///s + + source.cs + diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_C#7.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_C#7.cs new file mode 100644 index 000000000..e125f0989 --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_C#7.cs @@ -0,0 +1,772 @@ +/// SYNTAX TEST "Packages/C#/C#.sublime-syntax" + +class Foo { +/// <- meta.class storage.type.class + /// <- meta.class + /// <- meta.class +///^^^^^^^^ meta.class +/// ^ meta.class.body + + void Main(string[] args) { +/// ^^^^ storage.type +/// ^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^^^^^^^^^^^^^^^^^^^^ - meta.method meta.method +/// ^^^^ entity.name.function +/// ^^^^^^^^^^^^^^^ meta.method.parameters +/// ^ punctuation.section.parameters.begin +/// ^^^^^^ storage.type +/// ^^ meta.brackets +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^^^^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^ punctuation.section.block.begin + + int x = 37; +/// ^^^ storage.type +/// ^ - entity.name +/// ^ keyword.operator.assignment +/// ^^ constant.numeric.integer.decimal +/// ^ punctuation.terminator + + // simple nested function + int[] add(int y) {return x + y;} +/// ^^^ storage.type +/// ^^ meta.brackets +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.body meta.method +/// ^^^ entity.name.function +/// ^^^^^^^ meta.method.parameters +/// ^ punctuation.section.parameters.begin +/// ^^^ storage.type +/// ^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^^^^^^^^^^^^^^^ meta.method.body meta.method.body +/// ^ punctuation.section.block.begin +/// ^^^^^^ keyword.control +/// ^ keyword.operator +/// ^ punctuation.terminator +/// ^ punctuation.section.block.end + + T add(int y) {return x + y;}; +/// ^ support.type +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^^ entity.name.function +/// ^^^^^^^ meta.method.parameters +/// ^ punctuation.section.parameters.begin +/// ^^^ storage.type +/// ^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^^^^^^^^^^^^^^^ meta.method.body +/// ^^^^^^ keyword.control +/// ^ keyword.operator +/// ^ punctuation.terminator +/// ^ punctuation.section.block.end +/// ^ punctuation.terminator + + List[] add(int y) {return x + y;}; +/// ^^^^ support.type +/// ^^^^^ meta.generic +/// ^ punctuation.definition.generic.begin +/// ^^^ storage.type +/// ^ punctuation.definition.generic.end +/// ^^ meta.brackets +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^^ entity.name.function +/// ^^^^^^^ meta.method.parameters +/// ^ punctuation.section.parameters.begin +/// ^^^ storage.type +/// ^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^^^^^^^^^^^^^^^ meta.method.body +/// ^^^^^^ keyword.control +/// ^ keyword.operator +/// ^ punctuation.terminator +/// ^ punctuation.section.block.end +/// ^ punctuation.terminator + + List> add(int y) {return x + y;}; +/// ^^^^ support.type +/// ^^^^^^^^^^^^ meta.generic +/// ^ support.type +/// ^ punctuation.separator +/// ^^^ meta.generic meta.generic +/// ^ support.type +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^^ entity.name.function +/// ^^^^^^ meta.generic +/// ^ punctuation.definition.generic.begin +/// ^ support.type +/// ^ punctuation.separator +/// ^ support.type +/// ^ punctuation.definition.generic.end +/// ^^^^^^^ meta.method.parameters +/// ^ punctuation.section.parameters.begin +/// ^^^ storage.type +/// ^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^^^^^^^^^^^^^^^ meta.method.body +/// ^^^^^^ keyword.control +/// ^ keyword.operator +/// ^ punctuation.terminator +/// ^ punctuation.section.block.end +/// ^ punctuation.terminator + + // lambda + Func store = (x, y) => x + y; +/// ^^^^^^^^^^^^^ meta.generic +/// ^^^ storage.type +/// ^ punctuation.separator +/// ^^^^^^ storage.type +/// ^ punctuation.definition.generic.end +/// ^^^^^ variable.other +/// ^ keyword.operator +/// ^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end + + Console.Writeline(add(5)); +/// ^ punctuation.accessor +/// ^^^^^^^^^^^^^^^^^ meta.function-call +/// ^^^^^^^^^ variable.function +/// ^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^^^ meta.function-call meta.function-call +/// ^^^ variable.function +/// ^^^ meta.group meta.group +/// ^ punctuation.section.group.begin +/// ^ constant.numeric.integer.decimal +/// ^ punctuation.section.group.end +/// ^ punctuation.section.group.end + + // https://github.com/dotnet/roslyn/pull/2950 + int bin = 0b1001_1010_0001_0100; +/// ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary +/// ^^ punctuation.definition.numeric.base + int hex = 0x1b_a0_44_fe; +/// ^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal +/// ^^ punctuation.definition.numeric.base + int dec = 33_554_432; +/// ^^^^^^^^^^ constant.numeric.integer.decimal + int weird = 1_2__3___4____5_____6______7_______8________9; +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.decimal + double real = 1_000.111_1e-1_000; +/// ^^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal +/// ^ punctuation.separator.decimal.cs + double real = 1_000e-1_000; +/// ^^^^^^^^^^^^ constant.numeric.float.decimal + double dbl = 33_554_432.5_2; +/// ^^^^^^^^^^^^^^ constant.numeric.float.decimal + long lng = 33_554_4321L; +/// ^^^^^^^^^^^ constant.numeric.integer.decimal +/// ^ storage.type.numeric + bin = _0b1001_1010_0001_0100; +/// ^^^^^^^^^^^^^^^^^^^^^^ variable.other + bin = 0b1001_1010_0001_0100_; +/// ^ - constant.numeric.integer.binary + bin = 0b_1001_1010_0001_0100; +/// ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary + bin = 0b__1001__1010__0001__0_1_0_0; +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary + hex = _0x1b_a0_44_fe; +/// ^^^^^^^^^^^^^^ variable.other + hex = 0x_1b_a0_44_fe; +/// ^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal + int abc = _123; +/// ^^^^ variable.other + + switch (sh) { + case Shape shape when sh.Area == 0: +/// ^^^^ keyword.control.switch.case +/// ^^^^^ support.type +/// ^^^^^ variable.other +/// ^^^^ keyword.control.switch.case.when +/// ^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^^ variable.other +/// ^^ keyword.operator +/// ^ constant.numeric.integer.decimal +/// ^ punctuation.separator.case-statement + Console.WriteLine($"The shape: {sh.GetType().Name} with no dimensions"); + break; + case int? example when example == 5: +/// ^^^^ keyword.control.switch.case +/// ^^^ storage.type +/// ^ storage.type.nullable +/// ^^^^^^^ variable.other +/// ^^^^ keyword.control.switch.case.when +/// ^^^^^^^ variable.other +/// ^^ keyword.operator +/// ^ constant.numeric.integer.decimal +/// ^ punctuation.separator.case-statement + case Shape shape when shape.Area > 0: +/// ^^^^ keyword.control.switch.case +/// ^^^^^ support.type +/// ^ punctuation.definition.generic.begin +/// ^^^^^ support.type +/// ^ punctuation.definition.generic.end +/// ^^^^^ variable.other +/// ^^^^ keyword.control.switch.case.when +/// ^^^^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^^ variable.other +/// ^ keyword.operator +/// ^ constant.numeric.integer.decimal +/// ^ punctuation.separator.case-statement + } + + // https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7#out-variables + if (int.TryParse(input, out var quantity)) +/// ^^^ storage.modifier.argument +/// ^ - storage.modifier.argument +/// ^^^ storage.type.variable +/// ^^^^^^^^ variable.other +/// ^^ punctuation.section.group.end + WriteLine(quantity); + else + WriteLine("Quantity is not a valid integer!"); + + Console.WriteLine($"{nameof(quantity)}: {quantity}"); // still valid +/// ^^^^^^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^^^^^^^ variable.function + + int.TryParse(input, out ref int quantity); +/// ^^^ storage.type +/// ^ punctuation.accessor.dot +/// ^^^^^^^^ variable.function +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call +/// ^ punctuation.section.group.begin +/// ^^^ storage.modifier.argument +/// ^^^ storage.modifier.argument +/// ^^^ storage.type +/// ^^^^^^^^ variable.other +/// ^ punctuation.section.group.end + } +/// ^ meta.class.body meta.method.body punctuation.section.block.end + + // https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7#local-functions + public Task PerformLongRunningWork(string address, int index, string name) + { + if (string.IsNullOrWhiteSpace(address)) + throw new ArgumentException(message: "An address is required", paramName: nameof(address)); + if (index < 0) + throw new ArgumentOutOfRangeException(paramName: nameof(index), message: "The index must be non-negative"); + if (string.IsNullOrWhiteSpace(name)) + throw new ArgumentException(message: "You must supply a name", paramName: nameof(name)); + + return longRunningWorkImplementation(); + + async Task longRunningWorkImplementation () +/// ^^^^^ storage.modifier +/// ^^^^ support.type +/// ^ punctuation.definition.generic.begin +/// ^^^^^^ storage.type +/// ^ punctuation.definition.generic.end +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.function +/// ^^ meta.method.parameters + { +/// ^ punctuation.section.block.begin +/// ^ meta.class.body meta.method.body meta.method.body + var interimResult = await FirstWork(address); + var secondResult = await SecondStep(index, name); + return $"The results are {interimResult} and {secondResult}. Enjoy."; + } +/// ^ punctuation.section.block.end +/// ^ meta.class.body meta.method.body - meta.method.body meta.method.body + } + + // https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7#ref-locals-and-returns + public static ref int Find3(int[,] matrix, Func predicate) { +/// ^^^^^^ storage.modifier.access +/// ^^^^^^ storage.modifier +/// ^^^ storage.modifier +/// ^^^ storage.type +/// ^^^^^ entity.name.function +/// ^ punctuation.section.parameters.begin +/// ^^^ storage.type +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.separator +/// ^ punctuation.section.brackets.end +/// ^^^^^^ variable.parameter + for (int i = 0; i < matrix.GetLength(0); i++) + for (int j = 0; j < matrix.GetLength(1); j++) + if (predicate(matrix[i, j])) + return ref matrix[i, j]; +/// ^^^^^^ keyword.control.flow.return +/// ^^^ keyword.other +/// ^^^^^^ variable.other +/// ^ punctuation.section.brackets.begin +/// ^ variable.other +/// ^ punctuation.separator.accessor +/// ^ variable.other +/// ^ punctuation.section.brackets.end +/// ^ punctuation.terminator.statement + throw new InvalidOperationException("Not found"); + } + + // https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7#tuples + public void TupleTest () { + var letters = ("a", "b"); +/// ^^^^^^^^^^ meta.group.tuple +/// ^ punctuation.section.group.begin +/// ^ punctuation.separator.tuple +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + var (a, b, c) = (1, 2, 3); +/// ^^^ storage.type.variable +/// ^^^^^^^^^ meta.group.tuple +/// ^ variable.other +/// ^ punctuation.separator.tuple +/// ^ variable.other +/// ^ punctuation.separator.tuple +/// ^ keyword.operator.assignment - meta.group +/// ^^^^^^^^^ meta.group.tuple +/// ^ constant.numeric.integer.decimal +/// ^ punctuation.separator.tuple + (string Alpha, string Beta) namedLetters = ("a", "b"); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.tuple +/// ^ punctuation.section.group.begin +/// ^^^^^^ storage.type +/// ^^^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^^^^^^ storage.type +/// ^^^^ variable.other +/// ^ punctuation.section.group.end +/// ^^^^^^^^^^^^ variable.other +/// ^ keyword.operator.assignment +/// ^ punctuation.section.group.begin +/// ^ punctuation.separator.tuple +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + + (SomeType[] Alpha, SomeType Beta) example = (a, b); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.tuple +/// ^ punctuation.section.group.begin +/// ^^^^^^^^ support.type +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^^^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^^^^^^^^ support.type +/// ^ punctuation.definition.generic.begin +/// ^^^ storage.type +/// ^ punctuation.definition.generic.end +/// ^^^^ variable.other +/// ^ punctuation.section.group.end +/// ^^^^^^^ variable.other +/// ^ keyword.operator.assignment +/// ^^^^^^ meta.group.tuple +/// ^ punctuation.section.group.begin +/// ^ variable.other +/// ^ punctuation.separator.tuple +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + var alphabetStart = (Alpha: "a", Beta: "b"); +/// ^^^^^^^^^^^^^^^^^^^^^^^ meta.group.tuple +/// ^ punctuation.section.group.begin +/// ^^^^^ variable.other +/// ^ keyword.operator.assignment +/// ^ punctuation.separator.tuple +/// ^^^^ variable.other +/// ^ keyword.operator.assignment +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + var abc = (this as object, input); +/// ^ punctuation.section.group.begin +/// ^^^^ variable.language +/// ^^ keyword.operator.reflection +/// ^^^^^^ storage.type +/// ^ punctuation.separator.tuple +/// ^^^^^ variable.other +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + var abc = (example.Alpha as SomeType); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group - meta.group.tuple +/// ^ punctuation.section.group.begin +/// ^^^^^^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^^^ variable.other +/// ^^ keyword.operator.reflection +/// ^^^^^^^^ support.type +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + // https://docs.microsoft.com/en-us/dotnet/csharp/deconstruct + (string city, _, double area) = QueryCityData("New York City"); +/// ^ punctuation.section.group.begin +/// ^^^^^^ storage.type +/// ^^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^ variable.language.deconstruction.discard +/// ^ punctuation.separator.tuple +/// ^^^^^^ storage.type +/// ^^^^ variable.other +/// ^ punctuation.section.group.end +/// ^ keyword.operator.assignment + (city, population, _) = QueryCityData("New York City"); +/// ^ punctuation.section.group.begin +/// ^^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^^^^^^^^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^ variable.language.deconstruction +/// ^ punctuation.section.group.end +/// ^ keyword.operator.assignment + var (_, _, _, pop1, _, pop2) = QueryCityDataForYears("New York City", 1960, 2010); +/// ^^^ storage.type.variable +/// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.tuple +/// ^ - meta.group +/// ^ punctuation.definition.group.begin +/// ^ variable.language +/// ^ punctuation.separator.tuple +/// ^ variable.language +/// ^ punctuation.separator.tuple +/// ^^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^ variable.language +/// ^ punctuation.separator.tuple +/// ^^^^ variable.other +/// ^ punctuation.definition.group.end + (Func test1, string test2) = ((int d) => d * 2, 5.ToString()); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.tuple +/// ^^^^ support.type +/// ^^^^^^^^^^ meta.generic +/// ^^^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^^^^^^ storage.type +/// ^^^^^ variable.other +/// ^ keyword.operator.assignment - meta.group +/// ^ meta.group.tuple punctuation.section.group.begin +/// ^^^^^^^^^^^^^^^^ meta.function.anonymous +/// ^ punctuation.separator.tuple - meta.function.anonymous +/// ^ constant.numeric.integer.decimal +/// ^ punctuation.accessor.dot +/// ^^^^^^^^ variable.function +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end +/// ^ punctuation.section.group.end + (a, b) = (new Random().Next(), 15); +/// ^^^ keyword.operator.new +/// ^^^^^^ support.type +/// ^ punctuation.separator.tuple +/// ^^ meta.group.tuple constant.numeric.integer.decimal +/// ^ punctuation.section.group.end + + var dic = new Dictionary { ["Bob"] = 32, ["Alice"] = 17 }; + foreach (var (name, age) in dic.Select(x => (x.Key, x.Value))) +/// ^^^ storage.type.variable +/// ^^^^^^^^^^^ meta.group.tuple +/// ^ punctuation.definition.group.begin +/// ^^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^^^ variable.other +/// ^ punctuation.definition.group.end +/// ^^ keyword.control.flow + { + Console.WriteLine($"{name} is {age} years old."); + } + + var positions = new List<(int, int)> { (0, 1), (1, 2), (2, 4) }; + foreach (var(x, y) in positions) +/// ^ punctuation.section.group.begin +/// ^^^storage.type.variable +/// ^^^^^^ meta.group.tuple +/// ^ punctuation.definition.group.begin +/// ^ variable.other +/// ^ punctuation.separator.tuple +/// ^ variable.other +/// ^ punctuation.definition.group.end +/// ^^ keyword.control.flow +/// ^^^^^^^^^ variable.other +/// ^ punctuation.section.group.end + { + Console.WriteLine($"x={x} y={y}"); + } + } + + private static (int Max, int Min) Range(IEnumerable numbers) +/// ^^^^^^^ storage.modifier.access +/// ^^^^^^ storage.modifier +/// ^ punctuation.section.group.begin +/// ^^^ storage.type +/// ^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^^^ storage.type +/// ^^^ variable.other +/// ^ punctuation.section.group.end +/// ^^^^^ entity.name.function - entity.name.function.constructor +/// ^ punctuation.section.parameters.begin +/// ^^^^^^^^^^^ support.type +/// ^ punctuation.definition.generic.begin +/// ^^^ storage.type +/// ^ punctuation.definition.generic.end +/// ^^^^^^^ variable.parameter +/// ^ punctuation.section.parameters.end + { + int min = int.MaxValue; + int max = int.MinValue; + foreach(var n in numbers) + { + min = (n < min) ? n : min; + max = (n > max) ? n : max; + } + return (max, min); +/// ^^^^^^ keyword.control.flow.return +/// ^ punctuation.section.group.begin +/// ^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^^^ variable.other +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + + Func test = s => (example1: "hello", Example2: "world"); +/// ^^^^ support.type +/// ^ punctuation.definition.generic.begin +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.tuple +/// ^ punctuation.section.group.begin +/// ^^^^^^ storage.type +/// ^^^^^^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^^^ storage.type +/// ^^^^^^^^ variable.other +/// ^ punctuation.section.group.end +/// ^ punctuation.definition.generic.end +/// ^^^^ variable.other +/// ^ keyword.operator.assignment.variable +/// ^ variable.parameter +/// ^^ storage.type.function.lambda +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^^^^^ variable.other +/// ^ keyword.operator.assignment +/// ^ punctuation.separator +/// ^^^^^^^^ variable.other +/// ^ keyword.operator.assignment +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + } + + public void Deconstruct(out string firstName, out string lastName, out int age) + { + firstName = FirstName; + lastName = LastName; + age = Age; + } + + public void Example((int foo, float bar) val, (int foo, string bar) otherVal) {} +/// ^^^^^^^ entity.name.function +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.parameters +/// ^ punctuation.section.parameters.begin +/// ^^^^^^^^^^^^^^^^^^^^ meta.group.tuple +/// ^ punctuation.section.group.begin +/// ^^^ storage.type +/// ^^^ variable.other +/// ^ punctuation.separator.tuple +/// ^^^^^ storage.type +/// ^^^ variable.other +/// ^ punctuation.section.group.end +/// ^^^ variable.parameter +/// ^ punctuation.separator.parameter.function +/// ^^^^^^^^^^^^^^^^^^^^^ meta.group.tuple +/// ^^^^^^^^ variable.parameter +/// ^ punctuation.section.parameters.end + public void Example((int , float ) val, (int, string) otherVal) {} +/// ^^^^^^^ entity.name.function +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.parameters +/// ^^^^^^^^^^^^^^ meta.group.tuple +/// ^^^ storage.type +/// ^ punctuation.separator.tuple +/// ^^^^^ storage.type +/// ^ punctuation.section.group.end +/// ^^^ variable.parameter - meta.group.tuple +/// ^ punctuation.separator.parameter.function +/// ^^^^^^^^^^^^^ meta.group.tuple +/// ^ punctuation.section.group.begin +/// ^^^ storage.type +/// ^ punctuation.separator.tuple +/// ^^^^^^ storage.type +/// ^ punctuation.section.group.end +/// ^^^^^^^^ variable.parameter +/// ^ punctuation.section.parameters.end +} +/// <- meta.class.body punctuation.section.block.end + +public readonly struct S +/// ^^ storage.modifier.access +/// ^^^^^^^^ storage.modifier +/// ^^^^^^ storage.type.struct +/// ^ entity.name.struct +{ +/// <- meta.struct.body meta.block punctuation.section.block.begin + public readonly int Age; +/// ^^^^^^ storage.modifier.access +/// ^^^^^^^^ storage.modifier +/// ^^^ storage.type +/// ^^^ variable.other.member + public string Name { get; } + + public readonly int X, Y; // All fields must be readonly +/// ^ variable.other.member +/// ^ punctuation.separator.variables +/// ^ variable.other.member +/// ^ punctuation.terminator.statement + + public S(int age, string name) + { + this.Age = age; + this.Name = name; + } + + public S(S other) + { + this = other; + } +} + +// "private protected" is now a valid modifier. It's equivalent to protected, except that it can only be +// accessed inside the current assembly. +class BaseClass { private protected void Foo() {} } +/// ^^^^^^^ storage.modifier.access +/// ^^^^^^^^^ storage.modifier.access +/// ^^^^ storage.type +/// ^^^ entity.name.function +class Derived : BaseClass { void Bar() => Foo(); } + +// You can now place the "in" keyword before parameters to prevent them from being modified. This is +// particularly useful with structs, because the compiler avoids the overhead of having to copy the value: +void Foo (in string s, in int x, in Point point) +///^ storage.type +/// ^^^ entity.name.function +/// ^^ storage.modifier.parameter +/// ^^^^^^ storage.type +/// ^ variable.parameter +/// ^ punctuation.separator.parameter +{ + // s = "new"; // error + // x++; // error + // point.X++; // error +} +// Note that you don't specify the 'in' modifier when calling the method: +void TestFoo() => Foo ("hello", 123, new Point (2, 3)); + +// https://msdn.microsoft.com/en-us/magazine/mt814808.aspx +Span bytes = length <= 128 ? stackalloc byte[length] : new byte[length]; +/// ^^^^^^^^^^ keyword.other +/// ^^^^ variable.other +bytes[0] = 42; +bytes[1] = 43; +Assert.Equal(42, bytes[0]); +Assert.Equal(43, bytes[1]); +bytes[2] = 44; // throws IndexOutOfRangeException + +public readonly ref struct Span +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.struct +/// ^ storage.modifier.access +/// ^^^^^^^^ storage.modifier +/// ^^^ storage.modifier +/// ^^^^^^ storage.type.struct +/// ^^^^ entity.name.struct +{ + private readonly ref T _pointer; +/// ^^^^^^^ storage.modifier.access +/// ^^^^^^^^ storage.modifier +/// ^^^ storage.modifier +/// ^ support.type +/// ^^^^^^^^ variable.other.member + private readonly int _length; +} + +public delegate void SpanAction(Span span, TArg arg); +/// ^^^^^^^^ storage.type.delegate +/// ^^^^ storage.type +/// ^^^^^^^^^^ variable.other.member.delegate +/// ^^^^^^^^^^^^ meta.generic +/// ^ support.type +/// ^ punctuation.separator.type +/// ^^ storage.modifier +/// ^^^^ support.type + +void Test () +{ + int[] array = { 1, 15, -39, 0, 7, 14, -12 }; +/// ^ constant.numeric.integer.decimal +/// ^ punctuation.separator.array-element +/// ^ punctuation.terminator.statement + ref int place = ref Find (7, array); // aliases 7's place in the array +/// ^^^ storage.modifier +/// ^^^ storage.type +/// ^^^^^ variable.other +/// ^ keyword.operator.assignment.variable +/// ^^^ keyword.other +/// ^^^^ variable.function + place = 9; // replaces 7 with 9 in the array + Console.WriteLine (array [4]); // prints 9 +} + +public ref int Find (int number, int[] numbers) +/// ^^ storage.modifier.access +/// ^^^ storage.modifier +/// ^^^ storage.type +/// ^^^^ entity.name.function +{ + for (int i = 0; i < numbers.Length; i++) + { + if (numbers [i] == number) + { + return ref numbers [i]; // return the storage location, not the value +/// ^^^^^^ keyword.control.flow.return +/// ^^^ keyword.other +/// ^^^^^^^ variable.other + } + } + throw new IndexOutOfRangeException ($"{nameof (number)} not found"); +} + +public class MyClass { + object obj; + public MyClass () => obj = null; +/// ^^^^^^^ meta.method.constructor entity.name.function.constructor +/// ^^^^^^^^^^^^^^^^^ meta.class.body meta.block meta.method +/// ^^ storage.type.function +/// ^^^ variable.other +/// ^ keyword.operator.assignment +/// ^^^^ constant.language +/// ^ punctuation.terminator.statement - meta.method +} +/// <- meta.class.body meta.block punctuation.section.block.end + +public class Person // https://stackoverflow.com/a/41974829/4473405 +{ + public string Name { get; } + public int Age { get; } + + public Person(string name, int age) => (Name, Age) = (name, age); +/// ^^^^^^ storage.modifier.access +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.constructor +/// ^^^^^^ entity.name.function.constructor +/// ^ punctuation.section.parameters.begin +/// ^^^^^^ storage.type +/// ^^^^ variable.parameter +/// ^ punctuation.separator.parameter.function +/// ^^^ storage.type +/// ^^^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^ storage.type.function +/// ^ meta.group punctuation.section.group.begin +/// ^^^^ meta.group variable.other +/// ^ meta.group punctuation.separator.tuple +/// ^^^ meta.group variable.other +/// ^ meta.group punctuation.section.group.end +/// ^ keyword.operator.assignment +/// ^ meta.group punctuation.section.group.begin +/// ^^^^ meta.group variable.other +/// ^ punctuation.separator.tuple +/// ^^^ meta.group variable.other +/// ^ meta.group punctuation.section.group.end +/// ^ punctuation.terminator.statement +} diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_Comments.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_Comments.cs new file mode 100755 index 000000000..1dcfbb52e --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_Comments.cs @@ -0,0 +1,53 @@ +//* SYNTAX TEST "Packages/C#/C#.sublime-syntax" + +// A Hello World! program in C#. +//*<- comment.line +using System; + +namespace HelloWorld +{ + /// +//* ^^^ punctuation.definition.comment.documentation.cs +//* ^^^^^^^^^^^^^^ comment.block.documentation +//* ^ punctuation.definition.tag.begin +//* ^^^^^^^ entity.name.tag.begin +//* ^ punctuation.definition.tag.end +//* ^ text.documentation +//* ^^^^^^^^^ - text.documentation +//* ^ text.documentation + /// This class is testing comments +//* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation +//* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ text.documentation + /// +//* ^^ punctuation.definition.tag.begin +//* ^^^^^^^ entity.name.tag.end +//* ^ punctuation.definition.tag.end + /// Reference +//* ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - text.documentation +//* ^ punctuation.definition.tag.begin +//* ^^^ entity.name.tag +//* ^^^^ entity.other.attribute-name +//* ^ punctuation.separator.argument.value +//* ^ punctuation.definition.tag.end +//* ^^^^^^^^^ text.documentation + /** + * +//* ^ meta.namespace.cs meta.block.cs comment.block.cs punctuation.definition.comment.cs + */ + class Hello + { + /// + /// Computes matrix-matrix product of a sparse matrix stored in the CSC format. +//* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ text.documentation + /// + void dcscmm(Transpose TransA, int m, int n, int k, + double alpha, + double[] val, int offsetval, + int[] indx, int offsetindx, + int[] pntrb, int offsetpntrb, + //int[] pntre, int offsetpntre, + double[] b, int offsetb, int ldb, + double beta, + double[] c, int offsetc, int ldc); + } +} diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_GeneralStructure.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_GeneralStructure.cs new file mode 100755 index 000000000..59ea150aa --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_GeneralStructure.cs @@ -0,0 +1,1327 @@ +/// SYNTAX TEST "Packages/C#/C#.sublime-syntax" + +// A skeleton of a C# program +using System; + +namespace YourNamespace +///<- storage.type.namespace +/// ^ entity.name.namespace +{ +///<- punctuation.section.block.begin + class YourClass +/// ^ storage.type.class +/// ^ entity.name.class + { + Int x; +/// ^^^ support.type +/// ^ variable.other.member + Int x0 = 0, y0 = 0; +/// ^ support.type +/// ^ variable.other.member +/// ^ keyword.operator.assignment +/// ^ punctuation.separator +/// ^ variable.other.member +/// ^ keyword.operator.assignment + string[][] test = new[] { new[] { "hello", "world" }, new[] { "foo", "bar" }}; +/// ^^^^^^ storage.type +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^^^^ variable.other.member +/// ^ keyword.operator.assignment.variable + + [ServiceBehavior(Namespace = "http://test/", InstanceContextMode = InstanceContextMode.PerCall)] +/// ^ variable.parameter +/// ^ keyword.operator.assignment +/// ^^^^^^^^^^^^^^ string.quoted.double +/// ^ punctuation.separator +/// ^ variable.parameter +/// ^ keyword.operator.assignment +/// ^ - variable.parameter + public Int YourProperty { +/// ^ storage.modifier +/// ^^^ support.type +/// ^ variable.other.member +/// ^ meta.property punctuation.section.block.begin + get {return x;} +/// ^^^^^^^^^^^^^^^ meta.property meta.method +/// ^ storage.type.function.accessor.get +/// ^^^^^^^^^^^ meta.property meta.method.body meta.block +/// ^ punctuation.section.block.begin +/// ^ punctuation.terminator +/// ^ punctuation.section.block.end + set {x = value;} +/// ^^^^^^^^^^^^^^^^ meta.property meta.method +/// ^ storage.type.function.accessor.set +/// ^^^^^^^^^^^^ meta.property meta.method.body meta.block +/// ^ punctuation.section.block.begin +/// ^ variable.other +/// ^ variable.language +/// ^ punctuation.terminator +/// ^ punctuation.section.block.end + } +/// ^ meta.property punctuation.section.block.end + + public bool IsConst(Type value) => this is Const && (this as Const).Value.Equals(value); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^^^^^^ entity.name.function +/// ^^^^^^^^^^^^ meta.method.parameters +/// ^ punctuation.section.parameters.begin +/// ^^^^ support.type +/// ^^^^^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^^ storage.type.function +/// ^^^^ variable.language +/// ^^ keyword.operator.reflection +/// ^^^^^ support.type +/// ^^ keyword.operator +/// ^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^ variable.language +/// ^^ keyword.operator.reflection +/// ^^^^^ support.type +/// ^ punctuation.section.group.end +/// ^ punctuation.accessor +/// ^ punctuation.accessor +/// ^^^^^^^^^^^^^ meta.function-call +/// ^^^^^^ variable.function +/// ^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^^ variable.language +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator + + public bool IsZero => IsConst(Numeric.Zero); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.property +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^ variable.other.member +/// ^^ storage.type.function.accessor.get +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call +/// ^^^^^^^ support.type +/// ^^^^^^ meta.generic +/// ^ punctuation.definition.generic.begin +/// ^^^^ support.type +/// ^ punctuation.definition.generic.end + + public bool InlineProperty {get; private set; } = false; +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.property +/// ^^^^^^^^^^^^^^ variable.other.member +/// ^^^^^^^^^^^^^^^^^^^^ meta.property meta.block +/// ^^^ storage.type.function.accessor.get +/// ^^^^^^^ storage.modifier.access +/// ^^^ storage.type.function.accessor.set +/// ^ keyword.operator.assignment +/// ^^^^^ constant.language + + public new bool NewMethod() => false; +/// ^^^ storage.modifier +/// ^^^^ storage.type +/// ^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^^^^^^^^ entity.name.function +/// ^^ meta.method.parameters +/// ^^ storage.type.function +/// ^^^^^ constant.language + } + + struct YourStruct +/// ^^^^^^^^^^^^^^^^^ meta.struct +/// ^ storage.type.struct +/// ^ entity.name.struct + { +///^^ meta.struct +// ^ meta.block punctuation.section.block.begin + } +///^^ meta.struct meta.block +// ^ punctuation.section.block.end + + interface IYourInterface +/// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface +/// ^ storage.type.interface +/// ^ entity.name.interface + { +///^^ meta.interface +// ^ meta.block punctuation.section.block.begin + } +///^^ meta.interface meta.block +// ^ punctuation.section.block.end + + delegate FooBar YourDelegate(int a); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.delegate +/// ^ storage.type.delegate +/// ^ support.type +/// ^ variable.other.member.delegate +/// ^^^^^^^ meta.delegate.parameters +/// ^ storage.type +/// ^ variable.parameter +/// ^ punctuation.terminator + + public delegate FooBar YourDelegate (int a); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.delegate +/// ^^^^^^^^ storage.type.delegate +/// ^^^^^^ support.type +/// ^^^^^^^^^^^^ variable.other.member.delegate +/// ^^^^^^^ meta.delegate.parameters +/// ^ punctuation.section.parameters.begin +/// ^^^ storage.type +/// ^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^ punctuation.terminator + + enum YourEnum +/// ^^^^^^^^^^^^^ meta.enum +/// ^ storage.type.enum +/// ^ entity.name.enum + { +///^^ meta.enum +/// ^ meta.block punctuation.section.block.begin +/// ^ - meta.enum meta.enum + A, B +/// ^ constant.other.enum + }; +///^^ meta.enum meta.block +/// ^ punctuation.section.block.end +/// ^ punctuation.terminator + + public enum Things + { + [Stuff("1")] +/// ^^^^^^^^^^^^ meta.annotation + Item1, +/// ^ constant.other.enum + Item2, + [Stuff] +/// ^^^^^^^ meta.annotation + Item3 + } + + namespace YourNestedNamespace +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.namespace meta.namespace +/// ^ storage.type.namespace +/// ^ entity.name.namespace + { +///^^ meta.namespace +/// ^ meta.block punctuation.section.block.begin + struct YourStruct +/// ^^^^^^^^^^^^^^^^^^^^^ meta.namespace +/// ^^^^^^^^^^^^^^^^^ meta.struct +/// ^ storage.type.struct +/// ^ entity.name.struct + { +/// ^ meta.struct meta.block punctuation.section.block.begin + } +/// ^ meta.struct meta.block punctuation.section.block.end + } +/// ^ meta.namespace meta.block meta.namespace meta.block punctuation.section.block.end + + class InheritingSomething: IYourInterface +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class +/// ^ storage.type.class +/// ^ entity.name.class +/// ^ punctuation.separator +/// ^ entity.other.inherited-class + { +///^^ meta.class +/// ^ meta.block punctuation.section.block.begin + } +///^^ meta.class meta.block +/// ^ punctuation.section.block.end + + class WithGeneric where T1: IEnumerable {} +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class +/// ^^^^^^^^ meta.generic +/// ^ punctuation.definition.generic.begin +/// ^ punctuation.separator.type +/// ^ punctuation.definition.generic.end +/// ^ storage.modifier +/// ^^ support.type +/// ^ entity.other.inherited-class +/// ^^^^ meta.generic +/// ^ punctuation.definition.generic.begin +/// ^^ support.type +/// ^ punctuation.definition.generic.end + +namespace TestNamespace.Test +{ + using NodeName = SomeNamespace.SomeClass; + + public class Derived : Base + { + public Derived(DateTime exportDate) : base(exportDate) { +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^^^^^^ entity.name.function.constructor +/// ^^^^^^^^^^^^^^^^^^ meta.method.constructor +/// ^^^^ variable.language +/// ^^^^^^^^^^^^ meta.group + for (int i = 0; i < items.Count; ++i) +/// ^ keyword.control.loop +/// ^^^^ - meta.group +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^ storage.type +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^ punctuation.terminator +/// ^ variable.other +/// ^ keyword.operator +/// ^ punctuation.terminator +/// ^^ keyword.operator +/// ^ variable.other +/// ^ punctuation.section.group.end + {} +/// ^^ meta.method meta.block meta.block +/// ^ punctuation.section.block.begin +/// ^ punctuation.section.block.end + foreach (int test in collection) +/// ^ keyword.control.loop +/// ^^^^^^^^ - meta.group +/// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^ storage.type +/// ^^^^ variable.other +/// ^^ keyword.control.flow +/// ^^^^^^^^^^ variable.other +/// ^ punctuation.section.group.end + {} +/// ^^ meta.method meta.block meta.block +/// ^ punctuation.section.block.begin +/// ^ punctuation.section.block.end + for (i = 0; i < items.Count; i++) {} +/// ^^^ keyword.control.loop.for +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ - meta.group +/// ^ variable.other +/// ^ keyword.operator.assignment + + if (true) +/// ^ keyword.control +/// ^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end + a = 5; +/// ^ constant.numeric + + if (false) { +/// ^ keyword.control +/// ^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + + } +/// ^ meta.method meta.block meta.block punctuation.section.block.end + + if (false) { +/// ^ keyword.control +/// ^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + + } else { +/// ^ meta.method meta.block meta.block punctuation.section.block.end +/// ^ keyword.control +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + + } +/// ^ meta.method meta.block meta.block punctuation.section.block.end + + switch (foo) { +/// ^^^^^^ keyword.control.flow.switch +/// ^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^ variable.other +/// ^ punctuation.section.group.end +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + case 1: +/// ^ keyword.control +/// ^ constant.numeric +/// ^ punctuation.separator + do_something(); +/// ^ variable.function + break; +/// ^ keyword.control + case BLBodyBattleLibrary.ContextType.TapUp: +/// ^^^^ keyword.control.switch.case +/// ^^^^^^^^^^^^^^^^^^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^^^^^^^^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^^^ constant.other +/// ^ punctuation.separator.case-statement + case BindingFlags.Static: +/// ^^^^ keyword.control.switch.case +/// ^^^^^^^^^^^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^^^^ constant.other +/// ^ punctuation.separator.case-statement + case test: +/// ^^^^ keyword.control.switch.case +/// ^^^^ constant.other +/// ^ punctuation.separator.case-statement + case this.test; +/// ^^^^ keyword.control.switch.case +/// ^^^^ variable.language +/// ^ punctuation.accessor.dot + case 1*2: +/// ^^^^ keyword.control.switch.case +/// ^ constant.numeric +/// ^ keyword.operator +/// ^ constant.numeric +/// ^ punctuation.separator.case-statement + case bar("hello"): +/// ^^^^ keyword.control.switch.case +/// ^^^ variable.function +/// ^ punctuation.section.group.begin +/// ^^^^^^^ string.quoted.double +/// ^ punctuation.section.group.end +/// ^ punctuation.separator.case-statement + break; + case abc.def: +/// ^^^^ keyword.control.switch.case +/// ^^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^ constant.other +/// ^ punctuation.separator.case-statement + default: +/// ^ keyword.control +/// ^ punctuation.separator + do_something_else(); +/// ^ variable.function + break; +/// ^ keyword.control + } +/// ^ meta.method meta.block meta.block punctuation.section.block.end + + while (true) { +/// ^ keyword.control +/// ^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^ constant.language +/// ^ punctuation.section.group.end +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + if (!something()) +/// ^ keyword.control +/// ^^^^^^^^^^^^^^ meta.group + break; + } +/// ^ meta.method meta.block meta.block punctuation.section.block.end + + do { +/// ^ keyword.control +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + something(); + } while (true); +/// ^ meta.method meta.block meta.block punctuation.section.block.end +/// ^ keyword.control +/// ^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^ constant.language +/// ^ punctuation.section.group.end + + try { +/// ^ keyword.control +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + } catch (ArgumentException e) +/// ^ meta.method meta.block meta.block punctuation.section.block.end +/// ^ keyword.control +/// ^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end +/// ^^^^^^^^^^^^^^^^^ support.type +/// ^ variable.other + { +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + } +/// ^ meta.method meta.block meta.block punctuation.section.block.end + catch (FaultException) +/// ^^^^^ keyword.control.trycatch.catch +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^^^^^^^^^^^ support.type +/// ^ punctuation.definition.generic.begin +/// ^^^^^^^^^^^^ support.type +/// ^ punctuation.definition.generic.end +/// ^ punctuation.section.group.end + { +/// ^ punctuation.section.block.begin + throw; +/// ^^^^^ keyword.control.trycatch.throw +/// ^ punctuation + } + catch (FaultException e) +/// ^^^^^ keyword.control.trycatch.catch +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^^^^^^^^^^^ support.type +/// ^ punctuation.definition.generic.begin +/// ^^^^^^^^^^^^ support.type +/// ^ punctuation.definition.generic.end +/// ^ - support - variable +/// ^ variable.other +/// ^ punctuation.section.group.end + { +/// ^ punctuation.section.block.begin + throw; +/// ^^^^^ keyword.control.trycatch.throw +/// ^ punctuation + } +/// ^ punctuation.section.block.end + + try { +/// ^ keyword.control +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + } catch (ArgumentException e) when (e.ParamName == "foo") +/// ^ meta.method meta.block meta.block punctuation.section.block.end +/// ^ keyword.control +/// ^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end +/// ^ keyword.control +/// ^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^ keyword.operator +/// ^^^^ string.quoted.double +/// ^ punctuation.section.group.end + { +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + } catch (System.ArgumentException e) { +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ - meta.group +/// ^ punctuation.section.group.begin +/// ^^^^^^ support.type +/// ^ punctuation.accessor.dot.namespace +/// ^^^^^^^^^^^^^^^^^ support.type +/// ^ variable.other +/// ^ punctuation.section.group.end + System.String blah = "test"; +/// ^^^^^^ support.type +/// ^ punctuation.accessor.dot +/// ^^^^^^ support.type +/// ^^^^ variable.other + } +/// ^ meta.method meta.block meta.block punctuation.section.block.end + + finally { +/// ^ keyword.control +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + var foo = ""; +/// ^ storage.type.variable +/// ^^ string.quoted.double + } +/// ^ meta.method meta.block meta.block punctuation.section.block.end + } + + public virtual void Instantiate(string componentId, out T component) +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^ storage.modifier +/// ^ storage.modifier +/// ^ storage.type +/// ^ entity.name.function +/// ^^^^^^^^^^^ - meta.generic +/// ^^^ meta.generic +/// ^ punctuation.section.parameters.begin +/// ^^^^^^ storage.type +/// ^^^^^^^^^^^ variable.parameter +/// ^ punctuation.separator +/// ^^^ storage.modifier +/// ^ support.type +/// ^^^^^^^^^ variable.parameter + + where T : BaseComponent +/// ^ storage.modifier +/// ^ support.type +/// ^ punctuation.separator +/// ^ entity.other.inherited-class + { + var test = "Test"; +/// ^ storage.type.variable +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^ string.quoted.double +/// ^ punctuation.terminator + } + } +} + + + class YourMainClass +/// ^^^^^^^^^^^^^^^^^^^ meta.class +/// ^ storage.type.class +/// ^ entity.name.class + { +/// ^ meta.class meta.block punctuation.section.block.begin + + public DateTime test1; +/// ^ storage.modifier +/// ^^^^^^^^ support.type +/// ^^^^^ variable.other.member + + public DateTime? test2; +/// ^ storage.modifier +/// ^^^^^^^^ support.type +/// ^ storage.type.nullable +/// ^^^^^ variable.other.member + + private const string _bar = "bar"; +/// ^ storage.modifier +/// ^^^^^ storage.modifier +/// ^ storage.type +/// ^^^^ variable.other.member +/// ^ keyword.operator.assignment +/// ^^^^^ string.quoted.double +/// ^ punctuation.definition.string.begin +/// ^ punctuation.definition.string.end + + static void Main(string[] args) +/// ^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^^^^^ storage.type +/// ^^ meta.brackets +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^^^^ variable.parameter + { +/// ^ meta.class meta.block meta.method meta.block punctuation.section.block.begin + //Your program starts here... + var f = 1e-3f; +/// ^^^ storage.type.variable +/// ^ variable.other +/// ^^^^ constant.numeric +/// ^ storage.type.numeric + var l = 11545L; +/// ^^^ storage.type.variable +/// ^ variable.other +/// ^^^^^ constant.numeric +/// ^ storage.type.numeric + var d = 11545D; +/// ^^^ storage.type.variable +/// ^ variable.other +/// ^^^^^ constant.numeric +/// ^ storage.type.numeric + int x = 1, y = 0; +/// ^^^ storage.type +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^ constant.numeric +/// ^ punctuation.separator +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^ constant.numeric +/// ^ punctuation.terminator + value = x; +/// ^^^^^ variable.language +/// ^ keyword.operator.assignment +/// ^ variable.other +/// ^ punctuation.terminator + const int x = 1; +/// ^ storage.modifier +/// ^ storage.type +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^ constant.numeric +/// ^ punctuation.terminator + } +/// ^ punctuation.section.block.end + + private void MethodWith1Default(int max, string path = null) { } +/// ^ storage.modifier +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^ entity.name.function +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.parameters +/// ^^^ storage.type +/// ^^^ variable.parameter +/// ^ punctuation.separator +/// ^^^^^^ storage.type +/// ^^^^ variable.parameter +/// ^ keyword.operator.assignment +/// ^^^^ constant.language + + internal void MethodWith2Default(int max = -1, string path = null){ } +/// ^ storage.modifier +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^ entity.name.function +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.parameters +/// ^^^ storage.type +/// ^^^ variable.parameter +/// ^ keyword.operator.assignment +/// ^ constant.numeric +/// ^ punctuation.separator +/// ^^^^^^ storage.type +/// ^^^^ variable.parameter +/// ^ keyword.operator.assignment +/// ^^^^ constant.language + + partial void MethodWithTypeParam(T x){ do_something(); } +/// ^ storage.modifier +/// ^^^ entity.name.function +/// ^^^ meta.generic +/// ^ punctuation.definition.generic.begin +/// ^ support.type +/// ^ support.type +/// ^ variable.parameter +/// ^ variable.function + + List>>> reallyNestedTypes; +/// ^^^^ support.type +/// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic +/// ^^^^ support.type +/// ^^^^^^^^^^^^^^^^^^^ meta.generic meta.generic +/// ^^^^ support.type +/// ^^^^^^^^^^^^^ meta.generic meta.generic meta.generic +/// ^^^^ support.type +/// ^^^^^^^ meta.generic meta.generic meta.generic meta.generic +/// ^^^^^ storage.type +/// ^ variable.other.member + + IEnumerator IEnumerable.GetEnumerator() +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method +/// ^^^^^^^^^^^ entity.other.inherited-class +/// ^^^^^ meta.generic +/// ^^^ storage.type +/// ^^^^ entity.name.function + { + return new MyCustomIterator(this); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instance +/// ^ keyword.operator.new +/// ^^^^^^^^^^^^^^^^ support.type +/// ^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^ variable.language +/// ^ punctuation.section.group.end + } + + IEnumerable Traverse() + { + yield return 7; +/// ^ keyword.control.flow.return +/// ^ keyword.control.flow.return + yield return 42; + yield return 314; + } + + List.this[int key]{ get; set; } +/// ^ support.type +/// ^^^^^ meta.generic +/// ^ punctuation.definition.generic.begin +/// ^ punctuation.definition.generic.end +/// ^ punctuation.accessor +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.property +/// ^^^^^^^^^^^^^^^ - meta.method +/// ^ - meta.method +/// ^^^ - meta.method +/// ^^^^ variable.language +/// ^^^^^^^^^ meta.brackets +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^^^ storage.type +/// ^^^ variable.parameter +/// ^^^ storage.type.function.accessor +/// ^^^ storage.type.function.accessor + + + ///////////////////////////// + // methods with attributes // + ///////////////////////////// + + [Route("api/helloworld")] +/// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation +/// ^ punctuation.definition.annotation.begin +/// ^^^^^ variable.annotation +/// ^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^^^^^^^^^^^^^^^^ string +/// ^ punctuation.section.group.end +/// ^ punctuation.definition.annotation.end + string Get([FromUri] string name) => $"Hello {name}"; +/// ^^^^^^^^^ meta.annotation +/// ^ punctuation.definition.annotation.begin +/// ^^^^^^^ variable.annotation +/// ^ punctuation.definition.annotation.end +/// ^^^^^ storage.type + + // examples from: https://msdn.microsoft.com/en-us/library/mt653979.aspx + // applies to method + [method: SomeAttr] +/// ^^^^^^^^^^^^^^^^^^ meta.annotation +/// ^ punctuation.definition.annotation.begin +/// ^^^^^^ storage.modifier.target +/// ^ punctuation.separator +/// ^^^^^^^^ variable.annotation +/// ^ punctuation.definition.annotation.end + int Method2() { return 0; } + + // applies to return value + [return: SomeAttr] +/// ^^^^^^^^^^^^^^^^^^ meta.annotation +/// ^ punctuation.definition.annotation.begin +/// ^^^^^^ storage.modifier.target +/// ^ punctuation.separator +/// ^^^^^^^^ variable.annotation +/// ^ punctuation.definition.annotation.end + int Method3() { return 0; } + + [AcceptVerbs(HttpVerbs.Post)] +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation +/// ^^^^^^^^^^^ variable.annotation +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end + [ValidateAntiForgeryToken] +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation +/// ^^^^^^^^^^^^^^^^^^^^^^^^ variable.annotation + [JsonHandleError] +/// ^^^^^^^^^^^^^^^^^ meta.annotation +/// ^^^^^^^^^^^^^^^ variable.annotation + public virtual ActionResult Process([ModelBinder(typeof(MyModelBinder))] +/// ^ entity.name.function +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation +/// ^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^^^^^^ keyword.operator +/// ^^^^^^^^^^^^^^^ meta.group meta.group +/// ^^^^^^^^^^^^^ support.type + [Bind(Prefix = "MyContent")] MyProcessModel model) +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation +/// ^^^^ variable.annotation +/// ^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^^^^^^ variable.parameter +/// ^ keyword.operator.assignment +/// ^^^^^^^^^^^ string.quoted.double + { + } + + int Method4 => 5; +/// ^^^ storage.type +/// ^^^^^^^ variable.other.member +/// ^^^^ meta.method +/// ^^ storage.type.function +/// ^ constant.numeric +/// ^ punctuation.terminator + + delegate int del(int i); +/// ^^^^^^^^^^^^^^^^^^^^^^^ meta.delegate +/// ^ storage.type.delegate +/// ^ storage.type +/// ^ variable.other.member.delegate +/// ^^^^^^^ meta.delegate.parameters +/// ^ storage.type +/// ^ variable.parameter + + public delegate TOutput Converter (TInput from); +/// ^ storage.modifier +/// ^ storage.type.delegate +/// ^ support.type +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.delegate +/// ^ variable.other.member.delegate +/// ^^^^^^^^^^^^^^^^^ meta.generic +/// ^ punctuation.definition.generic.begin +/// ^^^^^^ support.type +/// ^ punctuation.separator +/// ^^^^^^^ support.type +/// ^ punctuation.definition.generic.end +/// ^^^^^^^^^^^^^ meta.delegate.parameters +/// ^ - meta.delegate meta.delegate +/// ^ support.type +/// ^ variable.parameter + + void CodeContainingLambdas(){ + + del square = x => x * x; +/// ^^^ support.type +/// ^^^ variable.other +/// ^ keyword.operator.assignment +/// ^^^^^^^^ meta.function.anonymous +/// ^^ storage.type.function.lambda + Func times2 = x => x + x; +/// ^^^ support.type +/// ^^^ variable.other +/// ^ keyword.operator.assignment +/// ^^^^^^^^^^ meta.function.anonymous +/// ^^ storage.type.function.lambda + + var changes = refs.ToDictionary(kvp => kvp.key, arg => k + 5); +/// ^^^^^^^^^^^^^^ meta.function.anonymous.cs +/// ^^^ variable.parameter.cs +/// ^^ storage.type.function.lambda.cs +/// ^^^ variable.other.cs +/// ^ punctuation.separator.argument.cs +/// ^^ - meta.function.anonymous +/// ^^^^^^^^^^^^ meta.function.anonymous.cs +/// ^^^ variable.parameter.cs +/// ^^ storage.type.function.lambda.cs +/// ^ variable.other.cs +/// ^ keyword.operator.cs +/// ^ constant.numeric.integer.decimal.cs +/// ^ - meta.function.anonymous + + var shortDigits = digits.Where((digit, index) => digit.Length < index); +/// ^ - meta.function.anonymous +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.anonymous.cs +/// ^ - meta.function.anonymous +/// ^ punctuation.section.group.begin.cs +/// ^^^^^^^^^^^^^^ meta.group.cs +/// ^^^^^ variable.parameter.cs +/// ^ punctuation.separator.parameter.function.cs +/// ^^^^^ variable.parameter.cs +/// ^ punctuation.section.group.end.cs +/// ^^ storage.type.function.lambda.cs +/// ^^^^^ variable.other.cs + + } + + void CodeContainingConstructors(){ + var array = new []{ "foo" }; +/// ^^^^^^^^^^^^^^^ meta.instance +/// ^^ meta.brackets.cs +/// ^^^^^^^^^ meta.braces +/// ^ punctuation.section.braces.begin +/// ^ punctuation.section.braces.end + + var arrayWithType = new string[] { "foobar" }; +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instance +/// ^^^^^^^^^^^^ meta.braces +/// ^ punctuation.section.braces.begin +/// ^ punctuation.section.braces.end + + var list = new List { "coconuts", "horses" }; +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instance +/// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.braces +/// ^ punctuation.section.braces.begin +/// ^ punctuation.section.braces.end + var dictionary = new Dictionary +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.instance + { +/// ^ meta.instance meta.braces punctuation.section.braces.begin + ["woman"] = "floating", + ["floating"] = "wood" + }; +/// ^ meta.instance meta.braces punctuation.section.braces.end + + var anonymous = new { +/// ^^^^^ meta.instance +/// ^ meta.class.body punctuation.section.block.begin + Wood = "burning", +/// ^^^^ variable.other.member +/// ^ keyword.operator.assignment +/// ^^^^^^^^^ string.quoted.double +/// ^ punctuation.separator + Burning = "sorcerer" +/// ^^^^^^^ variable.other.member +/// ^ keyword.operator.assignment +/// ^^^^^^^^^^ string.quoted.double + }; +/// ^ meta.instance meta.class.body punctuation.section.block.end + + var anonArray = new[] +/// ^^^^^ meta.instance +/// ^^ meta.brackets + { +/// ^ meta.instance meta.braces punctuation.section.braces.begin + new { name = "apple", diam = 4 }, +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.body.anonymous +/// ^punctuation.section.block.begin +/// ^^^^ variable.other.member +/// ^ keyword.operator.assignment +/// ^^^^^^^ string.quoted.double +/// ^ punctuation.separator +/// ^^^^ variable.other.member +/// ^ keyword.operator.assignment +/// ^ constant.numeric +/// ^ punctuation.section.block.end + new { name = "grape", diam = 1 } +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.body.anonymous +/// ^ punctuation.section.block.begin +/// ^^^^ variable.other.member +/// ^ keyword.operator.assignment +/// ^^^^^^^ string.quoted.double +/// ^ punctuation.separator +/// ^^^^ variable.other.member +/// ^ keyword.operator.assignment +/// ^ constant.numeric +/// ^ punctuation.section.block.end + }; +/// ^ meta.instance meta.braces punctuation.section.braces.end + + new System.Drawing.Point(6, 11) { X = 5, Y = 10 }; +/// ^^^^^^ support.type +/// ^ punctuation +/// ^^^^^^^ support.type +/// ^ punctuation +/// ^^^^^ support.type +/// ^ punctuation.section.group.begin +/// ^ constant.numeric +/// ^ punctuation.separator.argument +/// ^^ constant.numeric +/// ^ punctuation.section.group.end +/// ^ punctuation.section.braces.begin +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^ constant.numeric +/// ^ punctuation.separator +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^^ constant.numeric +/// ^ punctuation.section.braces.end +/// ^ punctuation.terminator.statement + new System.Drawing.Point(6, 11) + { X = 5, Y = 10 }; +/// ^ punctuation.section.braces.begin +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^ constant.numeric +/// ^ punctuation.separator +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^^ constant.numeric +/// ^ punctuation.section.braces.end +/// ^ punctuation.terminator.statement + } +/// ^ punctuation.section.block + + void TestMethod(int argument) { + if (argument <= 0) + throw new ArgumentException("Value must be positive", nameof(argument)); +/// ^ keyword.other +/// ^ variable.other + nameof(TestMethod); +/// ^ keyword.other +/// ^ support.type + nameof(int); +/// ^ keyword.other +/// ^ storage.type + nameof(YourNamespace.foo); +/// ^ keyword.other +/// ^ support.type +/// ^^^^^ meta.generic +/// ^ punctuation.accessor +/// ^ variable.other + } + + #region Empty region 01 // not a comment ! +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor +/// ^^^^^^^ keyword.other.preprocessor +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.section +/// ^^^^^^^ - comment + + #endregion Empty region 01 +/// ^^^^^^^^^^ keyword.other.preprocessor +/// ^^^^^^^^^^^^^^^ variable.other.section + } +/// ^ punctuation.section.block.end + + + void TestMe () { + a = b => b * 2; +/// ^^ storage.type.function.lambda +/// ^^^^^^^^ meta.function.anonymous +/// ^ punctuation.terminator.statement - meta.function.anonymous + + try +/// ^^^ keyword.control.trycatch.try + { + + } + catch (InvalidOperationException ex) +/// ^^^^^ keyword.control.trycatch.catch + { + + } + finally +/// ^^^^^^^ keyword.control.trycatch.finally + { + + } + + a = b => { return b * 2; }; +/// ^^ meta.function.anonymous storage.type.function.lambda +/// ^ meta.function.anonymous punctuation.section.block.begin +/// ^ punctuation.section.block.end +/// ^ punctuation.terminator.statement - meta.function.anonymous + + try +/// ^^^ keyword.control.trycatch.try + { + + } + catch (InvalidOperationException ex) +/// ^^^^^ keyword.control.trycatch.catch + { + + } + finally +/// ^^^^^^^ keyword.control.trycatch.finally + { + } + + a = (b, c) => { return b * c; }; +/// ^ variable.parameter +/// ^ punctuation.separator +/// ^ variable.parameter +/// ^^ storage.type.function.lambda +/// ^ meta.function.anonymous punctuation.section.block.begin +/// ^ punctuation.section.block.end +/// ^ punctuation.terminator.statement - meta.function.anonymous + + try +/// ^^^ keyword.control.trycatch.try + { + + } + catch (InvalidOperationException) +/// ^^^^^ keyword.control.trycatch.catch +/// ^^^^^^^^^^^^^^^^^^^^^^^^^ support.type + { + + } + finally +/// ^^^^^^^ keyword.control.trycatch.finally + { + } + + Func test = (a, b) => a.len(); +/// ^^^^^^^^^^^^^^^^^ meta.function.anonymous +/// ^^^^^^ meta.group +/// ^ variable.parameter +/// ^ punctuation.separator.parameter.function +/// ^ variable.parameter +/// ^^ storage.type.function.lambda +/// ^ punctuation.terminator.statement +/// ^ - meta.function.anonymous + + goto abc; +/// ^^^^ keyword.control.flow.goto +/// ^^^ constant.other.label + abc: +/// ^^^ entity.name.label +/// ^ punctuation.separator + + switch (test[0]) + { + case 'a': + result += 4; + goto case 'b'; +/// ^^^^ keyword.control.flow.goto +/// ^^^^ keyword.control.switch.case +/// ^^^ constant.character +/// ^ punctuation.terminator.statement + case 'b': +/// ^^^^ keyword.control.switch.case - invalid +/// ^^^ constant.character +/// ^ punctuation.separator.case-statement + result += 6; + break; + case 'c': + result += 8; + break; + } + + int foo; + int.TryParse(input, out foo); +/// ^^^ storage.modifier.argument +/// ^^^ variable.other - support.type + int.TryParse(input, out foo /* comment */); +/// ^^^ storage.modifier.argument +/// ^^^ variable.other - support.type + + "hello".OfType().Where(c => c == 'l').Count()); +/// ^ invalid.illegal.stray.brace + + var test = (Action)(() => "hello".Dump()); +/// ^^^^^^ meta.cast support.type +/// ^ punctuation.section.group.begin +/// ^^ meta.function.anonymous meta.group +/// ^^ storage.type.function.lambda +/// ^ punctuation.section.group.end + test = (Action)(() => {}); +/// ^^^^^^^^ meta.cast +/// ^ meta.group punctuation.section.group.begin +/// ^^^^^^^ meta.function.anonymous +/// ^ meta.group punctuation.section.group.begin +/// ^ meta.group punctuation.section.group.end +/// ^^ storage.type.function.lambda +/// ^ punctuation.section.block.begin +/// ^ punctuation.section.block.end +/// ^ meta.group punctuation.section.group.end + test.Invoke(); + + // https://msdn.microsoft.com/en-us/library/txafckwd(v=vs.110).aspx +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link + formatted = string.Format("date {0:dddd MMMM}.", DateTime.Now); +/// ^^^^^^^^^^^^^ constant.other.placeholder +/// ^ - constant + + string[] names = { "Adam", "Bridgette", "Carla", "Daniel", + "Ebenezer", "Francine", "George" }; + decimal[] hours = { 40, 6.667m, 40.39m, 82, 40.333m, 80, 16.75m }; +/// ^^^^^^^ storage.type +/// ^^ meta.brackets +/// ^^^^^ variable.other + + int?[] test; +/// ^^^^ storage.type +/// ^^ meta.brackets +/// ^^^^ variable.other + + test[ hello] = 2; +/// ^^^^ variable.other +/// ^^^^^ variable.other +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end + test[ 5 ] = 2; +/// ^^^^ variable.other +/// ^ constant.numeric +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end + + Console.WriteLine("{0,-20} {1,5}\n", "Name", "Hours"); +/// ^^^^^^^ constant.other.placeholder - invalid +/// ^ string - constant +/// ^^^^^ constant.other.placeholder - invalid +/// ^^ constant.character.escape + for (int ctr = 0; ctr < names.Length; ctr++) + Console.WriteLine("{0,-20} {1,5:N1}", names[ctr], hours[ctr]); +/// ^^^^^^^^^^^^^^^^^^ string.quoted.double - invalid +/// ^^^^^^^ constant.other.placeholder +/// ^ - constant +/// ^^^^^^^^ constant.other.placeholder + + int MyInt = 100; + Console.WriteLine("{0:C}", MyInt); +/// ^^^^^ constant.other.placeholder - invalid +/// ^ punctuation.definition.placeholder.begin +/// ^ punctuation.definition.placeholder.end +/// ^ punctuation.definition.string.end + // The example displays the following output + // if en-US is the current culture: + // $100.00 + formatted = string.Format(@"Price = |{0,-10:C}|", myInt); +/// ^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +/// ^^^^^^^^^ constant.other.placeholder - invalid +/// ^ punctuation.definition.placeholder.begin +/// ^ punctuation.definition.placeholder.end + formatted = string.Format("{00}G}}", myInt); +/// ^^^^ constant.other.placeholder - invalid +/// ^ - constant +/// ^^ constant.character.escape + formatted = string.Format("{0{{G{}", myInt); +/// ^ punctuation.definition.placeholder.begin +/// ^^^^ invalid.illegal.unexpected-character-in-placeholder +/// ^ punctuation.definition.placeholder.end + + formatted = string.Format("{0}{1:D}{2}\"{1:", "{", myInt, "}"); +/// ^^^^^^^^^^^ constant.other.placeholder - invalid +/// ^^ constant.character.escape +/// ^^ constant.other.placeholder - invalid +/// ^ invalid.illegal.unclosed-string-placeholder +/// ^ punctuation.definition.string.end +/// ^ string - invalid - constant.other - punctuation + formatted = string.Format("{0", myInt); +/// ^^ constant.other.placeholder +/// ^ invalid.illegal.unclosed-string-placeholder + formatted = string.Format("{1:\", {", myInt, "}"); +/// ^^^^^^^^ constant.other.placeholder +/// ^^ constant.character.escape +/// ^^^ invalid.illegal.unclosed-string-placeholder +/// ^ punctuation.definition.string.end + formatted = string.Format("{1:\",{{}} {}", myInt, "}"); +/// ^^^^^^^^^^^^^ constant.other.placeholder +/// ^ punctuation.definition.placeholder.begin +/// ^^ constant.character.escape +/// ^^^^ constant.character.escape +/// ^ invalid.illegal.unescaped-placeholder +/// ^ punctuation.definition.placeholder.end + formatted = string.Format(@"{0:00.00000{{}}test""} me", 5); +/// ^^^^^^^^^^^^^^^^^^^^^^ constant.other.placeholder - invalid +/// ^^^^ constant.character.escape +/// ^ punctuation.definition.placeholder.end + formatted = string.Format(test, hello == true, world); +/// ^^^^^ variable.other - variable.parameter +/// ^^^^^ variable.other - variable.parameter +/// ^^ keyword.operator - keyword.operator.assignment + formatted = string.Format(@"GMT is {0:yyyyMMdd\THHmmss\Z}", DateTime.Now.ToUniversalTime()); +/// ^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.raw constant.other.placeholder + formatted = string.Format("GMT is {0:yyyyMMdd\\THHmmss\\Z}", DateTime.Now.ToUniversalTime()); +/// ^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double constant.other.placeholder + Console.WriteLine($@"GMT is {DateTime.Now:yyyyMMdd\THHmmss\Z}"); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated +/// ^ punctuation.separator +/// ^^^^^^^^^^^^^^^^^^^ constant.other.format-spec + Console.WriteLine($"GMT is {DateTime.Now:yyyyMMdd\THHmmss\Z}"); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated +/// ^ punctuation.separator +/// ^^^^^^^^^^^^^^^^^^^ constant.other.format-spec +/// ^ invalid.illegal.lone-escape +/// ^ invalid.illegal.lone-escape + Console.WriteLine($@"GMT is {DateTime.Now:yyyyMMdd\T\""\x1043HHmmss\Z}"); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.format-spec - invalid +/// ^^^^^^^ constant.character.escape +/// ^^^^^^^^^^ - constant.character.escape +/// ^^ constant.character.escape + } +} +///<- punctuation.section.block.end +} +/// <- invalid.illegal.stray.brace + +class Test +{ + void Abc() + { + Something.SomeMethod(]; +/// ^ meta.function-call meta.group punctuation.section.group.begin +/// ^ invalid.illegal.stray.brace +/// ^ invalid.illegal.expected-close-paren + } +/// ^ - invalid.illegal.stray.brace +} + +void Main () { // method outside a class, i.e. a LINQPad script +///^ storage.type +/// ^^^^ entity.name.function +} +/// <- punctuation.section.block.end + +public class AfterTopLevelMethod { +///^^^ storage.modifier.access +/// ^^^^^ storage.type.class +/// ^^^^^^^^^^^^^^^^^^^ entity.name.class + + // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/events/how-to-implement-custom-event-accessors + protected event EventHandler IDrawingObject.OnDraw +/// ^^^^^^^^^ storage.modifier.access +/// ^^^^^ storage.modifier +/// ^^^^^^^^^^^^ support.type +/// ^^^^^^^^^^^^^^ entity.other.inherited-class +/// ^ punctuation.accessor.dot +/// ^^^^^^ variable.other.member + { +/// ^ punctuation.section.block.begin + add +/// ^^^ meta.method storage.type.function.accessor.add + { +/// ^ punctuation.section.block.begin + lock (objectLock) +/// ^^^^ keyword.control.other.lock +/// ^^^^^^^^^^ variable.other + { + PreDrawEvent += value; + } + } +/// ^ punctuation.section.block.end +/// ^ - meta.method + remove +/// ^^^^^^ meta.method storage.type.function.accessor.remove + { + lock (objectLock) + { + PreDrawEvent -= value; + } + } + } +/// ^ punctuation.section.block.end + + public event SampleEventHandler SampleEvent; +/// ^^^^^^ storage.modifier.access +/// ^^^^^ storage.modifier +/// ^^^^^^^^^^^^^^^^^^ support.type +/// ^^^^^^^^^^^ variable.other.member +/// ^ punctuation.terminator.statement +} diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_Generics.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_Generics.cs new file mode 100755 index 000000000..9c1a49c37 --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_Generics.cs @@ -0,0 +1,164 @@ +/// SYNTAX TEST "Packages/C#/C#.sublime-syntax" + +List l; +/// <- support.type +/// ^ storage.type +/// ^ variable.other +List> ll; +/// <- support.type +/// ^ support.type +/// ^ storage.type +/// ^ variable.other +List>> lll; +/// <- support.type +/// ^ support.type +/// ^ support.type +/// ^ storage.type +/// ^ variable.other + x = 1; +/// ^ variable.other.cs + int x = 1; +/// ^ storage.type +/// ^ variable.other + int x1 = 1, x2 = 2; +/// ^ storage.type +/// ^ variable.other +/// ^ variable.other + + foo(a); +/// ^ variable.function +/// ^ storage.type + +Foo.List l; +/// ^ variable.other +Foo.l + 1; +/// ^ variable.other +Foo.List l; +/// ^^ support.type +/// ^ variable.other + +List bar = new List(); +/// <- support.type +/// ^^^ storage.type +/// ^^^^ support.type +/// ^^^ storage.type + +List> list; +///^ support.type +/// ^ punctuation.definition.generic.begin +/// ^^^^^^^^ support.type +/// ^ punctuation.definition.generic.begin +/// ^^^^^^ support.type +/// ^ punctuation.accessor.dot +/// ^^^^^ support.type +/// ^^ punctuation.definition.generic.end +/// ^^^^ variable.other + +string verbatim = @"This is a test "" of a verbatim string literal - C:\User"; +/// ^^ string.quoted.double punctuation.definition.string +/// ^^ constant.character.escape +/// ^ string.quoted.double - constant +/// ^ string.quoted.double punctuation.definition.string + +string interpolated = $"{t.Word}"; +string interpolated = $"inner {t.Word,-30} {t.Responsibility,8:F2} {{"; +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated +/// ^ variable.other +/// ^ punctuation.separator +/// ^^^ constant.numeric.integer.decimal +/// ^ punctuation.section.interpolation.end +/// ^ punctuation.section.interpolation.begin +/// ^ variable.other +/// ^ punctuation.separator +/// ^ constant.numeric.integer.decimal +/// ^ punctuation.separator +/// ^^ constant.other.format-spec +/// ^^ constant.character.escape +/// ^ punctuation.definition.string.end + +string unclosed_string = "inner ; +/// ^ invalid.illegal.unclosed-string +string bar = "bar" +/// <- storage.type + +string unclosed_interpolation = $"inner {t.Word}; +/// ^ invalid.illegal.unclosed-string.cs +string foo = "foo"; +/// <- storage.type + +string long_interpolation = $@" + inner {t.Word} +/// ^ punctuation.section.interpolation.begin +/// ^ variable.other +/// ^ punctuation.section.interpolation.end + {t.Responsibility,8:F2} +"; +/// <- punctuation.definition.string.end + +string unclosed_interpolation = $"inner { +/// ^ punctuation.section.interpolation.begin.cs +/// ^ invalid.illegal.unclosed-string.cs + +/// <- - string + +string unclosed_interpolation = $"inner {2} +/// ^ punctuation.section.interpolation.begin.cs +/// ^ constant.numeric.integer.decimal.cs +/// ^ punctuation.section.interpolation.end.cs +/// ^ invalid.illegal.unclosed-string.cs + +string format_string = "{0} and {1} like to go {{crazy}}"; +/// ^ string +/// ^^^ constant.other.placeholder.cs +/// ^^^ constant.other.placeholder.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs + +string format_string_long = @"{0} and +/// ^^ string +/// ^^^ constant.other.placeholder.cs +foo {1} like to go {{crazy}}"; +/// ^^^ constant.other.placeholder.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs + +string format_string_2 = "{}"; +/// ^^ string - constant.other.placeholder.cs + + +x[10][5] = 2; +f(5)[2] = 10; +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end + +int? foo = 4; + +string Permute(string input) +/// ^^^ entity.name.function +{ + char[] charArray = input.ToCharArray(); + Array.Reverse(charArray); + return new string(charArray); +} + +private string DontPermute(string input) +/// ^^^ storage.modifier +/// ^^^ entity.name.function +{ + return input; +} + + +string Frag +{ +/// <- punctuation.section.block.begin + get +/// ^^^ - storage.type.function + { +/// ^ punctuation.section.block.begin + var list = new List(); + return list; + } // <-- This and the next "}" are marked "invalid" +/// ^ punctuation.section.block.end - invalid +} +/// <- punctuation.section.block.end diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_HelloWorld.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_HelloWorld.cs new file mode 100755 index 000000000..1c10dd15d --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_HelloWorld.cs @@ -0,0 +1,49 @@ +/// SYNTAX TEST "Packages/C#/C#.sublime-syntax" + +// A Hello World! program in C#. +///<- comment.line +using System; +///<- keyword.control.import +/// ^ meta.path +/// ^ punctuation.terminator.cs + +namespace HelloWorld +///^^^^^^^^^^^^^^^^^ meta.namespace +///<- storage.type.namespace +/// ^ entity.name.namespace +{ +///<- meta.namespace meta.block punctuation.section.block.begin + class Hello +/// ^ storage.type.class +/// ^ entity.name.class + { +/// ^ punctuation.section.block.begin + static void Main() +/// ^ storage.modifier +/// ^ storage.type +/// ^ entity.name.function +/// ^ punctuation.section.parameters.end + + { +/// ^ punctuation.section.block.begin + Console.WriteLine("Hello World!"); +/// ^ punctuation.accessor.dot +/// ^ variable.function +/// ^ punctuation.section.group.begin +/// ^ punctuation.definition.string +/// ^ punctuation.definition.string +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator + // Keep the console window open in debug mode. +/// ^ punctuation.definition.comment +/// ^ comment.line + Console.WriteLine ("Press any key to exit."); +/// ^ variable.function +/// ^ punctuation.section.group.begin + Console.ReadKey(); + } +/// ^ punctuation.section.block.end + } +/// ^ punctuation.section.block.end +} +///<- meta.namespace meta.block punctuation.section.block.end diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_Operators.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_Operators.cs new file mode 100755 index 000000000..fe7104e19 --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_Operators.cs @@ -0,0 +1,107 @@ +/// SYNTAX TEST "Packages/C#/C#.sublime-syntax" + +int? length = customers?.Length; +/// <- storage.type +///^ storage.type.nullable +/// ^ variable.other +/// ^^ punctuation.accessor.null-coalescing + +Customer? first = customers?[0]; +/// <- support.type +/// ^ storage.type.nullable +/// ^^^^ meta.brackets +/// ^^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end + +Customer second = customers[0]; +/// <- support.type +/// ^ variable.other +/// ^^^ meta.brackets +/// ^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end + +int? count = customers?[0]?.Orders?.Count(); +///^ storage.type.nullable +/// ^ variable.other +/// ^ keyword.operator.assignment +/// ^^^^ meta.brackets +/// ^^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^^ punctuation.accessor.null-coalescing +/// ^^ punctuation.accessor.null-coalescing +/// ^^^^^^^ meta.function-call + +A?.B?.C?[0] ?? E; +/// ^^ punctuation.accessor.null-coalescing +/// ^^ punctuation.section.brackets.begin +/// ^^ keyword.operator +/// ^ punctuation.terminator + +A?.B?.C?[0] == E; + /// <- punctuation.accessor.null-coalescing + /// <- punctuation.accessor.null-coalescing +/// ^^ punctuation.accessor.null-coalescing +/// ^^^^ meta.brackets +/// ^^ punctuation.section.brackets.begin +/// ^ punctuation.section.brackets.end +/// ^^ keyword.operator +/// ^ punctuation.terminator + + x->y; +/// ^^ punctuation.accessor.arrow +/// ^ punctuation.terminator + + (*x).y; +/// ^ keyword.operator.pointer +/// ^ punctuation.accessor.dot +/// ^ punctuation.terminator + + var c = 5 * 4; +/// ^ constant.numeric.integer.decimal +/// ^ keyword.operator +/// ^ - keyword.operator.pointer +/// ^ constant.numeric.integer.decimal + + x >>= y +/// ^^^ keyword.operator + + x = x >> y +/// ^ keyword.operator.assignment +/// ^^ keyword.operator + +condition ? first_expression : second_expression; +/// ^ keyword.operator.ternary +/// ^ keyword.operator.ternary + + ((Test.Example . State)item.State).ToString(); +/// ^^^^^^^^^^^^^^^^^^^^^^ meta.cast +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end +/// ^^^^ variable.other - meta.cast +/// ^^^^ support.type +/// ^ punctuation.separator.namespace +/// ^^^^^^^ support.type +/// ^ punctuation.separator.namespace +/// ^^^^^ support.type + + (int)test.example(abc); +/// ^^^^^ meta.cast +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end +/// ^^^ storage.type +/// ^^^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^^^^^ meta.function-call variable.function +/// ^^^^^ meta.group - meta.cast +/// ^ punctuation.section.group.begin +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + + (string)((SomeClass)test).value; +/// ^^^^^^^^ meta.cast +/// ^^^^^^ storage.type +/// ^ meta.group - meta.cast +/// ^^^^^^^^^^^ meta.cast +/// ^^^^^^^^^ support.type +/// ^^^^ variable.other +/// ^ meta.group - meta.cast diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_PreprocessorDirectives.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_PreprocessorDirectives.cs new file mode 100755 index 000000000..bc5338cde --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_PreprocessorDirectives.cs @@ -0,0 +1,70 @@ +/// SYNTAX TEST "Packages/C#/C#.sublime-syntax" + +#define DEBUG +/// ^^ entity.name.constant +#define MYTEST +#undef DEBUG + +using System; +#pragma warning disable warning-list +// ^ keyword.other.preprocessor +// ^ keyword.other.preprocessor +#pragma warning restore warning-list +#pragma checksum "file.cs" "{3673e4ca-6098-4ec1-890f-8fceb2a794a2}" "{012345678AB}" // New checksum +// ^ keyword.other.preprocessor +// ^ stirng.quoted.double +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal + +#region +/// ^^ meta.preprocessor keyword.other.preprocessor +#region MyClass definition +/// ^^ meta.preprocessor keyword.other.preprocessor +/// ^^ meta.preprocessor entity.name.section +public class MyClass +{ + static void Main() + { +#if (DEBUG && !MYTEST) + Console.WriteLine("DEBUG is defined"); +#elif (!DEBUG && MYTEST) + Console.WriteLine("MYTEST is defined"); +#elif (DEBUG && MYTEST) +/// ^^ keyword.operator + Console.WriteLine("DEBUG and MYTEST are defined"); +#else + Console.WriteLine("DEBUG and MYTEST are not defined"); +#endif + +# if DEBUG +/// ^^ meta.preprocessor keyword.control.preprocessor +/// ^^ constant.other.flag +#error DEBUG is defined // comment +/// ^^ meta.preprocessor keyword.other.preprocessor +/// ^^ string.unquoted +/// ^^ string.unquoted +/// ^ - comment + +#warning Deprecated code in this method. +#endif + +#line 200 "Special" +/// ^ meta.preprocessor keyword.other.preprocessor +/// ^^^ constant.numeric +/// ^^^^^^^^^ string + int i; // CS0168 on line 200 + int j; // CS0168 on line 201 +#line default +/// ^ meta.preprocessor keyword.other.preprocessor + char c; // CS0168 on line 31 + float f; // CS0168 on line 32 +#line hidden // numbering not affected +/// ^ meta.preprocessor keyword.other.preprocessor + string s; + double d; // CS0168 on line 35 + } +} +#endregion a / b +// ^^ storage.type.section +// ^^^^^ variable.other.section +#endregion +// ^^ storage.type.section diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_Strings.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_Strings.cs new file mode 100644 index 000000000..3f3c22147 --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_Strings.cs @@ -0,0 +1,56 @@ +/// SYNTAX TEST "Packages/C#/C#.sublime-syntax" + +"short unicode \u1234"; +///<- string.quoted.double.cs +/// ^^^^^^ constant.character.escape.cs + +"long unicode \U12345678"; +///<- string.quoted.double.cs +/// ^^^^^^^^^^ constant.character.escape.cs + +"invalid escape \u12"; +///<- string.quoted.double.cs +/// ^ invalid.illegal.lone-escape.cs + +"simple escapes \' \" \\ \0 \a \b \f \n \r \t \v"; +///<- string.quoted.double.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs +/// ^^ constant.character.escape.cs + +var literal = "foo"; +/// ^^^^^ string.quoted.double +var interpolated_none = $"foo"; +/// ^^^^^^ meta.string.interpolated.cs string.quoted.double.cs +var interpolated_yes = $"foo {bar} foo"; +/// ^^^^^^^^^^^^^^^^ meta.string.interpolated.cs +var verbatim_singleline = @"foo"; +/// ^^^^^^ string.quoted.double.raw.cs +var verbatim_singleline_interpolated_none = $@"foo bar"; +/// ^^^^^^^^^^^ meta.string.interpolated.cs string.quoted.double.raw.cs +var verbatim_singleline_interpolated_yes = $@"foo {bar} foo"; +/// ^^^^^^^ string.quoted.double.raw.cs +/// ^^^^^^^^^^^^^^^^^ meta.string.interpolated.cs +var verbatim_multiline = @"foo bar +/// ^^^^^^^^^^ string.quoted.double.raw.cs +baz"; +var verbatim_multiline_interpolated_none = $@"foo bar +/// ^^^^^^^^^^^ meta.string.interpolated.cs string.quoted.double.raw.cs +baz"; +var verbatim_multiline_interpolated_yes = $@"foo {bar} +/// ^^^^^^ string.quoted.double.raw.cs +/// ^^^^^^^^^^^^ meta.string.interpolated.cs +baz"; + + "{32F31D43-81CC-4C15-9DE6-3FC5453562B6}" +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.guid + diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_Using.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_Using.cs new file mode 100755 index 000000000..09e1a46a1 --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_Using.cs @@ -0,0 +1,176 @@ +/// SYNTAX TEST "Packages/C#/C#.sublime-syntax" +using System.Text; +/// <- keyword.control.import +/// ^ meta.path +/// ^ punctuation.separator.namespace +/// ^ meta.path +/// ^ punctuation.terminator +using static System.Math.Foo; +/// <- keyword.control.import +/// ^ keyword.control.import +/// ^ meta.path +using Project = PC.MyCompany.Project; +/// <- keyword.control.import +/// ^ meta.path +/// ^ keyword.operator.assignment +using Wrapped = PC.MyCompany.Project.Wrapper; +/// <- keyword.control.import +/// ^ meta.path +/// ^ keyword.operator.assignment +/// ^ storage.type +using col = global::System.Collections; +///^^ keyword.control.import +/// ^^^ meta.path +/// ^ keyword.operator.assignment +/// ^^^^^^ support.namespace +/// ^^ punctuation.accessor.double-colon.namespace +/// ^^^^^^ meta.path +/// ^ punctuation.separator.namespace +/// ^^^^^^^^^^^ meta.path +/// ^ punctuation.terminator +using sys = global::System; +///^^ keyword.control.import +/// ^^^ meta.path +/// ^ keyword.operator.assignment +/// ^^^^^^ support.namespace +/// ^^ punctuation.accessor.double-colon.namespace +/// ^^^^^^ meta.path +/// ^ punctuation.terminator +using abc = global:test; +/// ^^^ meta.path +/// ^ keyword.operator.assignment +/// ^^^^^^ meta.path +/// ^^^^^ invalid.illegal.expected-namespace +/// ^ punctuation.terminator + +class Foo { + + static void UsingFont([Usage("help text")] string x) +/// ^^^^^ variable.annotation +/// ^ string +/// ^ storage.type +/// ^ variable.parameter + { + using (Font font3 = new Font("Arial", 10.0f)) +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ keyword.control.using +/// ^ punctuation.section.group.begin +/// ^ support.type +/// ^ keyword.operator.assignment +/// ^ punctuation.section.group.end + { +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + // Use font3 + global::System.Console.WriteLine("foo"); +/// ^^^^^^ support.namespace +/// ^^ punctuation.accessor.double-colon +/// ^ punctuation.accessor.dot +/// ^^^^^^^ variable.other +/// ^ punctuation.accessor.dot +/// ^^^^^^^^^ variable.function + } +/// ^ meta.method meta.block meta.block punctuation.section.block.end + + using (Font font3 = new Font("Arial", 10.0f), +/// ^ keyword.control.using +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ punctuation.separator + font4 = new Font("Arial", 10.0f)) +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.end + { +/// ^ meta.method meta.block meta.block punctuation.section.block.begin + // Use font3 and font4. + } +/// ^ meta.method meta.block meta.block punctuation.section.block.end + } + + public void dcsrmm(double[] val, int offsetval, int[] indx, int offsetindx, int[] pntrb, int offsetpntrb, double[] b, int offsetb, int ldb, double beta, double[] c, int offsetc, int ldc) + { + fixed (Double* bp = &b[offsetb]) +/// ^ keyword.control.other.fixed +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ support.type +/// ^ keyword.operator.pointer +/// ^ punctuation.section.group.end + + fixed (var cp = &c[offsetc]) +/// ^ keyword.control.other.fixed +/// ^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ storage.type.variable +/// ^ punctuation.section.group.end + + fixed (double* valp = &val[offsetval], bp = &b[offsetb], cp = &c[offsetc]) +/// ^ keyword.control.other.fixed +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +/// ^ punctuation.section.group.begin +/// ^ storage.type +/// ^ punctuation.separator.variables +/// ^ punctuation.section.group.end + { + cblas_dcsrmm(valp, indxp, pntrbp, bp, ldb, beta, cp, ldc); + } + } +} + + +[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] +/// ^ support.namespace +/// ^^ punctuation.accessor.double-colon +/// ^^^^^^ variable.other.namespace +/// ^ punctuation.accessor.dot.namespace +/// ^^^^^^^ variable.other.namespace +internal sealed partial class Test : sys::Configuration.ApplicationSettingsBase { +/// ^^^ meta.path +/// ^^ punctuation.accessor.double-colon +/// ^^^^^^^^^^^^^ meta.path +/// ^ punctuation.accessor.dot.namespace +/// ^^^^^^^^^^^^^^^^^^^^^^^ entity.other.inherited-class + + private static Test defaultInstance = ((Test)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Test()))); +/// ^^^^^^ support.namespace +/// ^^ punctuation.accessor.double-colon +/// ^^^^^^ variable.other +/// ^ punctuation.accessor.dot + + public static Test Default { + [Tag] +/// ^^^^^ meta.annotation +/// ^ variable.annotation + get { +/// ^ storage.type.function.accessor.get + return defaultInstance; + } + } +} + +class Bar { + public void Main () + { + using(var reader = SomeCodeThatGetsAnIDisposable()) +/// ^^^^^ keyword.control.using.cs +/// ^ punctuation.section.group.begin.cs +/// ^^^ storage.type.variable.cs +/// ^ punctuation.section.group.end.cs + { + foreach(var line in reader) + { + DoStuff(line); + } + } + using (var reader = SomeCodeThatGetsAnIDisposable()) +/// ^^^^^ keyword.control.using.cs +/// ^ punctuation.section.group.begin.cs +/// ^^^ storage.type.variable.cs +/// ^ punctuation.section.group.end.cs + { + foreach (var line in reader) + { + DoStuff(line); + } + } + } +} diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_c#.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_c#.cs new file mode 100644 index 000000000..30932bd31 --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_c#.cs @@ -0,0 +1,230 @@ +// SYNTAX TEST "Packages/C#/C#.sublime-syntax" + +class X +// ^ storage.type.class +{ + X () { +// ^ entity.name.function.constructor +// ^^^^ meta.method + } + + X (string test) : base () { +// ^ entity.name.function.constructor +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.constructor +// ^^^^^^^^^^^^^^^ meta.method.constructor - meta.method.constructor.prebody +// ^^^^ variable.language +// ^^^^^^^^^^ meta.method.constructor.prebody +// ^ meta.group punctuation.section.group.begin +// ^ meta.group punctuation.section.group.end + } + + [Usage("Foo bar")] +// ^^^^^^^^^^^^^^^^^^ meta.annotation + // ^ variable.annotation + void Run([Usage("help text")] int x, int y) +// ^^^^ storage.type + // ^ entity.name.function + // ^^^^^ variable.annotation + // ^ string.quoted.double + // ^ storage.type + // ^ storage.type + { + } +} + +string verbatim = @"This is a test "" of a verbatim string literal - C:\User"; +// ^^ string.quoted.double.raw punctuation.definition.string.begin +// ^^ constant.character.escape +// ^ string.quoted.double.raw - constant +// ^ string.quoted.double.raw punctuation.definition.string.end + +class A +{ + public A(int x, int y) {} + // ^ storage.modifier + // ^ entity.name.function.constructor +} +class B: A +{ + public B(int x, int y): base(x + y, x - y) {} + // ^ variable.language +} + + +public class GenericList +{ + void Add(T input) { } +} + +class TestGenericList +{ + private class ExampleClass { } + static void Main() + { + GenericList list1 = new GenericList(); + // ^ storage.type + + GenericList list2 = new GenericList(); + + GenericList list3 = new GenericList(); + + string hello, wow = "test", test; +// ^^^^^^ storage.type +// ^^^^^ variable.other +// ^ punctuation.separator.variables +// ^^^ variable.other +// ^ keyword.operator.assignment +// ^^^^^^ string.quoted.double +// ^ punctuation.separator.variables +// ^^^^ variable.other +// ^ punctuation.terminator.statement + System . String test1; +// ^^^^^^ support.type +// ^ punctuation.accessor.dot +// ^^^^^^ support.type +// ^^^^^ variable.other + List . Enumerator a; +// ^^^^ support.type +// ^ punctuation.definition.generic.begin +// ^^^ storage.type +// ^ storage.type.nullable +// ^ punctuation.definition.generic.end +// ^ punctuation.accessor.dot.namespace +// ^^^^^^^^^^ support.type +// ^ variable.other + int ? test2 = 4; +// ^^^ storage.type +// ^ storage.type.nullable +// ^^^^^ variable.other +// ^ keyword.operator.assignment.variable +// ^ constant.numeric.integer.decimal + } +} + +public partial class Employee +// ^ storage.modifier +// ^ entity.name.class +{ + public void DoWork() + { + var group = MakeGroup(); + // ^^^^^ variable.other.cs - keyword + + var contents1 = group.GetContents(); + // ^^^^^ variable.other.cs - keyword + + var contents2 = @group.GetContents(); + // ^^^^^^ variable.other.cs - keyword + + var @void = MakeGroup(); + // ^^^^^ variable.other.cs - keyword + + var void = MakeGroup(); + // ^^^^ invalid.illegal - variable - keyword + + var subvoid1 = void.GetContents(); + // ^^^^ - variable # Technically illegal in this context, but at least it's not marked as a variable. + + var subvoid2 = @void.GetContents(); + // ^^^^^ variable.other.cs - keyword + + var msg = from + " " + to; + // ^^^^ variable.other.cs - keyword + } +} + +public class Coo +{ + public Object text = ObjectMaker.MakeSomeText ("In order to publish your text, you need to do some texty things 'Like this' and then say hello."); + // ^ variable.function + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double + // ^ - string + public Vector curves; + // ^ variable.other.member + int Zoo() + // ^ entity.name.function + {} +} + +class Syntax +{ + public decimal decimal1 = 1.0m; + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs + // ^ storage.type.numeric + public decimal decimal2 = 2.0M; + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs + // ^ storage.type.numeric + public double double1 = 1.0d; + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs + // ^ storage.type.numeric + public double double2 = 2.0D; + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs + // ^ storage.type.numeric + public double double3 = 2D; + // ^^ constant.numeric.float.decimal + // ^ storage.type.numeric + public float float1 = 1.0f; + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs + // ^ storage.type.numeric + public float float2 = 2.0F; + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs + // ^ storage.type.numeric + public double double3 = 2f; + // ^^ constant.numeric.float.decimal + // ^ storage.type.numeric + public long long1 = 1l; + // ^^ constant.numeric + // ^ storage.type.numeric + public long long2 = 2L; + // ^^ constant.numeric + // ^ storage.type.numeric + public ulong ulong1 = 1ul; + // ^^^ constant.numeric + // ^^ storage.type.numeric + public ulong ulong2 = 2UL; + // ^^^ constant.numeric + // ^^ storage.type.numeric + public ulong ulong3 = 3lu; + // ^^^ constant.numeric + // ^^ storage.type.numeric + public ulong ulong4 = 4LU; + // ^^^ constant.numeric + // ^^ storage.type.numeric + public ulong ulong5 = 5uL; + // ^^^ constant.numeric + // ^^ storage.type.numeric + public ulong ulong6 = 6Ul; + // ^^^ constant.numeric + // ^^ storage.type.numeric + public ulong ulong7 = 7lU; + // ^^^ constant.numeric + // ^^ storage.type.numeric + public ulong ulong8 = 8Lu; + // ^^^ constant.numeric + // ^^ storage.type.numeric + public ulong bad = 1UU; + // ^ - storage.type.numeric +} + +class Car +{ + ~Car() /* test */ // destructor +// ^^^^ entity.name.function.destructor + { + } +} + +public interface IObjectRepository +{ + bool CanGetObjects(IGetObjectsRequest request); + dynamic GetObjects(IGetObjectsRequest request); +// ^^^^^^^ support.type +// ^^^^^^^^^^ entity.name.function +// ^ punctuation.terminator +} diff --git a/assets/syntaxes/Packages/C#/tests/syntax_test_query.cs b/assets/syntaxes/Packages/C#/tests/syntax_test_query.cs new file mode 100644 index 000000000..7e623b501 --- /dev/null +++ b/assets/syntaxes/Packages/C#/tests/syntax_test_query.cs @@ -0,0 +1,60 @@ +/// SYNTAX TEST "Packages/C#/C#.sublime-syntax" + + class Test { + void Main() { + List books = new List() { +/// ^ meta.braces punctuation.section.braces.begin + new Book { Title = "LINQ in Action" }, + new Book { Title = "LINQ for Fun" }, + new Book { Title = "Extreme LINQ" } }; +/// ^^ meta.instance +/// ^ - meta.instance meta.instance +/// ^ meta.braces punctuation.section.braces.end + + var titles = + books + .Where(book => book.Title.Contains("Action")) + .Select(book => book.Title); + titles.Dump(); + + var results = from book in books +/// ^^^^ keyword.other.sql +/// ^^ keyword.other.sql + let titlelen = book.Title.Length +/// ^^^ keyword.other.sql + select new { book.Title, titlelen }.Dump(); +/// ^^^^^^ keyword.other.sql + results.Dump(); + + results = (from book in books +/// ^^^^ keyword.other.sql +/// ^^ keyword.other.sql + let title = book.Title +/// ^^^ keyword.other.sql + orderby title.Length descending +/// ^^^^^^^ keyword.other.sql +/// ^^^^^^^^^^ keyword.other.sql + select new { title, title.Length }).Dump(); +/// ^^^^^^ keyword.other.sql + + var innerJoinQuery = + from category in categories +/// ^^^^ keyword.other.sql +/// ^^ keyword.other.sql + join prod in products on category.ID equals prod.CategoryID +/// ^^^^ keyword.other.sql +/// ^^ keyword.other.sql +/// ^^ keyword.other.sql +/// ^^^^^^ keyword.other.sql + select new { ProductName = prod.Name, Category = category.Name }; + + var studentQuery1 = + from student in students +/// ^^^^ keyword.other.sql +/// ^^ keyword.other.sql + group student by student.Last[0] into letterGroup; +/// ^^^^^ keyword.other.sql +/// ^^ keyword.other.sql +/// ^^^^ keyword.other.sql + } + } diff --git a/assets/syntaxes/Packages/C++/C Single File.sublime-build b/assets/syntaxes/Packages/C++/C Single File.sublime-build new file mode 100644 index 000000000..99c150474 --- /dev/null +++ b/assets/syntaxes/Packages/C++/C Single File.sublime-build @@ -0,0 +1,14 @@ +{ + "shell_cmd": "gcc \"${file}\" -o \"${file_path}/${file_base_name}\"", + "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", + "working_dir": "${file_path}", + "selector": "source.c", + + "variants": + [ + { + "name": "Run", + "shell_cmd": "gcc \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"" + } + ] +} diff --git a/assets/syntaxes/Packages/C++/C Standard Includes.sublime-completions b/assets/syntaxes/Packages/C++/C Standard Includes.sublime-completions new file mode 100644 index 000000000..3fc385145 --- /dev/null +++ b/assets/syntaxes/Packages/C++/C Standard Includes.sublime-completions @@ -0,0 +1,38 @@ +{ + "scope": "(source.c | source.objc) & (meta.preprocessor.include string.quoted.other)", + + // Taken from http://en.cppreference.com/w/c/header + // Update as needed. + "completions": + [ + { "trigger": "assert.h\tstandard header", "contents": "assert.h" }, // Conditionally compiled macro that compares its argument to zero + { "trigger": "complex.h\tstandard header (since c99)", "contents": "complex.h" }, // (since C99) Complex number arithmetic + { "trigger": "ctype.h\tstandard header", "contents": "ctype.h" }, // Functions to determine the type contained in character data + { "trigger": "errno.h\tstandard header", "contents": "errno.h" }, // Macros reporting error conditions + { "trigger": "fenv.h\tstandard header (since c99)", "contents": "fenv.h" }, // (since C99) Floating-point environment + { "trigger": "float.h\tstandard header", "contents": "float.h" }, // Limits of float types + { "trigger": "inttypes.h\tstandard header (since c99)", "contents": "inttypes.h" }, // (since C99) Format conversion of integer types + { "trigger": "iso646.h\tstandard header (since c95)", "contents": "iso646.h" }, // (since C95) Alternative operator spellings + { "trigger": "limits.h\tstandard header", "contents": "limits.h" }, // Sizes of basic types + { "trigger": "locale.h\tstandard header", "contents": "locale.h" }, // Localization utilities + { "trigger": "math.h\tstandard header", "contents": "math.h" }, // Common mathematics functions + { "trigger": "setjmp.h\tstandard header", "contents": "setjmp.h" }, // Nonlocal jumps + { "trigger": "signal.h\tstandard header", "contents": "signal.h" }, // Signal handling + { "trigger": "stdalign.h\tstandard header (since c11)", "contents": "stdalign.h" }, // (since C11) alignas and alignof convenience macros + { "trigger": "stdarg.h\tstandard header", "contents": "stdarg.h" }, // Variable arguments + { "trigger": "stdatomic.h\tstandard header (since c11)", "contents": "stdatomic.h" }, // (since C11 Atomic types + { "trigger": "stdbool.h\tstandard header (since c99)", "contents": "stdbool.h" }, // (since C99) Boolean type + { "trigger": "stddef.h\tstandard header", "contents": "stddef.h" }, // Common macro definitions + { "trigger": "stdint.h\tstandard header (since c99)", "contents": "stdint.h" }, // (since C99) Fixed-width integer types + { "trigger": "stdio.h\tstandard header", "contents": "stdio.h" }, // Input/output + { "trigger": "stdlib.h\tstandard header", "contents": "stdlib.h" }, // General utilities: memory management, program utilities, string conversions, random numbers + { "trigger": "stdnoreturn.h\tstandard header (since c11)", "contents": "stdnoreturn.h" }, // (since C11) noreturn convenience macros + { "trigger": "string.h\tstandard header", "contents": "string.h" }, // String handling + { "trigger": "tgmath.h\tstandard header (since c99)", "contents": "tgmath.h" }, // (since C99) Type-generic math (macros wrapping math.h and complex.h) + { "trigger": "threads.h\tstandard header (since c11)", "contents": "threads.h" }, // (since C11) Thread library + { "trigger": "time.h\tstandard header", "contents": "time.h" }, // Time/date utilities + { "trigger": "uchar.h\tstandard header (since c11)", "contents": "uchar.h" }, // (since C11) UTF-16 and UTF-32 character utilities + { "trigger": "wchar.h\tstandard header (since c95)", "contents": "wchar.h" }, // (since C95) Extended multibyte and wide character utilities + { "trigger": "wctype.h\tstandard header (since c95)", "contents": "wctype.h" }, // (since C95) Wide character classification and mapping utilities + ] +} diff --git a/assets/syntaxes/Packages/C++/C++ Single File.sublime-build b/assets/syntaxes/Packages/C++/C++ Single File.sublime-build new file mode 100644 index 000000000..6c88a36e8 --- /dev/null +++ b/assets/syntaxes/Packages/C++/C++ Single File.sublime-build @@ -0,0 +1,14 @@ +{ + "shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"", + "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", + "working_dir": "${file_path}", + "selector": "source.c++", + + "variants": + [ + { + "name": "Run", + "shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"" + } + ] +} diff --git a/assets/syntaxes/Packages/C++/C++ Standard Includes.sublime-completions b/assets/syntaxes/Packages/C++/C++ Standard Includes.sublime-completions new file mode 100644 index 000000000..6a9b6f06e --- /dev/null +++ b/assets/syntaxes/Packages/C++/C++ Standard Includes.sublime-completions @@ -0,0 +1,218 @@ +{ + "scope": "(source.c++ | source.objc++) & (meta.preprocessor.include string.quoted.other)", + + // Taken from http://en.cppreference.com/w/cpp/header + // Update as needed. + "completions": + [ + // Utilities library + { "trigger": "cstdlib\tstandard header", "contents": "cstdlib" }, // General purpose utilities: program control, dynamic memory allocation, random numbers, sort and search + { "trigger": "csignal\tstandard header", "contents": "csignal" }, // Functions and macro constants for signal management + { "trigger": "csetjmp\tstandard header", "contents": "csetjmp" }, // Macro (and function) that saves (and jumps) to an execution context + { "trigger": "cstdarg\tstandard header", "contents": "cstdarg" }, // Handling of variable length argument lists + { "trigger": "typeinfo\tstandard header", "contents": "typeinfo" }, // Runtime type information utilities + { "trigger": "typeindex\tstandard header (since c++11)", "contents": "typeindex" }, // (since C++11) std::type_index + { "trigger": "type_traits\tstandard header (since c++11)", "contents": "type_traits" }, // (since C++11) Compile-time type information + { "trigger": "bitset\tstandard header", "contents": "bitset" }, // std::bitset class template + { "trigger": "functional\tstandard header", "contents": "functional" }, // Function objects, designed for use with the standard algorithms + { "trigger": "utility\tstandard header", "contents": "utility" }, // Various utility components + { "trigger": "ctime\tstandard header", "contents": "ctime" }, // C-style time/date utilites + { "trigger": "chrono\tstandard header (since c++11)", "contents": "chrono" }, // (since C++11) C++ time utilities + { "trigger": "cstddef\tstandard header", "contents": "cstddef" }, // typedefs for types such as size_t, NULL and others + { "trigger": "initializer_list\tstandard header since (c++11)", "contents": "initializer_list" }, // (since C++11) std::initializer_list class template + { "trigger": "tuple\tstandard header (since c++11)", "contents": "tuple" }, // (since C++11) std::tuple class template + { "trigger": "any\tstandard header (since c++17)", "contents": "any" }, // (since C++17) std::any class template + { "trigger": "optional\tstandard header (since c++17)", "contents": "optional" }, // (since C++17) std::optional class template + { "trigger": "variant\tstandard header (since c++17)", "contents": "variant" }, // (since C++17) std::variant class template + + // Dynmamic memory management utilities + { "trigger": "new\tstandard header", "contents": "new" }, // Low-level memory management utilities + { "trigger": "memory\tstandard header", "contents": "memory" }, // Higher level memory management utilities + { "trigger": "scoped_allocator\tstandard header (since c++11)", "contents": "scoped_allocator" }, // (since C++11) Nested allocator class + { "trigger": "memory_resource\tstandard header (since c++17)", "contents": "memory_resource" }, // (since C++17) Polymorphic allocators and memory resources + + // Numeric limits + { "trigger": "climits\tstandard header", "contents": "climits" }, // limits of integral types + { "trigger": "cfloat\tstandard header", "contents": "cfloat" }, // limits of float types + { "trigger": "cstdint\tstandard header (since c++11)", "contents": "cstdint" }, // (since C++11) fixed-size types and limits of other types + { "trigger": "cinttypes\tstandard header (since c++11)", "contents": "cinttypes" }, // (since C++11) formatting macros , intmax_t and uintmax_t math and conversions + { "trigger": "limits\tstandard header", "contents": "limits" }, // standardized way to query properties of arithmetic types + + // Error handling + { "trigger": "exception\tstandard header", "contents": "exception" }, // Exception handling utilities + { "trigger": "stdexcept\tstandard header", "contents": "stdexcept" }, // Standard exception objects + { "trigger": "system_error\tstandard header (since c++11)", "contents": "system_error" }, // (since C++11) defines std::error_code, a platform-dependent error code + { "trigger": "cerrno\tstandard header", "contents": "cerrno" }, // Macro containing the last error number + + // String library + { "trigger": "cctype\tstandard header", "contents": "cctype" }, // functions to determine the type contained in character data + { "trigger": "cwctype\tstandard header", "contents": "cwctype" }, // functions for determining the type of wide character data + { "trigger": "cstring\tstandard header", "contents": "cstring" }, // various narrow character string handling functions + { "trigger": "cwchar\tstandard header", "contents": "cwchar" }, // various wide and multibyte string handling functions + { "trigger": "cuchar\tstandard header (since c++11)", "contents": "cuchar" }, // (since C++11) C-style Unicode character conversion functions + { "trigger": "string\tstandard header", "contents": "string" }, // std::basic_string class template + { "trigger": "string_view\tstandard header (since c++17)", "contents": "string_view" }, // (since C++17) std::basic_string_view class template + { "trigger": "charconv\tstandard header (since c++20)", "contents": "charconv" }, // (since C++20) std::to_chars and std::from_chars + + // Containers library + { "trigger": "array\tstandard header (since c++11)", "contents": "array" }, // (since C++11) std::array container + { "trigger": "vector\tstandard header", "contents": "vector" }, // std::vector container + { "trigger": "deque\tstandard header", "contents": "deque" }, // std::deque container + { "trigger": "list\tstandard header", "contents": "list" }, // std::list container + { "trigger": "forward_list\tstandard header (since c++11)", "contents": "forward_list" }, // (since C++11) std::forward_list container + { "trigger": "set\tstandard header", "contents": "set" }, // std::set and std::multiset associative containers + { "trigger": "map\tstandard header", "contents": "map" }, // std::map and std::multimap associative containers + { "trigger": "unordered_set\tstandard header (since c++11)", "contents": "unordered_set" }, // (since C++11) std::unordered_set and std::unordered_multiset unordered associative containers + { "trigger": "unordered_map\tstandard header (since c++11)", "contents": "unordered_map" }, // (since C++11) std::unordered_map and std::unordered_multimap unordered associative containers + { "trigger": "stack\tstandard header", "contents": "stack" }, // std::stack container adaptor + { "trigger": "queue\tstandard header", "contents": "queue" }, // std::queue and std::priority_queue container adaptors + + // Algorithms library + { "trigger": "algorithm\tstandard header", "contents": "algorithm" }, // Algorithms that operate on containers + { "trigger": "execution\tstandard header (since c++17)", "contents": "execution" }, // (C++17) Predefined execution policies for parallel versions of the algorithms + + // Iterators library + { "trigger": "iterator\tstandard header", "contents": "iterator" }, // Container iterators + + // Numerics library + { "trigger": "cmath\tstandard header", "contents": "cmath"}, // Common mathematics functions + { "trigger": "complex\tstandard header", "contents": "complex" }, // Complex number type + { "trigger": "valarray\tstandard header", "contents": "valarray" }, // Class for representing and manipulating arrays of values + { "trigger": "random\tstandard header (since c++11)", "contents": "random" }, // (since C++11) Random number generators and distributions + { "trigger": "numeric\tstandard header", "contents": "numeric" }, // Numeric operations on values in containers + { "trigger": "ratio\tstandard header (since c++11)", "contents": "ratio" }, // (since C++11) Compile-time rational arithmetic + { "trigger": "cfenv\tstandard header (since c++11)", "contents": "cfenv" }, // (since C++11) Floating-point environment access functions + + // Input/output library + { "trigger": "iosfwd\tstandard header", "contents": "iosfwd" }, // forward declarations of all classes in the input/output library + { "trigger": "ios\tstandard header", "contents": "ios" }, // std::ios_base class, std::basic_ios class template and several typedefs + { "trigger": "istream\tstandard header", "contents": "istream" }, // std::basic_istream class template and several typedefs + { "trigger": "ostream\tstandard header", "contents": "ostream" }, // std::basic_ostream, std::basic_iostream class templates and several typedefs + { "trigger": "iostream\tstandard header", "contents": "iostream" }, // several standard stream objects + { "trigger": "fstream\tstandard header", "contents": "fstream" }, // std::basic_fstream, std::basic_ifstream, std::basic_ofstream class templates and several typedefs + { "trigger": "sstream\tstandard header", "contents": "sstream" }, // std::basic_stringstream, std::basic_istringstream, std::basic_ostringstream class templates and several typedefs + { "trigger": "iomanip\tstandard header", "contents": "iomanip" }, // Helper functions to control the format or input and output + { "trigger": "streambuf\tstandard header", "contents": "streambuf" }, // std::basic_streambuf class template + { "trigger": "cstdio\tstandard header", "contents": "cstdio" }, // C-style input-output functions + + // Localization library + { "trigger": "locale\tstandard header", "contents": "locale" }, // Localization utilities + { "trigger": "clocale\tstandard header", "contents": "clocale" }, // C localization utilities + { "trigger": "codecvt\tstandard header (since c++11)", "contents": "codecvt" }, // (since C++11) Unicode conversion facilities + + // Regular Expressions library + { "trigger": "regex\tstandard header (since c++11)", "contents": "regex" }, // (since C++11) Classes, algorithms and iterators to support regular expression processing + + // Atomic Operations library + { "trigger": "atomic\tstandard header (since c++11)", "contents": "atomic" }, // (since C++11) Atomic operations library + + // Thread support library + { "trigger": "thread\tstandard header (since c++11)", "contents": "thread" }, // (since C++11) std::thread class and supporting functions + { "trigger": "mutex\tstandard header (since c++11)", "contents": "mutex" }, // (since C++11) mutual exclusion primitives + { "trigger": "shared_mutex\tstandard header (since c++14)", "contents": "shared_mutex" }, // (since C++14) shared mutual exclusion primitives + { "trigger": "future\tstandard header (since c++11)", "contents": "future" }, // (since C++11) primitives for asynchronous computations + { "trigger": "condition_variable\tstandard header (since c++11)", "contents": "condition_variable" }, // (since C++11) thread waiting conditions + + // Filesystem library + { "trigger": "filesystem\tstandard header (since c++17)", "contents": "filesystem" }, // (since C++17) std::path class and supporting functions + + // Experimental libraries + { "trigger": "experimental/algorithm\tlibrary fundamentals TS", "contents": "experimental/algorithm" }, // Standard libraries extensions and Extensions for Parallelism + { "trigger": "experimental/any\tlibrary fundamentals TS", "contents": "experimental/any" }, // Standard libraries extensions + { "trigger": "experimental/chrono\tlibrary fundamentals TS", "contents": "experimental/chrono" }, // Standard libraries extensions + { "trigger": "experimental/deque\tlibrary fundamentals TS", "contents": "experimental/deque" }, // Standard libraries extensions + { "trigger": "experimental/execution_policy\tlibrary fundamentals TS", "contents": "experimental/execution_policy" }, // Extensions for Parallelism + { "trigger": "experimental/exception_list\tlibrary fundamentals TS", "contents": "experimental/exception_list" }, // Extensions for Parallelism + { "trigger": "experimental/filesystem\tlibrary fundamentals TS", "contents": "experimental/filesystem" }, // Filesystem library + { "trigger": "experimental/forward_list\tlibrary fundamentals TS", "contents": "experimental/forward_list" }, // Standard libraries extensions + { "trigger": "experimental/future\tlibrary fundamentals TS", "contents": "experimental/future" }, // Standard libraries extensions + { "trigger": "experimental/list\tlibrary fundamentals TS", "contents": "experimental/list" }, // Standard libraries extensions + { "trigger": "experimental/functional\tlibrary fundamentals TS", "contents": "experimental/functional" }, // Standard libraries extensions + { "trigger": "experimental/map\tlibrary fundamentals TS", "contents": "experimental/map" }, // Standard libraries extensions + { "trigger": "experimental/memory\tlibrary fundamentals TS", "contents": "experimental/memory" }, // Standard libraries extensions + { "trigger": "experimental/memory_resource\tlibrary fundamentals TS", "contents": "experimental/memory_resource" }, // Standard libraries extensions + { "trigger": "experimental/numeric\tlibrary fundamentals TS", "contents": "experimental/numeric" }, // Extensions for Parallelism + { "trigger": "experimental/optional\tlibrary fundamentals TS", "contents": "experimental/optional" }, // Standard libraries extensions + { "trigger": "experimental/ratio\tlibrary fundamentals TS", "contents": "experimental/ratio" }, // Standard libraries extensions + { "trigger": "experimental/regex\tlibrary fundamentals TS", "contents": "experimental/regex" }, // Standard libraries extensions + { "trigger": "experimental/set\tlibrary fundamentals TS", "contents": "experimental/set" }, // Standard libraries extensions + { "trigger": "experimental/string\tlibrary fundamentals TS", "contents": "experimental/string" }, // Standard libraries extensions + { "trigger": "experimental/string_view\tlibrary fundamentals TS", "contents": "experimental/string_view" }, // Standard libraries extensions + { "trigger": "experimental/system_error\tlibrary fundamentals TS", "contents": "experimental/system_error" }, // Standard libraries extensions + { "trigger": "experimental/tuple\tlibrary fundamentals TS", "contents": "experimental/tuple" }, // Standard libraries extensions + { "trigger": "experimental/type_traits\tlibrary fundamentals TS", "contents": "experimental/type_traits" }, // Standard libraries extensions + { "trigger": "experimental/unordered_map\tlibrary fundamentals TS", "contents": "experimental/unordered_map" }, // Standard libraries extensions + { "trigger": "experimental/unordered_set\tlibrary fundamentals TS", "contents": "experimental/unordered_set" }, // Standard libraries extensions + { "trigger": "experimental/utility\tlibrary fundamentals TS", "contents": "experimental/utility" }, // Standard libraries extensions + { "trigger": "experimental/vector\tlibrary fundamentals TS", "contents": "experimental/vector" }, // Standard libraries extensions + + // C compatibility headers + // + // For some of the C standard library headers of + // the form xxx.h, the C++ standard library both includes an + // identically-named header and another header of the form cxxx (all + // meaningful cxxx headers are listed above). With the exception of + // complex.h , each xxx.h header included in the C++ standard library + // places in the global namespace each name that the corresponding cxxx + // header would have placed in the std namespace. These headers are + // allowed to also declare the same names in the std namespace, and the + // corresponding cxxx headers are allowed to also declare the same names + // in the global namespace: including definitely provides + // std::malloc and may also provide ::malloc. Including + // definitely provides ::malloc and may also provide std::malloc. This + // applies even to functions and function overloads that are not part of + // C standard library. + { "trigger": "assert.h\tstandard header (deprecated)", "contents": "assert.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "ctype.h\tstandard header (deprecated)", "contents": "ctype.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "errno.h\tstandard header (deprecated)", "contents": "errno.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "fenv.h\tstandard header (deprecated)", "contents": "fenv.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "float.h\tstandard header (deprecated)", "contents": "float.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "inttypes.h\tstandard header (deprecated)", "contents": "inttypes.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "limits.h\tstandard header (deprecated)", "contents": "limits.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "locale.h\tstandard header (deprecated)", "contents": "locale.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "math.h\tstandard header (deprecated)", "contents": "math.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "setjmp.h\tstandard header (deprecated)", "contents": "setjmp.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "signal.h\tstandard header (deprecated)", "contents": "signal.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "stdarg.h\tstandard header (deprecated)", "contents": "stdarg.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "stddef.h\tstandard header (deprecated)", "contents": "stddef.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "stdint.h\tstandard header (deprecated)", "contents": "stdint.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "stdio.h\tstandard header (deprecated)", "contents": "stdio.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "stdlib.h\tstandard header (deprecated)", "contents": "stdlib.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "string.h\tstandard header (deprecated)", "contents": "string.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "time.h\tstandard header (deprecated)", "contents": "time.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "uchar.h\tstandard header (deprecated)", "contents": "uchar.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "wchar.h\tstandard header (deprecated)", "contents": "wchar.h" }, // behaves as if each name from is placed in global namespace + { "trigger": "wctype.h\tstandard header (deprecated)", "contents": "wctype.h" }, // behaves as if each name from is placed in global namespace + + // Unsupported C headers + // + // The C headers , , + // and are not included in C++ and have no cxxx equivalents. + + // Empty C headers + // + // The headers , , , and do not + // contain any content from the C standard library and instead merely + // include other headers from the C++ standard library. The use of all + // these headers is deprecated in C++. + // + // (since C++11)(deprecated in C++17) simply includes the header + // (deprecated) simply includes the header + // (since C++11)(deprecated in C++17) simply includes the headers and : the overloads equivalent to the contents of the C header tgmath.h are already provided by those headers + // (deprecated) simply includes the header + + // Meaningless C headers + // + // The headers , , and are meaningless in + // C++ because the macros they provide in C are language keywords in + // C++. + // + // empty header. The macros that appear in iso646.h in C are keywords in C++ + // (deprecated) behaves as if each name from is placed in global namespace + // (since C++11)(deprecated in C++17) defines one compatibility macro constant + // (deprecated) behaves as if each name from is placed in global namespace + // (since C++11)(deprecated in C++17) defines one compatibility macro constant + // (deprecated) behaves as if each name from is placed in global namespace + + ] +} diff --git a/assets/syntaxes/Packages/C++/C++.sublime-settings b/assets/syntaxes/Packages/C++/C++.sublime-settings new file mode 100644 index 000000000..babea2b89 --- /dev/null +++ b/assets/syntaxes/Packages/C++/C++.sublime-settings @@ -0,0 +1,3 @@ +{ + "extensions": ["h"] +} diff --git a/assets/syntaxes/Packages/C++/C++.sublime-syntax b/assets/syntaxes/Packages/C++/C++.sublime-syntax new file mode 100644 index 000000000..aa34cf536 --- /dev/null +++ b/assets/syntaxes/Packages/C++/C++.sublime-syntax @@ -0,0 +1,2166 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: C++ +comment: I don't think anyone uses .hp. .cp tends to be paired with .h. (I could be wrong. :) -- chris +file_extensions: + - cpp + - cc + - cp + - cxx + - c++ + - C + - h + - hh + - hpp + - hxx + - h++ + - inl + - ipp +first_line_match: '-\*- C\+\+ -\*-' +scope: source.c++ +variables: + # number digits + dec_digits: '(?:\d(?:[\d'']*\d)?)' + + # number exponents + dec_exponent: '(?:[eE][-+]??{{dec_digits}})' + hex_exponent: '(?:[pP][-+]??{{dec_digits}})' + + # number suffixes + # note: nearly everything can be defined as suffix via `operator` keyword + # see: https://en.cppreference.com/w/cpp/numeric/complex/operator%22%22i + dec_suffix: '(?:[a-zA-Z_][[:alnum:]_]*|(?=[^[:alnum:]_'']))' + hex_suffix: '(?:[g-zG-Z_][[:alnum:]_]*|(?=[^[:alnum:]_'']))' + float_suffix: '[fF]' + integer_suffix: '[lL]{1,2}[uU]?|[uU][lL]{0,2}' + + identifier: \b[[:alpha:]_][[:alnum:]_]*\b # upper and lowercase + macro_identifier: \b[[:upper:]_][[:upper:][:digit:]_]{2,}\b # only uppercase, at least 3 chars + path_lookahead: '(?:::\s*)?(?:{{identifier}}\s*::\s*)*(?:template\s+)?{{identifier}}' + operator_method_name: '\boperator\s*(?:[-+*/%^&|~!=<>]|[-+*/%^&|=!<>]=|<<=?|>>=?|&&|\|\||\+\+|--|,|->\*?|\(\)|\[\]|""\s*{{identifier}})' + casts: 'const_cast|dynamic_cast|reinterpret_cast|static_cast' + operator_keywords: 'and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|xor|xor_eq|noexcept' + control_keywords: 'break|case|catch|continue|default|do|else|for|goto|if|_Pragma|return|switch|throw|try|while' + memory_operators: 'new|delete' + basic_types: 'asm|__asm__|auto|bool|_Bool|char|_Complex|double|float|_Imaginary|int|long|short|signed|unsigned|void' + before_tag: 'struct|union|enum\s+class|enum\s+struct|enum|class' + declspec: '__declspec\(\s*\w+(?:\([^)]+\))?\s*\)' + storage_classes: 'static|export|extern|friend|explicit|virtual|register|thread_local' + type_qualifier: 'const|constexpr|mutable|typename|volatile' + compiler_directive: 'inline|restrict|__restrict__|__restrict' + visibility_modifiers: 'private|protected|public' + other_keywords: 'typedef|nullptr|{{visibility_modifiers}}|static_assert|sizeof|using|typeid|alignof|alignas|namespace|template' + modifiers: '{{storage_classes}}|{{type_qualifier}}|{{compiler_directive}}' + non_angle_brackets: '(?=<<|<=)' + + regular: '[^(){}&;*^%=<>-]*' + regular_plus: '[^(){}&;*^%=<>-]+' + paren_open: (?:\( + paren_close: '\))?' + generic_open: (?:{{regular_plus}}(?:< + generic_close: '>)?)?' + balance_parentheses: '{{regular}}{{paren_open}}{{regular}}{{paren_close}}{{regular}}' + generic_lookahead: <{{generic_open}}{{generic_open}}{{regular}}{{generic_close}}\s*{{generic_close}}{{balance_parentheses}}> + + data_structures_forward_decl_lookahead: '(\s+{{macro_identifier}})*\s*(:\s*({{path_lookahead}}|{{visibility_modifiers}}|,|\s|<[^;]*>)+)?;' + non_func_keywords: 'if|for|switch|while|decltype|sizeof|__declspec|__attribute__|typeid|alignof|alignas|static_assert' + +contexts: + main: + - include: preprocessor-global + - include: global + + ############################################################################# + # Reusable contexts + # + # The follow contexts are currently constructed to be reused in the + # Objetive-C++ syntax. They are specifically constructed to not push into + # sub-contexts, which ensures that Objective-C++ code isn't accidentally + # lexed as plain C++. + # + # The "unique-*" contexts are additions that C++ makes over C, and thus can + # be directly reused in Objective-C++ along with contexts from Objective-C + # and C. + ############################################################################# + + unique-late-expressions: + # This is highlighted after all of the other control keywords + # to allow operator overloading to be lexed properly + - match: \boperator\b + scope: keyword.control.c++ + + unique-modifiers: + - match: \b({{modifiers}})\b + scope: storage.modifier.c++ + + unique-variables: + - match: \bthis\b + scope: variable.language.c++ + # common C++ instance var naming idiom -- fMemberName + - match: '\b(f|m)[[:upper:]]\w*\b' + scope: variable.other.readwrite.member.c++ + # common C++ instance var naming idiom -- m_member_name + - match: '\bm_[[:alnum:]_]+\b' + scope: variable.other.readwrite.member.c++ + + unique-constants: + - match: \bnullptr\b + scope: constant.language.c++ + + unique-keywords: + - match: \busing\b + scope: keyword.control.c++ + - match: \bbreak\b + scope: keyword.control.flow.break.c++ + - match: \bcontinue\b + scope: keyword.control.flow.continue.c++ + - match: \bgoto\b + scope: keyword.control.flow.goto.c++ + - match: \breturn\b + scope: keyword.control.flow.return.c++ + - match: \bthrow\b + scope: keyword.control.flow.throw.c++ + - match: \b({{control_keywords}})\b + scope: keyword.control.c++ + - match: '\bdelete\b(\s*\[\])?|\bnew\b(?!])' + scope: keyword.control.c++ + - match: \b({{operator_keywords}})\b + scope: keyword.operator.word.c++ + + unique-types: + - match: \b(char16_t|char32_t|wchar_t|nullptr_t)\b + scope: storage.type.c++ + - match: \bclass\b + scope: storage.type.c++ + + unique-strings: + - match: '((?:L|u8|u|U)?R)("([^\(\)\\ ]{0,16})\()' + captures: + 1: storage.type.string.c++ + 2: punctuation.definition.string.begin.c++ + push: + - meta_scope: string.quoted.double.c++ + - match: '\)\3"' + scope: punctuation.definition.string.end.c++ + pop: true + + numbers: + # https://en.cppreference.com/w/cpp/language/floating_literal + + # decimal floats + - match: |- + (?x: + \b{{dec_digits}} + (?: + (?: + (\.) + (?: + # 1.1, 1.1e1, 1.1e-1, 1.1f, 1.1e1f, 1.1e-1f, 1.1L, 1.1e1L, 1.1e-1L + {{dec_digits}} {{dec_exponent}}? + # 1.e1, 1.e-1, 1.e1f, 1.e-1f, 1.e1L, 1.e-1L + | {{dec_exponent}} + # 1., 1.f, 1.L # but not `..` + | (?!\.) + ) + # 1e1 1e1f 1e1L + | {{dec_exponent}} + ) ({{dec_suffix}})? + # 1f + | ({{float_suffix}}) + ) + # .1, .1e1, .1e-1, .1f, .1e1f, .1e-1f, .1L, .1e1L, .1e-1L + | (\.) {{dec_digits}} {{dec_exponent}}? ({{dec_suffix}})? + ) + scope: constant.numeric.float.decimal.c++ + captures: + 1: punctuation.separator.decimal.c++ + 2: storage.type.numeric.c++ + 3: storage.type.numeric.c++ + 4: punctuation.separator.decimal.c++ + 5: storage.type.numeric.c++ + + # hexadecimal float (C99) + - match: \b0[xX](?=[[:alnum:]_''.]+?[pP]) + scope: punctuation.definition.numeric.base.c++ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.float.hexadecimal.c++ + - match: '{{hex_exponent}}' + pop: true + - match: \. + scope: punctuation.separator.decimal.c++ + - match: \H + scope: invalid.illegal.numeric.digit.c++ + + # https://en.cppreference.com/w/c/language/integer_constant + + # binary integer + - match: \b0[bB] + scope: punctuation.definition.numeric.base.c++ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.binary.c++ + - include: decimal-suffix + - match: '[2-9]' + scope: invalid.illegal.numeric.digit.c++ + # hexadecimal integer + - match: \b0[xX] + scope: punctuation.definition.numeric.base.c++ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.hexadecimal.c++ + - include: hexadecimal-suffix + # octal integer + - match: \b0(?=[\d'']) + scope: punctuation.definition.numeric.base.c++ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.octal.c++ + - include: decimal-suffix + - match: '[89]' + scope: invalid.illegal.numeric.digit.c++ + # decimal integer + - match: \b\d+ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.decimal.c++ + - include: decimal-suffix + + decimal-suffix: + - match: '{{dec_suffix}}' + scope: storage.type.numeric.c++ + pop: true + + hexadecimal-suffix: + - match: '{{hex_suffix}}' + scope: storage.type.numeric.c++ + pop: true + + identifiers: + - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: punctuation.accessor.double-colon.c++ + - match: '(?:(::)\s*)?{{identifier}}' + captures: + 1: punctuation.accessor.double-colon.c++ + + identifier-path-generic: + - include: angle-brackets + - match: '(?:(::)\s*)?{{identifier}}\s*(?=(<.*>)?\s*(::))\s*' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: punctuation.accessor.double-colon.c++ + + function-specifiers: + - match: \b(const|final|noexcept|override)\b + scope: storage.modifier.c++ + + ############################################################################# + # The following are C++-specific contexts that should not be reused. This is + # because they push into subcontexts and use variables that are C++-specific. + ############################################################################# + + ## Common context layout + + global: + - match: '(?=\btemplate\b)' + push: + - include: template + - match: (?=\S) + set: global-modifier + - include: using-namespace + - include: namespace + - include: keywords-angle-brackets + - match: '(?={{path_lookahead}}\s*<)' + push: global-modifier + # Take care of comments just before a function definition. + - match: /\* + scope: punctuation.definition.comment.c + push: + - - match: \s*(?=\w) + set: global-modifier + - match: "" + pop: true + - - meta_scope: comment.block.c + - match: \*/ + scope: punctuation.definition.comment.c + pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.c + - include: early-expressions + - match: ^\s*\b(extern)(?=\s+"C(\+\+)?") + scope: storage.modifier.c++ + push: + - include: comments + - include: strings + - match: '\{' + scope: punctuation.section.block.begin.c++ + set: + - meta_scope: meta.extern-c.c++ + - match: '^\s*(#\s*ifdef)\s*__cplusplus\s*' + scope: meta.preprocessor.c++ + captures: + 1: keyword.control.import.c++ + set: + - match: '\}' + scope: punctuation.section.block.end.c++ + pop: true + - include: preprocessor-global + - include: global + - match: '\}' + scope: punctuation.section.block.end.c++ + pop: true + - include: preprocessor-global + - include: global + - match: (?=\S) + set: global-modifier + - match: ^\s*(?=\w) + push: global-modifier + - include: late-expressions + + statements: + - include: preprocessor-statements + - include: scope:source.c#label + - include: expressions + + expressions: + - include: early-expressions + - include: late-expressions + + early-expressions: + - include: early-expressions-before-generic-type + - include: generic-type + - include: early-expressions-after-generic-type + + early-expressions-before-generic-type: + - include: preprocessor-expressions + - include: comments + - include: case-default + - include: using-namespace + - include: typedef + - include: using-alias + - include: keywords-angle-brackets + - include: keywords-parens + - include: keywords + - include: numbers + # Prevent a '<' from getting scoped as the start of another template + # parameter list, if in reality a less-than-or-equals sign is meant. + - match: <= + scope: keyword.operator.comparison.c + + early-expressions-after-generic-type: + - include: members-arrow + - include: operators + - include: members-dot + - include: strings + - include: parens + - include: brackets + - include: block + - include: variables + - include: constants + - match: ',' + scope: punctuation.separator.c++ + - match: '\)|\}' + scope: invalid.illegal.stray-bracket-end.c++ + + expressions-minus-generic-type: + - include: early-expressions-before-generic-type + - include: angle-brackets + - include: early-expressions-after-generic-type + - include: late-expressions + + expressions-minus-generic-type-function-call: + - include: early-expressions-before-generic-type + - include: angle-brackets + - include: early-expressions-after-generic-type + - include: late-expressions-before-function-call + - include: identifiers + - match: ';' + scope: punctuation.terminator.c++ + + late-expressions: + - include: late-expressions-before-function-call + - include: function-call + - include: identifiers + - match: ';' + scope: punctuation.terminator.c++ + + late-expressions-before-function-call: + - include: unique-late-expressions + - include: modifiers-parens + - include: modifiers + - include: types + + expressions-minus-function-call: + - include: early-expressions + - include: late-expressions-before-function-call + - include: identifiers + - match: ';' + scope: punctuation.terminator.c++ + + comments: + - include: scope:source.c#comments + + operators: + - include: scope:source.c#operators + + modifiers: + - include: unique-modifiers + - include: scope:source.c#modifiers + + variables: + - include: unique-variables + - include: scope:source.c#variables + + constants: + - include: unique-constants + - include: scope:source.c#constants + + keywords: + - include: unique-keywords + - include: scope:source.c#keywords + + types: + - include: unique-types + - include: types-parens + - include: scope:source.c#types + + strings: + - include: unique-strings + - include: scope:source.c#strings + + ## C++-specific contexts + + case-default: + - match: '\b(default|case)\b' + scope: keyword.control.c++ + push: + - match: (?=[);,]) + pop: true + - match: ':' + scope: punctuation.separator.c++ + pop: true + - include: expressions + + modifiers-parens: + - match: '\b(alignas)\b\s*(\()' + captures: + 1: storage.modifier.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + push: + - meta_content_scope: meta.group.c++ + - match: '\)' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - match: \b(__attribute__)\s*(\(\() + captures: + 1: storage.modifier.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + push : + - meta_scope: meta.attribute.c++ + - meta_content_scope: meta.group.c++ + - include: parens + - include: strings + - match: \)\) + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - match: \b(__declspec)(\() + captures: + 1: storage.modifier.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + push: + - meta_content_scope: meta.group.c++ + - match: '\)' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - match: '\b(align|allocate|code_seg|deprecated|property|uuid)\b\s*(\()' + captures: + 1: storage.modifier.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + push: + - meta_content_scope: meta.group.c++ + - match: '\)' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: numbers + - include: strings + - match: \b(get|put)\b + scope: variable.parameter.c++ + - match: ',' + scope: punctuation.separator.c++ + - match: '=' + scope: keyword.operator.assignment.c++ + - match: '\b(appdomain|deprecated|dllimport|dllexport|jintrinsic|naked|noalias|noinline|noreturn|nothrow|novtable|process|restrict|safebuffers|selectany|thread)\b' + scope: constant.other.c++ + + types-parens: + - match: '\b(decltype)\b\s*(\()' + captures: + 1: storage.type.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + push: + - meta_content_scope: meta.group.c++ + - match: '\)' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + + keywords-angle-brackets: + - match: \b({{casts}})\b\s* + scope: keyword.operator.word.cast.c++ + push: + - match: '>' + scope: punctuation.section.generic.end.c++ + pop: true + - match: '<' + scope: punctuation.section.generic.begin.c++ + push: + - match: '(?=>)' + pop: true + - include: expressions-minus-generic-type-function-call + + keywords-parens: + - match: '\b(alignof|typeid|static_assert|sizeof)\b\s*(\()' + captures: + 1: keyword.operator.word.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + push: + - meta_content_scope: meta.group.c++ + - match: '\)' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + + using-namespace: + - match: '\b(using)\s+(namespace)\b' + captures: + 1: keyword.control.c++ + 2: keyword.control.c++ + push: + - include: identifiers + - match: '' + pop: true + + namespace: + - match: '\b(namespace)\s+(?=({{path_lookahead}})?(?!\s*[;,]))' + scope: meta.namespace.c++ + captures: + 1: keyword.control.c++ + push: + - meta_content_scope: meta.namespace.c++ entity.name.namespace.c++ + - include: identifiers + - match: '' + set: + - meta_scope: meta.namespace.c++ + - include: comments + - match: '=' + scope: keyword.operator.alias.c++ + - match: '(?=;)' + pop: true + - match: '\}' + scope: meta.block.c++ punctuation.section.block.end.c++ + pop: true + - match: '\{' + scope: punctuation.section.block.begin.c++ + push: + - meta_scope: meta.block.c++ + - match: '(?=\})' + pop: true + - include: preprocessor-global + - include: global + - include: expressions + + template-common: + # Exit the template scope if we hit some basic invalid characters. This + # helps when a user is in the middle of typing their template types and + # prevents re-highlighting the whole file until the next > is found. + - match: (?=[{};]) + pop: true + - include: expressions + + template: + - match: \btemplate\b + scope: storage.type.template.c++ + push: + - meta_scope: meta.template.c++ + # Explicitly include comments here at the top, in order to NOT match the + # \S lookahead in the case of comments. + - include: comments + - match: < + scope: punctuation.section.generic.begin.c++ + set: + - meta_content_scope: meta.template.c++ + - match: '>' + scope: meta.template.c++ punctuation.section.generic.end.c++ + pop: true + - match: \.{3} + scope: keyword.operator.variadic.c++ + - match: \b(typename|{{before_tag}})\b + scope: storage.type.c++ + - include: template # include template here for nested templates + - include: template-common + - match: (?=\S) + set: + - meta_content_scope: meta.template.c++ + - match: \b({{before_tag}})\b + scope: storage.type.c++ + - include: template-common + + generic-type: + - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}}\s*(\(|\{))' + push: + - meta_scope: meta.function-call.c++ + - match: \btemplate\b + scope: storage.type.template.c++ + - match: (?:(::)\s*)?({{identifier}})\s*(<) + captures: + 1: punctuation.accessor.double-colon.c++ + 2: variable.function.c++ + 3: punctuation.section.generic.begin.c++ + push: + - match: '>' + scope: punctuation.section.generic.end.c++ + pop: true + - include: expressions-minus-generic-type-function-call + - match: (?:(::)\s*)?({{identifier}})\s*(\() + captures: + 1: punctuation.accessor.double-colon.c++ + 2: variable.function.c++ + 3: punctuation.section.group.begin.c++ + set: + - meta_scope: meta.function-call.c++ + - meta_content_scope: meta.group.c++ + - match: '\)' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - match: (?:(::)\s*)?({{identifier}})\s*(\{) + captures: + 1: punctuation.accessor.double-colon.c++ + 2: variable.function.c++ + 3: punctuation.section.group.begin.c++ + set: + - meta_scope: meta.function-call.c++ + - meta_content_scope: meta.group.c++ + - match: '\}' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - include: identifiers + - include: angle-brackets + - match: '\(' + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_scope: meta.function-call.c++ + - meta_content_scope: meta.group.c++ + - match: '\)' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - match: '\{' + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_scope: meta.function-call.c++ + - meta_content_scope: meta.group.c++ + - match: '\}' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}})' + push: + - include: identifiers + - match: '<' + scope: punctuation.section.generic.begin.c++ + set: + - match: '>' + scope: punctuation.section.generic.end.c++ + pop: true + - include: expressions-minus-generic-type-function-call + + angle-brackets: + - match: '<(?!<)' + scope: punctuation.section.generic.begin.c++ + push: + - match: '>' + scope: punctuation.section.generic.end.c++ + pop: true + - include: expressions-minus-generic-type-function-call + + block: + - match: '\{' + scope: punctuation.section.block.begin.c++ + push: + - meta_scope: meta.block.c++ + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '\}' + scope: punctuation.section.block.end.c++ + pop: true + - include: statements + + function-call: + - match: (?={{path_lookahead}}\s*(\(|\{)) + push: + - meta_scope: meta.function-call.c++ + - include: scope:source.c#c99 + - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: punctuation.accessor.double-colon.c++ + - match: '(?:(::)\s*)?({{identifier}})' + captures: + 1: punctuation.accessor.c++ + 2: variable.function.c++ + - match: '\(' + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_content_scope: meta.function-call.c++ meta.group.c++ + - match: '\)' + scope: meta.function-call.c++ meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - match: '\{' + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_content_scope: meta.function-call.c++ meta.group.c++ + - match: '\}' + scope: meta.function-call.c++ meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + + members-inside-function-call: + - meta_content_scope: meta.method-call.c++ meta.group.c++ + - match: \) + scope: meta.method-call.c++ meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + + members-after-accessor-junction: + # After we've seen an accessor (dot or arrow), this context decides what + # kind of entity we're accessing. + - include: comments + - match: \btemplate\b + scope: meta.method-call.c++ storage.type.template.c++ + # Guaranteed to be a template member function call after we match this + set: + - meta_content_scope: meta.method-call.c++ + - include: comments + - match: '{{identifier}}' + scope: variable.function.member.c++ + set: + - meta_content_scope: meta.method-call.c++ + - match: \( + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: members-inside-function-call + - include: comments + - include: angle-brackets + - match: (?=\S) # safety pop + pop: true + - match: (?=\S) # safety pop + pop: true + # Operator overloading + - match: '({{operator_method_name}})\s*(\()' + captures: + 0: meta.method-call.c++ + 1: variable.function.member.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + set: members-inside-function-call + # Non-templated member function call + - match: (~?{{identifier}})\s*(\() + captures: + 0: meta.method-call.c++ + 1: variable.function.member.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + set: members-inside-function-call + # Templated member function call + - match: (~?{{identifier}})\s*(?={{generic_lookahead}}) + captures: + 1: variable.function.member.c++ + set: + - meta_scope: meta.method-call.c++ + - match: < + scope: punctuation.section.generic.begin.c++ + set: + - meta_content_scope: meta.method-call.c++ + - match: '>' + scope: punctuation.section.generic.end.c++ + set: + - meta_content_scope: meta.method-call.c++ + - include: comments + - match: \( + scope: punctuation.section.group.begin.c++ + set: members-inside-function-call + - match: (?=\S) # safety pop + pop: true + - include: expressions + # Explicit base-class access + - match: ({{identifier}})\s*(::) + captures: + 1: variable.other.base-class.c++ + 2: punctuation.accessor.double-colon.c++ + set: members-after-accessor-junction # reset + # Just a regular member variable + - match: '{{identifier}}' + scope: variable.other.readwrite.member.c++ + pop: true + + members-dot: + - include: scope:source.c#access-illegal + # No lookahead required because members-dot goes after operators in the + # early-expressions-after-generic-type context. This means triple dots + # (i.e. "..." or "variadic") is attempted first. + - match: \. + scope: punctuation.accessor.dot.c++ + push: members-after-accessor-junction + + members-arrow: + # This needs to be before operators in the + # early-expressions-after-generic-type context because otherwise the "->" + # from the C language will match. + - match: -> + scope: punctuation.accessor.arrow.c++ + push: members-after-accessor-junction + + using-alias: + # consume keyword if followed by typename + - match: '\b(using)\b(?=\s+typename\b)' + captures: + 1: keyword.control.c++ + - match: '\b(using)\b\s+({{identifier}})(?!\s*(<|::))' + captures: + 1: keyword.control.c++ + 2: entity.name.type.using.c++ + + typedef: + - match: \btypedef\b + scope: storage.type.c++ + push: + - match: ({{identifier}})?\s*(?=;) + captures: + 1: entity.name.type.typedef.c++ + pop: true + - match: \b(struct)\s+({{identifier}})\b + captures: + 1: storage.type.c++ + - include: expressions-minus-generic-type + + parens: + - match: \( + scope: punctuation.section.group.begin.c++ + push: + - meta_scope: meta.group.c++ + - match: \) + scope: punctuation.section.group.end.c++ + pop: true + - include: expressions + + brackets: + - match: \[ + scope: punctuation.section.brackets.begin.c++ + push: + - meta_scope: meta.brackets.c++ + - match: \] + scope: punctuation.section.brackets.end.c++ + pop: true + - include: expressions + + function-trailing-return-type: + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + - include: modifiers-parens + - include: modifiers + - include: identifiers + - match: \*|& + scope: keyword.operator.c++ + - include: function-trailing-return-type-parens + - match: '(?=\S)' + pop: true + + function-trailing-return-type-parens: + - match: \( + scope: punctuation.section.group.begin.c++ + push: + - meta_scope: meta.group.c++ + - match: \) + scope: punctuation.section.group.end.c++ + pop: true + - include: function-trailing-return-type + + ## Detection of function and data structure definitions at the global level + + global-modifier: + - include: comments + - include: modifiers-parens + - include: modifiers + # Constructors and destructors don't have a type + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?\s*::\s*{{identifier}}\s*\()' + set: + - meta_content_scope: meta.function.c++ meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(?:(::)\s*)?({{identifier}})' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.constructor.c++ + - match: '(?=[^\w\s])' + set: function-definition-params + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?\s*::\s*~{{identifier}}\s*(\(|$))' + set: + - meta_content_scope: meta.function.c++ meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(?:(::)\s*)?(~{{identifier}})' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.destructor.c++ + - match: '(?=[^\w\s])' + set: function-definition-params + # If we see a path ending in :: before a newline, we don't know if it is + # a constructor or destructor, or a long return type, so we are just going + # to treat it like a regular function. Most likely it is a constructor, + # since it doesn't seem most developers would create such a long typename. + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?::\s*$)' + set: + - meta_content_scope: meta.function.c++ meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(::)\s*$' + captures: + 1: punctuation.accessor.double-colon.c++ + - match: '(?:(::)\s*)?(~?{{identifier}})(?=\s*\()' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ + - match: '(?=[^\w\s])' + set: function-definition-params + - include: unique-strings + - match: '(?=\S)' + set: global-type + + global-type: + - include: comments + - match: \*|& + scope: keyword.operator.c++ + - match: '(?=\b({{control_keywords}}|{{operator_keywords}}|{{casts}}|{{memory_operators}}|{{other_keywords}}|operator)\b)' + pop: true + - match: '(?=\s)' + set: global-maybe-function + # If a class/struct/enum followed by a name that is not a macro or declspec + # then this is likely a return type of a function. This is uncommon. + - match: |- + (?x: + ({{before_tag}}) + \s+ + (?= + (?![[:upper:][:digit:]_]+\b|__declspec|{{before_tag}}) + {{path_lookahead}} + (\s+{{identifier}}\s*\(|\s*[*&]) + ) + ) + captures: + 1: storage.type.c++ + set: + - include: identifiers + - match: '' + set: global-maybe-function + # The previous match handles return types of struct/enum/etc from a func, + # there this one exits the context to allow matching an actual struct/class + - match: '(?=\b({{before_tag}})\b)' + set: data-structures + - match: '(?=\b({{casts}})\b\s*<)' + pop: true + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + # Allow a macro call + - match: '({{identifier}})\s*(\()(?=[^\)]+\))' + captures: + 1: variable.function.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + push: + - meta_scope: meta.function-call.c++ + - meta_content_scope: meta.group.c++ + - match: '\)' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - match: '(?={{path_lookahead}}\s*\()' + set: + - include: function-call + - match: '' + pop: true + - include: variables + - include: constants + - include: identifiers + - match: (?=\W) + pop: true + + global-maybe-function: + - include: comments + # Consume pointer info, macros and any type info that was offset by macros + - match: \*|& + scope: keyword.operator.c++ + - match: '(?=\b({{control_keywords}}|{{operator_keywords}}|{{casts}}|{{memory_operators}}|{{other_keywords}})\b)' + pop: true + - match: '\b({{type_qualifier}})\b' + scope: storage.modifier.c++ + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + - include: modifiers-parens + - include: modifiers + # All uppercase identifier just before a newline is most likely a macro + - match: '[[:upper:][:digit:]_]+\s*$' + # Operator overloading + - match: '(?=({{path_lookahead}}\s*(?:{{generic_lookahead}})?::\s*)?{{operator_method_name}}\s*(\(|$))' + set: + - meta_content_scope: meta.function.c++ meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(?:(::)\s*)?({{operator_method_name}})(?=\s*\()' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ + - match: '(?=\s*(\(|$))' + set: function-definition-params + # Identifier that is not the function name - likely a macro or type + - match: '(?={{path_lookahead}}([ \t]+|[*&])(?!\s*(<|::|\(|$)))' + push: + - include: identifiers + - match: '' + pop: true + # Real function definition + - match: '(?={{path_lookahead}}({{generic_lookahead}}({{path_lookahead}})?)\s*(\(|$))' + set: [function-definition-params, global-function-identifier-generic] + - match: '(?={{path_lookahead}}\s*(\(|$))' + set: [function-definition-params, global-function-identifier] + - match: '(?={{path_lookahead}}\s*::\s*$)' + set: [function-definition-params, global-function-identifier] + - match: '(?=\S)' + pop: true + + global-function-identifier-generic: + - meta_content_scope: meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(?:(::)\s*)?({{identifier}})(?=\s*(<.*>)?\s*\()' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ + - match: '(?=\()' + pop: true + + global-function-identifier: + - meta_content_scope: meta.toc-list.full-identifier.c++ + - match: '(?:(::)\s*)?({{identifier}})(?!\s*(::))' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ + - include: identifiers + - match: '(?=\S)' + pop: true + + function-definition-params: + - meta_content_scope: meta.function.c++ + - include: comments + - match: '(?=\()' + set: + - match: \( + scope: meta.function.parameters.c++ meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_content_scope: meta.function.parameters.c++ meta.group.c++ + - match : \) + scope: punctuation.section.group.end.c++ + set: function-definition-continue + - match: '\bvoid\b' + scope: storage.type.c++ + - match: '{{identifier}}(?=\s*(\[|,|\)|=))' + scope: variable.parameter.c++ + - match: '=' + scope: keyword.operator.assignment.c++ + push: + - match: '(?=,|\))' + pop: true + - include: expressions-minus-generic-type + - include: scope:source.c#preprocessor-line-continuation + - include: expressions-minus-generic-type + - include: scope:source.c#preprocessor-line-continuation + - match: (?=\S) + pop: true + + function-definition-continue: + - meta_content_scope: meta.function.c++ + - include: comments + - match: '(?=;)' + pop: true + - match: '->' + scope: punctuation.separator.c++ + set: function-definition-trailing-return + - include: function-specifiers + - match: '=' + scope: keyword.operator.assignment.c++ + - match: '&' + scope: keyword.operator.c++ + - match: \b0\b + scope: constant.numeric.integer.decimal.c++ + - match: \b(default|delete)\b + scope: storage.modifier.c++ + - match: '(?=\{)' + set: function-definition-body + - match: '(?=\S)' + pop: true + + function-definition-trailing-return: + - include: comments + - match: '(?=;)' + pop: true + - match: '(?=\{)' + set: function-definition-body + - include: function-specifiers + - include: function-trailing-return-type + + function-definition-body: + - meta_content_scope: meta.function.c++ meta.block.c++ + - match: '\{' + scope: punctuation.section.block.begin.c++ + set: + - meta_content_scope: meta.function.c++ meta.block.c++ + - match: '\}' + scope: meta.function.c++ meta.block.c++ punctuation.section.block.end.c++ + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '(?=({{before_tag}})([^(;]+$|.*\{))' + push: data-structures + - include: statements + + ## Data structures including classes, structs, unions and enums + + data-structures: + - match: '\bclass\b' + scope: storage.type.c++ + set: data-structures-class-definition + # Detect variable type definitions using struct/enum/union followed by a tag + - match: '\b({{before_tag}})(?=\s+{{path_lookahead}}\s+{{path_lookahead}}\s*[=;\[])' + scope: storage.type.c++ + - match: '\bstruct\b' + scope: storage.type.c++ + set: data-structures-struct-definition + - match: '\benum(\s+(class|struct))?\b' + scope: storage.type.c++ + set: data-structures-enum-definition + - match: '\bunion\b' + scope: storage.type.c++ + set: data-structures-union-definition + - match: '(?=\S)' + pop: true + + preprocessor-workaround-eat-macro-before-identifier: + # Handle macros so they aren't matched as the class name + - match: ({{macro_identifier}})(?=\s+~?{{identifier}}) + captures: + 1: meta.assumed-macro.c + + data-structures-class-definition: + - meta_scope: meta.class.c++ + - include: data-structures-definition-common-begin + - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' + scope: entity.name.class.forward-decl.c++ + set: data-structures-class-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.class.c++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.class.c++ + set: data-structures-class-definition-after-identifier + - include: identifiers + - match: '(?=[^\w\s])' + set: data-structures-class-definition-after-identifier + - match: '(?=[:{])' + set: data-structures-class-definition-after-identifier + - match: '(?=;)' + pop: true + + data-structures-class-definition-after-identifier: + - meta_content_scope: meta.class.c++ + - include: data-structures-definition-common-begin + # No matching of identifiers since they should all be macros at this point + - include: data-structures-definition-common-end + - match: '\{' + scope: meta.block.c++ punctuation.section.block.begin.c++ + set: + - meta_content_scope: meta.class.c++ meta.block.c++ + - match: '\}' + scope: meta.class.c++ meta.block.c++ punctuation.section.block.end.c++ + pop: true + - include: data-structures-body + + data-structures-struct-definition: + - meta_scope: meta.struct.c++ + - include: data-structures-definition-common-begin + - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' + scope: entity.name.struct.forward-decl.c++ + set: data-structures-struct-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.struct.c++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.struct.c++ + set: data-structures-struct-definition-after-identifier + - include: identifiers + - match: '(?=[^\w\s])' + set: data-structures-struct-definition-after-identifier + - match: '(?=[:{])' + set: data-structures-struct-definition-after-identifier + - match: '(?=;)' + pop: true + + data-structures-struct-definition-after-identifier: + - meta_content_scope: meta.struct.c++ + - include: data-structures-definition-common-begin + # No matching of identifiers since they should all be macros at this point + - include: data-structures-definition-common-end + - match: '\{' + scope: meta.block.c++ punctuation.section.block.begin.c++ + set: + - meta_content_scope: meta.struct.c++ meta.block.c++ + - match: '\}' + scope: meta.struct.c++ meta.block.c++ punctuation.section.block.end.c++ + pop: true + - include: data-structures-body + + data-structures-enum-definition: + - meta_scope: meta.enum.c++ + - include: data-structures-definition-common-begin + - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' + scope: entity.name.enum.forward-decl.c++ + set: data-structures-enum-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.enum.c++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.enum.c++ + set: data-structures-enum-definition-after-identifier + - include: identifiers + - match: '(?=[^\w\s])' + set: data-structures-enum-definition-after-identifier + - match: '(?=[:{])' + set: data-structures-enum-definition-after-identifier + - match: '(?=;)' + pop: true + + data-structures-enum-definition-after-identifier: + - meta_content_scope: meta.enum.c++ + - include: data-structures-definition-common-begin + # No matching of identifiers since they should all be macros at this point + - include: data-structures-definition-common-end + - match: '\{' + scope: meta.block.c++ punctuation.section.block.begin.c++ + set: + - meta_content_scope: meta.enum.c++ meta.block.c++ + # Enums don't support methods so we have a simplified body + - match: '\}' + scope: meta.enum.c++ meta.block.c++ punctuation.section.block.end.c++ + pop: true + - include: statements + + data-structures-union-definition: + - meta_scope: meta.union.c++ + - include: data-structures-definition-common-begin + - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' + scope: entity.name.union.forward-decl.c++ + set: data-structures-union-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.union.c++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.union.c++ + set: data-structures-union-definition-after-identifier + - include: identifiers + - match: '(?=[^\w\s])' + set: data-structures-union-definition-after-identifier + - match: '(?=[{])' + set: data-structures-union-definition-after-identifier + - match: '(?=;)' + pop: true + + data-structures-union-definition-after-identifier: + - meta_content_scope: meta.union.c++ + - include: data-structures-definition-common-begin + # No matching of identifiers since they should all be macros at this point + # Unions don't support base classes + - include: angle-brackets + - match: '\{' + scope: meta.block.c++ punctuation.section.block.begin.c++ + set: + - meta_content_scope: meta.union.c++ meta.block.c++ + - match: '\}' + scope: meta.union.c++ meta.block.c++ punctuation.section.block.end.c++ + pop: true + - include: data-structures-body + - match: '(?=;)' + pop: true + + data-structures-definition-common-begin: + - include: comments + - match: '(?=\b(?:{{before_tag}}|{{control_keywords}})\b)' + pop: true + - include: preprocessor-other + - include: modifiers-parens + - include: modifiers + - include: preprocessor-workaround-eat-macro-before-identifier + + data-structures-definition-common-end: + - include: angle-brackets + - match: \bfinal\b + scope: storage.modifier.c++ + - match: ':' + scope: punctuation.separator.c++ + push: + - include: comments + - include: preprocessor-other + - include: modifiers-parens + - include: modifiers + - match: '\b(virtual|{{visibility_modifiers}})\b' + scope: storage.modifier.c++ + - match: (?={{path_lookahead}}) + push: + - meta_scope: entity.other.inherited-class.c++ + - include: identifiers + - match: '' + pop: true + - include: angle-brackets + - match: ',' + scope: punctuation.separator.c++ + - match: (?=\{|;) + pop: true + - match: '(?=;)' + pop: true + + data-structures-body: + - include: preprocessor-data-structures + - match: '(?=\btemplate\b)' + push: + - include: template + - match: (?=\S) + set: data-structures-modifier + - include: using-namespace + - include: typedef + - include: using-alias + - match: \b({{visibility_modifiers}})\s*(:)(?!:) + captures: + 1: storage.modifier.c++ + 2: punctuation.section.class.c++ + - match: '^\s*(?=(?:~?\w+|::))' + push: data-structures-modifier + - include: expressions-minus-generic-type + + data-structures-modifier-friend: + - match: (?=;) + pop: true + - match: '\{' + scope: punctuation.section.block.begin.c++ + set: + - meta_scope: meta.block.c++ + - match: '\}' + scope: punctuation.section.block.end.c++ + pop: true + - include: statements + - include: expressions-minus-function-call + + data-structures-modifier: + - match: '\bfriend\b' + scope: storage.modifier.c++ + push: + - include: comments + - match: '\b({{before_tag}})\b' + scope: storage.type.c++ + set: data-structures-modifier-friend + - match: '(?=\S)(?=[^;]+;)' + set: data-structures-modifier-friend + - match: '(?=\S)' + pop: true + - include: comments + - include: modifiers-parens + - include: modifiers + - match: '\bstatic_assert(?=\s*\()' + scope: meta.static-assert.c++ keyword.operator.word.c++ + push: + - match: '\(' + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_content_scope: meta.function-call.c++ meta.group.c++ + - match: '\)' + scope: meta.function-call.c++ meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + # Destructor + - match: '(?:{{identifier}}\s*(::)\s*)?~{{identifier}}(?=\s*(\(|$))' + scope: meta.method.destructor.c++ entity.name.function.destructor.c++ + captures: + 1: punctuation.accessor.c++ + set: method-definition-params + # It's a macro, not a constructor if there is no type in the first param + - match: '({{identifier}})\s*(\()(?=\s*(?!void){{identifier}}\s*[),])' + captures: + 1: variable.function.c++ + 2: meta.group.c++ punctuation.section.group.begin.c++ + push: + - meta_scope: meta.function-call.c++ + - meta_content_scope: meta.group.c++ + - match: '\)' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + # Constructor + - include: preprocessor-workaround-eat-macro-before-identifier + - match: '((?!{{before_tag}}|template){{identifier}})(?=\s*\()' + scope: meta.method.constructor.c++ entity.name.function.constructor.c++ + set: method-definition-params + # Long form constructor + - match: '({{identifier}}\s*(::)\s*{{identifier}})(?=\s*\()' + captures: + 1: meta.method.constructor.c++ entity.name.function.constructor.c++ + 2: punctuation.accessor.c++ + push: method-definition-params + - match: '(?=\S)' + set: data-structures-type + + data-structures-type: + - include: comments + - match: \*|& + scope: keyword.operator.c++ + # Cast methods + - match: '(operator)\s+({{identifier}})(?=\s*(\(|$))' + captures: + 1: keyword.control.c++ + 2: meta.method.c++ entity.name.function.c++ + set: method-definition-params + - match: '(?=\b({{control_keywords}}|{{operator_keywords}}|{{casts}}|{{memory_operators}}|{{other_keywords}}|operator)\b)' + pop: true + - match: '(?=\s)' + set: data-structures-maybe-method + # If a class/struct/enum followed by a name that is not a macro or declspec + # then this is likely a return type of a function. This is uncommon. + - match: |- + (?x: + ({{before_tag}}) + \s+ + (?= + (?![[:upper:][:digit:]_]+\b|__declspec|{{before_tag}}) + {{path_lookahead}} + (\s+{{identifier}}\s*\(|\s*[*&]) + ) + ) + captures: + 1: storage.type.c++ + set: + - include: identifiers + - match: '' + set: data-structures-maybe-method + # The previous match handles return types of struct/enum/etc from a func, + # there this one exits the context to allow matching an actual struct/class + - match: '(?=\b({{before_tag}})\b)' + set: data-structures + - match: '(?=\b({{casts}})\b\s*<)' + pop: true + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + - include: variables + - include: constants + - include: identifiers + - match: (?=[&*]) + set: data-structures-maybe-method + - match: (?=\W) + pop: true + + data-structures-maybe-method: + - include: comments + # Consume pointer info, macros and any type info that was offset by macros + - match: \*|& + scope: keyword.operator.c++ + - match: '(?=\b({{control_keywords}}|{{operator_keywords}}|{{casts}}|{{memory_operators}}|{{other_keywords}})\b)' + pop: true + - match: '\b({{type_qualifier}})\b' + scope: storage.modifier.c++ + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + - include: modifiers-parens + - include: modifiers + # Operator overloading + - match: '{{operator_method_name}}(?=\s*(\(|$))' + scope: meta.method.c++ entity.name.function.c++ + set: method-definition-params + # Identifier that is not the function name - likely a macro or type + - match: '(?={{path_lookahead}}([ \t]+|[*&])(?!\s*(<|::|\()))' + push: + - include: identifiers + - match: '' + pop: true + # Real function definition + - match: '(?={{path_lookahead}}({{generic_lookahead}})\s*(\())' + set: [method-definition-params, data-structures-function-identifier-generic] + - match: '(?={{path_lookahead}}\s*(\())' + set: [method-definition-params, data-structures-function-identifier] + - match: '(?={{path_lookahead}}\s*::\s*$)' + set: [method-definition-params, data-structures-function-identifier] + - match: '(?=\S)' + pop: true + + data-structures-function-identifier-generic: + - include: angle-brackets + - match: '(?={{identifier}})' + push: + - meta_content_scope: entity.name.function.c++ + - include: identifiers + - match: '(?=<)' + pop: true + - match: '(?=\()' + pop: true + + data-structures-function-identifier: + - meta_content_scope: entity.name.function.c++ + - include: identifiers + - match: '(?=\S)' + pop: true + + method-definition-params: + - meta_content_scope: meta.method.c++ + - include: comments + - match: '(?=\()' + set: + - match: \( + scope: meta.method.parameters.c++ meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_content_scope: meta.method.parameters.c++ meta.group.c++ + - match : \) + scope: punctuation.section.group.end.c++ + set: method-definition-continue + - match: '\bvoid\b' + scope: storage.type.c++ + - match: '{{identifier}}(?=\s*(\[|,|\)|=))' + scope: variable.parameter.c++ + - match: '=' + scope: keyword.operator.assignment.c++ + push: + - match: '(?=,|\))' + pop: true + - include: expressions-minus-generic-type + - include: expressions-minus-generic-type + - match: '(?=\S)' + pop: true + + method-definition-continue: + - meta_content_scope: meta.method.c++ + - include: comments + - match: '(?=;)' + pop: true + - match: '->' + scope: punctuation.separator.c++ + set: method-definition-trailing-return + - include: function-specifiers + - match: '=' + scope: keyword.operator.assignment.c++ + - match: '&' + scope: keyword.operator.c++ + - match: \b0\b + scope: constant.numeric.integer.decimal.c++ + - match: \b(default|delete)\b + scope: storage.modifier.c++ + - match: '(?=:)' + set: + - match: ':' + scope: punctuation.separator.initializer-list.c++ + set: + - meta_scope: meta.method.constructor.initializer-list.c++ + - match: '{{identifier}}' + scope: variable.other.readwrite.member.c++ + push: + - match: \( + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_content_scope: meta.group.c++ + - match: \) + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - match: \{ + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_content_scope: meta.group.c++ + - match: \} + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - include: comments + - match: (?=\{|;) + set: method-definition-continue + - include: expressions + - match: '(?=\{)' + set: method-definition-body + - match: '(?=\S)' + pop: true + + method-definition-trailing-return: + - include: comments + - match: '(?=;)' + pop: true + - match: '(?=\{)' + set: method-definition-body + - include: function-specifiers + - include: function-trailing-return-type + + method-definition-body: + - meta_content_scope: meta.method.c++ meta.block.c++ + - match: '\{' + scope: punctuation.section.block.begin.c++ + set: + - meta_content_scope: meta.method.c++ meta.block.c++ + - match: '\}' + scope: meta.method.c++ meta.block.c++ punctuation.section.block.end.c++ + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '(?=({{before_tag}})([^(;]+$|.*\{))' + push: data-structures + - include: statements + + ## Preprocessor for data-structures + + preprocessor-data-structures: + - include: preprocessor-rule-enabled-data-structures + - include: preprocessor-rule-disabled-data-structures + - include: preprocessor-practical-workarounds + + preprocessor-rule-disabled-data-structures: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.c++ + 2: keyword.control.import.c++ + 3: constant.numeric.integer.decimal.c++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.else.c++ + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: data-structures-body + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.c++ + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-data-structures: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.c++ + 2: keyword.control.import.c++ + 3: constant.numeric.integer.decimal.c++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.else.c++ + push: + - meta_content_scope: comment.block.preprocessor.else-branch.c++ + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: data-structures-body + + ## Preprocessor for global + + preprocessor-global: + - include: preprocessor-rule-enabled-global + - include: preprocessor-rule-disabled-global + - include: preprocessor-rule-other-global + + preprocessor-statements: + - include: preprocessor-rule-enabled-statements + - include: preprocessor-rule-disabled-statements + - include: preprocessor-rule-other-statements + + preprocessor-expressions: + - include: scope:source.c#incomplete-inc + - include: preprocessor-macro-define + - include: scope:source.c#pragma-mark + - include: preprocessor-other + + preprocessor-rule-disabled-global: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.c++ + 2: keyword.control.import.c++ + 3: constant.numeric.integer.decimal.c++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.else.c++ + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.c++ + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-global: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.c++ + 2: keyword.control.import.c++ + 3: constant.numeric.integer.decimal.c++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.else.c++ + push: + - meta_content_scope: comment.block.preprocessor.else-branch.c++ + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + + preprocessor-rule-other-global: + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: keyword.control.import.c++ + push: + - meta_scope: meta.preprocessor.c++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: \bdefined\b + scope: keyword.control.c++ + # Enter a new scope where all elif/else branches have their + # contexts popped by a subsequent elif/else/endif. This ensures that + # preprocessor branches don't push multiple meta.block scopes on + # the stack, thus messing up the "global" context's detection of + # functions. + - match: $\n + set: preprocessor-if-branch-global + + # These gymnastics here ensure that we are properly handling scope even + # when the preprocessor is used to create different scope beginnings, such + # as a different if/while condition + preprocessor-if-branch-global: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + pop: true + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-global + - match: \{ + scope: punctuation.section.block.begin.c++ + set: preprocessor-block-if-branch-global + - include: preprocessor-global + - include: negated-block + - include: global + + preprocessor-block-if-branch-global: + - meta_scope: meta.block.c++ + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + set: preprocessor-block-finish-global + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-global + - match: \} + scope: punctuation.section.block.end.c++ + set: preprocessor-if-branch-global + - include: statements + + preprocessor-block-finish-global: + - meta_scope: meta.block.c++ + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + set: preprocessor-block-finish-if-branch-global + - match: \} + scope: punctuation.section.block.end.c++ + pop: true + - include: statements + + preprocessor-block-finish-if-branch-global: + - match: ^\s*(#\s*endif)\b + captures: + 1: keyword.control.import.c++ + pop: true + - match: \} + scope: punctuation.section.block.end.c++ + set: preprocessor-if-branch-global + - include: statements + + preprocessor-elif-else-branch-global: + - match: (?=^\s*#\s*(endif)\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + + ## Preprocessor for statements + + preprocessor-rule-disabled-statements: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.c++ + 2: keyword.control.import.c++ + 3: constant.numeric.integer.decimal.c++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.else.c++ + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: statements + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.c++ + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-statements: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.c++ + 2: keyword.control.import.c++ + 3: constant.numeric.integer.decimal.c++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.else.c++ + push: + - meta_content_scope: comment.block.preprocessor.else-branch.c++ + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: statements + + preprocessor-rule-other-statements: + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: keyword.control.import.c++ + push: + - meta_scope: meta.preprocessor.c++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: \bdefined\b + scope: keyword.control.c++ + # Enter a new scope where all elif/else branches have their + # contexts popped by a subsequent elif/else/endif. This ensures that + # preprocessor branches don't push multiple meta.block scopes on + # the stack, thus messing up the "global" context's detection of + # functions. + - match: $\n + set: preprocessor-if-branch-statements + + # These gymnastics here ensure that we are properly handling scope even + # when the preprocessor is used to create different scope beginnings, such + # as a different if/while condition + preprocessor-if-branch-statements: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + pop: true + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-statements + - match: \{ + scope: punctuation.section.block.begin.c++ + set: preprocessor-block-if-branch-statements + - match: (?=(?!{{non_func_keywords}}){{path_lookahead}}\s*\() + set: preprocessor-if-branch-function-call + - include: negated-block + - include: statements + + preprocessor-if-branch-function-call: + - meta_content_scope: meta.function-call.c++ + - include: scope:source.c#c99 + - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' + scope: variable.function.c++ + captures: + 1: punctuation.accessor.c++ + 2: punctuation.accessor.c++ + - match: '(?:(::)\s*)?{{identifier}}' + scope: variable.function.c++ + captures: + 1: punctuation.accessor.c++ + - match: '\(' + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: preprocessor-if-branch-function-call-arguments + + preprocessor-if-branch-function-call-arguments: + - meta_content_scope: meta.function-call.c++ meta.group.c++ + - match : \) + scope: meta.function-call.c++ meta.group.c++ punctuation.section.group.end.c++ + set: preprocessor-if-branch-statements + - match: ^\s*(#\s*(?:elif|else))\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + set: preprocessor-if-branch-statements + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + set: preprocessor-if-branch-function-call-arguments-finish + - include: expressions + + preprocessor-if-branch-function-call-arguments-finish: + - meta_content_scope: meta.function-call.c++ meta.group.c++ + - match: \) + scope: meta.function-call.c++ meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + + preprocessor-block-if-branch-statements: + - meta_scope: meta.block.c++ + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + set: preprocessor-block-finish-statements + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-statements + - match: \} + scope: punctuation.section.block.end.c++ + set: preprocessor-if-branch-statements + - include: statements + + preprocessor-block-finish-statements: + - meta_scope: meta.block.c++ + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + set: preprocessor-block-finish-if-branch-statements + - match: \} + scope: punctuation.section.block.end.c++ + pop: true + - include: statements + + preprocessor-block-finish-if-branch-statements: + - match: ^\s*(#\s*endif)\b + captures: + 1: keyword.control.import.c++ + pop: true + - match: \} + scope: meta.block.c++ punctuation.section.block.end.c++ + set: preprocessor-if-branch-statements + - include: statements + + preprocessor-elif-else-branch-statements: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: statements + + ## Preprocessor other + + negated-block: + - match: '\}' + scope: punctuation.section.block.end.c++ + push: + - match: '\{' + scope: punctuation.section.block.begin.c++ + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - include: statements + + preprocessor-macro-define: + - match: ^\s*(\#\s*define)\b + captures: + 1: meta.preprocessor.macro.c++ keyword.control.import.define.c++ + push: + - meta_content_scope: meta.preprocessor.macro.c++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - match: '({{identifier}})(?=\()' + scope: entity.name.function.preprocessor.c++ + set: + - match: '\(' + scope: punctuation.section.group.begin.c++ + set: preprocessor-macro-params + - match: '{{identifier}}' + scope: entity.name.constant.preprocessor.c++ + set: preprocessor-macro-definition + + preprocessor-macro-params: + - meta_scope: meta.preprocessor.macro.parameters.c++ meta.group.c++ + - match: '{{identifier}}' + scope: variable.parameter.c++ + - match: \) + scope: punctuation.section.group.end.c++ + set: preprocessor-macro-definition + - match: ',' + scope: punctuation.separator.c++ + push: + - match: '{{identifier}}' + scope: variable.parameter.c++ + pop: true + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.c++ + - match: '(?=\))' + pop: true + - match: (/\*).*(\*/) + scope: comment.block.c++ + captures: + 1: punctuation.definition.comment.c++ + 2: punctuation.definition.comment.c++ + - match: '\S+' + scope: invalid.illegal.unexpected-character.c++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.c++ + - match: (/\*).*(\*/) + scope: comment.block.c++ + captures: + 1: punctuation.definition.comment.c++ + 2: punctuation.definition.comment.c++ + - match: $\n + scope: invalid.illegal.unexpected-end-of-line.c++ + + preprocessor-macro-definition: + - meta_content_scope: meta.preprocessor.macro.c++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + # Don't define blocks in define statements + - match: '\{' + scope: punctuation.section.block.begin.c++ + - match: '\}' + scope: punctuation.section.block.end.c++ + # Captures the namespace macro idiom + - match: '\b(namespace)\s+(?={{path_lookahead}}\s*\{)' + scope: meta.namespace.c++ + captures: + 1: keyword.control.c++ + push: + - meta_content_scope: meta.namespace.c++ entity.name.namespace.c++ + - include: identifiers + - match: '(?=\S)' + pop: true + - include: expressions + + preprocessor-practical-workarounds: + - include: preprocessor-convention-ignore-uppercase-ident-lines + - include: scope:source.c#preprocessor-convention-ignore-uppercase-calls-without-semicolon + + preprocessor-convention-ignore-uppercase-ident-lines: + - match: ^(\s*{{macro_identifier}})+\s*$ + scope: meta.assumed-macro.c++ + push: + # It's possible that we are dealing with a function return type on its own line, and the + # name of the function is on the subsequent line. + - match: '(?={{path_lookahead}}({{generic_lookahead}}({{path_lookahead}})?)\s*\()' + set: [function-definition-params, global-function-identifier-generic] + - match: '(?={{path_lookahead}}\s*\()' + set: [function-definition-params, global-function-identifier] + - match: ^ + pop: true + + preprocessor-other: + - match: ^\s*(#\s*(?:if|ifdef|ifndef|elif|else|line|pragma|undef))\b + captures: + 1: keyword.control.import.c++ + push: + - meta_scope: meta.preprocessor.c++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - match: \bdefined\b + scope: keyword.control.c++ + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c++ keyword.control.import.c++ + - match: ^\s*(#\s*(?:error|warning))\b + captures: + 1: keyword.control.import.error.c++ + push: + - meta_scope: meta.preprocessor.diagnostic.c++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - include: strings + - match: '\S+' + scope: string.unquoted.c++ + - match: ^\s*(#\s*(?:include|include_next|import))\b + captures: + 1: keyword.control.import.include.c++ + push: + - meta_scope: meta.preprocessor.include.c++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - match: '"' + scope: punctuation.definition.string.begin.c++ + push: + - meta_scope: string.quoted.double.include.c++ + - match: '"' + scope: punctuation.definition.string.end.c++ + pop: true + - match: < + scope: punctuation.definition.string.begin.c++ + push: + - meta_scope: string.quoted.other.lt-gt.include.c++ + - match: '>' + scope: punctuation.definition.string.end.c++ + pop: true + - include: preprocessor-practical-workarounds diff --git a/assets/syntaxes/Packages/C++/C.sublime-syntax b/assets/syntaxes/Packages/C++/C.sublime-syntax new file mode 100644 index 000000000..add0e8882 --- /dev/null +++ b/assets/syntaxes/Packages/C++/C.sublime-syntax @@ -0,0 +1,1311 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: C +file_extensions: + - c + - h +first_line_match: "-[*]-( Mode:)? C -[*]-" +scope: source.c + +variables: + # number exponents + dec_exponent: '(?:[eE][-+]??\d+)' + hex_exponent: '(?:[pP][-+]??\d+)' + + # number suffixes + dec_suffix: '[a-zA-Z_][[:alnum:]_]*' + hex_suffix: '[g-zG-Z_][[:alnum:]_]*' + integer_suffix: '[lL]{1,2}[uU]?|[uU][lL]{0,2}' + + identifier: \b[[:alpha:]_][[:alnum:]_]*\b # upper and lowercase + macro_identifier: \b[[:upper:]_][[:upper:][:digit:]_]{2,}\b # only uppercase, at least 3 chars + control_keywords: 'break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while' + basic_types: 'asm|__asm__|auto|bool|_Bool|char|_Complex|double|float|_Imaginary|int|long|short|signed|unsigned|void' + before_tag: 'struct|union|enum' + microsoft_types: '__int8|__int16|__int32|__int64' + windows_types: 'APIENTRY|ATOM|BOOL|BOOLEAN|BYTE|CALLBACK|CCHAR|CHAR|COLORREF|CONST|DWORD|DWORDLONG|DWORD_PTR|DWORD32|DWORD64|FLOAT|HACCEL|HALF_PTR|HANDLE|HBITMAP|HBRUSH|HCOLORSPACE|HCONV|HCONVLIST|HCURSOR|HDC|HDDEDATA|HDESK|HDROP|HDWP|HENHMETAFILE|HFILE|HFONT|HGDIOBJ|HGLOBAL|HHOOK|HICON|HINSTANCE|HKEY|HKL|HLOCAL|HMENU|HMETAFILE|HMODULE|HMONITOR|HPALETTE|HPEN|HRESULT|HRGN|HRSRC|HSZ|HWINSTA|HWND|INT|INT_PTR|INT8|INT16|INT32|INT64|LANGID|LCID|LCTYPE|LGRPID|LONG|LONGLONG|LONG_PTR|LONG32|LONG64|LPARAM|LPBOOL|LPBYTE|LPCOLORREF|LPCSTR|LPCTSTR|LPCVOID|LPCWSTR|LPDWORD|LPHANDLE|LPINT|LPLONG|LPSTR|LPTSTR|LPVOID|LPWORD|LPWSTR|LRESULT|PBOOL|PBOOLEAN|PBYTE|PCHAR|PCSTR|PCTSTR|PCWSTR|PDWORD|PDWORDLONG|PDWORD_PTR|PDWORD32|PDWORD64|PFLOAT|PHALF_PTR|PHANDLE|PHKEY|PINT|PINT_PTR|PINT8|PINT16|PINT32|PINT64|PLCID|PLONG|PLONGLONG|PLONG_PTR|PLONG32|PLONG64|POINTER_32|POINTER_64|POINTER_SIGNED|POINTER_UNSIGNED|PSHORT|PSIZE_T|PSSIZE_T|PSTR|PTBYTE|PTCHAR|PTSTR|PUCHAR|PUHALF_PTR|PUINT|PUINT_PTR|PUINT8|PUINT16|PUINT32|PUINT64|PULONG|PULONGLONG|PULONG_PTR|PULONG32|PULONG64|PUSHORT|PVOID|PWCHAR|PWORD|PWSTR|QWORD|SC_HANDLE|SC_LOCK|SERVICE_STATUS_HANDLE|SHORT|SIZE_T|SSIZE_T|TBYTE|TCHAR|UCHAR|UHALF_PTR|UINT|UINT_PTR|UINT8|UINT16|UINT32|UINT64|ULONG|ULONGLONG|ULONG_PTR|ULONG32|ULONG64|UNICODE_STRING|USHORT|USN|VOID|WCHAR|WINAPI|WORD|WPARAM' + stdint: 'int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t' + declspec: '__declspec\(\s*\w+(?:\([^)]+\))?\s*\)' + storage_classes: 'static|extern|register|{{declspec}}' + type_qualifier: 'const|volatile' + compiler_directive: 'inline|restrict|__restrict__|__restrict' + modifiers: '{{storage_classes}}|{{type_qualifier}}|{{compiler_directive}}' + non_func_keywords: 'if|for|switch|while|decltype|sizeof|__declspec|__attribute__' + +contexts: + main: + - include: preprocessor-global + - include: global + + ############################################################################# + # Reusable contexts + # + # The follow contexts are currently constructed to be reused in the C++ + # syntax. They are specifically constructed to not push into sub-contexts, + # which ensures that C++ code isn't accidentally lexed as plain C. They also + # should not use the {{identifier}} variable since that is different for C++. + ############################################################################# + + comments: + - match: ^/\* =(\s*.*?)\s*= \*/$\n? + scope: comment.block.c + captures: + 1: meta.toc-list.banner.block.c + - match: /\* + scope: punctuation.definition.comment.c + push: + - meta_scope: comment.block.c + - match: \*/ + scope: punctuation.definition.comment.c + pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.c + - match: \*/(?!\*) + scope: invalid.illegal.stray-comment-end.c + - match: ^// =(\s*.*?)\s*=\s*$\n? + scope: comment.line.banner.c + captures: + 1: meta.toc-list.banner.line.c + - match: // + scope: punctuation.definition.comment.c + push: + - meta_scope: comment.line.double-slash.c + - match: '(\\)$\n' + captures: + 1: punctuation.separator.continuation.c + - match: \n + pop: true + + strings: + - match: '(L|u8|u|U)?(")' + captures: + 1: storage.type.string.c + 2: punctuation.definition.string.begin.c + push: + - meta_scope: string.quoted.double.c + - match: '"' + scope: punctuation.definition.string.end.c + pop: true + - include: string_escaped_char + - include: string_placeholder + - match: "(L|u8|u|U)?(')" + captures: + 1: storage.type.string.c + 2: punctuation.definition.string.begin.c + push: + - meta_scope: string.quoted.single.c + - match: "'" + scope: punctuation.definition.string.end.c + pop: true + - include: string_escaped_char + + string_escaped_char: + - match: '(\\)$\n' + captures: + 1: punctuation.separator.continuation.c + - match: \\(?:\\|[abefnrtv\'"?]|[0-3][0-9]{0,2}|[4-7][0-9]?|x[a-fA-F0-9]+|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}) + scope: constant.character.escape.c + - match: \\. + scope: invalid.illegal.unknown-escape.c + + string_placeholder: + - match: |- + (?x)% + (\d+\$)? # field (argument #) + [#0\- +']* # flags + [,;:_]? # separator character (AltiVec) + ((-?\d+)|\*(-?\d+\$)?)? # minimum field width + (\.((-?\d+)|\*(-?\d+\$)?)?)? # precision + (hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier + (\[[^\]]+\]|[am]s|[diouxXDOUeEfFgGaACcSspn%]) # conversion type + scope: constant.other.placeholder.c + + keywords: + - match: \bbreak\b + scope: keyword.control.flow.break.c + - match: \bcontinue\b + scope: keyword.control.flow.continue.c + - match: \bgoto\b + scope: keyword.control.flow.goto.c + - match: \breturn\b + scope: keyword.control.flow.return.c + - match: \b({{control_keywords}})\b + scope: keyword.control.c + - match: \bsizeof\b + scope: keyword.operator.word.c + + modifiers: + - match: \b({{modifiers}})\b + scope: storage.modifier.c + + variables: + - match: '\bg[A-Z]\w*\b' + scope: variable.other.readwrite.global.mac-classic.c + - match: '\bs[A-Z]\w*\b' + scope: variable.other.readwrite.static.mac-classic.c + + constants: + - match: \b(__func__|NULL|true|false|TRUE|FALSE)\b + scope: constant.language.c + - match: \b(__FILE__|__FUNCTION__|__LINE__)\b + scope: support.constant.c + # common C constant naming idiom -- kConstantVariable + - match: '\bk[A-Z]\w*\b' + scope: constant.other.variable.mac-classic.c + - match: \b(noErr|kNilOptions|kInvalidID|kVariableLengthArray)\b + scope: support.constant.mac-classic.c + + c99: + - match: \b(hypot(f|l)?|s(scanf|ystem|nprintf|ca(nf|lb(n(f|l)?|ln(f|l)?))|i(n(h(f|l)?|f|l)?|gn(al|bit))|tr(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(jmp|vbuf|locale|buf)|qrt(f|l)?|w(scanf|printf)|rand)|n(e(arbyint(f|l)?|xt(toward(f|l)?|after(f|l)?))|an(f|l)?)|c(s(in(h(f|l)?|f|l)?|qrt(f|l)?)|cos(h(f)?|f|l)?|imag(f|l)?|t(ime|an(h(f|l)?|f|l)?)|o(s(h(f|l)?|f|l)?|nj(f|l)?|pysign(f|l)?)|p(ow(f|l)?|roj(f|l)?)|e(il(f|l)?|xp(f|l)?)|l(o(ck|g(f|l)?)|earerr)|a(sin(h(f|l)?|f|l)?|cos(h(f|l)?|f|l)?|tan(h(f|l)?|f|l)?|lloc|rg(f|l)?|bs(f|l)?)|real(f|l)?|brt(f|l)?)|t(ime|o(upper|lower)|an(h(f|l)?|f|l)?|runc(f|l)?|gamma(f|l)?|mp(nam|file))|i(s(space|n(ormal|an)|cntrl|inf|digit|u(nordered|pper)|p(unct|rint)|finite|w(space|c(ntrl|type)|digit|upper|p(unct|rint)|lower|al(num|pha)|graph|xdigit|blank)|l(ower|ess(equal|greater)?)|al(num|pha)|gr(eater(equal)?|aph)|xdigit|blank)|logb(f|l)?|max(div|abs))|di(v|fftime)|_Exit|unget(c|wc)|p(ow(f|l)?|ut(s|c(har)?|wc(har)?)|error|rintf)|e(rf(c(f|l)?|f|l)?|x(it|p(2(f|l)?|f|l|m1(f|l)?)?))|v(s(scanf|nprintf|canf|printf|w(scanf|printf))|printf|f(scanf|printf|w(scanf|printf))|w(scanf|printf)|a_(start|copy|end|arg))|qsort|f(s(canf|e(tpos|ek))|close|tell|open|dim(f|l)?|p(classify|ut(s|c|w(s|c))|rintf)|e(holdexcept|set(e(nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(aiseexcept|ror)|get(e(nv|xceptflag)|round))|flush|w(scanf|ide|printf|rite)|loor(f|l)?|abs(f|l)?|get(s|c|pos|w(s|c))|re(open|e|ad|xp(f|l)?)|m(in(f|l)?|od(f|l)?|a(f|l|x(f|l)?)?))|l(d(iv|exp(f|l)?)|o(ngjmp|cal(time|econv)|g(1(p(f|l)?|0(f|l)?)|2(f|l)?|f|l|b(f|l)?)?)|abs|l(div|abs|r(int(f|l)?|ound(f|l)?))|r(int(f|l)?|ound(f|l)?)|gamma(f|l)?)|w(scanf|c(s(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?|mbs)|pbrk|ftime|len|r(chr|tombs)|xfrm)|to(b|mb)|rtomb)|printf|mem(set|c(hr|py|mp)|move))|a(s(sert|ctime|in(h(f|l)?|f|l)?)|cos(h(f|l)?|f|l)?|t(o(i|f|l(l)?)|exit|an(h(f|l)?|2(f|l)?|f|l)?)|b(s|ort))|g(et(s|c(har)?|env|wc(har)?)|mtime)|r(int(f|l)?|ound(f|l)?|e(name|alloc|wind|m(ove|quo(f|l)?|ainder(f|l)?))|a(nd|ise))|b(search|towc)|m(odf(f|l)?|em(set|c(hr|py|mp)|move)|ktime|alloc|b(s(init|towcs|rtowcs)|towc|len|r(towc|len))))\b + scope: support.function.C99.c + + types: + - match: \b({{basic_types}}|{{before_tag}})\b + scope: storage.type.c + - match: \b(u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|ptrdiff_t)\b + scope: support.type.sys-types.c + - match: \b(pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t)\b + scope: support.type.pthread.c + - match: \b({{stdint}})\b + scope: support.type.stdint.c + - match: '\b({{microsoft_types}})\b' + scope: support.type.microsoft.c + - match: '\b({{windows_types}})\b' + scope: support.type.windows.c + - match: \b(AbsoluteTime|Boolean|Byte|ByteCount|ByteOffset|BytePtr|CompTimeValue|ConstLogicalAddress|ConstStrFileNameParam|ConstStringPtr|Duration|Fixed|FixedPtr|Float32|Float32Point|Float64|Float80|Float96|FourCharCode|Fract|FractPtr|Handle|ItemCount|LogicalAddress|OptionBits|OSErr|OSStatus|OSType|OSTypePtr|PhysicalAddress|ProcessSerialNumber|ProcessSerialNumberPtr|ProcHandle|Ptr|ResType|ResTypePtr|ShortFixed|ShortFixedPtr|SignedByte|SInt16|SInt32|SInt64|SInt8|Size|StrFileName|StringHandle|StringPtr|TimeBase|TimeRecord|TimeScale|TimeValue|TimeValue64|UInt16|UInt32|UInt64|UInt8|UniChar|UniCharCount|UniCharCountPtr|UniCharPtr|UnicodeScalarValue|UniversalProcHandle|UniversalProcPtr|UnsignedFixed|UnsignedFixedPtr|UnsignedWide|UTF16Char|UTF32Char|UTF8Char)\b + scope: support.type.mac-classic.c + + numbers: + # https://en.cppreference.com/w/c/language/floating_constant + + # decimal floats + - match: |- + (?x: + \b\d+ + (?: + (?: (\.) (?: \d+ {{dec_exponent}}? | {{dec_exponent}} | (?=[^.])) | {{dec_exponent}} ) + (?: ([fFlL])\b | ({{dec_suffix}})? ) | ([fF])\b + ) + | (\.) \d+ {{dec_exponent}}? (?: ([fFlL])\b | ({{dec_suffix}})? ) + ) + scope: constant.numeric.float.decimal.c + captures: + 1: punctuation.separator.decimal.c + 2: storage.type.numeric.c + 3: invalid.illegal.numeric.suffix.c + 4: storage.type.numeric.c + 5: punctuation.separator.decimal.c + 6: storage.type.numeric.c + 7: invalid.illegal.numeric.suffix.c + # hexadecimal float (C99) + - match: \b0[xX](?=[[:alnum:].]+?[pP]) + scope: punctuation.definition.numeric.base.c + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.float.hexadecimal.c + - match: '{{hex_exponent}}\b' + pop: true + - match: \. + scope: punctuation.separator.decimal.c + - match: \H + scope: invalid.illegal.numeric.digit.c + + # https://en.cppreference.com/w/c/language/integer_constant + + # hexadecimal integer + - match: \b0[xX] + scope: punctuation.definition.numeric.base.c + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.hexadecimal.c + - include: hexadecimal-suffix + # octal integer + - match: \b0(?=\d) + scope: punctuation.definition.numeric.base.c + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.octal.c + - match: '[89]' + scope: invalid.illegal.numeric.digit.c + - include: decimal-suffix + # decimal integer + - match: \b\d+ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.decimal.c + - include: decimal-suffix + + decimal-suffix: + - match: (?:{{integer_suffix}})?\b + scope: storage.type.numeric.c + pop: true + - match: '{{dec_suffix}}' + scope: invalid.illegal.numeric.suffix.c + pop: true + + hexadecimal-suffix: + - match: (?:{{integer_suffix}})?\b + scope: storage.type.numeric.c + pop: true + - match: '{{hex_suffix}}' + scope: invalid.illegal.numeric.suffix.c + pop: true + + operators: + - match: (?:\+\+|--) + scope: keyword.operator.arithmetic.c + - match: '->' + scope: punctuation.accessor.c + - match: \+\=|-\=|\*\=|/\=|%\=|&\=|\|\=|\^\=|>>\=|<<\= + scope: keyword.operator.assignment.augmented.c + - match: <<|>>|&&|\|\| + scope: keyword.operator.arithmetic.c + - match: <\=|>\=|\=\=|<|>|\!\= + scope: keyword.operator.comparison.c + - match: \+|\-|/|%|\||\^|~|! + scope: keyword.operator.arithmetic.c + # These two operator can be both arithmetic and pointer/address related + - match: \*|& + scope: keyword.operator.c + - match: \= + scope: keyword.operator.assignment.c + # Negative lookahead prevents match :: when included in C++ + - match: '\?|:(?!:)' + scope: keyword.operator.ternary.c + - match: '\.\.\.' + scope: keyword.operator.variadic.c + + access-illegal: + - match: \.\.(?!\.) + scope: invalid.illegal.syntax.c + + access: + - match: '(\.)({{identifier}})(?!\s*\()' + captures: + 1: punctuation.accessor.c + 2: variable.other.member.c + - include: access-illegal + - match: \.(?!\.) + scope: punctuation.accessor.c + + label: + - match: '^\s*((?!default){{identifier}})(:)(?!:)' + captures: + 1: entity.name.label.c + 2: punctuation.separator.c + + preprocessor-disabled: + - match: ^\s*(#\s*if(n?def)?)\b + captures: + 1: meta.preprocessor.c + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c + pop: true + - include: preprocessor-disabled + - include: pragma-mark + - include: pragma-mark + + preprocessor-line-continuation: + - match: '(\\)$\n' + captures: + 1: punctuation.separator.continuation.c + - match: \\(\s+?)$ + captures: + 1: invalid.illegal.space-after-continuation.c + + preprocessor-line-ending: + - match: $\n + pop: true + + # Comment handling in preprocessor directives are complicated by the fact + # that a single-line comment will normally consume the newline to prevent + # completions from being presented to the user. Additionally, a multi-line + # comment without a line continuation ends at the newline. + preprocessor-comments: + - match: /\* + scope: punctuation.definition.comment.c + push: + - meta_scope: comment.block.c + - match: '\\$\n' + scope: punctuation.separator.continuation.c + - match: \*/ + scope: punctuation.definition.comment.c + pop: true + - match: // + scope: punctuation.definition.comment.c + push: + - meta_scope: comment.line.double-slash.c + - match: '(\\)$\n' + captures: + 1: punctuation.separator.continuation.c + pop: true + - match: (?=\n) + pop: true + + pragma-mark: + - match: ^\s*((#\s*pragma\s+mark)\s+(.*)) + scope: meta.section.c + captures: + 1: meta.preprocessor.c + 2: keyword.control.import.pragma.c + 3: meta.toc-list.pragma-mark.c + + # Used by "inc" snippets to prevent double ##include + incomplete-inc: + - match: '^\s*(#i(nc?)?)\b\s*' + scope: meta.preprocessor.incomplete.c + + ############################################################################# + # The following are C-specific scopes that should not be reused. This is + # because they push into subcontexts and use variables that are C-specific. + ############################################################################# + + global: + - include: early-expressions + - match: '^\s*(?=\w+)' + push: global-modifier + - include: late-expressions + + statements: + - include: preprocessor-statements + - include: label + - include: expressions + + expressions: + - include: early-expressions + - include: late-expressions + + early-expressions: + - include: preprocessor-expressions + - include: comments + - include: case-default + - include: typedef + - include: keywords-parens + - include: keywords + - include: numbers + - include: operators + - include: strings + - include: parens + - include: brackets + - include: block + - include: variables + - include: constants + - include: access + - match: ',' + scope: punctuation.separator.c + - match: '\)|\}' + scope: invalid.illegal.stray-bracket-end.c + + late-expressions: + - include: modifiers-parens + - include: modifiers + - include: types + - include: function-call + - match: ';' + scope: punctuation.terminator.c + + ## C-specific contexts + + global-modifier: + - include: comments + - include: modifiers-parens + - include: modifiers + - match: '(?=\S)' + set: global-type + + global-type: + - include: comments + - match: \* + scope: keyword.operator.c + - match: |- + (?x: + ({{before_tag}}) + \s+ + (?= + {{identifier}} + (\s+{{identifier}}(?!\s*[{=;])|\s*\*+) + ) + ) + captures: + 1: storage.type.c + set: global-maybe-function + # The previous match handles return types of struct/enum/etc from a func, + # there this one exits the context to allow matching an actual struct/union + - match: '(?=\b({{before_tag}})\b)' + set: data-structures + - match: '(?=\b({{control_keywords}})\b)' + pop: true + - match: '(?=\s)' + set: global-maybe-function + # Allow a macro call + - match: '({{identifier}})\s*(\()(?=[^\)]+\))' + captures: + 1: variable.function.c + 2: meta.group.c punctuation.section.group.begin.c + push: + - meta_scope: meta.function-call.c + - meta_content_scope: meta.group.c + - match: '\)' + scope: meta.group.c punctuation.section.group.end.c + pop: true + - include: expressions + - match: (?={{identifier}}\s*\() + set: + - include: function-call + - match: '' + pop: true + - include: types + - match: '{{identifier}}' + - match: (?=\W) + pop: true + + global-maybe-function: + - include: comments + # Consume pointer info, macros and any type info that was offset by macros + - match: \* + scope: keyword.operator.c + - include: types + - include: modifiers-parens + - include: modifiers + # All uppercase identifier just before a newline is most likely a macro + - match: '[[:upper:][:digit:]_]+\s*$' + # Identifier that is not the function name - likely a macro + - match: '{{identifier}}(?!\s*(\(|$))' + # Real function definition + - match: '{{identifier}}(?=\s*(\(|$))' + scope: meta.function.c entity.name.function.c + set: function-definition-params + - match: '(?=\S)' + pop: true + + function-definition-params: + - meta_content_scope: meta.function.c + - include: comments + - match: '(?=\()' + set: + - match: \( + scope: meta.function.parameters.c meta.group.c punctuation.section.group.begin.c + set: + - meta_content_scope: meta.function.parameters.c meta.group.c + - match : \) + scope: punctuation.section.group.end.c + set: function-definition-continue + - match: '\bvoid\b' + scope: storage.type.c + - match: '{{identifier}}(?=\s*(\[|,|\)))' + scope: variable.parameter.c + - include: expressions + - include: preprocessor-line-continuation + - match: (?=\S) + pop: true + + function-definition-continue: + - meta_content_scope: meta.function.c + - include: comments + - match: '(?=;)' + pop: true + - match: \b(const|final|noexcept|override)\b + scope: storage.modifier.c + - match: '(?=\{)' + set: function-definition-body + - match: '(?=\S)' + pop: true + + function-definition-body: + - meta_content_scope: meta.function.c + - match: '\{' + scope: meta.block.c punctuation.section.block.begin.c + set: + - meta_content_scope: meta.function.c meta.block.c + - match: '\}' + scope: meta.function.c meta.block.c punctuation.section.block.end.c + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '(?=({{before_tag}})([^(;]+$|.*\{))' + push: data-structures + - include: statements + + data-structures: + # Detect variable type definitions using struct/enum/union followed by a tag + - match: '\b({{before_tag}})(?=\s+{{identifier}}\s+{{identifier}}\s*[=;\[])' + scope: storage.type.c + - match: '\bstruct\b' + scope: storage.type.c + set: data-structures-struct-definition + - match: '\benum\b' + scope: storage.type.c + set: data-structures-enum-definition + - match: '\bunion\b' + scope: storage.type.c + set: data-structures-union-definition + - match: '(?=\S)' + pop: true + + data-structures-struct-definition: + - meta_scope: meta.struct.c + - include: data-structures-definition-common-begin + - include: data-structures-definition-common-macro + - match: '{{identifier}}(?=\s*;)' + scope: entity.name.struct.forward-decl.c + - match: '{{identifier}}' + scope: entity.name.struct.c + set: data-structures-struct-definition-after-name + - include: data-structures-struct-definition-block-start + - match: '(?=;)' + pop: true + + data-structures-struct-definition-after-name: + - meta_scope: meta.struct.c + - include: data-structures-definition-common-begin + - match: '(?=;)' + pop: true + - include: data-structures-struct-definition-block-start + + data-structures-struct-definition-block-start: + - match: '\{' + scope: meta.block.c punctuation.section.block.begin.c + set: + - meta_content_scope: meta.struct.c meta.block.c + - match: '\}' + scope: meta.struct.c meta.block.c punctuation.section.block.end.c + pop: true + - include: data-structures-body + + data-structures-enum-definition: + - meta_scope: meta.enum.c + - include: data-structures-definition-common-begin + - include: data-structures-definition-common-macro + - match: '{{identifier}}(?=\s*;)' + scope: entity.name.enum.forward-decl.c + - match: '{{identifier}}' + scope: entity.name.enum.c + set: data-structures-enum-definition-after-name + - include: data-structures-enum-definition-block-start + - match: '(?=;)' + pop: true + + data-structures-enum-definition-after-name: + - meta_scope: meta.enum.c + - include: data-structures-definition-common-begin + - match: '(?=;)' + pop: true + - include: data-structures-enum-definition-block-start + + data-structures-enum-definition-block-start: + - match: '\{' + scope: meta.block.c punctuation.section.block.begin.c + set: + - meta_content_scope: meta.enum.c meta.block.c + # Enums don't support methods so we have a simplified body + - match: '\}' + scope: meta.enum.c meta.block.c punctuation.section.block.end.c + pop: true + - include: data-structures-body + + data-structures-union-definition: + - meta_scope: meta.union.c + - include: data-structures-definition-common-begin + - include: data-structures-definition-common-macro + - match: '{{identifier}}(?=\s*;)' + scope: entity.name.union.forward-decl.c + - match: '{{identifier}}' + scope: entity.name.union.c + set: data-structures-union-definition-after-name + - include: data-structures-union-definition-block-start + - match: '(?=;)' + pop: true + + data-structures-union-definition-after-name: + - meta_scope: meta.union.c + - include: data-structures-definition-common-begin + - match: '(?=;)' + pop: true + - include: data-structures-union-definition-block-start + + data-structures-union-definition-block-start: + - match: '\{' + scope: meta.block.c punctuation.section.block.begin.c + set: + - meta_content_scope: meta.union.c meta.block.c + - match: '\}' + scope: meta.union.c meta.block.c punctuation.section.block.end.c + pop: true + - include: data-structures-body + + data-structures-definition-common-begin: + - include: comments + - match: '(?=\b(?:{{before_tag}}|{{control_keywords}})\b)' + pop: true + - include: modifiers-parens + - include: modifiers + + data-structures-definition-common-macro: + # Handle macros so they aren't matched as the class name + - match: '\b[[:upper:][:digit:]_]+\b(?!\s*($|\{))' + + data-structures-definition-common-end: + - match: '(?=;)' + pop: true + + data-structures-body: + - include: preprocessor-data-structures + - match: '(?={{before_tag}})' + push: data-structures + - include: expressions + + block: + - match: '\{' + scope: punctuation.section.block.begin.c + push: + - meta_scope: meta.block.c + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '\}' + scope: punctuation.section.block.end.c + pop: true + - include: statements + + parens: + - match: \( + scope: punctuation.section.group.begin.c + push: + - meta_scope: meta.group.c + - match: \) + scope: punctuation.section.group.end.c + pop: true + - include: expressions + + brackets: + - match: \[ + scope: punctuation.section.brackets.begin.c + push: + - meta_scope: meta.brackets.c + - match: \] + scope: punctuation.section.brackets.end.c + pop: true + - include: expressions + + case-default: + - match: '\b(default|case)\b' + scope: keyword.control.c + push: + - match: ':' + scope: punctuation.separator.c + pop: true + - include: expressions + + modifiers-parens: + - match: \b(__attribute__)\s*(\(\() + captures: + 1: storage.modifier.c + 2: meta.group.c punctuation.section.group.begin.c + push : + - meta_scope: meta.attribute.c + - meta_content_scope: meta.group.c + - include: parens + - include: strings + - match: \)\) + scope: meta.group.c punctuation.section.group.end.c + pop: true + - match: \b(__declspec)(\() + captures: + 1: storage.modifier.c + 2: meta.group.c punctuation.section.group.begin.c + push: + - meta_content_scope: meta.group.c + - match: '\)' + scope: meta.group.c punctuation.section.group.end.c + pop: true + - match: '\b(align|allocate|code_seg|deprecated|property|uuid)\b\s*(\()' + captures: + 1: storage.modifier.c + 2: meta.group.c punctuation.section.group.begin.c + push: + - meta_content_scope: meta.group.c + - match: '\)' + scope: meta.group.c punctuation.section.group.end.c + pop: true + - include: numbers + - include: strings + - match: \b(get|put)\b + scope: variable.parameter.c + - match: ',' + scope: punctuation.separator.c + - match: '=' + scope: keyword.operator.assignment.c + - match: '\b(appdomain|deprecated|dllimport|dllexport|jintrinsic|naked|noalias|noinline|noreturn|nothrow|novtable|process|restrict|safebuffers|selectany|thread)\b' + scope: constant.other.c + + keywords-parens: + - match: '\b(sizeof)\b\s*(\()' + captures: + 1: keyword.operator.word.c + 2: meta.group.c punctuation.section.group.begin.c + push: + - meta_content_scope: meta.group.c + - match: '\)' + scope: meta.group.c punctuation.section.group.end.c + pop: true + - include: expressions + + typedef: + - match: \btypedef\b + scope: storage.type.c + push: + - match: ({{identifier}})?\s*(?=;) + captures: + 1: entity.name.type.typedef.c + pop: true + - match: \b(struct)\s+({{identifier}}) + captures: + 1: storage.type.c + - include: expressions + + function-call: + - match: (?={{identifier}}\s*\() + push: + - meta_content_scope: meta.function-call.c + - include: c99 + - match: '{{identifier}}' + scope: variable.function.c + - match: '\(' + scope: meta.group.c punctuation.section.group.begin.c + set: + - meta_content_scope: meta.function-call.c meta.group.c + - match : \) + scope: meta.function-call.c meta.group.c punctuation.section.group.end.c + pop: true + - include: expressions + + ## Preprocessor for data-structures + + preprocessor-data-structures: + - include: preprocessor-rule-enabled-data-structures + - include: preprocessor-rule-disabled-data-structures + + preprocessor-rule-disabled-data-structures: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.c + 2: keyword.control.import.c + 3: constant.numeric.integer.decimal.c + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c keyword.control.import.else.c + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: data-structures-body + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.c + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: preprocessor-disabled + + preprocessor-rule-enabled-data-structures: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.c + 2: keyword.control.import.c + 3: constant.numeric.integer.decimal.c + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c keyword.control.import.else.c + push: + - meta_content_scope: comment.block.preprocessor.else-branch.c + - match: (?=^\s*#\s*endif\b) + pop: true + - include: preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: data-structures-body + + ## Preprocessor for global + + preprocessor-global: + - include: preprocessor-rule-enabled-global + - include: preprocessor-rule-disabled-global + - include: preprocessor-rule-other-global + + preprocessor-statements: + - include: preprocessor-rule-enabled-statements + - include: preprocessor-rule-disabled-statements + - include: preprocessor-rule-other-statements + + preprocessor-expressions: + - include: incomplete-inc + - include: preprocessor-macro-define + - include: pragma-mark + - include: preprocessor-other + + preprocessor-rule-disabled-global: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.c + 2: keyword.control.import.c + 3: constant.numeric.integer.decimal.c + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c keyword.control.import.else.c + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.c + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: preprocessor-disabled + + preprocessor-rule-enabled-global: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.c + 2: keyword.control.import.c + 3: constant.numeric.integer.decimal.c + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c keyword.control.import.else.c + push: + - meta_content_scope: comment.block.preprocessor.else-branch.c + - match: (?=^\s*#\s*endif\b) + pop: true + - include: preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + + preprocessor-rule-other-global: + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: keyword.control.import.c + push: + - meta_scope: meta.preprocessor.c + - include: preprocessor-line-continuation + - include: preprocessor-comments + - match: \bdefined\b + scope: keyword.control.c + # Enter a new scope where all elif/else branches have their + # contexts popped by a subsequent elif/else/endif. This ensures that + # preprocessor branches don't push multiple meta.block scopes on + # the stack, thus messing up the "global" context's detection of + # functions. + - match: $\n + set: preprocessor-if-branch-global + + # These gymnastics here ensure that we are properly handling scope even + # when the preprocessor is used to create different scope beginnings, such + # as a different if/while condition + preprocessor-if-branch-global: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-global + - match: \{ + scope: punctuation.section.block.begin.c + set: preprocessor-block-if-branch-global + - include: preprocessor-global + - include: negated-block + - include: global + + preprocessor-block-if-branch-global: + - meta_scope: meta.block.c + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + set: preprocessor-block-finish-global + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-global + - match: \} + scope: punctuation.section.block.end.c + set: preprocessor-if-branch-global + - include: statements + + preprocessor-block-finish-global: + - meta_scope: meta.block.c + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + set: preprocessor-block-finish-if-branch-global + - match: \} + scope: punctuation.section.block.end.c + pop: true + - include: statements + + preprocessor-block-finish-if-branch-global: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: \} + scope: punctuation.section.block.end.c + set: preprocessor-if-branch-global + - include: statements + + preprocessor-elif-else-branch-global: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: preprocessor-global + - include: global + + ## Preprocessor for statements + + preprocessor-rule-disabled-statements: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.c + 2: keyword.control.import.c + 3: constant.numeric.integer.decimal.c + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c keyword.control.import.else.c + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: statements + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.c + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: preprocessor-disabled + + preprocessor-rule-enabled-statements: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.c + 2: keyword.control.import.c + 3: constant.numeric.integer.decimal.c + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.c keyword.control.import.else.c + push: + - meta_content_scope: comment.block.preprocessor.else-branch.c + - match: (?=^\s*#\s*endif\b) + pop: true + - include: preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: statements + + preprocessor-rule-other-statements: + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: keyword.control.import.c + push: + - meta_scope: meta.preprocessor.c + - include: preprocessor-line-continuation + - include: preprocessor-comments + - match: \bdefined\b + scope: keyword.control.c + # Enter a new scope where all elif/else branches have their + # contexts popped by a subsequent elif/else/endif. This ensures that + # preprocessor branches don't push multiple meta.block scopes on + # the stack, thus messing up the "global" context's detection of + # functions. + - match: $\n + set: preprocessor-if-branch-statements + + # These gymnastics here ensure that we are properly handling scope even + # when the preprocessor is used to create different scope beginnings, such + # as a different if/while condition + preprocessor-if-branch-statements: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-statements + - match: \{ + scope: punctuation.section.block.begin.c + set: preprocessor-block-if-branch-statements + - match: (?=(?!{{non_func_keywords}}){{identifier}}\s*\() + set: preprocessor-if-branch-function-call + - include: negated-block + - include: statements + + preprocessor-if-branch-function-call: + - meta_content_scope: meta.function-call.c + - include: c99 + - match: '{{identifier}}' + scope: variable.function.c + - match: '\(' + scope: meta.group.c punctuation.section.group.begin.c + set: preprocessor-if-branch-function-call-arguments + + preprocessor-if-branch-function-call-arguments: + - meta_content_scope: meta.function-call.c meta.group.c + - match : \) + scope: meta.function-call.c meta.group.c punctuation.section.group.end.c + set: preprocessor-if-branch-statements + - match: ^\s*(#\s*(?:elif|else))\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + set: preprocessor-if-branch-statements + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + set: preprocessor-if-branch-function-call-arguments-finish + - include: expressions + + preprocessor-if-branch-function-call-arguments-finish: + - meta_content_scope: meta.function-call.c meta.group.c + - match: \) + scope: meta.function-call.c meta.group.c punctuation.section.group.end.c + pop: true + - include: expressions + + preprocessor-block-if-branch-statements: + - meta_scope: meta.block.c + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + set: preprocessor-block-finish-statements + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-statements + - match: \} + scope: punctuation.section.block.end.c + set: preprocessor-if-branch-statements + - include: statements + + preprocessor-block-finish-statements: + - meta_scope: meta.block.c + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + set: preprocessor-block-finish-if-branch-statements + - match: \} + scope: punctuation.section.block.end.c + pop: true + - include: statements + + preprocessor-block-finish-if-branch-statements: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + pop: true + - match: \} + scope: punctuation.section.block.end.c + set: preprocessor-if-branch-statements + - include: statements + + preprocessor-elif-else-branch-statements: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: statements + + ## Preprocessor other + + negated-block: + - match: '\}' + scope: punctuation.section.block.end.c + push: + - match: '\{' + scope: punctuation.section.block.begin.c + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - include: statements + + preprocessor-macro-define: + - match: ^\s*(#\s*define)\b + captures: + 1: meta.preprocessor.macro.c keyword.control.import.define.c + push: + - meta_content_scope: meta.preprocessor.macro.c + - include: preprocessor-line-continuation + - include: preprocessor-line-ending + - include: preprocessor-comments + - match: '({{identifier}})(?=\()' + scope: entity.name.function.preprocessor.c + set: + - match: '\(' + scope: punctuation.section.group.begin.c + set: preprocessor-macro-params + - match: '{{identifier}}' + scope: entity.name.constant.preprocessor.c + set: preprocessor-macro-definition + + preprocessor-macro-params: + - meta_scope: meta.preprocessor.macro.parameters.c meta.group.c + - match: '{{identifier}}' + scope: variable.parameter.c + - match: \) + scope: punctuation.section.group.end.c + set: preprocessor-macro-definition + - match: ',' + scope: punctuation.separator.c + push: + - match: '{{identifier}}' + scope: variable.parameter.c + pop: true + - include: preprocessor-line-continuation + - include: preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.c + - match: '(?=\))' + pop: true + - match: (/\*).*(\*/) + scope: comment.block.c + captures: + 1: punctuation.definition.comment.c + 2: punctuation.definition.comment.c + - match: '\S+' + scope: invalid.illegal.unexpected-character.c + - include: preprocessor-line-continuation + - include: preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.c + - match: (/\*).*(\*/) + scope: comment.block.c + captures: + 1: punctuation.definition.comment.c + 2: punctuation.definition.comment.c + - match: $\n + scope: invalid.illegal.unexpected-end-of-line.c + + preprocessor-macro-definition: + - meta_content_scope: meta.preprocessor.macro.c + - include: preprocessor-line-continuation + - include: preprocessor-line-ending + - include: preprocessor-comments + # Don't define blocks in define statements + - match: '\{' + scope: punctuation.section.block.begin.c + - match: '\}' + scope: punctuation.section.block.end.c + - include: expressions + + preprocessor-practical-workarounds: + - include: preprocessor-convention-ignore-uppercase-ident-lines + - include: preprocessor-convention-ignore-uppercase-calls-without-semicolon + + preprocessor-convention-ignore-uppercase-ident-lines: + - match: ^(\s*{{macro_identifier}})+\s*$ + scope: meta.assumed-macro.c + push: + # It's possible that we are dealing with a function return type on its own line, and the + # name of the function is on the subsequent line. + - match: \s*({{identifier}})(?=\s*\() + captures: + 1: meta.function.c entity.name.function.c + set: function-definition-params + - match: ^ + pop: true + + + preprocessor-convention-ignore-uppercase-calls-without-semicolon: + - match: ^\s*({{macro_identifier}})\s*(\()(?=[^)]*\)\s*$) + captures: + 1: variable.function.assumed-macro.c + 2: punctuation.section.group.begin.c + push: + - meta_scope: meta.assumed-macro.c + - match: \) + scope: punctuation.section.group.end.c + pop: true + - include: expressions + + preprocessor-other: + - match: ^\s*(#\s*(?:if|ifdef|ifndef|elif|else|line|pragma|undef))\b + captures: + 1: keyword.control.import.c + push: + - meta_scope: meta.preprocessor.c + - include: preprocessor-line-continuation + - include: preprocessor-line-ending + - include: preprocessor-comments + - match: \bdefined\b + scope: keyword.control.c + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.c keyword.control.import.c + - match: ^\s*(#\s*(?:error|warning))\b + captures: + 1: keyword.control.import.error.c + push: + - meta_scope: meta.preprocessor.diagnostic.c + - include: preprocessor-line-continuation + - include: preprocessor-line-ending + - include: preprocessor-comments + - include: strings + - match: '\S+' + scope: string.unquoted.c + - match: ^\s*(#\s*(?:include|include_next|import))\b + captures: + 1: keyword.control.import.include.c + push: + - meta_scope: meta.preprocessor.include.c + - include: preprocessor-line-continuation + - include: preprocessor-line-ending + - include: preprocessor-comments + - match: '"' + scope: punctuation.definition.string.begin.c + push: + - meta_scope: string.quoted.double.include.c + - match: '"' + scope: punctuation.definition.string.end.c + pop: true + - match: < + scope: punctuation.definition.string.begin.c + push: + - meta_scope: string.quoted.other.lt-gt.include.c + - match: ">" + scope: punctuation.definition.string.end.c + pop: true + - include: preprocessor-practical-workarounds diff --git a/assets/syntaxes/Packages/C++/Comments (C++).tmPreferences b/assets/syntaxes/Packages/C++/Comments (C++).tmPreferences new file mode 100644 index 000000000..d9485b297 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Comments (C++).tmPreferences @@ -0,0 +1,51 @@ + + + + name + Comments + scope + source.c, source.c++, source.objc, source.objc++ + settings + + shellVariables + + + name + TM_COMMENT_START + value + // + + + name + TM_COMMENT_START_2 + value + /* + + + name + TM_COMMENT_END_2 + value + */ + + + name + TM_COMMENT_DISABLE_INDENT_2 + value + yes + + + name + TM_COMMENT_START_3 + value + /// + + + name + TM_COMMENT_START_4 + value + //! + + + + + diff --git a/assets/syntaxes/Packages/C++/Completion Rules.tmPreferences b/assets/syntaxes/Packages/C++/Completion Rules.tmPreferences new file mode 100644 index 000000000..79ea22a9f --- /dev/null +++ b/assets/syntaxes/Packages/C++/Completion Rules.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + source.c, source.c++, source.objc, source.objc++ + settings + + cancelCompletion + (^.*\bconst\s*$)|^\s*(\}?\s*(else|try|do|#if|#ifdef|#else|#elif|#endif|#pragma\s+once)|(class|struct|union|enum|namespace)\s*[a-zA-Z_0-9]+*)$ + + + diff --git a/assets/syntaxes/Packages/C++/Default.sublime-keymap b/assets/syntaxes/Packages/C++/Default.sublime-keymap new file mode 100644 index 000000000..7bf907a60 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Default.sublime-keymap @@ -0,0 +1,41 @@ +[ + // Auto-pair less-than and greater-than symbols in include statements + { "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<$0>"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, + { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.other - punctuation.definition.string.end", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "(source.c | source.c++) & meta.preprocessor.include" } + ] + }, + { "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${0:$SELECTION}>"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "(source.c | source.c++) & meta.preprocessor.include" } + ] + }, + { "keys": [">"], "command": "move", "args": {"by": "characters", "forward": true}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.other - punctuation.definition.string.end", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "(source.c | source.c++) & meta.preprocessor.include" } + ] + }, + { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.other - punctuation.definition.string.end", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "(source.c | source.c++) & meta.preprocessor.include" } + ] + }, +] diff --git a/assets/syntaxes/Packages/C++/Indentation Rules Comments.tmPreferences b/assets/syntaxes/Packages/C++/Indentation Rules Comments.tmPreferences new file mode 100644 index 000000000..a15a5d28f --- /dev/null +++ b/assets/syntaxes/Packages/C++/Indentation Rules Comments.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Indentation Rules + scope + + settings + + unIndentedLinePattern + . + + + diff --git a/assets/syntaxes/Packages/C++/Indentation Rules.tmPreferences b/assets/syntaxes/Packages/C++/Indentation Rules.tmPreferences new file mode 100644 index 000000000..479f54784 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Indentation Rules.tmPreferences @@ -0,0 +1,36 @@ + + + + name + Indentation Rules + scope + source.c, source.c++, source.objc, source.objc++ + settings + + decreaseIndentPattern + (?x) + ^ (.*\*/)? \s* \} .* $ + | ^ \s* (public|private|protected): \s* $ + | ^ \s* @(public|private|protected) \s* $ + + increaseIndentPattern + (?x) + ^ .* \{ [^}"']* $ + | ^ \s* (public|private|protected): \s* $ + | ^ \s* @(public|private|protected) \s* $ + + + bracketIndentNextLinePattern + (?x) + ^ \s* \b(if|while|else)\b [^;]* $ + | ^ \s* \b(for)\b .* $ + + + unIndentedLinePattern + (?!\(.*\))|@protocol|@interface(?!.*\{)|@implementation|@end).*)?$]]> + + indentSquareBrackets + + + + diff --git a/assets/syntaxes/Packages/C++/Snippets/#ifndef-#define-#endif.sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/#ifndef-#define-#endif.sublime-snippet new file mode 100644 index 000000000..fd3d8727e --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/#ifndef-#define-#endif.sublime-snippet @@ -0,0 +1,8 @@ + + #ifndef … #define … #endif + + def + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/#include-(#inc angle).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/#include-(#inc angle).sublime-snippet new file mode 100644 index 000000000..b9ac3ce36 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/#include-(#inc angle).sublime-snippet @@ -0,0 +1,6 @@ + + #include <…> + ]]> + inc + (source.c | source.objc | source.c++ | source.objc++) & meta.preprocessor.incomplete - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/#include-(#inc).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/#include-(#inc).sublime-snippet new file mode 100644 index 000000000..87dc70a42 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/#include-(#inc).sublime-snippet @@ -0,0 +1,6 @@ + + #include "…" + + inc + (source.c | source.objc | source.c++ | source.objc++) & meta.preprocessor.incomplete - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/#include-(inc angle).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/#include-(inc angle).sublime-snippet new file mode 100644 index 000000000..e432c196c --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/#include-(inc angle).sublime-snippet @@ -0,0 +1,6 @@ + + #include <…> + ]]> + Inc + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.incomplete - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/#include-(inc).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/#include-(inc).sublime-snippet new file mode 100644 index 000000000..f3d129b2d --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/#include-(inc).sublime-snippet @@ -0,0 +1,6 @@ + + #include "…" + + inc + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.incomplete - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/$1.begin()-$1.end()-(beginend).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/$1.begin()-$1.end()-(beginend).sublime-snippet new file mode 100644 index 000000000..e425d7859 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/$1.begin()-$1.end()-(beginend).sublime-snippet @@ -0,0 +1,6 @@ + + $1.begin(), $1.end() + )?$/(?2::(?1:>:.))/}begin(), ${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end()]]> + beginend + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/030-for-int-loop-(fori).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/030-for-int-loop-(fori).sublime-snippet new file mode 100644 index 000000000..5210ba9ec --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/030-for-int-loop-(fori).sublime-snippet @@ -0,0 +1,9 @@ + + For Loop + + for + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/Enumeration.sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/Enumeration.sublime-snippet new file mode 100644 index 000000000..94604d272 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/Enumeration.sublime-snippet @@ -0,0 +1,9 @@ + + Enumeration + + enum + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/Typedef.sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/Typedef.sublime-snippet new file mode 100644 index 000000000..413e2d2ee --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/Typedef.sublime-snippet @@ -0,0 +1,6 @@ + + Typedef + + td + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/class-..-(class).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/class-..-(class).sublime-snippet new file mode 100644 index 000000000..27eeaa60d --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/class-..-(class).sublime-snippet @@ -0,0 +1,11 @@ + + + class + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/do...while-loop-(do).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/do...while-loop-(do).sublime-snippet new file mode 100644 index 000000000..e33d11098 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/do...while-loop-(do).sublime-snippet @@ -0,0 +1,9 @@ + + Do While Loop + + do + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/forv.sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/forv.sublime-snippet new file mode 100644 index 000000000..659386673 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/forv.sublime-snippet @@ -0,0 +1,9 @@ + + Vector For Loop + ::iterator ${3:i} = $2.begin(); $3 != $2.end(); ++$3) +{ + $0 +}]]> + forv + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/fprintf.sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/fprintf.sublime-snippet new file mode 100644 index 000000000..ad0a43abf --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/fprintf.sublime-snippet @@ -0,0 +1,6 @@ + + fprintf … + + fprintf + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/if-..-(if).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/if-..-(if).sublime-snippet new file mode 100644 index 000000000..05e018114 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/if-..-(if).sublime-snippet @@ -0,0 +1,9 @@ + + If Condition + + if + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/main()-(int main).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/main()-(int main).sublime-snippet new file mode 100644 index 000000000..26b784ad3 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/main()-(int main).sublime-snippet @@ -0,0 +1,10 @@ + + main() + + main + (source.c | source.objc | source.c++ | source.objc++) & entity.name.function - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/main()-(main).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/main()-(main).sublime-snippet new file mode 100644 index 000000000..1390ca11e --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/main()-(main).sublime-snippet @@ -0,0 +1,10 @@ + + main() + + main + (source.c | source.objc | source.c++ | source.objc++) - entity.name.function - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/namespace-..-(namespace).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/namespace-..-(namespace).sublime-snippet new file mode 100644 index 000000000..ea4ba0901 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/namespace-..-(namespace).sublime-snippet @@ -0,0 +1,10 @@ + + Namespace + + ns + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/printf-..-(printf).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/printf-..-(printf).sublime-snippet new file mode 100644 index 000000000..4eab293e7 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/printf-..-(printf).sublime-snippet @@ -0,0 +1,6 @@ + + printf … + + printf + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/read-file-(readF).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/read-file-(readF).sublime-snippet new file mode 100644 index 000000000..dbdbac0a8 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/read-file-(readF).sublime-snippet @@ -0,0 +1,13 @@ + + Read File Into Vector + v; +if (FILE${TM_C_POINTER: *}fp = fopen(${1:"filename"}, "r")) +{ + char buf[1024]; + while (size_t len = fread(buf, 1, sizeof(buf), fp)) + v.insert(v.end(), buf, buf + len); + fclose(fp); +}]]> + readfile + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/std-map-(map).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/std-map-(map).sublime-snippet new file mode 100644 index 000000000..9b955dfe7 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/std-map-(map).sublime-snippet @@ -0,0 +1,6 @@ + + std::map + map$0;]]> + map + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/std-vector-(v).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/std-vector-(v).sublime-snippet new file mode 100644 index 000000000..d57107eb6 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/std-vector-(v).sublime-snippet @@ -0,0 +1,6 @@ + + std::vector + v$0;]]> + vector + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/struct.sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/struct.sublime-snippet new file mode 100644 index 000000000..ae642d529 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/struct.sublime-snippet @@ -0,0 +1,9 @@ + + Struct + + struct + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Snippets/template-typename-..-(template).sublime-snippet b/assets/syntaxes/Packages/C++/Snippets/template-typename-..-(template).sublime-snippet new file mode 100644 index 000000000..47b9f16c1 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Snippets/template-typename-..-(template).sublime-snippet @@ -0,0 +1,6 @@ + + template <typename ${1:_InputIter}> + ]]> + tp + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string + diff --git a/assets/syntaxes/Packages/C++/Symbol Index Hide Ctors.tmPreferences b/assets/syntaxes/Packages/C++/Symbol Index Hide Ctors.tmPreferences new file mode 100644 index 000000000..dca865c08 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Symbol Index Hide Ctors.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + + settings + + showInIndexedSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/C++/Symbol Index Include Constants.tmPreferences b/assets/syntaxes/Packages/C++/Symbol Index Include Constants.tmPreferences new file mode 100644 index 000000000..458294347 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Symbol Index Include Constants.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + + settings + + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/C++/Symbol Index.tmPreferences b/assets/syntaxes/Packages/C++/Symbol Index.tmPreferences new file mode 100644 index 000000000..3441721fa --- /dev/null +++ b/assets/syntaxes/Packages/C++/Symbol Index.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + source.c++, source.objc++ + settings + + symbolIndexTransformation + /.*::\s*([A-Za-z0-9_~]+)/$1/; + + + diff --git a/assets/syntaxes/Packages/C++/Symbol List - Indent Class Methods.tmPreferences b/assets/syntaxes/Packages/C++/Symbol List - Indent Class Methods.tmPreferences new file mode 100644 index 000000000..4b8be0460 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Symbol List - Indent Class Methods.tmPreferences @@ -0,0 +1,16 @@ + + + + bundleUUID + 4675A940-6227-11D9-BFB1-000D93589AF6 + name + Symbol List: Indent Class Methods + scope + + settings + + symbolTransformation + s/^\s*/ /; # pad + + + diff --git a/assets/syntaxes/Packages/C++/Symbol List - Namespace Spacing.tmPreferences b/assets/syntaxes/Packages/C++/Symbol List - Namespace Spacing.tmPreferences new file mode 100644 index 000000000..ea23339d5 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Symbol List - Namespace Spacing.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List + scope + + settings + + symbolTransformation + s/\s*::\s*/::/; # consistent spacing around ns separator + + + diff --git a/assets/syntaxes/Packages/C++/Symbol List - Prefix Banner Items.tmPreferences b/assets/syntaxes/Packages/C++/Symbol List - Prefix Banner Items.tmPreferences new file mode 100644 index 000000000..18f9db7d2 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Symbol List - Prefix Banner Items.tmPreferences @@ -0,0 +1,17 @@ + + + + name + Symbol List: Prefix Banner Items + scope + meta.toc-list.banner + settings + + symbolTransformation + + s/^\s+/# /; + s/^=+$/-/; + + + + diff --git a/assets/syntaxes/Packages/C++/Symbol List Hide Forward Decls.tmPreferences b/assets/syntaxes/Packages/C++/Symbol List Hide Forward Decls.tmPreferences new file mode 100644 index 000000000..42f66b141 --- /dev/null +++ b/assets/syntaxes/Packages/C++/Symbol List Hide Forward Decls.tmPreferences @@ -0,0 +1,14 @@ + + + + scope + + settings + + showInSymbolList + 0 + showInIndexedSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/C++/Symbol List.tmPreferences b/assets/syntaxes/Packages/C++/Symbol List.tmPreferences new file mode 100644 index 000000000..e2373a45b --- /dev/null +++ b/assets/syntaxes/Packages/C++/Symbol List.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List + scope + + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/C++/syntax_test_accessor.c b/assets/syntaxes/Packages/C++/syntax_test_accessor.c new file mode 100644 index 000000000..df99affa0 --- /dev/null +++ b/assets/syntaxes/Packages/C++/syntax_test_accessor.c @@ -0,0 +1,35 @@ +// SYNTAX TEST "Packages/C++/C.sublime-syntax" + +typedef struct _X +{ + int a; + int b; +} X; + +int main() +{ + X x; + x. +// ^ punctuation.accessor +} + +int main() +{ + X x; + x.. +// ^^ invalid.illegal - punctuation.accessor +} + +int main() +{ + X x; + x... +// ^^^ keyword - punctuation.accessor +} + +int main() +{ + X* x = malloc(sizeof(X)); + x-> +// ^^ punctuation.accessor +} diff --git a/assets/syntaxes/Packages/C++/syntax_test_accessor.cpp b/assets/syntaxes/Packages/C++/syntax_test_accessor.cpp new file mode 100644 index 000000000..e20a7bb04 --- /dev/null +++ b/assets/syntaxes/Packages/C++/syntax_test_accessor.cpp @@ -0,0 +1,68 @@ +// SYNTAX TEST "Packages/C++/C++.sublime-syntax" + +namespace N { + +class X +{ + public: + int a; + int b; +}; + +class Y : public X +{ + public: + int c; +} + +} // namespace N + +int main() +{ + N:: +// ^^ punctuation.accessor +} + +int main() +{ + N::X x; + x. +// ^ punctuation.accessor +} + +int main() +{ + N::X x; + x.. +// ^^ - punctuation.accessor +} + +int main() +{ + N::X x; + x... +// ^^^ keyword - punctuation.accessor +} + +int main() +{ + N::X* x = new X(); + x-> +// ^^ punctuation.accessor +} + +int main() +{ + N::Y y; + y.X:: +// ^ punctuation.accessor +// ^^ punctuation.accessor +} + +int main() +{ + N::Y* y = new Y(); + y->X:: +// ^^ punctuation.accessor +// ^^ punctuation.accessor +} diff --git a/assets/syntaxes/Packages/C++/syntax_test_c.c b/assets/syntaxes/Packages/C++/syntax_test_c.c new file mode 100644 index 000000000..1284a8bc3 --- /dev/null +++ b/assets/syntaxes/Packages/C++/syntax_test_c.c @@ -0,0 +1,939 @@ +/* SYNTAX TEST "Packages/C++/C.sublime-syntax" */ + +int main(){ + int a=5,b=0; + while(a-->0)++b; + /* ^^ keyword.operator.arithmetic */ + /* ^ keyword.operator.comparison */ + /* ^ constant.numeric */ + /* ^^ keyword.operator.arithmetic */ +} + +enum Foo { kFoo, kBar }; +#define FOO Foo +enum FOO do_the_foo(void); +/* ^ entity.name.function */ +/* ^ storage.type */ + +#define APIC_CAPABILITY TheEnum +enum TheEnum { kFoo, kBar }; +static enum APIC_CAPABILITY apic_capabilities(void) { return kFoo; }; +/* ^ entity.name.function */ +/* ^ storage.type */ + +struct __declspec(dllimport) X {}; +/* ^ storage.modifier */ +/* ^ entity.name.struct */ + +struct __declspec(dllimport) baz X {}; +/* ^ storage.modifier */ +/* ^ entity.name.struct */ + +struct foo { +/* ^ entity.name.struct */ + union { +/* ^ storage.type */ + struct { +/* ^ storage.type */ + int a; +/* ^ storage.type */ + int b; +/* ^ storage.type */ + } + } +} + +#define EXTTS_BUFSIZE (PTP_BUF_TIMESTAMPS /* comment block */ * sizeof(struct ptp_extts_event)) // comment line +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.group meta.group */ +/* <- keyword.control.import.define */ +/* ^ entity.name.constant.preprocessor */ +/* ^ comment.block */ +/* ^ keyword.operator.word */ +/* ^ storage.type */ +/* ^ comment.line */ + +#pragma foo(bar, \ +"baz") +/*^^^^ meta.preprocessor */ + +#define MY_MACRO(a, b) +/*^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* ^^^^^^ meta.preprocessor.macro.parameters */ +/* ^^^^^^^^ entity.name.function.preprocessor */ +/* ^ punctuation.section.group.end */ + +#define max(a, b, \ +/*^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ \ +/* ^^^^^^^^ meta.preprocessor.macro.parameters */ \ +/* <- keyword.control.import.define */ \ +/* ^ entity.name.function.preprocessor */ \ +/* ^ punctuation.section.group.begin */ \ +/* ^ variable.parameter */ \ +/* ^ punctuation.separator */ \ +/* */ \ +/* <- comment.block */ \ + c) ((a>b) ? (a>c?a:c) : (b>c?b:c)) + /* <- meta.preprocessor.macro meta.group variable.parameter */ + /* <- meta.preprocessor.macro meta.group punctuation.section.group.end */ + /* ^ keyword.operator.ternary */ + /* ^ keyword.operator.ternary */ + +#define PACKED __attribute__((aligned(1),packed)) +/* ^ entity.name.constant */ +/* ^ storage.modifier */ + +int i; +/* <- storage.type */ + +// The following example ensures that comments at the end of preprocessor +// directives don't mess with context transitions +int func() { +/* ^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters */ +/* ^ meta.block punctuation.section.block.begin */ +/* ^ entity.name.function */ + #if( EXTAL == 40000 ) /* 40 MHz */ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function meta.block */ +/* ^ keyword.control.import */ + #define PLL_RFD_PHI1 10 // PLL0_PH1 = 40MHz +/* ^ keyword.control.import */ +/* ^^ constant.numeric */ +/* ^ comment.line */ + #endif +/* ^ keyword.control.import */ +} +/* <- meta.function meta.block punctuation.section.block.end */ + /* <- - meta.function meta.block */ + +int f(int x, \ + /* ^ punctuation.separator.continuation */ + int y); + +#define CONST0 16 // Comment +#define CONST1 8 +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +#if defined(VARIABLE) | // comment_line \ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor */ \ + defined(VAR2) +/*^^^^^^^^^^^^^^^ meta.preprocessor */ +/* ^ keyword.control */ +# error This is a long error message that need to \ +/* <- keyword.control.import */ \ +/* ^ string.unquoted */ \ + be splitted into two lines to prevent large lines. // comment +#error "Eplicitly quoted string wrapped, \ + ensuring that the string quoting stops at some point \ + " +#warning This is a short warning +/* <- keyword.control.import */ +#endif + /* <- keyword.control.import */ + +#define MACRO_WITH_CURLY_BRACE { +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +#define MACRO_WITH_CURLY_BRACE_2 } +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +bool still_C_code_here = true; +/* <- storage.type */ +/* ^ constant.language */ + +FOOBAR +hello() { + /* <- meta.function entity.name.function */ + return 0; +} + +EFIAPI +UserStructCompare ( + /* <- meta.function entity.name.function */ + IN CONST VOID *UserStruct1, + IN CONST VOID *UserStruct2 + ) +{ + const USER_STRUCT *CmpStruct1; + /* <- meta.block storage.modifier */ + + CmpStruct1 = UserStruct1; + return KeyCompare (&CmpStruct1->Key, UserStruct2); + /* <- meta.block keyword.control */ + /* ^ meta.block meta.function-call variable.function */ +} + +LIB_RESULT +foo() +/* <- meta.function entity.name.function */ +{ + return LIB_SUCCESS; +} + +LIB_RESULT bar() +/* ^ meta.function entity.name.function */ +{ + return LIB_SUCCESS; +} + +THIS_IS_REALLY_JUST_A_MACRO_AND_NOT_A_RETURN_TYPE +/* <- meta.assumed-macro */ + +int main() { +/* <- storage.type */ + /* ^ meta.function entity.name.function */ + return 0; +} + +#if 0 +#ifdef moo +/* <- - keyword.control */ +#endif +/* <- - keyword.control */ +#endif + +#if 0 +/* ^ constant.numeric */ +int disabled_func() { +/* ^ comment.block */ +} +#endif + +#if 1 +/* ^ constant.numeric */ +int enabled_func() {} +/* ^ entity.name.function */ +#else +int disabled_func() { +/* ^ comment.block */ +} +#endif + +#if 1 + int a = 1; + #if 0 +/* ^ constant.numeric */ + int b = 2; +/* ^ comment.block */ + #else + int c = 3; + #endif +#else + int d = 4; +/* ^ comment.block */ +#endif + +FOO +/* <- meta.assumed-macro */ +FOO; +/* <- - meta.assumed-macro */ +foo +/* <- - meta.assumed-macro */ +; // fix highlighting +/* <- punctuation.terminator */ +FOO() +/* <- meta.assumed-macro variable.function.assumed-macro */ +FOO(); +/* <- - meta.assumed-macro */ +foo() +/* <- - meta.assumed-macro */ +; // fix highlighting +/* <- punctuation.terminator */ + +struct X +{ + ENABLED("reason") + /* <- meta.assumed-macro variable.function.assumed-macro */ + int foo; + /* <- storage.type */ + + DISABLED("reason") + /* <- meta.assumed-macro variable.function.assumed-macro */ + float bar; + /* <- storage.type */ +}; + +/** + * +/* ^ comment.block.c punctuation.definition.comment.c */ + +///////////////////////////////////////////// +// Preprocessor branches starting blocks +///////////////////////////////////////////// + +#ifdef FOO +if (1) { +#elif BAR +if (2) { +# elif BAZ +if (3) { +# else +if (4) { +#endif + int bar = 1; +} +/* <- meta.block punctuation.section.block.end */ + /* <- - meta.block */ + +///////////////////////////////////////////// +// Typedefs +///////////////////////////////////////////// + +typedef int myint; +/* <- storage.type */ +/* ^ entity.name.type */ + +typedef struct mystruct { +/* <- storage.type */ +/* ^ - entity */ +} mystruct; +/* ^ entity.name.type */ + +///////////////////////////////////////////// +// Data structures and return values +///////////////////////////////////////////// + +struct point +/* ^ storage.type */ +/* ^ entity.name.struct */ +{ + int x; + int y; +} + +struct point2 { +/* ^ storage.type */ +/* ^ entity.name.struct */ + int x; + int y; +} + +int main(void) { +/* ^^^^ entity.name.function */ +/* ^^^^ storage.type */ +} + +struct point get_point() {} +/* ^^^^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters */ +/* ^^ meta.block */ +/* ^ punctuation.section.block.begin +/* ^ punctuation.section.block.end +/* ^ storage.type */ +/* ^ - entity.name.struct */ +/* ^ entity.name.function */ + +struct point **alloc_points(); +/* ^ storage.type */ +/* ^ - entity.name.struct */ +/* ^^ keyword.operator */ +/* ^ entity.name.function */ + +struct point* alloc_point(); +/* ^ entity.name.function - variable.function */ + +struct point FOO_API *alloc_point3(); +/* ^ entity.name.function - variable.function */ + +int main(void) +{ + struct UI_BoundingBox decorativeBox = {10, titleHeight-3, width-20, height-10}; +/* ^ - entity.name */ +/* ^ - entity.name */ +} + +struct foo MACRO { +/* ^ entity.name.struct */ +/* ^ - entity.name */ +} + +// Partially-typed +struct foo +/* ^ entity.name */ + +struct UI_MenuBoxData +/* <- storage.type */ +/* ^ entity.name.struct */ +{ + struct UI_BoundingBox position; +/* ^ - entity.name */ +/* ^ - entity.name */ + enum UI_BoxCharType borderType; +/* ^ - entity.name */ +/* ^ - entity.name */ + unsigned int paddingX; + unsigned int paddingY; + struct UI_ScrollBoxText boxContents[]; +/* ^ - entity.name */ +/* ^ - entity.name */ +}; + +///////////////////////////////////////////// +// Test preprocessor branching and C blocks +///////////////////////////////////////////// + +int foo(int val, float val2[]) +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^^ variable.parameter */ +/* ^ punctuation.separator */ +/* ^^^^ variable.parameter */ +/* ^^ meta.brackets */ +/* ^ punctuation.section.brackets.begin */ +/* ^ punctuation.section.brackets.end */ +{ +/* <- meta.function meta.block */ + myClass *result; + result->kk = func(val); +/* ^^ punctuation.accessor */ + if (result != 0) { +/* ^^ keyword.operator.comparison.c */ + return 0; +#if CROSS_SCOPE_MACRO + /* <- keyword.control.import */ + } else if (result > 0) { + return 1; +#endif + /* <- keyword.control.import */ + } +/* ^ meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ + +#ifdef FOO + /* <- keyword.control.import */ + int foobar +/* ^^^^^^ - entity.name.function */ + ; + + if (val == -1) { +/* ^^ keyword.control */ +/* ^ meta.block meta.block punctuation.section.block.begin */ +#else + /* <- keyword.control.import */ + if (val == -2) { +/* ^ meta.block meta.block punctuation.section.block.begin */ +#endif + /* <- keyword.control.import */ + val += 1; + } +/* ^ meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ + + return -1; +} +/* <- meta.function punctuation.section.block.end */ + /* <- - meta.function */ + +BOOL +GetTextMetrics( + HDC hdc, + LPTEXTMETRIC lptm + ) +{ +#ifdef UNICODE +/* <- keyword.control.import */ + return GetTextMetricsW( +/* ^ variable.function */ +#else +/* <- keyword.control.import */ + return GetTextMetricsA( +/* ^ variable.function */ +#endif +/* <- keyword.control.import */ + hdc, + lptm + ); +/* ^ meta.function-call */ +/* ^ - meta.function-call */ +} + /* <- - meta.function */ + /* <- - meta.block */ + +///////////////////////////////////////////// +// Matching various function definitions +///////////////////////////////////////////// + +const int foo = 1; +/* ^ - entity.name.function */ +int a; +/* ^ - entity.name.function */ + +int /* comment */ * myfunc +/* <- storage.type */ +/* ^ comment.block */ +/* ^ keyword.operator */ +/* ^^^^^^ meta.function entity.name.function */ +(int * a) +/*^^^^^^^ meta.function.parameters meta.group */ +/* <- punctuation.section.group.begin */ +/* ^ keyword.operator */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +{ +/* <- meta.function meta.block punctuation.section.block.begin */ +} + +MACRO1 +RETURN_TYPE +/* <- - entity.name.function */ +func_name() { +/* < entity.name.function */ +} + +MACRO1 void * MACRO2 myfuncname () { +/* ^^^^^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters */ +/* ^ meta.block punctuation.section.block.begin +/* ^ storage.type */ +/* ^ keyword.operator */ +/* ^ entity.name.function */ + + label: +/* ^ entity.name.label */ +/* ^ punctuation.separator */ + do { + break; + } while(true); + + switch (a) { + case 1: break; +/* ^ punctuation.separator */ + case 100 - 10: break; +/* ^ punctuation.separator */ + default: break; +/* ^ punctuation.separator */ + } + + struct Args { +/* ^ storage.type */ +/* ^ entity.name.struct */ + void* hello; + void* foobar; + }; + + struct Args args; +/* ^ storage.type */ +/* ^ - entity */ + +} + +static const uint32_t * const MACRO funcname(); +/* ^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters */ +/* ^ storage.modifier */ +/* ^ storage.modifier */ +/* ^ support.type */ +/* ^ keyword.operator */ +/* ^ storage.modifier */ +/* ^ entity.name.function */ + +MACRO int +/* ^ storage.type */ +funcname2 +/* ^ entity.name.function */ +() +{ + int a[5]; +/* ^^^ meta.brackets */ +/* ^ punctuation.section.brackets.begin */ +/* ^ punctuation.section.brackets.end */ +} + +MACRO_CALL(int) macro_prefixed_func(){} +/*^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^ meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ entity.name.function */ + +int* return_type_pointer_no_space(){} +/* ^ entity.name.function */ + +// Make sure there isn't an incorrect match here since this is not a valid +// function definition +int32 +/* <- - entity.name.function */ +() {} + +_declspec(deprecated("bla")) void func2(int) {} +/* <- meta.function-call variable.function */ +/* ^ entity.name.function */ +__declspec(deprecated("bla")) void func2(int) {} +/* <- storage.modifier - variable.function */ +/* ^ storage.modifier - variable.function */ +/* ^ string.quoted.double punctuation */ +/* ^ string.quoted.double - punctuation */ +/* ^ string.quoted.double - punctuation */ +/* ^ string.quoted.double punctuation */ +/* ^^ punctuation - invalid */ +/* ^ entity.name.function */ +__notdeclspec(deprecated("bla")) void func2(int) {} +/* <- meta.function-call variable.function */ +/* ^ entity.name.function */ + +///////////////////////////////////////////// +// Test function call in function parameters +///////////////////////////////////////////// + +static string foo(bar() + ';'); +/* ^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^ meta.function.parameters */ +/* ^^^ entity.name.function */ +/* ^^^^^ meta.function-call */ +/* ^^^ variable.function */ +/* ^^^ string */ +/* ^ -string */ + +func_call(foo +/*^^^^^^^^^^^ meta.function-call */ +/* ^^^^ meta.group */ +/* ^ punctuation.section.group.begin */ +); +/* <- meta.function-call meta.group punctuation.section.group.end */ + +///////////////////////////////////////////// +// Invalid +///////////////////////////////////////////// +) +/* <- invalid.illegal.stray-bracket-end */ +} +/* <- invalid.illegal.stray-bracket-end */ + +///////////////////////////////////////////// +// Includes +///////////////////////////////////////////// + +#include "foobar.h" +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^^ string.quoted.double.include */ +/* ^ punctuation.definition.string.end */ + +#include +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ + +#ifdef _GLIBCXX_INCLUDE_NEXT_C_HEADERS +#include_next +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ +#endif + +#include +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ + +///////////////////////////////////////////// +// Numeric Constants +///////////////////////////////////////////// + +dec0 = 0; +/* ^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ +dec1 = 1234567890; +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ + +dec2 = 1234567890f; +/* ^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec3 = 1234567890L; +/* ^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec4 = 1234567890ul; +/* ^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec5 = 1234567890Lu; +/* ^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec6 = 1234567890LLU; +/* ^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec7 = 1234567890uLL; +/* ^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec8 = 1'234_567'890s0f; +/* ^ constant.numeric.integer.decimal */ +/* ^^^^^^^^^ string.quoted.single */ +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +oct1 = 01234567; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +oct2 = 01234567L; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct3 = 01234567LL; +/* ^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct4 = 01234567ulL; +/* ^^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct2 = 01284967Z0L; +/* ^^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ invalid.illegal.numeric.digit */ +/* ^ invalid.illegal.numeric.digit */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +hex1 = 0x0+0xFL+0xaull+0xallu+0xfu+0x'f'12_4uz; +/* ^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ string.quoted.single */ +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0xc1.01AbFp-1; +/* ^^^^^^^^^^^^^ constant.numeric.float.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.+1.f+1.L+1..; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^ constant.numeric.integer.decimal */ +/* ^^ invalid.illegal.syntax */ +/* ^ punctuation.terminator - constant */ + +f = 1e1+1e1f+1e1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.0suff+1.suff*.0suff/{1suff} +/* ^^^ constant.numeric.float.decimal - invalid */ +/* ^^^^ constant.numeric.float.decimal invalid.illegal.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^^ constant.numeric.float.decimal - invalid */ +/* ^^^^ constant.numeric.float.decimal invalid.illegal.numeric.suffix */ +/* ^ keyword.operator */ +/* ^^ constant.numeric.float.decimal - invalid */ +/* ^^^^ constant.numeric.float.decimal invalid.illegal.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^ punctuation.section.block.begin */ +/* ^ constant.numeric.integer.decimal - invalid */ +/* ^^^^ constant.numeric.integer.decimal invalid.illegal.numeric.suffix */ +/* ^ punctuation.section.block.end */ + +scanf("%ms %as %*[, ]", &buf); +/* ^^^ constant.other.placeholder */ +/* ^^^ constant.other.placeholder */ +/* ^^^^^^ constant.other.placeholder */ + +"foo % baz" +/* ^ - invalid */ + + +///////////////////////////////////////////// +// Control Keywords +///////////////////////////////////////////// + +int control_keywords() +{ + if (x < 5) + /* <- keyword.control */ + {} + else + /* <- keyword.control */ + {} + + switch (x) + /* <- keyword.control */ + { + case 1: + /* <- keyword.control */ + break; + /* <- keyword.control.flow.break */ + default: + /* <- keyword.control */ + break; + /* <- keyword.control.flow.break */ + } + + do + /* <- keyword.control */ + { + if (y == 3) + continue; + /* <- keyword.control.flow.continue */ + } while (y < x); + /*^ keyword.control */ + + switch (a) { + case 1: break; + /* ^ punctuation.separator */ + case 100 - 10: break; + /* ^ punctuation.separator */ + default: break; + /* ^ punctuation.separator */ + } + + goto label; + /* <- keyword.control.flow.goto */ + +label: + + return 123; + /* <- keyword.control.flow.return */ +} diff --git a/assets/syntaxes/Packages/C++/syntax_test_cpp.cpp b/assets/syntaxes/Packages/C++/syntax_test_cpp.cpp new file mode 100644 index 000000000..6ca0e9d7f --- /dev/null +++ b/assets/syntaxes/Packages/C++/syntax_test_cpp.cpp @@ -0,0 +1,2636 @@ +/* SYNTAX TEST "Packages/C++/C++.sublime-syntax" */ + +int main(){ + int a=5,b=0; + while(a-->0)++b; + /* ^^ keyword.operator.arithmetic */ + /* ^ keyword.operator.comparison */ + /* ^ constant.numeric */ + /* ^^ keyword.operator.arithmetic */ +} + +///////////////////////////////////////////// +// Preprocessor +///////////////////////////////////////////// + +#ifndef IGUARD_ + /* <- keyword.control.import */ +#define IGUARD_ + /* <- keyword.control.import.define */ +struct foo* alloc_foo(); +/* <- storage.type */ + /* <- - entity.name.type */ + /* <- entity.name.function */ +#endif + /* <- keyword.control.import */ + +// The following example ensures that comments at the end of preprocessor +// directives don't mess with context transitions +int func() { +/* ^ entity.name.function */ + #if( EXTAL == 40000 ) /* 40 MHz */ +/* ^ keyword.control.import */ + #define PLL_RFD_PHI1 10 // PLL0_PH1 = 40MHz +/* ^ keyword.control.import */ +/* ^^ constant.numeric */ +/* ^ comment.line */ + #endif +/* ^ keyword.control.import */ +} +/* <- meta.function meta.block punctuation.section.block.end */ + /* <- - meta.function meta.block */ + +int f(int x, \ + /* ^ punctuation.separator.continuation */ + int y); + +int g(int x = 5 \ + /* ^ punctuation.separator.continuation */ + , int y); + +#define MACRO_WITH_CURLY_BRACE { +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +#define MACRO_WITH_CURLY_BRACE_2 } +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +FOOBAR +hello() { + /* <- meta.function entity.name.function */ + return 0; +} + +EFIAPI +UserStructCompare ( + /* <- meta.function entity.name.function */ + IN CONST VOID *UserStruct1, + IN CONST VOID *UserStruct2 + ) +{ + const USER_STRUCT *CmpStruct1; + /* <- meta.block storage.modifier */ + + CmpStruct1 = UserStruct1; + return KeyCompare (&CmpStruct1->Key, UserStruct2); + /* <- meta.block keyword.control */ + /* ^ meta.block meta.function-call variable.function */ +} + +LIB_RESULT +foo() +/* <- meta.function entity.name.function */ +{ + return LIB_SUCCESS; +} + +LIB_RESULT bar() +/* ^ meta.function entity.name.function */ +{ + return LIB_SUCCESS; +} + +THIS_IS_REALLY_JUST_A_MACRO_AND_NOT_A_RETURN_TYPE +/* <- meta.assumed-macro */ + +int main() { +/* <- storage.type */ + /* ^ meta.function entity.name.function */ + return 0; +} + +// This is a method/function with the return type on a separate line and so should not be a +// constructor. +FOOLIB_RESULT +some_namespace::some_function(int a_parameter, double another_parameter) { + /* <- meta.function meta.toc-list.full-identifier */ + /* ^ entity.name.function - entity.name.function.constructor */ + return FOOLIB_SUCCESS; +} + +#pragma foo(bar, \ +"baz", \ +1) +/* <- meta.preprocessor */ + +#define MY_MACRO(a, b) +/*^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* ^^^^^^ meta.preprocessor.macro.parameters */ +/* ^^^^^^^^ entity.name.function.preprocessor */ +/* ^ punctuation.section.group.end */ + +#define max(a, b, \ +/*^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ \ +/* ^^^^^^^^ meta.preprocessor.macro.parameters */ \ +/* <- keyword.control.import.define */ \ +/* ^ entity.name.function.preprocessor */ \ +/* ^ punctuation.section.group.begin */ \ +/* ^ variable.parameter */ \ +/* ^ punctuation.separator */ \ +/* */ \ +/* <- comment.block */ \ + c) ((a>b) ? (a>c?a:c) : (b>c?b:c)) + /* <- meta.preprocessor.macro meta.group variable.parameter */ + /* <- meta.preprocessor.macro meta.group punctuation.section.group.end */ + /* ^ keyword.operator.ternary */ + /* ^ keyword.operator.ternary */ + +#if 0 +#ifdef moo +/* <- - keyword.control */ +#endif +/* <- - keyword.control */ +#endif + +FOO() +/* <- meta.assumed-macro variable.function.assumed-macro */ +FOO +/* <- meta.assumed-macro */ + +struct FOO1 FOO2 FOO3 Test { + /* ^ meta.struct meta.assumed-macro */ + /* ^ meta.struct meta.assumed-macro */ + /* ^ meta.struct meta.assumed-macro */ + Test(); + Test() noexcept; + Test() final; + Test() noexcept final; + ~Test(); + ~Test() noexcept; + ~Test() override noexcept; + virtual ~Test(); + virtual ~Test() noexcept; + virtual ~Test() override noexcept; + DLL_API Test(); + /* <- meta.assumed-macro */ + /* ^ meta.method.constructor */ + DLL_API Test() noexcept; + /* <- meta.assumed-macro */ + /* ^ meta.method.constructor */ + /* ^ storage.modifier */ + DLL_API Test() final; + /* <- meta.assumed-macro */ + /* ^ meta.method.constructor */ + /* ^ storage.modifier */ + DLL_API Test() noexcept final; + /* <- meta.assumed-macro */ + /* ^ meta.method.constructor */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + DLL_API ~Test(); + /* <- meta.assumed-macro */ + /* ^ meta.method.destructor */ + DLL_API ~Test() noexcept; + /* <- meta.assumed-macro */ + /* ^ meta.method.destructor */ + /* ^ storage.modifier */ + DLL_API ~Test() override noexcept; + /* <- meta.assumed-macro */ + /* ^ meta.method.destructor */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + DLL_API virtual ~Test(); + /* <- meta.assumed-macro */ + /* ^ storage.modifier */ + /* ^ meta.method.destructor */ + DLL_API virtual ~Test() noexcept; + /* <- meta.assumed-macro */ + /* ^ storage.modifier */ + /* ^ meta.method.destructor */ + /* ^ storage.modifier */ + DLL_API virtual ~Test() override noexcept; + /* <- meta.assumed-macro */ + /* ^ storage.modifier */ + /* ^ meta.method.destructor */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ +} + +struct X { + X(); + /* <- meta.group */ + /*^ meta.group - meta.group meta.group */ +}; + +#define DEPRECATED(msg) [[deprecated(msg)]] + +struct Test { + DEPRECATED("bla") + /* <- meta.assumed-macro variable.function.assumed-macro */ + bool foo (bool run=true) {} + /* ^ entity.name.function */ +}; + +namespace Test { + DEPRECATED("bla") + /* <- meta.assumed-macro variable.function.assumed-macro */ + bool foo (bool run=true) {} + /* ^ entity.name.function */ +} + +struct Test { +DEPRECATED("bla") +/* <- meta.assumed-macro variable.function.assumed-macro */ +bool foo (bool run=true) {} +/* ^ entity.name.function */ +}; + +///////////////////////////////////////////// +// Strings +///////////////////////////////////////////// + +char str1[] = "abc"; +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ +/* ^ punctuation.definition.string.end */ + +char str2[] = u8"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ + +char16_t str3[] = u"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ + +char32_t str4[] = U"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ + +wchar_t str5[] = L"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ + +char str6[] = "\a|\b|\e|\f|\n|\r|\t|\v|\'|\"|\?"; +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ + +char str7[] = "\0|\012"; +/* ^^ constant.character.escape */ +/* ^^^^ constant.character.escape */ + +char str8[] = "\x0a|\x41|\xA|\x000065"; +/* ^^^^ constant.character.escape */ +/* ^^^^ constant.character.escape */ +/* ^^^ constant.character.escape */ +/* ^^^^^^^^ constant.character.escape */ + +char16_t str9[] = u"\u0063"; +/* ^^^^^^ constant.character.escape */ + +char32_t str10[] = U"\U00000063"; +/* ^^^^^^^^^^ constant.character.escape */ + +char str11[] = "\q"; +/* ^^ invalid.illegal.unknown-escape */ + +scanf("%ms %as %*[, ]", &buf); +/* ^^^ constant.other.placeholder */ +/* ^^^ constant.other.placeholder */ +/* ^^^^^^ constant.other.placeholder */ + +"foo % baz" +/* ^ - invalid */ + +char rawStr1[] = R"("This is a raw string")"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ +/* ^ punctuation.definition.string.end */ + +char rawStr2[] = R"A*!34( )" )A*!34"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ +/* ^ punctuation.definition.string.end */ +/* ^ punctuation.definition.string.end */ + +const char IncludeRegexPattern[] = + R"(^[\t\ ]*#[\t\ ]*(import|include)[^"<]*(["<][^">]*[">]))"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^^ - invalid */ +/* ^^ - invalid */ +/* ^ punctuation.definition.string.end */ + +foo.f<5> /* foo */ (); + +///////////////////////////////////////////// +// Storage Types +///////////////////////////////////////////// + +void* ptr; +/* <- storage.type */ + +bool b; +/* <- storage.type */ + +char ch; +/* <- storage.type */ + +char16_t ch16; +/* <- storage.type */ + +char32_t ch32; +/* <- storage.type */ + +wchar_t wch; +/* <- storage.type */ + +unsigned int ui; +/* <- storage.type */ +/* ^ storage.type */ + +signed long l; +/* <- storage.type */ +/* ^ storage.type */ + +short s; +/* <- storage.type */ + +auto a = 2; +/* <- storage.type */ + +decltype(s) dt; +/* <- storage.type */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + +float f; +/* <- storage.type */ + +double d; +/* <- storage.type */ + +typedef int my_int; +/* <- storage.type */ +/* ^ entity.name.type */ + +typedef struct Books { +/* ^ storage.type */ +/* ^ - entity.name.type */ + char title[50]; + int book_id; +} Book; +/*^ entity.name.type */ + +using Alias = Foo; +/* <- keyword.control */ +/* ^^^^^ entity.name.type.using */ + +using Alias + = NewLineFoo; +/*^ - entity.name */ + +template +using TemplateAlias = Foo; +/* ^^^^^^^^^^^^^ entity.name.type.using */ + +using std::cout; +/* <- keyword.control */ +/* ^ - entity.name */ + +using std:: + cout; +/*^ - entity.name */ + +class MyClass : public SuperClass +{ + using This = MyClass; +/* ^ keyword.control */ +/* ^^^^ entity.name.type.using */ + + using MyInt +/* ^ keyword.control */ + = int32_t; + + using SuperClass::SuperClass; +/* ^ keyword.control */ +/* ^ - entity.name */ +}; + +class MyClass : public CrtpClass +{ + using typename CrtpClass::PointerType; +/* ^ keyword.control */ +/* ^ storage.modifier */ + using CrtpClass< +/* ^ keyword.control */ + MyClass>::method; +}; + +typedef struct Books Book; +/* ^ - entity.name.type.struct */ +/* ^ entity.name.type.typedef */ + +template class MyStack; +/* <- storage.type.template */ +/* ^ punctuation.section.generic */ +/* ^ storage.type */ +/* ^ constant.numeric */ +/* ^ punctuation.section.generic */ + +template class tupleTmpl; +/* <- storage.type.template */ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.template */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.end */ + +template, typename... Rest> class tupleVariadic; +/* <- storage.type.template */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^ punctuation.separator */ +/* ^^^ keyword.operator.variadic */ +/* ^ punctuation.section.generic.end */ + +template void SomeClass::function(); +/* ^^^ keyword.operator.variadic */ +/* ^^^^^^^^ entity.name.function */ + +template inline struct Foo* baz() +/* ^^^^^^ storage.modifier */ +/* ^ - entity.name */ +/* ^^^ meta.function entity.name.function */ +{} + +template +void classname::methodName() { +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^ punctuation.accessor */ +/* ^^^^^^^^^^ entity.name.function */ +} + +template +void funcName() { +/* ^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^ entity.name.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +} +bool A::operator<(const A& a) { return false; } +/* ^ storage.type */ +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^ entity.name.function */ +/* ^ meta.function.parameters punctuation.section.group.begin */ +template bool A::operator<(const A& a) { return false; } +/* ^ storage.type.template */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^ entity.name.function */ +/* ^ meta.function.parameters meta.group punctuation.section.group.begin */ +template +SomeType A::foobar(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ +template SomeType A::foobar(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ + +template A::A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function */ + +template A::A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function.constructor */ + +template A::~A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function.destructor */ + +template +bool A::operator > (const A& other) { return false; } +/* ^^^^^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^^^^ entity.name.function */ +template +bool A::operator == (const A& other) { return false; } +/* ^^^^^^^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^^^^^^ entity.name.function */ + +typedef std :: vector > Table; +/* ^^ punctuation.accessor */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^ punctuation.section.generic.end */ + +template + /* ^ meta.template keyword.operator */ + /* ^ meta.template keyword.operator */ + /* ^ meta.template constant.numeric */ + /* ^ meta.template keyword.operator */ + /* ^ meta.template constant.language */ +struct Foo +{ + +/* <- meta.struct - meta.template */ + + void bar(int a = 3, bool b = true) {} + /* ^ - meta.template keyword.operator */ + /* ^ - meta.template constant.numeric */ + /* ^ - meta.template keyword.operator */ + /* ^ - meta.template constant.language */ +}; + +/* <- - meta.block - meta.struct - meta.template */ + +template +/* ^^ meta.template punctuation.accessor */ +/* ^ meta.template keyword.operator */ +/* ^ meta.template constant.numeric */ +class fixed_array : private std::array {}; + +constexpr std::size_t f() { return 128; } +template +/* ^^ meta.template punctuation.accessor */ +/* ^ meta.template keyword.operator */ +/* ^ meta.template variable.function */ +/* ^^ meta.template meta.function-call punctuation */ +/* ^ meta.template punctuation */ +class fixed_array : private std::array {}; + +template class A { /* ... */ }; +template class B { /* ... */ }; +/* ^ meta.template keyword.operator */ +/* ^ meta.template */ +/* ^ meta.template punctuation */ +/* ^ - meta.template */ +template class C { /* ... */ }; + +// templates inside templates... it's templates all the way down +template class P> class X { /* ... */ }; +/* ^ meta.template punctuation */ +/* ^ meta.template meta.template punctuation */ +/* ^^^^^ meta.template meta.template storage.type */ +/* ^ meta.template meta.template punctuation */ +/* ^^^^^ meta.template storage.type */ +/* ^ meta.template punctuation */ + +X xa; // OK +X xb; // OK in C++14 after CWG 150 + // Error earlier: not an exact match +X xc; // OK in C++14 after CWG 150 + +// template declarations spanning multiple lines +template +/* <- meta.template storage.type */ +< +/* <- meta.template punctuation.section.generic.begin */ + class T, + class U = T +> +class B +{ + /* ... */ +}; + +// template declarations spanning multiple lines +template +< +/* <- meta.template punctuation.section.generic.begin */ + std::size_t Count = f() +/* ^^ meta.template punctuation.accessor */ +/* ^ meta.template keyword.operator */ +/* ^ meta.template variable.function */ +/* ^^ meta.template meta.function-call punctuation */ +> +/* <- meta.template punctuation.section.generic.end */ +class fixed_array : private std::array {}; + +template +static bool decode(const Node& node, T& sequence) { + if (!node.IsSequence()) + return false; + sequence.clear(); + for (const auto& item : node) { + sequence.push_back(item.template as()); + /* ^ punctuation.accessor */ + /* ^ storage.type - variable.other */ + /* ^ variable.function */ + /* ^ punctuation */ + /* ^^ punctuation.accessor */ + /* ^ punctuation */ + } + return true; +} + +#include +template struct A {}; +template struct B {}; +struct C {}; +A> f(std::function>()> g) { + /* ^ punctuation.section.group.begin */ + /* ^^ punctuation.accessor */ + /* ^ punctuation.section.generic.begin */ + /* ^ punctuation.section.generic.begin */ + /* ^ punctuation.section.generic.begin */ + /* ^^ punctuation.section.generic.end */ + /* ^ punctuation.section.group.begin */ + /* ^ punctuation.section.group.end */ + /* ^ punctuation.section.generic.end */ + /* ^ variable.parameter */ + /* ^ punctuation.section.group.end */ + /* ^ punctuation.section.block.begin */ + return g(); +} +int main() { + std::function foo1; + /* ^ - variabe.function */ + std::function()> foo2; + /* ^ - variable.function */ + auto f = [](std::function>()> g) { return g(); }; + /* ^ punctuation.section.group.begin */ + /* ^^ punctuation.accessor */ + /* ^ punctuation.section.generic.begin */ + /* ^ punctuation.section.generic.begin */ + /* ^ punctuation.section.generic.begin */ + /* ^^ punctuation.section.generic.end */ + /* ^ punctuation.section.group.begin */ + /* ^ punctuation.section.group.end */ + /* ^ punctuation.section.generic.end */ + /* ^ punctuation.section.group.end */ + /* ^ punctuation.section.block.begin */ + /* ^ punctuation.section.block.end */ + return 0; +} +/* <- - invalid.illegal */ + +// Example from section 14.2/4 of +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3690.pdf +struct X +{ + template + X* alloc(); + + template + static X* adjust(); +}; +template +void f(T* p) +{ + // Be optimistic: scope it as a template member function call anyway. + T* p1 = p->alloc<200>(); // ill-formed: < means less than + + T* p2 = p->template alloc<200>(); // OK: < starts template argument list + /* ^ punctuation.accessor */ + /* ^ storage.type - variable.other */ + /* ^ variable.function */ + + // Be optimistic: scope it as a template member function call anyway. + T::adjust<100>(); // ill-formed: < means less than + + T::template adjust<100>(); // OK: < starts template argument list + /* <- - variable.function */ + /*^ punctuation.accessor */ + /* ^ storage.type - variable.other */ + /* ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call */ + /* ^ variable.function */ +} + +struct X +{ + void template(); // <-- not allowed to be a function! + /* ^ - entity.name.function */ +}; + +void f() +{ + X x; + x.template(); // <-- should not be scoped as variable.function! + /* ^ - variable.function */ + + x /**/ . /**/ foo <5> /**/ () /**/ ; + /*^^^^ comment.block */ + /* ^ punctuation.accessor */ + /* ^^^ meta.method-call variable.function */ + /* ^ meta.method-call - variable.function */ + /* ^ meta.method-call punctuation.section.generic.begin */ + /* ^ meta.method-call punctuation.section.generic.end */ + /* ^ meta.method-call - punctuation - comment.block */ + /* ^^^^ meta.method-call comment.block */ + /* ^ meta.method-call - comment.block - punctuation */ + /* ^^ meta.method-call punctuation - comment.block */ + /* ^ - meta.method-call */ +}; + +template C f(T t) +{ + return C { g>(t) }; + /* ^ variable.function */ + /* ^ punctuation.section.group.begin */ +} + +template C> f(T t) +{ + return C> { g>(t) }; + /* ^ variable.function */ + /* ^ punctuation.section.group.begin */ +} + +struct A { int foo; }; +int main() { + A a, b; + a.foo = a.foo < 0 ? 1 : 2; + /* ^ - punctuation.section.generic */ + a.operator<(b); + /*^^^^^^^^^^^^ meta.method-call */ + /*^^^^^^^^^ variable.function.member */ + /* ^^^ meta.group */ + a.operator>(b); + /*^^^^^^^^^^^^ meta.method-call */ + /*^^^^^^^^^ variable.function.member */ + /* ^^^ meta.group */ + a.operator<=(b); + /*^^^^^^^^^^^^^ meta.method-call */ + /*^^^^^^^^^^ variable.function.member */ + /* ^^^ meta.group */ + a.operator>=(b); + /*^^^^^^^^^^^^^ meta.method-call */ + /*^^^^^^^^^^ variable.function.member */ + /* ^^^ meta.group */ + a.operator==(b); + /*^^^^^^^^^^^^^ meta.method-call */ + /*^^^^^^^^^^ variable.function.member */ + /* ^^^ meta.group */ + a.operator!=(b); + /*^^^^^^^^^^^^^ meta.method-call */ + /*^^^^^^^^^^ variable.function.member */ + /* ^^^ meta.group */ + a.operator->(); + /*^^^^^^^^^^^^ meta.method-call */ + /*^^^^^^^^^^ variable.function.member */ + /* ^^ meta.group */ +} +/* <- - invalid.illegal */ + +template +struct A::value && !is_std_char_type::value>> { + using x = conditional_t; + /* ^^ keyword.operator */ +}; +/* <- - invalid.illegal */ + + +///////////////////////////////////////////// +// Storage Modifiers +///////////////////////////////////////////// + +alignas(16) char array[256]; +/* <- storage.modifier */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + +const int XYZ = 2; +/* <- storage.modifier */ + +constexpr int ABC = 3 + 5; +/* <- storage.modifier */ + +thread_local int x; +/* <- storage.modifier */ + + +///////////////////////////////////////////// +// Control Keywords +///////////////////////////////////////////// + +static_assert(x >= 0); +/* <- keyword.operator */ + +noexcept(f()); +/* ^^^ meta.function-call */ +/* <- keyword.operator */ + +if (x < 5) +/* <- keyword.control */ +{} +else +/* <- keyword.control */ +{} + +switch (x) +/* <- keyword.control */ +{ +case 1: +/* <- keyword.control */ + break; + /* <- keyword.control.flow.break */ +default: +/* <- keyword.control */ + break; + /* <- keyword.control.flow.break */ +} + +do +/* <- keyword.control */ +{ + if (y == 3) + continue; + /* <- keyword.control.flow.continue */ +} while (y < x); +/*^ keyword.control */ + +switch (a) { + case 1: break; +/* ^ punctuation.separator */ + case 100 - 10: break; +/* ^ punctuation.separator */ + default: break; +/* ^ punctuation.separator */ +} + +goto label; +/* <- keyword.control.flow.goto */ + +try +/* <- keyword.control */ +{ + throw std :: string("xyz"); + /* <- keyword.control.flow.throw */ + /* ^^^^^^ variable.function */ + /* ^^ punctuation.accessor */ +} +catch (...) +/* <- keyword.control */ +{ +} + +int* ptr = new int(2); +/* ^ keyword.control */ + +delete ptr; +/* <- keyword.control */ + +return 123; +/* <- keyword.control.flow.return */ + + +///////////////////////////////////////////// +// Operator Keywords +///////////////////////////////////////////// + +int x = alignof(char); +/* ^ keyword.operator.word */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + +int x = sizeof(char); +/* ^ keyword.operator.word */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + + +///////////////////////////////////////////// +// Cast Keywords +///////////////////////////////////////////// + +const_cast(2.0); +/* <- keyword.operator.word.cast */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.end */ + +dynamic_cast(2.0); +/* <- keyword.operator.word.cast */ + +reinterpret_cast(2.0); +/* <- keyword.operator.word.cast */ + +static_cast(2.0); +/* <- keyword.operator.word.cast */ + +auto var = *reinterpret_cast>*>(v); +/* ^ keyword.operator.word.cast */ +/* ^ - variable.function */ + +///////////////////////////////////////////// +// Language Constants +///////////////////////////////////////////// + +bool t = true; +/* ^ constant.language */ + +bool f = false; +/* ^ constant.language */ + +int* p = nullptr; +/* ^ constant.language */ + +char ch[] = __func__; +/* ^ constant.language */ + + +///////////////////////////////////////////// +// Support Constants +///////////////////////////////////////////// + +std::cout << __FILE__ << '\n'; +/* ^ support.constant */ +/* ^^ punctuation.accessor */ + +std :: cout << __FUNCTION__ << '\n'; +/* ^^ punctuation.accessor */ +/* ^ support.constant */ + +std::cout << __LINE__ << '\n'; +/* ^ support.constant */ + + +///////////////////////////////////////////// +// Numeric Constants +///////////////////////////////////////////// + +dec1 = 1234567890; +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ + +dec2 = 1'924'013; +/* ^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ + +dec3 = 124ul; +/* ^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec4 = 9'204lu; +/* ^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec5 = 2'354'202'076LL; +/* ^^^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct1 = 0123_567; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct2 = 014'70; +/* ^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex1 = 0x1234567890ABCDEF; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0X1234567890ABCDEF; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex3 = 0x1234567890abcdef; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex4 = 0xA7'45'8C'38; +/* ^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex5 = 0x0+0xFL+0xaull+0xallu+0xfu+0xf'12_4_uz; +/* ^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0xc1.01AbFp-1; +/* ^^^^^^^^^^^^^ constant.numeric.float.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +bin1 = 0b010110; +/* ^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +bin2 = 0B010010; +/* ^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +bin3 = 0b1001'1101'0010'1100; +/* ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.+1.f+1.L+1..; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^ constant.numeric.integer.decimal */ +/* ^^ invalid.illegal.syntax */ +/* ^ punctuation.terminator - constant */ + +f = 1e1+1e1f+1e1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1'843'290.245'123; +/* ^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 2'837e1'000; +/* ^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 23e-1'000; +/* ^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.terminator - constant */ + +units1 = 134h + 123.45h; +/* ^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units2 = 147min + 147.min; +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units3 = 357s + 34.7s; +/* ^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units4 = 234_custom + 10e-1_custom; +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^^^^^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^^^^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +///////////////////////////////////////////// +// Functions +///////////////////////////////////////////// + +// function prototype +void abcdWXYZ1234(); +/* ^^^^^^^^^^^^^^ meta.function */ +/* ^ entity.name.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + +// function definition +void abcdWXYZ1234() +/* ^^^^^^^^^^^^^^ meta.function */ +/* ^ entity.name.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +{ +/* <- meta.function meta.block punctuation.section.block.begin */ +} +/* <- meta.function meta.block punctuation.section.block.end */ + +struct foo **alloc_foo(); +/* ^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ storage.type */ +/* ^ - entity.name.struct */ +/* ^^ keyword.operator */ +/* ^ entity.name.function */ + +long func +/* ^^^^ meta.function entity.name.function */ +(int x, void *MYMACRO(y) ) { +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/*^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters meta.group */ +/* <- meta.function.parameters meta.group punctuation.section.group.begin */ +/* ^ variable.parameter */ +/* ^ -entity.name.function */ +/* ^^^^^^^^^^ meta.function-call */ +/* ^^^ meta.group meta.function-call meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ punctuation.section.group.end */ + // Ensure < and > aren't parsed as a generic + if (foo < bar && baz > bar ) { +/* ^ keyword.operator.comparison */ +/* ^ keyword.operator.comparison */ + + label: +/* ^ entity.name.label */ +/* ^ punctuation.separator */ + do { + break; + } while(true); + + } + if (version.major == 10 && version.minor < 11) +/* ^ keyword.operator.comparison */ + { + + } +} +/* <- meta.function meta.block punctuation.section.block.end */ + +MACRO1 +RETURN_TYPE +/* <- - entity.name.function */ +func_name() { +/* < entity.name.function */ +} + +MACRO1 void * MACRO2 myfuncname () { +/* ^ storage.type */ +/* ^ keyword.operator */ +/* ^ entity.name.function */ + + struct Args { +/* ^ storage.type */ +/* ^ entity.name.struct */ + void* hello; + void* foobar; + Args() +/* ^ entity.name.function.constructor */ + : hellp(nullptr), +/* ^ punctuation.separator.initializer-list */ + foobar(nullptr) + { + } + }; + + struct Args args2; +/* ^ storage.type */ +/* ^ - entity */ + + class LocalFoo MYMACRO +/* ^ storage.type */ +/* ^ entity.name.class */ +/* ^ - entity */ + { + LocalFoo() {} +/* ^ entity.name.function.constructor */ + } + + class LocalFoo test; +/* ^ storage.type */ +/* ^ - entity */ + +} + +static const uint32_t * const MACRO funcname(); +/* ^ storage.modifier */ +/* ^ storage.modifier */ +/* ^ support.type */ +/* ^ keyword.operator */ +/* ^ storage.modifier */ +/* ^ entity.name.function */ + +void FooBar :: baz(int a) +/* ^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^ entity.name.function */ +/* ^^ punctuation.accessor */ +/* ^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +{ +} +/* A comment. */ void FooBar :: baz(int a) +/* ^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^ entity.name.function */ +/* ^^ punctuation.accessor */ +/* ^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +{ +} +// prevent leading comment from function recognition +/**/ HRESULT A::b() +/* ^ meta.function */ +/* ^ entity.name.function */ +{ + return S_OK; +} +FooBar::FooBar(int a) +/*^^^^^^^^^^^^^^^^^^^ meta.function */ +/*^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ +/* ^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^^^ storage.type */ +/* ^ punctuation.section.group.end */ +{ +} + +FooBar :: FooBar(int a) & = +/*^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/*^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ +/* ^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^^^ storage.type */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +/* ^ keyword.operator */ +/* ^ keyword.operator.assignment */ +default; +/*^^^^^ meta.function storage.modifier */ + +FooBar::~FooBar +/*^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^ entity.name.function */ +() { } +/* <- meta.function.parameters meta.group punctuation.section.group.begin */ + /* <- meta.function.parameters meta.group punctuation.section.group.end */ +/*^^^^ meta.function */ + +ThisIsAReallyReallyLongClassNameThatRequiresWrappingCodeInTheMiddleOfAPath:: + ThisIsAReallyReallyLongClassNameThatRequiresWrappingCodeInTheMiddleOfAPath() +/* <- meta.function meta.toc-list.full-identifier */ + : var_name(nullptr) { +} + +bool FooBar::operator==() {} +/* ^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^^^^^ entity.name.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^ meta.block */ +/* ^ punctuation.section.block.begin */ +/* ^ punctuation.section.block.end */ + + +myns::FooBar::~FooBar() { } +/*^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/*^^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^^ meta.block */ +/* ^ punctuation.section.block.begin */ +/* ^ punctuation.section.block.end */ +/*^^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^^ entity.name.function */ + + extern "C" void test_in_extern_c_block() +/* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ entity.name.function */ +{ +/* <- meta.function meta.block punctuation.section.block.begin */ +} +/* <- meta.function meta.block punctuation.section.block.end */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if 0 +void test_in_extern_c_block() +/* ^ comment.block */ +{ +} +#else + +/* temporary C++ preprocessor block */ +#ifdef __cplusplus +/* <- meta.preprocessor */ +/* <- keyword.control.import */ +# ifndef _Bool +/* <- meta.preprocessor */ +/* <- keyword.control.import */ + typedef bool _Bool; /* semi-hackish: C++ has no _Bool; bool is builtin */ +/* ^ storage.type */ +/* ^ entity.name.type.typedef */ +# endif +/* <- meta.preprocessor */ +/* <- keyword.control.import */ +#endif +/* <- meta.preprocessor */ +/* <- keyword.control.import */ + +void test_in_extern_c_block() +/* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ entity.name.function */ +{ +/* <- meta.function meta.block punctuation.section.block.begin */ +} +/* <- meta.function meta.block punctuation.section.block.end */ +#endif + +#ifdef __cplusplus +} +#endif +/* ^ - meta.extern-c */ + +gener func_returning_generic(int a); +/* ^ entity.name.function */ + +std::vector func_returning_path_generic(int a); +/* ^ punctuation.section.generic */ +/* ^ entity.name.function */ + +void f() +{ + static_assert(false, "oops"); + /* ^ keyword.operator.word */ +} + +long double operator "" _km (long double x); +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^^^ meta.function.parameters */ +/* ^^^^^^^^^^^^^^^ entity.name.function */ + +///////////////////////////////////////////// +// Namespace +///////////////////////////////////////////// + +namespace myNameSpace {} +/* <- keyword.control */ +/* ^ entity.name.namespace */ + +namespace new_name = current_name; +/* <- keyword.control */ + +using namespace NAME __attribute__((visibility ("hidden"))); +/* <- keyword.control */ +/* ^ keyword.control */ +/* ^ storage.modifier */ +/* ^ string */ + +void func() { + using namespace NAME __attribute__((visibility ("hidden"))); +/* ^ keyword.control */ +/* ^ keyword.control */ +/* ^ storage.modifier */ +/* ^ string */ +} + +using namespace +/* <- keyword.control */ +/* ^ keyword.control */ + +using namespace myNameSpace; +/* <- keyword.control */ +/* ^ keyword.control */ + +namespace ns :: abc /* Neither this comment... */ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.namespace */ +/* ^^^^^^^^^ entity.name.namespace */ +/* ^^ punctuation.accessor */ +/* ^ comment.block */ +// ...nor this comment is highlighted +/* <- comment.line */ +{ +/* <- meta.namespace meta.block punctuation.section.block.begin */ + void nsfunc() { + /* ^ entity.name.function */ + } +} +/* <- meta.namespace meta.block punctuation.section.block.end */ + +namespace tl { +/*^^^^^^^^^^^^ meta.namespace */ +/* ^ keyword.control */ + namespace { +/* ^ keyword.control */ +/* ^^^^^^^^^^^ meta.namespace meta.namespace */ +/* ^ meta.block meta.block punctuation.section.block.begin */ + void nested_func(){} +/* ^ entity.name.function */ + } +} + +MACRONAME namespace ns3 {} +/* ^ keyword.control */ + +extern "C++" +// ^ storage.modifier +// ^^^^^ string.quoted.double +{ +namespace std _GLIBCXX_VISIBILITY(default) +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.namespace +// ^ keyword.control +// ^ entity.name.namespace +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call +// ^^^^^^^^^ meta.group +// ^ keyword.control +{} +} + +#define MY_NAMESPACE_BEGIN namespace greatapp { +#define MY_NAMESPACE_END } +MY_NAMESPACE_BEGIN +class X { +private: +/* <- storage.modifier */ + int a; +protected: +/* <- storage.modifier */ + int b; +public: +/* <- storage.modifier */ + int c; +}; +MY_NAMESPACE_END + +MY_NAMESPACE_BEGIN int foo(); MY_NAMESPACE_END +/* ^ storage.type */ +/* ^ meta.function entity.name.function */ +/* ^^^ punctuation */ + +// Uncomment this some day +// MY_NAMESPACE_BEGIN class X : public std::true_type {}; MY_NAMESPACE_END + +///////////////////////////////////////////// +// Classes, structs, unions and enums +///////////////////////////////////////////// + +class BaseClass; +/*^^^^^^^^^^^^^ meta.class */ +/* ^ - meta.class meta.class */ +/* ^^^^^^^^^ entity.name.class.forward-decl */ + +class BaseClass // comment +/* <- storage.type */ +/* ^ entity.name.class */ +{ +public : +/* <- storage.modifier */ + tupleTmpl max(tupleGen a, tupleGen b); +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ variable.parameter */ +/* ^ punctuation.separator */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.end */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.end */ +protected: +/* <- storage.modifier */ +private: +/* <- storage.modifier */ + + static int a = 1 << 4; + /* <- storage.modifier */ + /* ^^ keyword.operator.arithmetic */ + + static int x; + /* <- storage.modifier */ + + virtual void doSomething() const = 0; + /* ^^^^^^^^^^^^^^^^^^^^^^^ meta.method */ + /* ^ - meta.method meta.method */ + /* ^^ meta.method.parameters meta.group */ + /* ^ punctuation.section.group.begin */ + /* ^ punctuation.section.group.end */ + /* <- storage.modifier */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ constant.numeric */ + + template + void func(){} +/* ^^^^^^^^ meta.method */ +/* ^^ meta.method.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^ meta.block */ +/* ^ punctuation.section.block.begin */ +/* ^ punctuation.section.block.end */ +/* ^^^^ entity.name.function */ + + template + void func(){} +/* ^^^^^^^^^^^ meta.method */ +/* ^^^^ entity.name.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^ meta.method.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^ meta.block */ +/* ^ punctuation.section.block.begin */ +/* ^ punctuation.section.block.end */ + + template + BaseClass(){} +/* ^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^^ meta.method.constructor */ +/* ^^^^^^^^^ entity.name.function */ + + ~BaseClass() {} +/* ^^^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^^^ meta.method.destructor */ +/* ^^^^^^^^^^ entity.name.function */ + + BaseClass operator [] () +/* ^^^^^^^^^^^^^^ meta.method */ +/* ^^ meta.method.parameters */ +/* ^^^^^^^^^^^ entity.name.function */ + {} + + BaseClass operator= +/* ^^^^^^^^^ meta.method */ +/* ^^^^^^^^^ entity.name.function */ + () {} +/* ^^^^^ meta.method */ +/* ^^ meta.method.parameters */ +/* ^^ meta.block */ +}; + +class DerivedClass : public ::BaseClass // Comment +/* ^ entity.other.inherited-class */ +/* ^ comment.line */ +{ + ~DerivedClass() override; + /* <- meta.method.destructor */ + /*^^^^^^^^^^^^^^^^^^^^^^ meta.method */ + /*^^^^^^^^^^^ meta.method.destructor */ + /* ^ storage.modifier */ + virtual void doSomething() const override final; + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + protected: +/*^^^^^^^^ storage.modifier */ + DerivedClass() override +/*^^^^^^^^^^^^^^^^^^^^^^^ meta.method */ +/*^^^^^^^^^^^^ meta.method.constructor */ +/* ^ storage.modifier */ + : a(a), +/* ^^^^^^^ meta.method.constructor.initializer-list */ + base_id_(BaseClass::None().ToInt()), +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.constructor.initializer-list */ +/* ^ variable.other.readwrite.member */ +/* ^ punctuation.accessor */ +/* ^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^ variable.function */ +/* ^ punctuation - meta.method-call */ +/* ^^^^^^^ meta.method-call */ +/* ^^^^^ variable.function */ +/* ^ punctuation.separator */ + bounds_(NULL), +/* ^^^^^^^^^^^^^^ meta.method.constructor.initializer-list */ + bit_field_(0) { +/* ^^^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^^^^^^ meta.method.constructor.initializer-list */ + char * a = "sprintf"; + char * b = sprintf("Testing %s", a); +/* ^^^^^^^^^ meta.function-call */ +/* ^^^^^^^ support.function.C99 */ + + base_id_->foobar(1, "foo"); +/* ^^ punctuation.accessor - meta.method-call */ +/* ^^^^^^^^^^^^^^^^ meta.method-call */ +/* ^^^^^^ variable.function */ + + base_id_->~BaseClass(); +/* ^^ punctuation.accessor - meta.method-call */ +/* ^^^^^^^^^^^^ meta.method-call */ +/* ^^^^^^^^^^ variable.function */ + } +/* ^ meta.method meta.block punctuation.section.block.end */ + +/* <- - meta.class.constructor.initializer-list */ + + typedef std::vector qux; +/* ^^^ entity.name.type.typedef */ +}; + + +template +class class1 : class2 +/* ^^^^^^ entity.name.class */ +/* ^ punctuation.section.generic */ +/* ^ punctuation.section.generic */ +/* ^^^^^^ entity.other.inherited-class */ +/* ^ punctuation.section.generic */ +/* ^ punctuation.section.generic */ +{} + +class FooBar { +/* ^ meta.class meta.block punctuation.section.block.begin */ + explicit FooBar(int a); +/* ^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^ storage.modifier */ +/* ^^^^^^ entity.name.function */ + FooBar() =default; +/* ^^^^^^ entity.name.function */ +/* ^ keyword.operator.assignment */ +/* ^^^^^^^ storage.modifier */ + FooBar(void) =default; +/* ^^^^^^ entity.name.function */ +/* ^^^^ storage.type */ +/* ^ keyword.operator.assignment */ +/* ^^^^^^^ storage.modifier */ + + // If a constructor name is on a line without the opening (, it is not + // highlighted as a method/constructor. This prevents a bunch of false + // positives, including data types as they are being typed into a struct. + FooBar +/* ^ - entity.name.function */ + (); + + virtual ~FooBar(); +/* ^^^^^^^ entity.name.function */ + +#ifndef DEBUG + ~FooBar(); +/* ^^^^^^^ entity.name.function */ +#endif + + void insert () {} +/* ^^^^^^ entity.name.function */ + + explicit operator bool +/* ^^^^ entity.name.function */ + () {} + + FooBar::~FooBar(); +/* ^^^^^^^^^^^^^^^ entity.name.function */ + + void FooBar:: + Baz() { + /* <- entity.name.function */ + } + + auto f(int a) -> decltype(a.begin()) override final; +/* ^^ punctuation.separator */ +/* ^ punctuation.accessor */ +/* ^^^^^ variable.function */ +/* ^ storage.modifier */ +/* ^ storage.modifier */ + + auto g() -> std::vector override final { +/* ^^ punctuation.separator */ +/* ^^ punctuation.accessor */ +/* ^ storage.type */ +/* ^ storage.modifier */ +/* ^ storage.modifier */ + this->g(1); +/* ^ variable.language */ + } + +private: +/*^^^^^ storage.modifier */ + + VISIBILITY_MACRO +/* ^ - entity.name.function */ + myns::subns::MyDataType +/* ^ - entity.name.function */ + and_now_method_name(); +/* ^ entity.name.function */ + + VISIBILITY_MACRO +/* ^ - entity.name.function */ + std::shared_future> +/* ^ - entity.name.function */ +/* ^^ punctuation.accessor */ +/* ^ punctuation.section.generic.begin */ +/* ^^ punctuation.accessor */ +/* ^ punctuation.section.generic.begin */ +/* ^^ punctuation.accessor */ + and_now_method_name2(); +/* ^ entity.name.function */ + + enum +/* ^^^^ meta.enum storage.type */ + { +/* ^ meta.enum punctuation.section.block.begin */ + A = 1, + B = 20 / 5 + } +/* ^ meta.enum punctuation.section.block.end */ +/* ^ - meta.enum */ + + friend int func(int a, int b); +/* ^ storage.modifier */ +/* ^ storage.type */ +/* ^ - entity.name.function */ +/* ^ - meta.function-call */ + + friend int func(int a, int b) { +/* ^ storage.modifier */ +/* ^ storage.type */ +/* ^ entity.name.function */ +/* ^ - meta.function-call */ +/* ^ meta.class meta.block meta.method meta.block punctuation.section.block.begin */ + int a = 1; + } +/* ^ meta.class meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.class meta.block meta.block */ + + friend class ::FooBar; +/* ^ storage.modifier */ +/* ^ storage.type +/* ^^ punctuation.accessor */ +/* ^ - entity */ + + friend bool operator != (const X& lhs, const X& rhs) { + /* ^^^^^^^^^^^ entity.name.function */ + int a = 1; + } +/* ^ meta.class meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.class meta.block meta.block */ + + #if 0 + /* ^ constant.numeric */ + int disabled_func() { + /* ^ comment.block */ + } + #endif + + #if 1 + /* ^ constant.numeric */ + int enabled_func() {} + /* ^ entity.name.function */ + #else + int disabled_func() { + /* ^ comment.block */ + } + #endif + + MACRO_NOT_CONSTRUCTOR(FooBar); +/* ^ meta.function-call variable.function - entity.name.function */ + + MACRO_NOT_CONSTRUCTOR2(FooBar, +/* ^ meta.function-call variable.function - entity.name.function */ + FriendClass); +} +/* <- meta.class meta.block punctuation.section.block.end */ + /* <- - meta.class meta.block */ + +struct X { + Y f() override noexcept final; + /*^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + ::Y g() override noexcept final; + /* <- punctuation.accessor */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ +}; + +class X { + public: + ::Y g() override noexcept final; + /* <- punctuation.accessor */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ +}; + +union Y { + ::Y g() override noexcept final; + /* <- punctuation.accessor */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ +}; + +class Child : public Parent { + ::anotherClass Func() override; + /* <- punctuation.accessor */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ +} + +class Adapter2 : public Abstraction, private Scenario { +/* ^ punctuation.separator */ +} + +class Adapter : public Abstraction + #if defined ASPECTO_MACRO +/* ^^^ keyword.control.import */ + , public Scenario +/* ^ punctuation.separator */ +/* ^ storage.modifier */ +/* ^ entity.other.inherited-class */ + #endif +/* ^^^^^^ keyword.control.import */ +{ + +} + +struct Base {}; +class Derived final : Base {}; +/* ^ storage.modifier */ +struct Derived final : Base {}; +/* ^ storage.modifier */ + +/* C++11 "uniform initialization" in initializer lists */ +class Foo { +public: + Foo() : var1(1), var(2), var3{3}, var4(4) {} + /* ^ meta.method.constructor.initializer-list */ + /* ^ - meta.function-call - variable.function */ +private: + int var1, var2, var3, var4; +}; + +class X { + int a, b, i, j; +public: + const int& r; + X(int i) + : r(a) // initializes X::r to refer to X::a + /* ^ meta.method.constructor.initializer-list punctuation */ + /* ^ meta.method.constructor.initializer-list punctuation */ + , b{i} // initializes X::b to the value of the parameter i + /* ^ meta.method.constructor.initializer-list punctuation */ + /* ^ meta.method.constructor.initializer-list punctuation */ + , i(i) // initializes X::i to the value of the parameter i + /* ^ meta.method.constructor.initializer-list punctuation */ + /* ^ meta.method.constructor.initializer-list punctuation */ + , j(this->i) // initializes X::j to the value of X::i + /* ^ meta.method.constructor.initializer-list punctuation */ + /* ^ meta.method.constructor.initializer-list punctuation */ + , j + /*^ variable */ + (this->i) + /* <- meta.method.constructor.initializer-list punctuation */ + { } +/* ^ punctuation - meta.method.constructor.initializer-list */ +/* ^ punctuation - meta.method.constructor.initializer-list */ +}; + +struct A { + static_assert(0 < 1, ""); + /* ^ keyword.operator.word */ + /* ^ meta.function-call */ + /* ^ keyword.operator.comparison */ + + A(); +/*^ meta.method.constructor entity.name.function.constructor */ + + void f(); + /* ^ storage.type */ + /* ^ meta.method entity.name.function */ + /* ^ punctuation.terminator */ +}; +/* <- punctuation.section.block.end - invalid.illegal */ + +struct bar { +/*^^^^^^^^^^ meta.struct */ +/*^^^^ storage.type */ +/* ^^^ entity.name.struct */ +/* ^ meta.block punctuation.section.block.begin */ + bar() +/* ^^^^^ meta.method */ +/* ^^^ entity.name.function */ + {} +} +/* <- meta.struct meta.block punctuation.section.block.end */ + /* <- - meta.struct meta.block */ + +enum baz { +/*^^^^^^^^ meta.enum */ +/* <- meta.enum storage.type */ +/* ^^^ entity.name.enum */ +/* ^ meta.block punctuation.section.block.begin */ + FOO = 1, +/* ^ keyword.operator.assignment */ +/* ^ constant.numeric */ + BAR = 2, + BAZ = 3, +#if 0 +/* ^ constant.numeric */ + QUX = 4, +/* ^ comment.block */ +#endif +} +/* <- meta.enum meta.block punctuation.section.block.end */ + /* <- - meta.enum meta.block */ + +int main(void) +{ + struct UI_BoundingBox decorativeBox = {10, titleHeight-3, width-20, height-10}; +/* ^ - entity.name */ +/* ^ - entity.name */ +} + +struct foo MACRO { +/* ^ entity.name.struct */ +/* ^ - entity.name */ +} + +// Partially-typed +struct foo +/* ^ entity.name */ + +struct UI_MenuBoxData +/* <- storage.type */ +/* ^ entity.name.struct */ +{ + struct UI_BoundingBox position; +/* ^ - entity.name */ +/* ^ - entity.name */ + enum UI_BoxCharType borderType; +/* ^ - entity.name */ +/* ^ - entity.name */ + unsigned int paddingX; + unsigned int paddingY; + struct UI_ScrollBoxText boxContents[]; +/* ^ - entity.name */ +/* ^ - entity.name */ +}; + +enum class qux : std::uint8_t +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum */ +/*^^^^^^^^ storage.type */ +/* ^^^ entity.name.enum */ +/* ^ punctuation.separator */ +/* ^^^^^^^^^^^^ entity.other.inherited-class */ +{ +/* <- meta.block punctuation.section.block.begin */ + FOO = 1, + BAR = 2, +/* ^ keyword.operator.assignment */ +/* ^ constant.numeric */ + BAZ = 3 +} +/* <- meta.enum meta.block punctuation.section.block.end */ + /* <- - meta.enum meta.block */ + +enum LineEnding : uint32_t; +/*^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum */ +/* ^^^^^^^^^^ entity.name.enum.forward-decl */ +/* ^ punctuation.separator */ +/* ^^^^^^^^ entity.other.inherited-class */ +/* ^ - meta.enum */ + +union foobaz { +/* <- meta.union storage.type */ +/* ^^^^^^ entity.name.union */ +/* ^ meta.block punctuation.section.block.begin */ +} +/* <- meta.union meta.block punctuation.section.block.end */ + /* <- - meta.union meta.block */ + +// Class name that looks like a possible macro +class SP {} +/* ^^ entity.name.class */ + +class MyClass MACRO MACRO2 +/* ^ storage.type */ +/* ^ entity.name.class */ +/* ^ - entity */ +/* ^ - entity */ +{} + +// Class using macro to handle __declspec() on Windows +class SK_API SkBitmap {} +/* ^ entity.name.class */ +class __declspec(property(get=foo)) SkBitmap {} +/* ^ storage.modifier */ +/* ^ variable.parameter */ +/* ^ entity.name.class */ +class __declspec(align(8)) SkBitmap {} +/* ^ storage.modifier */ +/* ^ constant.numeric */ +/* ^ entity.name.class */ +class __declspec(dllimport) SkBitmap {} +/* ^ constant.other */ +/* ^ entity.name.class */ + +// Make sure not to match macros that have "too few characters". +template class Sample { + public: + // The T here should not be consumed as a macro. + T operator() (const foo x) { + /* <- entity.name.function */ + /*^^^^^^^^ entity.name.function */ + return T; + } + int operator == (const int x) { + /*^^^^^^^^^^^ entity.name.function */ + return 0; + } + // The T here should not be consumed as a macro. + T operator()(int a) { + /* <- entity.name.function */ + /*^^^^^^^^ entity.name.function */ + return T; + } + // The T here should not be consumed as a macro. + T operator[](int a) { + /* <- entity.name.function */ + /*^^^^^^^^ entity.name.function */ + return T; + } +}; + +class Namespace::MyClass MACRO1 MACRO2 : public SuperClass +/* ^^^^^^^ entity.name.class */ +/* ^^ punctuation.accessor */ +/* ^ - entity.name */ +{ +}; + +struct Namespace::MyStruct +/* ^^^^^^^^ entity.name.struct */ +/* ^^ punctuation.accessor */ +{ +}; + +union Namespace::MyUnion +/* ^^^^^^^ entity.name.union */ +/* ^^ punctuation.accessor */ +{ +}; + +enum class Namespace::MyEnum +/* ^^^^^^ entity.name.enum */ +/* ^^ punctuation.accessor */ +{ +}; + +class Namespace:: +MyClass MACRO1 +/* <- entity.name.class */ +/* ^ - entity.name */ +{ +}; + +struct Namespace:: +MyStruct MACRO1 +/* <- entity.name.struct */ +/* ^ - entity.name */ +{ +}; + +union Namespace:: +MyUnion MACRO1 +/* <- entity.name.union */ +/* ^ - entity.name */ +{ +}; + +enum class Namespace:: +MyEnum MACRO1 +/* <- entity.name.enum */ +/* ^ - entity.name */ +{ +}; + + +///////////////////////////////////////////// +// Test preprocessor branching and C blocks +///////////////////////////////////////////// + +int foo(int val, float val2[], bool val3 = false) +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^^ variable.parameter */ +/* ^ punctuation.separator */ +/* ^^^^ variable.parameter */ +/* ^^ meta.brackets */ +/* ^ punctuation.section.brackets.begin */ +/* ^ punctuation.section.brackets.end */ +/* ^ punctuation.separator */ +/* ^^^^ storage.type */ +/* ^^^^ variable.parameter */ +/* ^ keyword.operator.assignment */ +/* ^^^^^ constant.language */ +{ + myClass *result; + result->kk = func(val); +/* ^^ punctuation.accessor */ + if (result == 0) { + return 0; +#if CROSS_SCOPE_MACRO + /* <- keyword.control.import */ + } else if (result > 0) { + return 1; +#endif + /* <- keyword.control.import */ + } +/* ^ meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ + +#ifndef DEBUG + if (check_debug()) { + val /= 2; +#endif + val += 1; +#ifndef DEBUG + } +/* ^ meta.function meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ +#endif + +#ifdef FOO + /* <- keyword.control.import */ + int foobar +/* ^^^^^^ - entity.name.function */ + ; + + if (val == -1) { +/* ^ meta.block meta.block punctuation.section.block.begin */ +#else + /* <- keyword.control.import */ + if (val == -2) { +/* ^ meta.block meta.block punctuation.section.block.begin */ +#endif + /* <- keyword.control.import */ + val += 1; + } +/* ^ meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ + + return -1; +} +/* <- meta.function punctuation.section.block.end */ + /* <- - meta.function */ + +#if 0 +/* ^ constant.numeric */ +int disabled_func() { +/* ^ comment.block */ +} +#endif + +#if 1 +/* ^ constant.numeric */ +int enabled_func() {} +/* ^ entity.name.function */ +#else +int disabled_func() { +/* ^ comment.block */ +} +#endif + +#if 1 + int a = 1; + #if 0 +/* ^ constant.numeric */ + int b = 2; +/* ^ comment.block */ + #else + int c = 3; + #endif +#else + int d = 4; +/* ^ comment.block */ +#endif + +BOOL +GetTextMetrics( + HDC hdc, + LPTEXTMETRIC lptm + ) +{ +#ifdef UNICODE +/* <- keyword.control.import */ + return GetTextMetricsW( +/* ^ variable.function */ +#else +/* <- keyword.control.import */ + return GetTextMetricsA( +/* ^ variable.function */ +#endif +/* <- keyword.control.import */ + hdc, + lptm + ); +/* ^ meta.function-call */ +/* ^ - meta.function-call */ +} + /* <- - meta.function */ + /* <- - meta.block */ + +///////////////////////////////////////////// +// Matching various function definitions +///////////////////////////////////////////// + +const int foo = 1; +/* ^ - entity.name.function */ +int a; +/* ^ - entity.name.function */ + +int /* comment */ * myfunc +/* <- storage.type */ +/* ^ comment.block */ +/* ^ keyword.operator */ +/* ^^^^^^ entity.name.function */ +(int * a) +/* <- punctuation.section.group.begin */ +/* ^ keyword.operator */ +/* ^ punctuation.section.group.end */ +{ + +} + +void MyClass3:: +foo() { +/* <- entity.name.function */ +} + +MyClass3:: +~MyClass3() { +/* <- entity.name.function */ +} + +struct A +{ + #ifdef X + static_assert(false, "asdf"); + /* ^ keyword.operator.word */ + #endif + + void f() + { + #ifdef X + static_assert(false, "asdf"); + /* ^ keyword.operator.word */ + #endif + } + + void f() + { + static_assert(false, "asdf"); + /* ^ keyword.operator.word */ + } +}; + +void f() +{ + static_assert(false, "asdf"); +/* ^ meta.function meta.block */ +/* ^ keyword.operator.word */ +} + +void f() +{ + #ifdef X + static_assert(false, "asdf"); +/* ^ meta.function meta.block */ +/* ^ keyword.operator.word */ + #endif +} + +Glib::ustring Node::_getDragTip(GdkEventMotion */*event*/); +/* ^^^^^^^^^ comment */ + +MACRO1 void * MACRO2 myfuncname () { +/* ^ storage.type */ +/* ^ keyword.operator */ +/* ^ entity.name.function */ + + label: +/* ^ entity.name.label */ +/* ^ punctuation.separator */ + do { + break; + } while(true); + + switch (a) { + case 1: break; +/* ^ punctuation.separator */ + case 100 - 10: break; +/* ^ punctuation.separator */ + default: break; +/* ^ punctuation.separator */ + } + +} + +static const uint32_t * const MACRO funcname(); +/* ^ storage.modifier */ +/* ^ storage.modifier */ +/* ^ support.type */ +/* ^ keyword.operator */ +/* ^ storage.modifier */ +/* ^ entity.name.function */ + +MACRO int +/* ^ storage.type */ +funcname2 +/* ^ entity.name.function */ +() +{ + +} + +MACRO_CALL(int) macro_prefixed_func(){} +/*^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^ meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ entity.name.function */ + +int* return_type_pointer_no_space(){} +/* ^ entity.name.function */ + +int& return_type_ref_no_space(){} +/* ^ entity.name.function */ + +// Make sure there isn't an incorrect match here since this is not a valid +// function definition +int32 +/* <- - entity.name.function */ +() {} + +_declspec(deprecated("bla")) void func2(int) {} +/* <- meta.function-call variable.function */ +/* ^ entity.name.function */ +__declspec(deprecated("bla")) void func2(int) {} +/* <- storage.modifier - variable.function */ +/* ^ storage.modifier - variable.function */ +/* ^ string.quoted.double punctuation */ +/* ^ string.quoted.double - punctuation */ +/* ^ string.quoted.double - punctuation */ +/* ^ string.quoted.double punctuation */ +/* ^^ punctuation - invalid */ +/* ^ entity.name.function */ +__notdeclspec(deprecated("bla")) void func2(int) {} +/* <- meta.function-call variable.function */ +/* ^ entity.name.function */ + +///////////////////////////////////////////// +// Paths/identifiers +///////////////////////////////////////////// + +void sayHi() +{ + std::cout << "Hi!\n"; +/* ^ punctuation.accessor */ + Print(3); +/* ^ variable.function */ + func_call(foo +/* ^ meta.function-call */ + ); + + if (::std::foo()) {} +/* ^^^ variable.function */ +/* ^^ punctuation.accessor */ +/* ^^ punctuation.accessor */ + + foobaz(); +/* ^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^ variable.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^ meta.group */ + + foobaz<>(); +/* ^^^^^^^^^^ meta.function-call */ +/* ^^^^^^ variable.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^ meta.group */ + + foobaz<0>(); +/* ^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^ variable.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ constant.numeric */ +/* ^ punctuation.section.generic.end */ +/* ^^ meta.group */ + + ::myns::foo(); +/* ^^ punctuation.accessor.double-colon */ +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^ variable.function */ +/* ^^^ storage.type */ + + myns::FooClass{42}; +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^^^ variable.function */ + + ::myns::BarClass{}; +/* ^^ punctuation.accessor.double-colon */ +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^^^ variable.function */ +/* ^^^ storage.type */ + + int a[5]; +/* ^^^ meta.brackets */ +/* ^ punctuation.section.brackets.begin */ +/* ^ punctuation.section.brackets.end */ + + std::cout << ">> Hi!\n"; +/* ^^ keyword.operator.arithmetic.c */ +} + +///////////////////////////////////////////// +// Includes +///////////////////////////////////////////// + +#include "foobar.h" +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^^ string.quoted.double.include */ +/* ^ punctuation.definition.string.end */ + +#include +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ + +#ifdef _GLIBCXX_INCLUDE_NEXT_C_HEADERS +#include_next +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ +#endif + +#include +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ + +/** + * +/* ^ comment.block.c punctuation.definition.comment.c */ diff --git a/assets/syntaxes/Packages/CSS/.python-version b/assets/syntaxes/Packages/CSS/.python-version new file mode 100644 index 000000000..98fccd6d0 --- /dev/null +++ b/assets/syntaxes/Packages/CSS/.python-version @@ -0,0 +1 @@ +3.8 \ No newline at end of file diff --git a/assets/syntaxes/Packages/CSS/CSS.sublime-syntax b/assets/syntaxes/Packages/CSS/CSS.sublime-syntax new file mode 100644 index 000000000..f0ce9b852 --- /dev/null +++ b/assets/syntaxes/Packages/CSS/CSS.sublime-syntax @@ -0,0 +1,2068 @@ +%YAML 1.2 +--- +# Derived from https://github.com/i-akhmadullin/Sublime-CSS3 +name: CSS +file_extensions: + - css + - css.erb + - css.liquid +scope: source.css +variables: + # Many variable names taken directly from https://www.w3.org/TR/css3-selectors/#lex + unicode: '\\\h{1,6}[ \t\n\f]?' + escape: '(?:{{unicode}}|\\[^\n\f\h])' + nonascii: '[\p{L}\p{M}\p{S}\p{N}&&[[:^ascii:]]]' + nmstart: '(?:[[_a-zA-Z]{{nonascii}}]|{{escape}})' + nmchar: '(?:[[-\w]{{nonascii}}]|{{escape}})' + ident: '(?:--{{nmchar}}+|-?{{nmstart}}{{nmchar}}*)' + + # Types + # https://www.w3.org/TR/css3-values/#numeric-types + integer: '(?:[-+]?\d+)' + float: '(?:[-+]?\d*(\.)\d+(?:[eE]{{integer}})*)' + + # Units + # https://www.w3.org/TR/css3-values/#lengths + font_relative_lengths: '(?i:em|ex|ch|rem)' + viewport_percentage_lengths: '(?i:vw|vh|vmin|vmax)' + absolute_lengths: '(?i:cm|mm|q|in|pt|pc|px|fr)' + angle_units: '(?i:deg|grad|rad|turn)' + duration_units: '(?i:s|ms)' + frequency_units: '(?i:Hz|kHz)' + resolution_units: '(?i:dpi|dpcm|dppx)' + + custom_element_chars: |- + (?x: + [-_a-z0-9\x{00B7}] + | \\\. + | [\x{00C0}-\x{00D6}] + | [\x{00D8}-\x{00F6}] + | [\x{00F8}-\x{02FF}] + | [\x{0300}-\x{037D}] + | [\x{037F}-\x{1FFF}] + | [\x{200C}-\x{200D}] + | [\x{203F}-\x{2040}] + | [\x{2070}-\x{218F}] + | [\x{2C00}-\x{2FEF}] + | [\x{3001}-\x{D7FF}] + | [\x{F900}-\x{FDCF}] + | [\x{FDF0}-\x{FFFD}] + | [\x{10000}-\x{EFFFF}] + ) + + combinators: '(?:>{1,3}|[~+])' + + # Predefined Counter Styles + # https://drafts.csswg.org/css-counter-styles-3/#predefined-counters + counter_styles: |- + (?xi: + arabic-indic | armenian | bengali | cambodian | circle + | cjk-decimal | cjk-earthly-branch | cjk-heavenly-stem | decimal-leading-zero + | decimal | devanagari | disclosure-closed | disclosure-open | disc + | ethiopic-numeric | georgian | gujarati | gurmukhi | hebrew + | hiragana-iroha | hiragana | japanese-formal | japanese-informal + | kannada | katakana-iroha | katakana | khmer + | korean-hangul-formal | korean-hanja-formal | korean-hanja-informal | lao + | lower-alpha | lower-armenian | lower-greek | lower-latin | lower-roman + | malayalam | mongolian | myanmar | oriya | persian + | simp-chinese-formal | simp-chinese-informal + | square | tamil | telugu | thai | tibetan + | trad-chinese-formal | trad-chinese-informal + | upper-alpha | upper-armenian | upper-latin | upper-roman + ) + +contexts: + main: + - include: comment-block + - include: selector + - include: at-rules + - include: property-list + + at-rules: + - include: at-charset + - include: at-counter-style + - include: at-custom-media + - include: at-document + - include: at-font-face + - include: at-import + - include: at-keyframes + - include: at-media + - include: at-namespace + - include: at-page + - include: at-supports + + # When including `color-values` and `color-adjuster-functions`, make sure it is + # included after the color adjustors to prevent `color-values` from consuming + # conflicting function names & color constants such as `red`, `green`, or `blue`. + color-values: + - include: color-functions + # https://www.w3.org/TR/CSS22/syndata.html#color-units + - match: \b(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)\b + scope: support.constant.color.w3c-standard-color-name.css + # https://www.w3.org/TR/css3-color/#svg-color + - match: \b(aliceblue|antiquewhite|aquamarine|azure|beige|bisque|blanchedalmond|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|gainsboro|ghostwhite|gold|goldenrod|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|limegreen|linen|magenta|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|oldlace|olivedrab|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|rebeccapurple|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|thistle|tomato|turquoise|violet|wheat|whitesmoke|yellowgreen)\b + scope: support.constant.color.w3c-extended-color-keywords.css + # Special Color Keywords + # https://www.w3.org/TR/css3-color/#currentcolor + # https://www.w3.org/TR/css3-color/#transparent-def + - match: \b((?i)currentColor|transparent)\b + scope: support.constant.color.w3c-special-color-keyword.css + # Hex Color + - match: '(#)(\h{3}|\h{6})\b' + scope: constant.other.color.rgb-value.css + captures: + 1: punctuation.definition.constant.css + # RGBA Hexadecimal Colors + # https://en.wikipedia.org/wiki/RGBA_color_space#RGBA_hexadecimal_.28word-order.29 + - match: '(#)(\h{4}|\h{8})\b' + scope: constant.other.color.rgba-value.css + captures: + 1: punctuation.definition.constant.css + + comment-block: + - match: /\* + scope: punctuation.definition.comment.css + push: + - meta_scope: comment.block.css + - match: \*/ + scope: punctuation.definition.comment.css + pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.css + + at-charset: + - match: \s*((@)charset\b)\s* + captures: + 1: keyword.control.at-rule.charset.css + 2: punctuation.definition.keyword.css + push: + - meta_scope: meta.at-rule.charset.css + - include: at-rule-punctuation + - include: literal-string + + # @counter-style + # https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule + at-counter-style: + - match: \s*((@)counter-style\b)\s+(?:(?i:\b(decimal|none)\b)|({{ident}}))?\s*(?=\{|$) + captures: + 1: keyword.control.at-rule.counter-style.css + 2: punctuation.definition.keyword.css + 3: invalid.illegal.counter-style-name.css + 4: entity.other.counter-style-name.css + push: + - meta_scope: meta.at-rule.counter-style.css + - include: comment-block + - include: rule-list-terminator + - include: rule-list + + at-custom-media: + - match: (?=\s*@custom-media\b) + push: + - match: ; + scope: punctuation.terminator.css + pop: true + - match: \s*((@)custom-media) + captures: + 1: keyword.control.at-rule.custom-media.css + 2: punctuation.definition.keyword.css + 3: support.constant.custom-media.css + push: + - meta_scope: meta.at-rule.custom-media.css + - match: \s*(?=;) + pop: true + - include: media-query-list + + # @document + # https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document + at-document: + - match: '((@)document)' + captures: + 1: keyword.control.at-rule.document.css + 2: punctuation.definition.keyword.css + push: + - meta_scope: meta.at-rule.document.css + - match: '\{' + scope: punctuation.definition.block.begin.css + push: + - meta_scope: meta.block.css + - match: '(?=\})' + pop: true + - include: main + - match: '\}' + scope: meta.block.css punctuation.definition.block.end.css + pop: true + - include: comment-block + - include: url-function + - include: url-prefix-function + - include: domain-function + - include: regexp-function + - include: comma-delimiter + + at-font-face: + - match: '\s*((@)font-face)\s*(?=\{|$)' + captures: + 1: keyword.control.at-rule.font-face.css + 2: punctuation.definition.keyword.css + push: + - meta_scope: meta.at-rule.font-face.css + - include: comment-block + - include: rule-list-terminator + - include: rule-list + + at-import: + - match: \s*((@)import\b)\s* + captures: + 1: keyword.control.at-rule.import.css + 2: punctuation.definition.keyword.css + push: + - meta_scope: meta.at-rule.import.css + - include: at-rule-punctuation + - include: literal-string + - include: url-function + - include: media-query-list + + # https://drafts.csswg.org/css-animations/#propdef-animation-name + keyframe-name: + - match: '\s*({{ident}})?' + captures: + 1: entity.other.animation-name.css + push: + - match: '\s*(?:(,)|(?=[{;]))' + captures: + 1: punctuation.definition.arbitrary-repetition.css + pop: true + + # @keyframes + # https://drafts.csswg.org/css-animations/#keyframes + at-keyframes: + - match: (?=\s*@(?:-webkit-|-moz-|-o-)?keyframes\b) + push: + - include: rule-list-terminator + - match: \s*((@)(-webkit-|-moz-|-o-)?keyframes) + captures: + 1: keyword.control.at-rule.keyframe.css + 2: punctuation.definition.keyword.css + 3: support.type.property-vendor.css + 4: support.constant.keyframe.css + push: + - meta_scope: meta.at-rule.keyframe.css + - match: '\s*(?=\{)' + pop: true + - match: '\s*(?=[^{;])' + push: + - match: '\s*(?=[{;])' + pop: true + - include: keyframe-name + - match: '\s*(\{)' + captures: + 1: punctuation.section.property-list.css + push: + - match: '(?=\})' + pop: true + - match: \b(from|to)\b + scope: keyword.keyframe-selector.css + - include: comma-delimiter + - include: numeric-values + - include: main + + at-media: + - match: (?=\s*@media\b) + push: + - include: rule-list-terminator + - match: \s*((@)media) + captures: + 1: keyword.control.at-rule.media.css + 2: punctuation.definition.keyword.css + 3: support.constant.media.css + push: + - meta_scope: meta.at-rule.media.css + - match: '\s*(?=\{)' + pop: true + - include: media-query-list + - match: '\s*(\{)' + captures: + 1: punctuation.section.property-list.css + push: + - match: '(?=\})' + pop: true + - include: main + + media-query: + # Media Types: https://www.w3.org/TR/CSS21/media.html + - include: comment-block + - match: \b(?i:all|aural|braille|embossed|handheld|print|projection|screen|speech|tty|tv)\b + scope: support.constant.media.css + - match: \b(?i:and|or|not|only)\b + scope: keyword.operator.logic.media.css + - match: ',' + scope: punctuation.definition.arbitrary-repetition.css + - match: \( + scope: punctuation.definition.group.begin.css + push: + - match: \) + scope: punctuation.definition.group.end.css + pop: true + - include: comment-block + - match: |- + (?x) + ( + (?: + (-webkit-|-o-)? + (?:min-|max-)? + (-moz-)? + (?: + (?:device-)?(?:height|width|aspect-ratio|pixel-ratio) + |color(?:-index)?|monochrome|resolution + ) + ) + |grid|scan|orientation + )\s*(:)? + captures: + 1: support.type.property-name.media.css + 2: support.type.vendor-prefix.css + 3: support.type.vendor-prefix.css + 4: punctuation.separator.key-value.css + - match: \b(portrait|landscape|progressive|interlace)\b + scope: support.constant.property-value.css + - match: \s*(\d+)(/)(\d+) + captures: + 1: constant.numeric.integer.decimal.css + 2: keyword.operator.arithmetic.css + 3: constant.numeric.integer.decimal.css + - include: numeric-values + + media-query-list: + - match: '\s*(?=[^{;])' + push: + - match: '\s*(?=[{;])' + pop: true + - include: media-query + + # @namespace + # https://www.w3.org/TR/css3-namespace/ + at-namespace: + - match: '\s*((@)namespace)\s+({{ident}}(?!{{nmchar}}|\())?' + captures: + 1: keyword.control.at-rule.namespace.css + 2: punctuation.definition.keyword.css + 3: entity.other.namespace-prefix.css + push: + - meta_scope: meta.at-rule.namespace.css + - include: at-rule-punctuation + - include: literal-string + - include: url-function + - include: comment-block + + # @page + # https://www.w3.org/TR/CSS2/page.html + at-page: + - match: '\s*((@)page)\s*(?:(:)(first|left|right))?\s*(?=\{|$)' + captures: + 1: keyword.control.at-rule.page.css + 2: punctuation.definition.keyword.css + 3: punctuation.definition.entity.css + 4: entity.other.pseudo-class.css + push: + - meta_scope: meta.at-rule.page.css + - include: comment-block + - include: rule-list-terminator + - include: rule-list + + # @supports + # https://drafts.csswg.org/css-conditional-3/#at-supports + at-supports: + - match: '((@)supports)' + captures: + 1: keyword.control.at-rule.supports.css + 2: punctuation.definition.keyword.css + push: + - meta_scope: meta.at-rule.supports.css + - match: '\{' + scope: punctuation.definition.block.begin.css + push: + - meta_scope: meta.block.css + - match: '(?=\})' + pop: true + - include: main + - match: '\}' + scope: meta.block.css punctuation.definition.block.end.css + pop: true + - include: at-supports-operators + - include: at-supports-parens + + at-supports-operators: + - match: '\b(?i:and|or|not)\b' + scope: keyword.operator.logic.css + + at-supports-parens: + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '\)' + scope: punctuation.definition.group.end.css + pop: true + - include: at-supports-operators + - include: at-supports-parens + - include: rule-list-body + + property-list: + - match: '(?=\{)' + push: + - match: '\}' + scope: punctuation.section.property-list.css + pop: true + - include: rule-list + + property-value-constants: + - match: |- + (?x)\b( + absolute|active|add + | all(-(petite|small)-caps|-scroll)? + | alpha(betic)? + | alternate(-reverse)? + | always|annotation|antialiased|at + | auto(hiding-scrollbar|-flow)? + | avoid(-column|-page|-region)? + | background(-color|-image|-position|-size)? + | backwards|balance|baseline|below|bevel|bicubic|bidi-override|blink + | block(-line-height)? + | blur + | bold(er)? + | border(-bottom|-left|-right|-top)?-(color|radius|width|style) + | border-(bottom|top)-(left|right)-radius + | border-image(-outset|-repeat|-slice|-source|-width)? + | border(-bottom|-left|-right|-top|-collapse|-spacing|-box)? + | both|bottom + | box(-shadow)? + | break-(all|word) + | brightness + | butt(on)? + | capitalize + | cent(er|ral) + | char(acter-variant)? + | cjk-ideographic|clip|clone|close-quote + | closest-(corner|side) + | col-resize|collapse + | color(-stop|-burn|-dodge)? + | column((-count|-gap|-reverse|-rule(-color|-width)?|-width)|s)? + | common-ligatures|condensed|consider-shifts|contain + | content(-box|s)? + | contextual|contrast|cover + | crisp(-e|E)dges + | crop + | cross(hair)? + | da(rken|shed) + | default|dense|diagonal-fractions|difference|disabled + | discretionary-ligatures|disregard-shifts + | distribute(-all-lines|-letter|-space)? + | dotted|double|drop-shadow + | (nwse|nesw|ns|ew|sw|se|nw|ne|w|s|e|n)-resize + | ease(-in-out|-in|-out)? + | element|ellipsis|embed|end|EndColorStr|evenodd + | exclu(de(-ruby)?|sion) + | expanded + | (extra|semi|ultra)-(condensed|expanded) + | farthest-(corner|side)? + | fill(-box|-opacity)? + | filter|first|fixed|flat + | fit-content + | flex((-basis|-end|-grow|-shrink|-start)|box)? + | flip|flood-color + | font(-size(-adjust)?|-stretch|-weight)? + | forwards + | from(-image)? + | full-width|geometricPrecision|glyphs|gradient|grayscale + | grid(-height)? + | groove|hand|hanging|hard-light|height|help|hidden|hide + | historical-(forms|ligatures) + | horizontal(-tb)? + | hue + | ideograph(-alpha|-numeric|-parenthesis|-space|ic) + | inactive|include-ruby|infinite|inherit|initial + | inline(-block|-box|-flex(box)?|-line-height|-table)? + | inset|inside + | inter(-ideograph|-word|sect) + | invert|isolat(e|ion)|italic + | jis(04|78|83|90) + | justify(-all)? + | keep-all + | large[r]? + | last|left|letter-spacing + | light(e[nr]|ing-color) + | line(-edge|-height|-through)? + | linear(-gradient|RGB)? + | lining-nums|list-item|local|loose|lowercase|lr-tb|ltr + | lumin(osity|ance)|manual + | margin(-bottom|-box|-left|-right|-top)? + | marker(-offset|s)? + | mathematical + | max-(content|height|lines|size|width) + | medium|middle + | min-(content|height|width) + | miter|mixed|move|multiply|newspaper + | no-(change|clip|(close|open)-quote|(common|discretionary|historical)-ligatures|contextual|drop|repeat) + | none|nonzero|normal|not-allowed|nowrap|oblique + | offset(-after|-before|-end|-start)? + | oldstyle-nums|opacity|open-quote + | optimize(Legibility|Precision|Quality|Speed) + | order|ordinal|ornaments + | outline(-color|-offset|-width)? + | outset|outside|over(line|-edge|lay) + | padding(-bottom|-box|-left|-right|-top)? + | page|painted|paused + | perspective-origin + | petite-caps|pixelated|pointer + | pre(-line|-wrap)? + | preserve-3d + | progid:DXImageTransform.Microsoft.(Alpha|Blur|dropshadow|gradient|Shadow) + | progress + | proportional-(nums|width) + | radial-gradient|recto|region|relative + | repeat(-[xy])? + | repeating-(linear|radial)-gradient + | replaced|reset-size|reverse|ridge|right + | round + | row(-resize|-reverse)? + | run-in + | ruby(-base|-text)?(-container)? + | rtl|running|saturat(e|ion)|screen + | safe + | scroll(-position|bar)? + | separate|sepia + | scale-down + | shape-(image-threshold|margin|outside) + | show + | sideways(-lr|-rl)? + | simplified + | slashed-zero|slice + | small(-caps|er)? + | smooth|snap|solid|soft-light + | space(-around|-between|-evenly)? + | span|sRGB + | stack(ed-fractions)? + | start(ColorStr)? + | static + | step-(end|start) + | sticky + | stop-(color|opacity) + | stretch|strict + | stroke(-box|-dash(array|offset)|-miterlimit|-opacity|-width)? + | style(set)? + | stylistic + | sub(grid|pixel-antialiased|tract)? + | super|swash + | table(-caption|-cell|(-column|-footer|-header|-row)-group|-column|-row)? + | tabular-nums|tb-rl + | text((-bottom|-(decoration|emphasis)-color|-indent|-(over|under|after|before)-edge|-shadow|-size(-adjust)?|-top)|field)? + | thi(ck|n) + | titling-ca(ps|se) + | to[p]? + | touch|traditional + | transform(-origin)? + | under(-edge|line)? + | unicase|unsafe|unset|uppercase|upright + | use-(glyph-orientation|script) + | verso + | vertical(-align|-ideographic|-lr|-rl|-text)? + | view-box + | viewport-fill(-opacity)? + | visibility + | visible(Fill|Painted|Stroke)? + | wait|wavy|weight|whitespace|width|word-spacing + | wrap(-reverse)? + | x{1,2}-(large|small) + | z-index|zero + | zoom(-in|-out)? + | ({{counter_styles}}) + )\b + scope: support.constant.property-value.css + # Generic Font Families: https://www.w3.org/TR/CSS2/fonts.html + - match: \b(?i:sans-serif|serif|monospace|fantasy|cursive|system-ui)\b(?=\s*[;,\n}]) + scope: support.constant.font-name.css + + property-values: + - include: comment-block + - include: vendor-prefix + - include: builtin-functions + - include: line-names + - include: unicode-range + - include: numeric-values + - include: color-values + - include: property-value-constants + - include: literal-string + - match: \!\s*important + scope: keyword.other.important.css + + rule-list-terminator: + - match: '\s*(\})' + captures: + 1: punctuation.section.property-list.css + pop: true + + rule-list: + - match: '\{' + scope: punctuation.section.property-list.css + push: + - meta_scope: meta.property-list.css + - match: '(?=\s*\})' + pop: true + - include: rule-list-body + + rule-list-body: + - include: comment-block + - match: "(?=[-a-z])" + push: + - meta_scope: meta.property-name.css + - match: "$|(?![-a-z])" + pop: true + - include: vendor-prefix + - match: '\b(var-)({{ident}})(?=\s)' + scope: invalid.deprecated.custom-property.css + captures: + 1: keyword.other.custom-property.prefix.css + 2: support.type.custom-property.name.css + - include: custom-property-name + - match: \bfont(-family)?(?!-)\b + scope: support.type.property-name.css + push: + - match: (:)([ \t]*) + captures: + 1: punctuation.separator.key-value.css + 2: meta.property-value.css + push: + - meta_content_scope: meta.property-value.css + - match: '\s*(;)|(?=[})])' + captures: + 1: punctuation.terminator.rule.css + pop: true + - include: property-values + - include: comma-delimiter + - match: '{{ident}}(\s+{{ident}})*' + scope: string.unquoted.css + - match: '' + pop: true + # Property names are sorted by popularity in descending order. + # Popularity data taken from https://www.chromestatus.com/metrics/css/popularity + - match: |- + \b(?x)( + display|width|background-color|height|position|font-family|font-weight + | top|opacity|cursor|background-image|right|visibility|box-sizing + | user-select|left|float|margin-left|margin-top|line-height + | padding-left|z-index|margin-bottom|margin-right|margin + | vertical-align|padding-top|white-space|border-radius|padding-bottom + | padding-right|padding|bottom|clear|max-width|box-shadow|content + | border-color|min-height|min-width|font-style|border-width + | border-collapse|background-size|text-overflow|max-height|text-transform + | text-shadow|text-indent|border-style|overflow-y|list-style-type + | word-wrap|border-spacing|appearance|zoom|overflow-x|border-top-left-radius + | border-bottom-left-radius|border-top-color|pointer-events + | border-bottom-color|align-items|justify-content|letter-spacing + | border-top-right-radius|border-bottom-right-radius|border-right-width + | font-smoothing|border-bottom-width|border-right-color|direction + | border-top-width|src|border-left-color|border-left-width + | tap-highlight-color|table-layout|background-clip|word-break + | transform-origin|resize|filter|backface-visibility|text-rendering + | box-orient|transition-property|transition-duration|word-spacing + | quotes|outline-offset|animation-timing-function|animation-duration + | animation-name|transition-timing-function|border-bottom-style + | border-bottom|transition-delay|transition|unicode-bidi|border-top-style + | border-top|unicode-range|list-style-position|orphans|outline-width + | line-clamp|order|flex-direction|box-pack|animation-fill-mode + | outline-color|list-style-image|list-style|touch-action|flex-grow + | border-left-style|border-left|animation-iteration-count + | page-break-inside|box-flex|box-align|page-break-after|animation-delay + | widows|border-right-style|border-right|flex-align|outline-style + | outline|background-origin|animation-direction|fill-opacity + | background-attachment|flex-wrap|transform-style|counter-increment + | overflow-wrap|counter-reset|animation-play-state|animation + | will-change|box-ordinal-group|image-rendering|mask-image|flex-flow + | background-position-y|stroke-width|background-position-x|background-position + | background-blend-mode|flex-shrink|flex-basis|flex-order|flex-item-align + | flex-line-pack|flex-negative|flex-pack|flex-positive|flex-preferred-size + | flex|user-drag|font-stretch|column-count|empty-cells|align-self + | caption-side|mask-size|column-gap|mask-repeat|box-direction + | font-feature-settings|mask-position|align-content|object-fit + | columns|text-fill-color|clip-path|stop-color|font-kerning + | page-break-before|stroke-dasharray|size|fill-rule|border-image-slice + | column-width|break-inside|column-break-before|border-image-width + | stroke-dashoffset|border-image-repeat|border-image-outset|line-break + | stroke-linejoin|stroke-linecap|stroke-miterlimit|stroke-opacity + | stroke|shape-rendering|border-image-source|border-image|border + | tab-size|writing-mode|perspective-origin-y|perspective-origin-x + | perspective-origin|perspective|text-align-last|text-align|clip-rule + | clip|text-anchor|column-rule-color|box-decoration-break|column-fill + | fill|column-rule-style|mix-blend-mode|text-emphasis-color + | baseline-shift|dominant-baseline|page|alignment-baseline + | column-rule-width|column-rule|break-after|font-variant-ligatures + | transform-origin-y|transform-origin-x|transform|object-position + | break-before|column-span|isolation|shape-outside|all + | color-interpolation-filters|marker|marker-end|marker-start + | marker-mid|color-rendering|color-interpolation|background-repeat-x + | background-repeat-y|background-repeat|background|mask-type + | flood-color|flood-opacity|text-orientation|mask-composite + | text-emphasis-style|paint-order|lighting-color|shape-margin + | text-emphasis-position|text-emphasis|shape-image-threshold + | mask-clip|mask-origin|mask|font-variant-caps|font-variant-alternates + | font-variant-east-asian|font-variant-numeric|font-variant-position + | font-variant|font-size-adjust|font-size|font-language-override + | font-display|font-synthesis|font|line-box-contain|text-justify + | text-decoration-color|text-decoration-style|text-decoration-line + | text-decoration|text-underline-position|grid-template-rows + | grid-template-columns|grid-template-areas|grid-template|rotate|scale + | translate|scroll-behavior|grid-column-start|grid-column-end + | grid-column-gap|grid-row-start|grid-row-end|grid-auto-rows + | grid-area|grid-auto-flow|grid-auto-columns|image-orientation + | hyphens|overflow-scrolling|overflow|color-profile|kerning + | nbsp-mode|color|image-resolution|grid-row-gap|grid-row|grid-column + | blend-mode|azimuth|pause-after|pause-before|pause|pitch-range|pitch + | text-height|system|negative|prefix|suffix|range|pad|fallback + | additive-symbols|symbols|speak-as|speak|grid-gap + )\b + scope: support.type.property-name.css + - match: (:)([ \t]*) + captures: + 1: punctuation.separator.key-value.css + 2: meta.property-value.css + push: + - meta_content_scope: meta.property-value.css + - match: '\s*(;)|(?=[})])' + captures: + 1: punctuation.terminator.rule.css + pop: true + - include: property-values + + selector: + - match: (?=[:.*#a-zA-Z\[]) + push: + - meta_scope: meta.selector.css + - match: "(?=[/@{)])" + pop: true + # Custom Elements: http://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts + - match: '\b([a-z](?:{{custom_element_chars}})*-(?:{{custom_element_chars}})*)\b' + scope: entity.name.tag.custom.css + - match: '\b(a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdi|bdo|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|content|data|datalist|dd|del|details|dfn|dir|dialog|div|dl|dt|element|em|embed|eventsource|fieldset|figure|figcaption|footer|form|frame|frameset|h[1-6]|head|header|hgroup|hr|html|i|iframe|img|input|ins|isindex|kbd|keygen|label|legend|li|link|main|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|picture|pre|progress|q|rp|rt|rtc|s|samp|script|section|select|shadow|small|source|span|strike|strong|style|sub|summary|sup|svg|table|tbody|td|template|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video|wbr|xmp|circle|clipPath|defs|ellipse|filter|foreignObject|g|glyph|glyphRef|image|line|linearGradient|marker|mask|path|pattern|polygon|polyline|radialGradient|rect|stop|switch|symbol|text|textPath|tref|tspan|use)\b' + scope: entity.name.tag.css + # https://drafts.csswg.org/selectors-4/#class-html + - match: '(\.){{ident}}' + scope: entity.other.attribute-name.class.css + captures: + 1: punctuation.definition.entity.css + # https://drafts.csswg.org/selectors-4/#id-selectors + - match: "(#){{ident}}" + scope: entity.other.attribute-name.id.css + captures: + 1: punctuation.definition.entity.css + - match: \* + scope: entity.name.tag.wildcard.css + # Combinators + # https://drafts.csswg.org/selectors-4/#combinators + # https://drafts.csswg.org/css-scoping/#deep-combinator + - match: '({{combinators}})(?![>~+])' + scope: punctuation.separator.combinator.css + - match: '({{combinators}}){2,}' + scope: invalid.illegal.combinator.css + - include: pseudo-elements + - include: pseudo-classes # pseudo-classes must be included after pseudo-elements + # Attribute Selectors + # https://drafts.csswg.org/selectors-4/#attribute-selectors + - match: '\[' + scope: punctuation.definition.entity.css + push: + - meta_scope: meta.attribute-selector.css + - include: qualified-name + - match: '({{ident}})' + scope: entity.other.attribute-name.css + - match: '\s*([~*|^$]?=)\s*' + captures: + 1: keyword.operator.attribute-selector.css + push: + - match: '[^\s\]\[''"]' + scope: string.unquoted.css + - include: literal-string + - match: '(?=(\s|\]))' + pop: true + - match: '(?:\s+([iI]))?' # case insensitive flag + captures: + 1: keyword.other.css + - match: '\]' + scope: punctuation.definition.entity.css + pop: true + - include: comma-delimiter + + # Pseudo Elements + # https://drafts.csswg.org/selectors-4/#pseudo-elements + pseudo-elements: + - match: |- + (?x: + (:{1,2})(?:before|after|first-line|first-letter) # CSS1 & CSS2 require : or :: + | (::)(-(?:moz|ms|webkit)-)?(?:{{ident}}) # CSS3 requires :: + )\b + scope: entity.other.pseudo-element.css + captures: + 1: punctuation.definition.entity.css + 2: punctuation.definition.entity.css + 3: support.type.vendor-prefix.css + + # Pseudo Classes + # https://drafts.csswg.org/selectors-4/#pseudo-classes + pseudo-classes: + # Functional Pseudo Classes + # https://drafts.csswg.org/selectors-4/#functional-pseudo-class + + # Functional Pseudo Classes with a single unquoted string + - match: '(:)(dir|lang)(?=\()' + scope: entity.other.pseudo-class.css + captures: + 1: punctuation.definition.entity.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: unquoted-string + + # Functional Pseudo Classes with selector list + - match: '(:)(matches|not|has)(?=\()' + scope: entity.other.pseudo-class.css + captures: + 1: punctuation.definition.entity.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: selector + + # Special :drop() pseudo-class + - match: '(:)(drop)(?=\()' + scope: entity.other.pseudo-class.css + captures: + 1: punctuation.definition.entity.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - match: \b(active|valid|invalid)\b + scope: keyword.other.pseudo-class.css + + # Functional Pseudo Classes with `An+B` param + # An+B Notation: https://drafts.csswg.org/css-syntax/#anb + # nth-last-child(), nth-child(), nth-last-of-type(), nth-of-type() + - match: '(:)(nth-last-child|nth-child|nth-last-of-type|nth-of-type)(?=\()' + scope: entity.other.pseudo-class.css + captures: + 1: punctuation.definition.entity.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - match: \b(even|odd)\b + scope: keyword.other.pseudo-class.css + - match: '([-+]?\d*(n))\s*([-+]\s*\d+)?' + captures: + 1: constant.numeric.integer.decimal.css + 2: keyword.other.unit.css + 3: constant.numeric.integer.decimal.css + - match: '[-+]\s+\d+n?|[-+]?\d+\s+n' + scope: invalid.illegal.numeric.css + - include: integer-type + + # Regular Pseudo Classes + - match: '(:)({{ident}})' + scope: entity.other.pseudo-class.css + captures: + 1: punctuation.definition.entity.css + + builtin-functions: + - include: attr-function + - include: calc-function + - include: cross-fade-function + - include: filter-functions + - include: gradient-functions + - include: image-function + - include: image-set-function + - include: minmax-function + - include: url-function + - include: var-function + - include: color-adjuster-functions + + # filter() + # https://drafts.fxtf.org/filters/#funcdef-filter + - match: '\b(filter)(?=\()' + scope: support.function.filter.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: image-type + - include: literal-string + - include: filter-functions + + # counter() + # https://drafts.csswg.org/css-lists-3/#funcdef-counter + - match: '\b(counter)(?=\()' + scope: support.function.counter.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - match: '({{ident}})' + scope: entity.other.counter-name.css string.unquoted.css + - match: '(?=,)' + push: + - match: '(?=\))' + pop: true + - include: comma-delimiter + - match: '\b({{counter_styles}}|none)\b' + scope: support.constant.property-value.counter-style.css + + # counters() + # https://drafts.csswg.org/css-lists-3/#funcdef-counters + - match: '\b(counters)(?=\()' + scope: support.function.counter.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - match: '({{ident}})' + scope: entity.other.counter-name.css string.unquoted.css + - match: '(?=,)' + push: + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: literal-string + - match: '\b({{counter_styles}}|none)\b' + scope: support.constant.property-value.counter-style.css + + # symbols() + # https://drafts.csswg.org/css-counter-styles-3/#symbols-function + - match: '\b(symbols)(?=\()' + scope: support.function.counter.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - match: '\b(cyclic|numeric|alphabetic|symbolic|fixed)\b' + scope: support.constant.symbol-type.css + - include: comma-delimiter + - include: literal-string + - include: image-type + + # format() + # https://drafts.csswg.org/css-fonts-3/#descdef-src + # format() is also mentioned in `issue 2` at https://drafts.csswg.org/css-images-3/#issues-index + # but does not seem to be implemented in any manner + - match: '\b(format)(?=\()' + scope: support.function.font-face.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: literal-string + + # local() + # https://drafts.csswg.org/css-fonts-3/#descdef-src + - match: '\b(local)(?=\()' + scope: support.function.font-face.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: literal-string + - include: unquoted-string + + # Transform Functions + # https://www.w3.org/TR/css-transforms-1/#transform-functions + + # transform functions with comma separated types + # matrix(), scale(), matrix3d(), scale3d() + - match: '\b(matrix3d|scale3d|matrix|scale)(?=\()' + scope: support.function.transform.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: number-type + - include: var-function + + # transform functions with comma separated or types + # translate(), translate3d() + - match: '\b(translate(3d)?)(?=\()' + scope: support.function.transform.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: percentage-type + - include: length-type + - include: number-type + - include: var-function + + # transform functions with a single or type + # translateX(), translateY() + - match: '\b(translate[XY])(?=\()' + scope: support.function.transform.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: percentage-type + - include: length-type + - include: number-type + + # transform functions with a single type + # rotate(), skewX(), skewY(), rotateX(), rotateY(), rotateZ() + - match: '\b(rotate[XYZ]?|skew[XY])(?=\()' + scope: support.function.transform.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: angle-type + + # transform functions with comma separated types + # skew() + - match: '\b(skew)(?=\()' + scope: support.function.transform.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: angle-type + + # transform functions with a single type + # translateZ(), perspective() + - match: '\b(translateZ|perspective)(?=\()' + scope: support.function.transform.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: length-type + + # transform functions with a comma separated or types + # rotate3d() + - match: '\b(rotate3d)(?=\()' + scope: support.function.transform.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: angle-type + - include: number-type + + # transform functions with a single type + # scaleX(), scaleY(), scaleZ() + - match: '\b(scale[XYZ])(?=\()' + scope: support.function.transform.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: number-type + + # Timing Functions + # https://www.w3.org/TR/web-animations-1/#timing-functions + + # cubic-bezier() + # https://www.w3.org/TR/web-animations-1/#cubic-bzier-timing-function + - match: '\b(cubic-bezier)(?=\()' + scope: support.function.timing.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: number-type + + # steps() + # https://www.w3.org/TR/web-animations-1/#step-timing-function + - match: '\b(steps)(?=\()' + scope: support.function.timing.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: integer-type + - match: (end|middle|start) + scope: support.keyword.timing-direction.css + + # Shape Functions + # https://www.w3.org/TR/css-shapes-1/#typedef-basic-shape + + # rect() - Deprecated + # https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect + - match: '\b(rect)(?=\()' + scope: support.function.shape.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - match: \bauto\b + scope: support.constant.property-value.css + - include: length-type + + # inset() + # https://www.w3.org/TR/css-shapes-1/#funcdef-inset + - match: '\b(inset)(?=\()' + scope: support.function.shape.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - match: '\bround\b' + scope: keyword.other.css + - include: length-type + - include: percentage-type + + # circle() + # https://www.w3.org/TR/css-shapes-1/#funcdef-circle + # ellipse() + # https://www.w3.org/TR/css-shapes-1/#funcdef-ellipse + - match: '\b(circle|ellipse)(?=\()' + scope: support.function.shape.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - match: '\bat\b' + scope: keyword.other.css + - match: '\b(top|right|bottom|left|center|closest-side|farthest-side)\b' + scope: support.constant.property-value.css + - include: length-type + - include: percentage-type + + # polygon() + # https://www.w3.org/TR/css-shapes-1/#funcdef-polygon + - match: '\b(polygon)(?=\()' + scope: support.function.shape.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - include: comment-block + - match: '(?=\))' + pop: true + - match: '\b(nonzero|evenodd)\b' + scope: support.constant.property-value.css + - include: length-type + - include: percentage-type + - include: calc-function + - include: comma-delimiter + + # toggle() + # https://www.w3.org/TR/css3-values/#toggle-notation + - match: '\b(toggle)(?=\()' + scope: support.function.toggle.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: vendor-prefix + - include: property-value-constants + - include: numeric-values + - include: color-values + - include: literal-string + + # repeat() + # https://drafts.csswg.org/css-grid/#funcdef-repeat + - match: '\b(repeat)(?=\()' + scope: support.function.grid.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: length-type + - include: percentage-type + - include: minmax-function + - include: integer-type + - include: var-function + - include: line-names + - match: \b(auto-fill|auto-fit)\b + scope: support.keyword.repetitions.css + - match: \b(max-content|min-content|auto)\b + scope: support.constant.property-value.css + + # var() + # https://drafts.csswg.org/css-variables/#funcdef-var + var-function: + - match: '\b(var)(?=\()' + scope: support.function.var.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: custom-property-name + + # Filter Functions + # https://drafts.fxtf.org/filters/#typedef-filter-function + filter-functions: + # blur() + # https://drafts.fxtf.org/filters/#funcdef-filter-blur + - match: '\b(blur)(?=\()' + scope: support.function.filter.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: length-type + + # brightness(), contrast(), grayscale(), invert(), opacity(), saturate(), sepia() + # https://drafts.fxtf.org/filters/#funcdef-filter-brightness + - match: '\b(brightness|contrast|grayscale|invert|opacity|saturate|sepia)(?=\()' + scope: support.function.filter.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: percentage-type + - include: number-type + + # drop-shadow() + # https://drafts.fxtf.org/filters/#funcdef-filter-drop-shadow + - match: '\b(drop-shadow)(?=\()' + scope: support.function.filter.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: length-type + - include: color-values + + # hue-rotate() + # https://drafts.fxtf.org/filters/#funcdef-filter-hue-rotate + - match: '\b(hue-rotate)(?=\()' + scope: support.function.filter.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: angle-type + + # calc() + # https://www.w3.org/TR/css3-values/#funcdef-calc + calc-function: + - match: '\b(calc)(?=\()' + scope: support.function.calc.css + push: + - meta_scope: meta.function-call.css + - match: '\(' + scope: punctuation.definition.group.begin.css + push: inside-calc-parens + - match: '' + pop: true + + inside-calc-parens: + - meta_scope: meta.group.css + - match: '(?=\))' + set: function-notation-terminator + - include: comment-block + - include: calc-function + - include: var-function + - include: numeric-values + - include: attr-function + - match: "[-/*+]" + scope: keyword.operator.css + - match: '\(' + scope: punctuation.definition.group.begin.css + push: inside-calc-parens + + # attr() + # https://www.w3.org/TR/css3-values/#funcdef-attr + attr-function: + - match: '\b(attr)(?=\()' + scope: support.function.attr.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: qualified-name + - include: literal-string + - match: '({{ident}})' + scope: entity.other.attribute-name.css + push: + - match: |- + (?x)\b( + {{font_relative_lengths}} + | {{viewport_percentage_lengths}} + | {{absolute_lengths}} + | {{angle_units}} + | {{duration_units}} + | {{frequency_units}} + | {{resolution_units}} + )\b + scope: keyword.other.unit.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: property-value-constants + - include: numeric-values + - include: color-values + + # url() + # https://drafts.csswg.org/css-images-3/#url-notation + url-function: + - match: '\b(url)(?=\()' + scope: support.function.url.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: literal-string + - include: unquoted-string + + # url-prefix() + # https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#url-prefix + url-prefix-function: + - match: '\b(url-prefix)(?=\()' + scope: support.function.url-prefix.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: literal-string + - include: unquoted-string + + # domain() + # https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#url-domain + domain-function: + - match: '\b(domain)(?=\()' + scope: support.function.domain.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: literal-string + - include: unquoted-string + + # regexp() + # https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#url-regexp + regexp-function: + - match: '\b(regexp)(?=\()' + scope: support.function.regexp.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: literal-string + + # image() + # https://drafts.csswg.org/css-images-3/#funcdef-image + image-function: + - match: '\b(image)(?=\()' + scope: support.function.image.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: image-type + - include: literal-string + - include: color-values + - include: comma-delimiter + - include: unquoted-string + + # image-set() + # https://drafts.csswg.org/css-images-3/#funcdef-image-set + image-set-function: + - match: '\b(image-set)(?=\()' + scope: support.function.image.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: literal-string + - include: color-values + - include: comma-delimiter + - include: resolution-type + - include: image-type + - match: '[0-9]+(x)' + scope: constant.numeric.integer.decimal.css + captures: + 1: keyword.other.unit.css + - include: unquoted-string + + # Gradient Functions + # https://drafts.csswg.org/css-images-3/#gradients + gradient-functions: + # linear-gradient() + # https://drafts.csswg.org/css-images-3/#linear-gradients + # repeating-linear-gradient() + # https://drafts.csswg.org/css-images-3/#funcdef-repeating-linear-gradient + - match: '\b((?:repeating-)?linear-gradient)(?=\()' + scope: support.function.gradient.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: angle-type + - include: comma-delimiter + - include: color-values + - include: percentage-type + - include: length-type + - match: '\bto\b' + scope: keyword.other.css + - match: \b(top|right|bottom|left)\b + scope: support.constant.property-value.css + + # radial-gradient() + # https://drafts.csswg.org/css-images-3/#radial-gradients + # repeating-radial-gradient() + # https://drafts.csswg.org/css-images-3/#funcdef-repeating-radial-gradient + - match: '\b((?:repeating-)?radial-gradient)(?=\()' + scope: support.function.gradient.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: color-values + - include: percentage-type + - include: length-type + - match: '\b(at|circle|ellipse)\b' + scope: keyword.other.css + - match: |- + (?x)\b( + left + | center + | right + | top + | bottom + | closest-corner + | closest-side + | farthest-corner + | farthest-side + )\b + scope: support.constant.property-value.css + + # cross-fade() + # https://drafts.csswg.org/css-images-3/#cross-fade-function + cross-fade-function: + - match: '\b(cross-fade)(?=\()' + scope: support.function.image.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: percentage-type + - include: color-values + - include: image-type + - include: literal-string + - include: unquoted-string + + # minmax() + # https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-minmax + minmax-function: + - match: '\b(minmax)(?=\()' + scope: support.function.grid.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: length-type + - include: percentage-type + - match: \b(auto|max-content|min-content)\b + scope: support.constant.property-value.css + + # Color Functions + # https://drafts.csswg.org/css-color + color-functions: + # rgb(), rgba() + # https://drafts.csswg.org/css-color/#rgb-functions + - match: '\b(rgba?)(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: percentage-type + - include: number-type + + # hsl(), hsla() + # https://drafts.csswg.org/css-color/#the-hsl-notation + # hwb() - Not yet implemented by browsers + # https://drafts.csswg.org/css-color/#funcdef-hwb + - match: '\b(hsla?|hwb)(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: angle-type + - include: percentage-type + - include: number-type + + # gray() - Not yet implemented by browsers + # https://drafts.csswg.org/css-color/#funcdef-gray + - match: '\b(gray)(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: percentage-type + - include: number-type + + # device-cmyk() - Not yet implemented by browsers + # https://drafts.csswg.org/css-color/#funcdef-device-cmyk + - match: '\b(device-cmyk)(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: color-adjuster-functions # must be included before `color-values` + - include: color-values + - include: percentage-type + - include: number-type + + # color-mod() - Not yet implemented by browsers + # https://drafts.csswg.org/css-color/#funcdef-color-mod + - match: '\b(color)(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: comma-delimiter + - include: color-adjuster-functions # must be included before `color-values` + - include: var-function + - include: color-values + - include: angle-type + - include: number-type + + # Color Adjuster Functions - Not yet implemented by browsers + # https://drafts.csswg.org/css-color/#typedef-color-adjuster + color-adjuster-functions: + # red(), green(), blue(), alpha() - Not yet implemented by browsers + - match: '\b(red|green|blue|alpha|a)(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: color-adjuster-operators + - include: percentage-type + - include: number-type + + # hue() - Not yet implemented by browsers + - match: '\b(hue|h)(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: color-adjuster-operators + - include: angle-type + + # saturation(), lightness(), whiteness(), blackness() - Not yet implemented by browsers + - match: '\b(saturation|lightness|whiteness|blackness|[slwb])(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: color-adjuster-operators + - include: percentage-type + + # tint(), shade(), contrast() - Not yet implemented by browsers + # contrast() interferes with the contrast() filter function; + # therefore, it is not yet implemented here + - match: '\b(tint|shade)(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - include: percentage-type + + # blend(), blenda() - Not yet implemented by browsers + - match: '\b(blenda|blend)(?=\()' + scope: support.function.color.css + push: + - meta_scope: meta.function-call.css + - include: function-notation-terminator + - match: '\(' + scope: punctuation.definition.group.begin.css + push: + - meta_scope: meta.group.css + - match: '(?=\))' + pop: true + - match: '\b(rgb|hsl|hwb)\b' + scope: keyword.other.color-space.css + - include: color-values + - include: percentage-type + - include: var-function + + unicode-range: + - match: |- + (?xi) + (u\+) + ([0-9a-f?]{1,6} + (?:(-)[0-9a-f]{1,6})?) + scope: support.unicode-range.css + captures: + 1: support.constant.unicode-range.prefix.css + 2: constant.codepoint-range.css + 3: punctuation.section.range.css + + # Qualified Name + # https://drafts.csswg.org/css-namespaces-3/#css-qnames + qualified-name: + - match: '(?:({{ident}})|(\*))?([|])(?!=)' + captures: + 1: entity.other.namespace-prefix.css + 2: entity.name.namespace.wildcard.css + 3: punctuation.separator.namespace.css + + # Custom Properties + # https://drafts.csswg.org/css-variables/#typedef-custom-property-name + custom-property-name: + - match: '(--)({{nmchar}}+)' + scope: support.type.custom-property.css + captures: + 1: punctuation.definition.custom-property.css + 2: support.type.custom-property.name.css + + color-adjuster-operators: + - match: '[\-\+*](?=\s+)' + scope: keyword.operator.css + + comma-delimiter: + - match: '\s*(,)\s*' + captures: + 1: punctuation.separator.sequence.css + + vendor-prefix: + - match: "-(?:webkit|moz|ms|o)-" + scope: support.type.vendor-prefix.css + + function-notation-terminator: + - match: '\)' + scope: meta.group.css punctuation.definition.group.end.css + pop: true + + at-rule-punctuation: + - match: \; + scope: punctuation.terminator.rule.css + - match: (?=;|$) + pop: true + + # Named Grid Lines + # https://drafts.csswg.org/css-grid/#named-lines + line-names: + - match: '\[' + scope: punctuation.section.begin.css + push: + - match: '{{ident}}' + scope: string.unquoted.line-name.css + - match: '\]' + scope: punctuation.section.end.css + pop: true + + unquoted-string: + - match: '[^\s''"]' + scope: string.unquoted.css + + literal-string: + - match: \' + scope: punctuation.definition.string.begin.css + push: + - meta_scope: string.quoted.single.css + - match: \' + scope: punctuation.definition.string.end.css + pop: true + - include: string-content + - match: \" + scope: punctuation.definition.string.begin.css + push: + - meta_scope: string.quoted.double.css + - match: \" + scope: punctuation.definition.string.end.css + pop: true + - include: string-content + + string-content: + - match: \n + scope: invalid.illegal.newline.css + pop: true + - match: \\\s*\n + scope: constant.character.escape.newline.css + - match: \\(?:\h{1,6}|.) + scope: constant.character.escape.css + + # https://www.w3.org/TR/css3-values/#numeric-types + numeric-values: + - include: dimensions + - include: percentage-type + - include: number-type + + float-type: + - match: '{{float}}' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + + integer-type: + - match: '{{integer}}' + scope: constant.numeric.integer.decimal.css + + # Make sure `number-type` is included after any other numeric values + # as `number-type` will consume all numeric values. + number-type: + - include: float-type + - include: integer-type + + percentage-type: + - match: '{{float}}(%)' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}(%)' + scope: constant.numeric.integer.decimal.css + captures: + 1: keyword.other.unit.css + + dimensions: + - include: angle-type + - include: frequency-type + - include: length-type + - include: resolution-type + - include: time-type + + length-type: + - match: '{{float}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})\b' + scope: constant.numeric.integer.decimal.css + captures: + 1: keyword.other.unit.css + - match: '0\b(?!%)' + scope: constant.numeric.integer.decimal.css + + time-type: + - match: '{{float}}({{duration_units}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{duration_units}})\b' + scope: constant.numeric.integer.decimal.css + captures: + 1: keyword.other.unit.css + + frequency-type: + - match: '{{float}}({{frequency_units}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{frequency_units}})\b' + scope: constant.numeric.integer.decimal.css + captures: + 1: keyword.other.unit.css + + resolution-type: + - match: '{{float}}({{resolution_units}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{resolution_units}})\b' + scope: constant.numeric.integer.decimal.css + captures: + 1: keyword.other.unit.css + + angle-type: + - match: '{{float}}({{angle_units}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{angle_units}})\b' + scope: constant.numeric.integer.decimal.css + captures: + 1: keyword.other.unit.css + - match: '0\b(?!%)' + scope: constant.numeric.integer.decimal.css + + # https://drafts.csswg.org/css-images-3/#typedef-image + image-type: + - include: cross-fade-function + - include: gradient-functions + - include: image-function + - include: image-set-function + - include: url-function diff --git a/assets/syntaxes/Packages/CSS/Comments.tmPreferences b/assets/syntaxes/Packages/CSS/Comments.tmPreferences new file mode 100644 index 000000000..8edc5fe40 --- /dev/null +++ b/assets/syntaxes/Packages/CSS/Comments.tmPreferences @@ -0,0 +1,33 @@ + + + + name + Comments + scope + source.css + settings + + shellVariables + + + name + TM_COMMENT_START + value + /* + + + name + TM_COMMENT_END + value + */ + + + name + TM_COMMENT_DISABLE_INDENT + value + yes + + + + + diff --git a/assets/syntaxes/Packages/CSS/Completion Rules.tmPreferences b/assets/syntaxes/Packages/CSS/Completion Rules.tmPreferences new file mode 100644 index 000000000..42f1748b0 --- /dev/null +++ b/assets/syntaxes/Packages/CSS/Completion Rules.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + source.css meta.selector + settings + + cancelCompletion + .* + + + diff --git a/assets/syntaxes/Packages/CSS/Default.sublime-keymap b/assets/syntaxes/Packages/CSS/Default.sublime-keymap new file mode 100644 index 000000000..e700c7ee7 --- /dev/null +++ b/assets/syntaxes/Packages/CSS/Default.sublime-keymap @@ -0,0 +1,47 @@ +[ + { "keys": [":"], "command": "insert_snippet", "args": {"contents": ":$0;"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.css - meta.selector.css", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\}|$)", "match_all": true } + ] + }, + { "keys": [";"], "command": "move", "args": {"by": "characters", "forward": true}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.css - meta.selector.css", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^;", "match_all": true } + ] + }, + { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.css - meta.selector.css", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": ":$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^;", "match_all": true } + ] + }, + + // Expand {|} to { | } when space is pressed + { "keys": [" "], "command": "insert_snippet", "args": {"contents": " $0 "}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.css - meta.selector.css", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }, + ] + }, + { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.css - meta.selector.css", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{ $", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^ \\}", "match_all": true } + ] + }, +] diff --git a/assets/syntaxes/Packages/CSS/Symbol Index.tmPreferences b/assets/syntaxes/Packages/CSS/Symbol Index.tmPreferences new file mode 100644 index 000000000..8f9867631 --- /dev/null +++ b/assets/syntaxes/Packages/CSS/Symbol Index.tmPreferences @@ -0,0 +1,14 @@ + + + + scope + source.css entity.other.attribute-name.class, source.css entity.other.attribute-name.id + settings + + showInIndexedSymbolList + 1 + symbolIndexTransformation + /[#.]([A-Za-z0-9_~]+)/$1/; + + + diff --git a/assets/syntaxes/Packages/CSS/Symbol List Group.tmPreferences b/assets/syntaxes/Packages/CSS/Symbol List Group.tmPreferences new file mode 100644 index 000000000..5c65c1e7c --- /dev/null +++ b/assets/syntaxes/Packages/CSS/Symbol List Group.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Group + scope + source.css comment.block.css -source.css.embedded + settings + + showInSymbolList + 1 + symbolTransformation + s/\/\*\*\s*(.*?)\s*\*\//** $1 **/; s/\/\*.*?\*\*\//./; s/\/\*[^\*].*?[^\*]\*\/// + + + diff --git a/assets/syntaxes/Packages/CSS/Symbol List.tmPreferences b/assets/syntaxes/Packages/CSS/Symbol List.tmPreferences new file mode 100644 index 000000000..61fdb5b87 --- /dev/null +++ b/assets/syntaxes/Packages/CSS/Symbol List.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Selector + scope + source.css meta.selector + settings + + showInSymbolList + 1 + symbolTransformation + s/^\s*/CSS: /; s/\s+/ /g + + + diff --git a/assets/syntaxes/Packages/CSS/css_completions.py b/assets/syntaxes/Packages/CSS/css_completions.py new file mode 100644 index 000000000..f7e25ddcb --- /dev/null +++ b/assets/syntaxes/Packages/CSS/css_completions.py @@ -0,0 +1,521 @@ +import sublime, sublime_plugin +import re + + +# Prepare some common property values for when there is more than one way to +# specify a certain value type. The color value for example can be specified +# by `rgb()` or `hsl()` and so on. Example where `|` denotes the caret: +# +# color: rg| --> color: rgb(|); +# +# This is also helpful when multiple properties share the same value types. +COMMON_VALUES = { + 'animation_direction': [ + 'alternate', 'alternate-reverse', 'normal', 'reverse' + ], + 'absolute_size': [ + 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' + ], + 'absolute_weight': [ + '100', '200', '300', '400', '500', '600', '700', '800', '900' + ], + 'basic_shape': ['inset($1)', 'circle($1)', 'ellipse($1)', 'polygon($1)'], + 'blend_mode': [ + 'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', + 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', + 'exclusion', 'hue', 'saturation', 'color', 'luminosity' + ], + 'border_style': [ + 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', + 'groove', 'ridge', 'inset', 'outset' + ], + 'border_width': ['thin', 'medium', 'thick'], + 'break_before_after': [ + 'always', 'left', 'right', 'recto', 'verso', 'page', 'column', 'region' + ], + 'break_inside': [ + 'auto', 'avoid', 'avoid-page', 'avoid-column', 'avoid-region' + ], + 'color': ['currentColor', 'rgb($1)', 'rgba($1)', 'hsl($1)', 'hsla($1)', 'transparent'], + 'font_variant_alternates': [ + 'normal', 'historical-forms', 'stylistic($1)', 'styleset($1)', + 'character-variant($1)', 'swash($1)', 'ornaments($1)', 'annotation($1)' + ], + 'generic_name': [ + 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace' + ], + 'list_style_type': [ + 'none', 'inline', 'disc', 'circle', 'square', 'decimal', + 'decimal-leading-zero', 'arabic-indic', 'binary', 'bengali', + 'cambodian', 'khmer', 'devanagari', 'gujarati', 'gurmukhi', + 'kannada', 'lower-hexadecimal', 'lao', 'malayalam', 'mongolian', + 'myanmar', 'octal', 'oriya', 'persian', 'urdu', 'telugu', + 'tibetan', 'thai', 'upper-hexadecimal', 'lower-roman', + 'upper-roman', 'lower-greek', 'lower-alpha', 'lower-latin', + 'upper-alpha', 'upper-latin', 'afar', 'ethiopic-halehame-aa-et', + 'ethiopic-halehame-aa-er', 'amharic', 'ethiopic-halehame-am-et', + 'amharic-abegede', 'ethiopic-abegede-am-et', 'cjk-earthly-branch', + 'cjk-heavenly-stem', 'ethiopic', 'ethiopic-halehame-gez', + 'ethiopic-abegede', 'ethiopic-abegede-gez', 'hangul-consonant', + 'hangul', 'lower-norwegian', 'oromo', 'ethiopic-halehame-om-et', + 'sidama', 'ethiopic-halehame-sid-et', 'somali', + 'ethiopic-halehame-so-et', 'tigre', 'ethiopic-halehame-tig', + 'tigrinya-er', 'ethiopic-halehame-ti-er', 'tigrinya-er-abegede', + 'ethiopic-abegede-ti-er', 'tigrinya-et', 'ethiopic-halehame-ti-et', + 'tigrinya-et-abegede', 'ethiopic-abegede-ti-et', 'upper-greek', + 'upper-norwegian', 'asterisks', 'footnotes', 'hebrew', 'armenian', + 'lower-armenian', 'upper-armenian', 'georgian', 'cjk-ideographic', + 'hiragana', 'katakana', 'hiragana-iroha', 'katakana-iroha' + ], + 'position': ['top', 'right', 'bottom', 'left', 'center'], + 'relative_size': ['larger', 'smaller'], + 'relative_weight': ['bolder', 'lighter'], + 'repeat_style': [ + 'repeat', 'repeat-x', 'repeat-y', 'space', 'round', 'no-repeat' + ], + 'string': ['\"$1\"'], + 'timing_function': [ + 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear', + 'cubic-bezier($1)', 'step-start', 'step-end', 'steps($1)' + ], + 'uri': ['url($1)'], +} + +PROPERTY_DICT = { + 'align-content': [ + 'center', 'flex-end', 'flex-start', 'space-around', 'space-between', + 'stretch' + ], + 'align-items': ['baseline', 'center', 'flex-end', 'flex-start', 'stretch'], + 'align-self': ['auto', 'baseline', 'center', 'flex-end', 'flex-start', 'stretch'], + 'alignment-baseline': [ + 'baseline', 'middle', 'auto', 'before-edge', 'after-edge', 'central', + 'text-before-edge', 'text-after-edge', 'ideographic', 'alphabetic', + 'hanging', 'mathematical' + ], + 'animation': [ + 'none', '', 'infinite', '', + 'forwards', 'backwards', 'both', 'running', 'paused' + ], + 'animation-name': ['none', ''], + 'animation-duration': [''), + ('area\tTag', 'area shape=\"$1\" coords=\"$2\" href=\"$3\">'), + ('audio\tTag', 'audio src=\"$1\">$0'), + ('base\tTag', 'base href=\"$1\">'), + ('br\tTag', 'br>'), + ('col\tTag', 'col>'), + ('hr\tTag', 'hr>'), + ('iframe\tTag', 'iframe src=\"$1\">$0'), + ('input\tTag', 'input type=\"$1\" name=\"$2\">'), + ('img\tTag', 'img src=\"$1\">'), + ('link\tTag', 'link rel=\"stylesheet\" type=\"text/css\" href=\"$1\">'), + ('meta\tTag', 'meta ${1:charset=\"utf-8\"}>'), + ('param\tTag', 'param name=\"$1\" value=\"$2\">'), + ('progress\tTag', 'progress value=\"$1\" max=\"$2\">'), + ('script\tTag', 'script${2: type=\"${1:text/javascript}\"}>$0'), + ('source\tTag', 'source src=\"$1\" type=\"$2\">'), + ('style\tTag', 'style type=\"${1:text/css}\">$0'), + ('track\tTag', 'track kind=\"$1\" src=\"$2\">'), + ('wbr\tTag', 'wbr>'), + ('video\tTag', 'video src=\"$1\">$0') + ]) + + return default_list + + # This responds to on_query_completions, but conceptually it's expanding + # expressions, rather than completing words. + # + # It expands these simple expressions: + # tag.class + # tag#id + def expand_tag_attributes(self, view, locations): + # Get the contents of each line, from the beginning of the line to + # each point + lines = [view.substr(sublime.Region(view.line(l).a, l)) + for l in locations] + + # Reverse the contents of each line, to simulate having the regex + # match backwards + lines = [l[::-1] for l in lines] + + # Check the first location looks like an expression + rex = re.compile("([\w-]+)([.#])(\w+)") + expr = match(rex, lines[0]) + if not expr: + return [] + + # Ensure that all other lines have identical expressions + for i in range(1, len(lines)): + ex = match(rex, lines[i]) + if ex != expr: + return [] + + # Return the completions + arg, op, tag = rex.match(expr).groups() + + arg = arg[::-1] + tag = tag[::-1] + expr = expr[::-1] + + if op == '.': + snippet = '<{0} class=\"{1}\">$1$0'.format(tag, arg) + else: + snippet = '<{0} id=\"{1}\">$1$0'.format(tag, arg) + + return [(expr, snippet)] + + def get_attribute_completions(self, view, pt, prefix): + SEARCH_LIMIT = 500 + search_start = max(0, pt - SEARCH_LIMIT - len(prefix)) + line = view.substr(sublime.Region(search_start, pt + SEARCH_LIMIT)) + + line_head = line[0:pt - search_start] + line_tail = line[pt - search_start:] + + # find the tag from end of line_head + i = len(line_head) - 1 + tag = None + space_index = len(line_head) + while i >= 0: + c = line_head[i] + if c == '<': + # found the open tag + tag = line_head[i + 1:space_index] + break + elif c == ' ': + space_index = i + i -= 1 + + # check that this tag looks valid + if not tag or not tag.isalnum(): + return [] + + # determines whether we need to close the tag + # default to closing the tag + suffix = '>' + + for c in line_tail: + if c == '>': + # found end tag + suffix = '' + break + elif c == '<': + # found another open tag, need to close this one + break + + if suffix == '' and not line_tail.startswith(' ') and not line_tail.startswith('>'): + # add a space if not there + suffix = ' ' + + # got the tag, now find all attributes that match + attributes = self.tag_to_attributes.get(tag, []) + # ("class\tAttr", "class="$1">"), + attri_completions = [(a + '\tAttr', a + '="$1"' + suffix) for a in attributes] + return attri_completions + + +# unit testing +# to run it in sublime text: +# import HTML.html_completions +# HTML.html_completions.Unittest.run() + +import unittest + +class Unittest(unittest.TestCase): + + class Sublime: + INHIBIT_WORD_COMPLETIONS = 1 + INHIBIT_EXPLICIT_COMPLETIONS = 2 + + # this view contains a hard coded one line super simple HTML fragment + class View: + def __init__(self): + self.buf = 'td.class' + + def line(self, pt): + # only ever 1 line + return sublime.Region(0, len(self.buf)) + + def substr(self, region): + return self.buf[region.a : region.b] + + def run(): + # redefine the modules to use the mock version + global sublime + + sublime_module = sublime + # use the normal region + Unittest.Sublime.Region = sublime.Region + sublime = Unittest.Sublime + + test = Unittest() + test.test_simple_completion() + test.test_inside_tag_completion() + test.test_inside_tag_no_completion() + test.test_expand_tag_attributes() + + # set it back after testing + sublime = sublime_module + + # def get_completions(self, view, prefix, locations, is_inside_tag): + def test_simple_completion(self): + # td.class + view = Unittest.View() + completor = HtmlTagCompletions() + + # simulate typing 'tab' at the start of the line, it is outside a tag + completion_list, flags = completor.get_completions(view, 'tab', [0], False) + + # should give a bunch of tags that starts with t + self.assertEqual(completion_list[0], ('table\tTag', '$0
')) + self.assertEqual(completion_list[1], ('tbody\tTag', '$0')) + # don't suppress word based completion + self.assertEqual(flags, 0) + + def test_inside_tag_completion(self): + # td.class + view = Unittest.View() + completor = HtmlTagCompletions() + + # simulate typing 'h' after <, i.e. $0')) + self.assertEqual(completion_list[1], ('header\tTag', 'header>$0')) + self.assertEqual(completion_list[2], ('h1\tTag', 'h1>$0')) + # suppress word based completion + self.assertEqual(flags, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS) + + # simulate typing 'he' after <, i.e. $0')) + self.assertEqual(completion_list[1], ('header\tTag', 'header>$0')) + self.assertEqual(completion_list[2], ('h1\tTag', 'h1>$0')) + # suppress word based completion + self.assertEqual(flags, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS) + + def test_inside_tag_no_completion(self): + # td.class + view = Unittest.View() + completor = HtmlTagCompletions() + + # simulate typing 'h' after td.class + view = Unittest.View() + completor = HtmlTagCompletions() + + # simulate typing tab after td.class + completion_list, flags = completor.get_completions(view, '', [26], False) + + # should give just one completion, and suppress word based completion + self.assertEqual(completion_list, [('td.class', '$1$0')]) + self.assertEqual(flags, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS) diff --git a/assets/syntaxes/Packages/HTML/syntax_test_html.html b/assets/syntaxes/Packages/HTML/syntax_test_html.html new file mode 100644 index 000000000..a69ea9702 --- /dev/null +++ b/assets/syntaxes/Packages/HTML/syntax_test_html.html @@ -0,0 +1,639 @@ +## SYNTAX TEST "Packages/HTML/HTML.sublime-syntax" + +## <- meta.tag.preprocessor punctuation.definition.tag.begin +##^^^entity.name.tag.xml +## ^ punctuation.definition.tag.end + +## <- meta.tag.sgml.doctype punctuation.definition.tag.begin +##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +##^^^^^^^ keyword.declaration.doctype +## ^^^^ constant.language.doctype +## ^^^^^^ keyword.content.external +## ^^^^^^^^^^^ string.quoted.double +## ^ meta.brackets meta.internal-subset punctuation.section.brackets.begin +## ^^^^^^^^^^^^^^^^ comment.block +## ^^^^ punctuation.definition.comment.begin +## ^^^ punctuation.definition.comment.end + ; +## ^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype meta.brackets meta.internal-subset +]> +## <- meta.tag.sgml.doctype meta.brackets meta.internal-subset punctuation.section.brackets.end + + + Test HTML + + + ## <- comment.block.html punctuation.definition.comment.end.html + ## ^^^^^^ entity.name.tag.script.html + ## ^^^^^^^^^ meta.tag.script.end.html - source.js.embedded.html + ## ^ - meta.tag + + + ## <- comment.block.html punctuation.definition.comment.end.html + ## ^^^^^^ entity.name.tag.script.html + ## ^^^^^^^^^ meta.tag.script.end.html - source.js.embedded.html + ## ^ - meta.tag + + + + + ## ^^^^^^^^^ text.html.basic text.html.embedded.html meta.tag.script.end + +## ^ text.html.basic text.html.embedded.html +## ^^^^^^^^^ text.html.basic - text.html.embedded.html meta.tag.script.end +## ^ text.html.basic - text.html.embedded.html + + +## ^^^^^^^^ meta.tag.script.begin +## ^^ source.js.embedded +## ^^^^^^^^^^ meta.tag.script.end + + + + + ##^^^^^ entity.name.tag.style.html + ##<- meta.tag.style.end.html - source.css.embedded.html + ##^^^^^^ meta.tag.style.end.html - source.css.embedded.html + ## ^ - meta.tag + + + + + + +| ^^^^^ meta.disable-markdown meta.tag.style.end.html entity.name.tag.style.html +okay +| <- - meta.disable-markdown + +http://spec.commonmark.org/0.28/#example-143 + + +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown +*foo* +| <- - meta.disable-markdown + +http://spec.commonmark.org/0.28/#example-144 + +*bar* +| ^^^^^^^^^^ comment.block.html +| ^^^^^ meta.disable-markdown +*baz* +| <- - meta.disable-markdown + +http://spec.commonmark.org/0.28/#example-145 + +1. *bar* +| ^^^^^^^^^^^^^^^^ meta.disable-markdown +okay +| <- - meta.disable-markdown + +http://spec.commonmark.org/0.28/#example-146 + + +| ^^^^^^^^ meta.disable-markdown comment.block.html +okay +| <- - meta.disable-markdown + +http://spec.commonmark.org/0.28/#example-147 + +'; + +?> +|^^ meta.disable-markdown +okay +| <- - meta.disable-markdown + +http://spec.commonmark.org/0.28/#example-148 + + +| ^^^^^^^ meta.disable-markdown meta.tag.sgml.doctype.html keyword.declaration.doctype.html +okay +| <- - meta.disable-markdown + +http://spec.commonmark.org/0.28/#example-149 + + +|^ meta.disable-markdown meta.tag.sgml.cdata.html +okay +| <- - meta.disable-markdown + +1. Test + + ```python +| ^^^ markup.list.numbered meta.code-fence punctuation.definition.raw.code-fence.begin + Test + +| <- - invalid + Test + ``` +| ^^^ punctuation.definition.raw.code-fence.end + +1. Test 2 +|^ markup.list.numbered.bullet punctuation.definition.list_item + +```xml +|^^^^^ meta.code-fence.definition.begin.xml +| ^^^ constant.other.language-name + +|^^^^^^^^^^^^^^^^^^^^^^ markup.raw.code-fence.xml +| ^^^^^^^ meta.tag.preprocessor.xml entity.other.attribute-name.localname.xml + + + +``` +|^^ punctuation.definition.raw.code-fence.end + +```sql +|^^^^^ meta.code-fence.definition.begin.sql +| ^^^ constant.other.language-name +SELECT TOP 10 * +|^^^^^^^^^^^^^^^ markup.raw.code-fence.sql +|^^^^^^^^^ keyword.other.DML.sql +FROM TableName +``` +|^^ meta.code-fence.definition.end.sql punctuation.definition.raw.code-fence.end - markup + +```python +|^^ punctuation.definition.raw.code-fence.begin +|^^^^^^^^^ meta.code-fence.definition.begin.python - markup +| ^^^^^^ constant.other.language-name +def function(): + pass +| ^^^^ keyword.control.flow.pass.python +unclosed_paren = ( +| ^ meta.group.python punctuation.section.group.begin.python +``` +|^^ meta.code-fence.definition.end.python punctuation.definition.raw.code-fence.end + +```Graphviz +graph n {} +| ^^^ storage.type.dot +``` + +| <- - markup.raw + +```php +var_dump(expression); +| ^^^^^^ support.function.var.php +``` + +```html+php +
+|^^^ entity.name.tag.block.any.html += => <=> // && == != +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta - constant - keyword - variable - punctuation + + -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.raw - constant - keyword - variable - punctuation + +> -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level - constant - keyword - variable + +> > -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown punctuation.definition.blockquote.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level - constant - keyword - variable diff --git a/assets/syntaxes/Packages/Markdown/syntax_test_multimarkdown.md b/assets/syntaxes/Packages/Markdown/syntax_test_multimarkdown.md new file mode 100644 index 000000000..2c3c094df --- /dev/null +++ b/assets/syntaxes/Packages/Markdown/syntax_test_multimarkdown.md @@ -0,0 +1,35 @@ +T: SYNTAX TEST "Packages/Markdown/MultiMarkdown.sublime-syntax" +Title: A Sample MultiMarkdown Document +T: ^^ meta.header.multimarkdown keyword.other.multimarkdown +T: ^ meta.header.multimarkdown punctuation.separator.key-value.multimarkdown +T: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.multimarkdown string.unquoted.multimarkdown +T: ^ meta.header.multimarkdown - string +Author: Fletcher T. Penney +T:^^^^ meta.header.multimarkdown keyword.other.multimarkdown +T: ^ meta.header.multimarkdown punctuation.separator.key-value.multimarkdown +T: ^^^^^^^^^^^^^^^^^^ meta.header.multimarkdown string.unquoted.multimarkdown +Date: February 9, 2011 +Comment: This is a comment intended to demonstrate + metadata that spans multiple lines, yet + is treated as a single value. +T: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.multimarkdown string.unquoted.multimarkdown +T: ^ meta.header.multimarkdown - string +Test: And this is a new key-value pair +With-Dash: Test +T: ^^^^^^ meta.header.multimarkdown keyword.other.multimarkdown +T: ^ meta.header.multimarkdown punctuation.separator.key-value.multimarkdown +T: ^^^^ meta.header.multimarkdown string.unquoted.multimarkdown +With Space: Test +T: ^^^^^^^ meta.header.multimarkdown keyword.other.multimarkdown +T: ^ meta.header.multimarkdown punctuation.separator.key-value.multimarkdown +T: ^^^^ meta.header.multimarkdown string.unquoted.multimarkdown +HTML Header: +T: ^^^^^^^^ meta.header.multimarkdown string.unquoted.multimarkdown + +T: <- meta.content.multimarkdown - meta.header.multimarkdown +# Heading +| <- markup.heading punctuation.definition.heading +|^^^^^^^^ markup.heading diff --git a/assets/syntaxes/Packages/Matlab/Indent.tmPreferences b/assets/syntaxes/Packages/Matlab/Indent.tmPreferences new file mode 100644 index 000000000..e67c72e08 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Indent.tmPreferences @@ -0,0 +1,68 @@ + + + + name + Miscellaneous Matlab + scope + source.matlab + settings + + decreaseIndentPattern + ^\s*\b(end\w*|catch|else|elseif|case|otherwise)\b + highlightPairs + + + ( + ) + + + [ + ] + + + { + } + + + " + " + + + increaseIndentPattern + (?x)^\s* + \b( + classdef|properties|events|methods|enumeration + |function + |if|else|elseif + |switch|case|otherwise + |for|while + |try|catch + |unwind_protect + )\b + + smartTypingPairs + + + ( + ) + + + [ + ] + + + { + } + + + " + " + + + ' + ' + + + + + diff --git a/assets/syntaxes/Packages/Matlab/Matlab.sublime-syntax b/assets/syntaxes/Packages/Matlab/Matlab.sublime-syntax new file mode 100644 index 000000000..870748032 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Matlab.sublime-syntax @@ -0,0 +1,503 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: MATLAB +file_extensions: + - matlab +scope: source.matlab +variables: + id: '[A-Za-z_]\w*' +contexts: + main: + - include: function + - include: constants_override + - include: brackets + - include: curlybrackets + - include: parens + - include: transpose + - include: string + - include: members + - include: all_matlab_keywords + - include: all_matlab_comments + - include: number + - include: operators + - include: variable + - include: variable_invalid + - include: not_equal_invalid + - include: variable_assignment + members: + - match: ({{id}})(\.)({{id}}) + captures: + 2: punctuation.accessor.dot.matlab + push: transpose_post_parens + all_matlab_comments: + - match: (%%).*$\n? + scope: comment.double.percentage.matlab + captures: + 1: punctuation.definition.comment.matlab + - match: '^\s*(%\{)\s*\n' + captures: + 1: punctuation.definition.comment.matlab + push: + - meta_scope: comment.block.percentage.matlab + - match: '^\s*(%\})\s*$\n?' + captures: + 1: punctuation.definition.comment.matlab + pop: true + - match: (%).*$\n? + scope: comment.line.percentage.matlab + captures: + 1: punctuation.definition.comment.matlab + all_matlab_keywords: + - include: matlab_keyword_control + - include: matlab_keyword_operator + - include: matlab_keyword_other + - include: matlab_oop + - include: matlab_storage_type + - include: matlab_storage_modifier + - include: matlab_constant_language + - include: matlab_variable_function + - include: matlab_keyword_desktop + - include: matlab_keyword_mathematics + - include: matlab_keyword_analysis + - include: matlab_storage_control + - include: matlab_support_graphics + - include: matlab_support_function + - include: matlab_support_external + - include: matlab_support_toolbox_aerospace + - include: matlab_support_toolbox_bioinformatics + - include: matlab_support_toolbox_communications + - include: matlab_support_toolbox_control_systems + - include: matlab_support_toolbox_curve_fitting + - include: matlab_support_toolbox_data_acquisition + - include: matlab_support_toolbox_database + - include: matlab_support_toolbox_datafeed + - include: matlab_support_toolbox_design + - include: matlab_support_toolbox_excel_link + - include: matlab_support_toolbox_filter_design_hdl_coder + - include: matlab_support_toolbox_financial_derivatives + - include: matlab_support_toolbox_financial + - include: matlab_support_toolbox_fixed_income + - include: matlab_support_toolbox_fixed_point + - include: matlab_support_toolbox_fuzzy_logic + - include: matlab_support_toolbox_garch + - include: matlab_support_toolbox_genetic_algorithms + - include: matlab_support_toolbox_image_acquisition + - include: matlab_support_toolbox_image_processing + - include: matlab_support_toolbox_instrument_control + - include: matlab_support_toolbox_mapping + - include: matlab_support_toolbox_model_predictive_control + - include: matlab_support_toolbox_model_based_calibration + - include: matlab_support_toolbox_neural_network + - include: matlab_support_toolbox_opc + - include: matlab_support_toolbox_optimization + - include: matlab_support_toolbox_rf + - include: matlab_support_toolbox_robust_control + - include: matlab_support_toolbox_signal_processing + - include: matlab_support_toolbox_spline + - include: matlab_support_toolbox_statistics + - include: matlab_support_toolbox_symbolic_math + - include: matlab_support_toolbox_system_identification + - include: matlab_support_toolbox_virtual_reality + - include: matlab_support_toolbox_wavelet + allofem: + - include: parens + - include: curlybrackets + - include: end_in_parens + - include: brackets + - include: transpose + - include: string + - include: all_matlab_keywords + - include: all_matlab_comments + - include: variable + - include: number + - include: variable_invalid + - include: operators + - match: \.\.\. + scope: punctuation.separator.continuation.matlab + brackets: + - match: '\[' + scope: punctuation.section.brackets.begin.matlab + push: + - meta_scope: meta.brackets.matlab + - match: '\]' + scope: punctuation.section.brackets.end.matlab + set: transpose_post_parens + - include: allofem + constants_override: + - match: '(^|\;)\s*(ans|i|j|inf|Inf|nan|NaN|eps|end)\s*=[^=]' + comment: The user is trying to override MATLAB constants and functions. + scope: meta.inappropriate.matlab + curlybrackets: + - match: '\{' + scope: meta.brackets.curly.matlab + push: + - meta_content_scope: meta.brackets.curly.matlab + - match: '\}' + scope: meta.brackets.curly.matlab + set: transpose_post_parens + - include: allofem + - include: end_in_parens + end_in_parens: + - match: \bend\b + comment: end as operator symbol + scope: keyword.operator.symbols.matlab + escaped_quote: + - match: "''" + scope: constant.character.escape.matlab + + # Function + function: + - match: '^\s*(function)\b' + captures: + 1 : keyword.other.matlab + push: + - match: \b(\w+)\s+(=) + captures: + 1: variable.parameter.output.function.matlab + 2: keyword.operator.assignment.matlab + - match: '\[' + scope: punctuation.section.brackets.matlab + push: + - match: \b\w+\b + scope: variable.parameter.output.function.matlab + - match: ',' + scope: punctuation.separator.matlab + - match: '\]' + scope: punctuation.section.brackets.matlab + pop: true + - match: '(=)?\s*\b(\w+)\s*(\()' + captures: + 1: keyword.operator.assignment.matlab + 2: entity.name.function.matlab + 3: punctuation.section.parens.begin.matlab + set: + - meta_scope: meta.function.parameters.matlab + - match: \b\w+\b + scope: variable.parameter.input.function.matlab + - match: ',' + scope: punctuation.separator.matlab + - match: '\)' + scope: punctuation.section.parens.end.matlab + pop: true + - match: \b(\w+)\s*(?=%|$) + captures: + 1: entity.name.function.matlab + pop: true + # Matlab keywords + matlab_constant_language: + - match: \b(ans|eps|false|Inf|inf|intmax|intmin|namelengthmax|NaN|nan|on|off|realmax|realmin|true|i|j|pi)\b + comment: MATLAB constants + scope: constant.language.matlab + matlab_keyword_analysis: + - match: \b(abs|addevent|addsample|addsampletocollection|addts|angle|conv|conv2|convn|corrcoef|cov|cplxpair|ctranspose|cumtrapz|deconv|del2|delevent|delsample|delsamplefromcollection|detrend|diff|fft|fft2|fftn|fftshift|fftw|filter|filter2|getabstime|getdatasamplesize|getinterpmethod|getqualitydesc|getsampleusingtime|gettimeseriesnames|gettsafteratevent|gettsafterevent|gettsatevent|gettsbeforeatevent|gettsbeforeevent|gettsbetweenevents|gradient|idealfilter|ifft|ifft2|ifftn|ifftshift|iqr|max|mean|median|min|mldivide|mode|mrdivide|removets|resample|setabstime|setinterpmethod|settimeseriesnames|std|synchronize|timeseries|trapz|tscollection|tsdata.event|tsprops|tstool|var)\b + comment: Data Analysis + scope: keyword.analysis.matlab + matlab_keyword_control: + - match: \b(break|case|catch|continue|else|elseif|end|for|parfor|if|otherwise|pause|rethrow|return|start|startat|stop|switch|try|wait|while)\b + comment: Control keywords + scope: keyword.control.matlab + matlab_keyword_desktop: + - match: \b(addpath|assignin|builddocsearchdb|cd|checkin|checkout|clc|clear|clipboard|cmopts|commandhistory|commandwindow|computer|copyfile|customverctrl|dbclear|dbcont|dbdown|dbquit|dbstack|dbstatus|dbstep|dbstop|dbtype|dbup|debug|demo|diary|dir|doc|docopt|docsearch|dos|echodemo|edit|exit|fileattrib|filebrowser|finish|format|genpath|getenv|grabcode|help|helpbrowser|helpwin|home|hostid|info|keyboard|license|lookfor|ls|matlab|matlabrc|matlabroot|memory|mkdir|mlint|mlintrpt|more|movefile|notebook|openvar|pack|partialpath|path|path2rc|pathdef|pathsep|pathtool|perl|playshow|prefdir|preferences|profile|profsave|publish|pwd|quit|recycle|rehash|restoredefaultpath|rmdir|rmpath|savepath|setenv|startup|support|system|toolboxdir|type|undocheckout|unix|ver|verctrl|verLessThan|version|web|what|whatsnew|which|winqueryreg|workspace)\b|(^\s*!.*$) + comment: Desktop Tools and Development + scope: keyword.desktop.matlab + matlab_keyword_mathematics: + - match: \b(accumarray|acos|acosd|acosh|acot|acotd|acoth|acsc|acscd|acsch|airy|amd|asec|asecd|asech|asin|asind|asinh|atan|atan2|atand|atanh|balance|besselh|besseli|besselj|besselk|bessely|beta|betainc|betaln|bicg|bicgstab|blkdiag|bsxfun|bvp4c|bvpget|bvpinit|bvpset|bvpxtend|cart2pol|cart2sph|cat|cdf2rdf|ceil|cgs|chol|cholinc|cholupdate|circshift|colamd|colperm|compan|complex|cond|condeig|condest|conj|convhull|convhulln|cos|cosd|cosh|cot|cotd|coth|cross|csc|cscd|csch|cumprod|cumsum|dblquad|dde23|ddeget|ddesd|ddeset|decic|det|deval|diag|disp|display|dmperm|dot|eig|eigs|ellipj|ellipke|erf|erfc|erfcinv|erfcx|erfinv|etree|etreeplot|exp|expint|expm|expm1|eye|factor|factorial|find|fix|flipdim|fliplr|flipud|floor|fminbnd|fminsearch|freqspace|full|funm|fzero|gallery|gamma|gammainc|gammaln|gcd|gmres|gplot|griddata|griddata3|griddatan|gsvd|hadamard|hankel|hess|hilb|horzcat|hypot|idivide|ilu|imag|ind2sub|Inf|inline|interp1|interp1q|interp2|interp3|interpft|interpn|inv|invhilb|ipermute|kron|lcm|ldl|legendre|length|linsolve|linspace|log|log10|log1p|log2|logm|logspace|lscov|lsqnonneg|lsqr|lu|luinc|magic|meshgrid|minres|mkpp|mod|NaN|nchoosek|ndgrid|ndims|nextpow2|nnz|nonzeros|norm|normest|nthroot|null|numel|nzmax|ode113|ode15i|ode15s|ode23|ode23s|ode23t|ode23tb|ode45|odefile|odeget|odeset|odextend|ones|optimget|optimset|ordeig|ordqz|ordschur|orth|pascal|pcg|pchip|pdepe|pdeval|perms|permute|pinv|planerot|pol2cart|poly|polyder|polyeig|polyfit|polyint|polyval|polyvalm|pow2|ppval|primes|prod|psi|qmr|qr|qrdelete|qrinsert|qrupdate|quad|quadl|quadv|qz|rand|randn|randperm|rank|rat|rats|rcond|real|reallog|realpow|realsqrt|rem|repmat|reshape|residue|roots|rosser|rot90|round|rref|rsf2csf|schur|sec|secd|sech|shiftdim|sign|sin|sind|sinh|size|sort|sortrows|spalloc|sparse|spaugment|spconvert|spdiags|speye|spfun|sph2cart|spline|spones|spparms|sprand|sprandn|sprandsym|sprank|spy|sqrt|sqrtm|squeeze|ss2tf|sub2ind|subspace|sum|svd|svds|symamd|symbfact|symmlq|symrcm|tan|tand|tanh|toeplitz|trace|treelayout|treeplot|tril|triplequad|triu|unmkpp|unwrap|vander|vectorize|vertcat|wilkinson|zeros)\b + comment: Mathematics + scope: keyword.mathematics.matlab + matlab_keyword_operator: + - match: \b(all|and|any|bitand|bitcmp|bitget|bitmax|bitor|bitset|bitshift|bitxor|eq|ge|gt|isa|isappdata|iscell|iscellstr|ischar|iscom|isdir|isempty|isequal|isequalwithequalnans|isevent|isfield|isfinite|isfloat|isglobal|ishandle|ishold|isinf|isinteger|isinterface|isjava|iskeyword|isletter|islogical|ismac|ismember|ismethod|isnan|isnumeric|isobject|ispc|ispref|isprime|isprop|isreal|isscalar|issorted|isspace|issparse|isstrprop|isstruct|isstudent|isunix|isvarname|isvector|le|lt|mislocked|or|ne|not|setxor|union|unique|xor)\b + comment: Operator keywords + scope: keyword.operator.matlab + matlab_keyword_other: + - match: \b(addOptional|addParamValue|addRequired|addtodate|arrayfun|assert|blanks|builtin|calendar|cell|celldisp|cellfun|cellplot|clock|cputime|createCopy|datatipinfo|date|datenum|datestr|datevec|dbmex|deal|deblank|depdir|depfun|echo|eomday|error|etime|eval|evalc|evalin|exist|feval|fieldnames|findstr|func2str|genvarname|getfield|global|inferiorto|inmem|intersect|intwarning|lasterr|lasterror|lastwarn|loadobj|lower|methods|methodsview|mex|mexext|mfilename|mlock|munlock|nargchk|nargoutchk|now|orderfields|parse|pcode|regexp|regexpi|regexprep|regexptranslate|rmfield|run|saveobj|setdiff|setfield|sprintf|sscanf|strcat|strcmp|strcmpi|strfind|strings|strjust|strmatch|strncmp|strncmpi|strread|strrep|strtok|strtrim|structfun|strvcat|subsasgn|subsindex|subsref|substruct|superiorto|swapbytes|symvar|tic|timer|timerfind|timerfindall|toc|typecast|upper|warning|weekday|who|whos)\b + comment: Other keywords + scope: keyword.other.matlab + matlab_storage_control: + - match: \b(addframe|ascii|audioplayer|audiorecorder|aufinfo|auread|auwrite|avifile|aviinfo|aviread|beep|binary|cdfepoch|cdfinfo|cdfread|cdfwrite|csvread|csvwrite|daqread|dlmread|dlmwrite|exifread|feof|ferror|fgetl|fgets|filehandle|filemarker|fileparts|filesep|fitsinfo|fitsread|fopen|fprintf|fread|frewind|fscanf|fseek|ftell|ftp|fullfile|fwrite|gunzip|gzip|hdf|hdf5|hdf5info|hdf5read|hdf5write|hdfinfo|hdfread|hdftool|imfinfo|importdata|imread|imwrite|lin2mu|load|memmapfile|mget|mmfileinfo|movie2avi|mput|mu2lin|multibandread|multibandwrite|open|rename|save|sendmail|sound|soundsc|tar|tempdir|tempname|textread|textscan|todatenum|uiimport|untar|unzip|urlread|urlwrite|wavfinfo|wavplay|wavread|wavrecord|wavwrite|winopen|wk1finfo|wk1read|wk1write|xlsfinfo|xlsread|xlswrite|xmlread|xmlwrite|xslt|zip)\b + comment: File I/O + scope: storage.control.matlab + matlab_storage_modifier: + - match: \b(base2dec|bin2dec|cast|cell2mat|cell2struct|cellstr|char|dec2base|dec2bin|dec2hex|hex2dec|hex2num|int2str|mat2cell|mat2str|num2cell|native2unicode|num2hex|num2str|persistent|str2double|str2func|str2mat|str2num|struct2cell|unicode2native)\b + comment: Storage modifiers + scope: storage.modifier.matlab + matlab_storage_type: + - match: \b(class|double|function|functions|input|inputname|inputParser|int16|int32|int64|int8|logical|single|struct|uint16|uint32|uint64|uint8)\b + comment: Storage types + scope: storage.type.matlab + matlab_support_external: + - match: \b(actxcontrol|actxcontrollist|actxcontrolselect|actxGetRunningServer|actxserver|addproperty|calllib|callSoapService|createClassFromWsdl|createSoapMessage|ddeadv|ddeexec|ddeinit|ddepoke|ddereq|ddeterm|ddeunadv|deleteproperty|enableservice|eventlisteners|events|Execute|GetCharArray|GetFullMatrix|GetVariable|GetWorkspaceData|import|instrcallback|instrfind|instrfindall|interfaces|invoke|javaaddpath|javaArray|javachk|javaclasspath|javaMethod|javaObject|javarmpath|libfunctions|libfunctionsview|libisloaded|libpointer|libstruct|loadlibrary|MaximizeCommandWindow|MinimizeCommandWindow|move|parseSoapResponse|PutCharArray|PutFullMatrix|PutWorkspaceData|readasync|record|registerevent|release|send|serial|serialbreak|stopasync|unloadlibrary|unregisterallevents|unregisterevent|usejava)\b + comment: External Interfaces + scope: support.external.matlab + matlab_support_function: + - match: \b(addpref|align|dialog|errordlg|export2wsdlg|getappdata|getpixelposition|getpref|ginput|guidata|guide|guihandles|helpdlg|inputdlg|inspect|listdlg|listfonts|menu|movegui|msgbox|openfig|printdlg|printpreview|questdlg|rmappdata|rmpref|selectmoveresize|setappdata|setpixelposition|setpref|textwrap|uibuttongroup|uicontextmenu|uicontrol|uigetdir|uigetfile|uigetpref|uimenu|uiopen|uipanel|uipushtool|uiputfile|uiresume|uisave|uisetcolor|uisetfont|uisetpref|uistack|uitoggletool|uitoolbar|uiwait|waitbar|waitfor|waitforbuttonpress|warndlg)\b + comment: Creating Graphical User Interfaces + scope: support.function.matlab + matlab_support_graphics: + - match: \b(alim|allchild|alpha|alphamap|ancestor|annotation|area|axes|axis|bar|bar3|bar3h|barh|box|brighten|camdolly|cameratoolbar|camlight|camlookat|camorbit|campan|campos|camproj|camroll|camtarget|camup|camva|camzoom|caxis|cla|clabel|clf|close|closereq|colorbar|colordef|colormap|colormapeditor|ColorSpec|comet|comet3|compass|coneplot|contour|contour3|contourc|contourf|contourslice|contrast|copyobj|curl|cylinder|daspect|datacursormode|datetick|delaunay|delaunay3|delaunayn|delete|diffuse|divergence|dragrect|drawnow|dsearch|dsearchn|ellipsoid|errorbar|ezcontour|ezcontourf|ezmesh|ezmeshc|ezplot|ezplot3|ezpolar|ezsurf|ezsurfc|feather|figure|figurepalette|fill|fill3|findall|findfigs|findobj|flow|fplot|frame2im|frameedit|gca|gcbf|gcbo|gcf|gco|get|getframe|graymon|grid|gtext|hgexport|hggroup|hgload|hgsave|hgtransform|hidden|hist|histc|hold|hsv2rgb|im2frame|im2java|image|imagesc|imformats|ind2rgb|inpolygon|interpstreamspeed|isocaps|isocolors|isonormals|isosurface|legend|light|lightangle|lighting|line|LineSpec|linkaxes|linkprop|loglog|makehgtform|material|mesh|meshc|meshz|movie|newplot|noanimate|opengl|orient|pan|pareto|patch|pbaspect|pcolor|peaks|pie|pie3|plot|plot3|plotbrowser|plotedit|plotmatrix|plottools|plotyy|polar|polyarea|print|printopt|propedit|propertyeditor|quiver|quiver3|rbbox|rectangle|rectint|reducepatch|reducevolume|refresh|refreshdata|reset|rgb2hsv|rgbplot|ribbon|rose|rotate|rotate3d|saveas|scatter|scatter3|semilogx|semilogy|set|shading|showplottool|shrinkfaces|slice|smooth3|specular|sphere|spinmap|stairs|stem|stem3|stream2|stream3|streamline|streamparticles|streamribbon|streamslice|streamtube|subplot|subvolume|surf|surf2patch|surface|surfc|surfl|surfnorm|tetramesh|texlabel|text|title|trimesh|triplot|trisurf|tsearch|tsearchn|view|viewmtx|volumebounds|voronoi|voronoin|waterfall|whitebg|xlabel|xlim|ylabel|ylim|zlabel|zlim|zoom)\b + comment: Graphics + scope: support.function.graphics.matlab + matlab_support_toolbox_aerospace: + - match: \b(wrldmagm|updateNodes|updateCamera|updateBodies|update|show|saveas|rrtheta|rrsigma|rrdelta|removeViewpoint|removeNode|removeBody|read|quatrotate|quatnormalize|quatnorm|quatmultiply|quatmod|quatinv|quatdivide|quatconj|quat2dcm|quat2angle|play|nodeInfo|moveBody|move|mjuliandate|machnumber|load|lla2ecef|leapyear|juliandate|initialize|initIfNeeded|hide|gravitywgs84|geoidegm96|geod2geoc|geocradius|geoc2geod|generatePatches|findstartstoptimes|fganimation|ecef2lla|dpressure|delete|decyear|dcmecef2ned|dcmbody2wind|dcm2quat|dcm2latlon|dcm2angle|dcm2alphabeta|datcomimport|createBody|correctairspeed|convvel|convtemp|convpres|convmass|convlength|convforce|convdensity|convangvel|convangacc|convang|convacc|atmospalt|atmosnrlmsise00|atmosnonstd|atmoslapse|atmosisa|atmoscoesa|atmoscira|angle2quat|angle2dcm|alphabeta|airspeed|addViewpoint|addRoute|addNode|addBody|VirtualRealityAnimation|Viewpoint|Node|Geometry|GenerateRunScript|Camera|Body|Animation)\b + comment: Matlab aerospace toolbox + scope: support.function.toolbox.aerospace.matlab + matlab_support_toolbox_bioinformatics: + - match: \b(zonebackadj|weights|view|traverse|traceplot|topoorder|swalign|svmtrain|svmsmoset|svmclassify|subtree|sptread|showhmmprof|showalignment|shortestpath|seqwordcount|seqtool|seqshowwords|seqshoworfs|seqreverse|seqrcomplement|seqprofile|seqpdist|seqneighjoin|seqmatch|seqlogo|seqlinkage|seqinsertgaps|seqdotplot|seqdisp|seqconsensus|seqcomplement|seq2regexp|select|scfread|samplealign|rnaplot|rnafold|rnaconvert|rna2dna|rmasummary|rmabackadj|revgeneticcode|restrict|reroot|reorder|redgreencmap|rebasecuts|rankfeatures|randseq|randfeatures|ramachandran|quantilenorm|prune|proteinpropplot|proteinplot|profalign|probesetvalues|probesetplot|probesetlookup|probesetlink|probelibraryinfo|plot|phytreewrite|phytreetool|phytreeread|phytree|pfamhmmread|pdist|pdbwrite|pdbread|pdbdistplot|pam|palindromes|optimalleaforder|oligoprop|nwalign|num2goid|nuc44|ntdensity|nt2int|nt2aa|nmercount|mzxmlread|mzxml2peaks|multialignviewer|multialignread|multialign|msviewer|mssgolay|msresample|msppresample|mspeaks|mspalign|msnorm|mslowess|msheatmap|msdotplot|msbackadj|msalign|molweight|molviewer|minspantree|maxflow|mavolcanoplot|mattest|mapcaplot|manorm|malowess|maloglog|mairplot|mainvarsetnorm|maimage|magetfield|mafdr|maboxplot|knnimpute|knnclassify|joinseq|jcampread|isspantree|isomorphism|isoelectric|isdag|int2nt|int2aa|imageneread|hmmprofstruct|hmmprofmerge|hmmprofgenerate|hmmprofestimate|hmmprofalign|graphtraverse|graphtopoorder|graphshortestpath|graphpred2path|graphminspantree|graphmaxflow|graphisspantree|graphisomorphism|graphisdag|graphconncomp|graphcluster|graphallshortestpaths|gprread|gonnet|goannotread|getrelatives|getpdb|getnodesbyid|getnewickstr|getmatrix|gethmmtree|gethmmprof|gethmmalignment|getgeodata|getgenpept|getgenbank|getembl|getedgesbynodeid|getdescendants|getcanonical|getbyname|getblast|getancestors|get|geosoftread|genpeptread|genevarfilter|geneticcode|generangefilter|geneont|genelowvalfilter|geneentropyfilter|genbankread|gcrmabackadj|gcrma|galread|featuresparse|featuresmap|fastawrite|fastaread|exprprofvar|exprprofrange|evalrasmolscript|emblread|dolayout|dndsml|dnds|dna2rna|dimercount|dayhoff|cytobandread|crossvalind|cpgisland|conncomp|codoncount|codonbias|clustergram|cleave|classperf|chromosomeplot|cghcbs|celintensityread|blosum|blastreadlocal|blastread|blastncbi|blastlocal|blastformat|biograph|baselookup|basecount|atomiccomp|aminolookup|allshortestpaths|agferead|affyread|affyprobeseqread|affyprobeaffinities|affyinvarsetnorm|aacount|aa2nt|aa2int)\b + comment: Matlab bioinformatics toolbox + scope: support.function.toolbox.bioinformatics.matlab + matlab_support_toolbox_communications: + - match: \b(wgn|vitdec|vec2mat|varlms|syndtable|symerr|stdchan|ssbmod|ssbdemod|signlms|shift2mask|seqgen\.pn|seqgen|semianalytic|scatterplot|rsgenpoly|rsencof|rsenc|rsdecof|rsdec|rls|ricianchan|reset|rectpulse|rcosine|rcosiir|rcosflt|rcosfir|rayleighchan|randsrc|randintrlv|randint|randerr|randdeintrlv|quantiz|qfuncinv|qfunc|qammod|qamdemod|pskmod|pskdemod|primpoly|poly2trellis|pmmod|pmdemod|plot|pammod|pamdemod|oqpskmod|oqpskdemod|oct2dec|normlms|noisebw|muxintrlv|muxdeintrlv|mskmod|mskdemod|modnorm|modem\.qammod|modem\.qamdemod|modem\.pskmod|modem\.pskdemod|modem\.pammod|modem\.pamdemod|modem\.oqpskmod|modem\.oqpskdemod|modem\.mskmod|modem\.mskdemod|modem\.genqammod|modem\.genqamdemod|modem\.dpskmod|modem\.dpskdemod|modem|mlseeq|mldivide|minpol|matintrlv|matdeintrlv|mask2shift|marcumq|log|lms|lloyds|lineareq|istrellis|isprimitive|iscatastrophic|intrlv|intdump|ifft|huffmanenco|huffmandict|huffmandeco|hilbiir|helscanintrlv|helscandeintrlv|helintrlv|heldeintrlv|hank2sys|hammgen|gray2bin|gfweight|gftuple|gftrunc|gftable|gfsub|gfroots|gfrepcov|gfrank|gfprimfd|gfprimdf|gfprimck|gfpretty|gfmul|gfminpol|gflineq|gffilter|gfdiv|gfdeconv|gfcosets|gfconv|gfadd|gf|genqammod|genqamdemod|gen2par|fskmod|fskdemod|fmmod|fmdemod|finddelay|filter|fft|fec\.ldpcenc|fec\.ldpcdec|eyediagram|equalize|encode|dvbs2ldpc|dpskmod|dpskdemod|dpcmopt|dpcmenco|dpcmdeco|doppler\.rounded|doppler\.rjakes|doppler\.jakes|doppler\.gaussian|doppler\.flat|doppler\.bigaussian|doppler\.ajakes|doppler|distspec|dftmtx|dfe|deintrlv|decode|de2bi|cyclpoly|cyclgen|cosets|convmtx|convintrlv|convenc|convdeintrlv|compand|commscope\.eyediagram|commscope|cma|bsc|biterr|bin2gray|bi2de|bertool|bersync|berfit|berfading|berconfint|bercoding|berawgn|bchnumerr|bchgenpoly|bchenc|bchdec|awgn|arithenco|arithdeco|ammod|amdemod|alignsignals|algintrlv|algdeintrlv)\b + comment: Matlab communications toolbox + scope: support.function.toolbox.communications.matlab + matlab_support_toolbox_control_systems: + - match: \b(zpkdata|zpk|zgrid|zero|totaldelay|tfdata|tf|stepplot|stepinfo|step|stack|stabsep|ssdata|ssbal|ss2ss|ss|sminreal|size|sisotool|sisoinit|sigmaplot|sigma|sgrid|setoptions|setdelaymodel|set|series|rss|rlocusplot|rlocus|reshape|reg|real|pzplot|pzmap|pole|place|parallel|pade|ord2|obsvf|obsv|nyquistplot|nyquist|norm|nicholsplot|nichols|ngrid|ndims|modsep|modred|minreal|margin|lyapchol|lyap|ltiview|ltiprops|ltimodels|lsimplot|lsiminfo|lsim|lqry|lqrd|lqr|lqgreg|lqg|lft|kalmd|kalman|issiso|isproper|isempty|isdt|isct|iopzplot|iopzmap|inv|interp|initialplot|initial|impulseplot|impulse|imag|hsvplot|hsvd|hasdelay|gram|getoptions|getdelaymodel|get|gensig|gdare|gcare|fselect|freqresp|frdata|frd|fnorm|filt|feedback|fcat|evalfr|estim|esort|dssdata|dss|dsort|drss|dlyapchol|dlyap|dlqr|delayss|delay2z|dcgain|dare|damp|d2d|d2c|ctrlpref|ctrbf|ctrb|covar|connect|conj|chgunits|care|canon|c2d|bodeplot|bodemag|bode|bandwidth|balred|balreal|augstate|append|allmargin|acker|abs)\b + comment: Matlab control systems toolbox + scope: support.function.toolbox.control-systems.matlab + matlab_support_toolbox_curve_fitting: + - match: \b(type|smooth|set|probvalues|probnames|predint|plot|numcoeffs|numargs|islinear|integrate|indepnames|get|formula|fittype|fitoptions|fit|feval|excludedata|differentiate|dependnames|datastats|confint|coeffvalues|coeffnames|cftool|cflibhelp|cfit|category|argnames)\b + comment: Matlab curve fitting toolbox + scope: support.function.toolbox.curve-fitting.matlab + matlab_support_toolbox_data_acquisition: + - match: \b(wait|trigger|stop|start|softscope|size|showdaqevents|setverify|set|save|putvalue|putsample|putdata|propinfo|peekdata|obj2mfile|muxchanidx|makenames|load|length|isvalid|issending|isrunning|islogging|isdioline|ischannel|inspect|getvalue|getsample|getdata|get|flushdata|disp|digitalio|delete|dec2binvec|daqreset|daqregister|daqread|daqmem|daqhwinfo|daqhelp|daqfind|daqcallback|clear|binvec2dec|analogoutput|analoginput|addmuxchannel|addline|addchannel)\b + comment: Matlab data acquisition toolbox + scope: support.function.toolbox.data-acquisition.matlab + matlab_support_toolbox_database: + - match: \b(width|versioncolumns|update|unregister|tables|tableprivileges|supports|sql2native|setdbprefs|set|runstoredprocedure|rsmd|rows|rollback|resultset|register|querytimeout|querybuilder|procedures|procedurecolumns|primarykeys|ping|namecolumn|logintimeout|isurl|isreadonly|isnullcolumn|isjdbc|isdriver|isconnection|insert|indexinfo|importedkeys|getdatasources|get|fetchmulti|fetch|fastinsert|exportedkeys|exec|drivermanager|driver|dmd|database\.fetch|database|cursor\.fetch|crossreference|confds|commit|columns|columnprivileges|columnnames|cols|close|clearwarnings|bestrowid|attr)\b + comment: Matlab database toolbox + scope: support.function.toolbox.database.matlab + matlab_support_toolbox_datafeed: + - match: \b(yahoo|tables|stop|stockticker|showtrades|reuters|pricevol|nextinfo|kx|isconnection|insert|info|idc|hyperfeed|havertool|haver|get|fred|fetch|factset|exec|datastream|close|bloomberg)\b + comment: Matlab datafeed toolbox + scope: support.function.toolbox.datafeed.matlab + matlab_support_toolbox_design: + - match: \b(zplane|zpkshiftc|zpkshift|zpkrateup|zpklp2xn|zpklp2xc|zpklp2mbc|zpklp2mb|zpklp2lp|zpklp2hp|zpklp2bsc|zpklp2bs|zpklp2bpc|zpklp2bp|zpkftransf|zpkbpc2bpc|zerophase|window|validstructures|tf2cl|tf2ca|stepz|specifyall|sos|setspecs|set2int|scaleopts|scalecheck|scale|reset|reorder|reffilter|realizemdl|qreport|polyphase|phasez|phasedelay|parallel|order|nstates|normalizefreq|normalize|norm|noisepsdopts|noisepsd|multistage|msesim|msepred|mfilt\.linearinterp|mfilt\.iirwdfinterp|mfilt\.iirwdfdecim|mfilt\.iirinterp|mfilt\.iirdecim|mfilt\.holdinterp|mfilt\.firtdecim|mfilt\.firsrc|mfilt\.firinterp|mfilt\.firfracinterp|mfilt\.firfracdecim|mfilt\.firdecim|mfilt\.fftfirinterp|mfilt\.farrowsrc|mfilt\.cicinterp|mfilt\.cicdecim|mfilt\.cascade|mfilt|measure|maxstep|limitcycle|lagrange|kaiserwin|isstable|issos|isreal|isminphase|ismaxphase|islinphase|isfir|isallpass|int|info|impz|iirshiftc|iirshift|iirrateup|iirpowcomp|iirpeak|iirnotch|iirls|iirlpnormc|iirlpnorm|iirlp2xn|iirlp2xc|iirlp2mbc|iirlp2mb|iirlp2lp|iirlp2hp|iirlp2bsc|iirlp2bs|iirlp2bpc|iirlp2bp|iirlinphase|iirgrpdelay|iirftransf|iircomb|iirbpc2bpc|ifir|help|grpdelay|gain|freqz|freqsamp|freqrespopts|freqrespest|firtype|firpr2chfb|firnyquist|firminphase|firls|firlpnorm|firlp2lp|firlp2hp|firhalfband|firgr|fireqint|firceqrip|fircband|filtstates\.cic|filterbuilder|filter|fftcoeffs|fdesign\.rsrc|fdesign\.peak|fdesign\.parameq|fdesign\.octave|fdesign\.nyquist|fdesign\.notch|fdesign\.lowpass|fdesign\.isinclp|fdesign\.interpolator|fdesign\.hilbert|fdesign\.highpass|fdesign\.halfband|fdesign\.fracdelay|fdesign\.differentiator|fdesign\.decimator|fdesign\.ciccomp|fdesign\.bandstop|fdesign\.bandpass|fdesign\.arbmagnphase|fdesign\.arbmag|fdesign|fdatool|fcfwrite|farrow|euclidfactors|equiripple|ellip|double|disp|dfilt\.wdfallpass|dfilt\.scalar|dfilt\.parallel|dfilt\.latticemamin|dfilt\.latticemamax|dfilt\.latticearma|dfilt\.latticear|dfilt\.latticeallpass|dfilt\.dfsymfir|dfilt\.dffirt|dfilt\.dffir|dfilt\.dfasymfir|dfilt\.df2tsos|dfilt\.df2t|dfilt\.df2sos|dfilt\.df2|dfilt\.df1tsos|dfilt\.df1t|dfilt\.df1sos|dfilt\.df1|dfilt\.cascadewdfallpass|dfilt\.cascadeallpass|dfilt\.cascade|dfilt\.calatticepc|dfilt\.calattice|dfilt\.allpass|dfilt|designopts|designmethods|design|denormalize|cumsec|cost|convert|coewrite|coeread|coeffs|cl2tf|cheby2|cheby1|ca2tf|butter|block|autoscale|allpassshiftc|allpassshift|allpassrateup|allpasslp2xn|allpasslp2xc|allpasslp2mbc|allpasslp2mb|allpasslp2lp|allpasslp2hp|allpasslp2bsc|allpasslp2bs|allpasslp2bpc|allpasslp2bp|allpassbpc2bpc|adaptfilt\.ufdaf|adaptfilt\.tdafdft|adaptfilt\.tdafdct|adaptfilt\.swrls|adaptfilt\.swftf|adaptfilt\.ss|adaptfilt\.se|adaptfilt\.sd|adaptfilt\.rls|adaptfilt\.qrdrls|adaptfilt\.qrdlsl|adaptfilt\.pbufdaf|adaptfilt\.pbfdaf|adaptfilt\.nlms|adaptfilt\.lsl|adaptfilt\.lms|adaptfilt\.hswrls|adaptfilt\.hrls|adaptfilt\.gal|adaptfilt\.ftf|adaptfilt\.filtxlms|adaptfilt\.fdaf|adaptfilt\.dlms|adaptfilt\.blmsfft|adaptfilt\.blms|adaptfilt\.bap|adaptfilt\.apru|adaptfilt\.ap|adaptfilt\.adjlms|adaptfilt)\b + comment: Matlab design toolbox + scope: support.function.toolbox.design.matlab + matlab_support_toolbox_excel_link: + - match: \b(matlabsub|matlabinit|matlabfcn|MLUseFullDesktop|MLUseCellArray|MLStartDir|MLShowMatlabErrors|MLPutVar|MLPutMatrix|MLOpen|MLMissingDataAsNaN|MLGetVar|MLGetMatrix|MLGetFigure|MLEvalString|MLDeleteMatrix|MLClose|MLAutoStart|MLAppendMatrix)\b + comment: Matlab excel link toolbox + scope: support.function.toolbox.excel-link.matlab + matlab_support_toolbox_filter_design_hdl_coder: + - match: \b(generatetbstimulus|generatetb|generatehdl|fdhdltool)\b + comment: Matlab filter design hdl coder toolbox + scope: support.function.toolbox.filter-design-hdl-coder.matlab + matlab_support_toolbox_financial: + - match: \b(zero2pyld|zero2fwd|zero2disc|zbtyield|zbtprice|yldtbill|yldmat|ylddisc|yearfrac|yeardays|year|xirr|x2mdate|wrkdydif|willpctr|willad|weights2holdings|weekday|wclose|volroc|vertcat|uplus|uminus|uicalendar|ugarchsim|ugarchpred|ugarchllf|ugarch|typprice|tsmovavg|tsmom|tsaccel|tr2bonds|toweekly|totalreturnprice|tosemi|toquoted|toquarterly|tomonthly|todecimal|today|todaily|toannual|times|time2date|tick2ret|thirtytwo2dec|thirdwednesday|tbl2bond|taxedrr|targetreturn|subsref|subsasgn|stochosc|std|spctkd|sortfts|smoothts|size|sharpe|setfield|selectreturn|second|rsindex|rmfield|ret2tick|resamplets|rdivide|pyld2zero|pvvar|pvtrend|pvfix|prtbill|prmat|prdisc|prcroc|prbyzero|power|posvolidx|portvrisk|portstats|portsim|portrand|portopt|portcons|portalpha|portalloc|pointfig|plus|plot|periodicreturns|peravg|pcpval|pcglims|pcgcomp|pcalims|payuni|payper|payodd|payadv|opprofit|onbalvol|nweekdate|now|nomrr|negvolidx|mvnrstd|mvnrobj|mvnrmle|mvnrfish|mtimes|mrdivide|movavg|months|month|mirr|minute|minus|min|merge|medprice|mean|maxdrawdown|max|macd|m2xdate|lweekdate|lpm|log2|log10|log|llow|length|leadts|lbusdate|lagts|issorted|isfield|isequal|iscompatible|isbusday|irr|inforatio|hour|horzcat|holidays|holdings2weights|hist|highlow|hhigh|getnameidx|getfield|geom2arith|fwd2zero|fvvar|fvfix|fvdisc|ftsuniq|ftstool|ftsinfo|ftsgui|ftsbound|fts2mat|fts2ascii|frontier|frontcon|freqstr|freqnum|frac2cur|fpctkd|fints|filter|fillts|fieldnames|fetch|fbusdate|extfield|exp|ewstats|eomday|eomdate|end|emaxdrawdown|elpm|effrr|ecmnstd|ecmnobj|ecmnmle|ecmninit|ecmnhess|ecmnfish|ecmmvnrstd|ecmmvnrobj|ecmmvnrmle|ecmmvnrfish|ecmlsrobj|ecmlsrmle|discrate|disc2zero|diff|depstln|depsoyd|deprdv|depgendb|depfixdb|dec2thirtytwo|daysdif|daysadd|daysact|days365|days360psa|days360isda|days360e|days360|day|datewrkdy|datevec|datestr|datenum|datemnth|datefind|datedisp|dateaxis|date2time|cur2str|cur2frac|cumsum|createholidays|cpnpersz|cpndaysp|cpndaysn|cpndatepq|cpndatep|cpndatenq|cpndaten|cpncount|cov2corr|corr2cov|convertto|convert2sur|chfield|chartfts|chaikvolat|chaikosc|cftimes|cfport|cfdur|cfdates|cfconv|cfamounts|candle|busdays|busdate|boxcox|bollinger|bolling|bndyield|bndspread|bndprice|bnddury|bnddurp|bndconvy|bndconvp|blsvega|blstheta|blsrho|blsprice|blslambda|blsimpv|blsgamma|blsdelta|blkprice|blkimpv|binprice|beytbill|barh|bar3h|bar3|bar|ascii2fts|arith2geom|annuterm|annurate|amortize|adosc|adline|active2abs|acrudisc|acrubond|accrfrac|abs2active)\b + comment: Matlab financial toolbox + scope: support.function.toolbox.financial.matlab + matlab_support_toolbox_financial_derivatives: + - match: \b(trintreeshape|trintreepath|treeviewer|treeshape|treepath|time2date|swaptionbyhw|swaptionbyhjm|swaptionbybk|swaptionbybdt|swapbyzero|swapbyhw|swapbyhjm|swapbybk|swapbybdt|stockspec|stockoptspec|ratetimes|rate2disc|optstockbyitt|optstockbyeqp|optstockbycrr|optbndbyhw|optbndbyhjm|optbndbybk|optbndbybdt|mmktbyhjm|mmktbybdt|mktrintree|mktree|mkbush|lookbackbyitt|lookbackbyeqp|lookbackbycrr|itttree|itttimespec|ittsens|ittprice|isafin|intenvset|intenvsens|intenvprice|intenvget|insttypes|instswaption|instswap|instsetfield|instselect|instoptstock|instoptbnd|instlookback|instlength|instgetcell|instget|instfloor|instfloat|instfixed|instfind|instfields|instdisp|instdelete|instcompound|instcf|instcap|instbond|instbarrier|instasian|instaddfield|instadd|hwvolspec|hwtree|hwtimespec|hwsens|hwprice|hjmvolspec|hjmtree|hjmtimespec|hjmsens|hjmprice|hedgeslf|hedgeopt|floorbyhw|floorbyhjm|floorbybk|floorbybdt|floatbyzero|floatbyhw|floatbyhjm|floatbybk|floatbybdt|fixedbyzero|fixedbyhw|fixedbyhjm|fixedbybk|fixedbybdt|eqptree|eqptimespec|eqpsens|eqpprice|disc2rate|derivset|derivget|datedisp|date2time|cvtree|crrtree|crrtimespec|crrsens|crrprice|compoundbyitt|compoundbyeqp|compoundbycrr|classfin|cfbyzero|cfbyhw|cfbyhjm|cfbybk|cfbybdt|capbyhw|capbyhjm|capbybk|capbybdt|bushshape|bushpath|bondbyzero|bondbyhw|bondbyhjm|bondbybk|bondbybdt|bkvolspec|bktree|bktimespec|bksens|bkprice|bdtvolspec|bdttree|bdttimespec|bdtsens|bdtprice|barrierbyitt|barrierbyeqp|barrierbycrr|asianbyitt|asianbyeqp|asianbycrr)\b + comment: Matlab financial derivatives toolbox + scope: support.function.toolbox.financial-derivatives.matlab + matlab_support_toolbox_fixed_income: + - match: \b(zeroyield|zeroprice|tfutyieldbyrepo|tfutpricebyrepo|tfutimprepo|tfutbyyield|tfutbyprice|tbillyield2disc|tbillyield|tbillval01|tbillrepo|tbillprice|tbilldisc2yield|stepcpnyield|stepcpnprice|stepcpncfamounts|psaspeed2rate|psaspeed2default|mbsyield2speed|mbsyield2oas|mbsyield|mbswal|mbsprice2speed|mbsprice2oas|mbsprice|mbspassthrough|mbsoas2yield|mbsoas2price|mbsnoprepay|mbsdury|mbsdurp|mbsconvy|mbsconvp|mbscfamounts|liborprice|liborfloat2fixed|liborduration|convfactor|cfamounts|cdyield|cdprice|cdai|cbprice|bkput|bkfloorlet|bkcaplet|bkcall)\b + comment: Matlab fixed income toolbox + scope: support.function.toolbox.fixed-income.matlab + matlab_support_toolbox_fixed_point: + - match: \b(zlim|ylim|xlim|wordlength|waterfall|voronoin|voronoi|vertcat|upperbound|uplus|uminus|uint8|uint32|uint16|triu|trisurf|triplot|trimesh|tril|treeplot|transpose|tostring|toeplitz|times|text|surfnorm|surfl|surfc|surf|sum|subsref|subsasgn|sub|stripscaling|streamtube|streamslice|streamribbon|stem3|stem|stairs|squeeze|sqrt|spy|slice|size|single|sign|shiftdim|set|semilogy|semilogx|sdec|scatter3|scatter|savefipref|round|rose|ribbon|rgbplot|reshape|resetlog|reset|rescale|repmat|realmin|realmax|real|range|randquant|quiver3|quiver|quantizer|quantize|pow2|polar|plus|plotyy|plotmatrix|plot3|plot|permute|pcolor|patch|or|oct|nunderflows|numerictype|numberofelements|num2int|num2hex|num2bin|noverflows|not|noperations|ne|ndims|mtimes|mpy|minus|minlog|min|meshz|meshc|mesh|maxlog|max|lt|lsb|lowerbound|loglog|logical|line|length|le|isvector|issigned|isscalar|isrow|isreal|ispropequal|isobject|isnumerictype|isnumeric|isnan|isinf|isfinite|isfimath|isfi|isequal|isempty|iscolumn|ipermute|intmin|intmax|int8|int32|int16|int|innerprodintbits|imag|horzcat|histc|hist|hex2num|hex|hankel|gt|gplot|getmsb|getlsb|get|ge|fractionlength|fplot|flipud|fliplr|flipdim|fipref|fimath|fi|feather|ezsurfc|ezsurf|ezpolar|ezplot3|ezplot|ezmesh|ezcontourf|ezcontour|exponentmin|exponentmax|exponentlength|exponentbias|etreeplot|errorbar|eq|eps|end|double|divide|disp|diag|denormalmin|denormalmax|dec|ctranspose|copyobj|convergent|contourf|contourc|contour3|contour|conj|coneplot|complex|compass|comet3|comet|clabel|buffer|bitxorreduce|bitxor|bitsrl|bitsra|bitsll|bitsliceget|bitshift|bitset|bitror|bitrol|bitorreduce|bitor|bitget|bitconcat|bitcmp|bitandreduce|bitand|bin2num|bin|barh|bar|area|any|and|all|add|abs)\b + comment: Matlab fixed-point toolbox + scope: support.function.toolbox.fixed-point.matlab + matlab_support_toolbox_fuzzy_logic: + - match: \b(zmf|writefis|trimf|trapmf|surfview|subclust|smf|sigmf|showrule|showfis|sffis|setfis|ruleview|ruleedit|rmvar|rmmf|readfis|psigmf|probor|plotmf|plotfis|pimf|parsrule|newfis|mfedit|mf2mf|mam2sug|getfis|gensurf|genfis3|genfis2|genfis1|gbellmf|gaussmf|gauss2mf|fuzzy|fuzblock|fuzarith|findcluster|fcm|evalmf|evalfis|dsigmf|defuzz|convertfis|anfisedit|anfis|addvar|addrule|addmf)\b + comment: Matlab fuzzy logic toolbox + scope: support.function.toolbox.fuzzy-logic.matlab + matlab_support_toolbox_garch: + - match: \b(ret2price|price2ret|ppTSTest|ppARTest|ppARDTest|parcorr|lratiotest|lbqtest|lagmatrix|hpfilter|garchsim|garchset|garchpred|garchplot|garchma|garchinfer|garchget|garchfit|garchdisp|garchcount|garchar|dfTSTest|dfARTest|dfARDTest|crosscorr|autocorr|archtest|aicbic)\b + comment: Matlab GARCH toolbox + scope: support.function.toolbox.garch.matlab + matlab_support_toolbox_genetic_algorithms: + - match: \b(threshacceptbnd|simulannealbnd|saoptimset|saoptimget|psoptimset|psoptimget|psearchtool|patternsearch|gatool|gaoptimset|gaoptimget|gamultiobj|ga)\b + comment: Matlab genetic algorithms toolbox + scope: support.function.toolbox.genetic-algorithms.matlab + matlab_support_toolbox_image_acquisition: + - match: \b(wait|videoinput|triggerinfo|triggerconfig|trigger|stoppreview|stop|start|set|save|propinfo|preview|peekdata|obj2mfile|load|isvalid|isrunning|islogging|imaqtool|imaqreset|imaqmontage|imaqmem|imaqhwinfo|imaqhelp|imaqfind|getsnapshot|getselectedsource|getdata|get|flushdata|disp|delete|closepreview|clear)\b + comment: Matlab image acquisition toolbox + scope: support.function.toolbox.image-acquisition.matlab + matlab_support_toolbox_image_processing: + - match: \b(zoom|ycbcr2rgb|xyz2uint16|xyz2double|wiener2|whitepoint|watershed|warp|uintlut|uint8|uint16|truesize|translate|tonemap|tforminv|tformfwd|tformarray|subimage|stretchlim|strel|stdfilt|std2|roipoly|roifilt2|roifill|roicolor|rgbplot|rgb2ycbcr|rgb2ntsc|rgb2ind|rgb2hsv|rgb2gray|regionprops|reflect|rangefilt|radon|qtsetblk|qtgetblk|qtdecomp|psf2otf|poly2mask|pixval|phantom|para2fan|padarray|otf2psf|ordfilt2|ntsc2rgb|normxcorr2|nlfilter|nitfread|nitfinfo|montage|medfilt2|mean2|mat2gray|maketform|makeresampler|makelut|makecform|makeConstrainToRectFcn|label2rgb|lab2uint8|lab2uint16|lab2double|isrgb|isnitf|isind|isicc|isgray|isflat|isbw|iradon|iptwindowalign|iptsetpref|iptremovecallback|iptnum2ordinal|ipticondir|iptgetpref|iptgetapi|iptdemos|iptcheckstrs|iptchecknargin|iptcheckmap|iptcheckinput|iptcheckhandle|iptcheckconn|iptaddcallback|iptSetPointerBehavior|iptPointerManager|iptGetPointerBehavior|ippl|intlut|interfileread|interfileinfo|ind2rgb|ind2gray|imwrite|imview|imtransform|imtophat|imtool|imsubtract|imshow|imscrollpanel|imsave|imrotate|imresize|imregionalmin|imregionalmax|imrect|imreconstruct|imread|impyramid|imputfile|improfile|impositionrect|impoly|impoint|implay|impixelregionpanel|impixelregion|impixelinfoval|impixelinfo|impixel|imoverviewpanel|imoverview|imopen|imnoise|immultiply|immovie|immagbox|imline|imlincomb|imimposemin|imhmin|imhmax|imhist|imhandles|imgetfile|imgcf|imgca|imfreehand|imfinfo|imfilter|imfill|imextendedmin|imextendedmax|imerode|imellipse|imdivide|imdistline|imdisplayrange|imdilate|imcrop|imcontrast|imcontour|imcomplement|imclose|imclearborder|imbothat|imattributes|imapprox|imagemodel|imageinfo|imadjust|imadd|imabsdiff|im2uint8|im2uint16|im2single|im2java2d|im2java|im2int16|im2double|im2col|im2bw|ifftn|ifft2|ifanbeam|idct2|iccwrite|iccroot|iccread|iccfind|hsv2rgb|houghpeaks|houghlines|hough|histeq|hdrread|graythresh|grayslice|graycoprops|graycomatrix|gray2ind|getsequence|getrect|getrangefromclass|getpts|getnhood|getneighbors|getline|getimagemodel|getimage|getheight|fwind2|fwind1|ftrans2|fspecial|fsamp2|freqz2|freqspace|fliptform|findbounds|filter2|fftshift|fftn|fft2|fanbeam|fan2para|entropyfilt|entropy|edgetaper|edge|double|dither|dicomwrite|dicomuid|dicomread|dicomlookup|dicominfo|dicomdict|dicomanon|demosaic|decorrstretch|deconvwnr|deconvreg|deconvlucy|deconvblind|dctmtx|dct2|cpstruct2pairs|cpselect|cpcorr|cp2tform|corr2|convn|convmtx2|conv2|conndef|colorbar|colfilt|col2im|cmunique|cmpermute|checkerboard|bwunpack|bwulterode|bwtraceboundary|bwselect|bwperim|bwpack|bwmorph|bwlabeln|bwlabel|bwhitmiss|bweuler|bwdist|bwboundaries|bwareaopen|bwarea|brighten|blkproc|bestblk|axes2pix|applylut|applycform|analyze75read|analyze75info|adapthisteq)\b + comment: Matlab image processing toolbox + scope: support.function.toolbox.image-processing.matlab + matlab_support_toolbox_instrument_control: + - match: \b(visa|update|udp|trigger|tmtool|tcpip|stopasync|spoll|size|set|serialbreak|serial|selftest|scanstr|save|resolvehost|remove|record|readasync|query|propinfo|obj2mfile|midtest|midedit|methods|memwrite|memunmap|memread|mempoke|mempeek|memmap|makemid|load|length|iviconfigurationstore|isvalid|invoke|instrreset|instrnotify|instrid|instrhwinfo|instrhelp|instrfindall|instrfind|instrcallback|inspect|icdevice|gpib|geterror|get|fwrite|fscanf|fread|fprintf|fopen|flushoutput|flushinput|fgets|fgetl|fclose|echoudp|echotcpip|disp|disconnect|devicereset|delete|connect|commit|clrdevice|clear|binblockwrite|binblockread|add)\b + comment: Matlab instrument control toolbox + scope: support.function.toolbox.instrument-control.matlab + matlab_support_toolbox_mapping: + - match: \b(zerom|zero22pi|zdatam-ui|zdatam|wrapToPi|wrapTo360|wrapTo2Pi|wrapTo180|worldmap|worldfilewrite|worldfileread|westof|vmap0ui|vmap0rhead|vmap0read|vmap0data|vinvtran|viewshed|vfwdtran|vec2mtx|utmzoneui|utmzone|utmgeoid|usgsdems|usgsdem|usgs24kdem|usamap|updategeostruct|unwrapMultipart|unitstr|unitsratio|undotrim|undoclip|uimaptbx|trimdata|trimcart|trackui|trackg|track2|track1|track|toRadians|toDegrees|tissot|timezone|timedim|time2str|tightmap|tigerp|tigermif|tgrline|textm|tbase|tagm-ui|tagm|symbolm|surfm|surflsrm|surflm|surfdist|surfacem|str2angle|stem3m|stdm|stdist|spzerom|spcread|smoothlong|sm2rad|sm2nm|sm2km|sm2deg|sizem|showm-ui|showm|showaxes|shapewrite|shaperead|shapeinfo|shaderel|setpostn|setm|setltln|seedm|sectorg|sec2hr|sec2hms|sec2hm|sdtsinfo|sdtsdemread|scxsc|scirclui|scircleg|scircle2|scircle1|scatterm|scaleruler|satbath|rsphere|roundn|rotatetext|rotatem|rootlayr|rhxrh|restack|resizem|removeExtraNanSeparators|refvec2mat|refmat2vec|reducem|reckon|readmtx|readfk5|readfields|rcurve|rad2sm|rad2nm|rad2km|rad2dms|rad2dm|rad2deg|quiverm|quiver3m|qrydata|putpole|projlist|projinv|projfwd|project|previewmap|polyxpoly|polysplit|polymerge|polyjoin|polycut|polybool|poly2fv|poly2cw|poly2ccw|polcmap|plotm|plot3m|plabel|pixcenters|pix2map|pix2latlon|pcolorm|patchm|patchesm|parallelui|paperscale|panzoom|originui|org2pol|onem|npi2pi|northarrow|nm2sm|nm2rad|nm2km|nm2deg|newpole|neworig|navfix|nanm|nanclip|namem|n2ecc|mobjects|mlayers|mlabelzero22pi|mlabel|minvtran|minaxis|mfwdtran|meshm|meshlsrm|meshgrat|meridianfwd|meridianarc|meanm|mdistort|mat2hms|mat2dms|mapview|maptrims|maptrimp|maptriml|maptrim|maptool|mapshow|maps|mapprofile|mapoutline|maplist|mapbbox|map2pix|makesymbolspec|makerefmat|makemapped|makedbfspec|makeattribspec|majaxis|lv2ecef|ltln2val|los2|linem|linecirc|limitm|lightmui|lightm|legs|lcolorbar|latlon2pix|kmlwrite|km2sm|km2rad|km2nm|km2deg|ispolycw|ismapped|ismap|isShapeMultipart|intrplon|intrplat|interpm|inputm|ind2rgb8|imbedm|hr2sec|hr2hms|hr2hm|hms2sec|hms2mat|hms2hr|hms2hm|histr|hista|hidem-ui|hidem|handlem-ui|handlem|gtopo30s|gtopo30|gtextm|gshhs|grn2eqa|gridm|grid2image|grepfields|gradientm|globedems|globedem|getworldfilename|getseeds|getm|geotiffread|geotiffinfo|geotiff2mstruct|geoshow|geoloc2grid|geodetic2geocentricLat|geodetic2ecef|geocentric2geodeticLat|gcxsc|gcxgc|gcwaypts|gcpmap|gcm|gc2sc|fromRadians|fromDegrees|framem|flatearthpoly|flat2ecc|fipsname|findm|filterm|fillm|fill3m|extractm|extractfield|etopo5|etopo|eqa2grn|epsm|encodem|ellipse1|elevation|egm96geoid|ecef2lv|ecef2geodetic|ecc2n|ecc2flat|eastof|dteds|dted|driftvel|driftcorr|dreckon|dms2rad|dms2mat|dms2dm|dms2degrees|dms2deg|dm2degrees|distortcalc|distdim|distance|dist2str|displaym|departure|demdataui|demcmap|degrees2dms|degrees2dm|deg2sm|deg2rad|deg2nm|deg2km|deg2dms|deg2dm|defaultm|dcwrhead|dcwread|dcwgaz|dcwdata|daspectm|crossfix|convertlat|contourm|contourfm|contourcmap|contour3m|cometm|comet3m|combntns|colorui|colorm|cmapui|clrmenu|closePolygonParts|clmo-ui|clmo|clma|clipdata|clegendm|clabelm|circcirc|changem|cart2grn|camupm|camtargm|camposm|bufferm|azimuth|axesscale|axesmui|axesm|axes2ecc|avhrrlambert|avhrrgoode|areaquad|areamat|areaint|arcgridread|antipode|angledim|angl2str|almanac)\b + comment: Matlab mapping toolbox + scope: support.function.toolbox.mapping.matlab + matlab_support_toolbox_model_based_calibration: + - match: \b(modelinput|getAlternativeTypes|getAlternativeNames|YData|XDataNames|XData|Widths|Values|Value|UserVariables|UpdateResponseFeatures|UpdateResponse|Units|Type|TestPlans|TestFilters|SummaryStatisticsForTest|SummaryStatistics|StepwiseStatus|StepwiseSelection|StepwiseRegression|Status|StatisticsDialog|SizeOfParameterSet|SingleVIF|SignalUnits|SignalNames|SetupDialog|SetTermStatus|SaveAs|Save|RollbackEdit|RestoreDataForTest|RestoreData|Responses|ResponseSignalName|Response|RemoveVariable|RemoveTestFilter|RemoveOutliersForTest|RemoveOutliers|RemoveFilter|RemoveData|Remove|RecordsPerTest|Properties|PredictedValueForTest|PredictedValue|PartialVIF|Parameters|ParameterStatistics|PEVForTest|PEV|Owner|OutputData|OutlierIndicesForTest|OutlierIndices|NumberOfTests|NumberOfRecords|NumberOfParameters|NumberOfInputs|New|Names|Name|MultipleVIF|ModifyVariable|ModifyTestFilter|ModifyFilter|Modified|ModelSetup|ModelForTest|Model|MakeHierarchicalResponse|LocalResponses|LoadProject|Load|Levels|Level|Jacobian|IsEditable|IsBeingEdited|IsAlternative|InputsPerLevel|Inputs|InputSignalNames|InputSetupDialog|InputData|ImportFromMBCDataStructure|ImportFromFile|GetTermStatus|GetTermLabel|GetIncludedTerms|GetDesignMatrix|GetAllTerms|FitAlgorithm|Fit|Filters|Filename|ExportToMBCDataStructure|Export|Evaluate|DoubleResponseData|DoubleInputData|DiagnosticStatistics|DetachData|DefineTestGroups|DefineNumberOfRecordsPerTest|DefaultModels|DataFileTypes|Data|CreateTestplan|CreateResponseFeature|CreateResponse|CreateProject|CreateModel|CreateData|CreateAlternativeModels|CreateAlgorithm|Covariance|Correlation|CopyData|CommitEdit|ChooseAsBest|Centers|BoxCoxSSE|BeginEdit|AttachData|Append|AlternativeResponses|AlternativeModelStatistics|AliasMatrix|AddVariable|AddTestFilter|AddFilter)\b + comment: Matlab model-based calibration toolbox + scope: support.function.toolbox.model-based-calibration.matlab + matlab_support_toolbox_model_predictive_control: + - match: \b(zpk|trim|tf|ss|size|sim|setoutdist|setname|setmpcsignals|setmpcdata|setindist|setestim|set|qpdantz|plot|pack|mpcverbosity|mpcstate|mpcsimopt|mpcprops|mpcmove|mpchelp|mpc|getoutdist|getname|getmpcdata|getindist|getestim|get|d2d|compare|cloffset)\b + comment: Matlab model predictive control toolbox + scope: support.function.toolbox.model-predictive-control.matlab + matlab_support_toolbox_neural_network: + - match: \b(vec2ind|tribas|trainscg|trains|trainrp|trainr|trainoss|trainlm|traingdx|traingdm|traingda|traingd|traincgp|traincgf|traincgb|trainc|trainbr|trainbfgc|trainbfg|trainb|train|tansig|sse|srchhyb|srchgol|srchcha|srchbre|srchbac|sp2narx|softmax|sim|setx|seq2con|scalprod|satlins|satlin|revert|removerows|removeconstantrows|randtop|rands|randnr|randnc|radbas|quant|purelin|processpca|postreg|poslin|pnormc|plotvec|plotv|plotsom|plotpv|plotperf|plotpc|plotes|plotep|plotbr|normr|normprod|normc|nntool|nnt2som|nnt2rb|nnt2p|nnt2lvq|nnt2lin|nnt2hop|nnt2ff|nnt2elm|nnt2c|nftool|newsom|newrbe|newrb|newpnn|newp|newnarxsp|newnarx|newlvq|newlrn|newlind|newlin|newhop|newgrnn|newfftd|newff|newelm|newdtdnn|newcf|newc|network|netsum|netprod|netinv|negdist|mseregec|msereg|mse|minmax|midpoint|maxlinlr|mapstd|mapminmax|mandist|mae|logsig|linkdist|learnwh|learnsom|learnpn|learnp|learnos|learnlv2|learnlv1|learnk|learnis|learnhd|learnh|learngdm|learngd|learncon|initzero|initwb|initnw|initlay|initcon|init|ind2vec|hintonwb|hintonw|hextop|hardlims|hardlim|gridtop|getx|gensim|fixunknowns|errsurf|dotprod|dividerand|divideint|divideind|divideblock|dist|display|disp|convwf|concur|con2seq|compet|combvec|calcperf|calcpd|calcjx|calcjejj|calcgx|boxdist|adapt)\b + comment: Matlab neural network toolbox + scope: support.function.toolbox.neural-network.matlab + matlab_support_toolbox_opc: + - match: \b(writeasync|write|wait|trend|stop|start|showopcevents|set|serveritems|serveritemprops|save|removepublicgroup|refresh|readasync|read|propinfo|peekdata|openosf|opctool|opcsupport|opcstruct2timeseries|opcstruct2array|opcserverinfo|opcreset|opcregister|opcread|opcqstr|opcqparts|opcqid|opchelp|opcfind|opcda|opccallback|obj2mfile|makepublic|load|isvalid|getnamespace|getdata|get|genslwrite|genslread|flushdata|flatnamespace|disp|disconnect|delete|copyobj|connect|clonegroup|cleareventlog|cancelasync|additem|addgroup)\b + comment: Matlab OPC toolbox + scope: support.function.toolbox.opc.matlab + matlab_support_toolbox_optimization: + - match: \b(quadprog|optimtool|optimset|optimget|lsqnonneg|lsqnonlin|lsqlin|lsqcurvefit|linprog|gangstr|fzmult|fzero|fsolve|fseminf|fminunc|fminsearch|fminimax|fmincon|fminbnd|fgoalattain|color|bintprog)\b + comment: Matlab optimization toolbox + scope: support.function.toolbox.optimization.matlab + matlab_support_toolbox_rf: + - match: \b(writeva|write|timeresp|smith|setop|semilogy|semilogx|rfmodel\.rational|rfdata\.power|rfdata\.noise|rfdata\.nf|rfdata\.network|rfdata\.mixerspur|rfdata\.ip3|rfdata\.data|rfckt\.txline|rfckt\.twowire|rfckt\.shuntrlc|rfckt\.seriesrlc|rfckt\.series|rfckt\.rlcgline|rfckt\.passive|rfckt\.parallelplate|rfckt\.parallel|rfckt\.mixer|rfckt\.microstrip|rfckt\.lclowpasstee|rfckt\.lclowpasspi|rfckt\.lchighpasstee|rfckt\.lchighpasspi|rfckt\.lcbandstoptee|rfckt\.lcbandstoppi|rfckt\.lcbandpasstee|rfckt\.lcbandpasspi|rfckt\.hybridg|rfckt\.hybrid|rfckt\.delay|rfckt\.datafile|rfckt\.cpw|rfckt\.coaxial|rfckt\.cascade|rfckt\.amplifier|restore|read|polar|plotyy|plot|loglog|listparam|listformat|impulse|getz0|getop|freqresp|extract|circle|calculate|analyze)\b + comment: Matlab RF toolbox + scope: support.function.toolbox.rf.matlab + matlab_support_toolbox_robust_control: + - match: \b(wcsens|wcnorm|wcmargin|wcgopt|wcgain|usubs|uss|usimsamp|usiminfo|usimfill|usample|ureal|uplot|umat|ultidyn|ufrd|udyn|ucomplexm|ucomplex|sysic|symdec|stack|stabproj|squeeze|slowfast|skewdec|simplify|showlmi|setmvar|setlmis|sectf|sdlsim|sdhinfsyn|sdhinfnorm|schurmr|robuststab|robustperf|robopt|repmat|reduce|randuss|randumat|randatom|quadstab|quadperf|pvinfo|pvec|psys|psinfo|popov|polydec|pdsimul|pdlstab|normalized2actual|newlmi|ncfsyn|ncfmr|ncfmargin|mussvextract|mussv|msfsyn|modreal|mktito|mkfilter|mixsyn|mincx|matnbr|mat2dec|ltrsyn|ltiarray2uss|loopsyn|loopsens|loopmargin|lmivar|lmiterm|lmireg|lminbr|lmiinfo|lmiedit|lftdata|isuncertain|ispsys|imp2ss|imp2exp|icsignal|iconnect|icomplexify|hinfsyn|hinfgs|hankelsv|hankelmr|h2syn|h2hinfsyn|gridureal|gevp|getlmis|genphase|gapmetric|fitmagfrd|fitfrd|feasp|evallmi|drawmag|dmplot|dksyn|dkitopt|diag|delmvar|dellmi|defcx|decnbr|decinfo|decay|dec2mat|dcgainmr|cpmargin|complexify|cmsclsyn|bstmr|bilin|balancmr|augw|aff2pol|actual2normalized)\b + comment: Matlab robust control toolbox + scope: support.function.toolbox.robust-control.matlab + matlab_support_toolbox_signal_processing: + - match: \b(zplane|zp2tf|zp2ss|zp2sos|zerophase|yulewalk|xcov|xcorr2|xcorr|wvtool|wintool|window|vco|upsample|upfirdn|unwrap|uencode|udecode|tukeywin|tripuls|triang|tfestimate|tf2zpk|tf2zp|tf2ss|tf2sos|tf2latc|taylorwin|strips|stmcb|stepz|ss2zp|ss2tf|ss2sos|square|sptool|spectrum\.yulear|spectrum\.welch|spectrum\.periodogram|spectrum\.music|spectrum\.mtm|spectrum\.mcov|spectrum\.eigenvector|spectrum\.cov|spectrum\.burg|spectrum|spectrogram|sosfilt|sos2zp|sos2tf|sos2ss|sos2cell|sinc|sigwin|sgolayfilt|sgolay|seqperiod|schurrc|sawtooth|rootmusic|rooteig|rlevinson|residuez|resample|rectwin|rectpuls|rceps|rc2poly|rc2lar|rc2is|rc2ac|pyulear|pwelch|pulstran|prony|pow2db|polystab|polyscale|poly2rc|poly2lsf|poly2ac|pmusic|pmtm|pmcov|phasez|phasedelay|periodogram|peig|pcov|pburg|parzenwin|nuttallwin|mscohere|modulate|medfilt1|maxflat|lsf2poly|lpc|lp2lp|lp2hp|lp2bs|lp2bp|levinson|latcfilt|latc2tf|lar2rc|kaiserord|kaiser|is2rc|invfreqz|invfreqs|intfilt|interp|impz|impinvar|ifft2|ifft|idct|icceps|hilbert|hann|hamming|grpdelay|goertzel|gmonopuls|gausswin|gaussfir|gauspuls|fvtool|freqz|freqspace|freqs|flattopwin|firrcos|firpmord|firpm|firls|fircls1|fircls|fir2|fir1|findpeaks|filtstates\.dfiir|filtstates|filtic|filtfilt|filternorm|filter2|filter|fftshift|fftfilt|fft2|fft|fdatool|eqtflength|ellipord|ellipap|ellip|dspfwiz|dspdata\.pseudospectrum|dspdata\.psd|dspdata\.msspectrum|dspdata|dpsssave|dpssload|dpssdir|dpssclear|dpss|downsample|diric|digitrevorder|dftmtx|dfilt\.statespace|dfilt\.scalar|dfilt\.parallel|dfilt\.latticemamin|dfilt\.latticemamax|dfilt\.latticearma|dfilt\.latticear|dfilt\.latticeallpass|dfilt\.fftfir|dfilt\.dfsymfir|dfilt\.dffirt|dfilt\.dffir|dfilt\.dfasymfir|dfilt\.df2tsos|dfilt\.df2t|dfilt\.df2sos|dfilt\.df2|dfilt\.df1tsos|dfilt\.df1t|dfilt\.df1sos|dfilt\.df1|dfilt\.delay|dfilt\.cascade|dfilt|demod|deconv|decimate|dct|db2pow|czt|cpsd|cplxpair|cov|corrmtx|corrcoef|convmtx|conv2|conv|chirp|cheby2|cheby1|chebwin|cheb2ord|cheb2ap|cheb1ord|cheb1ap|cfirpm|cell2sos|cconv|cceps|buttord|butter|buttap|buffer|bohmanwin|blackmanharris|blackman|bitrevorder|bilinear|besself|besselap|bartlett|barthannwin|aryule|armcov|arcov|arburg|angle|ac2rc|ac2poly|abs)\b + comment: Matlab signal processing toolbox + scope: support.function.toolbox.signal-processing.matlab + matlab_support_toolbox_spline: + - match: \b(tpaps|titanium|subplus|stmak|stcol|spterms|sprpp|spmak|splpp|splinetool|spcrv|spcol|spaps|spapi|spap2|sorted|slvblk|rsmak|rscvn|rpmak|ppmak|optknt|newknt|knt2mlt|knt2brk|getcurve|franke|fnzeros|fnxtr|fnval|fntlr|fnrfn|fnplt|fnmin|fnjmp|fnint|fndir|fnder|fncmb|fnchg|fnbrk|fn2fm|cscvn|csaps|csapi|csape|chbpnt|bspline|bspligui|brk2knt|bkbrk|aveknt|augknt|aptknt)\b + comment: Matlab spline toolbox + scope: support.function.toolbox.spline.matlab + matlab_support_toolbox_statistics: + - match: \b(ztest|zscore|x2fx|wishrnd|wblstat|wblrnd|wblplot|wblpdf|wbllike|wblinv|wblfit|wblcdf|view|vartestn|vartest2|vartest|var|upperparams|unifstat|unifrnd|unifpdf|unifit|unifinv|unifcdf|unidstat|unidrnd|unidpdf|unidinv|unidcdf|type|ttest2|ttest|tstat|trnd|trimmean|treeval|treetest|treeprune|treefit|treedisp|tpdf|tinv|tiedrank|test|tdfread|tcdf|tblwrite|tblread|tabulate|surfht|summary|stepwisefit|stepwise|std|statset|statget|squareform|sortrows|sort|slicesample|skewness|silhouette|signtest|signrank|setlabels|set|segment|scatterhist|sampsizepwr|runstest|rstool|rsmdemo|rowexch|rotatefactors|robustfit|robustdemo|risk|ridge|replacedata|reorderlevels|regstats|regress|refline|refcurve|rcoplot|raylstat|raylrnd|raylpdf|raylinv|raylfit|raylcdf|ranksum|range|randtool|randsample|random|randg|quantile|qqplot|prune|procrustes|probplot|princomp|prctile|posterior|polyval|polytool|polyfit|polyconf|poisstat|poissrnd|poisspdf|poissinv|poissfit|poisscdf|perms|pearsrnd|pdist|pdf|pcares|pcacov|partialcorr|paretotails|pareto|parent|parallelcoords|ordinal|numnodes|nsegments|normstat|normspec|normrnd|normplot|normpdf|normlike|norminv|normfit|normcdf|nominal|nodesize|nodeprob|nodeerr|nlpredci|nlparci|nlintool|nlinfit|ncx2stat|ncx2rnd|ncx2pdf|ncx2inv|ncx2cdf|nctstat|nctrnd|nctpdf|nctinv|nctcdf|ncfstat|ncfrnd|ncfpdf|ncfinv|ncfcdf|nbinstat|nbinrnd|nbinpdf|nbininv|nbinfit|nbincdf|nanvar|nansum|nanstd|nanmin|nanmedian|nanmean|nanmax|nancov|mvtrnd|mvtpdf|mvtcdf|mvregresslike|mvregress|mvnrnd|mvnpdf|mvncdf|multivarichart|multcompare|moment|mode|mnrval|mnrnd|mnrfit|mnpdf|mlecov|mle|mhsample|mergelevels|median|mean|mdscale|manovacluster|manova1|maineffectsplot|mahal|mad|lsqnonneg|lsline|lscov|lowerparams|lognstat|lognrnd|lognpdf|lognlike|logninv|lognfit|logncdf|linkage|linhyptest|lillietest|lhsnorm|lhsdesign|leverage|levelcounts|kurtosis|kstest2|kstest|ksdensity|kruskalwallis|kmeans|join|johnsrnd|jbtest|jackknife|iwishrnd|isundefined|ismember|islevel|isbranch|iqr|invpred|interactionplot|inconsistent|icdf|hygestat|hygernd|hygepdf|hygeinv|hygecdf|hougen|hmmviterbi|hmmtrain|hmmgenerate|hmmestimate|hmmdecode|histfit|hist3|hist|harmmean|hadamard|gscatter|grpstats|grp2idx|gpstat|gprnd|gppdf|gplotmatrix|gplike|gpinv|gpfit|gpcdf|gname|gmdistribution|glyphplot|glmval|glmfit|gline|gevstat|gevrnd|gevpdf|gevlike|gevinv|gevfit|gevcdf|getlabels|get|geostat|geornd|geopdf|geomean|geoinv|geocdf|gamstat|gamrnd|gampdf|gamlike|gaminv|gamfit|gamcdf|gagerr|fullfact|fsurfht|fstat|frnd|friedman|fracfactgen|fracfact|fpdf|fit|finv|ff2n|fcdf|factoran|expstat|exprnd|exppdf|explike|expinv|expfit|expcdf|evstat|evrnd|evpdf|evlike|evinv|evfit|evcdf|eval|errorbar|ecdfhist|ecdf|dwtest|dummyvar|droplevels|disttool|dfittool|dendrogram|dcovary|daugment|datasetfun|dataset|cutvar|cuttype|cutpoint|cutcategories|crosstab|coxphfit|cov|corrcov|corrcoef|corr|cordexch|copulastat|copularnd|copulapdf|copulaparam|copulafit|copulacdf|cophenet|controlrules|controlchart|combnk|cmdscale|clusterdata|cluster|classregtree|classprob|classify|classcount|cholcov|children|chi2stat|chi2rnd|chi2pdf|chi2inv|chi2gof|chi2cdf|cdfplot|cdf|ccdesign|casewrite|caseread|capaplot|capability|canoncorr|candgen|candexch|boxplot|boundary|bootstrp|bootci|biplot|binostat|binornd|binopdf|binoinv|binofit|binocdf|betastat|betarnd|betapdf|betalike|betainv|betafit|betacdf|bbdesign|barttest|aoctool|ansaribradley|anovan|anova2|anova1|andrewsplot|addlevels|addedvarplot)\b + comment: Matlab statistics toolbox + scope: support.function.toolbox.statistics.matlab + matlab_support_toolbox_symbolic_math: + - match: \b(ztrans|zeta|vpa|uint8|uint64|uint32|uint16|triu|tril|taylortool|taylor|symsum|syms|sym2poly|sym|svd|subs|subexpr|sort|solve|size|sinint|single|simplify|simple|rsums|rref|round|real|rank|quorem|procread|pretty|poly2sym|poly|numden|null|mod|mhelp|mfunlist|mfun|mapleinit|maple|log2|log10|limit|latex|laplace|lambertw|jordan|jacobian|iztrans|inv|int8|int64|int32|int16|int|imag|ilaplace|ifourier|hypergeom|horner|heaviside|funtool|frac|fourier|fortran|floor|fix|finverse|findsym|factor|ezsurfc|ezsurf|ezpolar|ezplot3|ezplot|ezmeshc|ezmesh|ezcontourf|ezcontour|expm|expand|eq|eig|dsolve|double|dirac|digits|diff|diag|det|cosint|conj|compose|colspace|collect|coeffs|ceil|ccode)\b + comment: Matlab symbolic math toolbox + scope: support.function.toolbox.symbolic-math.matlab + matlab_support_toolbox_system_identification: + - match: \b(zpkdata|zpk|wavenet|view|unitgain|treepartition|timestamp|tfdata|tf|struc|step|ssdata|ss|spafdr|spa|size|simsd|sim|sigmoidnet|setstruc|setpname|setpar|setinit|set|selstruc|segment|saturation|rplr|rpem|roe|resid|resample|realdata|rbj|rarx|rarmax|pzmap|pwlinear|present|predict|polyreg|polydata|poly1d|plot|pexcit|pem|pe|oe|nyquist|nuderst|noisecnv|nlhw|nlarx|nkshift|neuralnet|n4sid|misdata|midprefs|merge|lintan|linear|linapp|ivx|ivstruc|ivar|iv4|isreal|init|impulse|ifft|idss|idresamp|idproc|idpoly|idnlmodel|idnlhw|idnlgrey|idnlarx|idmodel|idmdlsim|idinput|idgrey|idfrd|idfilt|ident|iddata|idarx|getreg|getpar|getinit|getexp|get|fselect|freqresp|frd|fpe|fft|ffplot|feedback|fcat|evaluate|etfe|diff|detrend|delayest|deadzone|d2c|customreg|customnet|cra|covf|compare|c2d|bode|bj|balred|arxstruc|arxdata|arx|armax|ar|aic|advice|addreg|EstimationInfo)\b + comment: Matlab system identification toolbox + scope: support.function.toolbox.system-identification.matlab + matlab_support_toolbox_virtual_reality: + - match: \b(vrworld|vrwhos|vrwho|vrview|vrspacemouse|vrsetpref|vrrotvec2mat|vrrotvec|vrrotmat2vec|vrplay|vrori2dir|vrnode|vrlib|vrjoystick|vrinstall|vrgetpref|vrfigure|vrdrawnow|vrdir2ori|vrclose|vrclear)\b + comment: Matlab virtual reality toolbox + scope: support.function.toolbox.virtual-reality.matlab + matlab_support_toolbox_wavelet: + - match: \b(wvarchg|wtreemgr|wthrmngr|wthresh|wthcoef2|wthcoef|wtbxmngr|wtbo|wscalogram|write|wrev|wrcoef2|wrcoef|wpviewcf|wptree|wpthcoef|wpsplt|wprec2|wprec|wprcoef|wpjoin|wpfun|wpdencmp|wpdec2|wpdec|wpcutree|wpcoef|wpbmpen|wp2wtree|wnoisest|wnoise|wmulden|wmspca|wmaxlev|wkeep|wfusmat|wfusimg|wfilters|wfbmesti|wfbm|wextend|wentropy|wenergy2|wenergy|wdencmp|wden|wdcenergy|wdcbm2|wdcbm|wcodemat|wbmpen|waverec2|waverec|wavenames|wavemngr|wavemenu|waveinfo|wavefun2|wavefun|wavedemo|wavedec2|wavedec|wave2lp|upwlev2|upwlev|upcoef2|upcoef|treeord|treedpth|tnodes|thselect|symwavf|symaux|swt2|swt|shanwavf|set|scal2frq|readtree|read|rbiowavf|qmf|plot|pat2cwav|orthfilt|ntree|ntnode|noleaves|nodesplt|nodepar|nodejoin|nodedesc|nodeasc|mswthresh|mswden|mswcmptp|mswcmpscr|mswcmp|morlet|meyeraux|meyer|mexihat|mdwtrec|mdwtdec|mdwtcluster|lwtcoef2|lwtcoef|lwt2|lwt|lsinfo|ls2filt|liftwave|liftfilt|leaves|laurpoly|laurmat|iswt2|iswt|istnode|isnode|intwave|ind2depo|ilwt2|ilwt|idwt2|idwt|get|gauswavf|filt2ls|fbspwavf|entrupd|dyadup|dyaddown|dwtmode|dwt2|dwt|dtree|drawtree|displs|disp|detcoef2|detcoef|depo2ind|ddencmp|dbwavf|dbaux|cwt|coifwavf|cmorwavf|chgwdeccfs|cgauwavf|cfs2wpt|centfrq|bswfun|biorwavf|biorfilt|besttree|bestlevt|appcoef2|appcoef|allnodes|addlift)\b + comment: Matlab wavelet toolbox + scope: support.function.toolbox.wavelet.matlab + matlab_variable_function: + - match: \b(nargin|nargout|varargin|varargout)\b + comment: MATLAB variables + scope: variable.other.function.matlab + matlab_oop: + - match: \b(classdef)\b + scope: keyword.other.oop.matlab + push: + - meta_scope: meta.classdef.matlab + - match: \( + scope: punctuation.definition.properties.begin.matlab + push: + - meta_scope: meta.properties.matlab + - match: \) + scope: punctuation.definition.properties.end.matlab + pop: true + - match: ',' + scope: punctuation.separator.matlab + - match: \b(Abstract|AllowedSubclasses|ConstructOnLoad|HandleCompatible|Hidden|InferiorClasses|Sealed)\s*(=) + captures: + 1: variable.parameter.matlab + 2: keyword.operator.symbols.matlab + - match: \b(false|true)\b + scope: constant.language.matlab + - match : \b(\w+)\b(?:\s*(<)\s*(\w+))? + captures: + 1: entity.name.class.matlab + 2: punctuation.definition.inheritance.matlab + 3: entity.other.inherited-class.matlab + pop: true + - match: \b(properties)\s+(\() + captures: + 1: keyword.other.oop.matlab + 2: punctuation.definition.properties.begin.matlab + push: + - match: \) + scope: punctuation.definition.properties.end.matlab + pop: true + - match: ',' + scope: punctuation.separator.matlab + - match: \b(AbortSet|Abstract|Access|Constant|Dependent|GetAccess|GetObservable|Hidden|NonCopyable|SetAccess|SetObservable|Transient)\s*(=) + captures: + 1: variable.parameter.matlab + 2: keyword.operator.symbols.matlab + - match: \b(false|true|public|protected|private)\b + scope: constant.language.matlab + - match: \b(properties|events|enumeration)\b + scope: keyword.other.oop.matlab + not_equal_invalid: + - match: \s*!=\s* + comment: Not equal is written ~= not !=. + scope: invalid.illegal.invalid-inequality.matlab + number: + - match: '\d*\.?\d+([eE][+-]?\d)?([0-9&&[^\.]])*(i|j)?\b' + comment: "Valid numbers: 1, .1, 1.1, .1e1, 1.1e1, 1e1, 1i, 1j, 1e2j" + scope: constant.numeric.matlab + operators: + - match: \s*(==|~=|~|>|>=|<|<=|=|&|&&|:|\||\|\||\+|-|\*|\.\*|/|\./|\\|\.\\|\^|\.\^)\s* + comment: Operator symbols + scope: keyword.operator.symbols.matlab + parens: + - match: \( + scope: punctuation.section.parens.begin.matlab + push: + - meta_scope: meta.parens.matlab + - match: \) + scope: punctuation.section.parens.end.matlab + # pop: true + set: transpose_post_parens + - include: allofem + - include: end_in_parens + special_characters: + - match: '((\%([\+\-0]?\d{0,3}(\.\d{1,3})?)(c|d|e|E|f|g|G|s|((b|t)?(o|u|x|X))))|\%\%|\\(b|f|n|r|t|\\))' + comment: Operator symbols + scope: constant.character.escape.matlab + string: + - match: '''' + scope: punctuation.definition.string.begin.matlab + push: + - meta_scope: string.quoted.single.matlab + - match: '''(?=(\]|\)|\}|=|~|<|>|&|\||-|\+|\*|\.|\^|\||\s|;|:|,))' + scope: punctuation.definition.string.end.matlab + pop: true + - include: escaped_quote + - include: unescaped_quote + - include: special_characters + - match: '"' + scope: punctuation.definition.string.begin.matlab + push: + - meta_scope: string.quoted.double.matlab + - match: '"' + scope: punctuation.definition.string.end.matlab + pop: true + transpose: + - match: '\b({{id}})(\.?'')' + captures: + 1 : meta.variable.other.valid.matlab + 2 : keyword.operator.transpose.matlab + transpose_post_parens: + - match: '(\.?'')' + captures: + 1 : keyword.operator.transpose.matlab + pop: true + - match: '' + pop: true + unescaped_quote: + - match: "'(?=.)" + scope: invalid.illegal.unescaped-quote.matlab + variable: + - match: '\b{{id}}\b' + comment: Valid variable. Added meta to disable highlighting + scope: meta.variable.other.valid.matlab + variable_assignment: + - match: '=\s*\.{0,2}\s*;?\s*$\n?' + comment: Incomplete variable assignment. + scope: invalid.illegal.incomplete-variable-assignment.matlab + variable_invalid: + - match: '\b(_\w|\d+[_a-df-zA-DF-Z])\w*\b' + comment: No variables or function names can start with a number or an underscore. + scope: invalid.illegal.invalid-variable-name.matlab diff --git a/assets/syntaxes/Packages/Matlab/Miscellaneous.tmPreferences b/assets/syntaxes/Packages/Matlab/Miscellaneous.tmPreferences new file mode 100644 index 000000000..e8b43bcf2 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Miscellaneous.tmPreferences @@ -0,0 +1,78 @@ + + + + name + Miscellaneous + scope + source.matlab + settings + + decreaseIndentPattern + ^\s*end\b + highlightPairs + + + ( + ) + + + [ + ] + + + { + } + + + " + " + + + increaseIndentPattern + ^\s*\\begin\{.*\} + shellVariables + + + name + TM_COMMENT_START + value + % + + + name + TM_COMMENT_START_2 + value + %{ + + + + name + TM_COMMENT_END_2 + value + +%} + + + + smartTypingPairs + + + ( + ) + + + [ + ] + + + { + } + + + " + " + + + + + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/Octave-function.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/Octave-function.sublime-snippet new file mode 100644 index 000000000..b66e23a0c --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/Octave-function.sublime-snippet @@ -0,0 +1,34 @@ + + . + +## -*- texinfo -*- +## @deftypefn {Function File} {${1:Outputs} = } ${2:Function Name} (${3:Input Arguments) +## ${4:Short Description} +## +## ${5:Long Description} +## +## @seealso{${6:functions}} +## @end deftypefn + +## Author: $TM_FULLNAME + +$0 + +endfunction]]> + octfun + source.matlab, source.octave + Octave function + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/^.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/^.sublime-snippet new file mode 100644 index 000000000..3491b3e61 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/^.sublime-snippet @@ -0,0 +1,6 @@ + + + ^ + source.matlab, source.octave + ^ + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/case.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/case.sublime-snippet new file mode 100644 index 000000000..2729b59a7 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/case.sublime-snippet @@ -0,0 +1,7 @@ + + + case + source.matlab, source.octave + case + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/clear.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/clear.sublime-snippet new file mode 100644 index 000000000..f356c1fa8 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/clear.sublime-snippet @@ -0,0 +1,6 @@ + + + clear + source.matlab, source.octave + clear + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/disp-sprintf.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/disp-sprintf.sublime-snippet new file mode 100644 index 000000000..25f417ddb --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/disp-sprintf.sublime-snippet @@ -0,0 +1,6 @@ + + + dsp + source.matlab, source.octave + disp sprintf + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/disp.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/disp.sublime-snippet new file mode 100644 index 000000000..b9c59954f --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/disp.sublime-snippet @@ -0,0 +1,6 @@ + + + disp + source.matlab, source.octave + disp + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/dlmwrite.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/dlmwrite.sublime-snippet new file mode 100644 index 000000000..505f0ca47 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/dlmwrite.sublime-snippet @@ -0,0 +1,7 @@ + + + dlmwrite + source.matlab, source.octave + dlmwrite + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/else.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/else.sublime-snippet new file mode 100644 index 000000000..0be25598d --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/else.sublime-snippet @@ -0,0 +1,7 @@ + + + else + source.matlab, source.octave + else + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/elseif.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/elseif.sublime-snippet new file mode 100644 index 000000000..297888053 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/elseif.sublime-snippet @@ -0,0 +1,7 @@ + + + elseif + source.matlab, source.octave + elseif + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/error.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/error.sublime-snippet new file mode 100644 index 000000000..1c1df23f2 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/error.sublime-snippet @@ -0,0 +1,6 @@ + + + error + source.matlab, source.octave + error + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/exp.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/exp.sublime-snippet new file mode 100644 index 000000000..8f47cd9e3 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/exp.sublime-snippet @@ -0,0 +1,6 @@ + + + e + source.matlab, source.octave + exp + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/fprintf.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/fprintf.sublime-snippet new file mode 100644 index 000000000..247135372 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/fprintf.sublime-snippet @@ -0,0 +1,6 @@ + + + fpr + source.matlab, source.octave + fprintf + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/get.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/get.sublime-snippet new file mode 100644 index 000000000..ffa1a0e9d --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/get.sublime-snippet @@ -0,0 +1,6 @@ + + + get + source.matlab, source.octave + get + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/griddata.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/griddata.sublime-snippet new file mode 100644 index 000000000..288837f0c --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/griddata.sublime-snippet @@ -0,0 +1,6 @@ + + + griddata + source.matlab, source.octave + griddata + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/if-elseif.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/if-elseif.sublime-snippet new file mode 100644 index 000000000..a645aa16d --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/if-elseif.sublime-snippet @@ -0,0 +1,13 @@ + + + ifeif + source.matlab , source.octave + if … elseif … end + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/line.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/line.sublime-snippet new file mode 100644 index 000000000..6863080c4 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/line.sublime-snippet @@ -0,0 +1,7 @@ + + + line + source.matlab, source.octave + line + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/set.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/set.sublime-snippet new file mode 100644 index 000000000..d20efb49c --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/set.sublime-snippet @@ -0,0 +1,6 @@ + + + set + source.matlab , source.octave + set + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/small-function.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/small-function.sublime-snippet new file mode 100644 index 000000000..1a4f28818 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/small-function.sublime-snippet @@ -0,0 +1,8 @@ + + + func + source.matlab, source.octave + small function + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/sprintf.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/sprintf.sublime-snippet new file mode 100644 index 000000000..ba7541b35 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/sprintf.sublime-snippet @@ -0,0 +1,6 @@ + + + spr + source.matlab, source.octave + sprintf + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/switch___case___otherwise___end.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/switch___case___otherwise___end.sublime-snippet new file mode 100644 index 000000000..25329c65d --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/switch___case___otherwise___end.sublime-snippet @@ -0,0 +1,11 @@ + + + switch + source.matlab, source.octave + switch ... case ... otherwise ... end + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/title.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/title.sublime-snippet new file mode 100644 index 000000000..67e4eb521 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/title.sublime-snippet @@ -0,0 +1,6 @@ + + + zla + source.matlab , source.octave + title + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/unix.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/unix.sublime-snippet new file mode 100644 index 000000000..22db5ede2 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/unix.sublime-snippet @@ -0,0 +1,6 @@ + + + uni + source.matlab, source.octave + unix + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/unwind_protect-cleanup-end.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/unwind_protect-cleanup-end.sublime-snippet new file mode 100644 index 000000000..5ad4d89a4 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/unwind_protect-cleanup-end.sublime-snippet @@ -0,0 +1,10 @@ + + + unwind + source.matlab, source.octave + unwind_protect … cleanup … end + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/warning.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/warning.sublime-snippet new file mode 100644 index 000000000..24fa71b75 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/warning.sublime-snippet @@ -0,0 +1,6 @@ + + + war + source.matlab, source.octave + warning + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/while.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/while.sublime-snippet new file mode 100644 index 000000000..500bcefc3 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/while.sublime-snippet @@ -0,0 +1,9 @@ + + + whi + source.matlab , source.octave + while + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/xlabel.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/xlabel.sublime-snippet new file mode 100644 index 000000000..564e88eb0 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/xlabel.sublime-snippet @@ -0,0 +1,6 @@ + + + xla + source.matlab , source.octave + xlabel + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/xtick.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/xtick.sublime-snippet new file mode 100644 index 000000000..b88cc8caf --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/xtick.sublime-snippet @@ -0,0 +1,6 @@ + + + xti + source.matlab , source.octave + xtick + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/ylabel.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/ylabel.sublime-snippet new file mode 100644 index 000000000..a3b1f8e50 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/ylabel.sublime-snippet @@ -0,0 +1,6 @@ + + + yla + source.matlab , source.octave + ylabel + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/ytick.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/ytick.sublime-snippet new file mode 100644 index 000000000..90590f862 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/ytick.sublime-snippet @@ -0,0 +1,6 @@ + + + yti + source.matlab , source.octave + ytick + diff --git a/assets/syntaxes/Packages/Matlab/Snippets/zlabel.sublime-snippet b/assets/syntaxes/Packages/Matlab/Snippets/zlabel.sublime-snippet new file mode 100644 index 000000000..55092de90 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Snippets/zlabel.sublime-snippet @@ -0,0 +1,6 @@ + + + zla + source.matlab , source.octave + zlabel + diff --git a/assets/syntaxes/Packages/Matlab/Symbols.tmPreferences b/assets/syntaxes/Packages/Matlab/Symbols.tmPreferences new file mode 100644 index 000000000..8e99cef84 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/Symbols.tmPreferences @@ -0,0 +1,19 @@ + + + + name + Symbol List: Functions + scope + source.matlab meta.function.with-arguments, source.matlab meta.function.without-arguments + settings + + showInSymbolList + 1 + symbolTransformation + .*=)\s*//; # remove output args + ]]> + + + diff --git a/assets/syntaxes/Packages/Matlab/syntax_test_matlab.m b/assets/syntaxes/Packages/Matlab/syntax_test_matlab.m new file mode 100644 index 000000000..589202e35 --- /dev/null +++ b/assets/syntaxes/Packages/Matlab/syntax_test_matlab.m @@ -0,0 +1,216 @@ +% SYNTAX TEST "Packages/Matlab/Matlab.sublime-syntax" + + +%--------------------------------------------- +% Matlab OOP test + +classdef (Sealed = false) classname < baseclass +% <- keyword.other +% ^ variable.parameter +% ^ keyword.operator.symbols +% ^ constant.language +% ^ entity.name.class +% ^ entity.other.inherited-class + properties (SetAccess = private, GetAccess = true) +% ^ keyword.other +% ^ variable.parameter +% ^ constant.language +% ^ variable.parameter + PropName + end +% ^ keyword.control + methods +% ^ keyword.other + methodName + end + events +% ^ keyword.other + EventName + end + enumeration +% ^ keyword.other + EnumName + end +end + + +%--------------------------------------------- +% Syntax brackets/parens punctuation test + +x = [ 1.76 ] +% <- source.matlab meta.variable.other.valid.matlab +% ^ source.matlab keyword.operator.symbols.matlab +% ^ source.matlab punctuation.section.brackets.begin.matlab +% ^^^^ source.matlab meta.brackets.matlab constant.numeric.matlab +% ^ source.matlab punctuation.section.brackets.end.matlab + + +xAprox = fMetodoDeNewton( xi ) +% <- source.matlab meta.variable.other.valid.matlab +% ^ source.matlab keyword.operator.symbols.matlab +% ^ source.matlab meta.variable.other.valid.matlab +% ^ source.matlab punctuation.section.parens.begin.matlab +% ^ source.matlab meta.parens.matlab meta.variable.other.valid.matlab +% ^ source.matlab punctuation.section.parens.end.matlab + + +%--------------------------------------------- +% Block comment test + +% Success case +%{ +x = 5 +% ^ source.matlab comment.block.percentage.matlab +%} + +% Invalid block +%{ Not start of block comment +% ^ comment.line.percentage.matlab +x = 5 +% ^ keyword.operator.symbols.matlab +%} + + %{ +%} Not end of block +% ^ comment.block.percentage.matlab +x = 5 +% ^ comment.block.percentage.matlab + %} +x = 5 %{ not block comment +% ^ keyword.operator.symbols.matlab +x = 5 +% ^ constant.numeric.matlab + + +%--------------------------------------------- +% Function + +function y = average(x) +% <- keyword.other +% ^ variable.parameter.output.function.matlab +% ^^^^^^^ entity.name.function.matlab +% ^ variable.parameter.input.function.matlab + if ~isvector(x) +% ^ keyword.operator.symbols.matlab + error('Input must be a vector') + end + y = sum(x)/length(x); +end + +function [m,s] = stat(x) +% <- keyword.other +% ^ variable.parameter.output.function.matlab +% ^ -variable.parameter.output.function.matlab +% ^ variable.parameter.output.function.matlab +% ^ keyword.operator.assignment.matlab +% ^^^^ entity.name.function.matlab +% ^ variable.parameter.input.function.matlab + n = length(x); + m = sum(x)/n; + s = sqrt(sum((x-m).^2/n)); +end + +function m = avg(x,n) +% ^ variable.parameter.output.function.matlab +% ^^^ entity.name.function.matlab +% ^ variable.parameter.input.function.matlab +% ^ variable.parameter.input.function.matlab + m = sum(x)/n; +end + +function foo(bar) +% <- keyword.other.matlab +% ^^^ entity.name.function.matlab +% ^^^ meta.function.parameters.matlab variable.parameter.input.function.matlab +end + +function x = foo +% <- keyword.other.matlab +% ^ variable.parameter.output.function.matlab +% ^ keyword.operator.assignment.matlab +% ^^^ entity.name.function.matlab +end + +function foo +% <- keyword.other.matlab +% ^^^ entity.name.function.matlab +end + +function foo % with comment +% <- keyword.other.matlab +% ^^^ entity.name.function.matlab +end + + +%--------------------------------------------- +% Numbers + +1 +% <- constant.numeric.matlab +.1 +% <- constant.numeric.matlab +1.1 +% <- constant.numeric.matlab +.1e1 +% <- constant.numeric.matlab +1.1e1 +% <- constant.numeric.matlab +1e1 +% <- constant.numeric.matlab +1i - (4i) +% <- constant.numeric.matlab +% ^^ constant.numeric.matlab +1j +% <- constant.numeric.matlab +1e2j +% <- constant.numeric.matlab + + +%--------------------------------------------- +% transpose +a = a' % is the conjugate and transpose +% ^ -keyword.operator.transpose.matlab +% ^ keyword.operator.transpose.matlab +a = a.' % is the transpose +% ^ -keyword.operator.transpose.matlab +% ^^ keyword.operator.transpose.matlab +c = a.b' % is the conjugate and transpose of the field b of structure a +% ^ punctuation.accessor.dot.matlab +% ^ keyword.operator.transpose.matlab +c = a.b.' % is the transpose of the field b of structure a +% ^ punctuation.accessor.dot.matlab +% ^^ keyword.operator.transpose.matlab +x = a[3]' + b(4)' % is the conjugate and transpose +% ^ keyword.operator.transpose.matlab +% ^ keyword.operator.transpose.matlab + +l = {l.n}'; +% ^ keyword.operator.transpose.matlab + +%--------------------------------------------- +% String +a = '%' +a = '.' % .' +% ^^^ comment.line.percentage.matlab + + 'a'a' +% ^ string.quoted.single.matlab invalid.illegal.unescaped-quote.matlab +%^ string.quoted.single.matlab punctuation.definition.string.begin.matlab +% ^ string.quoted.single.matlab +% ^ string.quoted.single.matlab punctuation.definition.string.end.matlab + +regexprep(outloc,'.+\\','') +% ^ punctuation.definition.string.begin.matlab +% ^^ meta.parens.matlab string.quoted.single.matlab +% ^^ constant.character.escape.matlab +% ^ punctuation.definition.string.end.matlab + +s1="00:06:57"; +% ^ punctuation.definition.string.begin.matlab +% ^^^^^^^^ string.quoted.double.matlab +% ^ punctuation.definition.string.end.matlab + +%--------------------------------------------- +parfor x = 1:10 +%^ keyword.control.matlab +end diff --git a/assets/syntaxes/Packages/OCaml/Indent rules.tmPreferences b/assets/syntaxes/Packages/OCaml/Indent rules.tmPreferences new file mode 100644 index 000000000..3a7e5d8ef --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Indent rules.tmPreferences @@ -0,0 +1,18 @@ + + + + name + Indent rules + scope + source.ocaml + settings + + decreaseIndentPattern + ^\s*(end|done|with|in|else)\b|^\s*;;|^[^\("]*\) + increaseIndentPattern + [ \t]*$|\b(for|while)[ \t]+.*[ \t]+do[ \t]*$|(\btry$|\bif\s+.*\sthen$|\belse|[:=]\s*sig|=\s*struct)\s*$]]> + indentNextLinePattern + (?!\bif.*then.*(else.*|(;|[ \t]in)[ \t]*$))\bif|\bthen[ \t]*$|\belse[ \t]*$$ + + + diff --git a/assets/syntaxes/Packages/OCaml/Miscellaneous.tmPreferences b/assets/syntaxes/Packages/OCaml/Miscellaneous.tmPreferences new file mode 100644 index 000000000..daaea74e4 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Miscellaneous.tmPreferences @@ -0,0 +1,27 @@ + + + + name + Comments + scope + source.ocaml + settings + + shellVariables + + + name + TM_COMMENT_START + value + (* + + + name + TM_COMMENT_END + value + *) + + + + + diff --git a/assets/syntaxes/Packages/OCaml/OCaml.sublime-syntax b/assets/syntaxes/Packages/OCaml/OCaml.sublime-syntax new file mode 100644 index 000000000..73ceb3939 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/OCaml.sublime-syntax @@ -0,0 +1,716 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: OCaml +file_extensions: + - ml + - mli +scope: source.ocaml +variables: + sign: (?:-|\b) + suffix: (?:[lLn]|(?!\.))\b + bin_digit: '[01_]' + oct_digit: '[0-7_]' + dec_digit: '[0-9_]' + hex_digit: '[\h_]' + bin_integer: (?:[01]{{bin_digit}}*) + oct_integer: (?:[0-7]{{oct_digit}}*) + dec_integer: (?:[0-9]{{dec_digit}}*) + hex_integer: (?:\h{{hex_digit}}*) + exponent: '[-+]??(_?){{dec_integer}}' + dec_exponent: (?:[Ee]{{exponent}}) + hex_exponent: (?:[Pp]{{exponent}}) + + identifier: '[a-z][a-zA-Z0-9''_]*' + capIdentifier: '[A-Z][a-zA-Z0-9''_]*' + +contexts: + main: + - match: '\b(let)\s+(module)\s+({{capIdentifier}})\s*(=)' + scope: meta.module.binding + captures: + 1: keyword.other.module-binding.ocaml + 2: keyword.other.module-definition.ocaml + 3: support.other.module.ocaml + 4: punctuation.separator.module-binding.ocaml + - match: \b(let|and)\s+(open)\s+{{capIdentifier}}(\.{{capIdentifier}})*\b + captures: + 1: keyword.other.ocaml + 2: keyword.control.import.ocaml + - match: '\b(let|and)\s+(?!\(\*)((rec\s+)([a-z_][a-zA-Z0-9_'']*)\b|([a-z_][a-zA-Z0-9_'']*|\([^)]+\))(?=\s)((?=\s*=\s*(?=fun(?:ction)\b))|(?!\s*=)))' + captures: + 1: keyword.other.function-definition.ocaml + 3: keyword.other.function-definition.ocaml + 4: entity.name.function.ocaml + 5: entity.name.function.ocaml + push: + - meta_scope: meta.function.ocaml + - match: '(?:(:)\s*([^=]+))?(?:(=)|(=)\s*(?=fun(?:ction)\b))' + captures: + 1: punctuation.separator.function.type-constraint.ocaml + 2: storage.type.ocaml + 3: keyword.operator.ocaml + 4: keyword.operator.ocaml + pop: true + - include: variables + - match: \b(let|and)\s+({{identifier}})\s*(=)\s* + captures: + 1: keyword.other.ocaml + 2: variable.other.constant.ocaml + 3: keyword.operator.assignment.ocaml + - match: (\(|\s)(?=fun\s) + captures: + 1: punctuation.definition.function.anonymous.ocaml + push: + - meta_scope: meta.function.anonymous.ocaml + - match: (\)) + captures: + 1: punctuation.definition.function.anonymous.ocaml + pop: true + - match: (?<=(\(|\s))(fun)\s + captures: + 2: keyword.other.function-definition.ocaml + push: + - meta_scope: meta.function.anonymous.definition.ocaml + - match: (->) + captures: + 1: punctuation.separator.function-definition.ocaml + pop: true + - include: variables + - include: main + - match: ^\s*(?=type\s) + push: + - meta_scope: meta.type-definition-group.ocaml + - match: \b(?=let|end|val)|^\s*$ + pop: true + - match: '\b(type|and)\s+([^=]*)(=)?' + captures: + 1: keyword.other.type-definition.ocaml + 2: storage.type.ocaml + 3: punctuation.separator.type-definition.ocaml + push: + - meta_scope: meta.type-definition.ocaml + - match: (?=\b(type|and|let|end|val)\b)|(?=^\s*$) + pop: true + - include: typedefs + - match: \b(with|function)(?=(\s*$|.*->))\b|((?)) + captures: + 1: keyword.control.match-definition.ocaml + 2: keyword.other.function-definition.ocaml + 3: keyword.control.match-definition.ocaml + push: + - meta_scope: meta.pattern-match.ocaml + - match: (?:(->)|\b(when)\b|\s(?=\|)) + captures: + 1: punctuation.separator.match-definition.ocaml + 2: keyword.control.match-condition.ocaml + pop: true + - include: matchpatterns + - match: '^[ \t]*(class\s+type\s+)((\[\s*(''[A-Za-z][a-zA-Z0-9_'']*(?:\s*,\s*''[A-Za-z][a-zA-Z0-9_'']*)*)\s*\]\s+)?[a-z_][a-zA-Z0-9''_]*)' + scope: meta.class.type-definition.ocaml + captures: + 1: keyword.other.class-type-definition.ocaml + 2: entity.name.type.class-type.ocaml + 4: storage.type.ocaml + - match: '^[ \t]*(class)(?:\s+(?!(?:virtual)\s+))((\[\s*(''[A-Za-z][a-zA-Z0-9_'']*(?:\s*,\s*''[A-Za-z][a-zA-Z0-9_'']*)*)\s*\]\s+)?[a-z_][a-zA-Z0-9''_]*)' + captures: + 1: keyword.other.class-definition.ocaml + 2: entity.name.type.class.ocaml + 4: storage.type.ocaml + push: + - meta_scope: meta.class.ocaml + - match: (=) + captures: + 1: keyword.operator.ocaml + pop: true + - include: variables + - match: '^[ \t]*(class\s+virtual\s+)((\[\s*(''[A-Za-z][a-zA-Z0-9_'']*(?:\s*,\s*''[A-Za-z][a-zA-Z0-9_'']*)*)\s*\]\s+)?[a-z_][a-zA-Z0-9''_]*)' + captures: + 1: keyword.other.class-definition.ocaml + 2: entity.name.type.class.ocaml + 4: storage.type.ocaml + push: + - meta_scope: meta.class.virtual.ocaml + - match: (=) + captures: + 1: keyword.operator.ocaml + pop: true + - include: variables + - match: '^[ \t]*(class\s+type\s+virtual)((\[\s*(''[A-Za-z][a-zA-Z0-9_'']*(?:\s*,\s*''[A-Za-z][a-zA-Z0-9_'']*)*)\s*\]\s+)?[a-z_][a-zA-Z0-9''_]*)' + scope: meta.class.virtual.type-definition.ocaml + captures: + 1: keyword.other.class-type-definition.ocaml + 2: entity.name.type.class-type.ocaml + 4: storage.type.ocaml + - match: '(\{)' + captures: + 1: punctuation.definition.record.ocaml + push: + - meta_scope: meta.record.ocaml + - match: '(\})' + captures: + 1: punctuation.definition.record.ocaml + pop: true + - match: \bwith\b + scope: keyword.other.language.ocaml + - match: '(\bmutable\s+)?\b([a-z_][a-zA-Z0-9_'']*)\s*(:)' + captures: + 1: keyword.other.storage.modifier.ocaml + 2: source.ocaml + 3: punctuation.definition.record.ocaml + push: + - meta_scope: meta.record.definition.ocaml + - match: "(;|(?=}))" + captures: + 1: keyword.operator.ocaml + pop: true + - include: typedefs + - include: main + - match: '\b(object)\s*(?:(\()(_?[a-z]+)(\)))?\s*$' + captures: + 1: keyword.other.object-definition.ocaml + 2: punctuation.definition.self-binding.ocaml + 3: entity.name.type.self-binding.ocaml + 4: punctuation.definition.self-binding.ocaml + push: + - meta_scope: meta.object.ocaml + - match: \b(end)\b + captures: + 1: keyword.control.object.ocaml + 2: punctuation.terminator.expression.ocaml + pop: true + - match: '\b(method)\s+(virtual\s+)?(private\s+)?([a-z_][a-zA-Z0-9''_]*)' + captures: + 1: keyword.other.method-definition.ocaml + 2: keyword.other.method-definition.ocaml + 3: keyword.other.method-restriction.ocaml + 4: entity.name.function.method.ocaml + push: + - meta_scope: meta.method.ocaml + - match: (=|:) + captures: + 1: keyword.operator.ocaml + pop: true + - include: variables + - match: '(constraint)\s+([a-z_''][a-zA-Z0-9''_]*)\s+(=)' + captures: + 1: keyword.other.language.ocaml + 2: storage.type.ocaml + 3: keyword.operator.ocaml + push: + - meta_scope: meta.object.type-constraint.ocaml + - match: '(#[a-z_][a-zA-Z0-9''_]*)|(int|char|float|string|list|array|bool|unit|exn|option|int32|int64|nativeint|format4|lazy_t)|([a-z_][a-zA-Z0-9''_]*)\s*$' + captures: + 1: storage.type.polymorphic-variant.ocaml + 2: storage.type.ocaml + 3: storage.type.ocaml + pop: true + - include: main + - match: '(?<=\w|\)|'')(#)[a-z_][a-zA-Z0-9''_]*' + scope: meta.method-call.ocaml + captures: + 1: punctuation.separator.method-call.ocaml + - match: '^[ \t]*(module)\s+([A-Z_][a-zA-Z0-9''_]*)(?:\s*(:)\s*([A-Z][a-zA-Z0-9''_]*)?)?' + scope: meta.module.ocaml + captures: + 1: keyword.other.module-definition.ocaml + 2: entity.name.type.module.ocaml + 3: punctuation.separator.module-definition.ocaml + 4: entity.name.type.module-type.ocaml + - match: '^[ \t]*(module\s+type\s+)([A-Z][a-zA-Z0-9''_]*)' + scope: meta.module.type.ocaml + captures: + 1: keyword.other.module-type-definition.ocaml + 2: entity.name.type.module-type.ocaml + - match: \b(sig)\b + captures: + 1: keyword.other.module.signature.ocaml + push: + - meta_scope: meta.module.signature.ocaml + - match: \b(end)\b + captures: + 1: keyword.other.module.signature.ocaml + 2: punctuation.terminator.expression.ocaml + 3: keyword.operator.ocaml + pop: true + - include: module-signature + - include: main + - match: \b(struct)\b + captures: + 1: keyword.other.module.structure.ocaml + push: + - meta_scope: meta.module.structure.ocaml + - match: \b(end)\b + captures: + 1: keyword.other.module.structure.ocaml + pop: true + - include: main + - include: moduleref + - match: '\b(open)\s+([A-Z][a-zA-Z0-9''_]*)(?=(\.[A-Z][a-zA-Z0-9_]*)*)' + captures: + 1: keyword.other.ocaml + 2: support.other.module.ocaml + push: + - meta_scope: meta.module.open.ocaml + - match: (\s|$) + pop: true + - match: '(\.)([A-Z][a-zA-Z0-9''_]*)' + scope: support.other.module.ocaml + captures: + 1: punctuation.separator.module-reference.ocaml + - match: '\b(exception)\s+([A-Z][a-zA-Z0-9''_]*)\b' + scope: meta.exception.ocaml + captures: + 1: keyword.other.ocaml + 2: entity.name.type.exception.ocaml + - match: '(?=(\[<)(?![^\[]+?[^>]]))' + push: + - meta_scope: source.camlp4.embedded.ocaml + - match: "(>])" + captures: + 1: punctuation.definition.camlp4-stream.ocaml + pop: true + - include: scope:source.camlp4.ocaml + - include: strings + - include: constants + - include: comments + - include: lists + - include: arrays + - match: '(\()(?=(~[a-z][a-zA-Z0-9_]*:|("(\\"|[^"])*")|[^\(\)~"])+(?|:(?![:=])))' + captures: + 1: punctuation.section.type-constraint.ocaml + push: + - meta_scope: meta.type-constraint.ocaml + - match: '(?|:(?![:=]))(.*?)(\))' + captures: + 1: punctuation.separator.type-constraint.ocaml + 2: storage.type.ocaml + 3: punctuation.section.type-constraint.ocaml + pop: true + - include: main + - match: '^[ \t]*#[a-zA-Z]+' + scope: keyword.other.directive.ocaml + - match: '^[ \t]*#[0-9]*' + scope: keyword.other.directive.line-number.ocaml + - include: storagetypes + - match: \b(mutable|ref)\b + scope: keyword.other.storage.modifier.ocaml + - match: '`[A-Za-z][a-zA-Z0-9''_]*\b' + scope: entity.name.type.variant.polymorphic.ocaml + - match: '\b[A-Z][a-zA-Z0-9''_]*\b' + scope: entity.name.type.variant.ocaml + - match: "!=|:=|>|<" + scope: keyword.operator.symbol.ocaml + - match: '[*+/-]\.' + scope: keyword.operator.infix.floating-point.ocaml + - match: ~-\. + scope: keyword.operator.prefix.floating-point.ocaml + - match: "::" + scope: punctuation.definition.list.constructor.ocaml + - match: ;; + scope: punctuation.terminator.expression.ocaml + - match: ; + scope: punctuation.separator.ocaml + - match: "->" + scope: punctuation.separator.function-return.ocaml + - match: '[=<>@^&+\-*/$%|][|!$%&*+./:<=>?@^~-]*' + scope: keyword.operator.infix.ocaml + - match: '\bnot\b|!|[!\?~][!$%&*+./:<=>?@^~-]+' + scope: keyword.operator.prefix.ocaml + - match: "~[a-z][a-z0-9'_]*(:)?" + scope: entity.name.tag.label.ocaml + captures: + 1: punctuation.separator.argument-label.ocaml + - match: \b(begin)\b + captures: + 1: keyword.control.begin-end.ocaml + push: + - meta_scope: meta.begin-end-group.ocaml + - match: \b(end)\b + captures: + 1: keyword.control.begin-end.ocaml + pop: true + - include: main + - match: \b(for)\b + captures: + 1: keyword.control.for-loop.ocaml + push: + - meta_scope: meta.for-loop.ocaml + - match: \b(done)\b + captures: + 1: keyword.control.for-loop.ocaml + pop: true + - match: \bdo\b + scope: keyword.control.loop.ocaml + - include: main + - match: \b(while)\b + captures: + 1: keyword.control.while-loop.ocaml + push: + - meta_scope: meta.while-loop.ocaml + - match: \b(done)\b + captures: + 1: keyword.control.while-loop.ocaml + pop: true + - match: \bdo\b + scope: keyword.control.loop.ocaml + - include: main + - match: \( + push: + - meta_scope: meta.paren-group.ocaml + - match: \) + pop: true + - include: main + - match: \b(and|land|lor|lsl|lsr|lxor|mod|or)\b + scope: keyword.operator.ocaml + - match: \b(downto|if|else|match|then|to|when|with|try)\b + scope: keyword.control.ocaml + - match: \b(as|assert|class|constraint|exception|functor|in|include|inherit|initializer|lazy|let|mod|module|mutable|new|object|open|private|rec|sig|struct|type|virtual)\b + scope: keyword.other.ocaml + - include: module-signature + - match: (’|‘|“|”) + scope: invalid.illegal.unrecognized-character.ocaml + arrays: + - match: '(\[\|)' + captures: + 1: punctuation.definition.array.begin.ocaml + push: + - meta_scope: meta.array.ocaml + - match: '(\|])' + captures: + 1: punctuation.definition.array.end.ocaml + pop: true + - include: arrays + - include: main + comments: + - match: \(\*+(\*)\) + scope: comment.block.ocaml + captures: + 1: comment.block.empty.ocaml + - match: \(\* + push: + - meta_scope: comment.block.ocaml + - match: \*\) + pop: true + - include: comments + - match: '(?=[^\\])(")' + push: + - meta_scope: comment.block.string.quoted.double.ocaml + - match: '"' + pop: true + - match: '\\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\d\d|[bnrt''"\\])' + scope: comment.block.string.constant.character.escape.ocaml + constants: + - match: '(?:\[\s*(\])|\((\))|\(\s*(\)))' + scope: constant.language.pseudo-variable.ocaml + captures: + 1: meta.empty-typing-pair.ocaml + 2: meta.empty-typing-pair.parens.ocaml + 3: meta.empty-typing-pair.ocaml + - match: \b(true|false)\b + scope: constant.language.boolean.ocaml + - match: '''(.|\\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\d\d|[bnrt''"\\]))''' + scope: constant.character.ocaml + + # http://caml.inria.fr/pub/docs/manual-ocaml/lex.html + # hexadecimal floats + - match: ({{sign}})(0[xX])(_*){{hex_integer}}(?:(\.){{hex_digit}}*{{hex_exponent}}?|{{hex_exponent}}) + scope: constant.numeric.float.hexadecimal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.definition.numeric.base.ocaml + 3: invalid.illegal.numeric.ocaml + 4: punctuation.separator.decimal.ocaml + 5: invalid.illegal.numeric.ocaml + 6: invalid.illegal.numeric.ocaml + # decimal floats + - match: ({{sign}}){{dec_integer}}(?:(\.){{dec_digit}}*{{dec_exponent}}?|{{dec_exponent}}) + scope: constant.numeric.float.decimal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.separator.decimal.ocaml + 3: invalid.illegal.numeric.ocaml + 4: invalid.illegal.numeric.ocaml + # hexadecimal integers + - match: ({{sign}})(0[xX])(_*){{hex_integer}}*({{suffix}}) + scope: constant.numeric.integer.hexadecimal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.definition.numeric.base.ocaml + 3: invalid.illegal.numeric.ocaml + 4: storage.type.numeric.ocaml + # octal integers + - match: ({{sign}})(0[oO])(_*){{oct_integer}}*({{suffix}}) + scope: constant.numeric.integer.octal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.definition.numeric.base.ocaml + 3: invalid.illegal.numeric.ocaml + 4: storage.type.numeric.ocaml + # binary integers + - match: ({{sign}})(0[bB])(_*){{bin_integer}}*({{suffix}}) + scope: constant.numeric.integer.binary.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.definition.numeric.base.ocaml + 3: invalid.illegal.numeric.ocaml + 4: storage.type.numeric.ocaml + # decimal integers + - match: ({{sign}}){{dec_integer}}({{suffix}}) + scope: constant.numeric.integer.decimal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: storage.type.numeric.ocaml + # invalid numbers + - match: '{{sign}}\d+.*\b' + scope: invalid.illegal.numeric.ocaml + + definite_storagetypes: + - include: storagetypes + - match: '\b[a-zA-Z0-9''_]+\b' + scope: storage.type.ocaml + lists: + - match: '(\[)(?!\||<|>)' + captures: + 1: punctuation.definition.list.begin.ocaml + push: + - meta_scope: meta.list.ocaml + - match: '(?)(])' + captures: + 1: punctuation.definition.list.end.ocaml + pop: true + - include: lists + - include: main + matchpatterns: + - match: \b_\b + scope: constant.language.universal-match.ocaml + - match: \|(?=\s*\S) + scope: punctuation.separator.match-pattern.ocaml + - match: (\()(?=(?!=.*?->).*?\|) + captures: + 1: punctuation.definition.match-option.ocaml + push: + - meta_scope: meta.match-option.ocaml + - match: (\)) + captures: + 1: punctuation.definition.match-option.ocaml + pop: true + - match: \| + scope: punctuation.separator.match-option.ocaml + - include: matchpatterns + - include: moduleref + - include: constants + - include: variables + - include: main + module-signature: + - match: '(val)\s+([a-z_][a-zA-Z0-9_'']*)\s*(:)' + captures: + 1: keyword.other.ocaml + 2: entity.name.type.value-signature.ocaml + 3: punctuation.separator.type-constraint.ocaml + push: + - meta_scope: meta.module.signature.val.ocaml + - match: (?=\b(type|val|external|class|module|end)\b)|^\s*$ + pop: true + - match: '(\?)([a-z][a-zA-Z0-9_]*)\s*(:)' + scope: variable.parameter.ameter.optional.ocaml + captures: + 1: punctuation.definition.optional-parameter.ocaml + 2: entity.name.tag.label.optional.ocaml + 3: punctuation.separator.optional-parameter.ocaml + - match: '([a-z][a-zA-Z0-9''_]*)\s*(:)\s*' + captures: + 1: entity.name.tag.label.ocaml + 2: punctuation.separator.label.ocaml + 3: storage.type.ocaml + push: + - meta_scope: variable.parameter.labeled.ocaml + - match: \s + pop: true + - include: definite_storagetypes + - include: typedefs + - match: '(external)\s+([a-z_][a-zA-Z0-9_'']*)\s*(:)' + captures: + 1: keyword.other.ocaml + 2: entity.name.type.external-signature.ocaml + 3: punctuation.separator.type-constraint.ocaml + push: + - meta_scope: meta.module.signature.external.ocaml + - match: (?=\b(type|val|external|class|module|let|end)\b)|^\s*$ + pop: true + - match: '(\?)([a-z][a-zA-Z0-9_]*)\s*(:)' + scope: variable.parameter.optional.ocaml + captures: + 1: punctuation.definition.optional-parameter.ocaml + 2: entity.name.tag.label.optional.ocaml + 3: punctuation.separator.optional-parameter.ocaml + - match: '(~)([a-z][a-zA-Z0-9''_]*)\s*(:)\s*' + captures: + 1: punctuation.definition.labeled-parameter.ocaml + 2: entity.name.tag.label.ocaml + 3: punctuation.separator.label.ocaml + push: + - meta_scope: variable.parameter.labeled.ocaml + - match: \s + pop: true + - include: variables + - include: strings + - include: typedefs + moduleref: + - match: '\b([A-Z][a-zA-Z0-9''_]*)(\.)' + scope: meta.module-reference.ocaml + storagetypes: + - match: \b(int|char|float|string|list|array|bool|unit|exn|option|int32|int64|nativeint|format4|lazy_t)\b + scope: storage.type.ocaml + - match: "#[a-z_][a-zA-Z0-9_]*" + scope: storage.type.variant.polymorphic.ocaml + strings: + - match: '(?=[^\\])(")' + captures: + 1: punctuation.definition.string.begin.ocaml + push: + - meta_scope: string.quoted.double.ocaml + - match: (") + captures: + 1: punctuation.definition.string.end.ocaml + pop: true + - match: '\\$[ \t]*' + scope: punctuation.separator.string.ignore-eol.ocaml + - match: '\\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\d\d|[bnrt''"\\])' + scope: constant.character.string.escape.ocaml + - match: '\\[\|\(\)1-9$^.*+?\[\]]' + scope: constant.character.regexp.escape.ocaml + - match: '\\(?!(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\d\d|[bnrt''"\\]|[\|\(\)1-9$^.*+?\[\]]|$[ \t]*))(?:.)' + scope: invalid.illegal.character.string.escape + typedefs: + - match: \| + scope: punctuation.separator.variant-definition.ocaml + - include: comments + - match: \( + push: + - meta_scope: meta.paren-group.ocaml + - match: \) + pop: true + - include: typedefs + - match: \bof\b + scope: keyword.other.ocaml + - include: storagetypes + - match: '(?<=\s|\()[''a-z_][a-zA-Z0-9_]*\b' + scope: storage.type.ocaml + - match: '\b((?:[A-Z][a-zA-Z0-9''_]*)(?:\.[A-Z][a-zA-Z0-9''_]+)*)(\.[a-zA-Z0-9''_]+)' + scope: meta.module.type.ocaml + captures: + 1: support.other.module.ocaml + 2: storage.type.module.ocaml + - match: '(\[(>|<)?)' + captures: + 1: punctuation.definition.polymorphic-variant.ocaml + push: + - meta_scope: meta.polymorphic-variant.definition.ocaml + - match: '(\])' + captures: + 1: punctuation.definition.polymorphic-variant.ocaml + pop: true + - include: typedefs + - include: main + - match: \| + scope: punctuation.separator.algebraic-type.ocaml + variables: + - match: \(\) + scope: variable.parameter.unit.ocaml + - include: constants + - include: moduleref + - match: '(~)([a-z][a-zA-Z0-9''_]*)(\s*:\s*)?' + captures: + 1: punctuation.definition.labeled-parameter.ocaml + 2: entity.name.tag.label.ocaml + 3: punctuation.separator.label.ocaml + push: + - meta_scope: variable.parameter.labeled.ocaml + - match: (?=(->|\s)) + pop: true + - include: variables + - match: '(\?)([a-z][a-zA-Z0-9_]*)' + scope: variable.parameter.optional.ocaml + captures: + 1: punctuation.definition.optional-parameter.ocaml + 2: entity.name.tag.label.optional.ocaml + - match: '(\?)(\()([a-z_][a-zA-Z0-9''_]*)\s*(=)' + captures: + 1: punctuation.definition.optional-parameter.ocaml + 2: punctuation.definition.optional-parameter.ocaml + 3: entity.name.tag.label.optional.ocaml + 4: punctuation.separator.optional-parameter-assignment.ocaml + push: + - meta_scope: variable.parameter.optional.ocaml + - match: (\)) + captures: + 1: punctuation.definition.optional-parameter.ocaml + pop: true + - include: main + - match: '(\()(?=(~[a-z][a-zA-Z0-9_]*:|("(\\"|[^"])*")|[^\(\)~"])+(?|:(?![:=])))' + captures: + 1: punctuation.section.type-constraint.ocaml + push: + - meta_scope: meta.parameter.type-constrained.ocaml + - match: (\)) + captures: + 1: punctuation.section.type-constraint.ocaml + pop: true + - match: "(?|:(?![:=]))" + captures: + 1: punctuation.separator.type-constraint.ocaml + push: + - meta_scope: storage.type.ocaml + - match: (?=\)) + pop: true + - match: \( + push: + - meta_scope: meta.paren.group + - match: \) + pop: true + - include: variables + - include: comments + - match: \( + push: + - meta_scope: meta.paren-group.ocaml + - match: \) + pop: true + - include: variables + - match: (\() + captures: + 1: punctuation.definition.tuple.ocaml + push: + - meta_scope: variable.parameter.tuple.ocaml + - match: (\)) + captures: + 1: punctuation.definition.tuple.ocaml + pop: true + - include: matchpatterns + - include: variables + - match: "," + scope: punctuation.separator.tuple.ocaml + - match: '(\{)' + captures: + 1: punctuation.definition.record.ocaml + push: + - meta_scope: variable.parameter.record.ocaml + - match: '(\})' + captures: + 1: punctuation.definition.record.ocaml + pop: true + - include: moduleref + - match: '\b([a-z][a-zA-Z0-9''_]*)\s*(=)' + captures: + 1: entity.name.tag.record.ocaml + 2: punctuation.separator.record.field-assignment.ocaml + push: + - meta_scope: meta.recordfield.match.ocaml + - match: '(;)|(?=\})' + captures: + 1: punctuation.separator.record.ocaml + pop: true + - include: matchpatterns + - include: storagetypes + - match: '\b[a-z_][a-zA-Z0-9''_]*' + scope: variable.parameter.ocaml diff --git a/assets/syntaxes/Packages/OCaml/OCamllex.sublime-syntax b/assets/syntaxes/Packages/OCaml/OCamllex.sublime-syntax new file mode 100644 index 000000000..876104cd6 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/OCamllex.sublime-syntax @@ -0,0 +1,147 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: OCamllex +file_extensions: + - mll +scope: source.ocamllex +contexts: + main: + - match: '^\s*({)' + captures: + 1: punctuation.section.embedded.ocaml.begin.ocamllex + push: + - meta_scope: meta.embedded.ocaml + - match: '^\s*(})' + captures: + 1: punctuation.section.embedded.ocaml.end.ocamllex + pop: true + - include: scope:source.ocaml + - match: '\b(let)\s+([a-z][a-zA-Z0-9''_]*)\s+=' + captures: + 1: keyword.other.pattern-definition.ocamllex + 2: entity.name.type.pattern.stupid-goddamn-hack.ocamllex + push: + - meta_scope: meta.pattern-definition.ocaml + - match: ^(?:\s*let)|(?:\s*(rule|$)) + pop: true + - include: match-patterns + - match: '(rule|and)\s+([a-z][a-zA-Z0-9_]*)\s+(=)\s+(parse)(?=\s*$)|((?" + captures: + 0: punctuation.definition.type-declaration.end.ocamlyacc + pop: true + - include: scope:source.ocaml diff --git a/assets/syntaxes/Packages/OCaml/Snippets/Document.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/Document.sublime-snippet new file mode 100644 index 000000000..071dc0ba4 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/Document.sublime-snippet @@ -0,0 +1,6 @@ + + + doc + source.ocaml + Document + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/For-Loop.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/For-Loop.sublime-snippet new file mode 100644 index 000000000..2f2199da3 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/For-Loop.sublime-snippet @@ -0,0 +1,9 @@ + + + for + source.ocaml + for loop + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/While-Loop.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/While-Loop.sublime-snippet new file mode 100644 index 000000000..a5e694eb3 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/While-Loop.sublime-snippet @@ -0,0 +1,8 @@ + + + while + source.ocaml + while loop + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/begin.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/begin.sublime-snippet new file mode 100644 index 000000000..b61dd64de --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/begin.sublime-snippet @@ -0,0 +1,8 @@ + + + begin + source.ocaml + begin + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/class.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/class.sublime-snippet new file mode 100644 index 000000000..a67e49fa4 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/class.sublime-snippet @@ -0,0 +1,9 @@ + + + class + source.ocaml + class + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/fun.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/fun.sublime-snippet new file mode 100644 index 000000000..ae86f4f45 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/fun.sublime-snippet @@ -0,0 +1,6 @@ + + ${2:body})]]> + fun + source.ocaml + function + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/func.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/func.sublime-snippet new file mode 100644 index 000000000..effcc39f0 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/func.sublime-snippet @@ -0,0 +1,8 @@ + + ${2:expr1} +| ${3:patt2} -> ${4:expr2})]]> + func + source.ocaml + function alt + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/function-label.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/function-label.sublime-snippet new file mode 100644 index 000000000..0c4aea33b --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/function-label.sublime-snippet @@ -0,0 +1,6 @@ + + ${2:body})]]> + ~f + source.ocaml + function label + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/let-in.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/let-in.sublime-snippet new file mode 100644 index 000000000..3d715395b --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/let-in.sublime-snippet @@ -0,0 +1,6 @@ + + + lin + source.ocaml + let in + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/let.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/let.sublime-snippet new file mode 100644 index 000000000..fd985b501 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/let.sublime-snippet @@ -0,0 +1,6 @@ + + + let + source.ocaml + let + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/match-pattern.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/match-pattern.sublime-snippet new file mode 100644 index 000000000..fe17d4de5 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/match-pattern.sublime-snippet @@ -0,0 +1,6 @@ + + $0]]> + | + source.ocaml + match pattern + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/match.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/match.sublime-snippet new file mode 100644 index 000000000..30e7a6193 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/match.sublime-snippet @@ -0,0 +1,8 @@ + + ${3:expr} +| ${4:_} -> ${5:expr2}]]> + match + source.ocaml + match + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/method-(method).sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/method-(method).sublime-snippet new file mode 100644 index 000000000..e520ce8ef --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/method-(method).sublime-snippet @@ -0,0 +1,6 @@ + + + method + source.ocaml + method + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/module-signature.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/module-signature.sublime-snippet new file mode 100644 index 000000000..90624711d --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/module-signature.sublime-snippet @@ -0,0 +1,8 @@ + + + sig + source.ocaml + module signature + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/module-type.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/module-type.sublime-snippet new file mode 100644 index 000000000..dfca626e6 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/module-type.sublime-snippet @@ -0,0 +1,8 @@ + + + mtype + source.ocaml + module type + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/module.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/module.sublime-snippet new file mode 100644 index 000000000..5699bc3a4 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/module.sublime-snippet @@ -0,0 +1,8 @@ + + + module + source.ocaml + module + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/try.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/try.sublime-snippet new file mode 100644 index 000000000..73de1ee92 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/try.sublime-snippet @@ -0,0 +1,9 @@ + + failwith "Unknown"]]> + try + source.ocaml + try + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/type-(type).sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/type-(type).sublime-snippet new file mode 100644 index 000000000..f67684f86 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/type-(type).sublime-snippet @@ -0,0 +1,6 @@ + + + type + source.ocaml + type + diff --git a/assets/syntaxes/Packages/OCaml/Snippets/untitled.sublime-snippet b/assets/syntaxes/Packages/OCaml/Snippets/untitled.sublime-snippet new file mode 100644 index 000000000..838106060 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Snippets/untitled.sublime-snippet @@ -0,0 +1,8 @@ + + + $0 + ) ())]]> + thread + source.ocaml + untitled + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Classes.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Classes.tmPreferences new file mode 100644 index 000000000..e7b52680b --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Classes.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Classes + scope + entity.name.type.class.ocaml + settings + + showInSymbolList + 1 + symbolTransformation + s/^/class: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Exceptions.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Exceptions.tmPreferences new file mode 100644 index 000000000..ab74aee2a --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Exceptions.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Exceptions + scope + entity.name.type.exception.ocaml + settings + + showInSymbolList + 1 + symbolTransformation + s/^/exception: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamllex pattern definition.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamllex pattern definition.tmPreferences new file mode 100644 index 000000000..18db82d79 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamllex pattern definition.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Ocamllex pattern definition + scope + entity.name.type.pattern.stupid-goddamn-hack.ocamllex + settings + + showInSymbolList + 1 + symbolTransformation + s/^/pattern: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamllex pattern references.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamllex pattern references.tmPreferences new file mode 100644 index 000000000..a16847e49 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamllex pattern references.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Ocamllex pattern references + scope + entity.name.type.pattern.reference.stupid-goddamn-hack.ocamllex + settings + + showInSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamllex rules.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamllex rules.tmPreferences new file mode 100644 index 000000000..54f80002d --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamllex rules.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Ocamllex rules + scope + entity.name.function.entrypoint.ocamllex + settings + + showInSymbolList + 1 + symbolTransformation + s/^/entrypoint: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc non-terminal definition.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc non-terminal definition.tmPreferences new file mode 100644 index 000000000..d3aafa26d --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc non-terminal definition.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Ocamlyacc non-terminal definition + scope + entity.name.function.non-terminal.ocamlyacc + settings + + showInSymbolList + 1 + symbolTransformation + s/^/non-terminal: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc non-terminal reference.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc non-terminal reference.tmPreferences new file mode 100644 index 000000000..b1f4897f8 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc non-terminal reference.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Ocamlyacc non-terminal reference + scope + entity.name.function.non-terminal.reference.ocamlyacc + settings + + showInSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc token definition.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc token definition.tmPreferences new file mode 100644 index 000000000..51f884ba7 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc token definition.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Ocamlyacc token definition + scope + entity.name.type.token.ocamlyacc + settings + + showInSymbolList + 1 + symbolTransformation + s/^/token: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc token reference.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc token reference.tmPreferences new file mode 100644 index 000000000..93b103cb6 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Ocamlyacc token reference.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Ocamlyacc token reference + scope + entity.name.type.token.reference.ocamlyacc + settings + + showInSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Types.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Types.tmPreferences new file mode 100644 index 000000000..e334c2bf2 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Types.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Types + scope + storage.type.user-defined.ocaml + settings + + showInSymbolList + 1 + symbolTransformation + s/^/type: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List%3A Variants.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List%3A Variants.tmPreferences new file mode 100644 index 000000000..c01cc472f --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List%3A Variants.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Variants + scope + entity.name.type.variant.ocaml | entity.name.type.variant.polymorphic.ocaml + settings + + showInSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Classes.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Classes.tmPreferences new file mode 100644 index 000000000..e7b52680b --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Classes.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Classes + scope + entity.name.type.class.ocaml + settings + + showInSymbolList + 1 + symbolTransformation + s/^/class: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Exceptions.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Exceptions.tmPreferences new file mode 100644 index 000000000..ab74aee2a --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Exceptions.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Exceptions + scope + entity.name.type.exception.ocaml + settings + + showInSymbolList + 1 + symbolTransformation + s/^/exception: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamllex pattern definition.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamllex pattern definition.tmPreferences new file mode 100644 index 000000000..18db82d79 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamllex pattern definition.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Ocamllex pattern definition + scope + entity.name.type.pattern.stupid-goddamn-hack.ocamllex + settings + + showInSymbolList + 1 + symbolTransformation + s/^/pattern: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamllex pattern references.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamllex pattern references.tmPreferences new file mode 100644 index 000000000..a16847e49 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamllex pattern references.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Ocamllex pattern references + scope + entity.name.type.pattern.reference.stupid-goddamn-hack.ocamllex + settings + + showInSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamllex rules.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamllex rules.tmPreferences new file mode 100644 index 000000000..54f80002d --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamllex rules.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Ocamllex rules + scope + entity.name.function.entrypoint.ocamllex + settings + + showInSymbolList + 1 + symbolTransformation + s/^/entrypoint: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc non-terminal definition.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc non-terminal definition.tmPreferences new file mode 100644 index 000000000..d3aafa26d --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc non-terminal definition.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Ocamlyacc non-terminal definition + scope + entity.name.function.non-terminal.ocamlyacc + settings + + showInSymbolList + 1 + symbolTransformation + s/^/non-terminal: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc non-terminal reference.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc non-terminal reference.tmPreferences new file mode 100644 index 000000000..b1f4897f8 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc non-terminal reference.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Ocamlyacc non-terminal reference + scope + entity.name.function.non-terminal.reference.ocamlyacc + settings + + showInSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc token definition.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc token definition.tmPreferences new file mode 100644 index 000000000..51f884ba7 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc token definition.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Ocamlyacc token definition + scope + entity.name.type.token.ocamlyacc + settings + + showInSymbolList + 1 + symbolTransformation + s/^/token: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc token reference.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc token reference.tmPreferences new file mode 100644 index 000000000..93b103cb6 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Ocamlyacc token reference.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Ocamlyacc token reference + scope + entity.name.type.token.reference.ocamlyacc + settings + + showInSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Types.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Types.tmPreferences new file mode 100644 index 000000000..e334c2bf2 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Types.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Types + scope + storage.type.user-defined.ocaml + settings + + showInSymbolList + 1 + symbolTransformation + s/^/type: / + + + diff --git a/assets/syntaxes/Packages/OCaml/Symbol List_ Variants.tmPreferences b/assets/syntaxes/Packages/OCaml/Symbol List_ Variants.tmPreferences new file mode 100644 index 000000000..c01cc472f --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/Symbol List_ Variants.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List: Variants + scope + entity.name.type.variant.ocaml | entity.name.type.variant.polymorphic.ocaml + settings + + showInSymbolList + 0 + + + diff --git a/assets/syntaxes/Packages/OCaml/camlp4.sublime-syntax b/assets/syntaxes/Packages/OCaml/camlp4.sublime-syntax new file mode 100644 index 000000000..d33b350f1 --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/camlp4.sublime-syntax @@ -0,0 +1,32 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: camlp4 +scope: source.camlp4.ocaml +contexts: + main: + - match: '(\[<)(?=.*?>])' + captures: + 1: punctuation.definition.camlp4-stream.ocaml + push: + - meta_scope: meta.camlp4-stream.ocaml + - match: "(?=>])" + captures: + 1: punctuation.definition.camlp4-stream.ocaml + pop: true + - include: camlpppp-streams + - match: '\[<|>]' + scope: punctuation.definition.camlp4-stream.ocaml + - match: '\bparser\b|<(<|:)|>>|\$(:|\${0,1})' + scope: keyword.other.camlp4.ocaml + camlpppp-streams: + - match: (') + captures: + 1: punctuation.definition.camlp4.simple-element.ocaml + push: + - meta_scope: meta.camlp4-stream.element.ocaml + - match: '(;)(?=\s*'')|(?=\s*>])' + captures: + 1: punctuation.separator.camlp4.ocaml + pop: true + - include: scope:source.ocaml diff --git a/assets/syntaxes/Packages/OCaml/syntax_test_ml.ml b/assets/syntaxes/Packages/OCaml/syntax_test_ml.ml new file mode 100644 index 000000000..a763d28cc --- /dev/null +++ b/assets/syntaxes/Packages/OCaml/syntax_test_ml.ml @@ -0,0 +1,126 @@ +(* SYNTAX TEST "Packages/OCaml/OCaml.sublime-syntax" *) + + let open Core.Std +(*^^^ keyword.other.ocaml *) +(* ^^^^ keyword.control.import.ocaml *) + and open Core.Std in +(*^^^ keyword.other.ocaml *) +(* ^^^^ keyword.control.import.ocaml *) +(* ^^ keyword.other.ocaml *) + + let open s = +(*^^^ keyword.other.function-definition.ocaml *) +(* ^^^^ entity.name.function.ocaml *) +(*^^^^^^^^^^^^ meta.function.ocaml *) + and open s = +(*^^^ keyword.other.function-definition.ocaml *) +(* ^^^^ entity.name.function.ocaml *) +(*^^^^^^^^^^^^ meta.function.ocaml *) + + let open = 5 +(*^^^ keyword.other.ocaml *) +(* ^^^^ variable.other.constant.ocaml *) + + and open = 5 +(*^^^ keyword.other.ocaml *) +(* ^^^^ variable.other.constant.ocaml *) + + +(* Integers *) + + 123_456_789_0n +(* ^^^^^^^^^^^^^^ constant.numeric.integer.decimal *) +(* ^ storage.type.numeric *) + + 0 +(* ^ constant.numeric.integer.decimal *) + + 123 .foo +(* ^^^ constant.numeric.integer.decimal *) +(* ^^^^^^ - constant *) + + +123 + 123 +(* ^ keyword.operator *) +(* ^^^ constant.numeric.integer.decimal - keyword *) +(* ^ keyword.operator *) +(* ^^^ constant.numeric.integer.decimal - keyword *) + + -123 +(* ^^^^ constant.numeric.integer.decimal - keyword *) +(* ^ punctuation.definition.numeric.sign *) + + 0123456789 +(* ^^^^^^^^^^ constant.numeric.integer.decimal *) + + 123xyz +(* ^^^^^^ invalid.illegal.numeric *) + + 0b0110_1001_1001_0110n 0b_10_01 +(* ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ storage.type.numeric *) +(* ^^^^^^^^ constant.numeric.integer.binary *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ invalid.illegal.numeric *) + + 0o0123_4567n 0O_127 +(* ^^^^^^^^^^^^ constant.numeric.integer.octal *) +(* ^^ punctuation.definition.numeric *) +(* ^ storage.type.numeric *) +(* ^^^^^^ constant.numeric.integer.octal *) +(* ^^ punctuation.definition.numeric *) +(* ^ invalid.illegal.numeric *) + + 0x01_23_45_67_89_ab_CD_efn 0X_01l +(* ^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ storage.type.numeric *) +(* ^^^^^^ constant.numeric.integer.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ invalid.illegal.numeric *) +(* ^ storage.type.numeric *) + + 0b +(* ^^ constant.numeric.integer.binary punctuation.definition.numeric.base *) + + 0B0 0O0 0X0 +(* ^^^ constant.numeric.integer.binary *) +(* ^^^ constant.numeric.integer.octal *) +(* ^^^ constant.numeric.integer.hexadecimal *) + + 0xa. 0xa.b 0xa.ep1 0xa.ep-_1 +(* ^^^^ constant.numeric.float.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ punctuation.separator.decimal *) +(* ^^^^^ constant.numeric.float.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ punctuation.separator.decimal *) +(* ^^^^^^^ constant.numeric.float.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ punctuation.separator.decimal *) +(* ^^^^^^^^^ constant.numeric.float.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ punctuation.separator.decimal *) +(* ^ invalid.illegal.numeric *) + + 0b1.foo +(* ^^^^^^^ invalid.illegal.numeric *) + + 0b1.0 +(* ^^^^^ invalid.illegal.numeric *) + + 0b123 +(* ^^^^^ invalid.illegal.numeric *) + + +(* Floats *) + + 1_234_567_890.123_456_789_0 +(* ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal *) + + 12345e6_7_8 +(* ^^^^^^^^^^^ constant.numeric.float.decimal *) + + 123.456e+789 +(* ^^^^^^^^^^^^ constant.numeric.float.decimal *) +(* ^ punctuation.separator.decimal *) diff --git a/assets/syntaxes/Packages/Objective-C/Default.sublime-keymap b/assets/syntaxes/Packages/Objective-C/Default.sublime-keymap new file mode 100644 index 000000000..fab1fb969 --- /dev/null +++ b/assets/syntaxes/Packages/Objective-C/Default.sublime-keymap @@ -0,0 +1,41 @@ +[ + // Auto-pair less-than and greater-than symbols in include statements + { "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<$0>"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, + { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.other - punctuation.definition.string.end", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "(source.objc | source.objc++) & meta.preprocessor.include" } + ] + }, + { "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${0:$SELECTION}>"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "(source.objc | source.objc++) & meta.preprocessor.include" } + ] + }, + { "keys": [">"], "command": "move", "args": {"by": "characters", "forward": true}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.other - punctuation.definition.string.end", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "(source.objc | source.objc++) & meta.preprocessor.include" } + ] + }, + { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.other - punctuation.definition.string.end", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "(source.objc | source.objc++) & meta.preprocessor.include" } + ] + }, +] diff --git a/assets/syntaxes/Packages/Objective-C/Objective-C++.sublime-syntax b/assets/syntaxes/Packages/Objective-C/Objective-C++.sublime-syntax new file mode 100644 index 000000000..26b5cf4d3 --- /dev/null +++ b/assets/syntaxes/Packages/Objective-C/Objective-C++.sublime-syntax @@ -0,0 +1,2150 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Objective-C++ +file_extensions: + - mm + - M + - h +scope: source.objc++ +variables: + identifier: \b[[:alpha:]_][[:alnum:]_]*\b # upper and lowercase + macro_identifier: \b[[:upper:]_][[:upper:][:digit:]_]{2,}\b # only uppercase, at least 3 chars + path_lookahead: '(?:::\s*)?(?:{{identifier}}\s*::\s*)*(?:template\s+)?{{identifier}}' + operator_method_name: '\boperator\s*(?:[-+*/%ˆ&|~!=<>]|[-+*/%^&|=!<>]=|<<=?|>>=?|&&|\|\||\+\+|--|,|->\*?|\(\)|\[\]|""\s*{{identifier}})' + casts: 'const_cast|dynamic_cast|reinterpret_cast|static_cast' + operator_keywords: 'and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|xor|xor_eq|noexcept' + control_keywords: 'break|case|catch|continue|default|do|else|for|goto|if|_Pragma|return|switch|throw|try|while' + memory_operators: 'new|delete' + basic_types: 'asm|__asm__|auto|bool|_Bool|char|_Complex|double|float|_Imaginary|int|long|short|signed|unsigned|void' + before_tag: 'struct|union|enum\s+class|enum\s+struct|enum|class' + declspec: '__declspec\(\s*\w+(?:\([^)]+\))?\s*\)' + storage_classes: 'static|export|extern|friend|explicit|virtual|register|thread_local' + type_qualifier: 'const|constexpr|mutable|typename|volatile' + compiler_directive: 'inline|restrict|__restrict__|__restrict' + visibility_modifiers: 'private|protected|public' + other_keywords: 'typedef|nullptr|{{visibility_modifiers}}|static_assert|sizeof|using|typeid|alignof|alignas|namespace|template' + modifiers: '{{storage_classes}}|{{type_qualifier}}|{{compiler_directive}}' + non_angle_brackets: '(?=<<|<=)' + + regular: '[^(){}&;*^%=<>-]*' + regular_plus: '[^(){}&;*^%=<>-]+' + paren_open: (?:\( + paren_close: '\))?' + generic_open: (?:{{regular_plus}}(?:< + generic_close: '>)?)?' + balance_parentheses: '{{regular}}{{paren_open}}{{regular}}{{paren_close}}{{regular}}' + generic_lookahead: <{{generic_open}}{{generic_open}}{{regular}}{{generic_close}}\s*{{generic_close}}{{balance_parentheses}}> + + data_structures_forward_decl_lookahead: '(\s+{{macro_identifier}})*\s*(:\s*({{path_lookahead}}|{{visibility_modifiers}}|,|\s|<[^;]*>)+)?;' + non_func_keywords: 'if|for|switch|while|decltype|sizeof|__declspec|__attribute__|typeid|alignof|alignas|static_assert' + +contexts: + main: + - include: preprocessor-global + - include: global + + ## Common context layout + + global: + - include: preprocessor-expressions + - match: '(?=\btemplate\b)' + push: + - include: template + - match: (?=\S) + set: global-modifier + - include: using-namespace + - include: namespace + - include: keywords-angle-brackets + - match: '(?={{path_lookahead}}\s*<)' + push: global-modifier + - include: objc-structures + # Take care of comments just before a function definition. + - match: /\* + scope: punctuation.definition.comment.c + push: + - - match: \s*(?=\w) + set: global-modifier + - match: "" + pop: true + - - meta_scope: comment.block.c + - match: \*/ + scope: punctuation.definition.comment.c + pop: true + - include: early-expressions + - match: ^\s*\b(extern)(?=\s+"C(\+\+)?") + scope: storage.modifier.objc++ + push: + - include: comments + - include: strings + - match: '\{' + scope: punctuation.section.block.begin.objc++ + set: + - meta_scope: meta.extern-c.objc++ + - match: '^\s*(#\s*ifdef)\s*__cplusplus\s*' + scope: meta.preprocessor.objc++ + captures: + 1: keyword.control.import.objc++ + set: + - match: '\}' + scope: punctuation.section.block.end.objc++ + pop: true + - include: preprocessor-global + - include: global + - match: '\}' + scope: punctuation.section.block.end.objc++ + pop: true + - include: preprocessor-global + - include: global + - match: (?=\S) + set: global-modifier + - match: ^\s*(?=\w) + push: global-modifier + - include: late-expressions + + statements: + - include: preprocessor-statements + - include: preprocessor-expressions + - include: scope:source.c#label + - include: expressions + + expressions: + - include: early-expressions + - include: late-expressions + + early-expressions: + - include: early-expressions-before-generic-type + - include: generic-type + - include: early-expressions-after-generic-type + + early-expressions-before-generic-type: + - include: comments + - include: case-default + - include: using-namespace + - include: typedef + - include: using-alias + - include: keywords-angle-brackets + - include: keywords-parens + - include: keywords + - include: numbers + # Prevent a '<' from getting scoped as the start of another template + # parameter list, if in reality a less-than-or-equals sign is meant. + - match: <= + scope: keyword.operator.comparison.c + + early-expressions-after-generic-type: + - include: members-arrow + - include: operators + - include: members-dot + - include: strings + - include: parens + - include: block + - include: variables + - include: constants + - match: ',' + scope: punctuation.separator.objc++ + - match: '\)|\}' + scope: invalid.illegal.stray-bracket-end.objc++ + - include: bracketed-content + - include: brackets + + expressions-minus-generic-type: + - include: early-expressions-before-generic-type + - include: angle-brackets + - include: early-expressions-after-generic-type + - include: late-expressions + + expressions-minus-generic-type-function-call: + - include: early-expressions-before-generic-type + - include: angle-brackets + - include: early-expressions-after-generic-type + - include: late-expressions-before-function-call + - include: scope:source.c++#identifiers + - match: ';' + scope: punctuation.terminator.objc++ + + late-expressions: + - include: late-expressions-before-function-call + - include: function-call + - include: scope:source.c++#identifiers + - match: ';' + scope: punctuation.terminator.objc++ + + late-expressions-before-function-call: + - include: scope:source.c++#unique-late-expressions + - include: modifiers-parens + - include: modifiers + - include: types + + expressions-minus-function-call: + - include: early-expressions + - include: late-expressions-before-function-call + - include: scope:source.c++#identifiers + - match: ';' + scope: punctuation.terminator.objc++ + + comments: + - include: scope:source.c#comments + + operators: + - include: scope:source.c#operators + + modifiers: + - include: scope:source.objc#unique-modifiers + - include: scope:source.c++#unique-modifiers + - include: scope:source.c#modifiers + + variables: + - include: scope:source.objc#unique-variables + - include: scope:source.c++#unique-variables + - include: scope:source.c#variables + + constants: + - include: scope:source.objc#unique-constants + - match: '(?=\bNS\w+\b)' + push: scope:source.objc#ns-identifiers + - include: scope:source.c++#unique-constants + - include: scope:source.c#constants + + keywords: + - include: scope:source.objc#unique-keywords + - include: scope:source.c++#unique-keywords + - include: scope:source.c#keywords + + types: + - include: scope:source.objc#unique-types + - match: '(?=\bNS\w+\b)' + push: scope:source.objc#ns-identifiers + - include: scope:source.c++#unique-types + - include: types-parens + - include: scope:source.c#types + + strings: + - include: scope:source.objc#unique-strings + - include: scope:source.c++#unique-strings + - include: scope:source.c#strings + + numbers: + - include: scope:source.c++#numbers + + ########################################## + # Directly from Objective-C.sublime-syntax + ########################################## + + bracketed-content: + - match: '(\[)\s*(?={{identifier}}\s+[^\s,])' + captures: + 1: punctuation.section.scope.begin.objc++ + push: + - meta_scope: meta.bracketed.objc++ + - match: '\]' + scope: punctuation.section.scope.end.objc++ + pop: true + - match: \s*(NSPredicate)\s+(predicateWithFormat(:)) + captures: + 1: support.class.cocoa.objc++ + 2: support.function.any-method.objc++ + 3: punctuation.separator.arguments.objc++ + push: + - meta_scope: meta.function-call.predicate.objc++ + - include: scope:source.objc#ns-predicate + - include: expressions + - match: '\s+(\w+)(?=\s*\])' + captures: + 1: support.function.any-method.objc++ + - match: '\s+(\w+(:))' + captures: + 1: support.function.any-method.objc++ + 2: punctuation.separator.arguments.objc++ + push: + - meta_scope: meta.function-call.objc++ + - match: '(?=\])' + pop: true + - match: \b\w+(:) + scope: support.function.any-method.name-of-parameter.objc++ + captures: + 1: punctuation.separator.arguments.objc++ + - include: expressions + - include: expressions + + objc-structures: + - match: '((@)(interface|protocol))(?!.+;)\s+([[:alpha:]_][[:alnum:]_]*)\s*((:)(?:\s*)([[:alpha:]][[:alnum:]]*))?(\s|\n)?' + captures: + 1: storage.type.objc++ + 2: punctuation.definition.storage.type.objc++ + 4: entity.name.type.objc++ + 6: punctuation.definition.entity.other.inherited-class.objc++ + 7: entity.other.inherited-class.objc++ + 8: meta.divider.objc++ + 9: meta.inherited-class.objc++ + push: + - meta_scope: meta.interface-or-protocol.objc++ + - meta_content_scope: meta.scope.interface.objc++ + - match: ((@)end)\b + captures: + 1: storage.type.objc++ + 2: punctuation.definition.storage.type.objc++ + pop: true + - include: preprocessor-objc-structures + - include: objc-structure-body + - match: '((@)(implementation))\s+([[:alpha:]_][[:alnum:]_]*)\s*(?::\s*([[:alpha:]][[:alnum:]]*))?' + captures: + 1: storage.type.objc++ + 2: punctuation.definition.storage.type.objc++ + 4: entity.name.type.objc++ + 5: entity.other.inherited-class.objc++ + push: + - meta_scope: meta.implementation.objc++ + - meta_content_scope: meta.scope.implementation.objc++ + - match: ((@)end)\b + captures: + 1: storage.type.objc++ + 2: punctuation.definition.storage.type.objc++ + pop: true + - include: preprocessor-objc-structures + - include: objc-structure-body + + objc-structure-body: + - include: scope:source.objc#properties + - include: scope:source.objc#protocol_list + - include: method + - include: expressions + + method: + - match: ^(-|\+)\s* + push: + - meta_scope: meta.function.objc++ + - match: '\{' + scope: punctuation.section.block.begin.objc++ + set: + - meta_scope: meta.block.objc++ + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: (?=@end\b) + pop: true + - match: '\}' + scope: punctuation.section.block.end.objc++ + pop: true + - include: statements + - match: '(?=#|@end|;)' + pop: true + - match: '\(' + scope: meta.return-type.objc++ punctuation.definition.type.objc++ + push: + - meta_scope: meta.return-type.objc++ + - match: (\))\s*(\w+\b) + captures: + 1: punctuation.definition.type.objc++ + 2: entity.name.function.objc++ + pop: true + - include: scope:source.objc#protocol_list + - include: scope:source.objc#protocol_type_qualifier + - include: expressions + - match: \b\w+(?=:) + scope: entity.name.function.name-of-parameter.objc++ + - match: ((:))\s*(\() + captures: + 1: entity.name.function.name-of-parameter.objc++ + 2: punctuation.separator.arguments.objc++ + 3: punctuation.definition.type.objc++ + push: + - meta_scope: meta.argument-type.objc++ + - match: (\))\s*(\w+\b)? + captures: + 1: punctuation.definition.type.objc++ + 2: variable.parameter.function.objc++ + pop: true + - include: scope:source.objc#protocol_list + - include: scope:source.objc#protocol_type_qualifier + - include: expressions + - include: comments + - match: '(,)\s+(\.\.\.)\s*' + captures: + 1: punctuation.separator.objc++ + 2: keyword.operator.variadic.objc++ + push: + - include: scope:source.c#function-call + - match: '(?=\S)' + pop: true + + ## Preprocessor for objc-structures + + preprocessor-objc-structures: + - include: preprocessor-rule-enabled-objc-structures + - include: preprocessor-rule-disabled-objc-structures + + preprocessor-rule-disabled-objc-structures: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.objc++ + 2: keyword.control.import.objc++ + 3: constant.numeric.integer.decimal.objc++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.else.objc++ + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: objc-structure-body + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.objc++ + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-objc-structures: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.objc++ + 2: keyword.control.import.objc++ + 3: constant.numeric.integer.decimal.objc++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.else.objc++ + push: + - meta_content_scope: comment.block.preprocessor.else-branch.objc++ + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: objc-structure-body + + ################################## + # Directly from C++.sublime-syntax + ################################## + + case-default: + - match: '\b(default|case)\b' + scope: keyword.control.objc++ + push: + - match: (?=[);,]) + pop: true + - match: ':' + scope: punctuation.separator.objc++ + pop: true + - include: expressions + + modifiers-parens: + - match: '\b(alignas)\b\s*(\()' + captures: + 1: storage.modifier.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + push: + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - match: \b(__attribute__)\s*(\(\() + captures: + 1: storage.modifier.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + push : + - meta_scope: meta.attribute.objc++ + - meta_content_scope: meta.group.objc++ + - include: parens + - include: strings + - match: \)\) + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - match: \b(__declspec)(\() + captures: + 1: storage.modifier.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + push: + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - match: '\b(align|allocate|code_seg|deprecated|property|uuid)\b\s*(\()' + captures: + 1: storage.modifier.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + push: + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: numbers + - include: strings + - match: \b(get|put)\b + scope: variable.parameter.objc++ + - match: ',' + scope: punctuation.separator.objc++ + - match: '=' + scope: keyword.operator.assignment.objc++ + - match: '\b(appdomain|deprecated|dllimport|dllexport|jintrinsic|naked|noalias|noinline|noreturn|nothrow|novtable|process|restrict|safebuffers|selectany|thread)\b' + scope: constant.other.objc++ + + types-parens: + - match: '\b(decltype)\b\s*(\()' + captures: + 1: storage.type.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + push: + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + + keywords-angle-brackets: + - match: \b({{casts}})\b\s* + scope: keyword.operator.word.cast.objc++ + push: + - match: '>' + scope: punctuation.section.generic.end.objc++ + pop: true + - match: '<' + scope: punctuation.section.generic.begin.objc++ + push: + - match: '(?=>)' + pop: true + - include: expressions-minus-generic-type-function-call + + keywords-parens: + - match: '\b(alignof|typeid|static_assert|sizeof)\b\s*(\()' + captures: + 1: keyword.operator.word.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + push: + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + + using-namespace: + - match: '\b(using)\s+(namespace)\b' + captures: + 1: keyword.control.objc++ + 2: keyword.control.objc++ + push: + - include: scope:source.c++#identifiers + - match: '' + pop: true + + namespace: + - match: '\b(namespace)\s+(?=({{path_lookahead}})?(?!\s*[;,]))' + scope: meta.namespace.objc++ + captures: + 1: keyword.control.objc++ + push: + - meta_content_scope: meta.namespace.objc++ entity.name.namespace.objc++ + - include: scope:source.c++#identifiers + - match: '' + set: + - meta_scope: meta.namespace.objc++ + - include: comments + - match: '=' + scope: keyword.operator.alias.objc++ + - match: '(?=;)' + pop: true + - match: '\}' + scope: meta.block.objc++ punctuation.section.block.end.objc++ + pop: true + - match: '\{' + scope: punctuation.section.block.begin.objc++ + push: + - meta_scope: meta.block.objc++ + - match: '(?=\})' + pop: true + - include: preprocessor-global + - include: global + - include: expressions + + template-common: + # Exit the template scope if we hit some basic invalid characters. This + # helps when a user is in the middle of typing their template types and + # prevents re-highlighting the whole file until the next > is found. + - match: (?=[{};]) + pop: true + - include: expressions + + template: + - match: \btemplate\b + scope: storage.type.template.objc++ + push: + - meta_scope: meta.template.objc++ + # Explicitly include comments here at the top, in order to NOT match the + # \S lookahead in the case of comments. + - include: comments + - match: < + scope: punctuation.section.generic.begin.objc++ + set: + - meta_content_scope: meta.template.objc++ + - match: '>' + scope: meta.template.objc++ punctuation.section.generic.end.objc++ + pop: true + - match: \.{3} + scope: keyword.operator.variadic.objc++ + - match: \b(typename|{{before_tag}})\b + scope: storage.type.objc++ + - include: template # include template here for nested templates + - include: template-common + - match: (?=\S) + set: + - meta_content_scope: meta.template.objc++ + - match: \b({{before_tag}})\b + scope: storage.type.objc++ + - include: template-common + + generic-type: + - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}}\s*(\(|\{))' + push: + - meta_scope: meta.function-call.objc++ + - match: \btemplate\b + scope: storage.type.template.objc++ + - match: (?:(::)\s*)?({{identifier}})\s*(<) + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: variable.function.objc++ + 3: punctuation.section.generic.begin.objc++ + push: + - match: '>' + scope: punctuation.section.generic.end.objc++ + pop: true + - include: expressions-minus-generic-type-function-call + - match: (?:(::)\s*)?({{identifier}})\s*(\() + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: variable.function.objc++ + 3: punctuation.section.group.begin.objc++ + set: + - meta_scope: meta.function-call.objc++ + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - match: (?:(::)\s*)?({{identifier}})\s*(\{) + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: variable.function.objc++ + 3: punctuation.section.group.begin.objc++ + set: + - meta_scope: meta.function-call.objc++ + - meta_content_scope: meta.group.objc++ + - match: '\}' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - include: scope:source.c++#identifiers + - include: angle-brackets + - match: '\(' + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_scope: meta.function-call.objc++ + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - match: '\{' + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_scope: meta.function-call.objc++ + - meta_content_scope: meta.group.objc++ + - match: '\}' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}})' + push: + - include: scope:source.c++#identifiers + - match: '<' + scope: punctuation.section.generic.begin.objc++ + set: + - match: '>' + scope: punctuation.section.generic.end.objc++ + pop: true + - include: expressions-minus-generic-type-function-call + + angle-brackets: + - match: '<(?!<)' + scope: punctuation.section.generic.begin.objc++ + push: + - match: '>' + scope: punctuation.section.generic.end.objc++ + pop: true + - include: expressions-minus-generic-type-function-call + + block: + - match: '\{' + scope: punctuation.section.block.begin.objc++ + push: + - meta_scope: meta.block.objc++ + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '\}' + scope: punctuation.section.block.end.objc++ + pop: true + - include: statements + + function-call: + - match: (?={{path_lookahead}}\s*(\(|\{)) + push: + - meta_scope: meta.function-call.objc++ + - include: scope:source.c#c99 + - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: punctuation.accessor.double-colon.objc++ + - match: '(?:(::)\s*)?({{identifier}})' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: variable.function.objc++ + - match: '\(' + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_scope: meta.function-call.objc++ + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - match: '\{' + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_content_scope: meta.function-call.objc++ meta.group.objc++ + - match: '\}' + scope: meta.function-call.objc++ meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + + members-inside-function-call: + - meta_content_scope: meta.method-call.objc++ meta.group.objc++ + - match: \) + scope: meta.method-call.objc++ meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + + members-after-accessor-junction: + # After we've seen an accessor (dot or arrow), this context decides what + # kind of entity we're accessing. + - include: comments + - match: \btemplate\b + scope: meta.method-call.objc++ storage.type.template.objc++ + # Guaranteed to be a template member function call after we match this + set: + - meta_content_scope: meta.method-call.objc++ + - include: comments + - match: '{{identifier}}' + scope: variable.function.member.objc++ + set: + - meta_content_scope: meta.method-call.objc++ + - match: \( + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: members-inside-function-call + - include: comments + - include: angle-brackets + - match: (?=\S) # safety pop + pop: true + - match: (?=\S) # safety pop + pop: true + # Non-templated member function call + - match: (~?{{identifier}})\s*(\() + captures: + 0: meta.method-call.objc++ + 1: variable.function.member.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + set: members-inside-function-call + # Templated member function call + - match: (~?{{identifier}})\s*(?={{generic_lookahead}}) + captures: + 1: variable.function.member.objc++ + set: + - meta_scope: meta.method-call.objc++ + - match: < + scope: punctuation.section.generic.begin.objc++ + set: + - meta_content_scope: meta.method-call.objc++ + - match: '>' + scope: punctuation.section.generic.end.objc++ + set: + - meta_content_scope: meta.method-call.objc++ + - include: comments + - match: \( + scope: punctuation.section.group.begin.objc++ + set: members-inside-function-call + - match: (?=\S) # safety pop + pop: true + - include: expressions + # Explicit base-class access + - match: ({{identifier}})\s*(::) + captures: + 1: variable.other.base-class.objc++ + 2: punctuation.accessor.double-colon.objc++ + set: members-after-accessor-junction # reset + # Just a regular member variable + - match: '{{identifier}}' + scope: variable.other.readwrite.member.objc++ + pop: true + + members-dot: + - include: scope:source.c#access-illegal + # No lookahead required because members-dot goes after operators in the + # early-expressions-after-generic-type context. This means triple dots + # (i.e. "..." or "variadic") is attempted first. + - match: \. + scope: punctuation.accessor.dot.objc++ + push: members-after-accessor-junction + + members-arrow: + # This needs to be before operators in the + # early-expressions-after-generic-type context because otherwise the "->" + # from the C language will match. + - match: -> + scope: punctuation.accessor.arrow.objc++ + push: members-after-accessor-junction + + using-alias: + # consume keyword if followed by typename + - match: '\b(using)\b(?=\s+typename\b)' + captures: + 1: keyword.control.objc++ + - match: '\b(using)\b\s+({{identifier}})(?!\s*(<|::))' + captures: + 1: keyword.control.objc++ + 2: entity.name.type.using.objc++ + + typedef: + - match: \btypedef\b + scope: storage.type.objc++ + push: + - match: ({{identifier}})?\s*(?=;) + captures: + 1: entity.name.type.typedef.objc++ + pop: true + - match: \b(struct)\s+({{identifier}})\b + captures: + 1: storage.type.objc++ + - include: expressions-minus-generic-type + + parens: + - match: \( + scope: punctuation.section.group.begin.objc++ + push: + - meta_scope: meta.group.objc++ + - match: \) + scope: punctuation.section.group.end.objc++ + pop: true + - include: expressions + + brackets: + - match: \[ + scope: punctuation.section.brackets.begin.objc++ + push: + - meta_scope: meta.brackets.objc++ + - match: \] + scope: punctuation.section.brackets.end.objc++ + pop: true + - include: expressions + + function-trailing-return-type: + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + - include: modifiers-parens + - include: modifiers + - include: scope:source.c++#identifiers + - match: \*|& + scope: keyword.operator.objc++ + - include: function-trailing-return-type-parens + - match: '(?=\S)' + pop: true + + function-trailing-return-type-parens: + - match: \( + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + push: + - meta_scope: meta.group.objc++ + - match: \) + scope: punctuation.section.group.end.objc++ + pop: true + - include: function-trailing-return-type + + ## Detection of function and data structure definitions at the global level + + global-modifier: + - include: comments + - include: modifiers-parens + - include: modifiers + # Constructors and destructors don't have a type + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?\s*::\s*{{identifier}}\s*\()' + set: + - meta_content_scope: meta.function.objc++ meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(?:(::)\s*)?({{identifier}})' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.constructor.objc++ + - match: '(?=[^\w\s])' + set: function-definition-params + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?\s*::\s*~{{identifier}}\s*(\(|$))' + set: + - meta_content_scope: meta.function.objc++ meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(?:(::)\s*)?(~{{identifier}})' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.destructor.objc++ + - match: '(?=[^\w\s])' + set: function-definition-params + # If we see a path ending in :: before a newline, we don't know if it is + # a constructor or destructor, or a long return type, so we are just going + # to treat it like a regular function. Most likely it is a constructor, + # since it doesn't seem most developers would create such a long typename. + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?::\s*$)' + set: + - meta_content_scope: meta.function.objc++ meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(::)\s*$' + captures: + 1: punctuation.accessor.double-colon.objc++ + - match: '(?:(::)\s*)?(~?{{identifier}})(?=\s*\()' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.objc++ + - match: '(?=[^\w\s])' + set: function-definition-params + - include: scope:source.c++#unique-strings + - match: '(?=\S)' + set: global-type + + global-type: + - include: comments + - match: \*|& + scope: keyword.operator.objc++ + - match: '(?=\b({{control_keywords}}|{{operator_keywords}}|{{casts}}|{{memory_operators}}|{{other_keywords}}|operator)\b)' + pop: true + - match: '(?=\s)' + set: global-maybe-function + # If a class/struct/enum followed by a name that is not a macro or declspec + # then this is likely a return type of a function. This is uncommon. + - match: |- + (?x: + ({{before_tag}}) + \s+ + (?= + (?![[:upper:][:digit:]_]+\b|__declspec|{{before_tag}}) + {{path_lookahead}} + (\s+{{identifier}}\s*\(|\s*[*&]) + ) + ) + captures: + 1: storage.type.objc++ + set: + - include: scope:source.c++#identifiers + - match: '' + set: global-maybe-function + # The previous match handles return types of struct/enum/etc from a func, + # there this one exits the context to allow matching an actual struct/class + - match: '(?=\b({{before_tag}})\b)' + set: data-structures + - match: '(?=\b({{casts}})\b\s*<)' + pop: true + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + # Allow a macro call + - match: '({{identifier}})\s*(\()(?=[^\)]+\))' + captures: + 1: variable.function.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + push: + - meta_scope: meta.function-call.objc++ + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - match: '(?={{path_lookahead}}\s*\()' + set: + - include: function-call + - match: '' + pop: true + - include: variables + - include: constants + - include: scope:source.c++#identifiers + - match: (?=\W) + pop: true + + global-maybe-function: + - include: comments + # Consume pointer info, macros and any type info that was offset by macros + - match: \*|& + scope: keyword.operator.objc++ + - match: '(?=\b({{control_keywords}}|{{operator_keywords}}|{{casts}}|{{memory_operators}}|{{other_keywords}})\b)' + pop: true + - match: '\b({{type_qualifier}})\b' + scope: storage.modifier.objc++ + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + - include: modifiers-parens + - include: modifiers + # All uppercase identifier just before a newline is most likely a macro + - match: '[[:upper:][:digit:]_]+\s*$' + # Operator overloading + - match: '(?=({{path_lookahead}}\s*(?:{{generic_lookahead}})?::\s*)?{{operator_method_name}}\s*(\(|$))' + set: + - meta_content_scope: meta.function.objc++ meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(?:(::)\s*)?({{operator_method_name}})(?=\s*\()' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.objc++ + - match: '(?=\s*(\(|$))' + set: function-definition-params + # Identifier that is not the function name - likely a macro or type + - match: '(?={{path_lookahead}}([ \t]+|[*&])(?!\s*(<|::|\(|$)))' + push: + - include: scope:source.c++#identifiers + - match: '' + pop: true + # Real function definition + - match: '(?={{path_lookahead}}({{generic_lookahead}}({{path_lookahead}})?)\s*(\(|$))' + set: [function-definition-params, global-function-identifier-generic] + - match: '(?={{path_lookahead}}\s*(\(|$))' + set: [function-definition-params, global-function-identifier] + - match: '(?={{path_lookahead}}\s*::\s*$)' + set: [function-definition-params, global-function-identifier] + - match: '(?=\S)' + pop: true + + global-function-identifier-generic: + - meta_content_scope: meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(?:(::)\s*)?({{identifier}})(?=\s*(<.*>)?\s*\()' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.objc++ + - match: '(?=\()' + pop: true + + global-function-identifier: + - meta_content_scope: meta.toc-list.full-identifier.objc++ + - match: '(?:(::)\s*)?({{identifier}})(?!\s*(::))' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ + - include: scope:source.c++#identifiers + - match: '(?=\S)' + pop: true + + function-definition-params: + - meta_content_scope: meta.function.objc++ + - include: comments + - match: '(?=\()' + set: + - match: \( + scope: meta.function.parameters.objc++ meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_content_scope: meta.function.parameters.objc++ meta.group.objc++ + - match : \) + scope: punctuation.section.group.end.objc++ + set: function-definition-continue + - match: '\bvoid\b' + scope: storage.type.objc++ + - match: '{{identifier}}(?=\s*(\[|,|\)|=))' + scope: variable.parameter.objc++ + - match: '=' + scope: keyword.operator.assignment.objc++ + push: + - match: '(?=,|\))' + pop: true + - include: expressions-minus-generic-type + - include: scope:source.c#preprocessor-line-continuation + - include: expressions-minus-generic-type + - include: scope:source.c#preprocessor-line-continuation + - match: (?=\S) + pop: true + + function-definition-continue: + - meta_content_scope: meta.function.objc++ + - include: comments + - match: '(?=;)' + pop: true + - match: '->' + scope: punctuation.separator.objc++ + set: function-definition-trailing-return + - include: scope:source.c++#function-specifiers + - match: '=' + scope: keyword.operator.assignment.objc++ + - match: '&' + scope: keyword.operator.objc++ + - match: \b0\b + scope: constant.numeric.integer.decimal.objc++ + - match: \b(default|delete)\b + scope: storage.modifier.objc++ + - match: '(?=\{)' + set: function-definition-body + - match: '(?=\S)' + pop: true + + function-definition-trailing-return: + - include: comments + - match: '(?=;)' + pop: true + - match: '(?=\{)' + set: function-definition-body + - include: scope:source.c++#function-specifiers + - include: function-trailing-return-type + + function-definition-body: + - meta_content_scope: meta.function.objc++ meta.block.objc++ + - match: '\{' + scope: punctuation.section.block.begin.objc++ + set: + - meta_content_scope: meta.function.objc++ meta.block.objc++ + - match: '\}' + scope: meta.function.objc++ meta.block.objc++ punctuation.section.block.end.objc++ + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '(?=({{before_tag}})([^(;]+$|.*\{))' + push: data-structures + - include: statements + + ## Data structures including classes, structs, unions and enums + + data-structures: + - match: '\bclass\b' + scope: storage.type.objc++ + set: data-structures-class-definition + # Detect variable type definitions using struct/enum/union followed by a tag + - match: '\b({{before_tag}})(?=\s+{{path_lookahead}}\s+{{path_lookahead}}\s*[=;\[])' + scope: storage.type.objc++ + - match: '\bstruct\b' + scope: storage.type.objc++ + set: data-structures-struct-definition + - match: '\benum(\s+(class|struct))?\b' + scope: storage.type.objc++ + set: data-structures-enum-definition + - match: '\bunion\b' + scope: storage.type.objc++ + set: data-structures-union-definition + - match: '(?=\S)' + pop: true + + preprocessor-workaround-eat-macro-before-identifier: + # Handle macros so they aren't matched as the class name + - match: ({{macro_identifier}})(?=\s+~?{{identifier}}) + captures: + 1: meta.assumed-macro.c + + data-structures-class-definition: + - meta_scope: meta.class.objc++ + - include: data-structures-definition-common-begin + - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' + scope: entity.name.class.forward-decl.objc++ + set: data-structures-class-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.class.objc++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.class.objc++ + set: data-structures-class-definition-after-identifier + - include: scope:source.c++#identifiers + - match: data-structures-class-definition-after-identifier + - match: '(?=[^\w\s])' + set: data-structures-class-definition-after-identifier + - match: '(?=[:{])' + set: data-structures-class-definition-after-identifier + - match: '(?=;)' + pop: true + + data-structures-class-definition-after-identifier: + - meta_content_scope: meta.class.objc++ + - include: data-structures-definition-common-begin + # No matching of identifiers since they should all be macros at this point + - include: data-structures-definition-common-end + - match: '\{' + scope: meta.block.objc++ punctuation.section.block.begin.objc++ + set: + - meta_content_scope: meta.class.objc++ meta.block.objc++ + - match: '\}' + scope: meta.class.objc++ meta.block.objc++ punctuation.section.block.end.objc++ + pop: true + - include: data-structures-body + + data-structures-struct-definition: + - meta_scope: meta.struct.objc++ + - include: data-structures-definition-common-begin + - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' + scope: entity.name.struct.forward-decl.objc++ + set: data-structures-struct-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.struct.objc++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.struct.objc++ + set: data-structures-struct-definition-after-identifier + - include: scope:source.c++#identifiers + - match: data-structures-struct-definition-after-identifier + - match: '(?=[^\w\s])' + set: data-structures-struct-definition-after-identifier + - match: '(?=[:{])' + set: data-structures-struct-definition-after-identifier + - match: '(?=;)' + pop: true + + data-structures-struct-definition-after-identifier: + - meta_content_scope: meta.struct.objc++ + - include: data-structures-definition-common-begin + # No matching of identifiers since they should all be macros at this point + - include: data-structures-definition-common-end + - match: '\{' + scope: meta.block.objc++ punctuation.section.block.begin.objc++ + set: + - meta_content_scope: meta.struct.objc++ meta.block.objc++ + - match: '\}' + scope: meta.struct.objc++ meta.block.objc++ punctuation.section.block.end.objc++ + pop: true + - include: data-structures-body + + data-structures-enum-definition: + - meta_scope: meta.enum.objc++ + - include: data-structures-definition-common-begin + - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' + scope: entity.name.enum.forward-decl.objc++ + set: data-structures-enum-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.enum.objc++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.enum.objc++ + set: data-structures-enum-definition-after-identifier + - include: scope:source.c++#identifiers + - match: data-structures-enum-definition-after-identifier + - match: '(?=[^\w\s])' + set: data-structures-enum-definition-after-identifier + - match: '(?=[:{])' + set: data-structures-enum-definition-after-identifier + - match: '(?=;)' + pop: true + + data-structures-enum-definition-after-identifier: + - meta_content_scope: meta.enum.objc++ + - include: data-structures-definition-common-begin + # No matching of identifiers since they should all be macros at this point + - include: data-structures-definition-common-end + - match: '\{' + scope: meta.block.objc++ punctuation.section.block.begin.objc++ + set: + - meta_content_scope: meta.enum.objc++ meta.block.objc++ + # Enums don't support methods so we have a simplified body + - match: '\}' + scope: meta.enum.objc++ meta.block.objc++ punctuation.section.block.end.objc++ + pop: true + - include: statements + + data-structures-union-definition: + - meta_scope: meta.union.objc++ + - include: data-structures-definition-common-begin + - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' + scope: entity.name.union.forward-decl.objc++ + set: data-structures-union-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.union.objc++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.union.objc++ + set: data-structures-union-definition-after-identifier + - include: scope:source.c++#identifiers + - match: data-structures-union-definition-after-identifier + - match: '(?=[^\w\s])' + set: data-structures-union-definition-after-identifier + - match: '(?=[{])' + set: data-structures-union-definition-after-identifier + - match: '(?=;)' + pop: true + + data-structures-union-definition-after-identifier: + - meta_content_scope: meta.union.objc++ + - include: data-structures-definition-common-begin + # No matching of identifiers since they should all be macros at this point + # Unions don't support base classes + - include: angle-brackets + - match: '\{' + scope: meta.block.objc++ punctuation.section.block.begin.objc++ + set: + - meta_content_scope: meta.union.objc++ meta.block.objc++ + - match: '\}' + scope: meta.union.objc++ meta.block.objc++ punctuation.section.block.end.objc++ + pop: true + - include: data-structures-body + - match: '(?=;)' + pop: true + + data-structures-definition-common-begin: + - include: comments + - match: '(?=\b(?:{{before_tag}}|{{control_keywords}})\b)' + pop: true + - include: preprocessor-other + - include: modifiers-parens + - include: modifiers + - include: scope:source.c++#preprocessor-workaround-eat-macro-before-identifier + + data-structures-definition-common-end: + - include: angle-brackets + - match: \bfinal\b + scope: storage.modifier.c++ + - match: ':' + scope: punctuation.separator.objc++ + push: + - include: comments + - include: preprocessor-other + - include: modifiers-parens + - include: modifiers + - match: '\b(virtual|{{visibility_modifiers}})\b' + scope: storage.modifier.objc++ + - match: (?={{path_lookahead}}) + push: + - meta_scope: entity.other.inherited-class.objc++ + - include: scope:source.c++#identifiers + - match: '' + pop: true + - include: angle-brackets + - match: ',' + scope: punctuation.separator.objc++ + - match: (?=\{|;) + pop: true + - match: '(?=;)' + pop: true + + data-structures-body: + - include: preprocessor-data-structures + - match: '(?=\btemplate\b)' + push: + - include: template + - match: (?=\S) + set: data-structures-modifier + - include: typedef + - match: \b({{visibility_modifiers}})\s*(:)(?!:) + captures: + 1: storage.modifier.objc++ + 2: punctuation.section.class.objc++ + - match: '^\s*(?=(?:~?\w+|::))' + push: data-structures-modifier + - include: preprocessor-expressions + - include: expressions-minus-generic-type + + data-structures-modifier-friend: + - match: (?=;) + pop: true + - match: '\{' + scope: punctuation.section.block.begin.objc++ + set: + - meta_scope: meta.block.objc++ + - match: '\}' + scope: punctuation.section.block.end.objc++ + pop: true + - include: statements + - include: expressions-minus-function-call + + data-structures-modifier: + - match: '\bfriend\b' + scope: storage.modifier.objc++ + push: + - include: comments + - match: '\b({{before_tag}})\b' + scope: storage.type.objc++ + set: data-structures-modifier-friend + - match: '(?=\S)(?=[^;]+;)' + set: data-structures-modifier-friend + - match: '(?=\S)' + pop: true + - include: comments + - include: modifiers-parens + - include: modifiers + - match: '\bstatic_assert(?=\s*\()' + scope: meta.static-assert.objc++ keyword.operator.word.objc++ + push: + - match: '\(' + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_content_scope: meta.function-call.objc++ meta.group.objc++ + - match: '\)' + scope: meta.function-call.objc++ meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + # Destructor + - match: '(?:{{identifier}}\s*(::)\s*)?~{{identifier}}(?=\s*(\(|$))' + scope: meta.method.destructor.objc++ entity.name.function.destructor.objc++ + captures: + 1: punctuation.accessor.objc++ + set: method-definition-params + # It's a macro, not a constructor if there is no type in the first param + - match: '({{identifier}})\s*(\()(?=\s*(?!void){{identifier}}\s*[),])' + captures: + 1: variable.function.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + push: + - meta_scope: meta.function-call.objc++ + - meta_content_scope: meta.group.objc++ + - match: '\)' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + # Constructor + - include: scope:source.c++#preprocessor-workaround-eat-macro-before-identifier + - match: '((?!{{before_tag}}|template){{identifier}})(?=\s*\()' + scope: meta.method.constructor.objc++ entity.name.function.constructor.objc++ + set: method-definition-params + # Long form constructor + - match: '({{identifier}}\s*(::)\s*{{identifier}})(?=\s*\()' + captures: + 1: meta.method.constructor.objc++ entity.name.function.constructor.objc++ + 2: punctuation.accessor.objc++ + push: method-definition-params + - match: '(?=\S)' + set: data-structures-type + + data-structures-type: + - include: comments + - match: \*|& + scope: keyword.operator.objc++ + # Cast methods + - match: '(operator)\s+({{identifier}})(?=\s*(\(|$))' + captures: + 1: keyword.control.objc++ + 2: meta.method.objc++ entity.name.function.objc++ + set: method-definition-params + - match: '(?=\b({{control_keywords}}|{{operator_keywords}}|{{casts}}|{{memory_operators}}|{{other_keywords}}|operator)\b)' + pop: true + - match: '(?=\s)' + set: data-structures-maybe-method + # If a class/struct/enum followed by a name that is not a macro or declspec + # then this is likely a return type of a function. This is uncommon. + - match: |- + (?x: + ({{before_tag}}) + \s+ + (?= + (?![[:upper:][:digit:]_]+\b|__declspec|{{before_tag}}) + {{path_lookahead}} + (\s+{{identifier}}\s*\(|\s*[*&]) + ) + ) + captures: + 1: storage.type.objc++ + set: + - include: scope:source.c++#identifiers + - match: '' + set: data-structures-maybe-method + # The previous match handles return types of struct/enum/etc from a func, + # there this one exits the context to allow matching an actual struct/class + - match: '(?=\b({{before_tag}})\b)' + set: data-structures + - match: '(?=\b({{casts}})\b\s*<)' + pop: true + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + - include: variables + - include: constants + - include: scope:source.c++#identifiers + - match: (?=[&*]) + set: data-structures-maybe-method + - match: (?=\W) + pop: true + + data-structures-maybe-method: + - include: comments + # Consume pointer info, macros and any type info that was offset by macros + - match: \*|& + scope: keyword.operator.objc++ + - match: '(?=\b({{control_keywords}}|{{operator_keywords}}|{{casts}}|{{memory_operators}}|{{other_keywords}})\b)' + pop: true + - match: '\b({{type_qualifier}})\b' + scope: storage.modifier.objc++ + - match: '{{non_angle_brackets}}' + pop: true + - include: angle-brackets + - include: types + - include: modifiers-parens + - include: modifiers + # Operator overloading + - match: '{{operator_method_name}}(?=\s*(\(|$))' + scope: meta.method.objc++ entity.name.function.objc++ + set: method-definition-params + # Identifier that is not the function name - likely a macro or type + - match: '(?={{path_lookahead}}([ \t]+|[*&])(?!\s*(<|::|\()))' + push: + - include: scope:source.c++#identifiers + - match: '' + pop: true + # Real function definition + - match: '(?={{path_lookahead}}({{generic_lookahead}})\s*(\())' + set: [method-definition-params, data-structures-function-identifier-generic] + - match: '(?={{path_lookahead}}\s*(\())' + set: [method-definition-params, data-structures-function-identifier] + - match: '(?={{path_lookahead}}\s*::\s*$)' + set: [method-definition-params, data-structures-function-identifier] + - match: '(?=\S)' + pop: true + + data-structures-function-identifier-generic: + - include: angle-brackets + - match: '(?={{identifier}})' + push: + - meta_content_scope: entity.name.function.objc++ + - include: scope:source.c++#identifiers + - match: '(?=<)' + pop: true + - match: '(?=\()' + pop: true + + data-structures-function-identifier: + - meta_content_scope: entity.name.function.objc++ + - include: scope:source.c++#identifiers + - match: '(?=\S)' + pop: true + + method-definition-params: + - meta_content_scope: meta.method.objc++ + - include: comments + - match: '(?=\()' + set: + - match: \( + scope: meta.method.parameters.objc++ meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_content_scope: meta.method.parameters.objc++ meta.group.objc++ + - match : \) + scope: punctuation.section.group.end.objc++ + set: method-definition-continue + - match: '\bvoid\b' + scope: storage.type.objc++ + - match: '{{identifier}}(?=\s*(\[|,|\)|=))' + scope: variable.parameter.objc++ + - match: '=' + scope: keyword.operator.assignment.objc++ + push: + - match: '(?=,|\))' + pop: true + - include: expressions-minus-generic-type + - include: expressions-minus-generic-type + - match: '(?=\S)' + pop: true + + method-definition-continue: + - meta_content_scope: meta.method.objc++ + - include: comments + - match: '(?=;)' + pop: true + - match: '->' + scope: punctuation.separator.objc++ + set: method-definition-trailing-return + - include: scope:source.c++#function-specifiers + - match: '=' + scope: keyword.operator.assignment.objc++ + - match: '&' + scope: keyword.operator.objc++ + - match: \b0\b + scope: constant.numeric.integer.decimal.objc++ + - match: \b(default|delete)\b + scope: storage.modifier.objc++ + - match: '(?=:)' + set: + - match: ':' + scope: punctuation.separator.initializer-list.objc++ + set: + - meta_scope: meta.method.constructor.initializer-list.objc++ + - match: '{{identifier}}' + scope: variable.other.readwrite.member.objc++ + push: + - match: \( + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_content_scope: meta.group.objc++ + - match: \) + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - match: \{ + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_content_scope: meta.group.objc++ + - match: \} + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - include: comments + - match: (?=\{|;) + set: method-definition-continue + - include: expressions + - match: '(?=\{)' + set: method-definition-body + - match: '(?=\S)' + pop: true + + method-definition-trailing-return: + - include: comments + - match: '(?=;)' + pop: true + - match: '(?=\{)' + set: method-definition-body + - include: scope:source.c++#function-specifiers + - include: function-trailing-return-type + + method-definition-body: + - meta_content_scope: meta.method.objc++ meta.block.objc++ + - match: '\{' + scope: punctuation.section.block.begin.objc++ + set: + - meta_content_scope: meta.method.objc++ meta.block.objc++ + - match: '\}' + scope: meta.method.objc++ meta.block.objc++ punctuation.section.block.end.objc++ + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '(?=({{before_tag}})([^(;]+$|.*\{))' + push: data-structures + - include: statements + + ## Preprocessor for data-structures + + preprocessor-data-structures: + - include: preprocessor-rule-enabled-data-structures + - include: preprocessor-rule-disabled-data-structures + - include: scope:source.c++#preprocessor-practical-workarounds + + preprocessor-rule-disabled-data-structures: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.objc++ + 2: keyword.control.import.objc++ + 3: constant.numeric.integer.decimal.objc++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.else.objc++ + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: data-structures-body + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.objc++ + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-data-structures: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.objc++ + 2: keyword.control.import.objc++ + 3: constant.numeric.integer.decimal.objc++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.else.objc++ + push: + - meta_content_scope: comment.block.preprocessor.else-branch.objc++ + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: data-structures-body + + ## Preprocessor for global + + preprocessor-global: + - include: preprocessor-rule-enabled-global + - include: preprocessor-rule-disabled-global + - include: preprocessor-rule-other-global + + preprocessor-statements: + - include: preprocessor-rule-enabled-statements + - include: preprocessor-rule-disabled-statements + - include: preprocessor-rule-other-statements + + preprocessor-expressions: + - include: scope:source.c#incomplete-inc + - include: preprocessor-macro-define + - include: scope:source.c#pragma-mark + - include: preprocessor-other + + preprocessor-rule-disabled-global: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.objc++ + 2: keyword.control.import.objc++ + 3: constant.numeric.integer.decimal.objc++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.else.objc++ + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.objc++ + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-global: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.objc++ + 2: keyword.control.import.objc++ + 3: constant.numeric.integer.decimal.objc++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.else.objc++ + push: + - meta_content_scope: comment.block.preprocessor.else-branch.objc++ + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + + preprocessor-rule-other-global: + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: keyword.control.import.objc++ + push: + - meta_scope: meta.preprocessor.objc++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: \bdefined\b + scope: keyword.control.objc++ + # Enter a new scope where all elif/else branches have their + # contexts popped by a subsequent elif/else/endif. This ensures that + # preprocessor branches don't push multiple meta.block scopes on + # the stack, thus messing up the "global" context's detection of + # functions. + - match: $\n + set: preprocessor-if-branch-global + + # These gymnastics here ensure that we are properly handling scope even + # when the preprocessor is used to create different scope beginnings, such + # as a different if/while condition + preprocessor-if-branch-global: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-global + - match: \{ + scope: punctuation.section.block.begin.objc++ + set: preprocessor-block-if-branch-global + - include: preprocessor-global + - include: negated-block + - include: global + + preprocessor-block-if-branch-global: + - meta_scope: meta.block.objc++ + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + set: preprocessor-block-finish-global + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-global + - match: \} + scope: punctuation.section.block.end.objc++ + set: preprocessor-if-branch-global + - include: statements + + preprocessor-block-finish-global: + - meta_scope: meta.block.objc++ + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + set: preprocessor-block-finish-if-branch-global + - match: \} + scope: punctuation.section.block.end.objc++ + pop: true + - include: statements + + preprocessor-block-finish-if-branch-global: + - match: ^\s*(#\s*endif)\b + captures: + 1: keyword.control.import.objc++ + pop: true + - match: \} + scope: punctuation.section.block.end.objc++ + set: preprocessor-if-branch-global + - include: statements + + preprocessor-elif-else-branch-global: + - match: (?=^\s*#\s*(endif)\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + + ## Preprocessor for statements + + preprocessor-rule-disabled-statements: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.objc++ + 2: keyword.control.import.objc++ + 3: constant.numeric.integer.decimal.objc++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.else.objc++ + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: statements + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.objc++ + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-statements: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.objc++ + 2: keyword.control.import.objc++ + 3: constant.numeric.integer.decimal.objc++ + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.else.objc++ + push: + - meta_content_scope: comment.block.preprocessor.else-branch.objc++ + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: statements + + preprocessor-rule-other-statements: + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: keyword.control.import.objc++ + push: + - meta_scope: meta.preprocessor.objc++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: \bdefined\b + scope: keyword.control.objc++ + # Enter a new scope where all elif/else branches have their + # contexts popped by a subsequent elif/else/endif. This ensures that + # preprocessor branches don't push multiple meta.block scopes on + # the stack, thus messing up the "global" context's detection of + # functions. + - match: $\n + set: preprocessor-if-branch-statements + + # These gymnastics here ensure that we are properly handling scope even + # when the preprocessor is used to create different scope beginnings, such + # as a different if/while condition + preprocessor-if-branch-statements: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + pop: true + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-statements + - match: \{ + scope: punctuation.section.block.begin.objc++ + set: preprocessor-block-if-branch-statements + - match: (?=(?!{{non_func_keywords}}){{path_lookahead}}\s*\() + set: preprocessor-if-branch-function-call + - include: negated-block + - include: statements + + preprocessor-if-branch-function-call: + - meta_content_scope: meta.function-call.objc++ + - include: scope:source.c#c99 + - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' + scope: variable.function.objc++ + captures: + 1: punctuation.accessor.objc++ + 2: punctuation.accessor.objc++ + - match: '(?:(::)\s*)?{{identifier}}' + scope: variable.function.objc++ + captures: + 1: punctuation.accessor.objc++ + - match: '\(' + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: preprocessor-if-branch-function-call-arguments + + preprocessor-if-branch-function-call-arguments: + - meta_content_scope: meta.function-call.objc++ meta.group.objc++ + - match : \) + scope: meta.function-call.objc++ meta.group.objc++ punctuation.section.group.end.objc++ + set: preprocessor-if-branch-statements + - match: ^\s*(#\s*(?:elif|else))\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + set: preprocessor-if-branch-statements + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + set: preprocessor-if-branch-function-call-arguments-finish + - include: expressions + + preprocessor-if-branch-function-call-arguments-finish: + - meta_content_scope: meta.function-call.objc++ meta.group.objc++ + - match: \) + scope: meta.function-call.objc++ meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + + preprocessor-block-if-branch-statements: + - meta_scope: meta.block.objc++ + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + set: preprocessor-block-finish-statements + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-statements + - match: \} + scope: punctuation.section.block.end.objc++ + set: preprocessor-if-branch-statements + - include: statements + + preprocessor-block-finish-statements: + - meta_scope: meta.block.objc++ + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + set: preprocessor-block-finish-if-branch-statements + - match: \} + scope: punctuation.section.block.end.objc++ + pop: true + - include: statements + + preprocessor-block-finish-if-branch-statements: + - match: ^\s*(#\s*endif)\b + captures: + 1: keyword.control.import.objc++ + pop: true + - match: \} + scope: meta.block.objc++ punctuation.section.block.end.objc++ + set: preprocessor-if-branch-statements + - include: statements + + preprocessor-elif-else-branch-statements: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: statements + + ## Preprocessor other + + negated-block: + - match: '\}' + scope: punctuation.section.block.end.objc++ + push: + - match: '\{' + scope: punctuation.section.block.begin.objc++ + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - include: statements + + preprocessor-macro-define: + - match: ^\s*(\#\s*define)\b + captures: + 1: meta.preprocessor.macro.objc++ keyword.control.import.define.objc++ + push: + - meta_content_scope: meta.preprocessor.macro.objc++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - match: '({{identifier}})(?=\()' + scope: entity.name.function.preprocessor.objc++ + set: + - match: '\(' + scope: punctuation.section.group.begin.objc++ + set: preprocessor-macro-params + - match: '{{identifier}}' + scope: entity.name.constant.preprocessor.objc++ + set: preprocessor-macro-definition + + preprocessor-macro-params: + - meta_scope: meta.preprocessor.macro.parameters.objc++ meta.group.objc++ + - match: '{{identifier}}' + scope: variable.parameter.objc++ + - match: \) + scope: punctuation.section.group.end.objc++ + set: preprocessor-macro-definition + - match: ',' + scope: punctuation.separator.objc++ + push: + - match: '{{identifier}}' + scope: variable.parameter.objc++ + pop: true + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.objc++ + - match: '(?=\))' + pop: true + - match: (/\*).*(\*/) + scope: comment.block.objc++ + captures: + 1: punctuation.definition.comment.objc++ + 2: punctuation.definition.comment.objc++ + - match: '\S+' + scope: invalid.illegal.unexpected-character.objc++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.objc++ + - match: (/\*).*(\*/) + scope: comment.block.objc++ + captures: + 1: punctuation.definition.comment.objc++ + 2: punctuation.definition.comment.objc++ + - match: $\n + scope: invalid.illegal.unexpected-end-of-line.objc++ + + preprocessor-macro-definition: + - meta_content_scope: meta.preprocessor.macro.objc++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + # Don't define blocks in define statements + - match: '\{' + scope: punctuation.section.block.begin.objc++ + - match: '\}' + scope: punctuation.section.block.end.objc++ + # Captures the namespace macro idiom + - match: '\b(namespace)\s+(?={{path_lookahead}}\s*\{)' + scope: meta.namespace.objc++ + captures: + 1: keyword.control.objc++ + push: + - meta_content_scope: meta.namespace.objc++ entity.name.namespace.objc++ + - include: scope:source.c++#identifiers + - match: '(?=\S)' + pop: true + - include: expressions + + preprocessor-other: + - match: ^\s*(#\s*(?:if|ifdef|ifndef|elif|else|line|pragma|undef))\b + captures: + 1: keyword.control.import.objc++ + push: + - meta_scope: meta.preprocessor.objc++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - match: \bdefined\b + scope: keyword.control.objc++ + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc++ keyword.control.import.objc++ + - match: ^\s*(#\s*(?:error|warning))\b + captures: + 1: keyword.control.import.error.objc++ + push: + - meta_scope: meta.preprocessor.diagnostic.objc++ + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - include: strings + - match: '\S+' + scope: string.unquoted.objc++ + - match: ^\s*(#\s*(?:include|include_next))\b + captures: + 1: keyword.control.import.include.objc++ + push: + - meta_scope: meta.preprocessor.include.objc++ + - include: preprocessor-other-include-common + - match: ^\s*(#\s*import)\b + captures: + 1: keyword.control.import.import.objc++ + push: + - meta_scope: meta.preprocessor.import.objc++ + - include: preprocessor-other-include-common + - include: scope:source.c++#preprocessor-practical-workarounds + + preprocessor-other-include-common: + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - match: '"' + scope: punctuation.definition.string.begin.objc++ + push: + - meta_scope: string.quoted.double.include.objc++ + - match: '"' + scope: punctuation.definition.string.end.objc++ + pop: true + - match: < + scope: punctuation.definition.string.begin.objc++ + push: + - meta_scope: string.quoted.other.lt-gt.include.objc++ + - match: ">" + scope: punctuation.definition.string.end.objc++ + pop: true diff --git a/assets/syntaxes/Packages/Objective-C/Objective-C.sublime-syntax b/assets/syntaxes/Packages/Objective-C/Objective-C.sublime-syntax new file mode 100644 index 000000000..ca8829b1a --- /dev/null +++ b/assets/syntaxes/Packages/Objective-C/Objective-C.sublime-syntax @@ -0,0 +1,1409 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Objective-C +file_extensions: + - m + - h +scope: source.objc + +variables: + identifier: '\b[[:alpha:]_][[:alnum:]_]*\b' + control_keywords: 'break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while' + before_tag: 'struct|union|enum' + common_protocols: '\bNS(GlyphStorage|M(utableCopying|enuItem)|C(hangeSpelling|o(ding|pying|lorPicking(Custom|Default)))|T(oolbarItemValidations|ext(Input|AttachmentCell))|I(nputServ(iceProvider|erMouseTracker)|gnoreMisspelledWords)|Obj(CTypeSerializationCallBack|ect)|D(ecimalNumberBehaviors|raggingInfo)|U(serInterfaceValidations|RL(HandleClient|DownloadDelegate|ProtocolClient|AuthenticationChallengeSender))|Validated(ToobarItem|UserInterfaceItem)|Locking)\b' + non_func_keywords: 'if|for|switch|while|decltype|sizeof|__declspec|__attribute__' + +contexts: + main: + - include: preprocessor-global + - include: global + + ############################################################################# + # Reusable contexts + # + # The follow contexts are currently constructed to be reused in the + # Objetive-C++ syntax. They are specifically constructed to not push into + # sub-contexts, which ensures that Objective-C++ code isn't accidentally + # lexed as plain Objective-C. + # + # The "unique-*" contexts are additions that Objective-C makes over C, and + # thus can be directly reused in Objective-C++ along with contexts from C++ + # and C. + ############################################################################# + + properties: + - match: ((@)property)\s*(\() + captures: + 1: keyword.other.property.objc + 2: punctuation.definition.keyword.objc + 3: punctuation.section.scope.begin.objc + push: + - meta_scope: meta.property-with-attributes.objc + - match: '\)' + scope: punctuation.section.scope.end.objc + pop: true + - match: \b(getter|setter|readonly|readwrite|assign|retain|copy|nonatomic|strong|weak|class|nonnull|nullable|null_unspecified|null_resettable)\b + scope: keyword.other.property.attribute.objc + - match: ',' + scope: punctuation.separator.objc + - match: ((@)property)\b + scope: meta.property.objc + captures: + 1: keyword.other.property.objc + 2: punctuation.definition.keyword.objc + + protocol_list: + - match: '<' + scope: punctuation.section.scope.begin.objc + push: + - meta_scope: meta.protocol-list.objc + - match: '>' + scope: punctuation.section.scope.end.objc + pop: true + - match: '{{common_protocols}}' + scope: support.other.protocol.objc + + protocol_type_qualifier: + - match: \b(in|out|inout|oneway|bycopy|byref)\b + scope: storage.modifier.protocol.objc + + ns-predicate: + - match: '(?=\])' + pop: true + - match: \bargument(?:Array|s)(:) + scope: support.function.any-method.name-of-parameter.objc + captures: + 1: punctuation.separator.arguments.objc + - match: \b\w+(:) + scope: invalid.illegal.unknown-method.objc + captures: + 1: punctuation.separator.arguments.objc + - match: '@"' + scope: punctuation.definition.string.begin.objc + push: + - meta_scope: string.quoted.double.objc + - match: '"' + scope: punctuation.definition.string.end.objc + pop: true + - match: \b(?i:AND|OR|NOT|IN)\b + scope: keyword.operator.logical.predicate.cocoa.objc + - match: \b(?i:ALL|ANY|SOME|NONE)\b + scope: constant.language.predicate.cocoa.objc + - match: \b(?i:NULL|NIL|SELF|TRUE|YES|FALSE|NO|FIRST|LAST|SIZE)\b + scope: constant.language.predicate.cocoa.objc + - match: \b(?i:MATCHES|CONTAINS|BEGINSWITH|ENDSWITH|BETWEEN|LIKE)\b + scope: keyword.operator.comparison.predicate.cocoa.objc + - match: \b(?i:C(ASEINSENSITIVE|I))\b + scope: keyword.other.modifier.predicate.cocoa.objc + - match: \b(?i:ANYKEY|SUBQUERY|CAST|TRUEPREDICATE|FALSEPREDICATE)\b + scope: keyword.other.predicate.cocoa.objc + - match: '\\(\\|[abefnrtv''"?]|[0-3]\d{,2}|[4-7]\d?|x[a-zA-Z0-9]+)' + scope: constant.character.escape.objc + - match: \\. + scope: invalid.illegal.unknown-escape.objc + + unique-strings: + - match: '@"' + scope: punctuation.definition.string.begin.objc + push: + - meta_scope: string.quoted.double.objc + - match: '"' + scope: punctuation.definition.string.end.objc + pop: true + - include: scope:source.c#string_escaped_char + - match: '%@' + scope: constant.other.placeholder.objc + - include: scope:source.c#string_placeholder + + unique-keywords: + - match: (@)(dynamic|synthesize)\b + scope: keyword.other.property.directive.objc + captures: + 1: punctuation.definition.keyword.objc + - match: \b(NS_DURING|NS_HANDLER|NS_ENDHANDLER)\b + scope: keyword.control.macro.objc + - match: (@)(try|catch|finally|throw)\b + scope: keyword.control.exception.objc + captures: + 1: punctuation.definition.keyword.objc + - match: (@)(synchronized)\b + scope: keyword.control.synchronize.objc + captures: + 1: punctuation.definition.keyword.objc + - match: (@)(defs|encode)\b + scope: keyword.other.objc + captures: + 1: punctuation.definition.keyword.objc + + unique-variables: + - match: \b_cmd\b + scope: variable.other.selector.objc + - match: \b(self|super)\b + scope: variable.language.objc + - match: \bNSApp\b + scope: support.variable.foundation + + unique-constants: + - match: \b(YES|NO|Nil|nil)\b + scope: constant.language.objc + + unique-modifiers: + - match: (@)(synchronized|public|private|protected)\b + scope: storage.modifier.objc + captures: + 1: punctuation.definition.storage.modifier.objc + + unique-types: + - match: ((@)selector)\s*(\() + captures: + 1: storage.type.objc + 2: punctuation.definition.storage.type.objc + 3: punctuation.definition.storage.type.objc + push: + - meta_scope: meta.selector.objc + - meta_content_scope: meta.selector.method-name.objc + - match: '\)' + scope: punctuation.definition.storage.type.objc + pop: true + - match: '\b(?:[[:alpha:]_:][[:alnum:]_]*)+' + scope: support.function.any-method.name-of-parameter.objc + captures: + 1: punctuation.separator.arguments.objc + - match: \b(id)\s*(?=<) + captures: + 1: storage.type.objc + push: + - meta_scope: meta.id-with-protocol.objc + - match: '>' + scope: punctuation.section.scope.end.objc + pop: true + - match: '<' + scope: punctuation.section.scope.begin.objc + push: + - meta_scope: meta.protocol-list.objc + - match: '(?=>)' + pop: true + - match: '{{common_protocols}}' + scope: support.other.protocol.objc + - match: \bid\b(\s|\n)? + scope: storage.type.id.objc + - match: \b(IBOutlet|IBAction|BOOL|SEL|id|unichar|IMP|Class)\b + scope: storage.type.objc + - match: (@)(class|protocol)\b + scope: storage.type.objc + captures: + 1: punctuation.definition.storage.type.objc + - match: \bC(I(Sampler|Co(ntext|lor)|Image(Accumulator)?|PlugIn(Registration)?|Vector|Kernel|Filter(Generator|Shape)?)|A(Renderer|MediaTiming(Function)?|BasicAnimation|ScrollLayer|Constraint(LayoutManager)?|T(iledLayer|extLayer|rans(ition|action))|OpenGLLayer|PropertyAnimation|KeyframeAnimation|Layer|A(nimation(Group)?|ction)))\b + scope: support.class.quartz.objc + - match: \bC(G(Float|Point|Size|Rect)|IFormat|AConstraintAttribute)\b + scope: support.type.quartz.objc + + # This context is separate since the regexes are huge and they affect + # compilation speed and caching performance + ns-identifiers: + - match: (\s*)\b(NS(Rect(ToCGRect|FromCGRect)|MakeCollectable|S(tringFromProtocol|ize(ToCGSize|FromCGSize))|Draw(NinePartImage|ThreePartImage)|P(oint(ToCGPoint|FromCGPoint)|rotocolFromString)|EventMaskFromType|Value))\b + captures: + 1: punctuation.whitespace.support.function.cocoa.leopard.objc + 2: support.function.cocoa.leopard.objc + - match: (\s*)\b(NS(R(ound(DownToMultipleOfPageSize|UpToMultipleOfPageSize)|un(CriticalAlertPanel(RelativeToWindow)?|InformationalAlertPanel(RelativeToWindow)?|AlertPanel(RelativeToWindow)?)|e(set(MapTable|HashTable)|c(ycleZone|t(Clip(List)?|F(ill(UsingOperation|List(UsingOperation|With(Grays|Colors(UsingOperation)?))?)?|romString))|ordAllocationEvent)|turnAddress|leaseAlertPanel|a(dPixel|l(MemoryAvailable|locateCollectable))|gisterServicesProvider)|angeFromString)|Get(SizeAndAlignment|CriticalAlertPanel|InformationalAlertPanel|UncaughtExceptionHandler|FileType(s)?|WindowServerMemory|AlertPanel)|M(i(n(X|Y)|d(X|Y))|ouseInRect|a(p(Remove|Get|Member|Insert(IfAbsent|KnownAbsent)?)|ke(R(ect|ange)|Size|Point)|x(Range|X|Y)))|B(itsPer(SampleFromDepth|PixelFromDepth)|e(stDepth|ep|gin(CriticalAlertSheet|InformationalAlertSheet|AlertSheet)))|S(ho(uldRetainWithZone|w(sServicesMenuItem|AnimationEffect))|tringFrom(R(ect|ange)|MapTable|S(ize|elector)|HashTable|Class|Point)|izeFromString|e(t(ShowsServicesMenuItem|ZoneName|UncaughtExceptionHandler|FocusRingStyle)|lectorFromString|archPathForDirectoriesInDomains)|wap(Big(ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(ToHost|LongToHost))|Short|Host(ShortTo(Big|Little)|IntTo(Big|Little)|DoubleTo(Big|Little)|FloatTo(Big|Little)|Long(To(Big|Little)|LongTo(Big|Little)))|Int|Double|Float|L(ittle(ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(ToHost|LongToHost))|ong(Long)?)))|H(ighlightRect|o(stByteOrder|meDirectory(ForUser)?)|eight|ash(Remove|Get|Insert(IfAbsent|KnownAbsent)?)|FSType(CodeFromFileType|OfFile))|N(umberOfColorComponents|ext(MapEnumeratorPair|HashEnumeratorItem))|C(o(n(tainsRect|vert(GlyphsToPackedGlyphs|Swapped(DoubleToHost|FloatToHost)|Host(DoubleToSwapped|FloatToSwapped)))|unt(MapTable|HashTable|Frames|Windows(ForContext)?)|py(M(emoryPages|apTableWithZone)|Bits|HashTableWithZone|Object)|lorSpaceFromDepth|mpare(MapTables|HashTables))|lassFromString|reate(MapTable(WithZone)?|HashTable(WithZone)?|Zone|File(namePboardType|ContentsPboardType)))|TemporaryDirectory|I(s(ControllerMarker|EmptyRect|FreedObject)|n(setRect|crementExtraRefCount|te(r(sect(sRect|ionR(ect|ange))|faceStyleForKey)|gralRect)))|Zone(Realloc|Malloc|Name|Calloc|Fr(omPointer|ee))|O(penStepRootDirectory|ffsetRect)|D(i(sableScreenUpdates|videRect)|ottedFrameRect|e(c(imal(Round|Multiply|S(tring|ubtract)|Normalize|Co(py|mpa(ct|re))|IsNotANumber|Divide|Power|Add)|rementExtraRefCountWasZero)|faultMallocZone|allocate(MemoryPages|Object))|raw(Gr(oove|ayBezel)|B(itmap|utton)|ColorTiledRects|TiledRects|DarkBezel|W(hiteBezel|indowBackground)|LightBezel))|U(serName|n(ionR(ect|ange)|registerServicesProvider)|pdateDynamicServices)|Java(Bundle(Setup|Cleanup)|Setup(VirtualMachine)?|Needs(ToLoadClasses|VirtualMachine)|ClassesF(orBundle|romPath)|ObjectNamedInPath|ProvidesClasses)|P(oint(InRect|FromString)|erformService|lanarFromDepth|ageSize)|E(n(d(MapTableEnumeration|HashTableEnumeration)|umerate(MapTable|HashTable)|ableScreenUpdates)|qual(R(ects|anges)|Sizes|Points)|raseRect|xtraRefCount)|F(ileTypeForHFSTypeCode|ullUserName|r(ee(MapTable|HashTable)|ame(Rect(WithWidth(UsingOperation)?)?|Address)))|Wi(ndowList(ForContext)?|dth)|Lo(cationInRange|g(v|PageSize)?)|A(ccessibility(R(oleDescription(ForUIElement)?|aiseBadArgumentException)|Unignored(Children(ForOnlyChild)?|Descendant|Ancestor)|PostNotification|ActionDescription)|pplication(Main|Load)|vailableWindowDepths|ll(MapTable(Values|Keys)|HashTableObjects|ocate(MemoryPages|Collectable|Object)))))\b + captures: + 1: punctuation.whitespace.support.function.leading.cocoa.objc + 2: support.function.cocoa.objc + - match: \bNS(NotFound|Ordered(Ascending|Descending|Same))\b + scope: support.constant.cocoa.objc + - match: \bNS(MenuDidBeginTracking|ViewDidUpdateTrackingAreas)?Notification\b + scope: support.constant.notification.cocoa.leopard.objc + - match: \bNS(Menu(Did(RemoveItem|SendAction|ChangeItem|EndTracking|AddItem)|WillSendAction)|S(ystemColorsDidChange|plitView(DidResizeSubviews|WillResizeSubviews))|C(o(nt(extHelpModeDid(Deactivate|Activate)|rolT(intDidChange|extDid(BeginEditing|Change|EndEditing)))|lor(PanelColorDidChange|ListDidChange)|mboBox(Selection(IsChanging|DidChange)|Will(Dismiss|PopUp)))|lassDescriptionNeededForClass)|T(oolbar(DidRemoveItem|WillAddItem)|ext(Storage(DidProcessEditing|WillProcessEditing)|Did(BeginEditing|Change|EndEditing)|View(DidChange(Selection|TypingAttributes)|WillChangeNotifyingTextView))|ableView(Selection(IsChanging|DidChange)|ColumnDid(Resize|Move)))|ImageRepRegistryDidChange|OutlineView(Selection(IsChanging|DidChange)|ColumnDid(Resize|Move)|Item(Did(Collapse|Expand)|Will(Collapse|Expand)))|Drawer(Did(Close|Open)|Will(Close|Open))|PopUpButton(CellWillPopUp|WillPopUp)|View(GlobalFrameDidChange|BoundsDidChange|F(ocusDidChange|rameDidChange))|FontSetChanged|W(indow(Did(Resi(ze|gn(Main|Key))|M(iniaturize|ove)|Become(Main|Key)|ChangeScreen(|Profile)|Deminiaturize|Update|E(ndSheet|xpose))|Will(M(iniaturize|ove)|BeginSheet|Close))|orkspace(SessionDid(ResignActive|BecomeActive)|Did(Mount|TerminateApplication|Unmount|PerformFileOperation|Wake|LaunchApplication)|Will(Sleep|Unmount|PowerOff|LaunchApplication)))|A(ntialiasThresholdChanged|ppl(ication(Did(ResignActive|BecomeActive|Hide|ChangeScreenParameters|U(nhide|pdate)|FinishLaunching)|Will(ResignActive|BecomeActive|Hide|Terminate|U(nhide|pdate)|FinishLaunching))|eEventManagerWillProcessFirstEvent)))Notification\b + scope: support.constant.notification.cocoa.objc + - match: \bNS(RuleEditor(RowType(Simple|Compound)|NestingMode(Si(ngle|mple)|Compound|List))|GradientDraws(BeforeStartingLocation|AfterEndingLocation)|M(inusSetExpressionType|a(chPortDeallocate(ReceiveRight|SendRight|None)|pTable(StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality)))|B(oxCustom|undleExecutableArchitecture(X86|I386|PPC(64)?)|etweenPredicateOperatorType|ackgroundStyle(Raised|Dark|L(ight|owered)))|S(tring(DrawingTruncatesLastVisibleLine|EncodingConversion(ExternalRepresentation|AllowLossy))|ubqueryExpressionType|p(e(ech(SentenceBoundary|ImmediateBoundary|WordBoundary)|llingState(GrammarFlag|SpellingFlag))|litViewDividerStyleThi(n|ck))|e(rvice(RequestTimedOutError|M(iscellaneousError|alformedServiceDictionaryError)|InvalidPasteboardDataError|ErrorM(inimum|aximum)|Application(NotFoundError|LaunchFailedError))|gmentStyle(Round(Rect|ed)|SmallSquare|Capsule|Textured(Rounded|Square)|Automatic)))|H(UDWindowMask|ashTable(StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality))|N(oModeColorPanel|etServiceNoAutoRename)|C(hangeRedone|o(ntainsPredicateOperatorType|l(orRenderingIntent(RelativeColorimetric|Saturation|Default|Perceptual|AbsoluteColorimetric)|lectorDisabledOption))|ellHit(None|ContentArea|TrackableArea|EditableTextArea))|T(imeZoneNameStyle(S(hort(Standard|DaylightSaving)|tandard)|DaylightSaving)|extFieldDatePickerStyle|ableViewSelectionHighlightStyle(Regular|SourceList)|racking(Mouse(Moved|EnteredAndExited)|CursorUpdate|InVisibleRect|EnabledDuringMouseDrag|A(ssumeInside|ctive(In(KeyWindow|ActiveApp)|WhenFirstResponder|Always))))|I(n(tersectSetExpressionType|dexedColorSpaceModel)|mageScale(None|Proportionally(Down|UpOrDown)|AxesIndependently))|Ope(nGLPFAAllowOfflineRenderers|rationQueue(DefaultMaxConcurrentOperationCount|Priority(High|Normal|Very(High|Low)|Low)))|D(iacriticInsensitiveSearch|ownloadsDirectory)|U(nionSetExpressionType|TF(16(BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)|32(BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)))|P(ointerFunctions(Ma(chVirtualMemory|llocMemory)|Str(ongMemory|uctPersonality)|C(StringPersonality|opyIn)|IntegerPersonality|ZeroingWeakMemory|O(paque(Memory|Personality)|bjectP(ointerPersonality|ersonality)))|at(hStyle(Standard|NavigationBar|PopUp)|ternColorSpaceModel)|rintPanelShows(Scaling|Copies|Orientation|P(a(perSize|ge(Range|SetupAccessory))|review)))|Executable(RuntimeMismatchError|NotLoadableError|ErrorM(inimum|aximum)|L(inkError|oadError)|ArchitectureMismatchError)|KeyValueObservingOption(Initial|Prior)|F(i(ndPanelSubstringMatchType(StartsWith|Contains|EndsWith|FullWord)|leRead(TooLargeError|UnknownStringEncodingError))|orcedOrderingSearch)|Wi(ndow(BackingLocation(MainMemory|Default|VideoMemory)|Sharing(Read(Only|Write)|None)|CollectionBehavior(MoveToActiveSpace|CanJoinAllSpaces|Default))|dthInsensitiveSearch)|AggregateExpressionType)\b + scope: support.constant.cocoa.leopard.objc + - match: \bNS(R(GB(ModeColorPanel|ColorSpaceModel)|ight(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|T(ext(Movement|Alignment)|ab(sBezelBorder|StopType))|ArrowFunctionKey)|ound(RectBezelStyle|Bankers|ed(BezelStyle|TokenStyle|DisclosureBezelStyle)|Down|Up|Plain|Line(CapStyle|JoinStyle))|un(StoppedResponse|ContinuesResponse|AbortedResponse)|e(s(izableWindowMask|et(CursorRectsRunLoopOrdering|FunctionKey))|ce(ssedBezelStyle|iver(sCantHandleCommandScriptError|EvaluationScriptError))|turnTextMovement|doFunctionKey|quiredArgumentsMissingScriptError|l(evancyLevelIndicatorStyle|ative(Before|After))|gular(SquareBezelStyle|ControlSize)|moveTraitFontAction)|a(n(domSubelement|geDateMode)|tingLevelIndicatorStyle|dio(ModeMatrix|Button)))|G(IFFileType|lyph(Below|Inscribe(B(elow|ase)|Over(strike|Below)|Above)|Layout(WithPrevious|A(tAPoint|gainstAPoint))|A(ttribute(BidiLevel|Soft|Inscribe|Elastic)|bove))|r(ooveBorder|eaterThan(Comparison|OrEqualTo(Comparison|PredicateOperatorType)|PredicateOperatorType)|a(y(ModeColorPanel|ColorSpaceModel)|dient(None|Con(cave(Strong|Weak)|vex(Strong|Weak)))|phiteControlTint)))|XML(N(o(tationDeclarationKind|de(CompactEmptyElement|IsCDATA|OptionsNone|Use(SingleQuotes|DoubleQuotes)|Pre(serve(NamespaceOrder|C(haracterReferences|DATA)|DTD|Prefixes|E(ntities|mptyElements)|Quotes|Whitespace|A(ttributeOrder|ll))|ttyPrint)|ExpandEmptyElement))|amespaceKind)|CommentKind|TextKind|InvalidKind|D(ocument(X(MLKind|HTMLKind|Include)|HTMLKind|T(idy(XML|HTML)|extKind)|IncludeContentTypeDeclaration|Validate|Kind)|TDKind)|P(arser(GTRequiredError|XMLDeclNot(StartedError|FinishedError)|Mi(splaced(XMLDeclarationError|CDATAEndStringError)|xedContentDeclNot(StartedError|FinishedError))|S(t(andaloneValueError|ringNot(StartedError|ClosedError))|paceRequiredError|eparatorRequiredError)|N(MTOKENRequiredError|o(t(ationNot(StartedError|FinishedError)|WellBalancedError)|DTDError)|amespaceDeclarationError|AMERequiredError)|C(haracterRef(In(DTDError|PrologError|EpilogError)|AtEOFError)|o(nditionalSectionNot(StartedError|FinishedError)|mment(NotFinishedError|ContainsDoubleHyphenError))|DATANotFinishedError)|TagNameMismatchError|In(ternalError|valid(HexCharacterRefError|C(haracter(RefError|InEntityError|Error)|onditionalSectionError)|DecimalCharacterRefError|URIError|Encoding(NameError|Error)))|OutOfMemoryError|D(ocumentStartError|elegateAbortedParseError|OCTYPEDeclNotFinishedError)|U(RI(RequiredError|FragmentError)|n(declaredEntityError|parsedEntityError|knownEncodingError|finishedTagError))|P(CDATARequiredError|ublicIdentifierRequiredError|arsedEntityRef(MissingSemiError|NoNameError|In(Internal(SubsetError|Error)|PrologError|EpilogError)|AtEOFError)|r(ocessingInstructionNot(StartedError|FinishedError)|ematureDocumentEndError))|E(n(codingNotSupportedError|tity(Ref(In(DTDError|PrologError|EpilogError)|erence(MissingSemiError|WithoutNameError)|LoopError|AtEOFError)|BoundaryError|Not(StartedError|FinishedError)|Is(ParameterError|ExternalError)|ValueRequiredError))|qualExpectedError|lementContentDeclNot(StartedError|FinishedError)|xt(ernalS(tandaloneEntityError|ubsetNotFinishedError)|raContentError)|mptyDocumentError)|L(iteralNot(StartedError|FinishedError)|T(RequiredError|SlashRequiredError)|essThanSymbolInAttributeError)|Attribute(RedefinedError|HasNoValueError|Not(StartedError|FinishedError)|ListNot(StartedError|FinishedError)))|rocessingInstructionKind)|E(ntity(GeneralKind|DeclarationKind|UnparsedKind|P(ar(sedKind|ameterKind)|redefined))|lement(Declaration(MixedKind|UndefinedKind|E(lementKind|mptyKind)|Kind|AnyKind)|Kind))|Attribute(N(MToken(sKind|Kind)|otationKind)|CDATAKind|ID(Ref(sKind|Kind)|Kind)|DeclarationKind|En(tit(yKind|iesKind)|umerationKind)|Kind))|M(i(n(XEdge|iaturizableWindowMask|YEdge|uteCalendarUnit)|terLineJoinStyle|ddleSubelement|xedState)|o(nthCalendarUnit|deSwitchFunctionKey|use(Moved(Mask)?|E(ntered(Mask)?|ventSubtype|xited(Mask)?))|veToBezierPathElement|mentary(ChangeButton|Push(Button|InButton)|Light(Button)?))|enuFunctionKey|a(c(intoshInterfaceStyle|OSRomanStringEncoding)|tchesPredicateOperatorType|ppedRead|x(XEdge|YEdge))|ACHOperatingSystem)|B(MPFileType|o(ttomTabsBezelBorder|ldFontMask|rderlessWindowMask|x(Se(condary|parator)|OldStyle|Primary))|uttLineCapStyle|e(zelBorder|velLineJoinStyle|low(Bottom|Top)|gin(sWith(Comparison|PredicateOperatorType)|FunctionKey))|lueControlTint|ack(spaceCharacter|tabTextMovement|ingStore(Retained|Buffered|Nonretained)|TabCharacter|wardsSearch|groundTab)|r(owser(NoColumnResizing|UserColumnResizing|AutoColumnResizing)|eakFunctionKey))|S(h(ift(JISStringEncoding|KeyMask)|ow(ControlGlyphs|InvisibleGlyphs)|adowlessSquareBezelStyle)|y(s(ReqFunctionKey|tem(D(omainMask|efined(Mask)?)|FunctionKey))|mbolStringEncoding)|c(a(nnedOption|le(None|ToFit|Proportionally))|r(oll(er(NoPart|Increment(Page|Line|Arrow)|Decrement(Page|Line|Arrow)|Knob(Slot)?|Arrows(M(inEnd|axEnd)|None|DefaultSetting))|Wheel(Mask)?|LockFunctionKey)|eenChangedEventType))|t(opFunctionKey|r(ingDrawing(OneShot|DisableScreenFontSubstitution|Uses(DeviceMetrics|FontLeading|LineFragmentOrigin))|eam(Status(Reading|NotOpen|Closed|Open(ing)?|Error|Writing|AtEnd)|Event(Has(BytesAvailable|SpaceAvailable)|None|OpenCompleted|E(ndEncountered|rrorOccurred)))))|i(ngle(DateMode|UnderlineStyle)|ze(DownFontAction|UpFontAction))|olarisOperatingSystem|unOSOperatingSystem|pecialPageOrder|e(condCalendarUnit|lect(By(Character|Paragraph|Word)|i(ng(Next|Previous)|onAffinity(Downstream|Upstream))|edTab|FunctionKey)|gmentSwitchTracking(Momentary|Select(One|Any)))|quareLineCapStyle|witchButton|ave(ToOperation|Op(tions(Yes|No|Ask)|eration)|AsOperation)|mall(SquareBezelStyle|C(ontrolSize|apsFontMask)|IconButtonBezelStyle))|H(ighlightModeMatrix|SBModeColorPanel|o(ur(Minute(SecondDatePickerElementFlag|DatePickerElementFlag)|CalendarUnit)|rizontalRuler|meFunctionKey)|TTPCookieAcceptPolicy(Never|OnlyFromMainDocumentDomain|Always)|e(lp(ButtonBezelStyle|KeyMask|FunctionKey)|avierFontAction)|PUXOperatingSystem)|Year(MonthDa(yDatePickerElementFlag|tePickerElementFlag)|CalendarUnit)|N(o(n(StandardCharacterSetFontMask|ZeroWindingRule|activatingPanelMask|LossyASCIIStringEncoding)|Border|t(ification(SuspensionBehavior(Hold|Coalesce|D(eliverImmediately|rop))|NoCoalescing|CoalescingOn(Sender|Name)|DeliverImmediately|PostToAllSessions)|PredicateType|EqualToPredicateOperatorType)|S(cr(iptError|ollerParts)|ubelement|pecifierError)|CellMask|T(itle|opLevelContainersSpecifierError|abs(BezelBorder|NoBorder|LineBorder))|I(nterfaceStyle|mage)|UnderlineStyle|FontChangeAction)|u(ll(Glyph|CellType)|m(eric(Search|PadKeyMask)|berFormatter(Round(Half(Down|Up|Even)|Ceiling|Down|Up|Floor)|Behavior(10|Default)|S(cientificStyle|pellOutStyle)|NoStyle|CurrencyStyle|DecimalStyle|P(ercentStyle|ad(Before(Suffix|Prefix)|After(Suffix|Prefix))))))|e(t(Services(BadArgumentError|NotFoundError|C(ollisionError|ancelledError)|TimeoutError|InvalidError|UnknownError|ActivityInProgress)|workDomainMask)|wlineCharacter|xt(StepInterfaceStyle|FunctionKey))|EXTSTEPStringEncoding|a(t(iveShortGlyphPacking|uralTextAlignment)|rrowFontMask))|C(hange(ReadOtherContents|GrayCell(Mask)?|BackgroundCell(Mask)?|Cleared|Done|Undone|Autosaved)|MYK(ModeColorPanel|ColorSpaceModel)|ircular(BezelStyle|Slider)|o(n(stantValueExpressionType|t(inuousCapacityLevelIndicatorStyle|entsCellMask|ain(sComparison|erSpecifierError)|rol(Glyph|KeyMask))|densedFontMask)|lor(Panel(RGBModeMask|GrayModeMask|HSBModeMask|C(MYKModeMask|olorListModeMask|ustomPaletteModeMask|rayonModeMask)|WheelModeMask|AllModesMask)|ListModeColorPanel)|reServiceDirectory|m(p(osite(XOR|Source(In|O(ut|ver)|Atop)|Highlight|C(opy|lear)|Destination(In|O(ut|ver)|Atop)|Plus(Darker|Lighter))|ressedFontMask)|mandKeyMask))|u(stom(SelectorPredicateOperatorType|PaletteModeColorPanel)|r(sor(Update(Mask)?|PointingDevice)|veToBezierPathElement))|e(nterT(extAlignment|abStopType)|ll(State|H(ighlighted|as(Image(Horizontal|OnLeftOrBottom)|OverlappingImage))|ChangesContents|Is(Bordered|InsetButton)|Disabled|Editable|LightsBy(Gray|Background|Contents)|AllowsMixedState))|l(ipPagination|o(s(ePathBezierPathElement|ableWindowMask)|ckAndCalendarDatePickerStyle)|ear(ControlTint|DisplayFunctionKey|LineFunctionKey))|a(seInsensitive(Search|PredicateOption)|n(notCreateScriptCommandError|cel(Button|TextMovement))|chesDirectory|lculation(NoError|Overflow|DivideByZero|Underflow|LossOfPrecision)|rriageReturnCharacter)|r(itical(Request|AlertStyle)|ayonModeColorPanel))|T(hick(SquareBezelStyle|erSquareBezelStyle)|ypesetter(Behavior|HorizontalTabAction|ContainerBreakAction|ZeroAdvancementAction|OriginalBehavior|ParagraphBreakAction|WhitespaceAction|L(ineBreakAction|atestBehavior))|i(ckMark(Right|Below|Left|Above)|tledWindowMask|meZoneDatePickerElementFlag)|o(olbarItemVisibilityPriority(Standard|High|User|Low)|pTabsBezelBorder|ggleButton)|IFF(Compression(N(one|EXT)|CCITTFAX(3|4)|OldJPEG|JPEG|PackBits|LZW)|FileType)|e(rminate(Now|Cancel|Later)|xt(Read(InapplicableDocumentTypeError|WriteErrorM(inimum|aximum))|Block(M(i(nimum(Height|Width)|ddleAlignment)|a(rgin|ximum(Height|Width)))|B(o(ttomAlignment|rder)|aselineAlignment)|Height|TopAlignment|P(ercentageValueType|adding)|Width|AbsoluteValueType)|StorageEdited(Characters|Attributes)|CellType|ured(RoundedBezelStyle|BackgroundWindowMask|SquareBezelStyle)|Table(FixedLayoutAlgorithm|AutomaticLayoutAlgorithm)|Field(RoundedBezel|SquareBezel|AndStepperDatePickerStyle)|WriteInapplicableDocumentTypeError|ListPrependEnclosingMarker))|woByteGlyphPacking|ab(Character|TextMovement|le(tP(oint(Mask|EventSubtype)?|roximity(Mask|EventSubtype)?)|Column(NoResizing|UserResizingMask|AutoresizingMask)|View(ReverseSequentialColumnAutoresizingStyle|GridNone|S(olid(HorizontalGridLineMask|VerticalGridLineMask)|equentialColumnAutoresizingStyle)|NoColumnAutoresizing|UniformColumnAutoresizingStyle|FirstColumnOnlyAutoresizingStyle|LastColumnOnlyAutoresizingStyle)))|rackModeMatrix)|I(n(sert(CharFunctionKey|FunctionKey|LineFunctionKey)|t(Type|ernalS(criptError|pecifierError))|dexSubelement|validIndexSpecifierError|formational(Request|AlertStyle)|PredicateOperatorType)|talicFontMask|SO(2022JPStringEncoding|Latin(1StringEncoding|2StringEncoding))|dentityMappingCharacterCollection|llegalTextMovement|mage(R(ight|ep(MatchesDevice|LoadStatus(ReadingHeader|Completed|InvalidData|Un(expectedEOF|knownType)|WillNeedAllData)))|Below|C(ellType|ache(BySize|Never|Default|Always))|Interpolation(High|None|Default|Low)|O(nly|verlaps)|Frame(Gr(oove|ayBezel)|Button|None|Photo)|L(oadStatus(ReadError|C(ompleted|ancelled)|InvalidData|UnexpectedEOF)|eft)|A(lign(Right|Bottom(Right|Left)?|Center|Top(Right|Left)?|Left)|bove)))|O(n(State|eByteGlyphPacking|OffButton|lyScrollerArrows)|ther(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|TextMovement)|SF1OperatingSystem|pe(n(GL(GO(Re(setLibrary|tainRenderers)|ClearFormatCache|FormatCacheSize)|PFA(R(obust|endererID)|M(inimumPolicy|ulti(sample|Screen)|PSafe|aximumPolicy)|BackingStore|S(creenMask|te(ncilSize|reo)|ingleRenderer|upersample|ample(s|Buffers|Alpha))|NoRecovery|C(o(lor(Size|Float)|mpliant)|losestPolicy)|OffScreen|D(oubleBuffer|epthSize)|PixelBuffer|VirtualScreenCount|FullScreen|Window|A(cc(umSize|elerated)|ux(Buffers|DepthStencil)|l(phaSize|lRenderers))))|StepUnicodeReservedBase)|rationNotSupportedForKeyS(criptError|pecifierError))|ffState|KButton|rPredicateType|bjC(B(itfield|oolType)|S(hortType|tr(ingType|uctType)|electorType)|NoType|CharType|ObjectType|DoubleType|UnionType|PointerType|VoidType|FloatType|Long(Type|longType)|ArrayType))|D(i(s(c(losureBezelStyle|reteCapacityLevelIndicatorStyle)|playWindowRunLoopOrdering)|acriticInsensitivePredicateOption|rect(Selection|PredicateModifier))|o(c(ModalWindowMask|ument(Directory|ationDirectory))|ubleType|wn(TextMovement|ArrowFunctionKey))|e(s(cendingPageOrder|ktopDirectory)|cimalTabStopType|v(ice(NColorSpaceModel|IndependentModifierFlagsMask)|eloper(Directory|ApplicationDirectory))|fault(ControlTint|TokenStyle)|lete(Char(acter|FunctionKey)|FunctionKey|LineFunctionKey)|moApplicationDirectory)|a(yCalendarUnit|teFormatter(MediumStyle|Behavior(10|Default)|ShortStyle|NoStyle|FullStyle|LongStyle))|ra(wer(Clos(ingState|edState)|Open(ingState|State))|gOperation(Generic|Move|None|Copy|Delete|Private|Every|Link|All)))|U(ser(CancelledError|D(irectory|omainMask)|FunctionKey)|RL(Handle(NotLoaded|Load(Succeeded|InProgress|Failed))|CredentialPersistence(None|Permanent|ForSession))|n(scaledWindowMask|cachedRead|i(codeStringEncoding|talicFontMask|fiedTitleAndToolbarWindowMask)|d(o(CloseGroupingRunLoopOrdering|FunctionKey)|e(finedDateComponent|rline(Style(Single|None|Thick|Double)|Pattern(Solid|D(ot|ash(Dot(Dot)?)?)))))|known(ColorSpaceModel|P(ointingDevice|ageOrder)|KeyS(criptError|pecifierError))|boldFontMask)|tilityWindowMask|TF8StringEncoding|p(dateWindowsRunLoopOrdering|TextMovement|ArrowFunctionKey))|J(ustifiedTextAlignment|PEG(2000FileType|FileType)|apaneseEUC(GlyphPacking|StringEncoding))|P(o(s(t(Now|erFontMask|WhenIdle|ASAP)|iti(on(Replace|Be(fore|ginning)|End|After)|ve(IntType|DoubleType|FloatType)))|pUp(NoArrow|ArrowAt(Bottom|Center))|werOffEventType|rtraitOrientation)|NGFileType|ush(InCell(Mask)?|OnPushOffButton)|e(n(TipMask|UpperSideMask|PointingDevice|LowerSideMask)|riodic(Mask)?)|P(S(caleField|tatus(Title|Field)|aveButton)|N(ote(Title|Field)|ame(Title|Field))|CopiesField|TitleField|ImageButton|OptionsButton|P(a(perFeedButton|ge(Range(To|From)|ChoiceMatrix))|reviewButton)|LayoutButton)|lainTextTokenStyle|a(useFunctionKey|ragraphSeparatorCharacter|ge(DownFunctionKey|UpFunctionKey))|r(int(ing(ReplyLater|Success|Cancelled|Failure)|ScreenFunctionKey|erTable(NotFound|OK|Error)|FunctionKey)|o(p(ertyList(XMLFormat|MutableContainers(AndLeaves)?|BinaryFormat|Immutable|OpenStepFormat)|rietaryStringEncoding)|gressIndicator(BarStyle|SpinningStyle|Preferred(SmallThickness|Thickness|LargeThickness|AquaThickness)))|e(ssedTab|vFunctionKey))|L(HeightForm|CancelButton|TitleField|ImageButton|O(KButton|rientationMatrix)|UnitsButton|PaperNameButton|WidthForm))|E(n(terCharacter|d(sWith(Comparison|PredicateOperatorType)|FunctionKey))|v(e(nOddWindingRule|rySubelement)|aluatedObjectExpressionType)|qualTo(Comparison|PredicateOperatorType)|ra(serPointingDevice|CalendarUnit|DatePickerElementFlag)|x(clude(10|QuickDrawElementsIconCreationOption)|pandedFontMask|ecuteFunctionKey))|V(i(ew(M(in(XMargin|YMargin)|ax(XMargin|YMargin))|HeightSizable|NotSizable|WidthSizable)|aPanelFontAction)|erticalRuler|a(lidationErrorM(inimum|aximum)|riableExpressionType))|Key(SpecifierEvaluationScriptError|Down(Mask)?|Up(Mask)?|PathExpressionType|Value(MinusSetMutation|SetSetMutation|Change(Re(placement|moval)|Setting|Insertion)|IntersectSetMutation|ObservingOption(New|Old)|UnionSetMutation|ValidationError))|QTMovie(NormalPlayback|Looping(BackAndForthPlayback|Playback))|F(1(1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|7FunctionKey|i(nd(PanelAction(Replace(A(ndFind|ll(InSelection)?))?|S(howFindPanel|e(tFindString|lectAll(InSelection)?))|Next|Previous)|FunctionKey)|tPagination|le(Read(No(SuchFileError|PermissionError)|CorruptFileError|In(validFileNameError|applicableStringEncodingError)|Un(supportedSchemeError|knownError))|HandlingPanel(CancelButton|OKButton)|NoSuchFileError|ErrorM(inimum|aximum)|Write(NoPermissionError|In(validFileNameError|applicableStringEncodingError)|OutOfSpaceError|Un(supportedSchemeError|knownError))|LockingError)|xedPitchFontMask)|2(1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|o(nt(Mo(noSpaceTrait|dernSerifsClass)|BoldTrait|S(ymbolicClass|criptsClass|labSerifsClass|ansSerifClass)|C(o(ndensedTrait|llectionApplicationOnlyMask)|larendonSerifsClass)|TransitionalSerifsClass|I(ntegerAdvancementsRenderingMode|talicTrait)|O(ldStyleSerifsClass|rnamentalsClass)|DefaultRenderingMode|U(nknownClass|IOptimizedTrait)|Panel(S(hadowEffectModeMask|t(andardModesMask|rikethroughEffectModeMask)|izeModeMask)|CollectionModeMask|TextColorEffectModeMask|DocumentColorEffectModeMask|UnderlineEffectModeMask|FaceModeMask|All(ModesMask|EffectsModeMask))|ExpandedTrait|VerticalTrait|F(amilyClassMask|reeformSerifsClass)|Antialiased(RenderingMode|IntegerAdvancementsRenderingMode))|cusRing(Below|Type(None|Default|Exterior)|Only|Above)|urByteGlyphPacking|rm(attingError(M(inimum|aximum))?|FeedCharacter))|8FunctionKey|unction(ExpressionType|KeyMask)|3(1FunctionKey|2FunctionKey|3FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey)|9FunctionKey|4FunctionKey|P(RevertButton|S(ize(Title|Field)|etButton)|CurrentField|Preview(Button|Field))|l(oat(ingPointSamplesBitmapFormat|Type)|agsChanged(Mask)?)|axButton|5FunctionKey|6FunctionKey)|W(heelModeColorPanel|indow(s(NTOperatingSystem|CP125(1StringEncoding|2StringEncoding|3StringEncoding|4StringEncoding|0StringEncoding)|95(InterfaceStyle|OperatingSystem))|M(iniaturizeButton|ovedEventType)|Below|CloseButton|ToolbarButton|ZoomButton|Out|DocumentIconButton|ExposedEventType|Above)|orkspaceLaunch(NewInstance|InhibitingBackgroundOnly|Default|PreferringClassic|WithoutA(ctivation|ddingToRecents)|A(sync|nd(Hide(Others)?|Print)|llowingClassicStartup))|eek(day(CalendarUnit|OrdinalCalendarUnit)|CalendarUnit)|a(ntsBidiLevels|rningAlertStyle)|r(itingDirection(RightToLeft|Natural|LeftToRight)|apCalendarComponents))|L(i(stModeMatrix|ne(Moves(Right|Down|Up|Left)|B(order|reakBy(C(harWrapping|lipping)|Truncating(Middle|Head|Tail)|WordWrapping))|S(eparatorCharacter|weep(Right|Down|Up|Left))|ToBezierPathElement|DoesntMove|arSlider)|teralSearch|kePredicateOperatorType|ghterFontAction|braryDirectory)|ocalDomainMask|e(ssThan(Comparison|OrEqualTo(Comparison|PredicateOperatorType)|PredicateOperatorType)|ft(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|T(ext(Movement|Alignment)|ab(sBezelBorder|StopType))|ArrowFunctionKey))|a(yout(RightToLeft|NotDone|CantFit|OutOfGlyphs|Done|LeftToRight)|ndscapeOrientation)|ABColorSpaceModel)|A(sc(iiWithDoubleByteEUCGlyphPacking|endingPageOrder)|n(y(Type|PredicateModifier|EventMask)|choredSearch|imation(Blocking|Nonblocking(Threaded)?|E(ffect(DisappearingItemDefault|Poof)|ase(In(Out)?|Out))|Linear)|dPredicateType)|t(Bottom|tachmentCharacter|omicWrite|Top)|SCIIStringEncoding|d(obe(GB1CharacterCollection|CNS1CharacterCollection|Japan(1CharacterCollection|2CharacterCollection)|Korea1CharacterCollection)|dTraitFontAction|minApplicationDirectory)|uto(saveOperation|Pagination)|pp(lication(SupportDirectory|D(irectory|e(fined(Mask)?|legateReply(Success|Cancel|Failure)|activatedEventType))|ActivatedEventType)|KitDefined(Mask)?)|l(ternateKeyMask|pha(ShiftKeyMask|NonpremultipliedBitmapFormat|FirstBitmapFormat)|ert(SecondButtonReturn|ThirdButtonReturn|OtherReturn|DefaultReturn|ErrorReturn|FirstButtonReturn|AlternateReturn)|l(ScrollerParts|DomainsMask|PredicateModifier|LibrariesDirectory|ApplicationsDirectory))|rgument(sWrongScriptError|EvaluationScriptError)|bove(Bottom|Top)|WTEventType))\b + scope: support.constant.cocoa.objc + - match: \bNS(RuleEditor|G(arbageCollector|radient)|MapTable|HashTable|Co(ndition|llectionView(Item)?)|T(oolbarItemGroup|extInputClient|r(eeNode|ackingArea))|InvocationOperation|Operation(Queue)?|D(ictionaryController|ockTile)|P(ointer(Functions|Array)|athC(o(ntrol(Delegate)?|mponentCell)|ell(Delegate)?)|r(intPanelAccessorizing|edicateEditor(RowTemplate)?))|ViewController|FastEnumeration|Animat(ionContext|ablePropertyContainer))\b + scope: support.class.cocoa.leopard.objc + - match: \bNS(R(u(nLoop|ler(Marker|View))|e(sponder|cursiveLock|lativeSpecifier)|an(domSpecifier|geSpecifier))|G(etCommand|lyph(Generator|Storage|Info)|raphicsContext)|XML(Node|D(ocument|TD(Node)?)|Parser|Element)|M(iddleSpecifier|ov(ie(View)?|eCommand)|utable(S(tring|et)|C(haracterSet|opying)|IndexSet|D(ictionary|ata)|URLRequest|ParagraphStyle|A(ttributedString|rray))|e(ssagePort(NameServer)?|nu(Item(Cell)?|View)?|t(hodSignature|adata(Item|Query(ResultGroup|AttributeValueTuple)?)))|a(ch(BootstrapServer|Port)|trix))|B(itmapImageRep|ox|u(ndle|tton(Cell)?)|ezierPath|rowser(Cell)?)|S(hadow|c(anner|r(ipt(SuiteRegistry|C(o(ercionHandler|mmand(Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(er|View)|een))|t(epper(Cell)?|atus(Bar|Item)|r(ing|eam))|imple(HorizontalTypesetter|CString)|o(cketPort(NameServer)?|und|rtDescriptor)|p(e(cifierTest|ech(Recognizer|Synthesizer)|ll(Server|Checker))|litView)|e(cureTextField(Cell)?|t(Command)?|archField(Cell)?|rializer|gmentedC(ontrol|ell))|lider(Cell)?|avePanel)|H(ost|TTP(Cookie(Storage)?|URLResponse)|elpManager)|N(ib(Con(nector|trolConnector)|OutletConnector)?|otification(Center|Queue)?|u(ll|mber(Formatter)?)|etService(Browser)?|ameSpecifier)|C(ha(ngeSpelling|racterSet)|o(n(stantString|nection|trol(ler)?|ditionLock)|d(ing|er)|unt(Command|edSet)|pying|lor(Space|P(ick(ing(Custom|Default)|er)|anel)|Well|List)?|m(p(oundPredicate|arisonPredicate)|boBox(Cell)?))|u(stomImageRep|rsor)|IImageRep|ell|l(ipView|o(seCommand|neCommand)|assDescription)|a(ched(ImageRep|URLResponse)|lendar(Date)?)|reateCommand)|T(hread|ypesetter|ime(Zone|r)|o(olbar(Item(Validations)?)?|kenField(Cell)?)|ext(Block|Storage|Container|Tab(le(Block)?)?|Input|View|Field(Cell)?|List|Attachment(Cell)?)?|a(sk|b(le(Header(Cell|View)|Column|View)|View(Item)?))|reeController)|I(n(dex(S(pecifier|et)|Path)|put(Manager|S(tream|erv(iceProvider|er(MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(Rep|Cell|View)?)|O(ut(putStream|lineView)|pen(GL(Context|Pixel(Buffer|Format)|View)|Panel)|bj(CTypeSerializationCallBack|ect(Controller)?))|D(i(st(antObject(Request)?|ributed(NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(Controller)?|e(serializer|cimalNumber(Behaviors|Handler)?|leteCommand)|at(e(Components|Picker(Cell)?|Formatter)?|a)|ra(wer|ggingInfo))|U(ser(InterfaceValidations|Defaults(Controller)?)|RL(Re(sponse|quest)|Handle(Client)?|C(onnection|ache|redential(Storage)?)|Download(Delegate)?|Prot(ocol(Client)?|ectionSpace)|AuthenticationChallenge(Sender)?)?|n(iqueIDSpecifier|doManager|archiver))|P(ipe|o(sitionalSpecifier|pUpButton(Cell)?|rt(Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImageRep|a(steboard|nel|ragraphStyle|geLayout)|r(int(Info|er|Operation|Panel)|o(cessInfo|tocolChecker|perty(Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(numerator|vent|PSImageRep|rror|x(ception|istsCommand|pression))|V(iew(Animation)?|al(idated(ToobarItem|UserInterfaceItem)|ue(Transformer)?))|Keyed(Unarchiver|Archiver)|Qui(ckDrawView|tCommand)|F(ile(Manager|Handle|Wrapper)|o(nt(Manager|Descriptor|Panel)?|rm(Cell|atter)))|W(hoseSpecifier|indow(Controller)?|orkspace)|L(o(c(k(ing)?|ale)|gicalTest)|evelIndicator(Cell)?|ayoutManager)|A(ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(ication|e(Script|Event(Manager|Descriptor)))|ffineTransform|lert|r(chiver|ray(Controller)?)))\b + scope: support.class.cocoa.objc + - match: \bNS(R(oundingMode|ule(Editor(RowType|NestingMode)|rOrientation)|e(questUserAttentionType|lativePosition))|G(lyphInscription|radientDrawingOptions)|XML(NodeKind|D(ocumentContentKind|TDNodeKind)|ParserError)|M(ultibyteGlyphPacking|apTableOptions)|B(itmapFormat|oxType|ezierPathElement|ackgroundStyle|rowserDropOperation)|S(tr(ing(CompareOptions|DrawingOptions|EncodingConversionOptions)|eam(Status|Event))|p(eechBoundary|litViewDividerStyle)|e(archPathD(irectory|omainMask)|gmentS(tyle|witchTracking))|liderType|aveOptions)|H(TTPCookieAcceptPolicy|ashTableOptions)|N(otification(SuspensionBehavior|Coalescing)|umberFormatter(RoundingMode|Behavior|Style|PadPosition)|etService(sError|Options))|C(haracterCollection|o(lor(RenderingIntent|SpaceModel|PanelMode)|mp(oundPredicateType|arisonPredicateModifier))|ellStateValue|al(culationError|endarUnit))|T(ypesetterControlCharacterAction|imeZoneNameStyle|e(stComparisonOperation|xt(Block(Dimension|V(erticalAlignment|alueType)|Layer)|TableLayoutAlgorithm|FieldBezelStyle))|ableView(SelectionHighlightStyle|ColumnAutoresizingStyle)|rackingAreaOptions)|I(n(sertionPosition|te(rfaceStyle|ger))|mage(RepLoadStatus|Scaling|CacheMode|FrameStyle|LoadStatus|Alignment))|Ope(nGLPixelFormatAttribute|rationQueuePriority)|Date(Picker(Mode|Style)|Formatter(Behavior|Style))|U(RL(RequestCachePolicy|HandleStatus|C(acheStoragePolicy|redentialPersistence))|Integer)|P(o(stingStyle|int(ingDeviceType|erFunctionsOptions)|pUpArrowPosition)|athStyle|r(int(ing(Orientation|PaginationMode)|erTableStatus|PanelOptions)|opertyList(MutabilityOptions|Format)|edicateOperatorType))|ExpressionType|KeyValue(SetMutationKind|Change)|QTMovieLoopMode|F(indPanel(SubstringMatchType|Action)|o(nt(RenderingMode|FamilyClass)|cusRingPlacement))|W(hoseSubelementIdentifier|ind(ingRule|ow(B(utton|ackingLocation)|SharingType|CollectionBehavior)))|L(ine(MovementDirection|SweepDirection|CapStyle|JoinStyle)|evelIndicatorStyle)|Animation(BlockingMode|Curve))\b + scope: support.type.cocoa.leopard.objc + - match: \bNS(R(ect(Edge)?|ange)|G(lyph(Relation|LayoutMode)?|radientType)|M(odalSession|a(trixMode|p(Table|Enumerator)))|B(itmapImageFileType|orderType|uttonType|ezelStyle|ackingStoreType|rowserColumnResizingType)|S(cr(oll(er(Part|Arrow)|ArrowPosition)|eenAuxiliaryOpaque)|tringEncoding|ize|ocketNativeHandle|election(Granularity|Direction|Affinity)|wapped(Double|Float)|aveOperationType)|Ha(sh(Table|Enumerator)|ndler(2)?)|C(o(ntrol(Size|Tint)|mp(ositingOperation|arisonResult))|ell(State|Type|ImagePosition|Attribute))|T(hreadPrivate|ypesetterGlyphInfo|i(ckMarkPosition|tlePosition|meInterval)|o(ol(TipTag|bar(SizeMode|DisplayMode))|kenStyle)|IFFCompression|ext(TabType|Alignment)|ab(State|leViewDropOperation|ViewType)|rackingRectTag)|ImageInterpolation|Zone|OpenGL(ContextAuxiliary|PixelFormatAuxiliary)|D(ocumentChangeType|atePickerElementFlags|ra(werState|gOperation))|UsableScrollerParts|P(oint|r(intingPageOrder|ogressIndicator(Style|Th(ickness|readInfo))))|EventType|KeyValueObservingOptions|Fo(nt(SymbolicTraits|TraitMask|Action)|cusRingType)|W(indow(OrderingMode|Depth)|orkspace(IconCreationOptions|LaunchOptions)|ritingDirection)|L(ineBreakMode|ayout(Status|Direction))|A(nimation(Progress|Effect)|ppl(ication(TerminateReply|DelegateReply|PrintReply)|eEventManagerSuspensionID)|ffineTransformStruct|lertStyle))\b + scope: support.type.cocoa.objc + # Catch-all + - match: \bNS\w+\b + - match: '' + pop: true + + + ############################################################################# + # The following are Objective-C-specific contexts that should not be reused. + # This is because they push into subcontexts and use variables that are + # Objective-C-specific. + ############################################################################# + + ## Common context layout + + global: + - include: objc-structures + - include: early-expressions + - match: '^\s*(?=\w+)' + push: global-modifier + - include: late-expressions + + statements: + - include: preprocessor-statements + - include: scope:source.c#label + - include: expressions + + expressions: + - include: early-expressions + - include: late-expressions + + early-expressions: + - include: preprocessor-expressions + - include: comments + - include: case-default + - include: typedef + - include: keywords-parens + - include: keywords + - include: numbers + - include: operators + - include: strings + - include: parens + - include: block + - include: variables + - include: constants + - include: access + - match: ',' + scope: punctuation.separator.objc + - match: '\)|\}' + scope: invalid.illegal.stray-bracket-end.objc + - include: bracketed-content + - include: brackets + + late-expressions: + - include: modifiers-parens + - include: modifiers + - include: types + - include: function-call + - match: ';' + scope: punctuation.terminator.objc + + comments: + - include: scope:source.c#comments + + access: + - include: scope:source.c#access + + keywords: + - include: unique-keywords + - include: scope:source.c#keywords + + numbers: + - include: scope:source.c#numbers + + operators: + - include: scope:source.c#operators + + strings: + - include: unique-strings + - include: scope:source.c#strings + + variables: + - include: unique-variables + - include: scope:source.c#variables + + constants: + - include: unique-constants + - match: '(?=\bNS\w+\b)' + push: ns-identifiers + - include: scope:source.c#constants + + modifiers: + - include: unique-modifiers + - include: scope:source.c#modifiers + + types: + - include: unique-types + - match: '(?=\bNS\w+\b)' + push: ns-identifiers + - include: scope:source.c#types + + ## Objective-C-specific contexts + + bracketed-content: + - match: '(\[)\s*(?={{identifier}}\s+[^\s,])' + captures: + 1: punctuation.section.scope.begin.objc + push: + - meta_scope: meta.bracketed.objc + - match: '\]' + scope: punctuation.section.scope.end.objc + pop: true + - match: \s*(NSPredicate)\s+(predicateWithFormat(:)) + captures: + 1: support.class.cocoa + 2: support.function.any-method.objc + 3: punctuation.separator.arguments.objc + push: + - meta_scope: meta.function-call.predicate.objc + - include: ns-predicate + - include: expressions + - match: '\s+(\w+)(?=\s*\])' + captures: + 1: support.function.any-method.objc + - match: '\s+(\w+(:))' + captures: + 1: support.function.any-method.objc + 2: punctuation.separator.arguments.objc + push: + - meta_scope: meta.function-call.objc + - match: '(?=\])' + pop: true + - match: \b\w+(:) + scope: support.function.any-method.name-of-parameter.objc + captures: + 1: punctuation.separator.arguments.objc + - include: expressions + - include: expressions + + objc-structures: + - match: '((@)(interface|protocol))(?!.+;)\s+([[:alpha:]_][[:alnum:]_]*)\s*((:)(?:\s*)([[:alpha:]][[:alnum:]]*))?(\s|\n)?' + captures: + 1: storage.type.objc + 2: punctuation.definition.storage.type.objc + 4: entity.name.type.objc + 6: punctuation.definition.entity.other.inherited-class.objc + 7: entity.other.inherited-class.objc + 8: meta.divider.objc + 9: meta.inherited-class.objc + push: + - meta_scope: meta.interface-or-protocol.objc + - meta_content_scope: meta.scope.interface.objc + - match: ((@)end)\b + captures: + 1: storage.type.objc + 2: punctuation.definition.storage.type.objc + pop: true + - include: preprocessor-objc-structures + - include: objc-structure-body + - match: '((@)(implementation))\s+([[:alpha:]_][[:alnum:]_]*)\s*(?::\s*([[:alpha:]][[:alnum:]]*))?' + captures: + 1: storage.type.objc + 2: punctuation.definition.storage.type.objc + 4: entity.name.type.objc + 5: entity.other.inherited-class.objc + push: + - meta_scope: meta.implementation.objc + - meta_content_scope: meta.scope.implementation.objc + - match: ((@)end)\b + captures: + 1: storage.type.objc + 2: punctuation.definition.storage.type.objc + pop: true + - include: preprocessor-objc-structures + - include: objc-structure-body + + objc-structure-body: + - include: properties + - include: protocol_list + - include: method + - include: expressions + + method: + - match: ^(-|\+)\s* + push: + - meta_scope: meta.function.objc + - match: '\{' + scope: punctuation.section.block.begin.objc + set: + - meta_scope: meta.block.objc + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: (?=@end\b) + pop: true + - match: '\}' + scope: punctuation.section.block.end.objc + pop: true + - include: statements + - match: '(?=#|@end|;)' + pop: true + - match: '\(' + scope: meta.return-type.objc punctuation.definition.type.objc + push: + - meta_scope: meta.return-type.objc + - match: (\))\s*(\w+\b) + captures: + 1: punctuation.definition.type.objc + 2: entity.name.function.objc + pop: true + - include: protocol_list + - include: protocol_type_qualifier + - include: expressions + - match: \b\w+(?=:) + scope: entity.name.function.name-of-parameter.objc + - match: ((:))\s*(\() + captures: + 1: entity.name.function.name-of-parameter.objc + 2: punctuation.separator.arguments.objc + 3: punctuation.definition.type.objc + push: + - meta_scope: meta.argument-type.objc + - match: (\))\s*(\w+\b)? + captures: + 1: punctuation.definition.type.objc + 2: variable.parameter.function.objc + pop: true + - include: protocol_list + - include: protocol_type_qualifier + - include: expressions + - include: comments + - match: '(,)\s+(\.\.\.)\s*' + captures: + 1: punctuation.separator.objc + 2: keyword.operator.variadic.objc + push: + - include: scope:source.c#function-call + - match: '(?=\S)' + pop: true + + ## Preprocessor for objc-structures + + preprocessor-objc-structures: + - include: preprocessor-rule-enabled-objc-structures + - include: preprocessor-rule-disabled-objc-structures + + preprocessor-rule-disabled-objc-structures: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.objc + 2: keyword.control.import.objc + 3: constant.numeric.integer.decimal.objc + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.else.objc + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: objc-structure-body + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.objc + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-objc-structures: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.objc + 2: keyword.control.import.objc + 3: constant.numeric.integer.decimal.objc + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.else.objc + push: + - meta_content_scope: comment.block.preprocessor.else-branch.objc + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: objc-structure-body + + ################################ + # Directly from C.sublime-syntax + ################################ + + global-modifier: + - include: comments + - include: modifiers-parens + - include: modifiers + - match: '(?=\S)' + set: global-type + + global-type: + - include: comments + - match: \* + scope: keyword.operator.objc + - match: |- + (?x: + ({{before_tag}}) + \s+ + (?= + {{identifier}} + (\s+{{identifier}}(?!\s*[{=;])|\s*\*+) + ) + ) + captures: + 1: storage.type.objc + set: global-maybe-function + # The previous match handles return types of struct/enum/etc from a func, + # there this one exits the context to allow matching an actual struct/union + - match: '(?=\b({{before_tag}})\b)' + set: data-structures + - match: '(?=\b({{control_keywords}})\b)' + pop: true + - match: '(?=\s)' + set: global-maybe-function + # Allow a macro call + - match: '({{identifier}})\s*(\()(?=[^\)]+\))' + captures: + 1: variable.function.objc + 2: meta.group.objc punctuation.section.group.begin.objc + push: + - meta_scope: meta.function-call.objc + - meta_content_scope: meta.group.objc + - match: '\)' + scope: meta.group.objc punctuation.section.group.end.objc + pop: true + - include: expressions + - match: (?={{identifier}}\s*\() + set: + - include: function-call + - match: '' + pop: true + - include: types + - match: '{{identifier}}' + - match: (?=\W) + pop: true + + global-maybe-function: + - include: comments + # Consume pointer info, macros and any type info that was offset by macros + - match: \* + scope: keyword.operator.objc + - include: types + - include: modifiers-parens + - include: modifiers + # All uppercase identifier just before a newline is most likely a macro + - match: '[[:upper:][:digit:]_]+\s*$' + # Identifier that is not the function name - likely a macro + - match: '{{identifier}}(?!\s*(\(|$))' + # Real function definition + - match: '{{identifier}}(?=\s*(\(|$))' + scope: meta.function.objc entity.name.function.objc + set: function-definition-params + - match: '(?=\S)' + pop: true + + function-definition-params: + - meta_content_scope: meta.function.objc + - include: comments + - match: '(?=\()' + set: + - match: \( + scope: meta.function.parameters.objc meta.group.objc punctuation.section.group.begin.objc + set: + - meta_content_scope: meta.function.parameters.objc meta.group.objc + - match : \) + scope: punctuation.section.group.end.objc + set: function-definition-continue + - match: '\bvoid\b' + scope: storage.type.objc + - match: '{{identifier}}(?=\s*(\[|,|\)))' + scope: variable.parameter.objc + - include: expressions + - include: scope:source.c#preprocessor-line-continuation + - match: (?=\S) + pop: true + + function-definition-continue: + - meta_content_scope: meta.function.objc + - include: comments + - match: '(?=;)' + pop: true + - match: \b(const|final|noexcept|override)\b + scope: storage.modifier.objc + - match: '(?=\{)' + set: function-definition-body + - match: '(?=\S)' + pop: true + + function-definition-body: + - meta_content_scope: meta.function.objc + - match: '\{' + scope: meta.block.objc punctuation.section.block.begin.objc + set: + - meta_content_scope: meta.function.objc meta.block.objc + - match: '\}' + scope: meta.function.objc meta.block.objc punctuation.section.block.end.objc + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '(?=({{before_tag}})([^(;]+$|.*\{))' + push: data-structures + - include: statements + + data-structures: + # Detect variable type definitions using struct/enum/union followed by a tag + - match: '\b({{before_tag}})(?=\s+{{identifier}}\s+{{identifier}}\s*[=;\[])' + scope: storage.type.objc + - match: '\bstruct\b' + scope: storage.type.objc + set: data-structures-struct-definition + - match: '\benum\b' + scope: storage.type.objc + set: data-structures-enum-definition + - match: '\bunion\b' + scope: storage.type.objc + set: data-structures-union-definition + - match: '(?=\S)' + pop: true + + data-structures-struct-definition: + - meta_scope: meta.struct.objc + - include: data-structures-definition-common-begin + - include: data-structures-definition-common-macro + - match: '{{identifier}}(?=\s*;)' + scope: entity.name.struct.forward-decl.objc + - match: '{{identifier}}' + scope: entity.name.struct.objc + set: data-structures-struct-definition-after-name + - include: data-structures-struct-definition-block-start + - match: '(?=;)' + pop: true + + data-structures-struct-definition-after-name: + - meta_scope: meta.struct.objc + - include: data-structures-definition-common-begin + - match: '(?=;)' + pop: true + - include: data-structures-struct-definition-block-start + + data-structures-struct-definition-block-start: + - match: '\{' + scope: meta.block.objc punctuation.section.block.begin.objc + set: + - meta_content_scope: meta.struct.objc meta.block.objc + - match: '\}' + scope: meta.struct.objc meta.block.objc punctuation.section.block.end.objc + pop: true + - include: data-structures-body + + data-structures-enum-definition: + - meta_scope: meta.enum.objc + - include: data-structures-definition-common-begin + - include: data-structures-definition-common-macro + - match: '{{identifier}}(?=\s*;)' + scope: entity.name.enum.forward-decl.objc + - match: '{{identifier}}' + scope: entity.name.enum.objc + set: data-structures-enum-definition-after-name + - include: data-structures-enum-definition-block-start + - match: '(?=;)' + pop: true + + data-structures-enum-definition-after-name: + - meta_scope: meta.enum.objc + - include: data-structures-definition-common-begin + - match: '(?=;)' + pop: true + - include: data-structures-enum-definition-block-start + + data-structures-enum-definition-block-start: + - match: '\{' + scope: meta.block.objc punctuation.section.block.begin.objc + set: + - meta_content_scope: meta.enum.objc meta.block.objc + # Enums don't support methods so we have a simplified body + - match: '\}' + scope: meta.enum.objc meta.block.objc punctuation.section.block.end.objc + pop: true + - include: data-structures-body + + data-structures-union-definition: + - meta_scope: meta.union.objc + - include: data-structures-definition-common-begin + - include: data-structures-definition-common-macro + - match: '{{identifier}}(?=\s*;)' + scope: entity.name.union.forward-decl.objc + - match: '{{identifier}}' + scope: entity.name.union.objc + set: data-structures-union-definition-after-name + - include: data-structures-union-definition-block-start + - match: '(?=;)' + pop: true + + data-structures-union-definition-after-name: + - meta_scope: meta.union.objc + - include: data-structures-definition-common-begin + - match: '(?=;)' + pop: true + - include: data-structures-union-definition-block-start + + data-structures-union-definition-block-start: + - match: '\{' + scope: meta.block.objc punctuation.section.block.begin.objc + set: + - meta_content_scope: meta.union.objc meta.block.objc + - match: '\}' + scope: meta.union.objc meta.block.objc punctuation.section.block.end.objc + pop: true + - include: data-structures-body + + data-structures-definition-common-begin: + - include: comments + - match: '(?=\b(?:{{before_tag}}|{{control_keywords}})\b)' + pop: true + - include: modifiers-parens + - include: modifiers + + data-structures-definition-common-macro: + # Handle macros so they aren't matched as the class name + - match: '\b[[:upper:][:digit:]_]+\b(?!\s*($|\{))' + + data-structures-definition-common-end: + - match: '(?=;)' + pop: true + + data-structures-body: + - include: preprocessor-data-structures + - match: '(?={{before_tag}})' + push: data-structures + - include: expressions + + block: + - match: '\{' + scope: punctuation.section.block.begin.objc + push: + - meta_scope: meta.block.objc + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - match: '\}' + scope: punctuation.section.block.end.objc + pop: true + - include: statements + + parens: + - match: \( + scope: punctuation.section.group.begin.objc + push: + - meta_scope: meta.group.objc + - match: \) + scope: punctuation.section.group.end.objc + pop: true + - include: expressions + + brackets: + - match: \[ + scope: punctuation.section.brackets.begin.objc + push: + - meta_scope: meta.brackets.objc + - match: \] + scope: punctuation.section.brackets.end.objc + pop: true + - include: expressions + + case-default: + - match: '\b(default|case)\b' + scope: keyword.control.objc + push: + - match: ':' + scope: punctuation.separator.objc + pop: true + - include: expressions + + modifiers-parens: + - match: \b(__attribute__)\s*(\(\() + captures: + 1: storage.modifier.objc + 2: meta.group.objc punctuation.section.group.begin.objc + push : + - meta_scope: meta.attribute.objc + - meta_content_scope: meta.group.objc + - include: parens + - include: strings + - match: \)\) + scope: meta.group.objc punctuation.section.group.end.objc + pop: true + - match: \b(__declspec)(\() + captures: + 1: storage.modifier.objc + 2: meta.group.objc punctuation.section.group.begin.objc + push: + - meta_content_scope: meta.group.objc + - match: '\)' + scope: meta.group.objc punctuation.section.group.end.objc + pop: true + - match: '\b(align|allocate|code_seg|deprecated|property|uuid)\b\s*(\()' + captures: + 1: storage.modifier.objc + 2: meta.group.objc punctuation.section.group.begin.objc + push: + - meta_content_scope: meta.group.objc + - match: '\)' + scope: meta.group.objc punctuation.section.group.end.objc + pop: true + - include: numbers + - include: strings + - match: \b(get|put)\b + scope: variable.parameter.objc + - match: ',' + scope: punctuation.separator.objc + - match: '=' + scope: keyword.operator.assignment.objc + - match: '\b(appdomain|deprecated|dllimport|dllexport|jintrinsic|naked|noalias|noinline|noreturn|nothrow|novtable|process|restrict|safebuffers|selectany|thread)\b' + scope: constant.other.objc + + keywords-parens: + - match: '\b(sizeof)\b\s*(\()' + captures: + 1: keyword.operator.word.objc + 2: meta.group.objc punctuation.section.group.begin.objc + push: + - meta_content_scope: meta.group.objc + - match: '\)' + scope: meta.group.objc punctuation.section.group.end.objc + pop: true + - include: expressions + + typedef: + - match: \btypedef\b + scope: storage.type.objc + push: + - match: ({{identifier}})?\s*(?=;) + captures: + 1: entity.name.type.typedef.objc + pop: true + - match: \b(struct)\s+({{identifier}}) + captures: + 1: storage.type.objc + - include: expressions + + function-call: + - match: (?={{identifier}}\s*\() + push: + - meta_content_scope: meta.function-call.objc + - include: scope:source.c#c99 + - match: '{{identifier}}' + scope: variable.function.objc + - match: '\(' + scope: meta.group.objc punctuation.section.group.begin.objc + set: + - meta_content_scope: meta.function-call.objc meta.group.objc + - match : \) + scope: meta.function-call.objc meta.group.objc punctuation.section.group.end.objc + pop: true + - include: expressions + + ## Preprocessor for data-structures + + preprocessor-data-structures: + - include: preprocessor-rule-enabled-data-structures + - include: preprocessor-rule-disabled-data-structures + + preprocessor-rule-disabled-data-structures: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.objc + 2: keyword.control.import.objc + 3: constant.numeric.integer.decimal.objc + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.else.objc + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: data-structures-body + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.objc + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-data-structures: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.objc + 2: keyword.control.import.objc + 3: constant.numeric.integer.decimal.objc + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.else.objc + push: + - meta_content_scope: comment.block.preprocessor.else-branch.objc + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: data-structures-body + + ## Preprocessor for global + + preprocessor-global: + - include: preprocessor-rule-enabled-global + - include: preprocessor-rule-disabled-global + - include: preprocessor-rule-other-global + + preprocessor-statements: + - include: preprocessor-rule-enabled-statements + - include: preprocessor-rule-disabled-statements + - include: preprocessor-rule-other-statements + + preprocessor-expressions: + - include: scope:source.c#incomplete-inc + - include: preprocessor-macro-define + - include: scope:source.c#pragma-mark + - include: preprocessor-other + + preprocessor-rule-disabled-global: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.objc + 2: keyword.control.import.objc + 3: constant.numeric.integer.decimal.objc + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.else.objc + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.objc + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-global: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.objc + 2: keyword.control.import.objc + 3: constant.numeric.integer.decimal.objc + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.else.objc + push: + - meta_content_scope: comment.block.preprocessor.else-branch.objc + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + + preprocessor-rule-other-global: + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: keyword.control.import.objc + push: + - meta_scope: meta.preprocessor.objc + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: \bdefined\b + scope: keyword.control.objc + # Enter a new scope where all elif/else branches have their + # contexts popped by a subsequent elif/else/endif. This ensures that + # preprocessor branches don't push multiple meta.block scopes on + # the stack, thus messing up the "global" context's detection of + # functions. + - match: $\n + set: preprocessor-if-branch-global + + # These gymnastics here ensure that we are properly handling scope even + # when the preprocessor is used to create different scope beginnings, such + # as a different if/while condition + preprocessor-if-branch-global: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-global + - match: \{ + scope: punctuation.section.block.begin.objc + set: preprocessor-block-if-branch-global + - include: preprocessor-global + - include: negated-block + - include: global + + preprocessor-block-if-branch-global: + - meta_scope: meta.block.objc + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + set: preprocessor-block-finish-global + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-global + - match: \} + scope: punctuation.section.block.end.objc + set: preprocessor-if-branch-global + - include: statements + + preprocessor-block-finish-global: + - meta_scope: meta.block.objc + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + set: preprocessor-block-finish-if-branch-global + - match: \} + scope: punctuation.section.block.end.objc + pop: true + - include: statements + + preprocessor-block-finish-if-branch-global: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: \} + scope: punctuation.section.block.end.objc + set: preprocessor-if-branch-global + - include: statements + + preprocessor-elif-else-branch-global: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: preprocessor-global + - include: negated-block + - include: global + + ## Preprocessor for statements + + preprocessor-rule-disabled-statements: + - match: ^\s*((#if)\s+(0))\b + captures: + 1: meta.preprocessor.objc + 2: keyword.control.import.objc + 3: constant.numeric.integer.decimal.objc + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.else.objc + push: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: statements + - match: "" + push: + - meta_scope: comment.block.preprocessor.if-branch.objc + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: scope:source.c#preprocessor-disabled + + preprocessor-rule-enabled-statements: + - match: ^\s*((#if)\s+(0*1))\b + captures: + 1: meta.preprocessor.objc + 2: keyword.control.import.objc + 3: constant.numeric.integer.decimal.objc + push: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: ^\s*(#\s*else)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.else.objc + push: + - meta_content_scope: comment.block.preprocessor.else-branch.objc + - match: (?=^\s*#\s*endif\b) + pop: true + - include: scope:source.c#preprocessor-disabled + - match: "" + push: + - match: (?=^\s*#\s*(else|endif)\b) + pop: true + - include: negated-block + - include: statements + + preprocessor-rule-other-statements: + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: keyword.control.import.objc + push: + - meta_scope: meta.preprocessor.objc + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: \bdefined\b + scope: keyword.control.objc + # Enter a new scope where all elif/else branches have their + # contexts popped by a subsequent elif/else/endif. This ensures that + # preprocessor branches don't push multiple meta.block scopes on + # the stack, thus messing up the "global" context's detection of + # functions. + - match: $\n + set: preprocessor-if-branch-statements + + # These gymnastics here ensure that we are properly handling scope even + # when the preprocessor is used to create different scope beginnings, such + # as a different if/while condition + preprocessor-if-branch-statements: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-statements + - match: \{ + scope: punctuation.section.block.begin.objc + set: preprocessor-block-if-branch-statements + - match: (?=(?!{{non_func_keywords}}){{identifier}}\s*\() + set: preprocessor-if-branch-function-call + - include: negated-block + - include: statements + + preprocessor-if-branch-function-call: + - meta_content_scope: meta.function-call.objc + - include: scope:source.c#c99 + - match: '{{identifier}}' + scope: variable.function.objc + - match: '\(' + scope: meta.group.objc punctuation.section.group.begin.objc + set: preprocessor-if-branch-function-call-arguments + + preprocessor-if-branch-function-call-arguments: + - meta_content_scope: meta.function-call.objc meta.group.objc + - match : \) + scope: meta.function-call.objc meta.group.objc punctuation.section.group.end.objc + set: preprocessor-if-branch-statements + - match: ^\s*(#\s*(?:elif|else))\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + set: preprocessor-if-branch-statements + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + set: preprocessor-if-branch-function-call-arguments-finish + - include: expressions + + preprocessor-if-branch-function-call-arguments-finish: + - meta_content_scope: meta.function-call.objc meta.group.objc + - match: \) + scope: meta.function-call.objc meta.group.objc punctuation.section.group.end.objc + pop: true + - include: expressions + + preprocessor-block-if-branch-statements: + - meta_scope: meta.block.objc + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + set: preprocessor-block-finish-statements + - match: (?=^\s*#\s*(elif|else)\b) + push: preprocessor-elif-else-branch-statements + - match: \} + scope: punctuation.section.block.end.objc + set: preprocessor-if-branch-statements + - include: statements + + preprocessor-block-finish-statements: + - meta_scope: meta.block.objc + - match: ^\s*(#\s*(?:if|ifdef|ifndef))\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + set: preprocessor-block-finish-if-branch-statements + - match: \} + scope: punctuation.section.block.end.objc + pop: true + - include: statements + + preprocessor-block-finish-if-branch-statements: + - match: ^\s*(#\s*endif)\b + captures: + 1: meta.preprocessor.objc keyword.control.import.objc + pop: true + - match: \} + scope: punctuation.section.block.end.objc + set: preprocessor-if-branch-statements + - include: statements + + preprocessor-elif-else-branch-statements: + - match: (?=^\s*#\s*endif\b) + pop: true + - include: negated-block + - include: statements + + ## Preprocessor other + + negated-block: + - match: '\}' + scope: punctuation.section.block.end.objc + push: + - match: '\{' + scope: punctuation.section.block.begin.objc + pop: true + - match: (?=^\s*#\s*(elif|else|endif)\b) + pop: true + - include: statements + + preprocessor-macro-define: + - match: ^\s*(\#\s*define)\b + captures: + 1: meta.preprocessor.macro.objc keyword.control.import.define.objc + push: + - meta_content_scope: meta.preprocessor.macro.objc + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - match: '({{identifier}})(?=\()' + scope: entity.name.function.preprocessor.objc + set: + - match: '\(' + scope: punctuation.section.group.begin.objc + set: preprocessor-macro-params + - match: '{{identifier}}' + scope: entity.name.constant.preprocessor.objc + set: preprocessor-macro-definition + + preprocessor-macro-params: + - meta_scope: meta.preprocessor.macro.parameters.objc meta.group.objc + - match: '{{identifier}}' + scope: variable.parameter.objc + - match: \) + scope: punctuation.section.group.end.objc + set: preprocessor-macro-definition + - match: ',' + scope: punctuation.separator.objc + push: + - match: '{{identifier}}' + scope: variable.parameter.objc + pop: true + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.objc + - match: '(?=\))' + pop: true + - match: (/\*).*(\*/) + scope: comment.block.objc + captures: + 1: punctuation.definition.comment.objc + 2: punctuation.definition.comment.objc + - match: '\S+' + scope: invalid.illegal.unexpected-character.objc + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.objc + - match: (/\*).*(\*/) + scope: comment.block.objc + captures: + 1: punctuation.definition.comment.objc + 2: punctuation.definition.comment.objc + - match: $\n + scope: invalid.illegal.unexpected-end-of-line.objc + + preprocessor-macro-definition: + - meta_content_scope: meta.preprocessor.macro.objc + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + # Don't define blocks in define statements + - match: '\{' + scope: punctuation.section.block.begin.objc + - match: '\}' + scope: punctuation.section.block.end.objc + - include: expressions + + preprocessor-other: + - match: ^\s*(#\s*(?:if|ifdef|ifndef|elif|else|line|pragma|undef))\b + captures: + 1: keyword.control.import.objc + push: + - meta_scope: meta.preprocessor.objc + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - match: \bdefined\b + scope: keyword.control.objc + - match: ^\s*(#\s*(endif)\b) + captures: + 1: meta.preprocessor.objc + 2: keyword.control.import.objc + - match: ^\s*(#\s*(?:error|warning))\b + captures: + 1: keyword.control.import.error.objc + push: + - meta_scope: meta.preprocessor.diagnostic.objc + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - include: strings + - match: '\S+' + scope: string.unquoted.objc + - match: ^\s*(#\s*(?:include|include_next))\b + captures: + 1: keyword.control.import.include.objc + push: + - meta_scope: meta.preprocessor.include.objc + - include: preprocessor-other-include-common + - match: ^\s*(#\s*import)\b + captures: + 1: keyword.control.import.import.objc + push: + - meta_scope: meta.preprocessor.import.objc + - include: preprocessor-other-include-common + - include: scope:source.c#preprocessor-practical-workarounds + + preprocessor-other-include-common: + - include: scope:source.c#preprocessor-line-continuation + - include: scope:source.c#preprocessor-line-ending + - include: scope:source.c#preprocessor-comments + - match: '"' + scope: punctuation.definition.string.begin.objc + push: + - meta_scope: string.quoted.double.include.objc + - match: '"' + scope: punctuation.definition.string.end.objc + pop: true + - match: < + scope: punctuation.definition.string.begin.objc + push: + - meta_scope: string.quoted.other.lt-gt.include.objc + - match: ">" + scope: punctuation.definition.string.end.objc + pop: true diff --git a/assets/syntaxes/Packages/Objective-C/Symbol Index Include Constants.tmPreferences b/assets/syntaxes/Packages/Objective-C/Symbol Index Include Constants.tmPreferences new file mode 100644 index 000000000..1e75b0ec6 --- /dev/null +++ b/assets/syntaxes/Packages/Objective-C/Symbol Index Include Constants.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + + settings + + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/Objective-C/Symbol Index.tmPreferences b/assets/syntaxes/Packages/Objective-C/Symbol Index.tmPreferences new file mode 100644 index 000000000..5ff861fc2 --- /dev/null +++ b/assets/syntaxes/Packages/Objective-C/Symbol Index.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + source.objc, source.objc++ + settings + + symbolIndexTransformation + /([A-Za-z0-9_~]+):/$1/; + + + diff --git a/assets/syntaxes/Packages/Objective-C/syntax_test_accessor.m b/assets/syntaxes/Packages/Objective-C/syntax_test_accessor.m new file mode 100644 index 000000000..4faa52c7b --- /dev/null +++ b/assets/syntaxes/Packages/Objective-C/syntax_test_accessor.m @@ -0,0 +1,35 @@ +// SYNTAX TEST "Packages/Objective-C/Objective-C.sublime-syntax" + +typedef struct _X +{ + int a; + int b; +} X; + +int main() +{ + X x; + x. +// ^ punctuation.accessor +} + +int main() +{ + X x; + x.. +// ^^ invalid.illegal - punctuation.accessor +} + +int main() +{ + X x; + x... +// ^^^ keyword - punctuation.accessor +} + +int main() +{ + X* x = malloc(sizeof(X)); + x-> +// ^^ punctuation.accessor +} diff --git a/assets/syntaxes/Packages/Objective-C/syntax_test_accessor.mm b/assets/syntaxes/Packages/Objective-C/syntax_test_accessor.mm new file mode 100644 index 000000000..2c28b49af --- /dev/null +++ b/assets/syntaxes/Packages/Objective-C/syntax_test_accessor.mm @@ -0,0 +1,68 @@ +// SYNTAX TEST "Packages/Objective-C/Objective-C++.sublime-syntax" + +namespace N { + +class X +{ + public: + int a; + int b; +}; + +class Y : public X +{ + public: + int c; +} + +} // namespace N + +int main() +{ + N:: +// ^^ punctuation.accessor +} + +int main() +{ + N::X x; + x. +// ^ punctuation.accessor +} + +int main() +{ + N::X x; + x.. +// ^^ - punctuation.accessor +} + +int main() +{ + N::X x; + x... +// ^^^ keyword - punctuation.accessor +} + +int main() +{ + N::X* x = new X(); + x-> +// ^^ punctuation.accessor +} + +int main() +{ + N::Y y; + y.X:: +// ^ punctuation.accessor +// ^^ punctuation.accessor +} + +int main() +{ + N::Y* y = new Y(); + y->X:: +// ^^ punctuation.accessor +// ^^ punctuation.accessor +} diff --git a/assets/syntaxes/Packages/Objective-C/syntax_test_objc++.mm b/assets/syntaxes/Packages/Objective-C/syntax_test_objc++.mm new file mode 100644 index 000000000..946c32227 --- /dev/null +++ b/assets/syntaxes/Packages/Objective-C/syntax_test_objc++.mm @@ -0,0 +1,2645 @@ +/* SYNTAX TEST "Packages/Objective-C/Objective-C++.sublime-syntax" */ + +int main(){ + int a=5,b=0; + while(a-->0)++b; + /* ^^ keyword.operator.arithmetic */ + /* ^ keyword.operator.comparison */ + /* ^ constant.numeric */ + /* ^^ keyword.operator.arithmetic */ +} + +///////////////////////////////////////////// +// Preprocessor +///////////////////////////////////////////// + +#ifndef IGUARD_ + /* <- keyword.control.import */ +#define IGUARD_ + /* <- keyword.control.import.define */ +struct foo* alloc_foo(); +/* <- storage.type */ + /* <- - entity.name.type */ + /* <- entity.name.function */ +#endif + /* <- keyword.control.import */ + +// The following example ensures that comments at the end of preprocessor +// directives don't mess with context transitions +int func() { +/* ^ entity.name.function */ + #if( EXTAL == 40000 ) /* 40 MHz */ +/* ^ keyword.control.import */ + #define PLL_RFD_PHI1 10 // PLL0_PH1 = 40MHz +/* ^ keyword.control.import */ +/* ^^ constant.numeric */ +/* ^ comment.line */ + #endif +/* ^ keyword.control.import */ +} +/* <- meta.function meta.block punctuation.section.block.end */ + /* <- - meta.function meta.block */ + +int f(int x, \ + /* ^ punctuation.separator.continuation */ + int y); + +int g(int x = 5 \ + /* ^ punctuation.separator.continuation */ + , int y); + +#define MACRO_WITH_CURLY_BRACE { +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +#define MACRO_WITH_CURLY_BRACE_2 } +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +FOOBAR +hello() { + /* <- meta.function entity.name.function */ + return 0; +} + +EFIAPI +UserStructCompare ( + /* <- meta.function entity.name.function */ + IN CONST VOID *UserStruct1, + IN CONST VOID *UserStruct2 + ) +{ + const USER_STRUCT *CmpStruct1; + /* <- meta.block storage.modifier */ + + CmpStruct1 = UserStruct1; + return KeyCompare (&CmpStruct1->Key, UserStruct2); + /* <- meta.block keyword.control */ + /* ^ meta.block meta.function-call variable.function */ +} + +LIB_RESULT +foo() +/* <- meta.function entity.name.function */ +{ + return LIB_SUCCESS; +} + +LIB_RESULT bar() +/* ^ meta.function entity.name.function */ +{ + return LIB_SUCCESS; +} + +THIS_IS_REALLY_JUST_A_MACRO_AND_NOT_A_RETURN_TYPE +/* <- meta.assumed-macro */ + +int main() { +/* <- storage.type */ + /* ^ meta.function entity.name.function */ + return 0; +} + +// This is a method/function with the return type on a separate line and so should not be a +// constructor. +FOOLIB_RESULT +some_namespace::some_function(int a_parameter, double another_parameter) { + /* <- meta.function meta.toc-list.full-identifier */ + /* ^ entity.name.function - entity.name.function.constructor */ + return FOOLIB_SUCCESS; +} + +#pragma foo(bar, \ +"baz", \ +1) +/* <- meta.preprocessor */ + +#define MY_MACRO(a, b) +/*^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* ^^^^^^ meta.preprocessor.macro.parameters */ +/* ^^^^^^^^ entity.name.function.preprocessor */ +/* ^ punctuation.section.group.end */ + +#define max(a, b, \ +/*^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ \ +/* ^^^^^^^^ meta.preprocessor.macro.parameters */ \ +/* <- keyword.control.import.define */ \ +/* ^ entity.name.function.preprocessor */ \ +/* ^ punctuation.section.group.begin */ \ +/* ^ variable.parameter */ \ +/* ^ punctuation.separator */ \ +/* */ \ +/* <- comment.block */ \ + c) ((a>b) ? (a>c?a:c) : (b>c?b:c)) + /* <- meta.preprocessor.macro meta.group variable.parameter */ + /* <- meta.preprocessor.macro meta.group punctuation.section.group.end */ + /* ^ keyword.operator.ternary */ + /* ^ keyword.operator.ternary */ + +#if 0 +#ifdef moo +/* <- - keyword.control */ +#endif +/* <- - keyword.control */ +#endif + +FOO() +/* <- meta.assumed-macro variable.function.assumed-macro */ +FOO +/* <- meta.assumed-macro */ + +struct FOO1 FOO2 FOO3 Test { + /* ^ meta.struct meta.assumed-macro */ + /* ^ meta.struct meta.assumed-macro */ + /* ^ meta.struct meta.assumed-macro */ + Test(); + Test() noexcept; + Test() final; + Test() noexcept final; + ~Test(); + ~Test() noexcept; + ~Test() override noexcept; + virtual ~Test(); + virtual ~Test() noexcept; + virtual ~Test() override noexcept; + DLL_API Test(); + /* <- meta.assumed-macro */ + /* ^ meta.method.constructor */ + DLL_API Test() noexcept; + /* <- meta.assumed-macro */ + /* ^ meta.method.constructor */ + /* ^ storage.modifier */ + DLL_API Test() final; + /* <- meta.assumed-macro */ + /* ^ meta.method.constructor */ + /* ^ storage.modifier */ + DLL_API Test() noexcept final; + /* <- meta.assumed-macro */ + /* ^ meta.method.constructor */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + DLL_API ~Test(); + /* <- meta.assumed-macro */ + /* ^ meta.method.destructor */ + DLL_API ~Test() noexcept; + /* <- meta.assumed-macro */ + /* ^ meta.method.destructor */ + /* ^ storage.modifier */ + DLL_API ~Test() override noexcept; + /* <- meta.assumed-macro */ + /* ^ meta.method.destructor */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + DLL_API virtual ~Test(); + /* <- meta.assumed-macro */ + /* ^ storage.modifier */ + /* ^ meta.method.destructor */ + DLL_API virtual ~Test() noexcept; + /* <- meta.assumed-macro */ + /* ^ storage.modifier */ + /* ^ meta.method.destructor */ + /* ^ storage.modifier */ + DLL_API virtual ~Test() override noexcept; + /* <- meta.assumed-macro */ + /* ^ storage.modifier */ + /* ^ meta.method.destructor */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ +} + +struct X { + X(); + /* <- meta.group */ + /*^ meta.group - meta.group meta.group */ +}; + +#define DEPRECATED(msg) [[deprecated(msg)]] + +struct Test { + DEPRECATED("bla") + /* <- meta.assumed-macro variable.function.assumed-macro */ + bool foo (bool run=true) {} + /* ^ entity.name.function */ +}; + +namespace Test { + DEPRECATED("bla") + /* <- meta.assumed-macro variable.function.assumed-macro */ + bool foo (bool run=true) {} + /* ^ entity.name.function */ +} + +struct Test { +DEPRECATED("bla") +/* <- meta.assumed-macro variable.function.assumed-macro */ +bool foo (bool run=true) {} +/* ^ entity.name.function */ +}; + +///////////////////////////////////////////// +// Strings +///////////////////////////////////////////// + +char str1[] = "abc"; +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ +/* ^ punctuation.definition.string.end */ + +char str2[] = u8"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ + +char16_t str3[] = u"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ + +char32_t str4[] = U"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ + +wchar_t str5[] = L"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ + +char str6[] = "\a|\b|\e|\f|\n|\r|\t|\v|\'|\"|\?"; +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ +/* ^^ constant.character.escape */ + +char str7[] = "\0|\012"; +/* ^^ constant.character.escape */ +/* ^^^^ constant.character.escape */ + +char str8[] = "\x0a|\x41|\xA|\x000065"; +/* ^^^^ constant.character.escape */ +/* ^^^^ constant.character.escape */ +/* ^^^ constant.character.escape */ +/* ^^^^^^^^ constant.character.escape */ + +char16_t str9[] = u"\u0063"; +/* ^^^^^^ constant.character.escape */ + +char32_t str10[] = U"\U00000063"; +/* ^^^^^^^^^^ constant.character.escape */ + +char str11[] = "\q"; +/* ^^ invalid.illegal.unknown-escape */ + +scanf("%ms %as %*[, ]", &buf); +/* ^^^ constant.other.placeholder */ +/* ^^^ constant.other.placeholder */ +/* ^^^^^^ constant.other.placeholder */ + +"foo % baz" +/* ^ - invalid */ + +char rawStr1[] = R"("This is a raw string")"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ +/* ^ punctuation.definition.string.end */ + +char rawStr2[] = R"A*!34( )" )A*!34"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ +/* ^ punctuation.definition.string.end */ +/* ^ punctuation.definition.string.end */ + +const char IncludeRegexPattern[] = + R"(^[\t\ ]*#[\t\ ]*(import|include)[^"<]*(["<][^">]*[">]))"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^^ - invalid */ +/* ^^ - invalid */ +/* ^ punctuation.definition.string.end */ + + +///////////////////////////////////////////// +// Storage Types +///////////////////////////////////////////// + +void* ptr; +/* <- storage.type */ + +bool b; +/* <- storage.type */ + +char ch; +/* <- storage.type */ + +char16_t ch16; +/* <- storage.type */ + +char32_t ch32; +/* <- storage.type */ + +wchar_t wch; +/* <- storage.type */ + +unsigned int ui; +/* <- storage.type */ +/* ^ storage.type */ + +signed long l; +/* <- storage.type */ +/* ^ storage.type */ + +short s; +/* <- storage.type */ + +auto a = 2; +/* <- storage.type */ + +decltype(s) dt; +/* <- storage.type */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + +float f; +/* <- storage.type */ + +double d; +/* <- storage.type */ + +typedef int my_int; +/* <- storage.type */ +/* ^ entity.name.type */ + +typedef struct Books { +/* ^ storage.type */ +/* ^ - entity.name.type */ + char title[50]; + int book_id; +} Book; +/*^ entity.name.type */ + +typedef struct Books Book; +/* ^ - entity.name.type.struct */ +/* ^ entity.name.type.typedef */ + +using Alias = Foo; +/* <- keyword.control */ +/* ^^^^^ entity.name.type.using */ + +using Alias + = NewLineFoo; +/*^ - entity.name */ + +template +using TemplateAlias = Foo; +/* ^^^^^^^^^^^^^ entity.name.type.using */ + +using std::cout; +/* <- keyword.control */ +/* ^ - entity.name */ + +using std:: + cout; +/*^ - entity.name */ + +class MyClass : public SuperClass +{ + using This = MyClass; +/* ^ keyword.control */ +/* ^^^^ entity.name.type.using */ + + using MyInt +/* ^ keyword.control */ + = int32_t; + + using SuperClass::SuperClass; +/* ^ keyword.control */ +/* ^ - entity.name */ +}; + +class MyClass : public CrtpClass +{ + using typename CrtpClass::PointerType; +/* ^ keyword.control */ +/* ^ storage.modifier */ + using CrtpClass< +/* ^ keyword.control */ + MyClass>::method; +}; + +template class MyStack; +/* <- storage.type.template */ +/* ^ punctuation.section.generic */ +/* ^ storage.type */ +/* ^ constant.numeric */ +/* ^ punctuation.section.generic */ + +template class tupleTmpl; +/* <- storage.type.template */ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.template */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.end */ + +template, typename... Rest> class tupleVariadic; +/* <- storage.type.template */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^ punctuation.separator */ +/* ^^^ keyword.operator.variadic */ +/* ^ punctuation.section.generic.end */ + +template void SomeClass::function(); +/* ^^^ keyword.operator.variadic */ +/* ^^^^^^^^ entity.name.function */ + +template inline struct Foo* baz() +/* ^^^^^^ storage.modifier */ +/* ^ - entity.name */ +/* ^^^ meta.function entity.name.function */ +{} + +template +void classname::methodName() { +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^ punctuation.accessor */ +/* ^^^^^^^^^^ entity.name.function */ +} + +template +void funcName() { +/* ^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^ entity.name.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +} +bool A::operator<(const A& a) { return false; } +/* ^ storage.type */ +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^ entity.name.function */ +/* ^ meta.function.parameters punctuation.section.group.begin */ +template bool A::operator<(const A& a) { return false; } +/* ^ storage.type.template */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^ entity.name.function */ +/* ^ meta.function.parameters meta.group punctuation.section.group.begin */ +template +SomeType A::foobar(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ + +template SomeType A::foobar(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ + +template A::A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function */ + +template A::A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function.constructor */ + +template A::~A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function.destructor */ + +template +bool A::operator > (const A& other) { return false; } +/* ^^^^^^^^^^^^ meta.function entity.name.function */ +template +bool A::operator == (const A& other) { return false; } +/* ^^^^^^^^^^^^^^ meta.function entity.name.function */ +typedef std :: vector > Table; +/* ^^ punctuation.accessor */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^ punctuation.section.generic.end */ + +template + /* ^ meta.template keyword.operator */ + /* ^ meta.template keyword.operator */ + /* ^ meta.template constant.numeric */ + /* ^ meta.template keyword.operator */ + /* ^ meta.template constant.language */ +struct Foo +{ + +/* <- meta.struct - meta.template */ + + void bar(int a = 3, bool b = true) {} + /* ^ - meta.template keyword.operator */ + /* ^ - meta.template constant.numeric */ + /* ^ - meta.template keyword.operator */ + /* ^ - meta.template constant.language */ +}; + +/* <- - meta.block - meta.struct - meta.template */ + +template +/* ^^ meta.template punctuation.accessor */ +/* ^ meta.template keyword.operator */ +/* ^ meta.template constant.numeric */ +class fixed_array : private std::array {}; + +constexpr std::size_t f() { return 128; } +template +/* ^^ meta.template punctuation.accessor */ +/* ^ meta.template keyword.operator */ +/* ^ meta.template variable.function */ +/* ^^ meta.template meta.function-call punctuation */ +/* ^ meta.template punctuation */ +class fixed_array : private std::array {}; + +template class A { /* ... */ }; +template class B { /* ... */ }; +/* ^ meta.template keyword.operator */ +/* ^ meta.template */ +/* ^ meta.template punctuation */ +/* ^ - meta.template */ +template class C { /* ... */ }; + +// templates inside templates... it's templates all the way down +template class P> class X { /* ... */ }; +/* ^ meta.template punctuation */ +/* ^ meta.template meta.template punctuation */ +/* ^^^^^ meta.template meta.template storage.type */ +/* ^ meta.template meta.template punctuation */ +/* ^^^^^ meta.template storage.type */ +/* ^ meta.template punctuation */ + +X xa; // OK +X xb; // OK in C++14 after CWG 150 + // Error earlier: not an exact match +X xc; // OK in C++14 after CWG 150 + +// template declarations spanning multiple lines +template +/* <- meta.template storage.type */ +< +/* <- meta.template punctuation.section.generic.begin */ + class T, + class U = T +> +class B +{ + /* ... */ +}; + +// template declarations spanning multiple lines +template +< +/* <- meta.template punctuation.section.generic.begin */ + std::size_t Count = f() +/* ^^ meta.template punctuation.accessor */ +/* ^ meta.template keyword.operator */ +/* ^ meta.template variable.function */ +/* ^^ meta.template meta.function-call punctuation */ +> +/* <- meta.template punctuation.section.generic.end */ +class fixed_array : private std::array {}; + +template +static bool decode(const Node& node, T& sequence) { + if (!node.IsSequence()) + return false; + sequence.clear(); + for (const auto& item : node) { + sequence.push_back(item.template as()); + /* ^ punctuation.accessor */ + /* ^ storage.type - variable.other */ + /* ^ variable.function */ + /* ^ punctuation */ + /* ^^ punctuation.accessor */ + /* ^ punctuation */ + } + return true; +} + +#include +template struct A {}; +template struct B {}; +struct C {}; +A> f(std::function>()> g) { + /* ^ punctuation.section.group.begin */ + /* ^^ punctuation.accessor */ + /* ^ punctuation.section.generic.begin */ + /* ^ punctuation.section.generic.begin */ + /* ^ punctuation.section.generic.begin */ + /* ^^ punctuation.section.generic.end */ + /* ^ punctuation.section.group.begin */ + /* ^ punctuation.section.group.end */ + /* ^ punctuation.section.generic.end */ + /* ^ variable.parameter */ + /* ^ punctuation.section.group.end */ + /* ^ punctuation.section.block.begin */ + return g(); +} +int main() { + std::function foo1; + /* ^ - variabe.function */ + std::function()> foo2; + /* ^ - variable.function */ + auto f = [](std::function>()> g) { return g(); }; + /* ^ punctuation.section.group.begin */ + /* ^^ punctuation.accessor */ + /* ^ punctuation.section.generic.begin */ + /* ^ punctuation.section.generic.begin */ + /* ^ punctuation.section.generic.begin */ + /* ^^ punctuation.section.generic.end */ + /* ^ punctuation.section.group.begin */ + /* ^ punctuation.section.group.end */ + /* ^ punctuation.section.generic.end */ + /* ^ punctuation.section.group.end */ + /* ^ punctuation.section.block.begin */ + /* ^ punctuation.section.block.end */ + return 0; +} +/* <- - invalid.illegal */ + +// Example from section 14.2/4 of +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3690.pdf +struct X +{ + template + X* alloc(); + + template + static X* adjust(); +}; +template +void f(T* p) +{ + // Be optimistic: scope it as a template member function call anyway. + T* p1 = p->alloc<200>(); // ill-formed: < means less than + + T* p2 = p->template alloc<200>(); // OK: < starts template argument list + /* ^ punctuation.accessor */ + /* ^ storage.type - variable.other */ + /* ^ variable.function */ + + // Be optimistic: scope it as a template member function call anyway. + T::adjust<100>(); // ill-formed: < means less than + + T::template adjust<100>(); // OK: < starts template argument list + /* <- - variable.function */ + /*^ punctuation.accessor */ + /* ^ storage.type - variable.other */ + /* ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call */ + /* ^ variable.function */ +} + +struct X +{ + void template(); // <-- not allowed to be a function! + /* ^ - entity.name.function */ +}; + +void f() +{ + X x; + x.template(); // <-- should not be scoped as variable.function! + /* ^ - variable.function */ + + x /**/ . /**/ foo <5> /**/ () /**/ ; + /*^^^^ comment.block */ + /* ^ punctuation.accessor */ + /* ^^^ meta.method-call variable.function */ + /* ^ meta.method-call - variable.function */ + /* ^ meta.method-call punctuation.section.generic.begin */ + /* ^ meta.method-call punctuation.section.generic.end */ + /* ^ meta.method-call - punctuation - comment.block */ + /* ^^^^ meta.method-call comment.block */ + /* ^ meta.method-call - comment.block - punctuation */ + /* ^^ meta.method-call punctuation - comment.block */ + /* ^ - meta.method-call */ +}; + +template C f(T t) +{ + return C { g>(t) }; + /* ^ variable.function */ + /* ^ punctuation.section.group.begin */ +} + +template C> f(T t) +{ + return C> { g>(t) }; + /* ^ variable.function */ + /* ^ punctuation.section.group.begin */ +} + +struct A { int foo; }; +int main() { + A a; + a.foo = a.foo < 0 ? 1 : 2; + /* ^ - punctuation.section.generic */ +} +/* <- - invalid.illegal */ + +template +struct A::value && !is_std_char_type::value>> { + using x = conditional_t; + /* ^^ keyword.operator */ +}; +/* <- - invalid.illegal */ + + +///////////////////////////////////////////// +// Storage Modifiers +///////////////////////////////////////////// + +alignas(16) char array[256]; +/* <- storage.modifier */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + +const int XYZ = 2; +/* <- storage.modifier */ + +constexpr int ABC = 3 + 5; +/* <- storage.modifier */ + +thread_local int x; +/* <- storage.modifier */ + + +///////////////////////////////////////////// +// Control Keywords +///////////////////////////////////////////// + +static_assert(x >= 0); +/* <- keyword.operator */ + +noexcept(f()); +/* ^^^ meta.function-call */ +/* <- keyword.operator */ + +if (x < 5) +/* <- keyword.control */ +{} +else +/* <- keyword.control */ +{} + +switch (x) +/* <- keyword.control */ +{ +case 1: +/* <- keyword.control */ + break; + /* <- keyword.control.flow.break */ +default: +/* <- keyword.control */ + break; + /* <- keyword.control.flow.break */ +} + +do +/* <- keyword.control */ +{ + if (y == 3) + continue; + /* <- keyword.control.flow.continue */ +} while (y < x); +/*^ keyword.control */ + +switch (a) { + case 1: break; +/* ^ punctuation.separator */ + case 100 - 10: break; +/* ^ punctuation.separator */ + default: break; +/* ^ punctuation.separator */ +} + +goto label; +/* <- keyword.control.flow.goto */ + +try +/* <- keyword.control */ +{ + throw std :: string("xyz"); + /* <- keyword.control.flow.throw */ + /* ^^^^^^ variable.function */ + /* ^^ punctuation.accessor */ +} +catch (...) +/* <- keyword.control */ +{ +} + +int* ptr = new int(2); +/* ^ keyword.control */ + +delete ptr; +/* <- keyword.control */ + +return 123; +/* <- keyword.control.flow.return */ + + +///////////////////////////////////////////// +// Operator Keywords +///////////////////////////////////////////// + +int x = alignof(char); +/* ^ keyword.operator.word */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + +int x = sizeof(char); +/* ^ keyword.operator.word */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + + +///////////////////////////////////////////// +// Cast Keywords +///////////////////////////////////////////// + +const_cast(2.0); +/* <- keyword.operator.word.cast */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.end */ + +dynamic_cast(2.0); +/* <- keyword.operator.word.cast */ + +reinterpret_cast(2.0); +/* <- keyword.operator.word.cast */ + +static_cast(2.0); +/* <- keyword.operator.word.cast */ + +auto var = *reinterpret_cast>*>(v); +/* ^ keyword.operator.word.cast */ +/* ^ - variable.function */ + +///////////////////////////////////////////// +// Language Constants +///////////////////////////////////////////// + +bool t = true; +/* ^ constant.language */ + +bool f = false; +/* ^ constant.language */ + +int* p = nullptr; +/* ^ constant.language */ + +char ch[] = __func__; +/* ^ constant.language */ + + +///////////////////////////////////////////// +// Support Constants +///////////////////////////////////////////// + +std::cout << __FILE__ << '\n'; +/* ^ support.constant */ +/* ^^ punctuation.accessor */ + +std :: cout << __FUNCTION__ << '\n'; +/* ^^ punctuation.accessor */ +/* ^ support.constant */ + +std::cout << __LINE__ << '\n'; +/* ^ support.constant */ + + +///////////////////////////////////////////// +// Numeric Constants +///////////////////////////////////////////// + +dec1 = 1234567890; +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ + +dec2 = 1'924'013; +/* ^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ + +dec3 = 124ul; +/* ^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec4 = 9'204lu; +/* ^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec5 = 2'354'202'076LL; +/* ^^^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct1 = 0123_567; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct2 = 014'70; +/* ^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex1 = 0x1234567890ABCDEF; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0X1234567890ABCDEF; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex3 = 0x1234567890abcdef; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex4 = 0xA7'45'8C'38; +/* ^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex5 = 0x0+0xFL+0xaull+0xallu+0xfu+0xf'12_4_uz; +/* ^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0xc1.01AbFp-1; +/* ^^^^^^^^^^^^^ constant.numeric.float.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +bin1 = 0b010110; +/* ^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +bin2 = 0B010010; +/* ^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +bin3 = 0b1001'1101'0010'1100; +/* ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.+1.f+1.L+1..; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^ constant.numeric.integer.decimal */ +/* ^^ invalid.illegal.syntax */ +/* ^ punctuation.terminator - constant */ + +f = 1e1+1e1f+1e1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1'843'290.245'123; +/* ^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 2'837e1'000; +/* ^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 23e-1'000; +/* ^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.terminator - constant */ + +units1 = 134h + 123.45h; +/* ^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units2 = 147min + 147.min; +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units3 = 357s + 34.7s; +/* ^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units4 = 234_custom + 10e-1_custom; +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^^^^^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^^^^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +///////////////////////////////////////////// +// Functions +///////////////////////////////////////////// + +// function prototype +void abcdWXYZ1234(); +/* ^^^^^^^^^^^^^^ meta.function */ +/* ^ entity.name.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ + +// function definition +void abcdWXYZ1234() +/* ^^^^^^^^^^^^^^ meta.function */ +/* ^ entity.name.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +{ +/* <- meta.function meta.block punctuation.section.block.begin */ +} +/* <- meta.function meta.block punctuation.section.block.end */ + +struct foo **alloc_foo(); +/* ^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ storage.type */ +/* ^ - entity.name.struct */ +/* ^^ keyword.operator */ +/* ^ entity.name.function */ + +long func +/* ^^^^ meta.function entity.name.function */ +(int x, void *MYMACRO(y) ) { +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/*^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters meta.group */ +/* <- meta.function.parameters meta.group punctuation.section.group.begin */ +/* ^ variable.parameter */ +/* ^ -entity.name.function */ +/* ^^^^^^^^^^ meta.function-call */ +/* ^^^ meta.group meta.function-call meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ punctuation.section.group.end */ + // Ensure < and > aren't parsed as a generic + if (foo < bar && baz > bar ) { +/* ^ keyword.operator.comparison */ +/* ^ keyword.operator.comparison */ + + label: +/* ^ entity.name.label */ +/* ^ punctuation.separator */ + do { + break; + } while(true); + + } + + if (version.major == 10 && version.minor < 11) +/* ^ keyword.operator.comparison */ + { + + } +} +/* <- meta.function meta.block punctuation.section.block.end */ + +MACRO1 +RETURN_TYPE +/* <- - entity.name.function */ +func_name() { +/* < entity.name.function */ +} + +MACRO1 void * MACRO2 myfuncname () { +/* ^ storage.type */ +/* ^ keyword.operator */ +/* ^ entity.name.function */ + + struct Args { +/* ^ storage.type */ +/* ^ entity.name.struct */ + void* hello; + void* foobar; + Args() +/* ^ entity.name.function.constructor */ + : hellp(nullptr), +/* ^ punctuation.separator.initializer-list */ + foobar(nullptr) + { + } + }; + + struct Args args2; +/* ^ storage.type */ +/* ^ - entity */ + + class LocalFoo MYMACRO +/* ^ storage.type */ +/* ^ entity.name.class */ +/* ^ - entity */ + { + LocalFoo() {} +/* ^ entity.name.function.constructor */ + } + + class LocalFoo test; +/* ^ storage.type */ +/* ^ - entity */ + +} + +static const uint32_t * const MACRO funcname(); +/* ^ storage.modifier */ +/* ^ storage.modifier */ +/* ^ support.type */ +/* ^ keyword.operator */ +/* ^ storage.modifier */ +/* ^ entity.name.function */ + +void FooBar :: baz(int a) +/* ^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^ entity.name.function */ +/* ^^ punctuation.accessor */ +/* ^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +{ +} +/* A comment. */ void FooBar :: baz(int a) +/* ^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^ entity.name.function */ +/* ^^ punctuation.accessor */ +/* ^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +{ +} +// prevent leading comment from function recognition +/**/ HRESULT A::b() +/* ^ meta.function */ +/* ^ entity.name.function */ +{ + return S_OK; +} +FooBar::FooBar(int a) +/*^^^^^^^^^^^^^^^^^^^ meta.function */ +/*^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ +/* ^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^^^ storage.type */ +/* ^ punctuation.section.group.end */ +{ +} + +FooBar :: FooBar(int a) & = +/*^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/*^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ +/* ^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^^^ storage.type */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +/* ^ keyword.operator */ +/* ^ keyword.operator.assignment */ +default; +/*^^^^^ meta.function storage.modifier */ + +FooBar::~FooBar +/*^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^ entity.name.function */ +() { } +/* <- meta.function.parameters meta.group punctuation.section.group.begin */ + /* <- meta.function.parameters meta.group punctuation.section.group.end */ +/*^^^^ meta.function */ + +ThisIsAReallyReallyLongClassNameThatRequiresWrappingCodeInTheMiddleOfAPath:: + ThisIsAReallyReallyLongClassNameThatRequiresWrappingCodeInTheMiddleOfAPath() +/* <- meta.function meta.toc-list.full-identifier */ + : var_name(nullptr) { +} + +bool FooBar::operator==() {} +/* ^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^^^^^ entity.name.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^ meta.block */ +/* ^ punctuation.section.block.begin */ +/* ^ punctuation.section.block.end */ + + +myns::FooBar::~FooBar() { } +/*^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^^ meta.block */ +/* ^ punctuation.section.block.begin */ +/* ^ punctuation.section.block.end */ +/*^^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^^ entity.name.function */ + + extern "C" void test_in_extern_c_block() +/* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ entity.name.function */ +{ +/* <- meta.function meta.block punctuation.section.block.begin */ +} +/* <- meta.function meta.block punctuation.section.block.end */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if 0 +void test_in_extern_c_block() +/* ^ comment.block */ +{ +} +#else + +/* temporary C++ preprocessor block */ +#ifdef __cplusplus +/* <- meta.preprocessor */ +/* <- keyword.control.import */ +# ifndef _Bool +/* <- meta.preprocessor */ +/* <- keyword.control.import */ + typedef bool _Bool; /* semi-hackish: C++ has no _Bool; bool is builtin */ +/* ^ storage.type */ +/* ^ entity.name.type.typedef */ +# endif +/* <- meta.preprocessor */ +/* <- keyword.control.import */ +#endif +/* <- meta.preprocessor */ +/* <- keyword.control.import */ + +void test_in_extern_c_block() +/* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ entity.name.function */ +{ +/* <- meta.function meta.block punctuation.section.block.begin */ +} +/* <- meta.function meta.block punctuation.section.block.end */ +#endif + +#ifdef __cplusplus +} +#endif +/* ^ - meta.extern-c */ + +gener func_returning_generic(int a); +/* ^ entity.name.function */ + +std::vector func_returning_path_generic(int a); +/* ^ punctuation.section.generic */ +/* ^ entity.name.function */ + +void f() +{ + static_assert(false, "oops"); + /* ^ keyword.operator.word */ +} + +long double operator "" _km (long double x); +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^^^ meta.function.parameters */ +/* ^^^^^^^^^^^^^^^ entity.name.function */ + +///////////////////////////////////////////// +// Namespace +///////////////////////////////////////////// + +namespace myNameSpace {} +/* <- keyword.control */ +/* ^ entity.name.namespace */ + +namespace new_name = current_name; +/* <- keyword.control */ + +using namespace NAME __attribute__((visibility ("hidden"))); +/* <- keyword.control */ +/* ^ keyword.control */ +/* ^ storage.modifier */ +/* ^ string */ + +using namespace +/* <- keyword.control */ +/* ^ keyword.control */ + +using namespace myNameSpace; +/* <- keyword.control */ +/* ^ keyword.control */ + +void func() { + using namespace NAME __attribute__((visibility ("hidden"))); +/* ^ keyword.control */ +/* ^ keyword.control */ +/* ^ storage.modifier */ +/* ^ string */ +} + +namespace ns :: abc /* Neither this comment... */ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.namespace */ +/* ^^^^^^^^^ entity.name.namespace */ +/* ^^ punctuation.accessor */ +/* ^ comment.block */ +// ...nor this comment is highlighted +/* <- comment.line */ +{ +/* <- meta.namespace meta.block punctuation.section.block.begin */ + void nsfunc() { + /* ^ entity.name.function */ + } +} +/* <- meta.namespace meta.block punctuation.section.block.end */ + +namespace tl { +/*^^^^^^^^^^^^ meta.namespace */ +/* ^ keyword.control */ + namespace { +/* ^ keyword.control */ +/* ^^^^^^^^^^^ meta.namespace meta.namespace */ +/* ^ meta.block meta.block punctuation.section.block.begin */ + void nested_func(){} +/* ^ entity.name.function */ + } +} + +MACRONAME namespace ns3 {} +/* ^ keyword.control */ + +extern "C++" +// ^ storage.modifier +// ^^^^^ string.quoted.double +{ +namespace std _GLIBCXX_VISIBILITY(default) +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.namespace +// ^ keyword.control +// ^ entity.name.namespace +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call +// ^^^^^^^^^ meta.group +// ^ keyword.control +{} +} + +#define MY_NAMESPACE_BEGIN namespace greatapp { +#define MY_NAMESPACE_END } +MY_NAMESPACE_BEGIN +class X { +private: +/* <- storage.modifier */ + int a; +protected: +/* <- storage.modifier */ + int b; +public: +/* <- storage.modifier */ + int c; +}; +MY_NAMESPACE_END + +MY_NAMESPACE_BEGIN int foo(); MY_NAMESPACE_END +/* ^ storage.type */ +/* ^ meta.function entity.name.function */ +/* ^^^ punctuation */ + +// Uncomment this some day +// MY_NAMESPACE_BEGIN class X : public std::true_type {}; MY_NAMESPACE_END + +///////////////////////////////////////////// +// Classes, structs, unions and enums +///////////////////////////////////////////// + +class BaseClass; +/*^^^^^^^^^^^^^ meta.class */ +/* ^ - meta.class meta.class */ +/* ^^^^^^^^^ entity.name.class.forward-decl */ + +class BaseClass // comment +/* <- storage.type */ +/* ^ entity.name.class */ +{ +public : +/* <- storage.modifier */ + tupleTmpl max(tupleGen a, tupleGen b); +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ variable.parameter */ +/* ^ punctuation.separator */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.end */ +/* ^ punctuation.section.generic.begin */ +/* ^ storage.type */ +/* ^ punctuation.section.generic.end */ +protected: +/* <- storage.modifier */ +private: +/* <- storage.modifier */ + + static int a = 1 << 4; + /* <- storage.modifier */ + /* ^^ keyword.operator.arithmetic */ + + static int x; + /* <- storage.modifier */ + + virtual void doSomething() const = 0; + /* ^^^^^^^^^^^^^^^^^^^^^^^ meta.method */ + /* ^ - meta.method meta.method */ + /* ^^ meta.method.parameters meta.group */ + /* ^ punctuation.section.group.begin */ + /* ^ punctuation.section.group.end */ + /* <- storage.modifier */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ constant.numeric */ + + template + void func(){} +/* ^^^^^^^^ meta.method */ +/* ^^ meta.method.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^ meta.block */ +/* ^ punctuation.section.block.begin */ +/* ^ punctuation.section.block.end */ +/* ^^^^ entity.name.function */ + + template + void func(){} +/* ^^^^^^^^^^^ meta.method */ +/* ^^^^ entity.name.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^ meta.method.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^ meta.block */ +/* ^ punctuation.section.block.begin */ +/* ^ punctuation.section.block.end */ + + template + BaseClass(){} +/* ^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^^ meta.method.constructor */ +/* ^^^^^^^^^ entity.name.function */ + + ~BaseClass() {} +/* ^^^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^^^ meta.method.destructor */ +/* ^^^^^^^^^^ entity.name.function */ + + BaseClass operator [] () +/* ^^^^^^^^^^^^^^ meta.method */ +/* ^^ meta.method.parameters */ +/* ^^^^^^^^^^^ entity.name.function */ + {} + + BaseClass operator= +/* ^^^^^^^^^ meta.method */ +/* ^^^^^^^^^ entity.name.function */ + () {} +/* ^^^^^ meta.method */ +/* ^^ meta.method.parameters */ +/* ^^ meta.block */ +}; + +class DerivedClass : public ::BaseClass // Comment +/* ^ entity.other.inherited-class */ +/* ^ comment.line */ +{ + ~DerivedClass() override; + /* <- meta.method.destructor */ + /*^^^^^^^^^^^^^^^^^^^^^^ meta.method */ + /*^^^^^^^^^^^ meta.method.destructor */ + /* ^ storage.modifier */ + virtual void doSomething() const override final; + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + protected: +/*^^^^^^^^ storage.modifier */ + DerivedClass() override +/*^^^^^^^^^^^^^^^^^^^^^^^ meta.method */ +/*^^^^^^^^^^^^ meta.method.constructor */ +/* ^ storage.modifier */ + : a(a), +/* ^^^^^^^ meta.method.constructor.initializer-list */ + base_id_(BaseClass::None().ToInt()), +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.constructor.initializer-list */ +/* ^ variable.other.readwrite.member */ +/* ^ punctuation.accessor */ +/* ^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^ variable.function */ +/* ^ punctuation - meta.method-call */ +/* ^^^^^^^ meta.method-call */ +/* ^^^^^ variable.function */ +/* ^ punctuation.separator */ + bounds_(NULL), +/* ^^^^^^^^^^^^^^ meta.method.constructor.initializer-list */ + bit_field_(0) { +/* ^^^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^^^^^^ meta.method.constructor.initializer-list */ + char * a = "sprintf"; + char * b = sprintf("Testing %s", a); +/* ^^^^^^^^^ meta.function-call */ +/* ^^^^^^^ support.function.C99 */ + + base_id_->foobar(1, "foo"); +/* ^^ punctuation.accessor - meta.method-call */ +/* ^^^^^^^^^^^^^^^^ meta.method-call */ +/* ^^^^^^ variable.function */ + + base_id_->~BaseClass(); +/* ^^ punctuation.accessor - meta.method-call */ +/* ^^^^^^^^^^^^ meta.method-call */ +/* ^^^^^^^^^^ variable.function */ + } +/* ^ meta.method meta.block punctuation.section.block.end */ + +/* <- - meta.class.constructor.initializer-list */ + + typedef std::vector qux; +/* ^^^ entity.name.type.typedef */ +}; + + +template +class class1 : class2 +/* ^^^^^^ entity.name.class */ +/* ^ punctuation.section.generic */ +/* ^ punctuation.section.generic */ +/* ^^^^^^ entity.other.inherited-class */ +/* ^ punctuation.section.generic */ +/* ^ punctuation.section.generic */ +{} + +class FooBar { +/* ^ meta.class meta.block punctuation.section.block.begin */ + explicit FooBar(int a); +/* ^^^^^^^^^^^^^ meta.method */ +/* ^^^^^^^^ storage.modifier */ +/* ^^^^^^ entity.name.function */ + FooBar() =default; +/* ^^^^^^ entity.name.function */ +/* ^ keyword.operator.assignment */ +/* ^^^^^^^ storage.modifier */ + FooBar(void) =default; +/* ^^^^^^ entity.name.function */ +/* ^^^^ storage.type */ +/* ^ keyword.operator.assignment */ +/* ^^^^^^^ storage.modifier */ + + // If a constructor name is on a line without the opening (, it is not + // highlighted as a method/constructor. This prevents a bunch of false + // positives, including data types as they are being typed into a struct. + FooBar +/* ^ - entity.name.function */ + (); + + virtual ~FooBar(); +/* ^^^^^^^ entity.name.function */ + +#ifndef DEBUG + ~FooBar(); +/* ^^^^^^^ entity.name.function */ +#endif + + void insert () {} +/* ^^^^^^ entity.name.function */ + + explicit operator bool +/* ^^^^ entity.name.function */ + () {} + + FooBar::~FooBar(); +/* ^^^^^^^^^^^^^^^ entity.name.function */ + + void FooBar:: + Baz() { + /* <- entity.name.function */ + } + + auto f(int a) -> decltype(a.begin()) override final; +/* ^^ punctuation.separator */ +/* ^ punctuation.accessor */ +/* ^^^^^ variable.function */ +/* ^ storage.modifier */ +/* ^ storage.modifier */ + + auto g() -> std::vector override final { +/* ^^ punctuation.separator */ +/* ^^ punctuation.accessor */ +/* ^ storage.type */ +/* ^ storage.modifier */ +/* ^ storage.modifier */ + this->g(1); +/* ^ variable.language */ + } + +private: +/*^^^^^ storage.modifier */ + + VISIBILITY_MACRO +/* ^ - entity.name.function */ + myns::subns::MyDataType +/* ^ - entity.name.function */ + and_now_method_name(); +/* ^ entity.name.function */ + + VISIBILITY_MACRO +/* ^ - entity.name.function */ + std::shared_future> +/* ^ - entity.name.function */ +/* ^^ punctuation.accessor */ +/* ^ punctuation.section.generic.begin */ +/* ^^ punctuation.accessor */ +/* ^ punctuation.section.generic.begin */ +/* ^^ punctuation.accessor */ + and_now_method_name2(); +/* ^ entity.name.function */ + + enum +/* ^^^^ meta.enum storage.type */ + { +/* ^ meta.enum punctuation.section.block.begin */ + A = 1, + B = 20 / 5 + } +/* ^ meta.enum punctuation.section.block.end */ +/* ^ - meta.enum */ + + friend int func(int a, int b); +/* ^ storage.modifier */ +/* ^ storage.type */ +/* ^ - entity.name.function */ +/* ^ - meta.function-call */ + + friend int func(int a, int b) { +/* ^ storage.modifier */ +/* ^ storage.type */ +/* ^ entity.name.function */ +/* ^ - meta.function-call */ +/* ^ meta.class meta.block meta.method meta.block punctuation.section.block.begin */ + int a = 1; + } +/* ^ meta.class meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.class meta.block meta.block */ + + friend class ::FooBar; +/* ^ storage.modifier */ +/* ^ storage.type +/* ^^ punctuation.accessor */ +/* ^ - entity */ + + friend bool operator != (const X& lhs, const X& rhs) { + /* ^^^^^^^^^^^ entity.name.function */ + int a = 1; + } +/* ^ meta.class meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.class meta.block meta.block */ + + #if 0 + /* ^ constant.numeric */ + int disabled_func() { + /* ^ comment.block */ + } + #endif + + #if 1 + /* ^ constant.numeric */ + int enabled_func() {} + /* ^ entity.name.function */ + #else + int disabled_func() { + /* ^ comment.block */ + } + #endif + + MACRO_NOT_CONSTRUCTOR(FooBar); +/* ^ meta.function-call variable.function - entity.name.function */ + + MACRO_NOT_CONSTRUCTOR2(FooBar, +/* ^ meta.function-call variable.function - entity.name.function */ + FriendClass); +} +/* <- meta.class meta.block punctuation.section.block.end */ + /* <- - meta.class meta.block */ + +struct X { + Y f() override noexcept final; + /*^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + ::Y g() override noexcept final; + /* <- punctuation.accessor */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ +}; + +class X { + public: + ::Y g() override noexcept final; + /* <- punctuation.accessor */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ +}; + +union Y { + ::Y g() override noexcept final; + /* <- punctuation.accessor */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ + /* ^ storage.modifier */ +}; + +class Child : public Parent { + ::anotherClass Func() override; + /* <- punctuation.accessor */ + /* ^ entity.name.function */ + /* ^ storage.modifier */ +} + +class Adapter2 : public Abstraction, private Scenario { +/* ^ punctuation.separator */ +} + +class Adapter : public Abstraction + #if defined ASPECTO_MACRO +/* ^^^ keyword.control.import */ + , public Scenario +/* ^ punctuation.separator */ +/* ^ storage.modifier */ +/* ^ entity.other.inherited-class */ + #endif +/* ^^^^^^ keyword.control.import */ +{ + +} + +struct Base {}; +class Derived final : Base {}; +/* ^ storage.modifier */ +struct Derived final : Base {}; +/* ^ storage.modifier */ + +/* C++11 "uniform initialization" in initializer lists */ +class Foo { +public: + Foo() : var1(1), var(2), var3{3}, var4(4) {} + /* ^ meta.method.constructor.initializer-list */ + /* ^ - meta.function-call - variable.function */ +private: + int var1, var2, var3, var4; +}; + +class X { + int a, b, i, j; +public: + const int& r; + X(int i) + : r(a) // initializes X::r to refer to X::a + /* ^ meta.method.constructor.initializer-list punctuation */ + /* ^ meta.method.constructor.initializer-list punctuation */ + , b{i} // initializes X::b to the value of the parameter i + /* ^ meta.method.constructor.initializer-list punctuation */ + /* ^ meta.method.constructor.initializer-list punctuation */ + , i(i) // initializes X::i to the value of the parameter i + /* ^ meta.method.constructor.initializer-list punctuation */ + /* ^ meta.method.constructor.initializer-list punctuation */ + , j(this->i) // initializes X::j to the value of X::i + /* ^ meta.method.constructor.initializer-list punctuation */ + /* ^ meta.method.constructor.initializer-list punctuation */ + , j + /*^ variable */ + (this->i) + /* <- meta.method.constructor.initializer-list punctuation */ + { } +/* ^ punctuation - meta.method.constructor.initializer-list */ +/* ^ punctuation - meta.method.constructor.initializer-list */ +}; + +struct A { + static_assert(0 < 1, ""); + /* ^ keyword.operator.word */ + /* ^ meta.function-call */ + /* ^ keyword.operator.comparison */ + + A(); +/*^ meta.method.constructor entity.name.function.constructor */ + + void f(); + /* ^ storage.type */ + /* ^ meta.method entity.name.function */ + /* ^ punctuation.terminator */ +}; +/* <- punctuation.section.block.end - invalid.illegal */ + +struct bar { +/*^^^^^^^^^^ meta.struct */ +/*^^^^ storage.type */ +/* ^^^ entity.name.struct */ +/* ^ meta.block punctuation.section.block.begin */ + bar() +/* ^^^^^ meta.method */ +/* ^^^ entity.name.function */ + {} +} +/* <- meta.struct meta.block punctuation.section.block.end */ + /* <- - meta.struct meta.block */ + +enum baz { +/*^^^^^^^^ meta.enum */ +/* <- meta.enum storage.type */ +/* ^^^ entity.name.enum */ +/* ^ meta.block punctuation.section.block.begin */ + FOO = 1, +/* ^ keyword.operator.assignment */ +/* ^ constant.numeric */ + BAR = 2, + BAZ = 3, +#if 0 +/* ^ constant.numeric */ + QUX = 4, +/* ^ comment.block */ +#endif +} +/* <- meta.enum meta.block punctuation.section.block.end */ + /* <- - meta.enum meta.block */ + +int main(void) +{ + struct UI_BoundingBox decorativeBox = {10, titleHeight-3, width-20, height-10}; +/* ^ - entity.name */ +/* ^ - entity.name */ +} + +struct foo MACRO { +/* ^ entity.name.struct */ +/* ^ - entity.name */ +} + +// Partially-typed +struct foo +/* ^ entity.name */ + +struct UI_MenuBoxData +/* <- storage.type */ +/* ^ entity.name.struct */ +{ + struct UI_BoundingBox position; +/* ^ - entity.name */ +/* ^ - entity.name */ + enum UI_BoxCharType borderType; +/* ^ - entity.name */ +/* ^ - entity.name */ + unsigned int paddingX; + unsigned int paddingY; + struct UI_ScrollBoxText boxContents[]; +/* ^ - entity.name */ +/* ^ - entity.name */ +}; + +enum class qux : std::uint8_t +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum */ +/*^^^^^^^^ storage.type */ +/* ^^^ entity.name.enum */ +/* ^ punctuation.separator */ +/* ^^^^^^^^^^^^ entity.other.inherited-class */ +{ +/* <- meta.block punctuation.section.block.begin */ + FOO = 1, + BAR = 2, +/* ^ keyword.operator.assignment */ +/* ^ constant.numeric */ + BAZ = 3 +} +/* <- meta.enum meta.block punctuation.section.block.end */ + /* <- - meta.enum meta.block */ + +enum LineEnding : uint32_t; +/*^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum */ +/* ^^^^^^^^^^ entity.name.enum.forward-decl */ +/* ^ punctuation.separator */ +/* ^^^^^^^^ entity.other.inherited-class */ +/* ^ - meta.enum */ + +union foobaz { +/* <- meta.union storage.type */ +/* ^^^^^^ entity.name.union */ +/* ^ meta.block punctuation.section.block.begin */ +} +/* <- meta.union meta.block punctuation.section.block.end */ + /* <- - meta.union meta.block */ + +// Class name that looks like a possible macro +class SP {} +/* ^^ entity.name.class */ + +class MyClass MACRO MACRO2 +/* ^ storage.type */ +/* ^ entity.name.class */ +/* ^ - entity */ +/* ^ - entity */ +{} + +// Class using macro to handle __declspec() on Windows +class SK_API SkBitmap {} +/* ^ entity.name.class */ +class __declspec(property(get=foo)) SkBitmap {} +/* ^ storage.modifier */ +/* ^ variable.parameter */ +/* ^ entity.name.class */ +class __declspec(align(8)) SkBitmap {} +/* ^ storage.modifier */ +/* ^ constant.numeric */ +/* ^ entity.name.class */ +class __declspec(dllimport) SkBitmap {} +/* ^ constant.other */ +/* ^ entity.name.class */ + +// Make sure not to match macros that have "too few characters". +template class Sample { + public: + // The T here should not be consumed as a macro. + T operator() (const foo x) { + /* <- entity.name.function */ + /*^^^^^^^^ entity.name.function */ + return T; + } + int operator == (const int x) { + /*^^^^^^^^^^^ entity.name.function */ + return 0; + } + // The T here should not be consumed as a macro. + T operator()(int a) { + /* <- entity.name.function */ + /*^^^^^^^^ entity.name.function */ + return T; + } + // The T here should not be consumed as a macro. + T operator[](int a) { + /* <- entity.name.function */ + /*^^^^^^^^ entity.name.function */ + return T; + } +}; + +class Namespace::MyClass MACRO1 MACRO2 : public SuperClass +/* ^^^^^^^ entity.name.class */ +/* ^^ punctuation.accessor */ +/* ^ - entity.name */ +{ +}; + +struct Namespace::MyStruct +/* ^^^^^^^^ entity.name.struct */ +/* ^^ punctuation.accessor */ +{ +}; + +union Namespace::MyUnion +/* ^^^^^^^ entity.name.union */ +/* ^^ punctuation.accessor */ +{ +}; + +enum class Namespace::MyEnum +/* ^^^^^^ entity.name.enum */ +/* ^^ punctuation.accessor */ +{ +}; + +class Namespace:: +MyClass MACRO1 +/* <- entity.name.class */ +/* ^ - entity.name */ +{ +}; + +struct Namespace:: +MyStruct MACRO1 +/* <- entity.name.struct */ +/* ^ - entity.name */ +{ +}; + +union Namespace:: +MyUnion MACRO1 +/* <- entity.name.union */ +/* ^ - entity.name */ +{ +}; + +enum class Namespace:: +MyEnum MACRO1 +/* <- entity.name.enum */ +/* ^ - entity.name */ +{ +}; + +///////////////////////////////////////////// +// Test preprocessor branching and C blocks +///////////////////////////////////////////// + +int foo(int val, float val2[], bool val3 = false) +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^^ variable.parameter */ +/* ^ punctuation.separator */ +/* ^^^^ variable.parameter */ +/* ^^ meta.brackets */ +/* ^ punctuation.section.brackets.begin */ +/* ^ punctuation.section.brackets.end */ +/* ^ punctuation.separator */ +/* ^^^^ storage.type */ +/* ^^^^ variable.parameter */ +/* ^ keyword.operator.assignment */ +/* ^^^^^ constant.language */ +{ + myClass *result; + result->kk = func(val); +/* ^^ punctuation.accessor */ + if (result == 0) { + return 0; +#if CROSS_SCOPE_MACRO + /* <- keyword.control.import */ + } else if (result > 0) { + return 1; +#endif + /* <- keyword.control.import */ + } +/* ^ meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ + +#ifndef DEBUG + if (check_debug()) { + val /= 2; +#endif + val += 1; +#ifndef DEBUG + } +/* ^ meta.function meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ +#endif + +#ifdef FOO + /* <- keyword.control.import */ + int foobar +/* ^^^^^^ - entity.name.function */ + ; + + if (val == -1) { +/* ^ meta.block meta.block punctuation.section.block.begin */ +#else + /* <- keyword.control.import */ + if (val == -2) { +/* ^ meta.block meta.block punctuation.section.block.begin */ +#endif + /* <- keyword.control.import */ + val += 1; + } +/* ^ meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ + + return -1; +} +/* <- meta.function punctuation.section.block.end */ + /* <- - meta.function */ + +#if 0 +/* ^ constant.numeric */ +int disabled_func() { +/* ^ comment.block */ +} +#endif + +#if 1 +/* ^ constant.numeric */ +int enabled_func() {} +/* ^ entity.name.function */ +#else +int disabled_func() { +/* ^ comment.block */ +} +#endif + +#if 1 + int a = 1; + #if 0 +/* ^ constant.numeric */ + int b = 2; +/* ^ comment.block */ + #else + int c = 3; + #endif +#else + int d = 4; +/* ^ comment.block */ +#endif + +BOOL +GetTextMetrics( + HDC hdc, + LPTEXTMETRIC lptm + ) +{ +#ifdef UNICODE +/* <- keyword.control.import */ + return GetTextMetricsW( +/* ^ variable.function */ +#else +/* <- keyword.control.import */ + return GetTextMetricsA( +/* ^ variable.function */ +#endif +/* <- keyword.control.import */ + hdc, + lptm + ); +/* ^ meta.function-call */ +/* ^ - meta.function-call */ +} + /* <- - meta.function */ + /* <- - meta.block */ + +///////////////////////////////////////////// +// Matching various function definitions +///////////////////////////////////////////// + +const int foo = 1; +/* ^ - entity.name.function */ +int a; +/* ^ - entity.name.function */ + +int /* comment */ * myfunc +/* <- storage.type */ +/* ^ comment.block */ +/* ^ keyword.operator */ +/* ^^^^^^ entity.name.function */ +(int * a) +/* <- punctuation.section.group.begin */ +/* ^ keyword.operator */ +/* ^ punctuation.section.group.end */ +{ + +} + +void MyClass3:: +foo() { +/* <- entity.name.function */ +} + +MyClass3:: +~MyClass3() { +/* <- entity.name.function */ +} + +struct A +{ + #ifdef X + static_assert(false, "asdf"); + /* ^ keyword.operator.word */ + #endif + + void f() + { + #ifdef X + static_assert(false, "asdf"); + /* ^ keyword.operator.word */ + #endif + } + + void f() + { + static_assert(false, "asdf"); + /* ^ keyword.operator.word */ + } +}; + +void f() +{ + static_assert(false, "asdf"); +/* ^ meta.function meta.block */ +/* ^ keyword.operator.word */ +} + +void f() +{ + #ifdef X + static_assert(false, "asdf"); +/* ^ meta.function meta.block */ +/* ^ keyword.operator.word */ + #endif +} + +Glib::ustring Node::_getDragTip(GdkEventMotion */*event*/); +/* ^^^^^^^^^ comment */ + +MACRO1 void * MACRO2 myfuncname () { +/* ^ storage.type */ +/* ^ keyword.operator */ +/* ^ entity.name.function */ + + label: +/* ^ entity.name.label */ +/* ^ punctuation.separator */ + do { + break; + } while(true); + + switch (a) { + case 1: break; +/* ^ punctuation.separator */ + case 100 - 10: break; +/* ^ punctuation.separator */ + default: break; +/* ^ punctuation.separator */ + } + +} + +static const uint32_t * const MACRO funcname(); +/* ^ storage.modifier */ +/* ^ storage.modifier */ +/* ^ support.type */ +/* ^ keyword.operator */ +/* ^ storage.modifier */ +/* ^ entity.name.function */ + +MACRO int +/* ^ storage.type */ +funcname2 +/* ^ entity.name.function */ +() +{ + +} + +MACRO_CALL(int) macro_prefixed_func(){} +/*^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^ meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ entity.name.function */ + +int* return_type_pointer_no_space(){} +/* ^ entity.name.function */ + +int& return_type_ref_no_space(){} +/* ^ entity.name.function */ + +// Make sure there isn't an incorrect match here since this is not a valid +// function definition +int32 +/* <- - entity.name.function */ +() {} + +_declspec(deprecated("bla")) void func2(int) {} +/* <- meta.function-call variable.function */ +/* ^ entity.name.function */ +__declspec(deprecated("bla")) void func2(int) {} +/* <- storage.modifier - variable.function */ +/* ^ storage.modifier - variable.function */ +/* ^ string.quoted.double punctuation */ +/* ^ string.quoted.double - punctuation */ +/* ^ string.quoted.double - punctuation */ +/* ^ string.quoted.double punctuation */ +/* ^^ punctuation - invalid */ +/* ^ entity.name.function */ +__notdeclspec(deprecated("bla")) void func2(int) {} +/* <- meta.function-call variable.function */ +/* ^ entity.name.function */ + +///////////////////////////////////////////// +// Paths/identifiers +///////////////////////////////////////////// + +void sayHi() +{ + std::cout << "Hi!\n"; +/* ^ punctuation.accessor */ + Print(3); +/* ^ variable.function */ + func_call(foo +/* ^ meta.function-call */ + ); + + if (::std::foo()) {} +/* ^^^ variable.function */ +/* ^^ punctuation.accessor */ +/* ^^ punctuation.accessor */ + + foobaz(); +/* ^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^ variable.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^ meta.group */ + + foobaz<>(); +/* ^^^^^^^^^^ meta.function-call */ +/* ^^^^^^ variable.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ punctuation.section.generic.end */ +/* ^^ meta.group */ + + foobaz<0>(); +/* ^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^ variable.function */ +/* ^ punctuation.section.generic.begin */ +/* ^ constant.numeric */ +/* ^ punctuation.section.generic.end */ +/* ^^ meta.group */ + + ::myns::foo(); +/* ^^ punctuation.accessor.double-colon */ +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^ variable.function */ +/* ^^^ storage.type */ + + myns::FooClass{42}; +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^^^ variable.function */ + + ::myns::BarClass{}; +/* ^^ punctuation.accessor.double-colon */ +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^^^ variable.function */ +/* ^^^ storage.type */ + + int a[5]; +/* ^^^ meta.brackets */ +/* ^ punctuation.section.brackets.begin */ +/* ^ punctuation.section.brackets.end */ + + std::cout << ">> Hi!\n"; +/* ^^ keyword.operator.arithmetic.c */ +} + +///////////////////////////////////////////// +// Objective-C Interface +///////////////////////////////////////////// + +@interface Person : NSObject +/* <- storage.type punctuation.definition.storage.type */ +/*^ storage.type */ +@property (readonly) NSString *firstName; +/* <- keyword.other punctuation.definition.keyword */ +/*^ keyword.other */ +@property (readonly, nullable, class) NSString *lastName; +/* <- keyword.other punctuation.definition.keyword */ +/* ^ keyword.other.property.attribute */ +/* ^ punctuation.separator.objc */ +/* ^ keyword.other.property.attribute */ +/* ^ punctuation.separator.objc */ +/* ^ keyword.other.property.attribute. */ +/* ^ punctuation.section.scope.end */ +@end +/* <- storage.type punctuation.definition.storage.type */ +/*^ storage.type */ + +NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K like %@", +/*^ support.class */ +/* ^ keyword.operator */ +/* ^ meta.bracketed punctuation.section.scope.begin */ +/* ^ support.function.any-method */ +/* ^^ string.quoted.double punctuation.definition.string.begin */ + attributeName, attributeValue]; +/* ^ meta.bracketed punctuation.section.scope.end */ + +@implementation Person +- (void)debugOutput:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) +/* ^ punctuation.separator */ +/* ^^^ keyword.operator.variadic */ +/* ^ variable.function */ +{} +@end + +///////////////////////////////////////////// +// Includes +///////////////////////////////////////////// + +#import +/* <- meta.preprocessor.import keyword.control.import.import */ + +#include +/* <- meta.preprocessor.include keyword.control.import.include */ + +#include "foobar.h" +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^^ string.quoted.double.include */ +/* ^ punctuation.definition.string.end */ + +#include +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ + +#ifdef _GLIBCXX_INCLUDE_NEXT_C_HEADERS +#include_next +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ +#endif + +#include +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ diff --git a/assets/syntaxes/Packages/Objective-C/syntax_test_objc.m b/assets/syntaxes/Packages/Objective-C/syntax_test_objc.m new file mode 100644 index 000000000..1a99946b5 --- /dev/null +++ b/assets/syntaxes/Packages/Objective-C/syntax_test_objc.m @@ -0,0 +1,914 @@ +/* SYNTAX TEST "Packages/Objective-C/Objective-C.sublime-syntax" */ + +int main(){ + int a=5,b=0; + while(a-->0)++b; + /* ^^ keyword.operator.arithmetic */ + /* ^ keyword.operator.comparison */ + /* ^ constant.numeric */ + /* ^^ keyword.operator.arithmetic */ +} + +enum Foo { kFoo, kBar }; +#define FOO Foo +enum FOO do_the_foo(void); +/* ^ entity.name.function */ +/* ^ storage.type */ + +#define APIC_CAPABILITY TheEnum +enum TheEnum { kFoo, kBar }; +static enum APIC_CAPABILITY apic_capabilities(void) { return kFoo; }; +/* ^ entity.name.function */ +/* ^ storage.type */ + +struct __declspec(dllimport) X {}; +/* ^ storage.modifier */ +/* ^ entity.name.struct */ + +struct __declspec(dllimport) baz X {}; +/* ^ storage.modifier */ +/* ^ entity.name.struct */ + +struct foo { +/* ^ entity.name.struct */ + union { +/* ^ storage.type */ + struct { +/* ^ storage.type */ + int a; +/* ^ storage.type */ + int b; +/* ^ storage.type */ + } + } +} + +#define EXTTS_BUFSIZE (PTP_BUF_TIMESTAMPS /* comment block */ * sizeof(struct ptp_extts_event)) // comment line +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.group meta.group */ +/* <- keyword.control.import.define */ +/* ^ entity.name.constant.preprocessor */ +/* ^ comment.block */ +/* ^ keyword.operator.word */ +/* ^ storage.type */ +/* ^ comment.line */ + +#pragma foo(bar, \ +"baz") +/*^^^^ meta.preprocessor */ + +#define MY_MACRO(a, b) +/*^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ +/* ^^^^^^ meta.preprocessor.macro.parameters */ +/* ^^^^^^^^ entity.name.function.preprocessor */ +/* ^ punctuation.section.group.end */ + +#define max(a, b, \ +/*^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ \ +/* ^^^^^^^^ meta.preprocessor.macro.parameters */ \ +/* <- keyword.control.import.define */ \ +/* ^ entity.name.function.preprocessor */ \ +/* ^ punctuation.section.group.begin */ \ +/* ^ variable.parameter */ \ +/* ^ punctuation.separator */ \ +/* */ \ +/* <- comment.block */ \ + c) ((a>b) ? (a>c?a:c) : (b>c?b:c)) + /* <- meta.preprocessor.macro meta.group variable.parameter */ + /* <- meta.preprocessor.macro meta.group punctuation.section.group.end */ + /* ^ keyword.operator.ternary */ + /* ^ keyword.operator.ternary */ + +#define PACKED __attribute__((aligned(1),packed)) +/* ^ entity.name.constant */ +/* ^ storage.modifier */ + +int i; +/* <- storage.type */ + +// The following example ensures that comments at the end of preprocessor +// directives don't mess with context transitions +int func() { +/* ^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters */ +/* ^ meta.block punctuation.section.block.begin */ +/* ^ entity.name.function */ + #if( EXTAL == 40000 ) /* 40 MHz */ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function meta.block */ +/* ^ keyword.control.import */ + #define PLL_RFD_PHI1 10 // PLL0_PH1 = 40MHz +/* ^ keyword.control.import */ +/* ^^ constant.numeric */ +/* ^ comment.line */ + #endif +/* ^ keyword.control.import */ +} +/* <- meta.function meta.block punctuation.section.block.end */ + /* <- - meta.function meta.block */ + +int f(int x, \ + /* ^ punctuation.separator.continuation */ + int y); + +#define CONST0 16 // Comment +#define CONST1 8 +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +#if defined(VARIABLE) | // comment_line \ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor */ \ + defined(VAR2) +/*^^^^^^^^^^^^^^^ meta.preprocessor */ +/* ^ keyword.control */ +# error This is a long error message that need to \ +/* <- keyword.control.import */ \ +/* ^ string.unquoted */ \ + be splitted into two lines to prevent large lines. // comment +#error "Eplicitly quoted string wrapped, \ + ensuring that the string quoting stops at some point \ + " +#warning This is a short warning +/* <- keyword.control.import */ +#endif + /* <- keyword.control.import */ + +#define MACRO_WITH_CURLY_BRACE { +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +#define MACRO_WITH_CURLY_BRACE_2 } +/* <- keyword.control.import.define */ +/* ^ entity.name.constant */ + +bool still_C_code_here = true; +/* <- storage.type */ +/* ^ constant.language */ + +FOOBAR +hello() { + /* <- meta.function entity.name.function */ + return 0; +} + +EFIAPI +UserStructCompare ( + /* <- meta.function entity.name.function */ + IN CONST VOID *UserStruct1, + IN CONST VOID *UserStruct2 + ) +{ + const USER_STRUCT *CmpStruct1; + /* <- meta.block storage.modifier */ + + CmpStruct1 = UserStruct1; + return KeyCompare (&CmpStruct1->Key, UserStruct2); + /* <- meta.block keyword.control */ + /* ^ meta.block meta.function-call variable.function */ +} + +LIB_RESULT +foo() +/* <- meta.function entity.name.function */ +{ + return LIB_SUCCESS; +} + +LIB_RESULT bar() +/* ^ meta.function entity.name.function */ +{ + return LIB_SUCCESS; +} + +THIS_IS_REALLY_JUST_A_MACRO_AND_NOT_A_RETURN_TYPE +/* <- meta.assumed-macro */ + +int main() { +/* <- storage.type */ + /* ^ meta.function entity.name.function */ + return 0; +} + +#if 0 +#ifdef moo +/* <- - keyword.control */ +#endif +/* <- - keyword.control */ +#endif + +#if 0 +/* ^ constant.numeric */ +int disabled_func() { +/* ^ comment.block */ +} +#endif + +#if 1 +/* ^ constant.numeric */ +int enabled_func() {} +/* ^ entity.name.function */ +#else +int disabled_func() { +/* ^ comment.block */ +} +#endif + +#if 1 + int a = 1; + #if 0 +/* ^ constant.numeric */ + int b = 2; +/* ^ comment.block */ + #else + int c = 3; + #endif +#else + int d = 4; +/* ^ comment.block */ +#endif + + +FOO +/* <- meta.assumed-macro */ +FOO; +/* <- - meta.assumed-macro */ +foo +/* <- - meta.assumed-macro */ +; // fix highlighting +/* <- punctuation.terminator */ +FOO() +/* <- meta.assumed-macro variable.function.assumed-macro */ +FOO(); +/* <- - meta.assumed-macro */ +foo() +/* <- - meta.assumed-macro */ +; // fix highlighting +/* <- punctuation.terminator */ + +struct X +{ + ENABLED("reason") + /* <- meta.assumed-macro variable.function.assumed-macro */ + int foo; + /* <- storage.type */ + + DISABLED("reason") + /* <- meta.assumed-macro variable.function.assumed-macro */ + float bar; + /* <- storage.type */ +}; + +///////////////////////////////////////////// +// Preprocessor branches starting blocks +///////////////////////////////////////////// + +#ifdef FOO +if (1) { +#elif BAR +if (2) { +# elif BAZ +if (3) { +# else +if (4) { +#endif + int bar = 1; +} +/* <- meta.block punctuation.section.block.end */ + /* <- - meta.block */ + +///////////////////////////////////////////// +// Typedefs +///////////////////////////////////////////// + +typedef int myint; +/* <- storage.type */ +/* ^ entity.name.type */ + +typedef struct mystruct { +/* <- storage.type */ +/* ^ - entity */ +} mystruct; +/* ^ entity.name.type */ + +///////////////////////////////////////////// +// Data structures and return values +///////////////////////////////////////////// + +struct point +/* ^ storage.type */ +/* ^ entity.name.struct */ +{ + int x; + int y; +} + +struct point2 { +/* ^ storage.type */ +/* ^ entity.name.struct */ + int x; + int y; +} + +int main(void) { +/* ^^^^ entity.name.function */ +/* ^^^^ storage.type */ +} + +struct point get_point() {} +/* ^^^^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters */ +/* ^^ meta.block */ +/* ^ punctuation.section.block.begin +/* ^ punctuation.section.block.end +/* ^ storage.type */ +/* ^ - entity.name.struct */ +/* ^ entity.name.function */ + +struct point **alloc_points(); +/* ^ storage.type */ +/* ^ - entity.name.struct */ +/* ^^ keyword.operator */ +/* ^ entity.name.function */ + +struct point* alloc_point(); +/* ^ entity.name.function - variable.function */ + +struct point FOO_API *alloc_point3(); +/* ^ entity.name.function - variable.function */ + + +int main(void) +{ + struct UI_BoundingBox decorativeBox = {10, titleHeight-3, width-20, height-10}; +/* ^ - entity.name */ +/* ^ - entity.name */ +} + +struct foo MACRO { +/* ^ entity.name.struct */ +/* ^ - entity.name */ +} + +// Partially-typed +struct foo +/* ^ entity.name */ + +struct UI_MenuBoxData +/* <- storage.type */ +/* ^ entity.name.struct */ +{ + struct UI_BoundingBox position; +/* ^ - entity.name */ +/* ^ - entity.name */ + enum UI_BoxCharType borderType; +/* ^ - entity.name */ +/* ^ - entity.name */ + unsigned int paddingX; + unsigned int paddingY; + struct UI_ScrollBoxText boxContents[]; +/* ^ - entity.name */ +/* ^ - entity.name */ +}; + +///////////////////////////////////////////// +// Test preprocessor branching and C blocks +///////////////////////////////////////////// + +int foo(int val, float val2[]) +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^^^ variable.parameter */ +/* ^ punctuation.separator */ +/* ^^^^ variable.parameter */ +/* ^^ meta.brackets */ +/* ^ punctuation.section.brackets.begin */ +/* ^ punctuation.section.brackets.end */ +{ +/* <- meta.function meta.block */ + myClass *result; + result->kk = func(val); +/* ^^ punctuation.accessor */ + if (result == 0) { + return 0; +/* ^^^^^^ keyword.control.flow.return */ +#if CROSS_SCOPE_MACRO + /* <- keyword.control.import */ + } else if (result > 0) { + return 1; +#endif + /* <- keyword.control.import */ + } +/* ^ meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ + +#ifdef FOO + /* <- keyword.control.import */ + int foobar +/* ^^^^^^ - entity.name.function */ + ; + + if (val == -1) { +/* ^ meta.block meta.block punctuation.section.block.begin */ +#else + /* <- keyword.control.import */ + if (val == -2) { +/* ^ meta.block meta.block punctuation.section.block.begin */ +#endif + /* <- keyword.control.import */ + val += 1; + } +/* ^ meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.block meta.block */ + + return -1; +} +/* <- meta.function punctuation.section.block.end */ + /* <- - meta.function */ + +BOOL +GetTextMetrics( + HDC hdc, + LPTEXTMETRIC lptm + ) +{ +#ifdef UNICODE +/* <- keyword.control.import */ + return GetTextMetricsW( +/* ^ variable.function */ +#else +/* <- keyword.control.import */ + return GetTextMetricsA( +/* ^ variable.function */ +#endif +/* <- keyword.control.import */ + hdc, + lptm + ); +/* ^ meta.function-call */ +/* ^ - meta.function-call */ +} + /* <- - meta.function */ + /* <- - meta.block */ + +///////////////////////////////////////////// +// Matching various function definitions +///////////////////////////////////////////// + +const int foo = 1; +/* ^ - entity.name.function */ +int a; +/* ^ - entity.name.function */ + +int /* comment */ * myfunc +/* <- storage.type */ +/* ^ comment.block */ +/* ^ keyword.operator */ +/* ^^^^^^ meta.function entity.name.function */ +(int * a) +/*^^^^^^^ meta.function.parameters meta.group */ +/* <- punctuation.section.group.begin */ +/* ^ keyword.operator */ +/* ^ variable.parameter */ +/* ^ punctuation.section.group.end */ +{ +/* <- meta.function meta.block punctuation.section.block.begin */ +} + +MACRO1 +RETURN_TYPE +/* <- - entity.name.function */ +func_name() { +/* < entity.name.function */ +} + +MACRO1 void * MACRO2 myfuncname () { +/* ^^^^^^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters */ +/* ^ meta.block punctuation.section.block.begin +/* ^ storage.type */ +/* ^ keyword.operator */ +/* ^ entity.name.function */ + + label: +/* ^ entity.name.label */ +/* ^ punctuation.separator */ + do { + break; +/* ^^^^^ keyword.control.flow.break */ + } while(true); + + switch (a) { + case 1: break; +/* ^ punctuation.separator */ + case 100 - 10: break; +/* ^ punctuation.separator */ + default: break; +/* ^ punctuation.separator */ + } + + struct Args { +/* ^ storage.type */ +/* ^ entity.name.struct */ + void* hello; + void* foobar; + }; + + struct Args args; +/* ^ storage.type */ +/* ^ - entity */ + +} + +static const uint32_t * const MACRO funcname(); +/* ^^^^^^^^^^ meta.function */ +/* ^^ meta.function.parameters */ +/* ^ storage.modifier */ +/* ^ storage.modifier */ +/* ^ support.type */ +/* ^ keyword.operator */ +/* ^ storage.modifier */ +/* ^ entity.name.function */ + +MACRO int +/* ^ storage.type */ +funcname2 +/* ^ entity.name.function */ +() +{ + int a[5]; +/* ^^^ meta.brackets */ +/* ^ punctuation.section.brackets.begin */ +/* ^ punctuation.section.brackets.end */ +} + +MACRO_CALL(int) macro_prefixed_func(){} +/*^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^ meta.group */ +/* ^ punctuation.section.group.begin */ +/* ^ punctuation.section.group.end */ +/* ^ entity.name.function */ + +int* return_type_pointer_no_space(){} +/* ^ entity.name.function */ + +// Make sure there isn't an incorrect match here since this is not a valid +// function definition +int32 +/* <- - entity.name.function */ +() {} + +_declspec(deprecated("bla")) void func2(int) {} +/* <- meta.function-call variable.function */ +/* ^ entity.name.function */ +__declspec(deprecated("bla")) void func2(int) {} +/* <- storage.modifier - variable.function */ +/* ^ storage.modifier - variable.function */ +/* ^ string.quoted.double punctuation */ +/* ^ string.quoted.double - punctuation */ +/* ^ string.quoted.double - punctuation */ +/* ^ string.quoted.double punctuation */ +/* ^^ punctuation - invalid */ +/* ^ entity.name.function */ +__notdeclspec(deprecated("bla")) void func2(int) {} +/* <- meta.function-call variable.function */ +/* ^ entity.name.function */ + +///////////////////////////////////////////// +// Test function call in function parameters +///////////////////////////////////////////// + +static string foo(bar() + ';'); +/* ^^^^^^^^^^^^^^^^ meta.function */ +/* ^^^^^^^^^^^^^ meta.function.parameters */ +/* ^^^ entity.name.function */ +/* ^^^^^ meta.function-call */ +/* ^^^ variable.function */ +/* ^^^ string */ +/* ^ -string */ + +func_call(foo +/*^^^^^^^^^^^ meta.function-call */ +/* ^^^^ meta.group */ +/* ^ punctuation.section.group.begin */ +); +/* <- meta.function-call meta.group punctuation.section.group.end */ + +///////////////////////////////////////////// +// Invalid +///////////////////////////////////////////// +) +/* <- invalid.illegal.stray-bracket-end */ +} +/* <- invalid.illegal.stray-bracket-end */ + + +///////////////////////////////////////////// +// Objective-C Interface +///////////////////////////////////////////// + +@interface Person : NSObject +/* <- storage.type punctuation.definition.storage.type */ +/*^ storage.type */ +@property (readonly) NSString *firstName; +/* <- keyword.other punctuation.definition.keyword */ +/*^ keyword.other */ +@property (readonly, nullable, class) NSString *lastName; +/* <- keyword.other punctuation.definition.keyword */ +/* ^ keyword.other.property.attribute */ +/* ^ punctuation.separator.objc */ +/* ^ keyword.other.property.attribute */ +/* ^ punctuation.separator.objc */ +/* ^ keyword.other.property.attribute. */ +/* ^ punctuation.section.scope.end */ +@end +/* <- storage.type punctuation.definition.storage.type */ +/*^ storage.type */ + +NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K like %@", +/*^ support.class */ +/* ^ keyword.operator */ +/* ^ meta.bracketed punctuation.section.scope.begin */ +/* ^ support.function.any-method */ +/* ^^ string.quoted.double punctuation.definition.string.begin */ + attributeName, attributeValue]; +/* ^ meta.bracketed punctuation.section.scope.end */ + +@implementation Person +- (void)debugOutput:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) +/* ^ punctuation.separator */ +/* ^^^ keyword.operator.variadic */ +/* ^ variable.function */ +{} +@end + + +///////////////////////////////////////////// +// Includes +///////////////////////////////////////////// + +#import +/* <- meta.preprocessor.import keyword.control.import.import */ + +#include +/* <- meta.preprocessor.include keyword.control.import.include */ + +#include "foobar.h" +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^^ string.quoted.double.include */ +/* ^ punctuation.definition.string.end */ + +#include +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ + +#ifdef _GLIBCXX_INCLUDE_NEXT_C_HEADERS +#include_next +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ +#endif + +#include +/* <- keyword.control.import.include */ +/* ^ punctuation.definition.string.begin */ +/* ^^^^^^^^ string.quoted.other.lt-gt.include */ +/* ^ punctuation.definition.string.end */ + +///////////////////////////////////////////// +// Numeric Constants +///////////////////////////////////////////// + +dec0 = 0; +/* ^ constant.numeric.integer.decimal */ + +dec1 = 1234567890; +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ + +dec2 = 1234567890f; +/* ^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ + +dec3 = 1234567890L; +/* ^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ + +dec4 = 1234567890ul; +/* ^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ + +dec5 = 1234567890Lu; +/* ^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ + +dec6 = 1234567890LLU; +/* ^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ + +dec7 = 1234567890uLL; +/* ^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ + +dec8 = 1'234_567'890s0f; +/* ^ constant.numeric.integer.decimal */ +/* ^^^^^^^^^ string.quoted.single */ +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +oct1 = 01234567; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ + +oct2 = 01234567L; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ + +oct3 = 01234567LL; +/* ^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^ storage.type.numeric */ + +oct4 = 01234567ulL; +/* ^^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ + +oct2 = 01284967Z0L; +/* ^^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ invalid.illegal.numeric.digit */ +/* ^ invalid.illegal.numeric.digit */ +/* ^^^ invalid.illegal.numeric.suffix */ + +hex1 = 0x0+0xFL+0xaull+0xallu+0xfu+0x'f'12_4uz; +/* ^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ string.quoted.single */ +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0xc1.01AbFp-1; +/* ^^^^^^^^^^^^^ constant.numeric.float.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator.objc */ + +f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator.objc */ + +f = 1.+1.f+1.L+1..; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^ constant.numeric.integer.decimal */ +/* ^^ invalid.illegal.syntax */ +/* ^ punctuation.terminator.objc */ + +f = 1e1+1e1f+1e1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator.objc */ + +f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator.objc */ + +///////////////////////////////////////////// +// Objective-C specific format specifiers +///////////////////////////////////////////// + +print ("%@", @"String") +/* ^ - invalid */ + +NSLog (@"%@", @"String") +/* ^ constant.other.placeholder.objc */ + + +scanf("%ms %as %*[, ]", &buf); +/* ^^^ constant.other.placeholder */ +/* ^^^ constant.other.placeholder */ +/* ^^^^^^ constant.other.placeholder */ + +"foo % baz" +/* ^ - invalid */ diff --git a/assets/syntaxes/Packages/PHP/Comments.tmPreferences b/assets/syntaxes/Packages/PHP/Comments.tmPreferences new file mode 100644 index 000000000..d0438c2d7 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Comments.tmPreferences @@ -0,0 +1,39 @@ + + + + name + Comments + scope + source.php + settings + + shellVariables + + + name + TM_COMMENT_START + value + // + + + name + TM_COMMENT_START_2 + value + # + + + name + TM_COMMENT_START_3 + value + /* + + + name + TM_COMMENT_END_3 + value + */ + + + + + diff --git a/assets/syntaxes/Packages/PHP/Completion Rules.tmPreferences b/assets/syntaxes/Packages/PHP/Completion Rules.tmPreferences new file mode 100644 index 000000000..6d45a3ceb --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Completion Rules.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + source.php + settings + + cancelCompletion + ^\s*(\}?\s*(else|do|try)|(class|function)\s*[a-zA-Z_0-9]+)$ + + + diff --git a/assets/syntaxes/Packages/PHP/Indentation Rules - heredoc end.tmPreferences b/assets/syntaxes/Packages/PHP/Indentation Rules - heredoc end.tmPreferences new file mode 100644 index 000000000..81a5a645d --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Indentation Rules - heredoc end.tmPreferences @@ -0,0 +1,21 @@ + + + + name + Indentation Rules - HEREDOC end + scope + source.php meta.heredoc-end.php + settings + + + + + + diff --git a/assets/syntaxes/Packages/PHP/Indentation Rules Annex.tmPreferences b/assets/syntaxes/Packages/PHP/Indentation Rules Annex.tmPreferences new file mode 100644 index 000000000..807d799da --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Indentation Rules Annex.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Indentation Rules Annex + scope + source.php + settings + + unIndentedLinePattern + ^\s*((\*/|#|//| \*).*)?$ + + + diff --git a/assets/syntaxes/Packages/PHP/Indentation Rules.tmPreferences b/assets/syntaxes/Packages/PHP/Indentation Rules.tmPreferences new file mode 100644 index 000000000..c107d3778 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Indentation Rules.tmPreferences @@ -0,0 +1,66 @@ + + + + name + Indentation Rules + scope + source.php - comment - meta.embedded.html - string, meta.html-newline-after-php + settings + + decreaseIndentPattern + )|(end(if|for(each)?|switch|while))\b) # followed by an keyword that ends a control flow block + ) + ]]> + + increaseIndentPattern + "(?:[^"]++|\\.)*+"|'(?:[^']++|\\.)*+'){0} + (?/\*(?:[^*]++|\*(?!/))*+\*/){0} + (?(?:\g++|\g++|[^()'"/]++|/(?!\*))*+){0} + (? + \( # an open paren + \g # followed by anything that's not a paren + \g*+ # followed by any number of nested parens + \g # followed by anything that's not a paren + \) # a closing paren + ){0} + # begin rule + ^.* # anything on the line followed by: + ( + \{[^}"']* # an open curly brace not followed by a closing brace or string punctuation + | \[[^]"']* # an open square bracket not followed by a closing square bracket or string punctuation + | \([^)"']* # an open bracket not followed by a closing bracket or string punctuation + )$ + | # OR + ^\s* (<\?(php)?\s+)? # the beginning of the line followed by any amount of whitespace and an optional PHP open tag + ( (?: + (?:else)?if\s*\g|else # PHP "if" related statements + )\s*:(?!.*\bendif\b) # followed by a colon, not followed by an "endif" anywhere on the line + | + (?foreach|for|switch|while)\s*\g # PHP control keywords, followed by balanced parens + \s*:(?!.*\bend\k\b) # followed by a colon, and where the control structures don't end themselves on the same line + ) + ]]> + + indentNextLinePattern + + + bracketIndentNextLinePattern + (?x) + ^ \s* \b(if|while|else|elseif|foreach)\b [^;]* $ + | ^ \s* \b(for)\b .* $ + + + + diff --git a/assets/syntaxes/Packages/PHP/PHP Source.sublime-syntax b/assets/syntaxes/Packages/PHP/PHP Source.sublime-syntax new file mode 100644 index 000000000..c584d5c00 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/PHP Source.sublime-syntax @@ -0,0 +1,2389 @@ +%YAML 1.2 +--- +name: PHP Source +hidden: true +scope: source.php +variables: + identifier_start: '[[:alpha:]_]' + identifier: '\b{{identifier_start}}[[:alnum:]_]*\b' + path: '\\?({{identifier}}\\)*{{identifier}}' + sql_indicator: \s*(?:SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER)\b + +contexts: + main: + - include: statements + + statements: + - include: class + - include: use-statement + - match: '(?i)^\s*(interface)\s+({{identifier}})\s*' + captures: + 1: storage.type.interface.php + 2: entity.name.interface.php + push: + - meta_scope: meta.interface.php + - match: \b(extends)\b\s* + scope: storage.modifier.extends.php + set: + - match: '(?={{path}})' + set: + - meta_scope: meta.path.php + - meta_content_scope: entity.other.inherited-class.php + - include: identifier-parts + - match: '(\\)?({{identifier}})(?!\\)' + captures: + 1: punctuation.separator.namespace.php + - match: '' + pop: true + - match: '(?=\S)' + pop: true + - match: '(?=\S)' + pop: true + - match: '(?i)^\s*(namespace)\b\s*' + captures: + 1: keyword.other.namespace.php + push: + - meta_scope: meta.namespace.php meta.path.php + - meta_content_scope: entity.name.namespace.php + - include: identifier-parts + - match: '(\\)?({{identifier}})(?!\\)' + captures: + 1: punctuation.separator.namespace.php + - match: '' + pop: true + - match: '(?i)^\s*(trait)\s+({{identifier}})\s*' + captures: + 1: storage.type.trait.php + 2: entity.name.trait.php + - include: function + - match: '^\s*((?!default|else){{identifier}})\s*(:)(?!:)' + captures: + 1: entity.name.label.php + 2: punctuation.separator.php + - match: \{ + scope: punctuation.section.block.begin.php + - match: \} + scope: punctuation.section.block.end.php + - include: expressions + + block: + - match: '\}' + scope: punctuation.section.block.end.php + pop: true + - match: '\{' + scope: punctuation.section.block.begin.php + push: block + - include: embedded-html + - include: statements + + embedded-html: + - match: (\?>)(\s*\n)? + scope: meta.embedded.block.php + captures: + 1: punctuation.section.embedded.end.php + 2: meta.html-newline-after-php.php + push: + - meta_scope: embedding.php text.html.basic + - clear_scopes: true + - match: <\?(?i:php)? + scope: meta.embedded.block.php punctuation.section.embedded.begin.php + pop: true + - match: '' + with_prototype: + - include: single-line-php-tag + - match: (?=<\?(?i:php)?) + pop: true + push: scope:text.html.basic + + single-line-php-tag: + - match: (?:<\?=|<\?(?i:php)?(?=.*\?>)) + scope: punctuation.section.embedded.begin.php + push: + - meta_scope: meta.embedded.line.nested.php + - meta_content_scope: source.php + - match: (\?>)(\s*\n)? + captures: + 1: punctuation.section.embedded.end.php + 2: meta.html-newline-after-php.php + pop: true + - include: statements + + expressions: + - include: comments + - match: (?i)\b((?:require|include)(?:_once)?)\b\s* + captures: + 1: keyword.control.import.include.php + push: + - meta_scope: meta.include.php + # "\s*\?>" is for fixing one-liner ( https://github.com/sublimehq/Packages/issues/1545 ) + - match: (?=;|\)|\]|\s*\?>) + pop: true + - include: expressions + # yield from ( http://php.net/manual/en/language.generators.syntax.php#control-structures.yield.from ) + - match: \byield\b + scope: keyword.control.php + push: + - match: \bfrom\b + scope: keyword.control.php + pop: true + - match: (?=\S) + pop: true + - match: |- + \b(?xi: + break | case | continue | declare | default | die | do | else | + elseif | enddeclare | endfor | endforeach | endif | endswitch | endwhile | exit | + for | foreach | if | return | switch | use | while + )\b + scope: keyword.control.php + - match: \b(catch)\b\s*\(\s* + captures: + 1: keyword.control.exception.catch.php + push: + - meta_scope: meta.catch.php + - include: comments + - include: identifier-parts-as-path + - match: '(\\)' + scope: meta.path.php punctuation.separator.namespace.php + - match: '({{identifier}})\s*(\|)?' + captures: + 1: meta.path.php support.class.exception.php + 2: punctuation.separator.catch.php + - match: '((\$+){{identifier}})\s*\)' + captures: + 1: variable.other.php + 2: punctuation.definition.variable.php + pop: true + - match: \b(catch|try|throw|finally)\b + scope: keyword.control.exception.php + - include: arrow-function + - include: closure + - include: invoke-call + - match: |- + (?x)\s*(?= + [[:alnum:]_$\\]+(::) + (?: + ({{identifier}})\s*\( + | + ((\$+){{identifier}}) + | + ({{identifier}}) + )? + ) + push: + - match: (?=::{{identifier}}\s*\() + set: + - include: function-call-static + - match: '' + pop: true + - match: |- + (?x)(::) + (?: + (class)\b + | + ((\$+){{identifier}}) + | + ({{identifier}}) + )? + captures: + 1: punctuation.accessor.double-colon.php + 2: constant.class.php + 3: variable.other.class.php + 4: punctuation.definition.variable.php + 5: constant.other.class.php + set: after-identifier + - match: (self|static|parent)\b + scope: variable.language.php + - include: class-name + - include: variables + - include: variables + - include: strings + - match: (array)(\()(\)) + scope: meta.array.empty.php + captures: + 1: support.function.construct.php + 2: punctuation.section.array.begin.php + 3: punctuation.section.array.end.php + - match: (array)(\() + captures: + 1: support.function.construct.php + 2: punctuation.section.array.begin.php + push: + - meta_scope: meta.array.php + - match: \) + scope: punctuation.section.array.end.php + pop: true + - include: expressions + - match: (?i)\s*\(\s*(array|real|double|float|int(eger)?|bool(ean)?|string|object|binary|unset)\s*\) + captures: + 1: storage.type.php + - match: |- + \b(?xi: + array | bool | boolean | class | clone | double | float | function | + int | integer | interface | object | real | string + )\b + scope: storage.type.php + - match: (?i)\b(parent|self)\b + scope: variable.language.php + - match: |- + \b(?xi: + abstract | const | extends | final | global | implements | private | protected | + public | static + )\b + scope: storage.modifier.php + - include: object + - match: ; + scope: punctuation.terminator.expression.php + - include: heredoc + - include: numbers + - match: (\+|-|\*|/|%|&|\||\^|>>|<<|\.|\?\?)= + scope: keyword.operator.assignment.augmented.php + - match: "=>" + scope: keyword.operator.key.php + - match: '(?:(\=)(&))|(&(?=[[:alpha:]$_]))' + captures: + 1: keyword.operator.assignment.php + 2: storage.modifier.reference.php + 3: storage.modifier.reference.php + - match: (@) + scope: keyword.operator.error-control.php + - match: (\-\-|\+\+) + scope: keyword.operator.increment-decrement.php + - match: (\-|\+|\*|/|%) + scope: keyword.operator.arithmetic.php + - match: '&&|\|\|' + scope: keyword.operator.logical.php + - match: '<<|>>|~|\^|&|\|' + scope: keyword.operator.bitwise.php + - match: (===|!==|<=>|==|!=|<=|>=|<>|<|>) + scope: keyword.operator.comparison.php + - match: (?i)(!)|\b(and|or|xor|as)\b + scope: keyword.operator.logical.php + - include: function-call + - match: \.\.\. + scope: keyword.operator.spread.php + - match: \. + scope: keyword.operator.string.php + - match: "=" + scope: keyword.operator.assignment.php + - match: '(?i)\b(instanceof)\s+(?=[[:alpha:]\\$_])' + captures: + 1: keyword.operator.type.php + push: + - match: '(?=[^[:alnum:]_\\$])' + pop: true + - include: class-name + - include: variables + - include: instantiation + - match: '(?i)(goto)\s+({{identifier}})' + captures: + 1: keyword.control.goto.php + 2: support.other.php + - include: string-backtick + - match: '(\[)\s*(\])' + scope: meta.array.empty.php + captures: + 1: punctuation.section.array.begin.php + 2: punctuation.section.array.end.php + - match: '\[' + scope: punctuation.section.array.begin.php + push: + - meta_scope: meta.array.php + - match: '\]' + scope: punctuation.section.array.end.php + pop: true + - include: expressions + - include: constants + - match: \( + scope: punctuation.section.group.begin.php + push: + - meta_scope: meta.group.php + - match: \) + scope: punctuation.section.group.end.php + pop: true + - include: expressions + + after-identifier: + - include: item-access + - match: '(?=\S)' + pop: true + + after-function-call: + - include: item-access + - match: '(?=\S)' + pop: true + + item-access: + - match: '\[' + scope: meta.item-access.php punctuation.section.brackets.begin.php + push: + - meta_content_scope: meta.item-access.arguments.php + - match: '\]' + scope: meta.item-access.php punctuation.section.brackets.end.php + pop: true + - include: expressions + + class-builtin: + - match: |- + (?xi)(\\)?\b( + AMQPConnection | AMQPExchange | AMQPQueue | APCIterator | AppendIterator | ArrayAccess | ArrayIterator | ArrayObject | + BadFunctionCallException | BadMethodCallException | CachingIterator | Collator | Countable | DOMAttr | DOMCharacterData | DOMComment | + DOMDocument | DOMDocumentFragment | DOMElement | DOMEntityReference | DOMImplementation | DOMNamedNodeMap | DOMNode | DOMNodelist | + DOMProcessingInstruction | DOMText | DOMXPath | DateInterval | DatePeriod | DateTime | DateTimeZone | DirectoryIterator | + DomAttribute | DomDocument | DomDocumentType | DomElement | DomNode | DomProcessingInstruction | DomXsltStylesheet | DomainException | + EmptyIterator | ErrorException | Exception | FilesystemIterator | FilterIterator | GlobIterator | Gmagick | GmagickDraw | + GmagickPixel | HaruAnnotation | HaruDestination | HaruDoc | HaruEncoder | HaruFont | HaruImage | HaruOutline | + HaruPage | HttpDeflateStream | HttpInflateStream | HttpMessage | HttpQueryString | HttpRequest | HttpRequestPool | HttpResponse | + Imagick | ImagickDraw | ImagickPixel | ImagickPixelIterator | InfiniteIterator | IntlDateFormatter | InvalidArgumentException | Iterator | + IteratorAggregate | IteratorIterator | JsonException | JsonSerializable | KTaglib_ID3v2_AttachedPictureFrame | KTaglib_ID3v2_Frame | KTaglib_ID3v2_Tag | KTaglib_MPEG_AudioProperties | + KTaglib_MPEG_File | KTaglib_Tag | LengthException | LimitIterator | Locale | LogicException | Memcache | Memcached | + MessageFormatter | Mongo | MongoBinData | MongoCode | MongoCollection | MongoCursor | MongoDB | MongoDBRef | + MongoDate | MongoGridFS | MongoGridFSCursor | MongoGridFSFile | MongoGridfsFile | MongoId | MongoInt32 | MongoInt64 | + MongoRegex | MongoTimestamp | MultipleIterator | NoRewindIterator | Normalizer | NumberFormatter | OCI-Collection | OCI-Lob | + OutOfBoundsException | OutOfRangeException | OuterIterator | OverflowException | PDO | PDOStatement | ParentIterator | Phar | + PharData | PharFileInfo | RRDCreator | RRDGraph | RRDUpdater | RangeException | RecursiveArrayIterator | RecursiveCachingIterator | + RecursiveDirectoryIterator | RecursiveFilterIterator | RecursiveIterator | RecursiveIteratorIterator | RecursiveRegexIterator | RecursiveTreeIterator | Reflection | ReflectionClass | + ReflectionExtension | ReflectionFunction | ReflectionFunctionAbstract | ReflectionMethod | ReflectionObject | ReflectionParameter | ReflectionProperty | Reflector | + RegexIterator | ResourceBundle | RuntimeException | SAMConnection | SAMMessage | SCA | SCA_LocalProxy | SCA_SoapProxy | + SDO_DAS_ChangeSummary | SDO_DAS_DataFactory | SDO_DAS_DataObject | SDO_DAS_Relational | SDO_DAS_Setting | SDO_DAS_XML | SDO_DAS_XML_Document | SDO_DataFactory | + SDO_DataObject | SDO_Exception | SDO_List | SDO_Model_Property | SDO_Model_ReflectionDataObject | SDO_Model_Type | SDO_Sequence | SNMP | + SQLite3 | SQLite3Result | SQLite3Stmt | SQLiteDatabase | SQLiteResult | SQLiteUnbuffered | SVM | SVMModel | + SeekableIterator | Serializable | SimpleXMLElement | SimpleXMLIterator | SoapClient | SoapFault | SoapHeader | SoapParam | + SoapServer | SoapVar | SphinxClient | SplBool | SplDoublyLinkedList | SplEnum | SplFileInfo | SplFileObject | + SplFixedArray | SplFloat | SplHeap | SplInt | SplMaxHeap | SplMinHeap | SplObjectStorage | SplObserver | + SplPriorityQueue | SplQueue | SplStack | SplString | SplSubject | SplTempFileObject | Swish | SwishResult | + SwishResults | SwishSearch | TokyoTyrant | TokyoTyrantQuery | TokyoTyrantTable | Transliterator | Traversable | UnderflowException | + UnexpectedValueException | V8Js | V8JsException | XMLReader | XMLWriter | XSLTProcessor | ZipArchive | finfo | + mysqli | mysqli_driver | mysqli_result | mysqli_stmt | mysqli_warning | stdClass | streamWrapper | tidy | + tidyNode + )\b + captures: + 1: punctuation.separator.namespace.php + 2: support.class.builtin.php + + use-statement: + - match: (?i)\b(use)\b\s* + captures: + 1: keyword.other.use.php + push: + - meta_scope: meta.use.php + - match: \bfunction\b + scope: storage.type.php + set: use-statement-function + - match: \bconst\b + scope: storage.type.php + set: use-statement-const + - match: '(?=\S)' + set: use-statement-ns-class + # Escape during typing + - match: '(?=$\n)' + pop: true + + use-statement-common: + - include: comments + - match: (?i)\bas\b + scope: keyword.other.use-as.php + - match: ',' + scope: punctuation.separator.php + + use-statement-identifier-class-def: + - match: '(?={{path}})' + push: + - include: comments + # We are going to assume the alias is for a class so that the identifier + # gets put into the index. This will be incorrect sometimes (because it + # will sometimes be a namespace identifier), but the distinction + # shouldn't be a huge deal. + - match: '(?i)\b(as)\b' + scope: keyword.other.use-as.php + push: + - include: comments + - match: '{{identifier}}' + scope: entity.name.class.php + pop: true + - match: '(?=\S|$\n)' + pop: true + - include: identifier-parts-as-path + # We don't mark this as entity.name.class since the name is pulled + # verbatim and the indexer should find the name in the original source + # file. + - match: '(\\)?({{identifier}})(?!\\)' + scope: meta.path.php + captures: + 1: punctuation.separator.namespace.php + 2: support.class.php + - match: '(?=\S|$\n)' + pop: true + + use-statement-ns-class: + - meta_content_scope: meta.use.php + - match: (?=;|$\n) + pop: true + - match: '\{' + scope: punctuation.section.block.php + push: + - match: '\}' + scope: punctuation.section.block.php + pop: true + - include: use-statement-common + - include: use-statement-identifier-class-def + - include: use-statement-common + - include: use-statement-identifier-class-def + + use-statement-identifier-function-def: + - match: '(?={{path}})' + push: + - include: comments + - match: '(?i)\b(as)\b' + scope: keyword.other.use-as.php + push: + - include: comments + - match: '{{identifier}}' + scope: entity.name.function.php + pop: true + - match: '(?=\S|$\n)' + pop: true + - include: identifier-parts-as-path + # We don't mark this as entity.name.function since the name is pulled + # verbatim and the indexer should find the name in the original source + # file. + - match: '(\\)?({{identifier}})(?!\\)' + scope: meta.path.php + captures: + 1: punctuation.separator.namespace.php + 2: support.function.php + - match: '(?=\S|$\n)' + pop: true + + use-statement-function: + - meta_content_scope: meta.use.php + - match: (?=;|$\n) + pop: true + - match: '\{' + scope: punctuation.section.block.php + push: + - match: '\}' + scope: punctuation.section.block.php + pop: true + - include: use-statement-common + - include: use-statement-identifier-function-def + - include: use-statement-common + - include: use-statement-identifier-function-def + + use-statement-const: + - meta_content_scope: meta.use.php + - match: (?=;|$\n) + pop: true + - match: '\{' + scope: punctuation.section.block.php + push: + - match: '\}' + scope: punctuation.section.block.php + pop: true + - include: use-statement-common + - include: identifier-constant-pop + - include: use-statement-common + - include: identifier-constant-pop + + class: + - match: '(?i)(\b(?:abstract|final)\s+)?\b(class)\s+({{identifier}})\s*' + captures: + 1: storage.modifier.abstract.php + 2: storage.type.class.php + 3: entity.name.class.php + push: class-definition + + class-definition: + - meta_scope: meta.class.php + - match: "(?=;)" + pop: true + - match: '\{' + scope: meta.block.php punctuation.section.block.php + set: class-body + - include: comments + - match: (?i)(extends)\b\s* + captures: + 1: storage.modifier.extends.php + push: + - match: '(?=implements)' + pop: true + - include: comments + - match: '(?={{path}})' + set: + - meta_scope: meta.path.php + - meta_content_scope: entity.other.inherited-class.php + - include: class-builtin + - include: identifier-parts + - match: '(\\)?{{identifier}}(?!\\)' + captures: + 1: punctuation.separator.namespace.php + - match: '' + pop: true + - match: '(?=\S)' + pop: true + - match: (?i)(implements)\b\s* + captures: + 1: storage.modifier.implements.php + push: + - include: comments + - match: '(?={{path}})' + push: + - meta_scope: meta.path.php + - meta_content_scope: entity.other.inherited-class.php + - include: class-builtin + - include: identifier-parts + - match: '(\\)?{{identifier}}(?!\\)' + captures: + 1: punctuation.separator.namespace.php + - match: '' + pop: true + - match: ',' + scope: punctuation.separator.php + - match: '(?=\S)' + pop: true + + class-body: + - meta_content_scope: meta.class.php meta.block.php + - include: comments + - match: '\}' + scope: meta.class.php meta.block.php punctuation.section.block.php + pop: true + - match: (?i)\b(use)\b\s* + captures: + 1: keyword.other.use.php + push: + - meta_scope: meta.use.php + - match: (?=;|(?:^\s*$)) + pop: true + - match: '\{' + scope: punctuation.section.block.php + set: + - meta_scope: meta.use.php meta.block.php + - match: '}' + scope: punctuation.section.block.php + pop: true + - include: comments + - match: \b(as)\b + scope: keyword.other.use-as.php + - match: \b(insteadof)\b + scope: keyword.other.insteadof.php + - include: class-builtin + - match: '::' + scope: punctuation.accessor.double-colon.php + - match: (?={{path}}) + push: + - meta_scope: meta.path.php + - include: identifier-parts + - match: '(\\)?{{identifier}}(?!\\)' + captures: + 1: punctuation.separator.namespace.php + - match: '' + pop: true + - include: comments + - include: class-builtin + - match: (?={{path}}) + push: + - meta_scope: meta.path.php entity.other.inherited-class.php + - include: identifier-parts + - match: '(\\)?({{identifier}})(?!\\)' + captures: + 1: punctuation.separator.namespace.php + - match: '' + pop: true + - match: ',' + scope: punctuation.separator.php + # https://wiki.php.net/rfc/typed_properties_v2 + - match: (?=\b(?:var|public|private|protected|static)\b) + push: + - match: (?=\b(?:const|function)\b) + pop: true + - match: \b(?:var|public|private|protected|static)\b + scope: storage.modifier.php + - match: '(?:(\?)\s*)?({{identifier}})' + captures: + 1: storage.type.nullable.php + 2: support.class.php + pop: true + # Exit on unexpected content + - match: (?=\S) + pop: true + - include: statements + + function: + - match: (?i)(?=(?:\b(?:final|abstract|var|public|private|protected|static)\s+)*\bfunction\b\s*(&\s*)?{{identifier_start}}) + push: + - meta_content_scope: meta.function.php + - include: comments + - match: '(?i)\b(final|abstract|var|public|private|protected|static)\b' + scope: storage.modifier.php + - match: (?i)\bfunction\b + scope: storage.type.function.php + - match: '&' + scope: storage.modifier.reference.php + - match: '(__(?:callStatic|call|construct|destruct|get|set|isset|unset|toString|clone|set_state|sleep|wakeup|autoload|invoke|debugInfo))\b' + scope: entity.name.function.php support.function.magic.php + - match: '{{identifier}}' + scope: entity.name.function.php + # Lookahead is used here to prevent doubling up of meta.function and meta.function.parameters + - match: (?=\() + set: + - match: \( + scope: meta.function.parameters.php meta.group.php punctuation.section.group.begin.php + set: function-parameters + # Exit on unexpected content + - match: (?=\S) + pop: true + + # https://wiki.php.net/rfc/arrow_functions_v2 + arrow-function: + - match: '(?i)\b(fn)\b\s*(&)?\s*(?=\()' + scope: meta.function.arrow-function.php + captures: + 1: storage.type.function.php + 2: storage.modifier.reference.php + push: + - match: \( + scope: meta.function.parameters.php meta.group.php punctuation.section.group.begin.php + push: + - include: function-parameters + - match: (?==>) + pop: true + - match: "=>" + scope: punctuation.definition.arrow-function.php + push: + - match: '(?=;|,|\)|\s*\?>)' + pop: true + - include: expressions + # Exit on unexpected content + - match: (?=\S) + pop: true + + closure: + - match: (?i)\b(function)\s*(&)?\s*(?=\() + scope: meta.function.closure.php + captures: + 1: storage.type.function.php + 2: storage.modifier.reference.php + push: + - match: \( + scope: meta.function.parameters.php meta.group.php punctuation.section.group.begin.php + set: function-parameters + + function-parameters: + - meta_content_scope: meta.function.parameters.php meta.group.php + - match: '\)' + scope: punctuation.section.group.end.php + set: + - meta_content_scope: meta.function.php + - match: '\b(use)\b\s*(\()' + scope: meta.function.closure.use.php + captures: + 1: keyword.other.function.use.php + 2: punctuation.section.group.begin.php + set: function-use + - match: '(?=:)' + set: function-return-type + - match: \{ + scope: meta.block.php punctuation.section.block.begin.php + set: function-body + # Exit on unexpected content + - match: (?=\S) + pop: true + - include: comments + - match: \b(array|callable|int|string|bool|float|object)\b + scope: storage.type.php + # Class name type hint + - match: '{{identifier}}' + scope: meta.path.php support.class.php + - match: '\.\.\.' + scope: keyword.operator.spread.php + - match: '\?' + scope: storage.type.nullable.php + - match: '&' + scope: storage.modifier.reference.php + - match: (\$+){{identifier}} + scope: variable.parameter.php + captures: + 1: punctuation.definition.variable.php + - match: ',' + scope: punctuation.separator.php + - match: '=' + scope: keyword.operator.assignment.php + push: + - match: '(?=,|\))' + pop: true + - include: expressions + + function-use: + - meta_content_scope: meta.function.closure.use.php + - include: comments + - match: '\)' + scope: punctuation.section.group.end.php + set: + - meta_content_scope: meta.function.php + - match: '(?=:)' + set: function-return-type + - match: \{ + scope: meta.block.php punctuation.section.block.begin.php + set: function-body + # Exit on unexpected content + - match: (?=\S) + pop: true + - match: '&' + scope: storage.modifier.reference.php + - match: '(\$+){{identifier}}' + scope: variable.parameter.php + captures: + 1: punctuation.definition.variable.php + - match: ',' + scope: punctuation.separator.php + + function-return-type: + - meta_content_scope: meta.function.return-type.php + - match: '(?=;)' + pop: true + - match: \{ + scope: meta.block.php punctuation.section.block.begin.php + set: function-body + - match: ':' + scope: punctuation.separator.php + - match: '\?' + scope: storage.type.nullable.php + - match: \b(array|callable|int|string|bool|float|object)\b + scope: storage.type.php + - include: class-builtin + - include: identifier-parts-as-path + - match: '(\\)?({{identifier}})(?!\\)' + scope: meta.path.php + captures: + 1: punctuation.separator.namespace.php + 2: support.class.php + # Exit on unexpected content + - match: (?=\S) + pop: true + + function-body: + - meta_content_scope: meta.function.php meta.block.php + - match: \} + scope: meta.function.php meta.block.php punctuation.section.block.end.php + pop: true + - include: embedded-html + - match: '\{' + scope: punctuation.section.block.begin.php + push: block + - include: statements + + class-name: + - match: '(?={{path}})' + push: + - meta_scope: meta.path.php + - include: class-builtin + - include: identifier-parts + - match: '(\\)?({{identifier}})(?!\\)' + captures: + 1: punctuation.separator.namespace.php + 2: support.class.php + pop: true + - match: '' + pop: true + comments: + # This only highlights a docblock if the first line contains only /** or + # /**#@+ (which is used for docblock templates). Otherwise block-level + # comment would be highlighted as invalid for constructs such as /**** ****/ + - match: |- + (?x)/\*\*(?: + (?:\#@\+)?\s*$ (?# multi-line doc ) + | + (?=\s+@.*\s\*/\s*$) (?# inline doc ) + ) + scope: punctuation.definition.comment.begin.php + push: + - meta_scope: comment.block.documentation.phpdoc.php + - match: \*/ + scope: punctuation.definition.comment.end.php + pop: true + - include: php-doc + - match: /\* + scope: punctuation.definition.comment.begin.php + push: + - meta_scope: comment.block.php + - match: \*/ + scope: punctuation.definition.comment.end.php + pop: true + - match: // + scope: punctuation.definition.comment.php + push: + - meta_scope: comment.line.double-slash.php + - match: '(?=\?>)' + pop: true + # Consume the newline so that completions aren't shown at the end of the line + - match: \n + pop: true + - match: '#' + scope: punctuation.definition.comment.php + push: + - meta_scope: comment.line.number-sign.php + - match: '(?=\?>)' + pop: true + # Consume the newline so that completions aren't shown at the end of the line + - match: \n + pop: true + constants: + - match: |- + \b(?xi: + TRUE | FALSE | NULL | + __CLASS__ | __DIR__ | __FILE__ | __FUNCTION__ | __LINE__ | __METHOD__ | __NAMESPACE__ + )\b + scope: constant.language.php + - match: (?=\\?{{identifier}}\\{{path}}) + push: + - meta_scope: meta.path.php + - include: identifier-parts + - match: '(\\)?({{identifier}})(?!\\)' + captures: + 1: punctuation.separator.namespace.php + 2: constant.other.php + pop: true + - match: '(?=\\?[[:alpha:]_])' + push: + - match: '(?=[^\\_[:alnum:]])' + pop: true + - match: |- + (\\)?\b(?x: + DEFAULT_INCLUDE_PATH | E_ALL | E_COMPILE_ERROR | E_COMPILE_WARNING | E_CORE_ERROR | E_CORE_WARNING | E_DEPRECATED | E_ERROR | + E_NOTICE | E_PARSE | E_RECOVERABLE_ERROR | E_STRICT | E_USER_DEPRECATED | E_USER_ERROR | E_USER_NOTICE | E_USER_WARNING | + E_WARNING | MT_RAND_PHP | PEAR_EXTENSION_DIR | PEAR_INSTALL_DIR | PHP_BINDIR | PHP_CONFIG_FILE_PATH | PHP_CONFIG_FILE_SCAN_DIR | PHP_DATADIR | + PHP_DEBUG | PHP_EOL | PHP_EXTENSION_DIR | PHP_EXTRA_VERSION | PHP_FD_SETSIZE | PHP_FLOAT_DIG | PHP_FLOAT_EPSILON | PHP_FLOAT_MAX | + PHP_FLOAT_MIN | PHP_INT_MAX | PHP_INT_MIN | PHP_INT_SIZE | PHP_LIBDIR | PHP_LOCALSTATEDIR | PHP_MAJOR_VERSION | PHP_MAXPATHLEN | + PHP_MINOR_VERSION | PHP_OS | PHP_OS_FAMILY | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_START | PHP_PREFIX | PHP_RELEASE_VERSION | + PHP_ROUND_HALF_DOWN | PHP_ROUND_HALF_EVEN | PHP_ROUND_HALF_ODD | PHP_ROUND_HALF_UP | PHP_SAPI | PHP_SHLIB_SUFFIX | PHP_SYSCONFDIR | PHP_URL_FRAGMENT | + PHP_URL_HOST | PHP_URL_PASS | PHP_URL_PATH | PHP_URL_PORT | PHP_URL_QUERY | PHP_URL_SCHEME | PHP_URL_USER | PHP_VERSION | + PHP_VERSION_ID | PHP_WINDOWS_NT_DOMAIN_CONTROLLER | PHP_WINDOWS_NT_SERVER | PHP_WINDOWS_NT_WORKSTATION | PHP_WINDOWS_VERSION_BUILD | PHP_WINDOWS_VERSION_MAJOR | PHP_WINDOWS_VERSION_MINOR | PHP_WINDOWS_VERSION_PLATFORM | + PHP_WINDOWS_VERSION_PRODUCTTYPE | PHP_WINDOWS_VERSION_SP_MAJOR | PHP_WINDOWS_VERSION_SP_MINOR | PHP_WINDOWS_VERSION_SUITEMASK | PHP_ZTS | STDERR | STDIN | STDOUT | + ZEND_DEBUG_BUILD | ZEND_THREAD_SAFE + )\b + scope: support.constant.core.php + captures: + 1: punctuation.separator.namespace.php + - match: |- + (\\)?\b(?x: + ABDAY_[1-7] | ABMON_(?:[1-9]|1[0-2]) | ALT_DIGITS | AM_STR | ASSERT_ACTIVE | ASSERT_BAIL | ASSERT_CALLBACK | + ASSERT_QUIET_EVAL | ASSERT_WARNING | CASE_LOWER | CASE_UPPER | CHAR_MAX | CODESET | CONNECTION_ABORTED | CONNECTION_NORMAL | + CONNECTION_TIMEOUT | COUNT_NORMAL | COUNT_RECURSIVE | CREDITS_ALL | CREDITS_DOCS | CREDITS_FULLPAGE | CREDITS_GENERAL | CREDITS_GROUP | + CREDITS_MODULES | CREDITS_QA | CREDITS_SAPI | CRNCYSTR | CRYPT_BLOWFISH | CRYPT_EXT_DES | CRYPT_MD5 | CRYPT_SALT_LENGTH | + CRYPT_SHA256 | CRYPT_SHA512 | CRYPT_STD_DES | CURRENCY_SYMBOL | DATE_ATOM | DATE_COOKIE | DATE_ISO8601 | DATE_RFC1036 | + DATE_RFC1123 | DATE_RFC2822 | DATE_RFC3339 | DATE_RFC822 | DATE_RFC850 | DATE_RSS | DATE_W3C | DAY_([1-7]) | DECIMAL_POINT | DIRECTORY_SEPARATOR | + D_FMT | D_T_FMT | ENT_COMPAT | ENT_IGNORE | ENT_NOQUOTES | ENT_QUOTES | ERA | ERA_D_FMT | + ERA_D_T_FMT | ERA_T_FMT | ERA_YEAR | EXTR_IF_EXISTS | EXTR_OVERWRITE | EXTR_PREFIX_ALL | EXTR_PREFIX_IF_EXISTS | EXTR_PREFIX_INVALID | + EXTR_PREFIX_SAME | EXTR_REFS | EXTR_SKIP | FRAC_DIGITS | GROUPING | HASH_HMAC | HTML_ENTITIES | HTML_SPECIALCHARS | + INF | INFO_ALL | INFO_CONFIGURATION | INFO_CREDITS | INFO_ENVIRONMENT | INFO_GENERAL | INFO_LICENSE | INFO_MODULES | + INFO_VARIABLES | INI_ALL | INI_PERDIR | INI_SCANNER_NORMAL | INI_SCANNER_RAW | INI_SYSTEM | INI_USER | INT_CURR_SYMBOL | + INT_FRAC_DIGITS | LC_ALL | LC_COLLATE | LC_CTYPE | LC_MESSAGES | LC_MONETARY | LC_NUMERIC | LC_TIME | + LOCK_EX | LOCK_NB | LOCK_SH | LOCK_UN | LOG_ALERT | LOG_AUTH | LOG_AUTHPRIV | LOG_CONS | + LOG_CRIT | LOG_CRON | LOG_DAEMON | LOG_DEBUG | LOG_EMERG | LOG_ERR | LOG_INFO | LOG_KERN | + LOG_LOCAL0 | LOG_LOCAL1 | LOG_LOCAL2 | LOG_LOCAL3 | LOG_LOCAL4 | LOG_LOCAL5 | LOG_LOCAL6 | LOG_LOCAL7 | + LOG_LPR | LOG_MAIL | LOG_NDELAY | LOG_NEWS | LOG_NOTICE | LOG_NOWAIT | LOG_ODELAY | LOG_PERROR | + LOG_PID | LOG_SYSLOG | LOG_USER | LOG_UUCP | LOG_WARNING | MON_(?:[1-9]|1[0-2]) | MON_DECIMAL_POINT | MON_GROUPING | MON_THOUSANDS_SEP | M_1_PI | M_2_PI | M_2_SQRTPI | M_E | + M_EULER | M_LN10 | M_LN2 | M_LNPI | M_LOG10E | M_LOG2E | M_PI | M_PI_2 | + M_PI_4 | M_SQRT1_2 | M_SQRT2 | M_SQRT3 | M_SQRTPI | NAN | NEGATIVE_SIGN | NOEXPR | + NOSTR | N_CS_PRECEDES | N_SEP_BY_SPACE | N_SIGN_POSN | PATHINFO_BASENAME | PATHINFO_DIRNAME | PATHINFO_EXTENSION | PATHINFO_FILENAME | + PATH_SEPARATOR | PM_STR | POSITIVE_SIGN | P_CS_PRECEDES | P_SEP_BY_SPACE | P_SIGN_POSN | RADIXCHAR | SEEK_CUR | + SEEK_END | SEEK_SET | SORT_ASC | SORT_DESC | SORT_LOCALE_STRING | SORT_NUMERIC | SORT_REGULAR | SORT_STRING | + STR_PAD_BOTH | STR_PAD_LEFT | STR_PAD_RIGHT | THOUSANDS_SEP | THOUSEP | T_FMT | T_FMT_AMPM | UPLOAD_ERR_CANT_WRITE | + UPLOAD_ERR_EXTENSION | UPLOAD_ERR_FORM_SIZE | UPLOAD_ERR_INI_SIZE | UPLOAD_ERR_NO_FILE | UPLOAD_ERR_NO_TMP_DIR | UPLOAD_ERR_OK | UPLOAD_ERR_PARTIAL | YESEXPR | + YESSTR | __COMPILER_HALT_OFFSET__ + )\b + scope: support.constant.std.php + captures: + 1: punctuation.separator.namespace.php + - match: |- + (\\)?\b(?x: + CURLAUTH_ANY | CURLAUTH_ANYSAFE | CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM | CURLCLOSEPOLICY_CALLBACK | CURLCLOSEPOLICY_LEAST_RECENTLY_USED | + CURLCLOSEPOLICY_LEAST_TRAFFIC | CURLCLOSEPOLICY_OLDEST | CURLCLOSEPOLICY_SLOWEST | CURLE_ABORTED_BY_CALLBACK | CURLE_BAD_CALLING_ORDER | CURLE_BAD_CONTENT_ENCODING | CURLE_BAD_FUNCTION_ARGUMENT | CURLE_BAD_PASSWORD_ENTERED | + CURLE_COULDNT_CONNECT | CURLE_COULDNT_RESOLVE_HOST | CURLE_COULDNT_RESOLVE_PROXY | CURLE_FAILED_INIT | CURLE_FILESIZE_EXCEEDED | CURLE_FILE_COULDNT_READ_FILE | CURLE_FTP_ACCESS_DENIED | CURLE_FTP_BAD_DOWNLOAD_RESUME | + CURLE_FTP_CANT_GET_HOST | CURLE_FTP_CANT_RECONNECT | CURLE_FTP_COULDNT_GET_SIZE | CURLE_FTP_COULDNT_RETR_FILE | CURLE_FTP_COULDNT_SET_ASCII | CURLE_FTP_COULDNT_SET_BINARY | CURLE_FTP_COULDNT_STOR_FILE | CURLE_FTP_COULDNT_USE_REST | + CURLE_FTP_PORT_FAILED | CURLE_FTP_QUOTE_ERROR | CURLE_FTP_SSL_FAILED | CURLE_FTP_USER_PASSWORD_INCORRECT | CURLE_FTP_WEIRD_227_FORMAT | CURLE_FTP_WEIRD_PASS_REPLY | CURLE_FTP_WEIRD_PASV_REPLY | CURLE_FTP_WEIRD_SERVER_REPLY | + CURLE_FTP_WEIRD_USER_REPLY | CURLE_FTP_WRITE_ERROR | CURLE_FUNCTION_NOT_FOUND | CURLE_GOT_NOTHING | CURLE_HTTP_NOT_FOUND | CURLE_HTTP_PORT_FAILED | CURLE_HTTP_POST_ERROR | CURLE_HTTP_RANGE_ERROR | + CURLE_LDAP_CANNOT_BIND | CURLE_LDAP_INVALID_URL | CURLE_LDAP_SEARCH_FAILED | CURLE_LIBRARY_NOT_FOUND | CURLE_MALFORMAT_USER | CURLE_OBSOLETE | CURLE_OK | CURLE_OPERATION_TIMEOUTED | + CURLE_OUT_OF_MEMORY | CURLE_PARTIAL_FILE | CURLE_READ_ERROR | CURLE_RECV_ERROR | CURLE_SEND_ERROR | CURLE_SHARE_IN_USE | CURLE_SSH | CURLE_SSL_CACERT | + CURLE_SSL_CERTPROBLEM | CURLE_SSL_CIPHER | CURLE_SSL_CONNECT_ERROR | CURLE_SSL_ENGINE_NOTFOUND | CURLE_SSL_ENGINE_SETFAILED | CURLE_SSL_PEER_CERTIFICATE | CURLE_TELNET_OPTION_SYNTAX | CURLE_TOO_MANY_REDIRECTS | + CURLE_UNKNOWN_TELNET_OPTION | CURLE_UNSUPPORTED_PROTOCOL | CURLE_URL_MALFORMAT | CURLE_URL_MALFORMAT_USER | CURLE_WRITE_ERROR | CURLFTPAUTH_DEFAULT | CURLFTPAUTH_SSL | CURLFTPAUTH_TLS | + CURLFTPMETHOD_MULTICWD | CURLFTPMETHOD_NOCWD | CURLFTPMETHOD_SINGLECWD | CURLFTPSSL_ALL | CURLFTPSSL_CONTROL | CURLFTPSSL_NONE | CURLFTPSSL_TRY | CURLINFO_CERTINFO | + CURLINFO_CONNECT_TIME | CURLINFO_CONTENT_LENGTH_DOWNLOAD | CURLINFO_CONTENT_LENGTH_UPLOAD | CURLINFO_CONTENT_TYPE | CURLINFO_EFFECTIVE_URL | CURLINFO_FILETIME | CURLINFO_HEADER_OUT | CURLINFO_HEADER_SIZE | + CURLINFO_HTTP_CODE | CURLINFO_NAMELOOKUP_TIME | CURLINFO_PRETRANSFER_TIME | CURLINFO_PRIVATE | CURLINFO_REDIRECT_COUNT | CURLINFO_REDIRECT_TIME | CURLINFO_REQUEST_SIZE | CURLINFO_SIZE_DOWNLOAD | + CURLINFO_SIZE_UPLOAD | CURLINFO_SPEED_DOWNLOAD | CURLINFO_SPEED_UPLOAD | CURLINFO_SSL_VERIFYRESULT | CURLINFO_STARTTRANSFER_TIME | CURLINFO_TOTAL_TIME | CURLMOPT_PUSHFUNCTION | CURLMSG_DONE | + CURLM_BAD_EASY_HANDLE | CURLM_BAD_HANDLE | CURLM_CALL_MULTI_PERFORM | CURLM_INTERNAL_ERROR | CURLM_OK | CURLM_OUT_OF_MEMORY | CURLOPT_AUTOREFERER | CURLOPT_BINARYTRANSFER | + CURLOPT_BUFFERSIZE | CURLOPT_CAINFO | CURLOPT_CAPATH | CURLOPT_CERTINFO | CURLOPT_CLOSEPOLICY | CURLOPT_CONNECTTIMEOUT | CURLOPT_CONNECTTIMEOUT_MS | CURLOPT_COOKIE | + CURLOPT_COOKIEFILE | CURLOPT_COOKIEJAR | CURLOPT_COOKIESESSION | CURLOPT_CRLF | CURLOPT_CUSTOMREQUEST | CURLOPT_DNS_CACHE_TIMEOUT | CURLOPT_DNS_USE_GLOBAL_CACHE | CURLOPT_EGDSOCKET | + CURLOPT_ENCODING | CURLOPT_FAILONERROR | CURLOPT_FILE | CURLOPT_FILETIME | CURLOPT_FOLLOWLOCATION | CURLOPT_FORBID_REUSE | CURLOPT_FRESH_CONNECT | CURLOPT_FTPAPPEND | + CURLOPT_FTPLISTONLY | CURLOPT_FTPPORT | CURLOPT_FTPSSLAUTH | CURLOPT_FTP_CREATE_MISSING_DIRS | CURLOPT_FTP_FILEMETHOD | CURLOPT_FTP_SKIP_PASV_IP | CURLOPT_FTP_SSL | CURLOPT_FTP_USE_EPRT | + CURLOPT_FTP_USE_EPSV | CURLOPT_HEADER | CURLOPT_HEADERFUNCTION | CURLOPT_HTTP200ALIASES | CURLOPT_HTTPAUTH | CURLOPT_HTTPGET | CURLOPT_HTTPHEADER | CURLOPT_HTTPPROXYTUNNEL | + CURLOPT_HTTP_VERSION | CURLOPT_INFILE | CURLOPT_INFILESIZE | CURLOPT_INTERFACE | CURLOPT_IPRESOLVE | CURLOPT_KEYPASSWD | CURLOPT_KRB4LEVEL | CURLOPT_LOW_SPEED_LIMIT | + CURLOPT_LOW_SPEED_TIME | CURLOPT_MAXCONNECTS | CURLOPT_MAXREDIRS | CURLOPT_NETRC | CURLOPT_NOBODY | CURLOPT_NOPROGRESS | CURLOPT_NOSIGNAL | CURLOPT_PORT | + CURLOPT_POST | CURLOPT_POSTFIELDS | CURLOPT_POSTQUOTE | CURLOPT_POSTREDIR | CURLOPT_PRIVATE | CURLOPT_PROGRESSFUNCTION | CURLOPT_PROTOCOLS | CURLOPT_PROXY | + CURLOPT_PROXYAUTH | CURLOPT_PROXYPORT | CURLOPT_PROXYTYPE | CURLOPT_PROXYUSERPWD | CURLOPT_PUT | CURLOPT_QUOTE | CURLOPT_RANDOM_FILE | CURLOPT_RANGE | + CURLOPT_READDATA | CURLOPT_READFUNCTION | CURLOPT_REDIR_PROTOCOLS | CURLOPT_REFERER | CURLOPT_RESUME_FROM | CURLOPT_RETURNTRANSFER | CURLOPT_SSH_AUTH_TYPES | CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 | + CURLOPT_SSH_PRIVATE_KEYFILE | CURLOPT_SSH_PUBLIC_KEYFILE | CURLOPT_SSLCERT | CURLOPT_SSLCERTPASSWD | CURLOPT_SSLCERTTYPE | CURLOPT_SSLENGINE | CURLOPT_SSLENGINE_DEFAULT | CURLOPT_SSLKEY | + CURLOPT_SSLKEYPASSWD | CURLOPT_SSLKEYTYPE | CURLOPT_SSLVERSION | CURLOPT_SSL_CIPHER_LIST | CURLOPT_SSL_VERIFYHOST | CURLOPT_SSL_VERIFYPEER | CURLOPT_STDERR | CURLOPT_TCP_NODELAY | + CURLOPT_TIMECONDITION | CURLOPT_TIMEOUT | CURLOPT_TIMEOUT_MS | CURLOPT_TIMEVALUE | CURLOPT_TRANSFERTEXT | CURLOPT_UNRESTRICTED_AUTH | CURLOPT_UPLOAD | CURLOPT_URL | + CURLOPT_USERAGENT | CURLOPT_USERPWD | CURLOPT_VERBOSE | CURLOPT_WRITEFUNCTION | CURLOPT_WRITEHEADER | CURLPROTO_ALL | CURLPROTO_DICT | CURLPROTO_FILE | + CURLPROTO_FTP | CURLPROTO_FTPS | CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_LDAP | CURLPROTO_LDAPS | CURLPROTO_SCP | CURLPROTO_SFTP | + CURLPROTO_TELNET | CURLPROTO_TFTP | CURLPROXY_HTTP | CURLPROXY_SOCKS4 | CURLPROXY_SOCKS5 | CURLSSH_AUTH_DEFAULT | CURLSSH_AUTH_HOST | CURLSSH_AUTH_KEYBOARD | + CURLSSH_AUTH_NONE | CURLSSH_AUTH_PASSWORD | CURLSSH_AUTH_PUBLICKEY | CURLVERSION_NOW | CURL_HTTP_VERSION_1_0 | CURL_HTTP_VERSION_1_1 | CURL_HTTP_VERSION_NONE | CURL_IPRESOLVE_V4 | + CURL_IPRESOLVE_V6 | CURL_IPRESOLVE_WHATEVER | CURL_NETRC_IGNORED | CURL_NETRC_OPTIONAL | CURL_NETRC_REQUIRED | CURL_PUSH_DENY | CURL_PUSH_OK | CURL_TIMECOND_IFMODSINCE | + CURL_TIMECOND_IFUNMODSINCE | CURL_TIMECOND_LASTMOD | CURL_VERSION_IPV6 | CURL_VERSION_KERBEROS4 | CURL_VERSION_LIBZ | CURL_VERSION_SSL | DNS_A | DNS_A6 | + DNS_AAAA | DNS_ALL | DNS_ANY | DNS_CNAME | DNS_HINFO | DNS_MX | DNS_NAPTR | DNS_NS | + DNS_PTR | DNS_SOA | DNS_SRV | DNS_TXT | DOMSTRING_SIZE_ERR | DOM_HIERARCHY_REQUEST_ERR | DOM_INDEX_SIZE_ERR | DOM_INUSE_ATTRIBUTE_ERR | + DOM_INVALID_ACCESS_ERR | DOM_INVALID_CHARACTER_ERR | DOM_INVALID_MODIFICATION_ERR | DOM_INVALID_STATE_ERR | DOM_NAMESPACE_ERR | DOM_NOT_FOUND_ERR | DOM_NOT_SUPPORTED_ERR | DOM_NO_DATA_ALLOWED_ERR | + DOM_NO_MODIFICATION_ALLOWED_ERR | DOM_PHP_ERR | DOM_SYNTAX_ERR | DOM_VALIDATION_ERR | DOM_WRONG_DOCUMENT_ERR | FILEINFO_CONTINUE | FILEINFO_DEVICES | FILEINFO_MIME | + FILEINFO_MIME_ENCODING | FILEINFO_MIME_TYPE | FILEINFO_NONE | FILEINFO_PRESERVE_ATIME | FILEINFO_RAW | FILEINFO_SYMLINK | FILE_APPEND | FILE_BINARY | + FILE_IGNORE_NEW_LINES | FILE_NO_DEFAULT_CONTEXT | FILE_SKIP_EMPTY_LINES | FILE_TEXT | FILE_USE_INCLUDE_PATH | FILTER_CALLBACK | FILTER_DEFAULT | FILTER_FLAG_ALLOW_FRACTION | + FILTER_FLAG_ALLOW_HEX | FILTER_FLAG_ALLOW_OCTAL | FILTER_FLAG_ALLOW_SCIENTIFIC | FILTER_FLAG_ALLOW_THOUSAND | FILTER_FLAG_EMAIL_UNICODE | FILTER_FLAG_EMPTY_STRING_NULL | FILTER_FLAG_ENCODE_AMP | FILTER_FLAG_ENCODE_HIGH | + FILTER_FLAG_ENCODE_LOW | FILTER_FLAG_HOST_REQUIRED | FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 | FILTER_FLAG_NONE | FILTER_FLAG_NO_ENCODE_QUOTES | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE | + FILTER_FLAG_PATH_REQUIRED | FILTER_FLAG_QUERY_REQUIRED | FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_STRIP_BACKTICK | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW | FILTER_FORCE_ARRAY | FILTER_NULL_ON_FAILURE | + FILTER_REQUIRE_ARRAY | FILTER_REQUIRE_SCALAR | FILTER_SANITIZE_EMAIL | FILTER_SANITIZE_ENCODED | FILTER_SANITIZE_FULL_SPECIAL_CHARS | FILTER_SANITIZE_MAGIC_QUOTES | FILTER_SANITIZE_NUMBER_FLOAT | FILTER_SANITIZE_NUMBER_INT | + FILTER_SANITIZE_SPECIAL_CHARS | FILTER_SANITIZE_STRING | FILTER_SANITIZE_STRIPPED | FILTER_SANITIZE_URL | FILTER_UNSAFE_RAW | FILTER_VALIDATE_BOOLEAN | FILTER_VALIDATE_EMAIL | FILTER_VALIDATE_FLOAT | + FILTER_VALIDATE_INT | FILTER_VALIDATE_IP | FILTER_VALIDATE_REGEXP | FILTER_VALIDATE_URL | FNM_CASEFOLD | FNM_NOESCAPE | FNM_PATHNAME | FNM_PERIOD | + FORCE_DEFLATE | FORCE_GZIP | GLOB_AVAILABLE_FLAGS | GLOB_BRACE | GLOB_ERR | GLOB_MARK | GLOB_NOCHECK | GLOB_NOESCAPE | + GLOB_NOSORT | GLOB_ONLYDIR | ICONV_IMPL | ICONV_MIME_DECODE_CONTINUE_ON_ERROR | ICONV_MIME_DECODE_STRICT | ICONV_VERSION | IMAGETYPE_BMP | IMAGETYPE_COUNT | + IMAGETYPE_GIF | IMAGETYPE_ICO | IMAGETYPE_IFF | IMAGETYPE_JB2 | IMAGETYPE_JP2 | IMAGETYPE_JPC | IMAGETYPE_JPEG | IMAGETYPE_JPEG2000 | + IMAGETYPE_JPX | IMAGETYPE_PNG | IMAGETYPE_PSD | IMAGETYPE_SWC | IMAGETYPE_SWF | IMAGETYPE_TIFF_II | IMAGETYPE_TIFF_MM | IMAGETYPE_UNKNOWN | + IMAGETYPE_WBMP | IMAGETYPE_WEBP | IMAGETYPE_XBM | INPUT_COOKIE | INPUT_ENV | INPUT_GET | INPUT_POST | INPUT_REQUEST | + INPUT_SERVER | INPUT_SESSION | JSON_BIGINT_AS_STRING | JSON_ERROR_CTRL_CHAR | JSON_ERROR_DEPTH | JSON_ERROR_INF_OR_NAN | JSON_ERROR_INVALID_PROPERTY_NAME | JSON_ERROR_NONE | + JSON_ERROR_RECURSION | JSON_ERROR_STATE_MISMATCH | JSON_ERROR_SYNTAX | JSON_ERROR_UNSUPPORTED_TYPE | JSON_ERROR_UTF16 | JSON_ERROR_UTF8 | JSON_FORCE_OBJECT | JSON_HEX_AMP | + JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_INVALID_UTF8_IGNORE | JSON_INVALID_UTF8_SUBSTITUTE | JSON_NUMERIC_CHECK | JSON_OBJECT_AS_ARRAY | JSON_PARTIAL_OUTPUT_ON_ERROR | + JSON_PRESERVE_ZERO_FRACTION | JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR | JSON_UNESCAPED_LINE_TERMINATORS | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | LIBXML_BIGLINES | LIBXML_COMPACT | + LIBXML_DOTTED_VERSION | LIBXML_DTDATTR | LIBXML_DTDLOAD | LIBXML_DTDVALID | LIBXML_ERR_ERROR | LIBXML_ERR_FATAL | LIBXML_ERR_NONE | LIBXML_ERR_WARNING | + LIBXML_LOADED_VERSION | LIBXML_NOBLANKS | LIBXML_NOCDATA | LIBXML_NOEMPTYTAG | LIBXML_NOENT | LIBXML_NOERROR | LIBXML_NONET | LIBXML_NOWARNING | + LIBXML_NOXMLDECL | LIBXML_NSCLEAN | LIBXML_PARSEHUGE | LIBXML_VERSION | LIBXML_XINCLUDE | MCRYPT_3DES | MCRYPT_ARCFOUR | MCRYPT_ARCFOUR_IV | + MCRYPT_BLOWFISH | MCRYPT_BLOWFISH_COMPAT | MCRYPT_CAST_128 | MCRYPT_CAST_256 | MCRYPT_CRYPT | MCRYPT_DECRYPT | MCRYPT_DES | MCRYPT_DEV_RANDOM | + MCRYPT_DEV_URANDOM | MCRYPT_ENCRYPT | MCRYPT_ENIGNA | MCRYPT_GOST | MCRYPT_IDEA | MCRYPT_LOKI97 | MCRYPT_MARS | MCRYPT_MODE_CBC | + MCRYPT_MODE_CFB | MCRYPT_MODE_ECB | MCRYPT_MODE_NOFB | MCRYPT_MODE_OFB | MCRYPT_MODE_STREAM | MCRYPT_PANAMA | MCRYPT_RAND | MCRYPT_RC2 | + MCRYPT_RC6 | MCRYPT_RIJNDAEL_128 | MCRYPT_RIJNDAEL_192 | MCRYPT_RIJNDAEL_256 | MCRYPT_SAFER128 | MCRYPT_SAFER64 | MCRYPT_SAFERPLUS | MCRYPT_SERPENT | + MCRYPT_SKIPJACK | MCRYPT_THREEWAY | MCRYPT_TRIPLEDES | MCRYPT_TWOFISH | MCRYPT_WAKE | MCRYPT_XTEA | MHASH_ADLER32 | MHASH_CRC32 | + MHASH_CRC32B | MHASH_GOST | MHASH_HAVAL128 | MHASH_HAVAL160 | MHASH_HAVAL192 | MHASH_HAVAL224 | MHASH_HAVAL256 | MHASH_MD2 | + MHASH_MD4 | MHASH_MD5 | MHASH_RIPEMD128 | MHASH_RIPEMD160 | MHASH_RIPEMD256 | MHASH_RIPEMD320 | MHASH_SHA1 | MHASH_SHA224 | + MHASH_SHA256 | MHASH_SHA384 | MHASH_SHA512 | MHASH_SNEFRU256 | MHASH_TIGER | MHASH_TIGER128 | MHASH_TIGER160 | MHASH_WHIRLPOOL | + MYSQLI_ASSOC | MYSQLI_ASYNC | MYSQLI_AUTO_INCREMENT_FLAG | MYSQLI_BINARY_FLAG | MYSQLI_BLOB_FLAG | MYSQLI_BOTH | MYSQLI_CLIENT_COMPRESS | MYSQLI_CLIENT_FOUND_ROWS | + MYSQLI_CLIENT_IGNORE_SPACE | MYSQLI_CLIENT_INTERACTIVE | MYSQLI_CLIENT_NO_SCHEMA | MYSQLI_CLIENT_SSL | MYSQLI_CURSOR_TYPE_FOR_UPDATE | MYSQLI_CURSOR_TYPE_NO_CURSOR | MYSQLI_CURSOR_TYPE_READ_ONLY | MYSQLI_CURSOR_TYPE_SCROLLABLE | + MYSQLI_DATA_TRUNCATED | MYSQLI_DEBUG_TRACE_ENABLED | MYSQLI_ENUM_FLAG | MYSQLI_GROUP_FLAG | MYSQLI_INIT_COMMAND | MYSQLI_MULTIPLE_KEY_FLAG | MYSQLI_NOT_NULL_FLAG | MYSQLI_NO_DATA | + MYSQLI_NO_DEFAULT_VALUE_FLAG | MYSQLI_NUM | MYSQLI_NUM_FLAG | MYSQLI_ON_UPDATE_NOW_FLAG | MYSQLI_OPT_CONNECT_TIMEOUT | MYSQLI_OPT_INT_AND_FLOAT_NATIVE | MYSQLI_OPT_LOCAL_INFILE | MYSQLI_OPT_NET_CMD_BUFFER_SIZE | + MYSQLI_OPT_NET_READ_BUFFER_SIZE | MYSQLI_PART_KEY_FLAG | MYSQLI_PRI_KEY_FLAG | MYSQLI_READ_DEFAULT_FILE | MYSQLI_READ_DEFAULT_GROUP | MYSQLI_REFRESH_BACKUP_LOG | MYSQLI_REFRESH_GRANT | MYSQLI_REFRESH_HOSTS | + MYSQLI_REFRESH_LOG | MYSQLI_REFRESH_MASTER | MYSQLI_REFRESH_SLAVE | MYSQLI_REFRESH_STATUS | MYSQLI_REFRESH_TABLES | MYSQLI_REFRESH_THREADS | MYSQLI_REPORT_ALL | MYSQLI_REPORT_ERROR | + MYSQLI_REPORT_INDEX | MYSQLI_REPORT_OFF | MYSQLI_REPORT_STRICT | MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED | MYSQLI_SERVER_QUERY_NO_INDEX_USED | MYSQLI_SERVER_QUERY_WAS_SLOW | MYSQLI_SET_CHARSET_NAME | MYSQLI_SET_FLAG | + MYSQLI_STMT_ATTR_CURSOR_TYPE | MYSQLI_STMT_ATTR_PREFETCH_ROWS | MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH | MYSQLI_STORE_RESULT | MYSQLI_TIMESTAMP_FLAG | MYSQLI_TYPE_BIT | MYSQLI_TYPE_BLOB | MYSQLI_TYPE_CHAR | + MYSQLI_TYPE_DATE | MYSQLI_TYPE_DATETIME | MYSQLI_TYPE_DECIMAL | MYSQLI_TYPE_DOUBLE | MYSQLI_TYPE_ENUM | MYSQLI_TYPE_FLOAT | MYSQLI_TYPE_GEOMETRY | MYSQLI_TYPE_INT24 | + MYSQLI_TYPE_INTERVAL | MYSQLI_TYPE_LONG | MYSQLI_TYPE_LONGLONG | MYSQLI_TYPE_LONG_BLOB | MYSQLI_TYPE_MEDIUM_BLOB | MYSQLI_TYPE_NEWDATE | MYSQLI_TYPE_NEWDECIMAL | MYSQLI_TYPE_NULL | + MYSQLI_TYPE_SET | MYSQLI_TYPE_SHORT | MYSQLI_TYPE_STRING | MYSQLI_TYPE_TIME | MYSQLI_TYPE_TIMESTAMP | MYSQLI_TYPE_TINY | MYSQLI_TYPE_TINY_BLOB | MYSQLI_TYPE_VAR_STRING | + MYSQLI_TYPE_YEAR | MYSQLI_UNIQUE_KEY_FLAG | MYSQLI_UNSIGNED_FLAG | MYSQLI_USE_RESULT | MYSQLI_ZEROFILL_FLAG | MYSQL_ASSOC | MYSQL_BOTH | MYSQL_CLIENT_COMPRESS | + MYSQL_CLIENT_IGNORE_SPACE | MYSQL_CLIENT_INTERACTIVE | MYSQL_CLIENT_SSL | MYSQL_NUM | PCRE_VERSION | POSIX_F_OK | POSIX_RLIMIT_AS | POSIX_RLIMIT_CORE | + POSIX_RLIMIT_CPU | POSIX_RLIMIT_DATA | POSIX_RLIMIT_FSIZE | POSIX_RLIMIT_INFINITY | POSIX_RLIMIT_LOCKS | POSIX_RLIMIT_MEMLOCK | POSIX_RLIMIT_MSGQUEUE | POSIX_RLIMIT_NICE | + POSIX_RLIMIT_NOFILE | POSIX_RLIMIT_NPROC | POSIX_RLIMIT_RSS | POSIX_RLIMIT_RTPRIO | POSIX_RLIMIT_RTTIME | POSIX_RLIMIT_SIGPENDING | POSIX_RLIMIT_STACK | POSIX_R_OK | + POSIX_S_IFBLK | POSIX_S_IFCHR | POSIX_S_IFIFO | POSIX_S_IFREG | POSIX_S_IFSOCK | POSIX_W_OK | POSIX_X_OK | PREG_BACKTRACK_LIMIT_ERROR | + PREG_BAD_UTF8_ERROR | PREG_BAD_UTF8_OFFSET_ERROR | PREG_GREP_INVERT | PREG_INTERNAL_ERROR | PREG_JIT_STACKLIMIT_ERROR | PREG_NO_ERROR | PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER | + PREG_RECURSION_LIMIT_ERROR | PREG_SET_ORDER | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE | PREG_UNMATCHED_AS_NULL | PSFS_ERR_FATAL | PSFS_FEED_ME | + PSFS_FLAG_FLUSH_CLOSE | PSFS_FLAG_FLUSH_INC | PSFS_FLAG_NORMAL | PSFS_PASS_ON | SQLITE3_ASSOC | SQLITE3_BLOB | SQLITE3_BOTH | SQLITE3_FLOAT | + SQLITE3_INTEGER | SQLITE3_NULL | SQLITE3_NUM | SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READONLY | SQLITE3_OPEN_READWRITE | SQLITE3_TEXT | SQLITE_ABORT | + SQLITE_ASSOC | SQLITE_AUTH | SQLITE_BOTH | SQLITE_BUSY | SQLITE_CANTOPEN | SQLITE_CONSTRAINT | SQLITE_CORRUPT | SQLITE_DONE | + SQLITE_EMPTY | SQLITE_ERROR | SQLITE_FORMAT | SQLITE_FULL | SQLITE_INTERNAL | SQLITE_INTERRUPT | SQLITE_IOERR | SQLITE_LOCKED | + SQLITE_MISMATCH | SQLITE_MISUSE | SQLITE_NOLFS | SQLITE_NOMEM | SQLITE_NOTADB | SQLITE_NOTFOUND | SQLITE_NUM | SQLITE_OK | + SQLITE_PERM | SQLITE_PROTOCOL | SQLITE_READONLY | SQLITE_ROW | SQLITE_SCHEMA | SQLITE_TOOBIG | STREAM_BUFFER_FULL | STREAM_BUFFER_LINE | + STREAM_BUFFER_NONE | STREAM_CAST_AS_STREAM | STREAM_CAST_FOR_SELECT | STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT | STREAM_CRYPTO_METHOD_SSLv23_CLIENT | STREAM_CRYPTO_METHOD_SSLv23_SERVER | + STREAM_CRYPTO_METHOD_SSLv2_CLIENT | STREAM_CRYPTO_METHOD_SSLv2_SERVER | STREAM_CRYPTO_METHOD_SSLv3_CLIENT | STREAM_CRYPTO_METHOD_SSLv3_SERVER | STREAM_CRYPTO_METHOD_TLS_CLIENT | STREAM_CRYPTO_METHOD_TLS_SERVER | STREAM_ENFORCE_SAFE_MODE | STREAM_FILTER_ALL | + STREAM_FILTER_READ | STREAM_FILTER_WRITE | STREAM_IGNORE_URL | STREAM_IPPROTO_ICMP | STREAM_IPPROTO_IP | STREAM_IPPROTO_RAW | STREAM_IPPROTO_TCP | STREAM_IPPROTO_UDP | + STREAM_IS_URL | STREAM_MKDIR_RECURSIVE | STREAM_MUST_SEEK | STREAM_NOTIFY_AUTH_REQUIRED | STREAM_NOTIFY_AUTH_RESULT | STREAM_NOTIFY_COMPLETED | STREAM_NOTIFY_CONNECT | STREAM_NOTIFY_FAILURE | + STREAM_NOTIFY_FILE_SIZE_IS | STREAM_NOTIFY_MIME_TYPE_IS | STREAM_NOTIFY_PROGRESS | STREAM_NOTIFY_REDIRECTED | STREAM_NOTIFY_RESOLVE | STREAM_NOTIFY_SEVERITY_ERR | STREAM_NOTIFY_SEVERITY_INFO | STREAM_NOTIFY_SEVERITY_WARN | + STREAM_OOB | STREAM_OPTION_BLOCKING | STREAM_OPTION_READ_BUFFER | STREAM_OPTION_READ_TIMEOUT | STREAM_OPTION_WRITE_BUFFER | STREAM_PEEK | STREAM_PF_INET | STREAM_PF_INET6 | + STREAM_PF_UNIX | STREAM_REPORT_ERRORS | STREAM_SERVER_BIND | STREAM_SERVER_LISTEN | STREAM_SHUT_RD | STREAM_SHUT_RDWR | STREAM_SHUT_WR | STREAM_SOCK_DGRAM | + STREAM_SOCK_RAW | STREAM_SOCK_RDM | STREAM_SOCK_SEQPACKET | STREAM_SOCK_STREAM | STREAM_URL_STAT_LINK | STREAM_URL_STAT_QUIET | STREAM_USE_PATH | SUNFUNCS_RET_DOUBLE | + SUNFUNCS_RET_STRING | SUNFUNCS_RET_TIMESTAMP | XML_ATTRIBUTE_CDATA | XML_ATTRIBUTE_DECL_NODE | XML_ATTRIBUTE_ENTITY | XML_ATTRIBUTE_ENUMERATION | XML_ATTRIBUTE_ID | XML_ATTRIBUTE_IDREF | + XML_ATTRIBUTE_IDREFS | XML_ATTRIBUTE_NMTOKEN | XML_ATTRIBUTE_NMTOKENS | XML_ATTRIBUTE_NODE | XML_ATTRIBUTE_NOTATION | XML_CDATA_SECTION_NODE | XML_COMMENT_NODE | XML_DOCUMENT_FRAG_NODE | + XML_DOCUMENT_NODE | XML_DOCUMENT_TYPE_NODE | XML_DTD_NODE | XML_ELEMENT_DECL_NODE | XML_ELEMENT_NODE | XML_ENTITY_DECL_NODE | XML_ENTITY_NODE | XML_ENTITY_REF_NODE | + XML_ERROR_ASYNC_ENTITY | XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF | XML_ERROR_BAD_CHAR_REF | XML_ERROR_BINARY_ENTITY_REF | XML_ERROR_DUPLICATE_ATTRIBUTE | XML_ERROR_EXTERNAL_ENTITY_HANDLING | XML_ERROR_INCORRECT_ENCODING | XML_ERROR_INVALID_TOKEN | + XML_ERROR_JUNK_AFTER_DOC_ELEMENT | XML_ERROR_MISPLACED_XML_PI | XML_ERROR_NONE | XML_ERROR_NO_ELEMENTS | XML_ERROR_NO_MEMORY | XML_ERROR_PARAM_ENTITY_REF | XML_ERROR_PARTIAL_CHAR | XML_ERROR_RECURSIVE_ENTITY_REF | + XML_ERROR_SYNTAX | XML_ERROR_TAG_MISMATCH | XML_ERROR_UNCLOSED_CDATA_SECTION | XML_ERROR_UNCLOSED_TOKEN | XML_ERROR_UNDEFINED_ENTITY | XML_ERROR_UNKNOWN_ENCODING | XML_HTML_DOCUMENT_NODE | XML_LOCAL_NAMESPACE | + XML_NAMESPACE_DECL_NODE | XML_NOTATION_NODE | XML_OPTION_CASE_FOLDING | XML_OPTION_SKIP_TAGSTART | XML_OPTION_SKIP_WHITE | XML_OPTION_TARGET_ENCODING | XML_PI_NODE | XML_SAX_IMPL | + XML_TEXT_NODE + )\b + scope: support.constant.ext.php + captures: + 1: punctuation.separator.namespace.php + - match: |- + (\\)?\b(?x: + T_ABSTRACT | T_AND_EQUAL | T_ARRAY | T_ARRAY_CAST | T_AS | T_BAD_CHARACTER | T_BOOLEAN_AND | T_BOOLEAN_OR | + T_BOOL_CAST | T_BREAK | T_CASE | T_CATCH | T_CHARACTER | T_CLASS | T_CLASS_C | T_CLONE | + T_CLOSE_TAG | T_COMMENT | T_CONCAT_EQUAL | T_CONST | T_CONSTANT_ENCAPSED_STRING | T_CONTINUE | T_CURLY_OPEN | T_DEC | + T_DECLARE | T_DEFAULT | T_DIR | T_DIV_EQUAL | T_DNUMBER | T_DO | T_DOC_COMMENT | T_DOLLAR_OPEN_CURLY_BRACES | + T_DOUBLE_ARROW | T_DOUBLE_CAST | T_DOUBLE_COLON | T_ECHO | T_ELSE | T_ELSEIF | T_EMPTY | T_ENCAPSED_AND_WHITESPACE | + T_ENDDECLARE | T_ENDFOR | T_ENDFOREACH | T_ENDIF | T_ENDSWITCH | T_ENDWHILE | T_END_HEREDOC | T_EVAL | + T_EXIT | T_EXTENDS | T_FILE | T_FINAL | T_FOR | T_FOREACH | T_FUNCTION | T_FUNC_C | + T_GLOBAL | T_GOTO | T_HALT_COMPILER | T_IF | T_IMPLEMENTS | T_INC | T_INCLUDE | T_INCLUDE_ONCE | + T_INLINE_HTML | T_INSTANCEOF | T_INTERFACE | T_INT_CAST | T_ISSET | T_IS_EQUAL | T_IS_GREATER_OR_EQUAL | T_IS_IDENTICAL | + T_IS_NOT_EQUAL | T_IS_NOT_IDENTICAL | T_IS_SMALLER_OR_EQUAL | T_LINE | T_LIST | T_LNUMBER | T_LOGICAL_AND | T_LOGICAL_OR | + T_LOGICAL_XOR | T_METHOD_C | T_MINUS_EQUAL | T_ML_COMMENT | T_MOD_EQUAL | T_MUL_EQUAL | T_NAMESPACE | T_NEW | + T_NS_C | T_NS_SEPARATOR | T_NUM_STRING | T_OBJECT_CAST | T_OBJECT_OPERATOR | T_OLD_FUNCTION | T_OPEN_TAG | T_OPEN_TAG_WITH_ECHO | + T_OR_EQUAL | T_PAAMAYIM_NEKUDOTAYIM | T_PLUS_EQUAL | T_PRINT | T_PRIVATE | T_PROTECTED | T_PUBLIC | T_REQUIRE | + T_REQUIRE_ONCE | T_RETURN | T_SL | T_SL_EQUAL | T_SR | T_SR_EQUAL | T_START_HEREDOC | T_STATIC | + T_STRING | T_STRING_CAST | T_STRING_VARNAME | T_SWITCH | T_THROW | T_TRY | T_UNSET | T_UNSET_CAST | + T_USE | T_VAR | T_VARIABLE | T_WHILE | T_WHITESPACE | T_XOR_EQUAL + )\b + scope: support.constant.parser-token.php + captures: + 1: punctuation.separator.namespace.php + # In PHP, any identifier which is not a variable is taken to be a constant. + # However, if there is no constant defined with the given name then a notice + # is generated and the constant is assumed to have the value of its name. + - match: '{{identifier}}' + scope: constant.other.php + function-call: + # Functions in a user-defined namespace should only be highlighted as user, + # any built-in function names should not be highlighted specially + - match: '(?={{path}}\\{{identifier}}\s*\()' + push: + - meta_scope: meta.function-call.php + - meta_content_scope: meta.path.php + - include: identifier-parts + - match: '{{identifier}}(?=\s*\()' + scope: variable.function.php + set: function-call-parameters + - match: (?i)\b(print|echo)\b + scope: support.function.construct.php + # Root namespace function calls may be a built-in or user + - match: '(\\)?(?={{identifier}}\s*\()' + captures: + 1: punctuation.separator.namespace.php + push: + - meta_scope: meta.function-call.php + - match: (?=\s*\() + set: function-call-parameters + - match: (?i)\b(isset|unset|e(val|mpty)|list)\b + scope: support.function.construct.php + - include: support + - match: '{{identifier}}' + scope: variable.function.php + function-call-static: + - match: (::)(?={{identifier}}\s*\() + captures: + 1: punctuation.accessor.double-colon.php + push: + - meta_scope: meta.function-call.static.php + - match: (?=\s*\() + set: function-call-parameters + - match: '{{identifier}}' + scope: variable.function.php + function-call-parameters: + - match: \s*(\() + scope: meta.function-call.php + captures: + 1: meta.group.php punctuation.section.group.begin.php + set: + - meta_content_scope: meta.function-call.php meta.group.php + - match: \) + scope: meta.function-call.php meta.group.php punctuation.section.group.end.php + set: after-function-call + - match: ',' + scope: punctuation.separator.php + - include: expressions + heredoc: + - match: (?=<<<\s*'?({{identifier}})'?\s*$) + push: + - match: ^\s*(\1)\b(?:(;)(\s*$\n?))? + captures: + 1: punctuation.section.embedded.end.php keyword.operator.heredoc.php + 2: punctuation.terminator.expression.php + 3: meta.heredoc-end.php + pop: true + - match: <<<\s*(HTML)\s*$\n? + scope: punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.heredoc.php + embed: heredoc-html + embed_scope: meta.embedded.html text.html + escape: (?=^\s*HTML\b) + - match: <<<\s*('HTML')\s*$\n? + scope: meta.embedded.html punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.nowdoc.php + embed: scope:text.html.basic + embed_scope: meta.embedded.html text.html + escape: (?=^\s*HTML\b) + - match: <<<\s*(XML)\s*$\n? + scope: punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.heredoc.php + embed: heredoc-xml + embed_scope: meta.embedded.xml text.xml + escape: (?=^\s*XML\b) + - match: <<<\s*('XML')\s*$\n? + scope: meta.embedded.xml punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.nowdoc.php + embed: scope:text.xml + embed_scope: meta.embedded.xml text.xml + escape: (?=^\s*XML\b) + - match: <<<\s*(SQL)\s*$\n? + scope: punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.heredoc.php + embed: heredoc-sql + embed_scope: meta.embedded.sql source.sql + escape: (?=^\s*SQL\b) + - match: <<<\s*('SQL')\s*$\n? + scope: meta.embedded.sql punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.nowdoc.php + embed: scope:source.sql + embed_scope: meta.embedded.sql source.sql + escape: (?=^\s*SQL\b) + - match: <<<\s*(JAVASCRIPT)\s*$\n? + scope: punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.heredoc.php + embed: heredoc-javascript + embed_scope: meta.embedded.js source.js + escape: (?=^\s*JAVASCRIPT\b) + - match: <<<\s*('JAVASCRIPT')\s*$\n? + scope: meta.embedded.js punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.nowdoc.php + embed: scope:source.js + embed_scope: meta.embedded.js source.js + escape: (?=^\s*JAVASCRIPT\b) + - match: (<<<)\s*(JSON)\s*$\n? + scope: punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.heredoc.php + embed: heredoc-json + embed_scope: meta.embedded.json source.json + escape: (?=^\s*JSON\b) + - match: (<<<)\s*('JSON')\s*$\n? + scope: meta.embedded.json punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.nowdoc.php + embed: scope:source.json + embed_scope: meta.embedded.json source.json + escape: (?=^\s*JSON\b) + - match: <<<\s*(CSS)\s*$\n? + scope: punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.heredoc.php + embed: heredoc-css + embed_scope: meta.embedded.css source.css + escape: (?=^\s*CSS\b) + - match: <<<\s*('CSS')\s*$\n? + scope: meta.embedded.css punctuation.section.embedded.begin.php punctuation.definition.string.php + captures: + 1: keyword.operator.nowdoc.php + embed: scope:source.css + embed_scope: meta.embedded.css source.css + escape: (?=^\s*CSS\b) + - match: '<<<\s*({{identifier}})' + scope: punctuation.definition.string.php + captures: + 1: keyword.operator.heredoc.php + push: + - meta_scope: string.unquoted.heredoc.php + - match: (?=^\s*\1\b) + pop: true + - include: interpolation + - match: <<<\s*('({{identifier}})') + scope: punctuation.definition.string.php + captures: + 1: keyword.operator.nowdoc.php + push: + - meta_scope: string.unquoted.nowdoc.php + - match: (?=^\s*\2\b) + pop: true + heredoc-html: + - meta_include_prototype: false + - match: '' + push: scope:text.html.basic + with_prototype: + - include: interpolation + heredoc-xml: + - meta_include_prototype: false + - match: '' + push: scope:text.xml + with_prototype: + - include: interpolation + heredoc-sql: + - meta_include_prototype: false + - match: '' + push: scope:source.sql + with_prototype: + - include: interpolation + heredoc-javascript: + - meta_include_prototype: false + - match: '' + push: scope:source.js + with_prototype: + - include: interpolation + heredoc-json: + - meta_include_prototype: false + - match: '' + push: scope:source.json + with_prototype: + - include: interpolation + heredoc-css: + - meta_include_prototype: false + - match: '' + push: scope:source.css + with_prototype: + - include: interpolation + instantiation: + # anonymous class ( http://php.net/manual/en/language.oop5.anonymous.php ) + - match: '(?i)(new)\s+(class)\b\s*' + captures: + 1: keyword.other.new.php + 2: storage.type.class.php + push: + - match: (?=\() + push: function-call-parameters + - match: '' + set: class-definition + - match: (?i)(new)\s+ + captures: + 1: keyword.other.new.php + push: + - match: '(?=[^[:alnum:]$_\\])' + pop: true + - match: '(parent|static|self)\b' + scope: variable.language.php + - include: class-name + - include: variables + interpolation: + - match: '\\[0-7]{1,3}' + scope: constant.character.escape.octal.php + - match: '\\x[0-9A-Fa-f]{1,2}' + scope: constant.character.escape.hex.php + - match: '\\u\{[0-9A-Fa-f]+\}' + scope: constant.character.escape.unicodepoint.php + - match: '\\[nrt\\\$\"]' + scope: constant.character.escape.php + - match: '(\{)(?=\$.*?\})' + captures: + 1: punctuation.definition.expression.php + push: + - match: '(\})' + captures: + 1: punctuation.definition.expression.php + pop: true + - include: expressions + # Handles: "foo${bar}baz" + - match: '(\$\{){{identifier}}(\})' + scope: variable.other.php + captures: + 1: punctuation.definition.variable.php + 2: punctuation.definition.variable.php + - match: '(\$\{)(?=.*?\})' + captures: + 1: punctuation.definition.variable.php + push: + - match: '(\})' + captures: + 1: punctuation.definition.variable.php + pop: true + - include: expressions + # Handles: $foo, $foo[0], $foo[$bar], $foo->bar + - match: |- + (?x: + (?= + \${{identifier}} + (?: + ->{{identifier}} + | + \[ ( \d+ | \$?{{identifier}} ) \] + ) + ) + ) + push: + - match: (->)({{identifier}}) + captures: + 1: punctuation.accessor.arrow.php + 2: variable.other.member.php + pop: true + - match: '\[' + scope: meta.item-access.php punctuation.section.brackets.begin.php + set: + - meta_content_scope: meta.item-access.arguments.php + - match: '\]' + scope: meta.item-access.php punctuation.section.brackets.end.php + pop: true + - include: numbers + - include: variables + - match: '{{identifier}}' + scope: constant.other.php + - include: variables-no-item-access + - include: variables + invoke-call: + - match: '(\$+)({{identifier}})(?=\s*\()' + scope: meta.function-call.invoke.php + captures: + 1: punctuation.definition.variable.php + 2: variable.other.php + push: function-call-parameters + # Trailing underscores are allowed to prevent numbers from flickering while typing + # The underscore is for PHP 7.4: https://wiki.php.net/rfc/numeric_literal_separator + numbers: + - match: '\b(0[bB])(?!_)([01]|_(?!_))*\b' + scope: constant.numeric.integer.binary.php + captures: + 1: punctuation.definition.numeric.binary.php + - match: '\b(0[xX])(?!_)(\h|_(?!_))*\b' + scope: constant.numeric.integer.hexadecimal.php + captures: + 1: punctuation.definition.numeric.hexadecimal.php + - match: |- + (?x: + (?: + (?# such as 123.4 or .123) + (?:\b(?!_)(?:\d|_(?!_))+|\B)\.(?!_)(?:\d|_(?!_))+ + | + (?# such as 123.) + \b(?!_)(?:\d|_(?!_))+\. + )(?:[eE][+-]?(?!_)(?:\d|_(?!_))+)?\b + | + (?# such as 123e-4) + \b(?!_)(?:\d|_(?!_))+(?:[eE][+-]?(?!_)(?:\d|_(?!_))+)\b + ) + scope: constant.numeric.float.decimal.php + - match: '\b(?!_)(?:\d|_(?!_))+\b' + scope: constant.numeric.integer.decimal.php + object: + - match: '(->)(\$?\{)' + captures: + 1: punctuation.accessor.arrow.php + 2: punctuation.definition.variable.php + push: + - match: '(\})' + captures: + 1: punctuation.definition.variable.php + set: after-identifier + - include: expressions + - match: (->)({{identifier}})(?=\s*\() + scope: meta.function-call.method.php + captures: + 1: punctuation.accessor.arrow.php + 2: variable.function.php + push: function-call-parameters + - include: function-call-static + - match: (->)((\$+)?{{identifier}})? + captures: + 1: punctuation.accessor.arrow.php + 2: variable.other.member.php + 3: punctuation.definition.variable.php + push: after-identifier + - match: '(::)({{identifier}})?' + captures: + 1: punctuation.accessor.double-colon.php + 2: constant.other.class.php + push: after-identifier + parameter-default-types: + - include: strings + - include: numbers + - include: string-backtick + - include: variables + - match: "=>" + scope: keyword.operator.key.php + - match: "=" + scope: keyword.operator.assignment.php + - match: '&(?=\s*\$)' + scope: storage.modifier.reference.php + - match: (array)\s*(\() + captures: + 1: support.function.construct.php + 2: punctuation.section.array.begin.php + push: + - meta_scope: meta.array.php + - match: \) + scope: punctuation.section.array.end.php + pop: true + - include: parameter-default-types + - include: instantiation + - match: \s*(?={{path}}(::)({{identifier}})?) + push: + - match: '(::)({{identifier}})?' + captures: + 1: punctuation.accessor.double-colon.php + 2: constant.other.class.php + pop: true + - include: class-name + - include: constants + php-doc: + # If the next line doesn't start with whitespace then an asterisk, the use + # is either writing an invalid phpdoc comment, or not using phpdoc. Instead + # of marking the comment as invalid, we just switch to a normal block-level + # comment. + - match: ^(?!\s*\*) + set: + - meta_scope: comment.block.php + - match: \*/ + scope: punctuation.definition.comment.end.php + pop: true + - match: ^\s*(\*)\s*(@access)\s+((var|public|private|protected)|(.+))\s*$ + captures: + 1: punctuation.definition.comment.php + 2: keyword.other.phpdoc.php + 4: storage.modifier.php + 5: invalid.illegal.wrong-access-type.phpdoc.php + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.php + - match: "((https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt)://|mailto:)[-:@a-zA-Z0-9_.~%+/?=&#]*[-@a-zA-Z0-9_~%+/=&#]" + scope: markup.underline.link.php + - match: (@xlink)\s+(.+)\s*$ + captures: + 1: keyword.other.phpdoc.php + 2: markup.underline.link.php + - match: \@(a(bstract|pi|uthor)|c(ategory|opyright)|example|global|i(nternal|gnore)|li(cense|nk)|pa(ckage|ram)|return|s(ee|ince|tatic|ubpackage)|t(hrows|odo)|v(ar|ersion)|uses|deprecated|fi(nal|lesource)|property(-(read|write))?|method|source)\b + scope: keyword.other.phpdoc.php + - match: \{(@inheritdoc)\} + captures: + 1: keyword.other.phpdoc.php + # Annotations from PHPUnit + - match: \@(author|after(?:Class)?|backup(?:Globals|StaticAttributes)|before(?:Class)?|codeCoverageIgnore*|covers(?:DefaultClass|Nothing)?|dataProvider|depends|doesNotPerformAssertions|expectedException(?:Code|Message(?:RegExp)?)?|group|large|medium|preserveGlobalState|requires|run(TestsInSeparateProcesses|InSeparateProcess)|small|test(dox|With)?|ticket|uses)\b + scope: keyword.other.phpunit.php + - match: '\{(@(link)).+?\}' + scope: meta.tag.inline.phpdoc.php + captures: + 1: keyword.other.phpdoc.php + regex-double-quoted: + - match: (?="/(\\.|[^"/])+/[eimsuxADJSUX]*") + push: + - meta_scope: meta.string.php string.quoted.double.php + - match: (")(/) + captures: + 1: punctuation.definition.string.begin.php + 2: punctuation.definition.string.regex-delimiter.begin.php + - match: (/)([eimsuxADJSUX]*)(") + captures: + 1: punctuation.definition.string.regex-delimiter.end.php + 2: meta.regex.modifier.php + 3: punctuation.definition.string.end.php + pop: true + - match: '' + push: scope:source.regexp.php + with_prototype: + - match: (?=(/)([eimsuxADJSUX]*)(")) + pop: true + - include: interpolation + regex-single-quoted: + - match: (?='/(\\.|[^'/])+/[eimsuxADJSUX]*') + push: + - meta_scope: meta.string.php string.quoted.single.php + - match: (')(/) + captures: + 1: punctuation.definition.string.begin.php + 2: punctuation.definition.string.regex-delimiter.begin.php + - match: (/)([eimsuxADJSUX]*)(') + captures: + 1: punctuation.definition.string.regex-delimiter.end.php + 2: meta.regex.modifier.php + 3: punctuation.definition.string.end.php + pop: true + - match: '' + embed: scope:source.regexp.php + escape: (?=(/)([eimsuxADJSUX]*)(')) + string-backtick: + - match: "`" + scope: punctuation.definition.string.begin.php + push: + - meta_scope: string.interpolated.php + - match: "`" + scope: punctuation.definition.string.end.php + pop: true + - match: \\. + scope: constant.character.escape.php + - include: interpolation + string-double-quoted: + - match: '"' + scope: punctuation.definition.string.begin.php + push: + - meta_scope: string.quoted.double.php + - meta_content_scope: meta.string-contents.quoted.double.php + - match: '(?={{sql_indicator}})' + set: + - meta_scope: string.quoted.double.php + - meta_content_scope: meta.string-contents.quoted.double.php + - match: '"' + scope: punctuation.definition.string.end.php + pop: true + - match: '' + with_prototype: + - match: '(?=")' + pop: true + - include: interpolation + push: 'scope:source.sql' + - match: '(?=\S)' + set: + - meta_scope: string.quoted.double.php + - meta_content_scope: meta.string-contents.quoted.double.php + - match: '"' + scope: punctuation.definition.string.end.php + pop: true + - include: interpolation + string-single-quoted: + - match: "'" + scope: punctuation.definition.string.begin.php + push: + - meta_scope: string.quoted.single.php + - meta_content_scope: meta.string-contents.quoted.single.php + - match: '(?={{sql_indicator}})' + set: + - meta_scope: string.quoted.single.php + - meta_content_scope: meta.string-contents.quoted.single.php + - match: "'" + scope: punctuation.definition.string.end.php + pop: true + - match: '' + with_prototype: + - match: "(?=')" + pop: true + - match: '\\[\\'']' + scope: constant.character.escape.php + push: 'scope:source.sql' + - match: '(?=\S)' + set: + - meta_scope: string.quoted.single.php + - meta_content_scope: meta.string-contents.quoted.single.php + - match: "'" + scope: punctuation.definition.string.end.php + pop: true + - match: '\\[\\'']' + scope: constant.character.escape.php + + strings: + - include: regex-double-quoted + - include: string-double-quoted + - include: regex-single-quoted + - include: string-single-quoted + support: + - match: |- + \b(?xi: + apc_add | apc_bin_dump | apc_bin_dumpfile | apc_bin_load | apc_bin_loadfile | apc_cache_info | apc_cas | apc_clear_cache | + apc_compile_file | apc_dec | apc_define_constants | apc_delete | apc_delete_file | apc_exists | apc_fetch | apc_inc | + apc_load_constants | apc_sma_info | apc_store + )\b + scope: support.function.apc.php + - match: |- + \b(?xi: + array | array_change_key_case | array_chunk | array_column | array_combine | array_count_values | array_diff | array_diff_assoc | + array_diff_key | array_diff_uassoc | array_diff_ukey | array_fill | array_fill_keys | array_filter | array_flip | array_intersect | + array_intersect_assoc | array_intersect_key | array_intersect_uassoc | array_intersect_ukey | array_key_exists | array_keys | array_map | array_merge | + array_merge_recursive | array_multisort | array_pad | array_pop | array_product | array_push | array_rand | array_reduce | + array_replace | array_replace_recursive | array_reverse | array_search | array_shift | array_slice | array_splice | array_sum | + array_udiff | array_udiff_assoc | array_udiff_uassoc | array_uintersect | array_uintersect_assoc | array_uintersect_uassoc | array_unique | array_unshift | + array_values | array_walk | array_walk_recursive | arsort | asort | compact | count | current | + each | end | extract | in_array | key | krsort | ksort | list | + natcasesort | natsort | next | pos | prev | range | reset | rsort | + shuffle | sizeof | sort | uasort | uksort | usort + )\b + scope: support.function.array.php + - match: |- + \b(?xi: + __halt_compiler | connection_aborted | connection_status | connection_timeout | constant | define | defined | die | + eval | exit | get_browser | highlight_file | highlight_string | ignore_user_abort | pack | php_check_syntax | + php_strip_whitespace | show_source | sleep | sys_getloadavg | time_nanosleep | time_sleep_until | uniqid | unpack | + usleep + )\b + scope: support.function.basic_functions.php + - match: |- + \b(?xi: + bcadd | bccomp | bcdiv | bcmod | bcmul | bcpow | bcpowmod | bcscale | + bcsqrt | bcsub + )\b + scope: support.function.bcmath.php + - match: |- + \b(?xi: + bzclose | bzcompress | bzdecompress | bzerrno | bzerror | bzerrstr | bzflush | bzopen | + bzread | bzwrite + )\b + scope: support.function.bz2.php + - match: |- + \b(?xi: + FrenchToJD | GregorianToJD | JDDayOfWeek | JDMonthName | JDToFrench | JDToGregorian | JDToJulian | JewishToJD | + JulianToJD | cal_days_in_month | cal_from_jd | cal_info | cal_to_jd | easter_date | easter_days | jdtojewish | + jdtounix | unixtojd + )\b + scope: support.function.calendar.php + - match: |- + \b(?xi: + call_user_method | call_user_method_array | class_alias | class_exists | get_called_class | get_class | get_class_methods | get_class_vars | + get_declared_classes | get_declared_interfaces | get_object_vars | get_parent_class | interface_exists | is_a | is_subclass_of | method_exists | + property_exists + )\b + scope: support.function.classobj.php + - match: |- + \b(?xi: + com_addref | com_create_guid | com_event_sink | com_get | com_get_active_object | com_invoke | com_isenum | com_load | + com_load_typelib | com_message_pump | com_print_typeinfo | com_propget | com_propput | com_propset | com_release | com_set | + variant_abs | variant_add | variant_and | variant_cast | variant_cat | variant_cmp | variant_date_from_timestamp | variant_date_to_timestamp | + variant_div | variant_eqv | variant_fix | variant_get_type | variant_idiv | variant_imp | variant_int | variant_mod | + variant_mul | variant_neg | variant_not | variant_or | variant_pow | variant_round | variant_set | variant_set_type | + variant_sub | variant_xor + )\b + scope: support.function.com.php + - match: |- + \b(?xi: + random_bytes | random_int + )\b + scope: support.function.csprng.php + - match: |- + \b(?xi: + ctype_alnum | ctype_alpha | ctype_cntrl | ctype_digit | ctype_graph | ctype_lower | ctype_print | ctype_punct | + ctype_space | ctype_upper | ctype_xdigit + )\b + scope: support.function.ctype.php + - match: |- + \b(?xi: + curl_close | curl_copy_handle | curl_errno | curl_error | curl_exec | curl_getinfo | curl_init | curl_multi_add_handle | + curl_multi_close | curl_multi_exec | curl_multi_getcontent | curl_multi_info_read | curl_multi_init | curl_multi_remove_handle | curl_multi_select | curl_setopt | + curl_setopt_array | curl_version + )\b + scope: support.function.curl.php + - match: |- + \b(?xi: + checkdate | date | date_add | date_create | date_create_from_format | date_date_set | date_default_timezone_get | date_default_timezone_set | + date_diff | date_format | date_get_last_errors | date_interval_create_from_date_string | date_interval_format | date_isodate_set | date_modify | date_offset_get | + date_parse | date_parse_from_format | date_sub | date_sun_info | date_sunrise | date_sunset | date_time_set | date_timestamp_get | + date_timestamp_set | date_timezone_get | date_timezone_set | getdate | gettimeofday | gmdate | gmmktime | gmstrftime | + hrtime | idate | localtime | microtime | mktime | strftime | strptime | strtotime | + time | timezone_abbreviations_list | timezone_identifiers_list | timezone_location_get | timezone_name_from_abbr | timezone_name_get | timezone_offset_get | timezone_open | + timezone_transitions_get | timezone_version_get + )\b + scope: support.function.datetime.php + - match: |- + \b(?xi: + dba_close | dba_delete | dba_exists | dba_fetch | dba_firstkey | dba_handlers | dba_insert | dba_key_split | + dba_list | dba_nextkey | dba_open | dba_optimize | dba_popen | dba_replace | dba_sync + )\b + scope: support.function.dba.php + - match: |- + \b(?xi: + dbx_close | dbx_compare | dbx_connect | dbx_error | dbx_escape_string | dbx_fetch_row | dbx_query | dbx_sort + )\b + scope: support.function.dbx.php + - match: |- + \b(?xi: + chdir | chroot | closedir | dir | getcwd | opendir | readdir | rewinddir | + scandir + )\b + scope: support.function.dir.php + - match: |- + \b(?xi: + domxml_new_doc | domxml_open_file | domxml_open_mem | domxml_version | domxml_xmltree | domxml_xslt_stylesheet | domxml_xslt_stylesheet_doc | domxml_xslt_stylesheet_file | + domxml_xslt_version | xpath_eval | xpath_eval_expression | xpath_new_context | xpath_register_ns | xpath_register_ns_auto | xptr_eval | xptr_new_context + )\b + scope: support.function.domxml.php + - match: |- + \b(?xi: + dotnet_load + )\b + scope: support.function.dotnet.php + - match: |- + \b(?xi: + enchant_broker_describe | enchant_broker_dict_exists | enchant_broker_free | enchant_broker_free_dict | enchant_broker_get_error | enchant_broker_init | enchant_broker_list_dicts | enchant_broker_request_dict | + enchant_broker_request_pwl_dict | enchant_broker_set_ordering | enchant_dict_add_to_personal | enchant_dict_add_to_session | enchant_dict_check | enchant_dict_describe | enchant_dict_get_error | enchant_dict_is_in_session | + enchant_dict_quick_check | enchant_dict_store_replacement | enchant_dict_suggest + )\b + scope: support.function.enchant.php + - match: |- + \b(?xi: + ereg | ereg_replace | eregi | eregi_replace | split | spliti | sql_regcase + )\b + scope: support.function.ereg.php + - match: |- + \b(?xi: + debug_backtrace | debug_print_backtrace | error_clear_last | error_get_last | error_log | error_reporting | restore_error_handler | restore_exception_handler | + set_error_handler | set_exception_handler | trigger_error | user_error + )\b + scope: support.function.errorfunc.php + - match: |- + \b(?xi: + escapeshellarg | escapeshellcmd | exec | passthru | proc_close | proc_get_status | proc_nice | proc_open | + proc_terminate | shell_exec | system + )\b + scope: support.function.exec.php + - match: |- + \b(?xi: + exif_imagetype | exif_read_data | exif_tagname | exif_thumbnail | read_exif_data + )\b + scope: support.function.exif.php + - match: |- + \b(?xi: + basename | chgrp | chmod | chown | clearstatcache | copy | delete | dirname | + disk_free_space | disk_total_space | diskfreespace | fclose | feof | fflush | fgetc | fgetcsv | + fgets | fgetss | file | file_exists | file_get_contents | file_put_contents | fileatime | filectime | + filegroup | fileinode | filemtime | fileowner | fileperms | filesize | filetype | flock | + fnmatch | fopen | fpassthru | fputcsv | fputs | fread | fscanf | fseek | + fstat | ftell | ftruncate | fwrite | glob | is_dir | is_executable | is_file | + is_link | is_readable | is_uploaded_file | is_writable | is_writeable | lchgrp | lchown | link | + linkinfo | lstat | mkdir | move_uploaded_file | parse_ini_file | parse_ini_string | pathinfo | pclose | + popen | readfile | readlink | realpath | realpath_cache_get | realpath_cache_size | rename | rewind | + rmdir | set_file_buffer | stat | symlink | tempnam | tmpfile | touch | umask | + unlink + )\b + scope: support.function.file.php + - match: |- + \b(?xi: + finfo_buffer | finfo_close | finfo_file | finfo_open | finfo_set_flags | mime_content_type + )\b + scope: support.function.fileinfo.php + - match: |- + \b(?xi: + filter_has_var | filter_id | filter_input | filter_input_array | filter_list | filter_var | filter_var_array + )\b + scope: support.function.filter.php + - match: |- + \b(?xi: + call_user_func | call_user_func_array | create_function | forward_static_call | forward_static_call_array | func_get_arg | func_get_args | func_num_args | + function_exists | get_defined_functions | register_shutdown_function | register_tick_function | unregister_tick_function + )\b + scope: support.function.funchand.php + - match: |- + \b(?xi: + bind_textdomain_codeset | bindtextdomain | dcgettext | dcngettext | dgettext | dngettext | gettext | ngettext | + textdomain + )\b + scope: support.function.gettext.php + - match: |- + \b(?xi: + gmp_abs | gmp_add | gmp_and | gmp_binomial | gmp_clrbit | gmp_cmp | gmp_com | gmp_div | + gmp_fact | gmp_gcd | gmp_gcdext | gmp_hamdist | gmp_init | gmp_intval | gmp_invert | gmp_jacobi | + gmp_kronecker | gmp_kronecker_q | gmp_kronecker_qr | gmp_kronecker_r | gmp_kroneckerexact | gmp_lcm | gmp_legendre | gmp_mod | + gmp_mul | gmp_neg | gmp_nextprime | gmp_or | gmp_perfect_power | gmp_perfect_square | gmp_popcount | gmp_pow | + gmp_powm | gmp_prob_prime | gmp_random | gmp_scan0 | gmp_scan1 | gmp_setbit | gmp_sign | gmp_sqrt | + gmp_sqrtrem | gmp_strval | gmp_sub | gmp_testbit | gmp_xor + )\b + scope: support.function.gmp.php + - match: |- + \b(?xi: + hash | hash_algos | hash_copy | hash_file | hash_final | hash_hkdf | hash_hmac | hash_hmac_file | + hash_init | hash_update | hash_update_file | hash_update_stream + )\b + scope: support.function.hash.php + - match: |- + \b(?xi: + http_build_cookie | http_build_str | http_build_url | http_cache_etag | http_cache_last_modified | http_chunked_decode | http_date | http_deflate | + http_get | http_get_request_body | http_get_request_body_stream | http_get_request_headers | http_head | http_inflate | http_match_etag | http_match_modified | + http_match_request_header | http_negotiate_charset | http_negotiate_content_type | http_negotiate_language | http_parse_cookie | http_parse_headers | http_parse_message | http_parse_params | + http_persistent_handles_clean | http_persistent_handles_count | http_persistent_handles_ident | http_post_data | http_post_fields | http_put_data | http_put_file | http_put_stream | + http_redirect | http_request | http_request_body_encode | http_request_method_exists | http_request_method_name | http_request_method_register | http_request_method_unregister | http_response_code | + http_send_content_disposition | http_send_content_type | http_send_data | http_send_file | http_send_last_modified | http_send_status | http_send_stream | http_support | + http_throttle | ob_deflatehandler | ob_etaghandler | ob_inflatehandler + )\b + scope: support.function.http.php + - match: |- + \b(?xi: + iconv | iconv_get_encoding | iconv_mime_decode | iconv_mime_decode_headers | iconv_mime_encode | iconv_set_encoding | iconv_strlen | iconv_strpos | + iconv_strrpos | iconv_substr | ob_iconv_handler + )\b + scope: support.function.iconv.php + - match: |- + \b(?xi: + iis_add_server | iis_get_dir_security | iis_get_script_map | iis_get_server_by_comment | iis_get_server_by_path | iis_get_server_rights | iis_get_service_state | iis_remove_server | + iis_set_app_settings | iis_set_dir_security | iis_set_script_map | iis_set_server_rights | iis_start_server | iis_start_service | iis_stop_server | iis_stop_service + )\b + scope: support.function.iisfunc.php + - match: |- + \b(?xi: + gd_info | getimagesize | image2wbmp | image_type_to_extension | image_type_to_mime_type | imagealphablending | imageantialias | imagearc | + imagechar | imagecharup | imagecolorallocate | imagecolorallocatealpha | imagecolorat | imagecolorclosest | imagecolorclosestalpha | imagecolorclosesthwb | + imagecolordeallocate | imagecolorexact | imagecolorexactalpha | imagecolormatch | imagecolorresolve | imagecolorresolvealpha | imagecolorset | imagecolorsforindex | + imagecolorstotal | imagecolortransparent | imageconvolution | imagecopy | imagecopymerge | imagecopymergegray | imagecopyresampled | imagecopyresized | + imagecreate | imagecreatefromgd | imagecreatefromgd2 | imagecreatefromgd2part | imagecreatefromgif | imagecreatefromjpeg | imagecreatefrompng | imagecreatefromstring | + imagecreatefromwbmp | imagecreatefromxbm | imagecreatefromxpm | imagecreatetruecolor | imagedashedline | imagedestroy | imageellipse | imagefill | + imagefilledarc | imagefilledellipse | imagefilledpolygon | imagefilledrectangle | imagefilltoborder | imagefilter | imagefontheight | imagefontwidth | + imageftbbox | imagefttext | imagegammacorrect | imagegd | imagegd2 | imagegif | imagegrabscreen | imagegrabwindow | + imageinterlace | imageistruecolor | imagejpeg | imagelayereffect | imageline | imageloadfont | imagepalettecopy | imagepng | + imagepolygon | imagepsbbox | imagepsencodefont | imagepsextendfont | imagepsfreefont | imagepsloadfont | imagepsslantfont | imagepstext | + imagerectangle | imagerotate | imagesavealpha | imagesetbrush | imagesetpixel | imagesetstyle | imagesetthickness | imagesettile | + imagestring | imagestringup | imagesx | imagesy | imagetruecolortopalette | imagettfbbox | imagettftext | imagetypes | + imagewbmp | imagexbm | iptcembed | iptcparse | jpeg2wbmp | png2wbmp + )\b + scope: support.function.image.php + - match: |- + \b(?xi: + assert | assert_options | dl | extension_loaded | gc_collect_cycles | gc_disable | gc_enable | gc_enabled | + get_cfg_var | get_current_user | get_defined_constants | get_extension_funcs | get_include_path | get_included_files | get_loaded_extensions | get_magic_quotes_gpc | + get_magic_quotes_runtime | get_required_files | getenv | getlastmod | getmygid | getmyinode | getmypid | getmyuid | + getopt | getrusage | ini_alter | ini_get | ini_get_all | ini_restore | ini_set | magic_quotes_runtime | + main | memory_get_peak_usage | memory_get_usage | php_ini_loaded_file | php_ini_scanned_files | php_logo_guid | php_sapi_name | php_uname | + phpcredits | phpinfo | phpversion | putenv | restore_include_path | set_include_path | set_magic_quotes_runtime | set_time_limit | + sys_get_temp_dir | version_compare | zend_logo_guid | zend_thread_id | zend_version + )\b + scope: support.function.info.php + - match: |- + \b(?xi: + ibase_add_user | ibase_affected_rows | ibase_backup | ibase_blob_add | ibase_blob_cancel | ibase_blob_close | ibase_blob_create | ibase_blob_echo | + ibase_blob_get | ibase_blob_import | ibase_blob_info | ibase_blob_open | ibase_close | ibase_commit | ibase_commit_ret | ibase_connect | + ibase_db_info | ibase_delete_user | ibase_drop_db | ibase_errcode | ibase_errmsg | ibase_execute | ibase_fetch_assoc | ibase_fetch_object | + ibase_fetch_row | ibase_field_info | ibase_free_event_handler | ibase_free_query | ibase_free_result | ibase_gen_id | ibase_maintain_db | ibase_modify_user | + ibase_name_result | ibase_num_fields | ibase_num_params | ibase_param_info | ibase_pconnect | ibase_prepare | ibase_query | ibase_restore | + ibase_rollback | ibase_rollback_ret | ibase_server_info | ibase_service_attach | ibase_service_detach | ibase_set_event_handler | ibase_timefmt | ibase_trans | + ibase_wait_event + )\b + scope: support.function.interbase.php + - match: |- + \b(?xi: + collator_asort | collator_compare | collator_create | collator_get_attribute | collator_get_error_code | collator_get_error_message | collator_get_locale | collator_get_sort_key | + collator_get_strength | collator_set_attribute | collator_set_strength | collator_sort | collator_sort_with_sort_keys | datefmt_create | datefmt_format | datefmt_get_calendar | + datefmt_get_datetype | datefmt_get_error_code | datefmt_get_error_message | datefmt_get_locale | datefmt_get_pattern | datefmt_get_timetype | datefmt_get_timezone_id | datefmt_is_lenient | + datefmt_localtime | datefmt_parse | datefmt_set_calendar | datefmt_set_lenient | datefmt_set_pattern | datefmt_set_timezone_id | grapheme_extract | grapheme_stripos | + grapheme_stristr | grapheme_strlen | grapheme_strpos | grapheme_strripos | grapheme_strrpos | grapheme_strstr | grapheme_substr | idn_to_ascii | + idn_to_unicode | idn_to_utf8 | intl_error_name | intl_get_error_code | intl_get_error_message | intl_is_failure | locale_accept_from_http | locale_compose | + locale_filter_matches | locale_get_all_variants | locale_get_default | locale_get_display_language | locale_get_display_name | locale_get_display_region | locale_get_display_script | locale_get_display_variant | + locale_get_keywords | locale_get_primary_language | locale_get_region | locale_get_script | locale_lookup | locale_parse | locale_set_default | msgfmt_create | + msgfmt_format | msgfmt_format_message | msgfmt_get_error_code | msgfmt_get_error_message | msgfmt_get_locale | msgfmt_get_pattern | msgfmt_parse | msgfmt_parse_message | + msgfmt_set_pattern | normalizer_is_normalized | normalizer_normalize | numfmt_create | numfmt_format | numfmt_format_currency | numfmt_get_attribute | numfmt_get_error_code | + numfmt_get_error_message | numfmt_get_locale | numfmt_get_pattern | numfmt_get_symbol | numfmt_get_text_attribute | numfmt_parse | numfmt_parse_currency | numfmt_set_attribute | + numfmt_set_pattern | numfmt_set_symbol | numfmt_set_text_attribute | resourcebundle_count | resourcebundle_create | resourcebundle_get | resourcebundle_get_error_code | resourcebundle_get_error_message | + resourcebundle_locales | transliterator_create | transliterator_create_from_rules | transliterator_create_inverse | transliterator_get_error_code | transliterator_get_error_message | transliterator_list_ids | transliterator_transliterate + )\b + scope: support.function.intl.php + - match: |- + \b(?xi: + json_decode | json_encode | json_last_error + )\b + scope: support.function.json.php + - match: |- + \b(?xi: + ldap_8859_to_t61 | ldap_add | ldap_bind | ldap_close | ldap_compare | ldap_connect | ldap_count_entries | ldap_delete | + ldap_dn2ufn | ldap_err2str | ldap_errno | ldap_error | ldap_explode_dn | ldap_first_attribute | ldap_first_entry | ldap_first_reference | + ldap_free_result | ldap_get_attributes | ldap_get_dn | ldap_get_entries | ldap_get_option | ldap_get_values | ldap_get_values_len | ldap_list | + ldap_mod_add | ldap_mod_del | ldap_mod_replace | ldap_modify | ldap_next_attribute | ldap_next_entry | ldap_next_reference | ldap_parse_reference | + ldap_parse_result | ldap_read | ldap_rename | ldap_sasl_bind | ldap_search | ldap_set_option | ldap_set_rebind_proc | ldap_sort | + ldap_start_tls | ldap_t61_to_8859 | ldap_unbind + )\b + scope: support.function.ldap.php + - match: |- + \b(?xi: + libxml_clear_errors | libxml_disable_entity_loader | libxml_get_errors | libxml_get_last_error | libxml_set_streams_context | libxml_use_internal_errors + )\b + scope: support.function.libxml.php + - match: |- + \b(?xi: + ezmlm_hash | mail + )\b + scope: support.function.mail.php + - match: |- + \b(?xi: + abs | acos | acosh | asin | asinh | atan | atan2 | atanh | + base_convert | bindec | ceil | cos | cosh | decbin | dechex | decoct | + deg2rad | exp | expm1 | floor | fmod | getrandmax | hexdec | hypot | + intdiv | is_finite | is_infinite | is_nan | lcg_value | log | log10 | log1p | + max | min | mt_getrandmax | mt_rand | mt_srand | octdec | pi | pow | + rad2deg | rand | round | sin | sinh | sqrt | srand | tan | + tanh + )\b + scope: support.function.math.php + - match: |- + \b(?xi: + mb_check_encoding | mb_convert_case | mb_convert_encoding | mb_convert_kana | mb_convert_variables | mb_decode_mimeheader | mb_decode_numericentity | mb_detect_encoding | + mb_detect_order | mb_encode_mimeheader | mb_encode_numericentity | mb_encoding_aliases | mb_ereg | mb_ereg_match | mb_ereg_replace | mb_ereg_search | + mb_ereg_search_getpos | mb_ereg_search_getregs | mb_ereg_search_init | mb_ereg_search_pos | mb_ereg_search_regs | mb_ereg_search_setpos | mb_eregi | mb_eregi_replace | + mb_get_info | mb_http_input | mb_http_output | mb_internal_encoding | mb_language | mb_list_encodings | mb_output_handler | mb_parse_str | + mb_preferred_mime_name | mb_regex_encoding | mb_regex_set_options | mb_send_mail | mb_split | mb_strcut | mb_strimwidth | mb_stripos | + mb_stristr | mb_strlen | mb_strpos | mb_strrchr | mb_strrichr | mb_strripos | mb_strrpos | mb_strstr | + mb_strtolower | mb_strtoupper | mb_strwidth | mb_substitute_character | mb_substr | mb_substr_count + )\b + scope: support.function.mbstring.php + - match: |- + \b(?xi: + mcrypt_cbc | mcrypt_cfb | mcrypt_create_iv | mcrypt_decrypt | mcrypt_ecb | mcrypt_enc_get_algorithms_name | mcrypt_enc_get_block_size | mcrypt_enc_get_iv_size | + mcrypt_enc_get_key_size | mcrypt_enc_get_modes_name | mcrypt_enc_get_supported_key_sizes | mcrypt_enc_is_block_algorithm | mcrypt_enc_is_block_algorithm_mode | mcrypt_enc_is_block_mode | mcrypt_enc_self_test | mcrypt_encrypt | + mcrypt_generic | mcrypt_generic_deinit | mcrypt_generic_end | mcrypt_generic_init | mcrypt_get_block_size | mcrypt_get_cipher_name | mcrypt_get_iv_size | mcrypt_get_key_size | + mcrypt_list_algorithms | mcrypt_list_modes | mcrypt_module_close | mcrypt_module_get_algo_block_size | mcrypt_module_get_algo_key_size | mcrypt_module_get_supported_key_sizes | mcrypt_module_is_block_algorithm | mcrypt_module_is_block_algorithm_mode | + mcrypt_module_is_block_mode | mcrypt_module_open | mcrypt_module_self_test | mcrypt_ofb | mdecrypt_generic + )\b + scope: support.function.mcrypt.php + - match: |- + \b(?xi: + memcache_debug + )\b + scope: support.function.memcache.php + - match: |- + \b(?xi: + mhash | mhash_count | mhash_get_block_size | mhash_get_hash_name | mhash_keygen_s2k + )\b + scope: support.function.mhash.php + - match: |- + \b(?xi: + bson_decode | bson_encode + )\b + scope: support.function.mongo.php + - match: |- + \b(?xi: + mysql_affected_rows | mysql_client_encoding | mysql_close | mysql_connect | mysql_create_db | mysql_data_seek | mysql_db_name | mysql_db_query | + mysql_drop_db | mysql_errno | mysql_error | mysql_escape_string | mysql_fetch_array | mysql_fetch_assoc | mysql_fetch_field | mysql_fetch_lengths | + mysql_fetch_object | mysql_fetch_row | mysql_field_flags | mysql_field_len | mysql_field_name | mysql_field_seek | mysql_field_table | mysql_field_type | + mysql_free_result | mysql_get_client_info | mysql_get_host_info | mysql_get_proto_info | mysql_get_server_info | mysql_info | mysql_insert_id | mysql_list_dbs | + mysql_list_fields | mysql_list_processes | mysql_list_tables | mysql_num_fields | mysql_num_rows | mysql_pconnect | mysql_ping | mysql_query | + mysql_real_escape_string | mysql_result | mysql_select_db | mysql_set_charset | mysql_stat | mysql_tablename | mysql_thread_id | mysql_unbuffered_query + )\b + scope: support.function.mysql.php + - match: |- + \b(?xi: + mysqli_affected_rows | mysqli_autocommit | mysqli_bind_param | mysqli_bind_result | mysqli_change_user | mysqli_character_set_name | mysqli_client_encoding | mysqli_close | + mysqli_commit | mysqli_connect | mysqli_connect_errno | mysqli_connect_error | mysqli_data_seek | mysqli_debug | mysqli_disable_reads_from_master | mysqli_disable_rpl_parse | + mysqli_dump_debug_info | mysqli_embedded_server_end | mysqli_embedded_server_start | mysqli_enable_reads_from_master | mysqli_enable_rpl_parse | mysqli_errno | mysqli_error | mysqli_escape_string | + mysqli_execute | mysqli_fetch | mysqli_fetch_all | mysqli_fetch_array | mysqli_fetch_assoc | mysqli_fetch_field | mysqli_fetch_field_direct | mysqli_fetch_fields | + mysqli_fetch_lengths | mysqli_fetch_object | mysqli_fetch_row | mysqli_field_count | mysqli_field_seek | mysqli_field_tell | mysqli_free_result | mysqli_get_cache_stats | + mysqli_get_charset | mysqli_get_client_info | mysqli_get_client_stats | mysqli_get_client_version | mysqli_get_connection_stats | mysqli_get_host_info | mysqli_get_metadata | mysqli_get_proto_info | + mysqli_get_server_info | mysqli_get_server_version | mysqli_get_warnings | mysqli_info | mysqli_init | mysqli_insert_id | mysqli_kill | mysqli_master_query | + mysqli_more_results | mysqli_multi_query | mysqli_next_result | mysqli_num_fields | mysqli_num_rows | mysqli_options | mysqli_param_count | mysqli_ping | + mysqli_poll | mysqli_prepare | mysqli_query | mysqli_real_connect | mysqli_real_escape_string | mysqli_real_query | mysqli_reap_async_query | mysqli_report | + mysqli_rollback | mysqli_rpl_parse_enabled | mysqli_rpl_probe | mysqli_rpl_query_type | mysqli_select_db | mysqli_send_long_data | mysqli_send_query | mysqli_set_charset | + mysqli_set_local_infile_default | mysqli_set_local_infile_handler | mysqli_set_opt | mysqli_slave_query | mysqli_sqlstate | mysqli_ssl_set | mysqli_stat | mysqli_stmt_affected_rows | + mysqli_stmt_attr_get | mysqli_stmt_attr_set | mysqli_stmt_bind_param | mysqli_stmt_bind_result | mysqli_stmt_close | mysqli_stmt_data_seek | mysqli_stmt_errno | mysqli_stmt_error | + mysqli_stmt_execute | mysqli_stmt_fetch | mysqli_stmt_field_count | mysqli_stmt_free_result | mysqli_stmt_get_result | mysqli_stmt_get_warnings | mysqli_stmt_init | mysqli_stmt_insert_id | + mysqli_stmt_num_rows | mysqli_stmt_param_count | mysqli_stmt_prepare | mysqli_stmt_reset | mysqli_stmt_result_metadata | mysqli_stmt_send_long_data | mysqli_stmt_sqlstate | mysqli_stmt_store_result | + mysqli_store_result | mysqli_thread_id | mysqli_thread_safe | mysqli_use_result | mysqli_warning_count + )\b + scope: support.function.mysqli.php + - match: |- + \b(?xi: + mysqlnd_ms_get_stats | mysqlnd_ms_query_is_select | mysqlnd_ms_set_user_pick_server + )\b + scope: support.function.mysqlnd-ms.php + - match: |- + \b(?xi: + mysqlnd_qc_change_handler | mysqlnd_qc_clear_cache | mysqlnd_qc_get_cache_info | mysqlnd_qc_get_core_stats | mysqlnd_qc_get_handler | mysqlnd_qc_get_query_trace_log | mysqlnd_qc_set_user_handlers + )\b + scope: support.function.mysqlnd-qc.php + - match: |- + \b(?xi: + checkdnsrr | closelog | define_syslog_variables | dns_check_record | dns_get_mx | dns_get_record | fsockopen | gethostbyaddr | + gethostbyname | gethostbynamel | gethostname | getmxrr | getprotobyname | getprotobynumber | getservbyname | getservbyport | + header | header_remove | headers_list | headers_sent | inet_ntop | inet_pton | ip2long | long2ip | + openlog | pfsockopen | setcookie | setrawcookie | socket_get_status | socket_set_blocking | socket_set_timeout | syslog + )\b + scope: support.function.network.php + - match: |- + \b(?xi: + nsapi_request_headers | nsapi_response_headers | nsapi_virtual + )\b + scope: support.function.nsapi.php + - match: |- + \b(?xi: + aggregate | aggregate_info | aggregate_methods | aggregate_methods_by_list | aggregate_methods_by_regexp | aggregate_properties | aggregate_properties_by_list | aggregate_properties_by_regexp | + aggregation_info | deaggregate + )\b + scope: support.function.objaggregation.php + - match: |- + \b(?xi: + oci_bind_array_by_name | oci_bind_by_name | oci_cancel | oci_client_version | oci_close | oci_commit | oci_connect | oci_define_by_name | + oci_error | oci_execute | oci_fetch | oci_fetch_all | oci_fetch_array | oci_fetch_assoc | oci_fetch_object | oci_fetch_row | + oci_field_is_null | oci_field_name | oci_field_precision | oci_field_scale | oci_field_size | oci_field_type | oci_field_type_raw | oci_free_statement | + oci_internal_debug | oci_lob_copy | oci_lob_is_equal | oci_new_collection | oci_new_connect | oci_new_cursor | oci_new_descriptor | oci_num_fields | + oci_num_rows | oci_parse | oci_password_change | oci_pconnect | oci_result | oci_rollback | oci_server_version | oci_set_action | + oci_set_call_timeout | oci_set_client_identifier | oci_set_client_info | oci_set_db_operation | oci_set_edition | oci_set_module_name | oci_set_prefetch | oci_statement_type | + ocibindbyname | ocicancel | ocicloselob | ocicollappend | ocicollassign | ocicollassignelem | ocicollgetelem | ocicollmax | + ocicollsize | ocicolltrim | ocicolumnisnull | ocicolumnname | ocicolumnprecision | ocicolumnscale | ocicolumnsize | ocicolumntype | + ocicolumntyperaw | ocicommit | ocidefinebyname | ocierror | ociexecute | ocifetch | ocifetchinto | ocifetchstatement | + ocifreecollection | ocifreecursor | ocifreedesc | ocifreestatement | ociinternaldebug | ociloadlob | ocilogoff | ocilogon | + ocinewcollection | ocinewcursor | ocinewdescriptor | ocinlogon | ocinumcols | ociparse | ociplogon | ociresult | + ocirollback | ocirowcount | ocisavelob | ocisavelobfile | ociserverversion | ocisetprefetch | ocistatementtype | ociwritelobtofile | + ociwritetemporarylob + )\b + scope: support.function.oci8.php + - match: |- + \b(?xi: + openssl_cipher_iv_length | openssl_csr_export | openssl_csr_export_to_file | openssl_csr_get_public_key | openssl_csr_get_subject | openssl_csr_new | openssl_csr_sign | openssl_decrypt | + openssl_dh_compute_key | openssl_digest | openssl_encrypt | openssl_error_string | openssl_free_key | openssl_get_cipher_methods | openssl_get_md_methods | openssl_get_privatekey | + openssl_get_publickey | openssl_open | openssl_pkcs12_export | openssl_pkcs12_export_to_file | openssl_pkcs12_read | openssl_pkcs7_decrypt | openssl_pkcs7_encrypt | openssl_pkcs7_sign | + openssl_pkcs7_verify | openssl_pkey_derive | openssl_pkey_export | openssl_pkey_export_to_file | openssl_pkey_free | openssl_pkey_get_details | openssl_pkey_get_private | openssl_pkey_get_public | + openssl_pkey_new | openssl_private_decrypt | openssl_private_encrypt | openssl_public_decrypt | openssl_public_encrypt | openssl_random_pseudo_bytes | openssl_seal | openssl_sign | + openssl_verify | openssl_x509_check_private_key | openssl_x509_checkpurpose | openssl_x509_export | openssl_x509_export_to_file | openssl_x509_free | openssl_x509_parse | openssl_x509_read + )\b + scope: support.function.openssl.php + - match: |- + \b(?xi: + flush | ob_clean | ob_end_clean | ob_end_flush | ob_flush | ob_get_clean | ob_get_contents | ob_get_flush | + ob_get_length | ob_get_level | ob_get_status | ob_gzhandler | ob_implicit_flush | ob_list_handlers | ob_start | output_add_rewrite_var | + output_reset_rewrite_vars + )\b + scope: support.function.output.php + - match: |- + \b(?xi: + overload + )\b + scope: support.function.overload.php + - match: |- + \b(?xi: + pcntl_alarm | pcntl_exec | pcntl_fork | pcntl_getpriority | pcntl_setpriority | pcntl_signal | pcntl_signal_dispatch | pcntl_sigprocmask | + pcntl_sigtimedwait | pcntl_sigwaitinfo | pcntl_wait | pcntl_waitpid | pcntl_wexitstatus | pcntl_wifexited | pcntl_wifsignaled | pcntl_wifstopped | + pcntl_wstopsig | pcntl_wtermsig + )\b + scope: support.function.pcntl.php + - match: |- + \b(?xi: + pg_affected_rows | pg_cancel_query | pg_client_encoding | pg_close | pg_connect | pg_connection_busy | pg_connection_reset | pg_connection_status | + pg_convert | pg_copy_from | pg_copy_to | pg_dbname | pg_delete | pg_end_copy | pg_escape_bytea | pg_escape_string | + pg_execute | pg_fetch_all | pg_fetch_all_columns | pg_fetch_array | pg_fetch_assoc | pg_fetch_object | pg_fetch_result | pg_fetch_row | + pg_field_is_null | pg_field_name | pg_field_num | pg_field_prtlen | pg_field_size | pg_field_table | pg_field_type | pg_field_type_oid | + pg_free_result | pg_get_notify | pg_get_pid | pg_get_result | pg_host | pg_insert | pg_last_error | pg_last_notice | + pg_last_oid | pg_lo_close | pg_lo_create | pg_lo_export | pg_lo_import | pg_lo_open | pg_lo_read | pg_lo_read_all | + pg_lo_seek | pg_lo_tell | pg_lo_unlink | pg_lo_write | pg_meta_data | pg_num_fields | pg_num_rows | pg_options | + pg_parameter_status | pg_pconnect | pg_ping | pg_port | pg_prepare | pg_put_line | pg_query | pg_query_params | + pg_result_error | pg_result_error_field | pg_result_seek | pg_result_status | pg_select | pg_send_execute | pg_send_prepare | pg_send_query | + pg_send_query_params | pg_set_client_encoding | pg_set_error_verbosity | pg_trace | pg_transaction_status | pg_tty | pg_unescape_bytea | pg_untrace | + pg_update | pg_version + )\b + scope: support.function.pgsql.php + - match: |- + \b(?xi: + apache_child_terminate | apache_get_modules | apache_get_version | apache_getenv | apache_lookup_uri | apache_note | apache_request_headers | apache_reset_timeout | + apache_response_headers | apache_setenv | getallheaders | virtual + )\b + scope: support.function.php_apache.php + - match: |- + \b(?xi: + dom_import_simplexml + )\b + scope: support.function.php_dom.php + - match: |- + \b(?xi: + ftp_alloc | ftp_cdup | ftp_chdir | ftp_chmod | ftp_close | ftp_connect | ftp_delete | ftp_exec | + ftp_fget | ftp_fput | ftp_get | ftp_get_option | ftp_login | ftp_mdtm | ftp_mkdir | ftp_nb_continue | + ftp_nb_fget | ftp_nb_fput | ftp_nb_get | ftp_nb_put | ftp_nlist | ftp_pasv | ftp_put | ftp_pwd | + ftp_quit | ftp_raw | ftp_rawlist | ftp_rename | ftp_rmdir | ftp_set_option | ftp_site | ftp_size | + ftp_ssl_connect | ftp_systype + )\b + scope: support.function.php_ftp.php + - match: |- + \b(?xi: + imap_8bit | imap_alerts | imap_append | imap_base64 | imap_binary | imap_body | imap_bodystruct | imap_check | + imap_clearflag_full | imap_close | imap_create | imap_createmailbox | imap_delete | imap_deletemailbox | imap_errors | imap_expunge | + imap_fetch_overview | imap_fetchbody | imap_fetchheader | imap_fetchmime | imap_fetchstructure | imap_fetchtext | imap_gc | imap_get_quota | + imap_get_quotaroot | imap_getacl | imap_getmailboxes | imap_getsubscribed | imap_header | imap_headerinfo | imap_headers | imap_last_error | + imap_list | imap_listmailbox | imap_listscan | imap_listsubscribed | imap_lsub | imap_mail | imap_mail_compose | imap_mail_copy | + imap_mail_move | imap_mailboxmsginfo | imap_mime_header_decode | imap_msgno | imap_num_msg | imap_num_recent | imap_open | imap_ping | + imap_qprint | imap_rename | imap_renamemailbox | imap_reopen | imap_rfc822_parse_adrlist | imap_rfc822_parse_headers | imap_rfc822_write_address | imap_savebody | + imap_scan | imap_scanmailbox | imap_search | imap_set_quota | imap_setacl | imap_setflag_full | imap_sort | imap_status | + imap_subscribe | imap_thread | imap_timeout | imap_uid | imap_undelete | imap_unsubscribe | imap_utf7_decode | imap_utf7_encode | + imap_utf8 + )\b + scope: support.function.php_imap.php + - match: |- + \b(?xi: + mssql_bind | mssql_close | mssql_connect | mssql_data_seek | mssql_execute | mssql_fetch_array | mssql_fetch_assoc | mssql_fetch_batch | + mssql_fetch_field | mssql_fetch_object | mssql_fetch_row | mssql_field_length | mssql_field_name | mssql_field_seek | mssql_field_type | mssql_free_result | + mssql_free_statement | mssql_get_last_message | mssql_guid_string | mssql_init | mssql_min_error_severity | mssql_min_message_severity | mssql_next_result | mssql_num_fields | + mssql_num_rows | mssql_pconnect | mssql_query | mssql_result | mssql_rows_affected | mssql_select_db + )\b + scope: support.function.php_mssql.php + - match: |- + \b(?xi: + odbc_autocommit | odbc_binmode | odbc_close | odbc_close_all | odbc_columnprivileges | odbc_columns | odbc_commit | odbc_connect | + odbc_cursor | odbc_data_source | odbc_do | odbc_error | odbc_errormsg | odbc_exec | odbc_execute | odbc_fetch_array | + odbc_fetch_into | odbc_fetch_object | odbc_fetch_row | odbc_field_len | odbc_field_name | odbc_field_num | odbc_field_precision | odbc_field_scale | + odbc_field_type | odbc_foreignkeys | odbc_free_result | odbc_gettypeinfo | odbc_longreadlen | odbc_next_result | odbc_num_fields | odbc_num_rows | + odbc_pconnect | odbc_prepare | odbc_primarykeys | odbc_procedurecolumns | odbc_procedures | odbc_result | odbc_result_all | odbc_rollback | + odbc_setoption | odbc_specialcolumns | odbc_statistics | odbc_tableprivileges | odbc_tables + )\b + scope: support.function.php_odbc.php + - match: |- + \b(?xi: + preg_filter | preg_grep | preg_last_error | preg_match | preg_match_all | preg_quote | preg_replace | preg_replace_callback | + preg_replace_callback_array | preg_split + )\b + scope: support.function.php_pcre.php + - match: |- + \b(?xi: + class_implements | class_parents | iterator_apply | iterator_count | iterator_to_array | spl_autoload | spl_autoload_call | spl_autoload_extensions | + spl_autoload_functions | spl_autoload_register | spl_autoload_unregister | spl_classes | spl_object_hash | spl_object_id + )\b + scope: support.function.php_spl.php + - match: |- + \b(?xi: + zip_close | zip_entry_close | zip_entry_compressedsize | zip_entry_compressionmethod | zip_entry_filesize | zip_entry_name | zip_entry_open | zip_entry_read | + zip_open | zip_read + )\b + scope: support.function.php_zip.php + - match: |- + \b(?xi: + posix_access | posix_ctermid | posix_errno | posix_get_last_error | posix_getcwd | posix_getegid | posix_geteuid | posix_getgid | + posix_getgrgid | posix_getgrnam | posix_getgroups | posix_getlogin | posix_getpgid | posix_getpgrp | posix_getpid | posix_getppid | + posix_getpwnam | posix_getpwuid | posix_getrlimit | posix_getsid | posix_getuid | posix_initgroups | posix_isatty | posix_kill | + posix_mkfifo | posix_mknod | posix_setegid | posix_seteuid | posix_setgid | posix_setpgid | posix_setsid | posix_setuid | + posix_strerror | posix_times | posix_ttyname | posix_uname + )\b + scope: support.function.posix.php + - match: |- + \b(?xi: + setproctitle | setthreadtitle + )\b + scope: support.function.proctitle.php + - match: |- + \b(?xi: + pspell_add_to_personal | pspell_add_to_session | pspell_check | pspell_clear_session | pspell_config_create | pspell_config_data_dir | pspell_config_dict_dir | pspell_config_ignore | + pspell_config_mode | pspell_config_personal | pspell_config_repl | pspell_config_runtogether | pspell_config_save_repl | pspell_new | pspell_new_config | pspell_new_personal | + pspell_save_wordlist | pspell_store_replacement | pspell_suggest + )\b + scope: support.function.pspell.php + - match: |- + \b(?xi: + readline | readline_add_history | readline_callback_handler_install | readline_callback_handler_remove | readline_callback_read_char | readline_clear_history | readline_completion_function | readline_info | + readline_list_history | readline_on_new_line | readline_read_history | readline_redisplay | readline_write_history + )\b + scope: support.function.readline.php + - match: |- + \b(?xi: + recode | recode_file | recode_string + )\b + scope: support.function.recode.php + - match: |- + \b(?xi: + rrd_create | rrd_error | rrd_fetch | rrd_first | rrd_graph | rrd_info | rrd_last | rrd_lastupdate | + rrd_restore | rrd_tune | rrd_update | rrd_xport + )\b + scope: support.function.rrd.php + - match: |- + \b(?xi: + ftok | msg_get_queue | msg_queue_exists | msg_receive | msg_remove_queue | msg_send | msg_set_queue | msg_stat_queue | + sem_acquire | sem_get | sem_release | sem_remove | shm_attach | shm_detach | shm_get_var | shm_has_var | + shm_put_var | shm_remove | shm_remove_var + )\b + scope: support.function.sem.php + - match: |- + \b(?xi: + session_cache_expire | session_cache_limiter | session_commit | session_decode | session_destroy | session_encode | session_get_cookie_params | session_id | + session_is_registered | session_module_name | session_name | session_regenerate_id | session_register | session_save_path | session_set_cookie_params | session_set_save_handler | + session_start | session_unregister | session_unset | session_write_close + )\b + scope: support.function.session.php + - match: |- + \b(?xi: + shmop_close | shmop_delete | shmop_open | shmop_read | shmop_size | shmop_write + )\b + scope: support.function.shmop.php + - match: |- + \b(?xi: + simplexml_import_dom | simplexml_load_file | simplexml_load_string + )\b + scope: support.function.simplexml.php + - match: |- + \b(?xi: + snmp2_get | snmp2_getnext | snmp2_real_walk | snmp2_set | snmp2_walk | snmp3_get | snmp3_getnext | snmp3_real_walk | + snmp3_set | snmp3_walk | snmp_get_quick_print | snmp_get_valueretrieval | snmp_read_mib | snmp_set_enum_print | snmp_set_oid_numeric_print | snmp_set_oid_output_format | + snmp_set_quick_print | snmp_set_valueretrieval | snmpget | snmpgetnext | snmprealwalk | snmpset | snmpwalk | snmpwalkoid + )\b + scope: support.function.snmp.php + - match: |- + \b(?xi: + is_soap_fault | use_soap_error_handler + )\b + scope: support.function.soap.php + - match: |- + \b(?xi: + socket_accept | socket_bind | socket_clear_error | socket_close | socket_connect | socket_create | socket_create_listen | socket_create_pair | + socket_export_stream | socket_get_option | socket_getpeername | socket_getsockname | socket_last_error | socket_listen | socket_read | socket_recv | + socket_recvfrom | socket_select | socket_send | socket_sendto | socket_set_block | socket_set_nonblock | socket_set_option | socket_shutdown | + socket_strerror | socket_write + )\b + scope: support.function.sockets.php + - match: |- + \b(?xi: + sqlite_array_query | sqlite_busy_timeout | sqlite_changes | sqlite_close | sqlite_column | sqlite_create_aggregate | sqlite_create_function | sqlite_current | + sqlite_error_string | sqlite_escape_string | sqlite_exec | sqlite_factory | sqlite_fetch_all | sqlite_fetch_array | sqlite_fetch_column_types | sqlite_fetch_object | + sqlite_fetch_single | sqlite_fetch_string | sqlite_field_name | sqlite_has_more | sqlite_has_prev | sqlite_key | sqlite_last_error | sqlite_last_insert_rowid | + sqlite_libencoding | sqlite_libversion | sqlite_next | sqlite_num_fields | sqlite_num_rows | sqlite_open | sqlite_popen | sqlite_prev | + sqlite_query | sqlite_rewind | sqlite_seek | sqlite_single_query | sqlite_udf_decode_binary | sqlite_udf_encode_binary | sqlite_unbuffered_query | sqlite_valid + )\b + scope: support.function.sqlite.php + - match: |- + \b(?xi: + stats_absolute_deviation | stats_cdf_beta | stats_cdf_binomial | stats_cdf_cauchy | stats_cdf_chisquare | stats_cdf_exponential | stats_cdf_f | stats_cdf_gamma | + stats_cdf_laplace | stats_cdf_logistic | stats_cdf_negative_binomial | stats_cdf_noncentral_chisquare | stats_cdf_noncentral_f | stats_cdf_poisson | stats_cdf_t | stats_cdf_uniform | + stats_cdf_weibull | stats_covariance | stats_den_uniform | stats_dens_beta | stats_dens_cauchy | stats_dens_chisquare | stats_dens_exponential | stats_dens_f | + stats_dens_gamma | stats_dens_laplace | stats_dens_logistic | stats_dens_negative_binomial | stats_dens_normal | stats_dens_pmf_binomial | stats_dens_pmf_hypergeometric | stats_dens_pmf_poisson | + stats_dens_t | stats_dens_weibull | stats_harmonic_mean | stats_kurtosis | stats_rand_gen_beta | stats_rand_gen_chisquare | stats_rand_gen_exponential | stats_rand_gen_f | + stats_rand_gen_funiform | stats_rand_gen_gamma | stats_rand_gen_ibinomial | stats_rand_gen_ibinomial_negative | stats_rand_gen_int | stats_rand_gen_ipoisson | stats_rand_gen_iuniform | stats_rand_gen_noncenral_chisquare | + stats_rand_gen_noncentral_f | stats_rand_gen_noncentral_t | stats_rand_gen_normal | stats_rand_gen_t | stats_rand_get_seeds | stats_rand_phrase_to_seeds | stats_rand_ranf | stats_rand_setall | + stats_skew | stats_standard_deviation | stats_stat_binomial_coef | stats_stat_correlation | stats_stat_gennch | stats_stat_independent_t | stats_stat_innerproduct | stats_stat_noncentral_t | + stats_stat_paired_t | stats_stat_percentile | stats_stat_powersum | stats_variance + )\b + scope: support.function.stats.php + - match: |- + \b(?xi: + set_socket_blocking | stream_bucket_append | stream_bucket_make_writeable | stream_bucket_new | stream_bucket_prepend | stream_context_create | stream_context_get_default | stream_context_get_options | + stream_context_get_params | stream_context_set_default | stream_context_set_option | stream_context_set_params | stream_copy_to_stream | stream_encoding | stream_filter_append | stream_filter_prepend | + stream_filter_register | stream_filter_remove | stream_get_contents | stream_get_filters | stream_get_line | stream_get_meta_data | stream_get_transports | stream_get_wrappers | + stream_is_local | stream_notification_callback | stream_register_wrapper | stream_resolve_include_path | stream_select | stream_set_blocking | stream_set_read_buffer | stream_set_timeout | + stream_set_write_buffer | stream_socket_accept | stream_socket_client | stream_socket_enable_crypto | stream_socket_get_name | stream_socket_pair | stream_socket_recvfrom | stream_socket_sendto | + stream_socket_server | stream_socket_shutdown | stream_supports_lock | stream_wrapper_register | stream_wrapper_restore | stream_wrapper_unregister + )\b + scope: support.function.streamsfuncs.php + - match: |- + \b(?xi: + addcslashes | addslashes | bin2hex | chop | chr | chunk_split | convert_cyr_string | convert_uudecode | + convert_uuencode | count_chars | crc32 | crypt | echo | explode | fprintf | get_html_translation_table | + hebrev | hebrevc | html_entity_decode | htmlentities | htmlspecialchars | htmlspecialchars_decode | implode | join | + lcfirst | levenshtein | localeconv | ltrim | md5 | md5_file | metaphone | money_format | + nl2br | nl_langinfo | number_format | ord | parse_str | print | printf | quoted_printable_decode | + quoted_printable_encode | quotemeta | rtrim | setlocale | sha1 | sha1_file | similar_text | soundex | + sprintf | sscanf | str_getcsv | str_ireplace | str_pad | str_repeat | str_replace | str_rot13 | + str_shuffle | str_split | str_word_count | strcasecmp | strchr | strcmp | strcoll | strcspn | + strip_tags | stripcslashes | stripos | stripslashes | stristr | strlen | strnatcasecmp | strnatcmp | + strncasecmp | strncmp | strpbrk | strpos | strrchr | strrev | strripos | strrpos | + strspn | strstr | strtok | strtolower | strtoupper | strtr | substr | substr_compare | + substr_count | substr_replace | trim | ucfirst | ucwords | vfprintf | vprintf | vsprintf | + wordwrap + )\b + scope: support.function.string.php + - match: |- + \b(?xi: + sybase_affected_rows | sybase_close | sybase_connect | sybase_data_seek | sybase_deadlock_retry_count | sybase_fetch_array | sybase_fetch_assoc | sybase_fetch_field | + sybase_fetch_object | sybase_fetch_row | sybase_field_seek | sybase_free_result | sybase_get_last_message | sybase_min_client_severity | sybase_min_error_severity | sybase_min_message_severity | + sybase_min_server_severity | sybase_num_fields | sybase_num_rows | sybase_pconnect | sybase_query | sybase_result | sybase_select_db | sybase_set_message_handler | + sybase_unbuffered_query + )\b + scope: support.function.sybase.php + - match: |- + \b(?xi: + ob_tidyhandler | tidy_access_count | tidy_clean_repair | tidy_config_count | tidy_diagnose | tidy_error_count | tidy_get_body | tidy_get_config | + tidy_get_error_buffer | tidy_get_head | tidy_get_html | tidy_get_html_ver | tidy_get_opt_doc | tidy_get_output | tidy_get_release | tidy_get_root | + tidy_get_status | tidy_getopt | tidy_is_xhtml | tidy_is_xml | tidy_load_config | tidy_parse_file | tidy_parse_string | tidy_repair_file | + tidy_repair_string | tidy_reset_config | tidy_save_config | tidy_set_encoding | tidy_setopt | tidy_warning_count + )\b + scope: support.function.tidy.php + - match: |- + \b(?xi: + token_get_all | token_name + )\b + scope: support.function.tokenizer.php + - match: |- + \b(?xi: + base64_decode | base64_encode | get_headers | get_meta_tags | http_build_query | parse_url | rawurldecode | rawurlencode | + urldecode | urlencode + )\b + scope: support.function.url.php + - match: |- + \b(?xi: + boolval | debug_zval_dump | doubleval | empty | floatval | get_defined_vars | get_resource_type | gettype | + import_request_variables | intval | is_array | is_bool | is_callable | is_countable | is_double | is_float | + is_int | is_integer | is_iterable | is_long | is_null | is_numeric | is_object | is_real | + is_resource | is_scalar | is_string | isset | print_r | serialize | settype | strval | + unserialize | unset | var_dump | var_export + )\b + scope: support.function.var.php + - match: |- + \b(?xi: + wddx_add_vars | wddx_deserialize | wddx_packet_end | wddx_packet_start | wddx_serialize_value | wddx_serialize_vars + )\b + scope: support.function.wddx.php + - match: |- + \b(?xi: + xhprof_disable | xhprof_enable | xhprof_sample_disable | xhprof_sample_enable + )\b + scope: support.function.xhprof.php + - match: |- + \b(?xi: + utf8_decode | utf8_encode | xml_error_string | xml_get_current_byte_index | xml_get_current_column_number | xml_get_current_line_number | xml_get_error_code | xml_parse | + xml_parse_into_struct | xml_parser_create | xml_parser_create_ns | xml_parser_free | xml_parser_get_option | xml_parser_set_option | xml_set_character_data_handler | xml_set_default_handler | + xml_set_element_handler | xml_set_end_namespace_decl_handler | xml_set_external_entity_ref_handler | xml_set_notation_decl_handler | xml_set_object | xml_set_processing_instruction_handler | xml_set_start_namespace_decl_handler | xml_set_unparsed_entity_decl_handler + )\b + scope: support.function.xml.php + - match: |- + \b(?xi: + xmlrpc_decode | xmlrpc_decode_request | xmlrpc_encode | xmlrpc_encode_request | xmlrpc_get_type | xmlrpc_is_fault | xmlrpc_parse_method_descriptions | xmlrpc_server_add_introspection_data | + xmlrpc_server_call_method | xmlrpc_server_create | xmlrpc_server_destroy | xmlrpc_server_register_introspection_callback | xmlrpc_server_register_method | xmlrpc_set_type + )\b + scope: support.function.xmlrpc.php + - match: |- + \b(?xi: + xmlwriter_end_attribute | xmlwriter_end_cdata | xmlwriter_end_comment | xmlwriter_end_document | xmlwriter_end_dtd | xmlwriter_end_dtd_attlist | xmlwriter_end_dtd_element | xmlwriter_end_dtd_entity | + xmlwriter_end_element | xmlwriter_end_pi | xmlwriter_flush | xmlwriter_full_end_element | xmlwriter_open_memory | xmlwriter_open_uri | xmlwriter_output_memory | xmlwriter_set_indent | + xmlwriter_set_indent_string | xmlwriter_start_attribute | xmlwriter_start_attribute_ns | xmlwriter_start_cdata | xmlwriter_start_comment | xmlwriter_start_document | xmlwriter_start_dtd | xmlwriter_start_dtd_attlist | + xmlwriter_start_dtd_element | xmlwriter_start_dtd_entity | xmlwriter_start_element | xmlwriter_start_element_ns | xmlwriter_start_pi | xmlwriter_text | xmlwriter_write_attribute | xmlwriter_write_attribute_ns | + xmlwriter_write_cdata | xmlwriter_write_comment | xmlwriter_write_dtd | xmlwriter_write_dtd_attlist | xmlwriter_write_dtd_element | xmlwriter_write_dtd_entity | xmlwriter_write_element | xmlwriter_write_element_ns | + xmlwriter_write_pi | xmlwriter_write_raw + )\b + scope: support.function.xmlwriter.php + - match: |- + \b(?xi: + xslt_backend_info | xslt_backend_name | xslt_backend_version | xslt_create | xslt_errno | xslt_error | xslt_free | xslt_getopt | + xslt_process | xslt_set_base | xslt_set_encoding | xslt_set_error_handler | xslt_set_log | xslt_set_object | xslt_set_sax_handler | xslt_set_sax_handlers | + xslt_set_scheme_handler | xslt_set_scheme_handlers | xslt_setopt + )\b + scope: support.function.xslt.php + - match: |- + \b(?xi: + gzclose | gzcompress | gzdecode | gzdeflate | gzencode | gzeof | gzfile | gzgetc | + gzgets | gzgetss | gzinflate | gzopen | gzpassthru | gzputs | gzread | gzrewind | + gzseek | gztell | gzuncompress | gzwrite | readgzfile | zlib_get_coding_type + )\b + scope: support.function.zlib.php + - match: |- + \b(?xi: + is_int | is_integer + )\b + scope: support.function.alias.php + + variables: + - match: (\$)((_(COOKIE|FILES|GET|POST|REQUEST))|arg(v|c))\b + scope: variable.other.global.php + captures: + 1: punctuation.definition.variable.php + push: after-identifier + - match: (\$)((GLOBALS|_(ENV|SERVER|SESSION))) + scope: variable.other.global.safer.php + captures: + 1: punctuation.definition.variable.php + push: after-identifier + - match: '(\$)this\b' + scope: variable.language.php + captures: + 1: punctuation.definition.variable.php + push: after-identifier + - match: (\$+){{identifier}} + scope: variable.other.php + captures: + 1: punctuation.definition.variable.php + push: after-identifier + + variables-no-item-access: + - match: (\$)((_(COOKIE|FILES|GET|POST|REQUEST))|arg(v|c))\b + scope: variable.other.global.php + captures: + 1: punctuation.definition.variable.php + - match: (\$)((GLOBALS|_(ENV|SERVER|SESSION))) + scope: variable.other.global.safer.php + captures: + 1: punctuation.definition.variable.php + - match: '(\$)this\b' + scope: variable.language.php + captures: + 1: punctuation.definition.variable.php + - match: (\$+){{identifier}} + scope: variable.other.php + captures: + 1: punctuation.definition.variable.php + + identifier-parts: + - match: (\\)?({{identifier}})(\\) + captures: + 1: punctuation.separator.namespace.php + 2: support.other.namespace.php + 3: punctuation.separator.namespace.php + + identifier-parts-as-path: + - match: (\\)?({{identifier}})(\\) + scope: meta.path.php + captures: + 1: punctuation.separator.namespace.php + 2: support.other.namespace.php + 3: punctuation.separator.namespace.php + + identifier-constant-pop: + - match: '(?={{path}})' + push: + - meta_scope: meta.path.php + - include: identifier-parts + - match: '(\\)?({{identifier}})(?!\\)' + captures: + 1: punctuation.separator.namespace.php + 2: constant.other.php + set: after-identifier + - match: '' + pop: true diff --git a/assets/syntaxes/Packages/PHP/PHP.sublime-completions b/assets/syntaxes/Packages/PHP/PHP.sublime-completions new file mode 100644 index 000000000..1ff4448c5 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/PHP.sublime-completions @@ -0,0 +1,4170 @@ +{ + "scope": "source.php - variable.other.php - source.php meta.embedded.html", + + "completions": + [ + "php", + + { "trigger": "abs", "contents": "abs(${1:number})" }, + { "trigger": "acos", "contents": "acos(${1:arg})" }, + { "trigger": "acosh", "contents": "acosh(${1:arg})" }, + { "trigger": "addcslashes", "contents": "addcslashes(${1:str}, ${2:charlist})" }, + { "trigger": "addslashes", "contents": "addslashes(${1:str})" }, + { "trigger": "aggregate", "contents": "aggregate(${1:object}, ${2:class_name})" }, + { "trigger": "aggregate_info", "contents": "aggregate_info(${1:object})" }, + { "trigger": "aggregate_methods", "contents": "aggregate_methods(${1:object}, ${2:class_name})" }, + { "trigger": "aggregate_methods_by_list", "contents": "aggregate_methods_by_list(${1:object}, ${2:class_name}, ${3:methods_list})" }, + { "trigger": "aggregate_methods_by_regexp", "contents": "aggregate_methods_by_regexp(${1:object}, ${2:class_name}, ${3:regexp})" }, + { "trigger": "aggregate_properties", "contents": "aggregate_properties(${1:object}, ${2:class_name})" }, + { "trigger": "aggregate_properties_by_list", "contents": "aggregate_properties_by_list(${1:object}, ${2:class_name}, ${3:properties_list})" }, + { "trigger": "aggregate_properties_by_regexp", "contents": "aggregate_properties_by_regexp(${1:object}, ${2:class_name}, ${3:regexp})" }, + { "trigger": "aggregation_info", "contents": "aggregation_info()" }, + { "trigger": "apache_child_terminate", "contents": "apache_child_terminate()" }, + { "trigger": "apache_get_modules", "contents": "apache_get_modules()" }, + { "trigger": "apache_get_version", "contents": "apache_get_version()" }, + { "trigger": "apache_getenv", "contents": "apache_getenv(${1:variable})" }, + { "trigger": "apache_lookup_uri", "contents": "apache_lookup_uri(${1:filename})" }, + { "trigger": "apache_note", "contents": "apache_note(${1:note_name})" }, + { "trigger": "apache_request_headers", "contents": "apache_request_headers()" }, + { "trigger": "apache_reset_timeout", "contents": "apache_reset_timeout()" }, + { "trigger": "apache_response_headers", "contents": "apache_response_headers()" }, + { "trigger": "apache_setenv", "contents": "apache_setenv(${1:variable}, ${2:value})" }, + { "trigger": "apc_add", "contents": "apc_add(${1:key})" }, + { "trigger": "apc_bin_dump", "contents": "apc_bin_dump()" }, + { "trigger": "apc_bin_dumpfile", "contents": "apc_bin_dumpfile(${1:files}, ${2:user_vars}, ${3:filename})" }, + { "trigger": "apc_bin_load", "contents": "apc_bin_load(${1:data})" }, + { "trigger": "apc_bin_loadfile", "contents": "apc_bin_loadfile(${1:filename})" }, + { "trigger": "apc_cache_info", "contents": "apc_cache_info()" }, + { "trigger": "apc_cas", "contents": "apc_cas(${1:key}, ${2:old}, ${3:new})" }, + { "trigger": "apc_clear_cache", "contents": "apc_clear_cache()" }, + { "trigger": "apc_compile_file", "contents": "apc_compile_file(${1:filename})" }, + { "trigger": "apc_dec", "contents": "apc_dec(${1:key})" }, + { "trigger": "apc_define_constants", "contents": "apc_define_constants(${1:key}, ${2:constants})" }, + { "trigger": "apc_delete", "contents": "apc_delete(${1:key})" }, + { "trigger": "apc_delete_file", "contents": "apc_delete_file(${1:keys})" }, + { "trigger": "apc_exists", "contents": "apc_exists(${1:keys})" }, + { "trigger": "apc_fetch", "contents": "apc_fetch(${1:key})" }, + { "trigger": "apc_inc", "contents": "apc_inc(${1:key})" }, + { "trigger": "apc_load_constants", "contents": "apc_load_constants(${1:key})" }, + { "trigger": "apc_sma_info", "contents": "apc_sma_info()" }, + { "trigger": "apc_store", "contents": "apc_store(${1:key}, ${2:var})" }, + { "trigger": "apcu_add", "contents": "apcu_add(${1:key}, ${2:var})" }, + { "trigger": "apcu_cache_info", "contents": "apcu_cache_info()" }, + { "trigger": "apcu_cas", "contents": "apcu_cas(${1:key}, ${2:old}, ${3:new})" }, + { "trigger": "apcu_clear_cache", "contents": "apcu_clear_cache()" }, + { "trigger": "apcu_dec", "contents": "apcu_dec(${1:key})" }, + { "trigger": "apcu_delete", "contents": "apcu_delete(${1:key})" }, + { "trigger": "apcu_entry", "contents": "apcu_entry(${1:key})" }, + { "trigger": "apcu_exists", "contents": "apcu_exists(${1:keys})" }, + { "trigger": "apcu_fetch", "contents": "apcu_fetch(${1:key})" }, + { "trigger": "apcu_inc", "contents": "apcu_inc(${1:key})" }, + { "trigger": "apcu_sma_info", "contents": "apcu_sma_info()" }, + { "trigger": "apcu_store", "contents": "apcu_store(${1:key}, ${2:var})" }, + { "trigger": "apd_breakpoint", "contents": "apd_breakpoint(${1:debug_level})" }, + { "trigger": "apd_callstack", "contents": "apd_callstack()" }, + { "trigger": "apd_clunk", "contents": "apd_clunk(${1:warning})" }, + { "trigger": "apd_continue", "contents": "apd_continue(${1:debug_level})" }, + { "trigger": "apd_croak", "contents": "apd_croak(${1:warning})" }, + { "trigger": "apd_dump_function_table", "contents": "apd_dump_function_table()" }, + { "trigger": "apd_dump_persistent_resources", "contents": "apd_dump_persistent_resources()" }, + { "trigger": "apd_dump_regular_resources", "contents": "apd_dump_regular_resources()" }, + { "trigger": "apd_echo", "contents": "apd_echo(${1:output})" }, + { "trigger": "apd_get_active_symbols", "contents": "apd_get_active_symbols()" }, + { "trigger": "apd_set_pprof_trace", "contents": "apd_set_pprof_trace()" }, + { "trigger": "apd_set_session", "contents": "apd_set_session(${1:debug_level})" }, + { "trigger": "apd_set_session_trace", "contents": "apd_set_session_trace(${1:debug_level})" }, + { "trigger": "apd_set_session_trace_socket", "contents": "apd_set_session_trace_socket(${1:tcp_server}, ${2:socket_type}, ${3:port}, ${4:debug_level})" }, + { "trigger": "array", "contents": "array()" }, + { "trigger": "array_change_key_case", "contents": "array_change_key_case(${1:input})" }, + { "trigger": "array_chunk", "contents": "array_chunk(${1:input}, ${2:size})" }, + { "trigger": "array_column", "contents": "array_column(${1:input}, ${2:column_key})" }, + { "trigger": "array_combine", "contents": "array_combine(${1:keys}, ${2:values})" }, + { "trigger": "array_count_values", "contents": "array_count_values(${1:input})" }, + { "trigger": "array_diff", "contents": "array_diff(${1:array1}, ${2:array2})" }, + { "trigger": "array_diff_assoc", "contents": "array_diff_assoc(${1:array1}, ${2:array2})" }, + { "trigger": "array_diff_key", "contents": "array_diff_key(${1:array1}, ${2:array2})" }, + { "trigger": "array_diff_uassoc", "contents": "array_diff_uassoc(${1:array1}, ${2:array2})" }, + { "trigger": "array_diff_ukey", "contents": "array_diff_ukey(${1:array1}, ${2:array2})" }, + { "trigger": "array_fill", "contents": "array_fill(${1:start_index}, ${2:num}, ${3:value})" }, + { "trigger": "array_fill_keys", "contents": "array_fill_keys(${1:keys}, ${2:value})" }, + { "trigger": "array_filter", "contents": "array_filter(${1:input})" }, + { "trigger": "array_flip", "contents": "array_flip(${1:trans})" }, + { "trigger": "array_intersect", "contents": "array_intersect(${1:array1}, ${2:array2})" }, + { "trigger": "array_intersect_assoc", "contents": "array_intersect_assoc(${1:array1}, ${2:array2})" }, + { "trigger": "array_intersect_key", "contents": "array_intersect_key(${1:array1}, ${2:array2})" }, + { "trigger": "array_intersect_uassoc", "contents": "array_intersect_uassoc(${1:array1}, ${2:array2})" }, + { "trigger": "array_intersect_ukey", "contents": "array_intersect_ukey(${1:array1}, ${2:array2})" }, + { "trigger": "array_key_exists", "contents": "array_key_exists(${1:key}, ${2:array})" }, + { "trigger": "array_keys", "contents": "array_keys(${1:input})" }, + { "trigger": "array_map", "contents": "array_map(${1:callback}, ${2:arr1})" }, + { "trigger": "array_merge", "contents": "array_merge(${1:array1})" }, + { "trigger": "array_merge_recursive", "contents": "array_merge_recursive(${1:array1})" }, + { "trigger": "array_multisort", "contents": "array_multisort(${1:arr})" }, + { "trigger": "array_pad", "contents": "array_pad(${1:input}, ${2:pad_size}, ${3:pad_value})" }, + { "trigger": "array_pop", "contents": "array_pop(${1:array})" }, + { "trigger": "array_product", "contents": "array_product(${1:array})" }, + { "trigger": "array_push", "contents": "array_push(${1:array}, ${2:var})" }, + { "trigger": "array_rand", "contents": "array_rand(${1:input})" }, + { "trigger": "array_reduce", "contents": "array_reduce(${1:input}, ${2:function})" }, + { "trigger": "array_replace", "contents": "array_replace(${1:array}, ${2:array1})" }, + { "trigger": "array_replace_recursive", "contents": "array_replace_recursive(${1:array}, ${2:array1})" }, + { "trigger": "array_reverse", "contents": "array_reverse(${1:array})" }, + { "trigger": "array_search", "contents": "array_search(${1:needle}, ${2:haystack})" }, + { "trigger": "array_shift", "contents": "array_shift(${1:array})" }, + { "trigger": "array_slice", "contents": "array_slice(${1:array}, ${2:offset})" }, + { "trigger": "array_splice", "contents": "array_splice(${1:input}, ${2:offset})" }, + { "trigger": "array_sum", "contents": "array_sum(${1:array})" }, + { "trigger": "array_udiff", "contents": "array_udiff(${1:array1}, ${2:array2})" }, + { "trigger": "array_udiff_assoc", "contents": "array_udiff_assoc(${1:array1}, ${2:array2})" }, + { "trigger": "array_udiff_uassoc", "contents": "array_udiff_uassoc(${1:array1}, ${2:array2})" }, + { "trigger": "array_uintersect", "contents": "array_uintersect(${1:array1}, ${2:array2})" }, + { "trigger": "array_uintersect_assoc", "contents": "array_uintersect_assoc(${1:array1}, ${2:array2})" }, + { "trigger": "array_uintersect_uassoc", "contents": "array_uintersect_uassoc(${1:array1}, ${2:array2})" }, + { "trigger": "array_unique", "contents": "array_unique(${1:array})" }, + { "trigger": "array_unshift", "contents": "array_unshift(${1:array}, ${2:var})" }, + { "trigger": "array_values", "contents": "array_values(${1:input})" }, + { "trigger": "array_walk", "contents": "array_walk(${1:array}, ${2:funcname})" }, + { "trigger": "array_walk_recursive", "contents": "array_walk_recursive(${1:input}, ${2:funcname})" }, + { "trigger": "arsort", "contents": "arsort(${1:array})" }, + { "trigger": "asin", "contents": "asin(${1:arg})" }, + { "trigger": "asinh", "contents": "asinh(${1:arg})" }, + { "trigger": "asort", "contents": "asort(${1:array})" }, + { "trigger": "assert", "contents": "assert(${1:assertion})" }, + { "trigger": "assert_options", "contents": "assert_options(${1:what})" }, + { "trigger": "atan", "contents": "atan(${1:arg})" }, + { "trigger": "atan2", "contents": "atan2(${1:y}, ${2:x})" }, + { "trigger": "atanh", "contents": "atanh(${1:arg})" }, + { "trigger": "base64_decode", "contents": "base64_decode(${1:data})" }, + { "trigger": "base64_encode", "contents": "base64_encode(${1:data})" }, + { "trigger": "base_convert", "contents": "base_convert(${1:number}, ${2:frombase}, ${3:tobase})" }, + { "trigger": "basename", "contents": "basename(${1:path})" }, + { "trigger": "bbcode_add_element", "contents": "bbcode_add_element(${1:bbcode_container}, ${2:tag_name}, ${3:tag_rules})" }, + { "trigger": "bbcode_add_smiley", "contents": "bbcode_add_smiley(${1:bbcode_container}, ${2:smiley}, ${3:replace_by})" }, + { "trigger": "bbcode_create", "contents": "bbcode_create()" }, + { "trigger": "bbcode_destroy", "contents": "bbcode_destroy(${1:bbcode_container})" }, + { "trigger": "bbcode_parse", "contents": "bbcode_parse(${1:bbcode_container}, ${2:to_parse})" }, + { "trigger": "bbcode_set_arg_parser", "contents": "bbcode_set_arg_parser(${1:bbcode_container}, ${2:bbcode_arg_parser})" }, + { "trigger": "bbcode_set_flags", "contents": "bbcode_set_flags(${1:bbcode_container}, ${2:flags})" }, + { "trigger": "bcadd", "contents": "bcadd(${1:left_operand}, ${2:right_operand})" }, + { "trigger": "bccomp", "contents": "bccomp(${1:left_operand}, ${2:right_operand})" }, + { "trigger": "bcdiv", "contents": "bcdiv(${1:left_operand}, ${2:right_operand})" }, + { "trigger": "bcmod", "contents": "bcmod(${1:left_operand}, ${2:modulus})" }, + { "trigger": "bcmul", "contents": "bcmul(${1:left_operand}, ${2:right_operand})" }, + { "trigger": "bcompiler_load", "contents": "bcompiler_load(${1:filename})" }, + { "trigger": "bcompiler_load_exe", "contents": "bcompiler_load_exe(${1:filename})" }, + { "trigger": "bcompiler_parse_class", "contents": "bcompiler_parse_class(${1:class}, ${2:callback})" }, + { "trigger": "bcompiler_read", "contents": "bcompiler_read(${1:filehandle})" }, + { "trigger": "bcompiler_write_class", "contents": "bcompiler_write_class(${1:filehandle}, ${2:className})" }, + { "trigger": "bcompiler_write_constant", "contents": "bcompiler_write_constant(${1:filehandle}, ${2:constantName})" }, + { "trigger": "bcompiler_write_exe_footer", "contents": "bcompiler_write_exe_footer(${1:filehandle}, ${2:startpos})" }, + { "trigger": "bcompiler_write_file", "contents": "bcompiler_write_file(${1:filehandle}, ${2:filename})" }, + { "trigger": "bcompiler_write_footer", "contents": "bcompiler_write_footer(${1:filehandle})" }, + { "trigger": "bcompiler_write_function", "contents": "bcompiler_write_function(${1:filehandle}, ${2:functionName})" }, + { "trigger": "bcompiler_write_functions_from_file", "contents": "bcompiler_write_functions_from_file(${1:filehandle}, ${2:fileName})" }, + { "trigger": "bcompiler_write_header", "contents": "bcompiler_write_header(${1:filehandle})" }, + { "trigger": "bcompiler_write_included_filename", "contents": "bcompiler_write_included_filename(${1:filehandle}, ${2:filename})" }, + { "trigger": "bcpow", "contents": "bcpow(${1:left_operand}, ${2:right_operand})" }, + { "trigger": "bcpowmod", "contents": "bcpowmod(${1:left_operand}, ${2:right_operand}, ${3:modulus})" }, + { "trigger": "bcscale", "contents": "bcscale(${1:scale})" }, + { "trigger": "bcsqrt", "contents": "bcsqrt(${1:operand})" }, + { "trigger": "bcsub", "contents": "bcsub(${1:left_operand}, ${2:right_operand})" }, + { "trigger": "bin2hex", "contents": "bin2hex(${1:str})" }, + { "trigger": "bind_textdomain_codeset", "contents": "bind_textdomain_codeset(${1:domain}, ${2:codeset})" }, + { "trigger": "bindec", "contents": "bindec(${1:binary_string})" }, + { "trigger": "bindtextdomain", "contents": "bindtextdomain(${1:domain}, ${2:directory})" }, + { "trigger": "boolval", "contents": "boolval(${1:var})" }, + { "trigger": "bson_decode", "contents": "bson_decode(${1:bson})" }, + { "trigger": "bson_encode", "contents": "bson_encode(${1:anything})" }, + { "trigger": "bzclose", "contents": "bzclose(${1:bz})" }, + { "trigger": "bzcompress", "contents": "bzcompress(${1:source}, ${2:blocksize}, ${3:workfactor})" }, + { "trigger": "bzdecompress", "contents": "bzdecompress(${1:source})" }, + { "trigger": "bzerrno", "contents": "bzerrno(${1:bz})" }, + { "trigger": "bzerror", "contents": "bzerror(${1:bz})" }, + { "trigger": "bzerrstr", "contents": "bzerrstr(${1:bz})" }, + { "trigger": "bzflush", "contents": "bzflush(${1:bz})" }, + { "trigger": "bzopen", "contents": "bzopen(${1:filename}, ${2:mode})" }, + { "trigger": "bzread", "contents": "bzread(${1:bz})" }, + { "trigger": "bzwrite", "contents": "bzwrite(${1:bz}, ${2:data})" }, + { "trigger": "cairo_create", "contents": "cairo_create(${1:surface})" }, + { "trigger": "cairo_font_face_get_type", "contents": "cairo_font_face_get_type(${1:fontface})" }, + { "trigger": "cairo_font_face_status", "contents": "cairo_font_face_status(${1:fontface})" }, + { "trigger": "cairo_font_options_create", "contents": "cairo_font_options_create()" }, + { "trigger": "cairo_font_options_equal", "contents": "cairo_font_options_equal(${1:options}, ${2:other})" }, + { "trigger": "cairo_font_options_get_antialias", "contents": "cairo_font_options_get_antialias(${1:options})" }, + { "trigger": "cairo_font_options_get_hint_metrics", "contents": "cairo_font_options_get_hint_metrics(${1:options})" }, + { "trigger": "cairo_font_options_get_hint_style", "contents": "cairo_font_options_get_hint_style(${1:options})" }, + { "trigger": "cairo_font_options_get_subpixel_order", "contents": "cairo_font_options_get_subpixel_order(${1:options})" }, + { "trigger": "cairo_font_options_hash", "contents": "cairo_font_options_hash(${1:options})" }, + { "trigger": "cairo_font_options_merge", "contents": "cairo_font_options_merge(${1:options}, ${2:other})" }, + { "trigger": "cairo_font_options_set_antialias", "contents": "cairo_font_options_set_antialias(${1:options}, ${2:antialias})" }, + { "trigger": "cairo_font_options_set_hint_metrics", "contents": "cairo_font_options_set_hint_metrics(${1:options}, ${2:hint_metrics})" }, + { "trigger": "cairo_font_options_set_hint_style", "contents": "cairo_font_options_set_hint_style(${1:options}, ${2:hint_style})" }, + { "trigger": "cairo_font_options_set_subpixel_order", "contents": "cairo_font_options_set_subpixel_order(${1:options}, ${2:subpixel_order})" }, + { "trigger": "cairo_font_options_status", "contents": "cairo_font_options_status(${1:options})" }, + { "trigger": "cairo_format_stride_for_width", "contents": "cairo_format_stride_for_width(${1:format}, ${2:width})" }, + { "trigger": "cairo_image_surface_create", "contents": "cairo_image_surface_create(${1:format}, ${2:width}, ${3:height})" }, + { "trigger": "cairo_image_surface_create_for_data", "contents": "cairo_image_surface_create_for_data(${1:data}, ${2:format}, ${3:width}, ${4:height})" }, + { "trigger": "cairo_image_surface_create_from_png", "contents": "cairo_image_surface_create_from_png(${1:file})" }, + { "trigger": "cairo_image_surface_get_data", "contents": "cairo_image_surface_get_data(${1:surface})" }, + { "trigger": "cairo_image_surface_get_format", "contents": "cairo_image_surface_get_format(${1:surface})" }, + { "trigger": "cairo_image_surface_get_height", "contents": "cairo_image_surface_get_height(${1:surface})" }, + { "trigger": "cairo_image_surface_get_stride", "contents": "cairo_image_surface_get_stride(${1:surface})" }, + { "trigger": "cairo_image_surface_get_width", "contents": "cairo_image_surface_get_width(${1:surface})" }, + { "trigger": "cairo_matrix_create_scale", "contents": "cairo_matrix_create_scale()" }, + { "trigger": "cairo_matrix_create_translate", "contents": "cairo_matrix_create_translate()" }, + { "trigger": "cairo_matrix_invert", "contents": "cairo_matrix_invert(${1:matrix})" }, + { "trigger": "cairo_matrix_multiply", "contents": "cairo_matrix_multiply(${1:matrix1}, ${2:matrix2})" }, + { "trigger": "cairo_matrix_rotate", "contents": "cairo_matrix_rotate(${1:matrix}, ${2:radians})" }, + { "trigger": "cairo_matrix_transform_distance", "contents": "cairo_matrix_transform_distance(${1:matrix}, ${2:dx}, ${3:dy})" }, + { "trigger": "cairo_matrix_transform_point", "contents": "cairo_matrix_transform_point(${1:matrix}, ${2:dx}, ${3:dy})" }, + { "trigger": "cairo_matrix_translate", "contents": "cairo_matrix_translate(${1:matrix}, ${2:tx}, ${3:ty})" }, + { "trigger": "cairo_pattern_add_color_stop_rgb", "contents": "cairo_pattern_add_color_stop_rgb(${1:pattern}, ${2:offset}, ${3:red}, ${4:green}, ${5:blue})" }, + { "trigger": "cairo_pattern_add_color_stop_rgba", "contents": "cairo_pattern_add_color_stop_rgba(${1:pattern}, ${2:offset}, ${3:red}, ${4:green}, ${5:blue}, ${6:alpha})" }, + { "trigger": "cairo_pattern_create_for_surface", "contents": "cairo_pattern_create_for_surface(${1:surface})" }, + { "trigger": "cairo_pattern_create_linear", "contents": "cairo_pattern_create_linear(${1:x0}, ${2:y0}, ${3:x1}, ${4:y1})" }, + { "trigger": "cairo_pattern_create_radial", "contents": "cairo_pattern_create_radial(${1:x0}, ${2:y0}, ${3:r0}, ${4:x1}, ${5:y1}, ${6:r1})" }, + { "trigger": "cairo_pattern_create_rgb", "contents": "cairo_pattern_create_rgb(${1:red}, ${2:green}, ${3:blue})" }, + { "trigger": "cairo_pattern_create_rgba", "contents": "cairo_pattern_create_rgba(${1:red}, ${2:green}, ${3:blue}, ${4:alpha})" }, + { "trigger": "cairo_pattern_get_color_stop_count", "contents": "cairo_pattern_get_color_stop_count(${1:pattern})" }, + { "trigger": "cairo_pattern_get_color_stop_rgba", "contents": "cairo_pattern_get_color_stop_rgba(${1:pattern}, ${2:index})" }, + { "trigger": "cairo_pattern_get_extend", "contents": "cairo_pattern_get_extend(${1:pattern})" }, + { "trigger": "cairo_pattern_get_filter", "contents": "cairo_pattern_get_filter(${1:pattern})" }, + { "trigger": "cairo_pattern_get_linear_points", "contents": "cairo_pattern_get_linear_points(${1:pattern})" }, + { "trigger": "cairo_pattern_get_matrix", "contents": "cairo_pattern_get_matrix(${1:pattern})" }, + { "trigger": "cairo_pattern_get_radial_circles", "contents": "cairo_pattern_get_radial_circles(${1:pattern})" }, + { "trigger": "cairo_pattern_get_rgba", "contents": "cairo_pattern_get_rgba(${1:pattern})" }, + { "trigger": "cairo_pattern_get_surface", "contents": "cairo_pattern_get_surface(${1:pattern})" }, + { "trigger": "cairo_pattern_get_type", "contents": "cairo_pattern_get_type(${1:pattern})" }, + { "trigger": "cairo_pattern_set_extend", "contents": "cairo_pattern_set_extend(${1:pattern}, ${2:extend})" }, + { "trigger": "cairo_pattern_set_filter", "contents": "cairo_pattern_set_filter(${1:pattern}, ${2:filter})" }, + { "trigger": "cairo_pattern_set_matrix", "contents": "cairo_pattern_set_matrix(${1:pattern}, ${2:matrix})" }, + { "trigger": "cairo_pattern_status", "contents": "cairo_pattern_status(${1:pattern})" }, + { "trigger": "cairo_pdf_surface_create", "contents": "cairo_pdf_surface_create(${1:file}, ${2:width}, ${3:height})" }, + { "trigger": "cairo_pdf_surface_set_size", "contents": "cairo_pdf_surface_set_size(${1:surface}, ${2:width}, ${3:height})" }, + { "trigger": "cairo_ps_get_levels", "contents": "cairo_ps_get_levels()" }, + { "trigger": "cairo_ps_level_to_string", "contents": "cairo_ps_level_to_string(${1:level})" }, + { "trigger": "cairo_ps_surface_create", "contents": "cairo_ps_surface_create(${1:file}, ${2:width}, ${3:height})" }, + { "trigger": "cairo_ps_surface_dsc_begin_page_setup", "contents": "cairo_ps_surface_dsc_begin_page_setup(${1:surface})" }, + { "trigger": "cairo_ps_surface_dsc_begin_setup", "contents": "cairo_ps_surface_dsc_begin_setup(${1:surface})" }, + { "trigger": "cairo_ps_surface_dsc_comment", "contents": "cairo_ps_surface_dsc_comment(${1:surface}, ${2:comment})" }, + { "trigger": "cairo_ps_surface_get_eps", "contents": "cairo_ps_surface_get_eps(${1:surface})" }, + { "trigger": "cairo_ps_surface_restrict_to_level", "contents": "cairo_ps_surface_restrict_to_level(${1:surface}, ${2:level})" }, + { "trigger": "cairo_ps_surface_set_eps", "contents": "cairo_ps_surface_set_eps(${1:surface}, ${2:level})" }, + { "trigger": "cairo_ps_surface_set_size", "contents": "cairo_ps_surface_set_size(${1:surface}, ${2:width}, ${3:height})" }, + { "trigger": "cairo_scaled_font_create", "contents": "cairo_scaled_font_create(${1:fontface}, ${2:matrix}, ${3:ctm}, ${4:fontoptions})" }, + { "trigger": "cairo_scaled_font_extents", "contents": "cairo_scaled_font_extents(${1:scaledfont})" }, + { "trigger": "cairo_scaled_font_get_ctm", "contents": "cairo_scaled_font_get_ctm(${1:scaledfont})" }, + { "trigger": "cairo_scaled_font_get_font_face", "contents": "cairo_scaled_font_get_font_face(${1:scaledfont})" }, + { "trigger": "cairo_scaled_font_get_font_matrix", "contents": "cairo_scaled_font_get_font_matrix(${1:scaledfont})" }, + { "trigger": "cairo_scaled_font_get_font_options", "contents": "cairo_scaled_font_get_font_options(${1:scaledfont})" }, + { "trigger": "cairo_scaled_font_get_scale_matrix", "contents": "cairo_scaled_font_get_scale_matrix(${1:scaledfont})" }, + { "trigger": "cairo_scaled_font_get_type", "contents": "cairo_scaled_font_get_type(${1:scaledfont})" }, + { "trigger": "cairo_scaled_font_glyph_extents", "contents": "cairo_scaled_font_glyph_extents(${1:scaledfont}, ${2:glyphs})" }, + { "trigger": "cairo_scaled_font_status", "contents": "cairo_scaled_font_status(${1:scaledfont})" }, + { "trigger": "cairo_scaled_font_text_extents", "contents": "cairo_scaled_font_text_extents(${1:scaledfont}, ${2:text})" }, + { "trigger": "cairo_surface_copy_page", "contents": "cairo_surface_copy_page(${1:surface})" }, + { "trigger": "cairo_surface_create_similar", "contents": "cairo_surface_create_similar(${1:surface}, ${2:content}, ${3:width}, ${4:height})" }, + { "trigger": "cairo_surface_finish", "contents": "cairo_surface_finish(${1:surface})" }, + { "trigger": "cairo_surface_flush", "contents": "cairo_surface_flush(${1:surface})" }, + { "trigger": "cairo_surface_get_content", "contents": "cairo_surface_get_content(${1:surface})" }, + { "trigger": "cairo_surface_get_device_offset", "contents": "cairo_surface_get_device_offset(${1:surface})" }, + { "trigger": "cairo_surface_get_font_options", "contents": "cairo_surface_get_font_options(${1:surface})" }, + { "trigger": "cairo_surface_get_type", "contents": "cairo_surface_get_type(${1:surface})" }, + { "trigger": "cairo_surface_mark_dirty", "contents": "cairo_surface_mark_dirty(${1:surface})" }, + { "trigger": "cairo_surface_mark_dirty_rectangle", "contents": "cairo_surface_mark_dirty_rectangle(${1:surface}, ${2:x}, ${3:y}, ${4:width}, ${5:height})" }, + { "trigger": "cairo_surface_set_device_offset", "contents": "cairo_surface_set_device_offset(${1:surface}, ${2:x}, ${3:y})" }, + { "trigger": "cairo_surface_set_fallback_resolution", "contents": "cairo_surface_set_fallback_resolution(${1:surface}, ${2:x}, ${3:y})" }, + { "trigger": "cairo_surface_show_page", "contents": "cairo_surface_show_page(${1:surface})" }, + { "trigger": "cairo_surface_status", "contents": "cairo_surface_status(${1:surface})" }, + { "trigger": "cairo_surface_write_to_png", "contents": "cairo_surface_write_to_png(${1:surface}, ${2:stream})" }, + { "trigger": "cairo_svg_surface_create", "contents": "cairo_svg_surface_create(${1:file}, ${2:width}, ${3:height})" }, + { "trigger": "cairo_svg_surface_restrict_to_version", "contents": "cairo_svg_surface_restrict_to_version(${1:surface}, ${2:version})" }, + { "trigger": "cairo_svg_version_to_string", "contents": "cairo_svg_version_to_string(${1:version})" }, + { "trigger": "cal_days_in_month", "contents": "cal_days_in_month(${1:calendar}, ${2:month}, ${3:year})" }, + { "trigger": "cal_from_jd", "contents": "cal_from_jd(${1:jd}, ${2:calendar})" }, + { "trigger": "cal_info", "contents": "cal_info()" }, + { "trigger": "cal_to_jd", "contents": "cal_to_jd(${1:calendar}, ${2:month}, ${3:day}, ${4:year})" }, + { "trigger": "calcul_hmac", "contents": "calcul_hmac(${1:clent}, ${2:siretcode}, ${3:price}, ${4:reference}, ${5:validity}, ${6:taxation}, ${7:devise}, ${8:language})" }, + { "trigger": "calculhmac", "contents": "calculhmac(${1:clent}, ${2:data})" }, + { "trigger": "call_user_func", "contents": "call_user_func(${1:function})" }, + { "trigger": "call_user_func_array", "contents": "call_user_func_array(${1:function}, ${2:param_arr})" }, + { "trigger": "call_user_method", "contents": "call_user_method(${1:method_name}, ${2:obj})" }, + { "trigger": "call_user_method_array", "contents": "call_user_method_array(${1:method_name}, ${2:obj}, ${3:params})" }, + { "trigger": "ceil", "contents": "ceil(${1:value})" }, + { "trigger": "chdb_create", "contents": "chdb_create(${1:pathname}, ${2:data})" }, + { "trigger": "chdir", "contents": "chdir(${1:directory})" }, + { "trigger": "checkdate", "contents": "checkdate(${1:month}, ${2:day}, ${3:year})" }, + { "trigger": "checkdnsrr", "contents": "checkdnsrr(${1:host})" }, + { "trigger": "chgrp", "contents": "chgrp(${1:filename}, ${2:group})" }, + { "trigger": "chmod", "contents": "chmod(${1:filename}, ${2:mode})" }, + { "trigger": "chop", "contents": "chop()" }, + { "trigger": "chown", "contents": "chown(${1:filename}, ${2:user})" }, + { "trigger": "chr", "contents": "chr(${1:ascii})" }, + { "trigger": "chroot", "contents": "chroot(${1:directory})" }, + { "trigger": "chunk_split", "contents": "chunk_split(${1:body})" }, + { "trigger": "class_alias", "contents": "class_alias()" }, + { "trigger": "class_exists", "contents": "class_exists(${1:class_name})" }, + { "trigger": "class_implements", "contents": "class_implements(${1:class})" }, + { "trigger": "class_parents", "contents": "class_parents(${1:class})" }, + { "trigger": "classkit_import", "contents": "classkit_import(${1:filename})" }, + { "trigger": "classkit_method_add", "contents": "classkit_method_add(${1:classname}, ${2:methodname}, ${3:args}, ${4:code})" }, + { "trigger": "classkit_method_copy", "contents": "classkit_method_copy(${1:dClass}, ${2:dMethod}, ${3:sClass})" }, + { "trigger": "classkit_method_redefine", "contents": "classkit_method_redefine(${1:classname}, ${2:methodname}, ${3:args}, ${4:code})" }, + { "trigger": "classkit_method_remove", "contents": "classkit_method_remove(${1:classname}, ${2:methodname})" }, + { "trigger": "classkit_method_rename", "contents": "classkit_method_rename(${1:classname}, ${2:methodname}, ${3:newname})" }, + { "trigger": "clearstatcache", "contents": "clearstatcache()" }, + { "trigger": "closedir", "contents": "closedir()" }, + { "trigger": "closelog", "contents": "closelog()" }, + { "trigger": "com_addref", "contents": "com_addref()" }, + { "trigger": "com_create_guid", "contents": "com_create_guid()" }, + { "trigger": "com_event_sink", "contents": "com_event_sink(${1:comobject}, ${2:sinkobject})" }, + { "trigger": "com_get", "contents": "com_get()" }, + { "trigger": "com_get_active_object", "contents": "com_get_active_object(${1:progid})" }, + { "trigger": "com_invoke", "contents": "com_invoke(${1:com_object}, ${2:function_name})" }, + { "trigger": "com_isenum", "contents": "com_isenum(${1:com_module})" }, + { "trigger": "com_load", "contents": "com_load()" }, + { "trigger": "com_load_typelib", "contents": "com_load_typelib(${1:typelib_name})" }, + { "trigger": "com_message_pump", "contents": "com_message_pump()" }, + { "trigger": "com_print_typeinfo", "contents": "com_print_typeinfo(${1:comobject})" }, + { "trigger": "com_propget", "contents": "com_propget()" }, + { "trigger": "com_propput", "contents": "com_propput()" }, + { "trigger": "com_propset", "contents": "com_propset()" }, + { "trigger": "com_release", "contents": "com_release()" }, + { "trigger": "com_set", "contents": "com_set()" }, + { "trigger": "compact", "contents": "compact(${1:varname})" }, + { "trigger": "connection_aborted", "contents": "connection_aborted()" }, + { "trigger": "connection_status", "contents": "connection_status()" }, + { "trigger": "connection_timeout", "contents": "connection_timeout()" }, + { "trigger": "constant", "contents": "constant(${1:name})" }, + { "trigger": "convert_cyr_string", "contents": "convert_cyr_string(${1:str}, ${2:from}, ${3:to})" }, + { "trigger": "convert_uudecode", "contents": "convert_uudecode(${1:data})" }, + { "trigger": "convert_uuencode", "contents": "convert_uuencode(${1:data})" }, + { "trigger": "copy", "contents": "copy(${1:source}, ${2:dest})" }, + { "trigger": "cos", "contents": "cos(${1:arg})" }, + { "trigger": "cosh", "contents": "cosh(${1:arg})" }, + { "trigger": "count", "contents": "count(${1:var})" }, + { "trigger": "count_chars", "contents": "count_chars(${1:string})" }, + { "trigger": "counter_bump", "contents": "counter_bump(${1:offset})" }, + { "trigger": "counter_bump_value", "contents": "counter_bump_value(${1:counter}, ${2:offset})" }, + { "trigger": "counter_create", "contents": "counter_create(${1:name})" }, + { "trigger": "counter_get", "contents": "counter_get()" }, + { "trigger": "counter_get_meta", "contents": "counter_get_meta(${1:counter}, ${2:attribute})" }, + { "trigger": "counter_get_named", "contents": "counter_get_named(${1:name})" }, + { "trigger": "counter_get_value", "contents": "counter_get_value(${1:counter})" }, + { "trigger": "counter_reset", "contents": "counter_reset()" }, + { "trigger": "counter_reset_value", "contents": "counter_reset_value(${1:counter})" }, + { "trigger": "crack_check", "contents": "crack_check(${1:dictionary}, ${2:password})" }, + { "trigger": "crack_closedict", "contents": "crack_closedict()" }, + { "trigger": "crack_getlastmessage", "contents": "crack_getlastmessage()" }, + { "trigger": "crack_opendict", "contents": "crack_opendict(${1:dictionary})" }, + { "trigger": "crc32", "contents": "crc32(${1:str})" }, + { "trigger": "create_function", "contents": "create_function(${1:args}, ${2:code})" }, + { "trigger": "crypt", "contents": "crypt(${1:str})" }, + { "trigger": "ctype_alnum", "contents": "ctype_alnum(${1:text})" }, + { "trigger": "ctype_alpha", "contents": "ctype_alpha(${1:text})" }, + { "trigger": "ctype_cntrl", "contents": "ctype_cntrl(${1:text})" }, + { "trigger": "ctype_digit", "contents": "ctype_digit(${1:text})" }, + { "trigger": "ctype_graph", "contents": "ctype_graph(${1:text})" }, + { "trigger": "ctype_lower", "contents": "ctype_lower(${1:text})" }, + { "trigger": "ctype_print", "contents": "ctype_print(${1:text})" }, + { "trigger": "ctype_punct", "contents": "ctype_punct(${1:text})" }, + { "trigger": "ctype_space", "contents": "ctype_space(${1:text})" }, + { "trigger": "ctype_upper", "contents": "ctype_upper(${1:text})" }, + { "trigger": "ctype_xdigit", "contents": "ctype_xdigit(${1:text})" }, + { "trigger": "cubrid_affected_rows", "contents": "cubrid_affected_rows()" }, + { "trigger": "cubrid_bind", "contents": "cubrid_bind(${1:req_identifier}, ${2:bind_index}, ${3:bind_value})" }, + { "trigger": "cubrid_client_encoding", "contents": "cubrid_client_encoding()" }, + { "trigger": "cubrid_close", "contents": "cubrid_close()" }, + { "trigger": "cubrid_close_prepare", "contents": "cubrid_close_prepare(${1:req_identifier})" }, + { "trigger": "cubrid_close_request", "contents": "cubrid_close_request(${1:req_identifier})" }, + { "trigger": "cubrid_col_get", "contents": "cubrid_col_get(${1:conn_identifier}, ${2:oid}, ${3:attr_name})" }, + { "trigger": "cubrid_col_size", "contents": "cubrid_col_size(${1:conn_identifier}, ${2:oid}, ${3:attr_name})" }, + { "trigger": "cubrid_column_names", "contents": "cubrid_column_names(${1:req_identifier})" }, + { "trigger": "cubrid_column_types", "contents": "cubrid_column_types(${1:req_identifier})" }, + { "trigger": "cubrid_commit", "contents": "cubrid_commit(${1:conn_identifier})" }, + { "trigger": "cubrid_connect", "contents": "cubrid_connect(${1:host}, ${2:port}, ${3:dbname})" }, + { "trigger": "cubrid_connect_with_url", "contents": "cubrid_connect_with_url(${1:conn_url})" }, + { "trigger": "cubrid_current_oid", "contents": "cubrid_current_oid(${1:req_identifier})" }, + { "trigger": "cubrid_data_seek", "contents": "cubrid_data_seek(${1:req_identifier}, ${2:row_number})" }, + { "trigger": "cubrid_db_name", "contents": "cubrid_db_name(${1:result}, ${2:index})" }, + { "trigger": "cubrid_disconnect", "contents": "cubrid_disconnect(${1:conn_identifier})" }, + { "trigger": "cubrid_drop", "contents": "cubrid_drop(${1:conn_identifier}, ${2:oid})" }, + { "trigger": "cubrid_errno", "contents": "cubrid_errno()" }, + { "trigger": "cubrid_error", "contents": "cubrid_error()" }, + { "trigger": "cubrid_error_code", "contents": "cubrid_error_code()" }, + { "trigger": "cubrid_error_code_facility", "contents": "cubrid_error_code_facility()" }, + { "trigger": "cubrid_error_msg", "contents": "cubrid_error_msg()" }, + { "trigger": "cubrid_execute", "contents": "cubrid_execute(${1:conn_identifier}, ${2:SQL})" }, + { "trigger": "cubrid_fetch", "contents": "cubrid_fetch(${1:result})" }, + { "trigger": "cubrid_fetch_array", "contents": "cubrid_fetch_array(${1:result})" }, + { "trigger": "cubrid_fetch_assoc", "contents": "cubrid_fetch_assoc(${1:result})" }, + { "trigger": "cubrid_fetch_field", "contents": "cubrid_fetch_field(${1:result})" }, + { "trigger": "cubrid_fetch_lengths", "contents": "cubrid_fetch_lengths(${1:result})" }, + { "trigger": "cubrid_fetch_object", "contents": "cubrid_fetch_object(${1:result})" }, + { "trigger": "cubrid_fetch_row", "contents": "cubrid_fetch_row(${1:result})" }, + { "trigger": "cubrid_field_flags", "contents": "cubrid_field_flags(${1:result}, ${2:field_offset})" }, + { "trigger": "cubrid_field_len", "contents": "cubrid_field_len(${1:result}, ${2:field_offset})" }, + { "trigger": "cubrid_field_name", "contents": "cubrid_field_name(${1:result}, ${2:field_offset})" }, + { "trigger": "cubrid_field_seek", "contents": "cubrid_field_seek(${1:result})" }, + { "trigger": "cubrid_field_table", "contents": "cubrid_field_table(${1:result}, ${2:field_offset})" }, + { "trigger": "cubrid_field_type", "contents": "cubrid_field_type(${1:result}, ${2:field_offset})" }, + { "trigger": "cubrid_free_result", "contents": "cubrid_free_result(${1:req_identifier})" }, + { "trigger": "cubrid_get", "contents": "cubrid_get(${1:conn_identifier}, ${2:oid})" }, + { "trigger": "cubrid_get_charset", "contents": "cubrid_get_charset(${1:conn_identifier})" }, + { "trigger": "cubrid_get_class_name", "contents": "cubrid_get_class_name(${1:conn_identifier}, ${2:oid})" }, + { "trigger": "cubrid_get_client_info", "contents": "cubrid_get_client_info()" }, + { "trigger": "cubrid_get_db_parameter", "contents": "cubrid_get_db_parameter(${1:conn_identifier})" }, + { "trigger": "cubrid_get_server_info", "contents": "cubrid_get_server_info(${1:conn_identifier})" }, + { "trigger": "cubrid_insert_id", "contents": "cubrid_insert_id(${1:class_name})" }, + { "trigger": "cubrid_is_instance", "contents": "cubrid_is_instance(${1:conn_identifier}, ${2:oid})" }, + { "trigger": "cubrid_list_dbs", "contents": "cubrid_list_dbs(${1:conn_identifier})" }, + { "trigger": "cubrid_load_from_glo", "contents": "cubrid_load_from_glo(${1:conn_identifier}, ${2:oid}, ${3:file_name})" }, + { "trigger": "cubrid_lob_close", "contents": "cubrid_lob_close(${1:lob_identifier_array})" }, + { "trigger": "cubrid_lob_export", "contents": "cubrid_lob_export(${1:conn_identifier}, ${2:lob_identifier}, ${3:path_name})" }, + { "trigger": "cubrid_lob_get", "contents": "cubrid_lob_get(${1:conn_identifier}, ${2:SQL})" }, + { "trigger": "cubrid_lob_send", "contents": "cubrid_lob_send(${1:conn_identifier}, ${2:lob_identifier})" }, + { "trigger": "cubrid_lob_size", "contents": "cubrid_lob_size(${1:lob_identifier})" }, + { "trigger": "cubrid_lock_read", "contents": "cubrid_lock_read(${1:conn_identifier}, ${2:oid})" }, + { "trigger": "cubrid_lock_write", "contents": "cubrid_lock_write(${1:conn_identifier}, ${2:oid})" }, + { "trigger": "cubrid_move_cursor", "contents": "cubrid_move_cursor(${1:req_identifier}, ${2:offset})" }, + { "trigger": "cubrid_new_glo", "contents": "cubrid_new_glo(${1:conn_identifier}, ${2:class_name}, ${3:file_name})" }, + { "trigger": "cubrid_num_cols", "contents": "cubrid_num_cols(${1:req_identifier})" }, + { "trigger": "cubrid_num_fields", "contents": "cubrid_num_fields(${1:result})" }, + { "trigger": "cubrid_num_rows", "contents": "cubrid_num_rows(${1:req_identifier})" }, + { "trigger": "cubrid_ping", "contents": "cubrid_ping()" }, + { "trigger": "cubrid_prepare", "contents": "cubrid_prepare(${1:conn_identifier}, ${2:prepare_stmt})" }, + { "trigger": "cubrid_put", "contents": "cubrid_put(${1:conn_identifier}, ${2:oid})" }, + { "trigger": "cubrid_query", "contents": "cubrid_query(${1:query})" }, + { "trigger": "cubrid_real_escape_string", "contents": "cubrid_real_escape_string(${1:unescaped_string})" }, + { "trigger": "cubrid_result", "contents": "cubrid_result(${1:result}, ${2:row})" }, + { "trigger": "cubrid_rollback", "contents": "cubrid_rollback(${1:conn_identifier})" }, + { "trigger": "cubrid_save_to_glo", "contents": "cubrid_save_to_glo(${1:conn_identifier}, ${2:oid}, ${3:file_name})" }, + { "trigger": "cubrid_schema", "contents": "cubrid_schema(${1:conn_identifier}, ${2:schema_type})" }, + { "trigger": "cubrid_send_glo", "contents": "cubrid_send_glo(${1:conn_identifier}, ${2:oid})" }, + { "trigger": "cubrid_seq_drop", "contents": "cubrid_seq_drop(${1:conn_identifier}, ${2:oid}, ${3:attr_name}, ${4:index})" }, + { "trigger": "cubrid_seq_insert", "contents": "cubrid_seq_insert(${1:conn_identifier}, ${2:oid}, ${3:attr_name}, ${4:index}, ${5:seq_element})" }, + { "trigger": "cubrid_seq_put", "contents": "cubrid_seq_put(${1:conn_identifier}, ${2:oid}, ${3:attr_name}, ${4:index}, ${5:seq_element})" }, + { "trigger": "cubrid_set_add", "contents": "cubrid_set_add(${1:conn_identifier}, ${2:oid}, ${3:attr_name}, ${4:set_element})" }, + { "trigger": "cubrid_set_drop", "contents": "cubrid_set_drop(${1:conn_identifier}, ${2:oid}, ${3:attr_name}, ${4:set_element})" }, + { "trigger": "cubrid_unbuffered_query", "contents": "cubrid_unbuffered_query(${1:query})" }, + { "trigger": "cubrid_version", "contents": "cubrid_version()" }, + { "trigger": "curl_close", "contents": "curl_close(${1:ch})" }, + { "trigger": "curl_copy_handle", "contents": "curl_copy_handle(${1:ch})" }, + { "trigger": "curl_errno", "contents": "curl_errno(${1:ch})" }, + { "trigger": "curl_error", "contents": "curl_error(${1:ch})" }, + { "trigger": "curl_exec", "contents": "curl_exec(${1:ch})" }, + { "trigger": "curl_getinfo", "contents": "curl_getinfo(${1:ch})" }, + { "trigger": "curl_init", "contents": "curl_init()" }, + { "trigger": "curl_multi_add_handle", "contents": "curl_multi_add_handle(${1:mh}, ${2:ch})" }, + { "trigger": "curl_multi_close", "contents": "curl_multi_close(${1:mh})" }, + { "trigger": "curl_multi_exec", "contents": "curl_multi_exec(${1:mh}, ${2:still_running})" }, + { "trigger": "curl_multi_getcontent", "contents": "curl_multi_getcontent(${1:ch})" }, + { "trigger": "curl_multi_info_read", "contents": "curl_multi_info_read(${1:mh})" }, + { "trigger": "curl_multi_init", "contents": "curl_multi_init()" }, + { "trigger": "curl_multi_remove_handle", "contents": "curl_multi_remove_handle(${1:mh}, ${2:ch})" }, + { "trigger": "curl_multi_select", "contents": "curl_multi_select(${1:mh})" }, + { "trigger": "curl_setopt", "contents": "curl_setopt(${1:ch}, ${2:option}, ${3:value})" }, + { "trigger": "curl_setopt_array", "contents": "curl_setopt_array(${1:ch}, ${2:options})" }, + { "trigger": "curl_version", "contents": "curl_version()" }, + { "trigger": "current", "contents": "current(${1:array})" }, + { "trigger": "cyrus_authenticate", "contents": "cyrus_authenticate(${1:connection})" }, + { "trigger": "cyrus_bind", "contents": "cyrus_bind(${1:connection}, ${2:callbacks})" }, + { "trigger": "cyrus_close", "contents": "cyrus_close(${1:connection})" }, + { "trigger": "cyrus_connect", "contents": "cyrus_connect()" }, + { "trigger": "cyrus_query", "contents": "cyrus_query(${1:connection}, ${2:query})" }, + { "trigger": "cyrus_unbind", "contents": "cyrus_unbind(${1:connection}, ${2:trigger_name})" }, + { "trigger": "date", "contents": "date(${1:format})" }, + { "trigger": "date_add", "contents": "date_add()" }, + { "trigger": "date_create", "contents": "date_create()" }, + { "trigger": "date_create_from_format", "contents": "date_create_from_format()" }, + { "trigger": "date_date_set", "contents": "date_date_set()" }, + { "trigger": "date_default_timezone_get", "contents": "date_default_timezone_get()" }, + { "trigger": "date_default_timezone_set", "contents": "date_default_timezone_set(${1:timezone_identifier})" }, + { "trigger": "date_diff", "contents": "date_diff()" }, + { "trigger": "date_format", "contents": "date_format()" }, + { "trigger": "date_get_last_errors", "contents": "date_get_last_errors()" }, + { "trigger": "date_interval_create_from_date_string", "contents": "date_interval_create_from_date_string()" }, + { "trigger": "date_interval_format", "contents": "date_interval_format()" }, + { "trigger": "date_isodate_set", "contents": "date_isodate_set()" }, + { "trigger": "date_modify", "contents": "date_modify()" }, + { "trigger": "date_offset_get", "contents": "date_offset_get()" }, + { "trigger": "date_parse", "contents": "date_parse(${1:date})" }, + { "trigger": "date_parse_from_format", "contents": "date_parse_from_format(${1:format}, ${2:date})" }, + { "trigger": "date_sub", "contents": "date_sub()" }, + { "trigger": "date_sun_info", "contents": "date_sun_info(${1:time}, ${2:latitude}, ${3:longitude})" }, + { "trigger": "date_sunrise", "contents": "date_sunrise(${1:timestamp})" }, + { "trigger": "date_sunset", "contents": "date_sunset(${1:timestamp})" }, + { "trigger": "date_time_set", "contents": "date_time_set()" }, + { "trigger": "date_timestamp_get", "contents": "date_timestamp_get()" }, + { "trigger": "date_timestamp_set", "contents": "date_timestamp_set()" }, + { "trigger": "date_timezone_get", "contents": "date_timezone_get()" }, + { "trigger": "date_timezone_set", "contents": "date_timezone_set()" }, + { "trigger": "db2_autocommit", "contents": "db2_autocommit(${1:connection})" }, + { "trigger": "db2_bind_param", "contents": "db2_bind_param(${1:stmt}, ${2:parameter-number}, ${3:variable-name})" }, + { "trigger": "db2_client_info", "contents": "db2_client_info(${1:connection})" }, + { "trigger": "db2_close", "contents": "db2_close(${1:connection})" }, + { "trigger": "db2_column_privileges", "contents": "db2_column_privileges(${1:connection})" }, + { "trigger": "db2_columns", "contents": "db2_columns(${1:connection})" }, + { "trigger": "db2_commit", "contents": "db2_commit(${1:connection})" }, + { "trigger": "db2_conn_error", "contents": "db2_conn_error()" }, + { "trigger": "db2_conn_errormsg", "contents": "db2_conn_errormsg()" }, + { "trigger": "db2_connect", "contents": "db2_connect(${1:database}, ${2:username}, ${3:password})" }, + { "trigger": "db2_cursor_type", "contents": "db2_cursor_type(${1:stmt})" }, + { "trigger": "db2_escape_string", "contents": "db2_escape_string(${1:string_literal})" }, + { "trigger": "db2_exec", "contents": "db2_exec(${1:connection}, ${2:statement})" }, + { "trigger": "db2_execute", "contents": "db2_execute(${1:stmt})" }, + { "trigger": "db2_fetch_array", "contents": "db2_fetch_array(${1:stmt})" }, + { "trigger": "db2_fetch_assoc", "contents": "db2_fetch_assoc(${1:stmt})" }, + { "trigger": "db2_fetch_both", "contents": "db2_fetch_both(${1:stmt})" }, + { "trigger": "db2_fetch_object", "contents": "db2_fetch_object(${1:stmt})" }, + { "trigger": "db2_fetch_row", "contents": "db2_fetch_row(${1:stmt})" }, + { "trigger": "db2_field_display_size", "contents": "db2_field_display_size(${1:stmt}, ${2:column})" }, + { "trigger": "db2_field_name", "contents": "db2_field_name(${1:stmt}, ${2:column})" }, + { "trigger": "db2_field_num", "contents": "db2_field_num(${1:stmt}, ${2:column})" }, + { "trigger": "db2_field_precision", "contents": "db2_field_precision(${1:stmt}, ${2:column})" }, + { "trigger": "db2_field_scale", "contents": "db2_field_scale(${1:stmt}, ${2:column})" }, + { "trigger": "db2_field_type", "contents": "db2_field_type(${1:stmt}, ${2:column})" }, + { "trigger": "db2_field_width", "contents": "db2_field_width(${1:stmt}, ${2:column})" }, + { "trigger": "db2_foreign_keys", "contents": "db2_foreign_keys(${1:connection}, ${2:qualifier}, ${3:schema}, ${4:table-name})" }, + { "trigger": "db2_free_result", "contents": "db2_free_result(${1:stmt})" }, + { "trigger": "db2_free_stmt", "contents": "db2_free_stmt(${1:stmt})" }, + { "trigger": "db2_get_option", "contents": "db2_get_option(${1:resource}, ${2:option})" }, + { "trigger": "db2_last_insert_id", "contents": "db2_last_insert_id(${1:resource})" }, + { "trigger": "db2_lob_read", "contents": "db2_lob_read(${1:stmt}, ${2:colnum}, ${3:length})" }, + { "trigger": "db2_next_result", "contents": "db2_next_result(${1:stmt})" }, + { "trigger": "db2_num_fields", "contents": "db2_num_fields(${1:stmt})" }, + { "trigger": "db2_num_rows", "contents": "db2_num_rows(${1:stmt})" }, + { "trigger": "db2_pclose", "contents": "db2_pclose(${1:resource})" }, + { "trigger": "db2_pconnect", "contents": "db2_pconnect(${1:database}, ${2:username}, ${3:password})" }, + { "trigger": "db2_prepare", "contents": "db2_prepare(${1:connection}, ${2:statement})" }, + { "trigger": "db2_primary_keys", "contents": "db2_primary_keys(${1:connection}, ${2:qualifier}, ${3:schema}, ${4:table-name})" }, + { "trigger": "db2_procedure_columns", "contents": "db2_procedure_columns(${1:connection}, ${2:qualifier}, ${3:schema}, ${4:procedure}, ${5:parameter})" }, + { "trigger": "db2_procedures", "contents": "db2_procedures(${1:connection}, ${2:qualifier}, ${3:schema}, ${4:procedure})" }, + { "trigger": "db2_result", "contents": "db2_result(${1:stmt}, ${2:column})" }, + { "trigger": "db2_rollback", "contents": "db2_rollback(${1:connection})" }, + { "trigger": "db2_server_info", "contents": "db2_server_info(${1:connection})" }, + { "trigger": "db2_set_option", "contents": "db2_set_option(${1:resource}, ${2:options}, ${3:type})" }, + { "trigger": "db2_special_columns", "contents": "db2_special_columns(${1:connection}, ${2:qualifier}, ${3:schema}, ${4:table_name}, ${5:scope})" }, + { "trigger": "db2_statistics", "contents": "db2_statistics(${1:connection}, ${2:qualifier}, ${3:schema}, ${4:table-name}, ${5:unique})" }, + { "trigger": "db2_stmt_error", "contents": "db2_stmt_error()" }, + { "trigger": "db2_stmt_errormsg", "contents": "db2_stmt_errormsg()" }, + { "trigger": "db2_table_privileges", "contents": "db2_table_privileges(${1:connection})" }, + { "trigger": "db2_tables", "contents": "db2_tables(${1:connection})" }, + { "trigger": "dba_close", "contents": "dba_close(${1:handle})" }, + { "trigger": "dba_delete", "contents": "dba_delete(${1:key}, ${2:handle})" }, + { "trigger": "dba_exists", "contents": "dba_exists(${1:key}, ${2:handle})" }, + { "trigger": "dba_fetch", "contents": "dba_fetch(${1:key}, ${2:handle})" }, + { "trigger": "dba_firstkey", "contents": "dba_firstkey(${1:handle})" }, + { "trigger": "dba_handlers", "contents": "dba_handlers()" }, + { "trigger": "dba_insert", "contents": "dba_insert(${1:key}, ${2:value}, ${3:handle})" }, + { "trigger": "dba_key_split", "contents": "dba_key_split(${1:key})" }, + { "trigger": "dba_list", "contents": "dba_list()" }, + { "trigger": "dba_nextkey", "contents": "dba_nextkey(${1:handle})" }, + { "trigger": "dba_open", "contents": "dba_open(${1:path}, ${2:mode})" }, + { "trigger": "dba_optimize", "contents": "dba_optimize(${1:handle})" }, + { "trigger": "dba_popen", "contents": "dba_popen(${1:path}, ${2:mode})" }, + { "trigger": "dba_replace", "contents": "dba_replace(${1:key}, ${2:value}, ${3:handle})" }, + { "trigger": "dba_sync", "contents": "dba_sync(${1:handle})" }, + { "trigger": "dbase_add_record", "contents": "dbase_add_record(${1:dbase_identifier}, ${2:record})" }, + { "trigger": "dbase_close", "contents": "dbase_close(${1:dbase_identifier})" }, + { "trigger": "dbase_create", "contents": "dbase_create(${1:filename}, ${2:fields})" }, + { "trigger": "dbase_delete_record", "contents": "dbase_delete_record(${1:dbase_identifier}, ${2:record_number})" }, + { "trigger": "dbase_get_header_info", "contents": "dbase_get_header_info(${1:dbase_identifier})" }, + { "trigger": "dbase_get_record", "contents": "dbase_get_record(${1:dbase_identifier}, ${2:record_number})" }, + { "trigger": "dbase_get_record_with_names", "contents": "dbase_get_record_with_names(${1:dbase_identifier}, ${2:record_number})" }, + { "trigger": "dbase_numfields", "contents": "dbase_numfields(${1:dbase_identifier})" }, + { "trigger": "dbase_numrecords", "contents": "dbase_numrecords(${1:dbase_identifier})" }, + { "trigger": "dbase_open", "contents": "dbase_open(${1:filename}, ${2:mode})" }, + { "trigger": "dbase_pack", "contents": "dbase_pack(${1:dbase_identifier})" }, + { "trigger": "dbase_replace_record", "contents": "dbase_replace_record(${1:dbase_identifier}, ${2:record}, ${3:record_number})" }, + { "trigger": "dbplus_add", "contents": "dbplus_add(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_aql", "contents": "dbplus_aql(${1:query})" }, + { "trigger": "dbplus_chdir", "contents": "dbplus_chdir()" }, + { "trigger": "dbplus_close", "contents": "dbplus_close(${1:relation})" }, + { "trigger": "dbplus_curr", "contents": "dbplus_curr(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_errcode", "contents": "dbplus_errcode()" }, + { "trigger": "dbplus_errno", "contents": "dbplus_errno()" }, + { "trigger": "dbplus_find", "contents": "dbplus_find(${1:relation}, ${2:constraints}, ${3:tuple})" }, + { "trigger": "dbplus_first", "contents": "dbplus_first(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_flush", "contents": "dbplus_flush(${1:relation})" }, + { "trigger": "dbplus_freealllocks", "contents": "dbplus_freealllocks()" }, + { "trigger": "dbplus_freelock", "contents": "dbplus_freelock(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_freerlocks", "contents": "dbplus_freerlocks(${1:relation})" }, + { "trigger": "dbplus_getlock", "contents": "dbplus_getlock(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_getunique", "contents": "dbplus_getunique(${1:relation}, ${2:uniqueid})" }, + { "trigger": "dbplus_info", "contents": "dbplus_info(${1:relation}, ${2:key}, ${3:result})" }, + { "trigger": "dbplus_last", "contents": "dbplus_last(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_lockrel", "contents": "dbplus_lockrel(${1:relation})" }, + { "trigger": "dbplus_next", "contents": "dbplus_next(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_open", "contents": "dbplus_open(${1:name})" }, + { "trigger": "dbplus_prev", "contents": "dbplus_prev(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_rchperm", "contents": "dbplus_rchperm(${1:relation}, ${2:mask}, ${3:user}, ${4:group})" }, + { "trigger": "dbplus_rcreate", "contents": "dbplus_rcreate(${1:name}, ${2:domlist})" }, + { "trigger": "dbplus_rcrtexact", "contents": "dbplus_rcrtexact(${1:name}, ${2:relation})" }, + { "trigger": "dbplus_rcrtlike", "contents": "dbplus_rcrtlike(${1:name}, ${2:relation})" }, + { "trigger": "dbplus_resolve", "contents": "dbplus_resolve(${1:relation_name})" }, + { "trigger": "dbplus_restorepos", "contents": "dbplus_restorepos(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_rkeys", "contents": "dbplus_rkeys(${1:relation}, ${2:domlist})" }, + { "trigger": "dbplus_ropen", "contents": "dbplus_ropen(${1:name})" }, + { "trigger": "dbplus_rquery", "contents": "dbplus_rquery(${1:query})" }, + { "trigger": "dbplus_rrename", "contents": "dbplus_rrename(${1:relation}, ${2:name})" }, + { "trigger": "dbplus_rsecindex", "contents": "dbplus_rsecindex(${1:relation}, ${2:domlist}, ${3:type})" }, + { "trigger": "dbplus_runlink", "contents": "dbplus_runlink(${1:relation})" }, + { "trigger": "dbplus_rzap", "contents": "dbplus_rzap(${1:relation})" }, + { "trigger": "dbplus_savepos", "contents": "dbplus_savepos(${1:relation})" }, + { "trigger": "dbplus_setindex", "contents": "dbplus_setindex(${1:relation}, ${2:idx_name})" }, + { "trigger": "dbplus_setindexbynumber", "contents": "dbplus_setindexbynumber(${1:relation}, ${2:idx_number})" }, + { "trigger": "dbplus_sql", "contents": "dbplus_sql(${1:query})" }, + { "trigger": "dbplus_tcl", "contents": "dbplus_tcl(${1:sid}, ${2:script})" }, + { "trigger": "dbplus_tremove", "contents": "dbplus_tremove(${1:relation}, ${2:tuple})" }, + { "trigger": "dbplus_undo", "contents": "dbplus_undo(${1:relation})" }, + { "trigger": "dbplus_undoprepare", "contents": "dbplus_undoprepare(${1:relation})" }, + { "trigger": "dbplus_unlockrel", "contents": "dbplus_unlockrel(${1:relation})" }, + { "trigger": "dbplus_unselect", "contents": "dbplus_unselect(${1:relation})" }, + { "trigger": "dbplus_update", "contents": "dbplus_update(${1:relation}, ${2:old}, ${3:new})" }, + { "trigger": "dbplus_xlockrel", "contents": "dbplus_xlockrel(${1:relation})" }, + { "trigger": "dbplus_xunlockrel", "contents": "dbplus_xunlockrel(${1:relation})" }, + { "trigger": "dbx_close", "contents": "dbx_close(${1:link_identifier})" }, + { "trigger": "dbx_compare", "contents": "dbx_compare(${1:row_a}, ${2:row_b}, ${3:column_key})" }, + { "trigger": "dbx_connect", "contents": "dbx_connect(${1:module}, ${2:host}, ${3:database}, ${4:username}, ${5:password})" }, + { "trigger": "dbx_error", "contents": "dbx_error(${1:link_identifier})" }, + { "trigger": "dbx_escape_string", "contents": "dbx_escape_string(${1:link_identifier}, ${2:text})" }, + { "trigger": "dbx_fetch_row", "contents": "dbx_fetch_row(${1:result_identifier})" }, + { "trigger": "dbx_query", "contents": "dbx_query(${1:link_identifier}, ${2:sql_statement})" }, + { "trigger": "dbx_sort", "contents": "dbx_sort(${1:result}, ${2:user_compare_function})" }, + { "trigger": "dcgettext", "contents": "dcgettext(${1:domain}, ${2:message}, ${3:category})" }, + { "trigger": "dcngettext", "contents": "dcngettext(${1:domain}, ${2:msgid1}, ${3:msgid2}, ${4:n}, ${5:category})" }, + { "trigger": "deaggregate", "contents": "deaggregate(${1:object})" }, + { "trigger": "debug_backtrace", "contents": "debug_backtrace()" }, + { "trigger": "debug_print_backtrace", "contents": "debug_print_backtrace()" }, + { "trigger": "debug_zval_dump", "contents": "debug_zval_dump(${1:variable})" }, + { "trigger": "decbin", "contents": "decbin(${1:number})" }, + { "trigger": "dechex", "contents": "dechex(${1:number})" }, + { "trigger": "decoct", "contents": "decoct(${1:number})" }, + { "trigger": "define", "contents": "define(${1:name}, ${2:value})" }, + { "trigger": "define_syslog_variables", "contents": "define_syslog_variables()" }, + { "trigger": "defined", "contents": "defined(${1:name})" }, + { "trigger": "deg2rad", "contents": "deg2rad(${1:number})" }, + { "trigger": "delete", "contents": "delete()" }, + { "trigger": "dgettext", "contents": "dgettext(${1:domain}, ${2:message})" }, + { "trigger": "die", "contents": "die()" }, + { "trigger": "dio_close", "contents": "dio_close(${1:fd})" }, + { "trigger": "dio_fcntl", "contents": "dio_fcntl(${1:fd}, ${2:cmd})" }, + { "trigger": "dio_open", "contents": "dio_open(${1:filename}, ${2:flags})" }, + { "trigger": "dio_read", "contents": "dio_read(${1:fd})" }, + { "trigger": "dio_seek", "contents": "dio_seek(${1:fd}, ${2:pos})" }, + { "trigger": "dio_stat", "contents": "dio_stat(${1:fd})" }, + { "trigger": "dio_tcsetattr", "contents": "dio_tcsetattr(${1:fd}, ${2:options})" }, + { "trigger": "dio_truncate", "contents": "dio_truncate(${1:fd}, ${2:offset})" }, + { "trigger": "dio_write", "contents": "dio_write(${1:fd}, ${2:data})" }, + { "trigger": "dirname", "contents": "dirname(${1:path})" }, + { "trigger": "disk_free_space", "contents": "disk_free_space(${1:directory})" }, + { "trigger": "disk_total_space", "contents": "disk_total_space(${1:directory})" }, + { "trigger": "diskfreespace", "contents": "diskfreespace()" }, + { "trigger": "dl", "contents": "dl(${1:library})" }, + { "trigger": "dngettext", "contents": "dngettext(${1:domain}, ${2:msgid1}, ${3:msgid2}, ${4:n})" }, + { "trigger": "dns_check_record", "contents": "dns_check_record()" }, + { "trigger": "dns_get_mx", "contents": "dns_get_mx()" }, + { "trigger": "dns_get_record", "contents": "dns_get_record(${1:hostname})" }, + { "trigger": "dom_import_simplexml", "contents": "dom_import_simplexml(${1:node})" }, + { "trigger": "domxml_new_doc", "contents": "domxml_new_doc(${1:version})" }, + { "trigger": "domxml_open_file", "contents": "domxml_open_file(${1:filename})" }, + { "trigger": "domxml_open_mem", "contents": "domxml_open_mem(${1:str})" }, + { "trigger": "domxml_version", "contents": "domxml_version()" }, + { "trigger": "domxml_xmltree", "contents": "domxml_xmltree(${1:str})" }, + { "trigger": "domxml_xslt_stylesheet", "contents": "domxml_xslt_stylesheet(${1:xsl_buf})" }, + { "trigger": "domxml_xslt_stylesheet_doc", "contents": "domxml_xslt_stylesheet_doc(${1:xsl_doc})" }, + { "trigger": "domxml_xslt_stylesheet_file", "contents": "domxml_xslt_stylesheet_file(${1:xsl_file})" }, + { "trigger": "domxml_xslt_version", "contents": "domxml_xslt_version()" }, + { "trigger": "dotnet_load", "contents": "dotnet_load(${1:assembly_name})" }, + { "trigger": "doubleval", "contents": "doubleval()" }, + { "trigger": "each", "contents": "each(${1:array})" }, + { "trigger": "easter_date", "contents": "easter_date()" }, + { "trigger": "easter_days", "contents": "easter_days()" }, + { "trigger": "echo", "contents": "echo(${1:arg1})" }, + { "trigger": "empty", "contents": "empty(${1:var})" }, + { "trigger": "enchant_broker_describe", "contents": "enchant_broker_describe(${1:broker})" }, + { "trigger": "enchant_broker_dict_exists", "contents": "enchant_broker_dict_exists(${1:broker}, ${2:tag})" }, + { "trigger": "enchant_broker_free", "contents": "enchant_broker_free(${1:broker})" }, + { "trigger": "enchant_broker_free_dict", "contents": "enchant_broker_free_dict(${1:dict})" }, + { "trigger": "enchant_broker_get_error", "contents": "enchant_broker_get_error(${1:broker})" }, + { "trigger": "enchant_broker_init", "contents": "enchant_broker_init()" }, + { "trigger": "enchant_broker_list_dicts", "contents": "enchant_broker_list_dicts(${1:broker})" }, + { "trigger": "enchant_broker_request_dict", "contents": "enchant_broker_request_dict(${1:broker}, ${2:tag})" }, + { "trigger": "enchant_broker_request_pwl_dict", "contents": "enchant_broker_request_pwl_dict(${1:broker}, ${2:filename})" }, + { "trigger": "enchant_broker_set_ordering", "contents": "enchant_broker_set_ordering(${1:broker}, ${2:tag}, ${3:ordering})" }, + { "trigger": "enchant_dict_add_to_personal", "contents": "enchant_dict_add_to_personal(${1:dict}, ${2:word})" }, + { "trigger": "enchant_dict_add_to_session", "contents": "enchant_dict_add_to_session(${1:dict}, ${2:word})" }, + { "trigger": "enchant_dict_check", "contents": "enchant_dict_check(${1:dict}, ${2:word})" }, + { "trigger": "enchant_dict_describe", "contents": "enchant_dict_describe(${1:dict})" }, + { "trigger": "enchant_dict_get_error", "contents": "enchant_dict_get_error(${1:dict})" }, + { "trigger": "enchant_dict_is_in_session", "contents": "enchant_dict_is_in_session(${1:dict}, ${2:word})" }, + { "trigger": "enchant_dict_quick_check", "contents": "enchant_dict_quick_check(${1:dict}, ${2:word})" }, + { "trigger": "enchant_dict_store_replacement", "contents": "enchant_dict_store_replacement(${1:dict}, ${2:mis}, ${3:cor})" }, + { "trigger": "enchant_dict_suggest", "contents": "enchant_dict_suggest(${1:dict}, ${2:word})" }, + { "trigger": "end", "contents": "end(${1:array})" }, + { "trigger": "ereg", "contents": "ereg(${1:pattern}, ${2:string})" }, + { "trigger": "ereg_replace", "contents": "ereg_replace(${1:pattern}, ${2:replacement}, ${3:string})" }, + { "trigger": "eregi", "contents": "eregi(${1:pattern}, ${2:string})" }, + { "trigger": "eregi_replace", "contents": "eregi_replace(${1:pattern}, ${2:replacement}, ${3:string})" }, + { "trigger": "error_get_last", "contents": "error_get_last()" }, + { "trigger": "error_log", "contents": "error_log(${1:message})" }, + { "trigger": "error_reporting", "contents": "error_reporting()" }, + { "trigger": "escapeshellarg", "contents": "escapeshellarg(${1:arg})" }, + { "trigger": "escapeshellcmd", "contents": "escapeshellcmd(${1:command})" }, + { "trigger": "eval", "contents": "eval(${1:code_str})" }, + { "trigger": "event_add", "contents": "event_add(${1:event})" }, + { "trigger": "event_base_free", "contents": "event_base_free(${1:event_base})" }, + { "trigger": "event_base_loop", "contents": "event_base_loop(${1:event_base})" }, + { "trigger": "event_base_loopbreak", "contents": "event_base_loopbreak(${1:event_base})" }, + { "trigger": "event_base_loopexit", "contents": "event_base_loopexit(${1:event_base})" }, + { "trigger": "event_base_new", "contents": "event_base_new()" }, + { "trigger": "event_base_priority_init", "contents": "event_base_priority_init(${1:event_base}, ${2:npriorities})" }, + { "trigger": "event_base_set", "contents": "event_base_set(${1:event}, ${2:event_base})" }, + { "trigger": "event_buffer_base_set", "contents": "event_buffer_base_set(${1:bevent}, ${2:event_base})" }, + { "trigger": "event_buffer_disable", "contents": "event_buffer_disable(${1:bevent}, ${2:events})" }, + { "trigger": "event_buffer_enable", "contents": "event_buffer_enable(${1:bevent}, ${2:events})" }, + { "trigger": "event_buffer_fd_set", "contents": "event_buffer_fd_set(${1:bevent}, ${2:fd})" }, + { "trigger": "event_buffer_free", "contents": "event_buffer_free(${1:bevent})" }, + { "trigger": "event_buffer_new", "contents": "event_buffer_new(${1:stream}, ${2:readcb}, ${3:writecb}, ${4:errorcb})" }, + { "trigger": "event_buffer_priority_set", "contents": "event_buffer_priority_set(${1:bevent}, ${2:priority})" }, + { "trigger": "event_buffer_read", "contents": "event_buffer_read(${1:bevent}, ${2:data_size})" }, + { "trigger": "event_buffer_set_callback", "contents": "event_buffer_set_callback(${1:event}, ${2:readcb}, ${3:writecb}, ${4:errorcb})" }, + { "trigger": "event_buffer_timeout_set", "contents": "event_buffer_timeout_set(${1:bevent}, ${2:read_timeout}, ${3:write_timeout})" }, + { "trigger": "event_buffer_watermark_set", "contents": "event_buffer_watermark_set(${1:bevent}, ${2:events}, ${3:lowmark}, ${4:highmark})" }, + { "trigger": "event_buffer_write", "contents": "event_buffer_write(${1:bevent}, ${2:data})" }, + { "trigger": "event_del", "contents": "event_del(${1:event})" }, + { "trigger": "event_free", "contents": "event_free(${1:event})" }, + { "trigger": "event_new", "contents": "event_new()" }, + { "trigger": "event_set", "contents": "event_set(${1:event}, ${2:fd}, ${3:events}, ${4:callback})" }, + { "trigger": "exec", "contents": "exec(${1:command})" }, + { "trigger": "exif_imagetype", "contents": "exif_imagetype(${1:filename})" }, + { "trigger": "exif_read_data", "contents": "exif_read_data(${1:filename})" }, + { "trigger": "exif_tagname", "contents": "exif_tagname(${1:index})" }, + { "trigger": "exif_thumbnail", "contents": "exif_thumbnail(${1:filename})" }, + { "trigger": "exit", "contents": "exit()" }, + { "trigger": "exp", "contents": "exp(${1:arg})" }, + { "trigger": "expect_expectl", "contents": "expect_expectl(${1:expect}, ${2:cases})" }, + { "trigger": "expect_popen", "contents": "expect_popen(${1:command})" }, + { "trigger": "explode", "contents": "explode(${1:delimiter}, ${2:string})" }, + { "trigger": "expm1", "contents": "expm1(${1:arg})" }, + { "trigger": "extension_loaded", "contents": "extension_loaded(${1:name})" }, + { "trigger": "extract", "contents": "extract(${1:var_array})" }, + { "trigger": "ezmlm_hash", "contents": "ezmlm_hash(${1:addr})" }, + { "trigger": "fam_cancel_monitor", "contents": "fam_cancel_monitor(${1:fam}, ${2:fam_monitor})" }, + { "trigger": "fam_close", "contents": "fam_close(${1:fam})" }, + { "trigger": "fam_monitor_collection", "contents": "fam_monitor_collection(${1:fam}, ${2:dirname}, ${3:depth}, ${4:mask})" }, + { "trigger": "fam_monitor_directory", "contents": "fam_monitor_directory(${1:fam}, ${2:dirname})" }, + { "trigger": "fam_monitor_file", "contents": "fam_monitor_file(${1:fam}, ${2:filename})" }, + { "trigger": "fam_next_event", "contents": "fam_next_event(${1:fam})" }, + { "trigger": "fam_open", "contents": "fam_open()" }, + { "trigger": "fam_pending", "contents": "fam_pending(${1:fam})" }, + { "trigger": "fam_resume_monitor", "contents": "fam_resume_monitor(${1:fam}, ${2:fam_monitor})" }, + { "trigger": "fam_suspend_monitor", "contents": "fam_suspend_monitor(${1:fam}, ${2:fam_monitor})" }, + { "trigger": "fbsql_affected_rows", "contents": "fbsql_affected_rows()" }, + { "trigger": "fbsql_autocommit", "contents": "fbsql_autocommit(${1:link_identifier})" }, + { "trigger": "fbsql_blob_size", "contents": "fbsql_blob_size(${1:blob_handle})" }, + { "trigger": "fbsql_change_user", "contents": "fbsql_change_user(${1:user}, ${2:password})" }, + { "trigger": "fbsql_clob_size", "contents": "fbsql_clob_size(${1:clob_handle})" }, + { "trigger": "fbsql_close", "contents": "fbsql_close()" }, + { "trigger": "fbsql_commit", "contents": "fbsql_commit()" }, + { "trigger": "fbsql_connect", "contents": "fbsql_connect()" }, + { "trigger": "fbsql_create_blob", "contents": "fbsql_create_blob(${1:blob_data})" }, + { "trigger": "fbsql_create_clob", "contents": "fbsql_create_clob(${1:clob_data})" }, + { "trigger": "fbsql_create_db", "contents": "fbsql_create_db(${1:database_name})" }, + { "trigger": "fbsql_data_seek", "contents": "fbsql_data_seek(${1:result}, ${2:row_number})" }, + { "trigger": "fbsql_database", "contents": "fbsql_database(${1:link_identifier})" }, + { "trigger": "fbsql_database_password", "contents": "fbsql_database_password(${1:link_identifier})" }, + { "trigger": "fbsql_db_query", "contents": "fbsql_db_query(${1:database}, ${2:query})" }, + { "trigger": "fbsql_db_status", "contents": "fbsql_db_status(${1:database_name})" }, + { "trigger": "fbsql_drop_db", "contents": "fbsql_drop_db(${1:database_name})" }, + { "trigger": "fbsql_errno", "contents": "fbsql_errno()" }, + { "trigger": "fbsql_error", "contents": "fbsql_error()" }, + { "trigger": "fbsql_fetch_array", "contents": "fbsql_fetch_array(${1:result})" }, + { "trigger": "fbsql_fetch_assoc", "contents": "fbsql_fetch_assoc(${1:result})" }, + { "trigger": "fbsql_fetch_field", "contents": "fbsql_fetch_field(${1:result})" }, + { "trigger": "fbsql_fetch_lengths", "contents": "fbsql_fetch_lengths(${1:result})" }, + { "trigger": "fbsql_fetch_object", "contents": "fbsql_fetch_object(${1:result})" }, + { "trigger": "fbsql_fetch_row", "contents": "fbsql_fetch_row(${1:result})" }, + { "trigger": "fbsql_field_flags", "contents": "fbsql_field_flags(${1:result})" }, + { "trigger": "fbsql_field_len", "contents": "fbsql_field_len(${1:result})" }, + { "trigger": "fbsql_field_name", "contents": "fbsql_field_name(${1:result})" }, + { "trigger": "fbsql_field_seek", "contents": "fbsql_field_seek(${1:result})" }, + { "trigger": "fbsql_field_table", "contents": "fbsql_field_table(${1:result})" }, + { "trigger": "fbsql_field_type", "contents": "fbsql_field_type(${1:result})" }, + { "trigger": "fbsql_free_result", "contents": "fbsql_free_result(${1:result})" }, + { "trigger": "fbsql_get_autostart_info", "contents": "fbsql_get_autostart_info()" }, + { "trigger": "fbsql_hostname", "contents": "fbsql_hostname(${1:link_identifier})" }, + { "trigger": "fbsql_insert_id", "contents": "fbsql_insert_id()" }, + { "trigger": "fbsql_list_dbs", "contents": "fbsql_list_dbs()" }, + { "trigger": "fbsql_list_fields", "contents": "fbsql_list_fields(${1:database_name}, ${2:table_name})" }, + { "trigger": "fbsql_list_tables", "contents": "fbsql_list_tables(${1:database})" }, + { "trigger": "fbsql_next_result", "contents": "fbsql_next_result(${1:result})" }, + { "trigger": "fbsql_num_fields", "contents": "fbsql_num_fields(${1:result})" }, + { "trigger": "fbsql_num_rows", "contents": "fbsql_num_rows(${1:result})" }, + { "trigger": "fbsql_password", "contents": "fbsql_password(${1:link_identifier})" }, + { "trigger": "fbsql_pconnect", "contents": "fbsql_pconnect()" }, + { "trigger": "fbsql_query", "contents": "fbsql_query(${1:query})" }, + { "trigger": "fbsql_read_blob", "contents": "fbsql_read_blob(${1:blob_handle})" }, + { "trigger": "fbsql_read_clob", "contents": "fbsql_read_clob(${1:clob_handle})" }, + { "trigger": "fbsql_result", "contents": "fbsql_result(${1:result})" }, + { "trigger": "fbsql_rollback", "contents": "fbsql_rollback()" }, + { "trigger": "fbsql_rows_fetched", "contents": "fbsql_rows_fetched(${1:result})" }, + { "trigger": "fbsql_select_db", "contents": "fbsql_select_db()" }, + { "trigger": "fbsql_set_characterset", "contents": "fbsql_set_characterset(${1:link_identifier}, ${2:characterset})" }, + { "trigger": "fbsql_set_lob_mode", "contents": "fbsql_set_lob_mode(${1:result}, ${2:lob_mode})" }, + { "trigger": "fbsql_set_password", "contents": "fbsql_set_password(${1:link_identifier}, ${2:user}, ${3:password}, ${4:old_password})" }, + { "trigger": "fbsql_set_transaction", "contents": "fbsql_set_transaction(${1:link_identifier}, ${2:locking}, ${3:isolation})" }, + { "trigger": "fbsql_start_db", "contents": "fbsql_start_db(${1:database_name})" }, + { "trigger": "fbsql_stop_db", "contents": "fbsql_stop_db(${1:database_name})" }, + { "trigger": "fbsql_table_name", "contents": "fbsql_table_name(${1:result}, ${2:index})" }, + { "trigger": "fbsql_tablename", "contents": "fbsql_tablename()" }, + { "trigger": "fbsql_username", "contents": "fbsql_username(${1:link_identifier})" }, + { "trigger": "fbsql_warnings", "contents": "fbsql_warnings()" }, + { "trigger": "fclose", "contents": "fclose(${1:handle})" }, + { "trigger": "fdf_add_doc_javascript", "contents": "fdf_add_doc_javascript(${1:fdf_document}, ${2:script_name}, ${3:script_code})" }, + { "trigger": "fdf_add_template", "contents": "fdf_add_template(${1:fdf_document}, ${2:newpage}, ${3:filename}, ${4:template}, ${5:rename})" }, + { "trigger": "fdf_close", "contents": "fdf_close(${1:fdf_document})" }, + { "trigger": "fdf_create", "contents": "fdf_create()" }, + { "trigger": "fdf_enum_values", "contents": "fdf_enum_values(${1:fdf_document}, ${2:function})" }, + { "trigger": "fdf_errno", "contents": "fdf_errno()" }, + { "trigger": "fdf_error", "contents": "fdf_error()" }, + { "trigger": "fdf_get_ap", "contents": "fdf_get_ap(${1:fdf_document}, ${2:field}, ${3:face}, ${4:filename})" }, + { "trigger": "fdf_get_attachment", "contents": "fdf_get_attachment(${1:fdf_document}, ${2:fieldname}, ${3:savepath})" }, + { "trigger": "fdf_get_encoding", "contents": "fdf_get_encoding(${1:fdf_document})" }, + { "trigger": "fdf_get_file", "contents": "fdf_get_file(${1:fdf_document})" }, + { "trigger": "fdf_get_flags", "contents": "fdf_get_flags(${1:fdf_document}, ${2:fieldname}, ${3:whichflags})" }, + { "trigger": "fdf_get_opt", "contents": "fdf_get_opt(${1:fdf_document}, ${2:fieldname})" }, + { "trigger": "fdf_get_status", "contents": "fdf_get_status(${1:fdf_document})" }, + { "trigger": "fdf_get_value", "contents": "fdf_get_value(${1:fdf_document}, ${2:fieldname})" }, + { "trigger": "fdf_get_version", "contents": "fdf_get_version()" }, + { "trigger": "fdf_header", "contents": "fdf_header()" }, + { "trigger": "fdf_next_field_name", "contents": "fdf_next_field_name(${1:fdf_document})" }, + { "trigger": "fdf_open", "contents": "fdf_open(${1:filename})" }, + { "trigger": "fdf_open_string", "contents": "fdf_open_string(${1:fdf_data})" }, + { "trigger": "fdf_remove_item", "contents": "fdf_remove_item(${1:fdf_document}, ${2:fieldname}, ${3:item})" }, + { "trigger": "fdf_save", "contents": "fdf_save(${1:fdf_document})" }, + { "trigger": "fdf_save_string", "contents": "fdf_save_string(${1:fdf_document})" }, + { "trigger": "fdf_set_ap", "contents": "fdf_set_ap(${1:fdf_document}, ${2:field_name}, ${3:face}, ${4:filename}, ${5:page_number})" }, + { "trigger": "fdf_set_encoding", "contents": "fdf_set_encoding(${1:fdf_document}, ${2:encoding})" }, + { "trigger": "fdf_set_file", "contents": "fdf_set_file(${1:fdf_document}, ${2:url})" }, + { "trigger": "fdf_set_flags", "contents": "fdf_set_flags(${1:fdf_document}, ${2:fieldname}, ${3:whichFlags}, ${4:newFlags})" }, + { "trigger": "fdf_set_javascript_action", "contents": "fdf_set_javascript_action(${1:fdf_document}, ${2:fieldname}, ${3:trigger}, ${4:script})" }, + { "trigger": "fdf_set_on_import_javascript", "contents": "fdf_set_on_import_javascript(${1:fdf_document}, ${2:script}, ${3:before_data_import})" }, + { "trigger": "fdf_set_opt", "contents": "fdf_set_opt(${1:fdf_document}, ${2:fieldname}, ${3:element}, ${4:str1}, ${5:str2})" }, + { "trigger": "fdf_set_status", "contents": "fdf_set_status(${1:fdf_document}, ${2:status})" }, + { "trigger": "fdf_set_submit_form_action", "contents": "fdf_set_submit_form_action(${1:fdf_document}, ${2:fieldname}, ${3:trigger}, ${4:script}, ${5:flags})" }, + { "trigger": "fdf_set_target_frame", "contents": "fdf_set_target_frame(${1:fdf_document}, ${2:frame_name})" }, + { "trigger": "fdf_set_value", "contents": "fdf_set_value(${1:fdf_document}, ${2:fieldname}, ${3:value})" }, + { "trigger": "fdf_set_version", "contents": "fdf_set_version(${1:fdf_document}, ${2:version})" }, + { "trigger": "feof", "contents": "feof(${1:handle})" }, + { "trigger": "fflush", "contents": "fflush(${1:handle})" }, + { "trigger": "fgetc", "contents": "fgetc(${1:handle})" }, + { "trigger": "fgetcsv", "contents": "fgetcsv(${1:handle})" }, + { "trigger": "fgets", "contents": "fgets(${1:handle})" }, + { "trigger": "fgetss", "contents": "fgetss(${1:handle})" }, + { "trigger": "file", "contents": "file(${1:filename})" }, + { "trigger": "file_exists", "contents": "file_exists(${1:filename})" }, + { "trigger": "file_get_contents", "contents": "file_get_contents(${1:filename})" }, + { "trigger": "file_put_contents", "contents": "file_put_contents(${1:filename}, ${2:data})" }, + { "trigger": "fileatime", "contents": "fileatime(${1:filename})" }, + { "trigger": "filectime", "contents": "filectime(${1:filename})" }, + { "trigger": "filegroup", "contents": "filegroup(${1:filename})" }, + { "trigger": "fileinode", "contents": "fileinode(${1:filename})" }, + { "trigger": "filemtime", "contents": "filemtime(${1:filename})" }, + { "trigger": "fileowner", "contents": "fileowner(${1:filename})" }, + { "trigger": "fileperms", "contents": "fileperms(${1:filename})" }, + { "trigger": "filepro", "contents": "filepro(${1:directory})" }, + { "trigger": "filepro_fieldcount", "contents": "filepro_fieldcount()" }, + { "trigger": "filepro_fieldname", "contents": "filepro_fieldname(${1:field_number})" }, + { "trigger": "filepro_fieldtype", "contents": "filepro_fieldtype(${1:field_number})" }, + { "trigger": "filepro_fieldwidth", "contents": "filepro_fieldwidth(${1:field_number})" }, + { "trigger": "filepro_retrieve", "contents": "filepro_retrieve(${1:row_number}, ${2:field_number})" }, + { "trigger": "filepro_rowcount", "contents": "filepro_rowcount()" }, + { "trigger": "filesize", "contents": "filesize(${1:filename})" }, + { "trigger": "filetype", "contents": "filetype(${1:filename})" }, + { "trigger": "filter_has_var", "contents": "filter_has_var(${1:type}, ${2:variable_name})" }, + { "trigger": "filter_id", "contents": "filter_id(${1:filtername})" }, + { "trigger": "filter_input", "contents": "filter_input(${1:type}, ${2:variable_name})" }, + { "trigger": "filter_input_array", "contents": "filter_input_array(${1:type})" }, + { "trigger": "filter_list", "contents": "filter_list()" }, + { "trigger": "filter_var", "contents": "filter_var(${1:variable})" }, + { "trigger": "filter_var_array", "contents": "filter_var_array(${1:data})" }, + { "trigger": "finfo_buffer", "contents": "finfo_buffer(${1:finfo}, ${2:string = NULL})" }, + { "trigger": "finfo_close", "contents": "finfo_close(${1:finfo})" }, + { "trigger": "finfo_file", "contents": "finfo_file(${1:finfo}, ${2:file_name = NULL})" }, + { "trigger": "finfo_set_flags", "contents": "finfo_set_flags(${1:finfo}, ${2:options})" }, + { "trigger": "floatval", "contents": "floatval(${1:var})" }, + { "trigger": "flock", "contents": "flock(${1:handle}, ${2:operation})" }, + { "trigger": "floor", "contents": "floor(${1:value})" }, + { "trigger": "flush", "contents": "flush()" }, + { "trigger": "fmod", "contents": "fmod(${1:x}, ${2:y})" }, + { "trigger": "fnmatch", "contents": "fnmatch(${1:pattern}, ${2:string})" }, + { "trigger": "fopen", "contents": "fopen(${1:filename}, ${2:mode})" }, + { "trigger": "forward_static_call", "contents": "forward_static_call(${1:function})" }, + { "trigger": "forward_static_call_array", "contents": "forward_static_call_array(${1:function}, ${2:parameters})" }, + { "trigger": "fpassthru", "contents": "fpassthru(${1:handle})" }, + { "trigger": "fprintf", "contents": "fprintf(${1:handle}, ${2:format})" }, + { "trigger": "fputcsv", "contents": "fputcsv(${1:handle}, ${2:fields})" }, + { "trigger": "fputs", "contents": "fputs()" }, + { "trigger": "fread", "contents": "fread(${1:handle}, ${2:length})" }, + { "trigger": "FrenchToJD", "contents": "FrenchToJD(${1:month}, ${2:day}, ${3:year})" }, + { "trigger": "fribidi_log2vis", "contents": "fribidi_log2vis(${1:str}, ${2:direction}, ${3:charset})" }, + { "trigger": "fscanf", "contents": "fscanf(${1:handle}, ${2:format})" }, + { "trigger": "fseek", "contents": "fseek(${1:handle}, ${2:offset})" }, + { "trigger": "fsockopen", "contents": "fsockopen(${1:hostname})" }, + { "trigger": "fstat", "contents": "fstat(${1:handle})" }, + { "trigger": "ftell", "contents": "ftell(${1:handle})" }, + { "trigger": "ftok", "contents": "ftok(${1:pathname}, ${2:proj})" }, + { "trigger": "ftp_alloc", "contents": "ftp_alloc(${1:ftp_stream}, ${2:filesize})" }, + { "trigger": "ftp_cdup", "contents": "ftp_cdup(${1:ftp_stream})" }, + { "trigger": "ftp_chdir", "contents": "ftp_chdir(${1:ftp_stream}, ${2:directory})" }, + { "trigger": "ftp_chmod", "contents": "ftp_chmod(${1:ftp_stream}, ${2:mode}, ${3:filename})" }, + { "trigger": "ftp_close", "contents": "ftp_close(${1:ftp_stream})" }, + { "trigger": "ftp_connect", "contents": "ftp_connect(${1:host})" }, + { "trigger": "ftp_delete", "contents": "ftp_delete(${1:ftp_stream}, ${2:path})" }, + { "trigger": "ftp_exec", "contents": "ftp_exec(${1:ftp_stream}, ${2:command})" }, + { "trigger": "ftp_fget", "contents": "ftp_fget(${1:ftp_stream}, ${2:handle}, ${3:remote_file}, ${4:mode})" }, + { "trigger": "ftp_fput", "contents": "ftp_fput(${1:ftp_stream}, ${2:remote_file}, ${3:handle}, ${4:mode})" }, + { "trigger": "ftp_get", "contents": "ftp_get(${1:ftp_stream}, ${2:local_file}, ${3:remote_file}, ${4:mode})" }, + { "trigger": "ftp_get_option", "contents": "ftp_get_option(${1:ftp_stream}, ${2:option})" }, + { "trigger": "ftp_login", "contents": "ftp_login(${1:ftp_stream}, ${2:username}, ${3:password})" }, + { "trigger": "ftp_mdtm", "contents": "ftp_mdtm(${1:ftp_stream}, ${2:remote_file})" }, + { "trigger": "ftp_mkdir", "contents": "ftp_mkdir(${1:ftp_stream}, ${2:directory})" }, + { "trigger": "ftp_nb_continue", "contents": "ftp_nb_continue(${1:ftp_stream})" }, + { "trigger": "ftp_nb_fget", "contents": "ftp_nb_fget(${1:ftp_stream}, ${2:handle}, ${3:remote_file}, ${4:mode})" }, + { "trigger": "ftp_nb_fput", "contents": "ftp_nb_fput(${1:ftp_stream}, ${2:remote_file}, ${3:handle}, ${4:mode})" }, + { "trigger": "ftp_nb_get", "contents": "ftp_nb_get(${1:ftp_stream}, ${2:local_file}, ${3:remote_file}, ${4:mode})" }, + { "trigger": "ftp_nb_put", "contents": "ftp_nb_put(${1:ftp_stream}, ${2:remote_file}, ${3:local_file}, ${4:mode})" }, + { "trigger": "ftp_nlist", "contents": "ftp_nlist(${1:ftp_stream}, ${2:directory})" }, + { "trigger": "ftp_pasv", "contents": "ftp_pasv(${1:ftp_stream}, ${2:pasv})" }, + { "trigger": "ftp_put", "contents": "ftp_put(${1:ftp_stream}, ${2:remote_file}, ${3:local_file}, ${4:mode})" }, + { "trigger": "ftp_pwd", "contents": "ftp_pwd(${1:ftp_stream})" }, + { "trigger": "ftp_quit", "contents": "ftp_quit()" }, + { "trigger": "ftp_raw", "contents": "ftp_raw(${1:ftp_stream}, ${2:command})" }, + { "trigger": "ftp_rawlist", "contents": "ftp_rawlist(${1:ftp_stream}, ${2:directory})" }, + { "trigger": "ftp_rename", "contents": "ftp_rename(${1:ftp_stream}, ${2:oldname}, ${3:newname})" }, + { "trigger": "ftp_rmdir", "contents": "ftp_rmdir(${1:ftp_stream}, ${2:directory})" }, + { "trigger": "ftp_set_option", "contents": "ftp_set_option(${1:ftp_stream}, ${2:option}, ${3:value})" }, + { "trigger": "ftp_site", "contents": "ftp_site(${1:ftp_stream}, ${2:command})" }, + { "trigger": "ftp_size", "contents": "ftp_size(${1:ftp_stream}, ${2:remote_file})" }, + { "trigger": "ftp_ssl_connect", "contents": "ftp_ssl_connect(${1:host})" }, + { "trigger": "ftp_systype", "contents": "ftp_systype(${1:ftp_stream})" }, + { "trigger": "ftruncate", "contents": "ftruncate(${1:handle}, ${2:size})" }, + { "trigger": "func_get_arg", "contents": "func_get_arg(${1:arg_num})" }, + { "trigger": "func_get_args", "contents": "func_get_args()" }, + { "trigger": "func_num_args", "contents": "func_num_args()" }, + { "trigger": "function_exists", "contents": "function_exists(${1:function_name})" }, + { "trigger": "fwrite", "contents": "fwrite(${1:handle}, ${2:string})" }, + { "trigger": "gc_collect_cycles", "contents": "gc_collect_cycles()" }, + { "trigger": "gc_disable", "contents": "gc_disable()" }, + { "trigger": "gc_enable", "contents": "gc_enable()" }, + { "trigger": "gc_enabled", "contents": "gc_enabled()" }, + { "trigger": "gd_info", "contents": "gd_info()" }, + { "trigger": "geoip_continent_code_by_name", "contents": "geoip_continent_code_by_name(${1:hostname})" }, + { "trigger": "geoip_country_code3_by_name", "contents": "geoip_country_code3_by_name(${1:hostname})" }, + { "trigger": "geoip_country_code_by_name", "contents": "geoip_country_code_by_name(${1:hostname})" }, + { "trigger": "geoip_country_name_by_name", "contents": "geoip_country_name_by_name(${1:hostname})" }, + { "trigger": "geoip_database_info", "contents": "geoip_database_info()" }, + { "trigger": "geoip_db_avail", "contents": "geoip_db_avail(${1:database})" }, + { "trigger": "geoip_db_filename", "contents": "geoip_db_filename(${1:database})" }, + { "trigger": "geoip_db_get_all_info", "contents": "geoip_db_get_all_info()" }, + { "trigger": "geoip_id_by_name", "contents": "geoip_id_by_name(${1:hostname})" }, + { "trigger": "geoip_isp_by_name", "contents": "geoip_isp_by_name(${1:hostname})" }, + { "trigger": "geoip_org_by_name", "contents": "geoip_org_by_name(${1:hostname})" }, + { "trigger": "geoip_record_by_name", "contents": "geoip_record_by_name(${1:hostname})" }, + { "trigger": "geoip_region_by_name", "contents": "geoip_region_by_name(${1:hostname})" }, + { "trigger": "geoip_region_name_by_code", "contents": "geoip_region_name_by_code(${1:country_code}, ${2:region_code})" }, + { "trigger": "geoip_time_zone_by_country_and_region", "contents": "geoip_time_zone_by_country_and_region(${1:country_code})" }, + { "trigger": "get_browser", "contents": "get_browser()" }, + { "trigger": "get_called_class", "contents": "get_called_class()" }, + { "trigger": "get_cfg_var", "contents": "get_cfg_var(${1:option})" }, + { "trigger": "get_class", "contents": "get_class()" }, + { "trigger": "get_class_methods", "contents": "get_class_methods(${1:class_name})" }, + { "trigger": "get_class_vars", "contents": "get_class_vars(${1:class_name})" }, + { "trigger": "get_current_user", "contents": "get_current_user()" }, + { "trigger": "get_declared_classes", "contents": "get_declared_classes()" }, + { "trigger": "get_declared_interfaces", "contents": "get_declared_interfaces()" }, + { "trigger": "get_defined_constants", "contents": "get_defined_constants()" }, + { "trigger": "get_defined_functions", "contents": "get_defined_functions()" }, + { "trigger": "get_defined_vars", "contents": "get_defined_vars()" }, + { "trigger": "get_extension_funcs", "contents": "get_extension_funcs(${1:module_name})" }, + { "trigger": "get_headers", "contents": "get_headers(${1:url})" }, + { "trigger": "get_html_translation_table", "contents": "get_html_translation_table()" }, + { "trigger": "get_include_path", "contents": "get_include_path()" }, + { "trigger": "get_included_files", "contents": "get_included_files()" }, + { "trigger": "get_loaded_extensions", "contents": "get_loaded_extensions()" }, + { "trigger": "get_magic_quotes_gpc", "contents": "get_magic_quotes_gpc()" }, + { "trigger": "get_magic_quotes_runtime", "contents": "get_magic_quotes_runtime()" }, + { "trigger": "get_meta_tags", "contents": "get_meta_tags(${1:filename})" }, + { "trigger": "get_object_vars", "contents": "get_object_vars(${1:object})" }, + { "trigger": "get_parent_class", "contents": "get_parent_class()" }, + { "trigger": "get_required_files", "contents": "get_required_files()" }, + { "trigger": "get_resource_type", "contents": "get_resource_type(${1:handle})" }, + { "trigger": "getallheaders", "contents": "getallheaders()" }, + { "trigger": "getcwd", "contents": "getcwd()" }, + { "trigger": "getdate", "contents": "getdate()" }, + { "trigger": "getenv", "contents": "getenv(${1:varname})" }, + { "trigger": "gethostbyaddr", "contents": "gethostbyaddr(${1:ip_address})" }, + { "trigger": "gethostbyname", "contents": "gethostbyname(${1:hostname})" }, + { "trigger": "gethostbynamel", "contents": "gethostbynamel(${1:hostname})" }, + { "trigger": "gethostname", "contents": "gethostname()" }, + { "trigger": "getimagesize", "contents": "getimagesize(${1:filename})" }, + { "trigger": "getlastmod", "contents": "getlastmod()" }, + { "trigger": "getmxrr", "contents": "getmxrr(${1:hostname}, ${2:mxhosts})" }, + { "trigger": "getmygid", "contents": "getmygid()" }, + { "trigger": "getmyinode", "contents": "getmyinode()" }, + { "trigger": "getmypid", "contents": "getmypid()" }, + { "trigger": "getmyuid", "contents": "getmyuid()" }, + { "trigger": "getopt", "contents": "getopt(${1:options})" }, + { "trigger": "getprotobyname", "contents": "getprotobyname(${1:name})" }, + { "trigger": "getprotobynumber", "contents": "getprotobynumber(${1:number})" }, + { "trigger": "getrandmax", "contents": "getrandmax()" }, + { "trigger": "getrusage", "contents": "getrusage()" }, + { "trigger": "getservbyname", "contents": "getservbyname(${1:service}, ${2:protocol})" }, + { "trigger": "getservbyport", "contents": "getservbyport(${1:port}, ${2:protocol})" }, + { "trigger": "gettext", "contents": "gettext(${1:message})" }, + { "trigger": "gettimeofday", "contents": "gettimeofday()" }, + { "trigger": "gettype", "contents": "gettype(${1:var})" }, + { "trigger": "glob", "contents": "glob(${1:pattern})" }, + { "trigger": "gmdate", "contents": "gmdate(${1:format})" }, + { "trigger": "gmmktime", "contents": "gmmktime()" }, + { "trigger": "gmp_abs", "contents": "gmp_abs(${1:a})" }, + { "trigger": "gmp_add", "contents": "gmp_add(${1:a}, ${2:b})" }, + { "trigger": "gmp_and", "contents": "gmp_and(${1:a}, ${2:b})" }, + { "trigger": "gmp_clrbit", "contents": "gmp_clrbit(${1:a}, ${2:index})" }, + { "trigger": "gmp_cmp", "contents": "gmp_cmp(${1:a}, ${2:b})" }, + { "trigger": "gmp_com", "contents": "gmp_com(${1:a})" }, + { "trigger": "gmp_div", "contents": "gmp_div()" }, + { "trigger": "gmp_div_q", "contents": "gmp_div_q(${1:a}, ${2:b})" }, + { "trigger": "gmp_div_qr", "contents": "gmp_div_qr(${1:n}, ${2:d})" }, + { "trigger": "gmp_div_r", "contents": "gmp_div_r(${1:n}, ${2:d})" }, + { "trigger": "gmp_divexact", "contents": "gmp_divexact(${1:n}, ${2:d})" }, + { "trigger": "gmp_fact", "contents": "gmp_fact(${1:a})" }, + { "trigger": "gmp_gcd", "contents": "gmp_gcd(${1:a}, ${2:b})" }, + { "trigger": "gmp_gcdext", "contents": "gmp_gcdext(${1:a}, ${2:b})" }, + { "trigger": "gmp_hamdist", "contents": "gmp_hamdist(${1:a}, ${2:b})" }, + { "trigger": "gmp_init", "contents": "gmp_init(${1:number})" }, + { "trigger": "gmp_intval", "contents": "gmp_intval(${1:gmpnumber})" }, + { "trigger": "gmp_invert", "contents": "gmp_invert(${1:a}, ${2:b})" }, + { "trigger": "gmp_jacobi", "contents": "gmp_jacobi(${1:a}, ${2:p})" }, + { "trigger": "gmp_legendre", "contents": "gmp_legendre(${1:a}, ${2:p})" }, + { "trigger": "gmp_mod", "contents": "gmp_mod(${1:n}, ${2:d})" }, + { "trigger": "gmp_mul", "contents": "gmp_mul(${1:a}, ${2:b})" }, + { "trigger": "gmp_neg", "contents": "gmp_neg(${1:a})" }, + { "trigger": "gmp_nextprime", "contents": "gmp_nextprime(${1:a})" }, + { "trigger": "gmp_or", "contents": "gmp_or(${1:a}, ${2:b})" }, + { "trigger": "gmp_perfect_square", "contents": "gmp_perfect_square(${1:a})" }, + { "trigger": "gmp_popcount", "contents": "gmp_popcount(${1:a})" }, + { "trigger": "gmp_pow", "contents": "gmp_pow(${1:base}, ${2:exp})" }, + { "trigger": "gmp_powm", "contents": "gmp_powm(${1:base}, ${2:exp}, ${3:mod})" }, + { "trigger": "gmp_prob_prime", "contents": "gmp_prob_prime(${1:a})" }, + { "trigger": "gmp_random", "contents": "gmp_random()" }, + { "trigger": "gmp_scan0", "contents": "gmp_scan0(${1:a}, ${2:start})" }, + { "trigger": "gmp_scan1", "contents": "gmp_scan1(${1:a}, ${2:start})" }, + { "trigger": "gmp_setbit", "contents": "gmp_setbit(${1:a}, ${2:index})" }, + { "trigger": "gmp_sign", "contents": "gmp_sign(${1:a})" }, + { "trigger": "gmp_sqrt", "contents": "gmp_sqrt(${1:a})" }, + { "trigger": "gmp_sqrtrem", "contents": "gmp_sqrtrem(${1:a})" }, + { "trigger": "gmp_strval", "contents": "gmp_strval(${1:gmpnumber})" }, + { "trigger": "gmp_sub", "contents": "gmp_sub(${1:a}, ${2:b})" }, + { "trigger": "gmp_testbit", "contents": "gmp_testbit(${1:a}, ${2:index})" }, + { "trigger": "gmp_xor", "contents": "gmp_xor(${1:a}, ${2:b})" }, + { "trigger": "gmstrftime", "contents": "gmstrftime(${1:format})" }, + { "trigger": "gnupg_adddecryptkey", "contents": "gnupg_adddecryptkey(${1:identifier}, ${2:fingerprint}, ${3:passphrase})" }, + { "trigger": "gnupg_addencryptkey", "contents": "gnupg_addencryptkey(${1:identifier}, ${2:fingerprint})" }, + { "trigger": "gnupg_addsignkey", "contents": "gnupg_addsignkey(${1:identifier}, ${2:fingerprint})" }, + { "trigger": "gnupg_cleardecryptkeys", "contents": "gnupg_cleardecryptkeys(${1:identifier})" }, + { "trigger": "gnupg_clearencryptkeys", "contents": "gnupg_clearencryptkeys(${1:identifier})" }, + { "trigger": "gnupg_clearsignkeys", "contents": "gnupg_clearsignkeys(${1:identifier})" }, + { "trigger": "gnupg_decrypt", "contents": "gnupg_decrypt(${1:identifier}, ${2:text})" }, + { "trigger": "gnupg_decryptverify", "contents": "gnupg_decryptverify(${1:identifier}, ${2:text}, ${3:plaintext})" }, + { "trigger": "gnupg_encrypt", "contents": "gnupg_encrypt(${1:identifier}, ${2:plaintext})" }, + { "trigger": "gnupg_encryptsign", "contents": "gnupg_encryptsign(${1:identifier}, ${2:plaintext})" }, + { "trigger": "gnupg_export", "contents": "gnupg_export(${1:identifier}, ${2:fingerprint})" }, + { "trigger": "gnupg_geterror", "contents": "gnupg_geterror(${1:identifier})" }, + { "trigger": "gnupg_getprotocol", "contents": "gnupg_getprotocol(${1:identifier})" }, + { "trigger": "gnupg_import", "contents": "gnupg_import(${1:identifier}, ${2:keydata})" }, + { "trigger": "gnupg_init", "contents": "gnupg_init()" }, + { "trigger": "gnupg_keyinfo", "contents": "gnupg_keyinfo(${1:identifier}, ${2:pattern})" }, + { "trigger": "gnupg_setarmor", "contents": "gnupg_setarmor(${1:identifier}, ${2:armor})" }, + { "trigger": "gnupg_seterrormode", "contents": "gnupg_seterrormode(${1:identifier}, ${2:errormode})" }, + { "trigger": "gnupg_setsignmode", "contents": "gnupg_setsignmode(${1:identifier}, ${2:signmode})" }, + { "trigger": "gnupg_sign", "contents": "gnupg_sign(${1:identifier}, ${2:plaintext})" }, + { "trigger": "gnupg_verify", "contents": "gnupg_verify(${1:identifier}, ${2:signed_text}, ${3:signature})" }, + { "trigger": "gopher_parsedir", "contents": "gopher_parsedir(${1:dirent})" }, + { "trigger": "grapheme_extract", "contents": "grapheme_extract(${1:haystack}, ${2:size})" }, + { "trigger": "grapheme_stripos", "contents": "grapheme_stripos(${1:haystack}, ${2:needle})" }, + { "trigger": "grapheme_stristr", "contents": "grapheme_stristr(${1:haystack}, ${2:needle})" }, + { "trigger": "grapheme_strlen", "contents": "grapheme_strlen(${1:input})" }, + { "trigger": "grapheme_strpos", "contents": "grapheme_strpos(${1:haystack}, ${2:needle})" }, + { "trigger": "grapheme_strripos", "contents": "grapheme_strripos(${1:haystack}, ${2:needle})" }, + { "trigger": "grapheme_strrpos", "contents": "grapheme_strrpos(${1:haystack}, ${2:needle})" }, + { "trigger": "grapheme_strstr", "contents": "grapheme_strstr(${1:haystack}, ${2:needle})" }, + { "trigger": "grapheme_substr", "contents": "grapheme_substr(${1:string}, ${2:start})" }, + { "trigger": "GregorianToJD", "contents": "GregorianToJD(${1:month}, ${2:day}, ${3:year})" }, + { "trigger": "gupnp_context_get_host_ip", "contents": "gupnp_context_get_host_ip(${1:context})" }, + { "trigger": "gupnp_context_get_port", "contents": "gupnp_context_get_port(${1:context})" }, + { "trigger": "gupnp_context_get_subscription_timeout", "contents": "gupnp_context_get_subscription_timeout(${1:context})" }, + { "trigger": "gupnp_context_host_path", "contents": "gupnp_context_host_path(${1:context}, ${2:local_path}, ${3:server_path})" }, + { "trigger": "gupnp_context_new", "contents": "gupnp_context_new()" }, + { "trigger": "gupnp_context_set_subscription_timeout", "contents": "gupnp_context_set_subscription_timeout(${1:context}, ${2:timeout})" }, + { "trigger": "gupnp_context_timeout_add", "contents": "gupnp_context_timeout_add(${1:context}, ${2:timeout}, ${3:callback})" }, + { "trigger": "gupnp_context_unhost_path", "contents": "gupnp_context_unhost_path(${1:context}, ${2:server_path})" }, + { "trigger": "gupnp_control_point_browse_start", "contents": "gupnp_control_point_browse_start(${1:cpoint})" }, + { "trigger": "gupnp_control_point_browse_stop", "contents": "gupnp_control_point_browse_stop(${1:cpoint})" }, + { "trigger": "gupnp_control_point_callback_set", "contents": "gupnp_control_point_callback_set(${1:cpoint}, ${2:signal}, ${3:callback})" }, + { "trigger": "gupnp_control_point_new", "contents": "gupnp_control_point_new(${1:context}, ${2:target})" }, + { "trigger": "gupnp_device_action_callback_set", "contents": "gupnp_device_action_callback_set(${1:root_device}, ${2:signal}, ${3:action_name}, ${4:callback})" }, + { "trigger": "gupnp_device_info_get", "contents": "gupnp_device_info_get(${1:root_device})" }, + { "trigger": "gupnp_device_info_get_service", "contents": "gupnp_device_info_get_service(${1:root_device}, ${2:type})" }, + { "trigger": "gupnp_root_device_get_available", "contents": "gupnp_root_device_get_available(${1:root_device})" }, + { "trigger": "gupnp_root_device_get_relative_location", "contents": "gupnp_root_device_get_relative_location(${1:root_device})" }, + { "trigger": "gupnp_root_device_new", "contents": "gupnp_root_device_new(${1:context}, ${2:location}, ${3:description_dir})" }, + { "trigger": "gupnp_root_device_set_available", "contents": "gupnp_root_device_set_available(${1:root_device}, ${2:available})" }, + { "trigger": "gupnp_root_device_start", "contents": "gupnp_root_device_start(${1:root_device})" }, + { "trigger": "gupnp_root_device_stop", "contents": "gupnp_root_device_stop(${1:root_device})" }, + { "trigger": "gupnp_service_action_get", "contents": "gupnp_service_action_get(${1:action}, ${2:name}, ${3:type})" }, + { "trigger": "gupnp_service_action_return", "contents": "gupnp_service_action_return(${1:action})" }, + { "trigger": "gupnp_service_action_return_error", "contents": "gupnp_service_action_return_error(${1:action}, ${2:error_code})" }, + { "trigger": "gupnp_service_action_set", "contents": "gupnp_service_action_set(${1:action}, ${2:name}, ${3:type}, ${4:value})" }, + { "trigger": "gupnp_service_freeze_notify", "contents": "gupnp_service_freeze_notify(${1:service})" }, + { "trigger": "gupnp_service_info_get", "contents": "gupnp_service_info_get(${1:proxy})" }, + { "trigger": "gupnp_service_info_get_introspection", "contents": "gupnp_service_info_get_introspection(${1:proxy})" }, + { "trigger": "gupnp_service_introspection_get_state_variable", "contents": "gupnp_service_introspection_get_state_variable(${1:introspection}, ${2:variable_name})" }, + { "trigger": "gupnp_service_notify", "contents": "gupnp_service_notify(${1:service}, ${2:name}, ${3:type}, ${4:value})" }, + { "trigger": "gupnp_service_proxy_action_get", "contents": "gupnp_service_proxy_action_get(${1:proxy}, ${2:action}, ${3:name}, ${4:type})" }, + { "trigger": "gupnp_service_proxy_action_set", "contents": "gupnp_service_proxy_action_set(${1:proxy}, ${2:action}, ${3:name}, ${4:value}, ${5:type})" }, + { "trigger": "gupnp_service_proxy_add_notify", "contents": "gupnp_service_proxy_add_notify(${1:proxy}, ${2:value}, ${3:type}, ${4:callback})" }, + { "trigger": "gupnp_service_proxy_callback_set", "contents": "gupnp_service_proxy_callback_set(${1:proxy}, ${2:signal}, ${3:callback})" }, + { "trigger": "gupnp_service_proxy_get_subscribed", "contents": "gupnp_service_proxy_get_subscribed(${1:proxy})" }, + { "trigger": "gupnp_service_proxy_remove_notify", "contents": "gupnp_service_proxy_remove_notify(${1:proxy}, ${2:value})" }, + { "trigger": "gupnp_service_proxy_set_subscribed", "contents": "gupnp_service_proxy_set_subscribed(${1:proxy}, ${2:subscribed})" }, + { "trigger": "gupnp_service_thaw_notify", "contents": "gupnp_service_thaw_notify(${1:service})" }, + { "trigger": "gzclose", "contents": "gzclose(${1:zp})" }, + { "trigger": "gzcompress", "contents": "gzcompress(${1:data})" }, + { "trigger": "gzdecode", "contents": "gzdecode(${1:data}, ${2:length})" }, + { "trigger": "gzdeflate", "contents": "gzdeflate(${1:data})" }, + { "trigger": "gzencode", "contents": "gzencode(${1:data})" }, + { "trigger": "gzeof", "contents": "gzeof(${1:zp})" }, + { "trigger": "gzfile", "contents": "gzfile(${1:filename})" }, + { "trigger": "gzgetc", "contents": "gzgetc(${1:zp})" }, + { "trigger": "gzgets", "contents": "gzgets(${1:zp}, ${2:length})" }, + { "trigger": "gzgetss", "contents": "gzgetss(${1:zp}, ${2:length})" }, + { "trigger": "gzinflate", "contents": "gzinflate(${1:data})" }, + { "trigger": "gzopen", "contents": "gzopen(${1:filename}, ${2:mode})" }, + { "trigger": "gzpassthru", "contents": "gzpassthru(${1:zp})" }, + { "trigger": "gzputs", "contents": "gzputs()" }, + { "trigger": "gzread", "contents": "gzread(${1:zp}, ${2:length})" }, + { "trigger": "gzrewind", "contents": "gzrewind(${1:zp})" }, + { "trigger": "gzseek", "contents": "gzseek(${1:zp}, ${2:offset})" }, + { "trigger": "gztell", "contents": "gztell(${1:zp})" }, + { "trigger": "gzuncompress", "contents": "gzuncompress(${1:data})" }, + { "trigger": "gzwrite", "contents": "gzwrite(${1:zp}, ${2:string})" }, + { "trigger": "__halt_compiler", "contents": "__halt_compiler()" }, + { "trigger": "hash", "contents": "hash(${1:algo}, ${2:data})" }, + { "trigger": "hash_algos", "contents": "hash_algos()" }, + { "trigger": "hash_copy", "contents": "hash_copy(${1:context})" }, + { "trigger": "hash_file", "contents": "hash_file(${1:algo}, ${2:filename})" }, + { "trigger": "hash_final", "contents": "hash_final(${1:context})" }, + { "trigger": "hash_hmac", "contents": "hash_hmac(${1:algo}, ${2:data}, ${3:key})" }, + { "trigger": "hash_hmac_file", "contents": "hash_hmac_file(${1:algo}, ${2:filename}, ${3:key})" }, + { "trigger": "hash_init", "contents": "hash_init(${1:algo})" }, + { "trigger": "hash_update", "contents": "hash_update(${1:context}, ${2:data})" }, + { "trigger": "hash_update_file", "contents": "hash_update_file(${1:context}, ${2:filename})" }, + { "trigger": "hash_update_stream", "contents": "hash_update_stream(${1:context}, ${2:handle})" }, + { "trigger": "header", "contents": "header(${1:string})" }, + { "trigger": "header_remove", "contents": "header_remove()" }, + { "trigger": "headers_list", "contents": "headers_list()" }, + { "trigger": "headers_sent", "contents": "headers_sent()" }, + { "trigger": "hebrev", "contents": "hebrev(${1:hebrew_text})" }, + { "trigger": "hebrevc", "contents": "hebrevc(${1:hebrew_text})" }, + { "trigger": "hexdec", "contents": "hexdec(${1:hex_string})" }, + { "trigger": "highlight_file", "contents": "highlight_file(${1:filename})" }, + { "trigger": "highlight_string", "contents": "highlight_string(${1:str})" }, + { "trigger": "html_entity_decode", "contents": "html_entity_decode(${1:string})" }, + { "trigger": "htmlentities", "contents": "htmlentities(${1:string})" }, + { "trigger": "htmlspecialchars", "contents": "htmlspecialchars(${1:string})" }, + { "trigger": "htmlspecialchars_decode", "contents": "htmlspecialchars_decode(${1:string})" }, + { "trigger": "http_build_cookie", "contents": "http_build_cookie(${1:cookie})" }, + { "trigger": "http_build_query", "contents": "http_build_query(${1:query_data})" }, + { "trigger": "http_build_str", "contents": "http_build_str(${1:query})" }, + { "trigger": "http_build_url", "contents": "http_build_url()" }, + { "trigger": "http_cache_etag", "contents": "http_cache_etag()" }, + { "trigger": "http_cache_last_modified", "contents": "http_cache_last_modified()" }, + { "trigger": "http_chunked_decode", "contents": "http_chunked_decode(${1:encoded})" }, + { "trigger": "http_date", "contents": "http_date()" }, + { "trigger": "http_deflate", "contents": "http_deflate(${1:data})" }, + { "trigger": "http_get", "contents": "http_get(${1:url})" }, + { "trigger": "http_get_request_body", "contents": "http_get_request_body()" }, + { "trigger": "http_get_request_body_stream", "contents": "http_get_request_body_stream()" }, + { "trigger": "http_get_request_headers", "contents": "http_get_request_headers()" }, + { "trigger": "http_head", "contents": "http_head(${1:url})" }, + { "trigger": "http_inflate", "contents": "http_inflate(${1:data})" }, + { "trigger": "http_match_etag", "contents": "http_match_etag(${1:etag})" }, + { "trigger": "http_match_modified", "contents": "http_match_modified()" }, + { "trigger": "http_match_request_header", "contents": "http_match_request_header(${1:header}, ${2:value})" }, + { "trigger": "http_negotiate_charset", "contents": "http_negotiate_charset(${1:supported})" }, + { "trigger": "http_negotiate_content_type", "contents": "http_negotiate_content_type(${1:supported})" }, + { "trigger": "http_negotiate_language", "contents": "http_negotiate_language(${1:supported})" }, + { "trigger": "http_parse_cookie", "contents": "http_parse_cookie(${1:cookie})" }, + { "trigger": "http_parse_headers", "contents": "http_parse_headers(${1:header})" }, + { "trigger": "http_parse_message", "contents": "http_parse_message(${1:message})" }, + { "trigger": "http_parse_params", "contents": "http_parse_params(${1:param})" }, + { "trigger": "http_persistent_handles_clean", "contents": "http_persistent_handles_clean()" }, + { "trigger": "http_persistent_handles_count", "contents": "http_persistent_handles_count()" }, + { "trigger": "http_persistent_handles_ident", "contents": "http_persistent_handles_ident()" }, + { "trigger": "http_post_data", "contents": "http_post_data(${1:url}, ${2:data})" }, + { "trigger": "http_post_fields", "contents": "http_post_fields(${1:url}, ${2:data})" }, + { "trigger": "http_put_data", "contents": "http_put_data(${1:url}, ${2:data})" }, + { "trigger": "http_put_file", "contents": "http_put_file(${1:url}, ${2:file})" }, + { "trigger": "http_put_stream", "contents": "http_put_stream(${1:url}, ${2:stream})" }, + { "trigger": "http_redirect", "contents": "http_redirect()" }, + { "trigger": "http_request", "contents": "http_request(${1:method}, ${2:url})" }, + { "trigger": "http_request_body_encode", "contents": "http_request_body_encode(${1:fields}, ${2:files})" }, + { "trigger": "http_request_method_exists", "contents": "http_request_method_exists(${1:method})" }, + { "trigger": "http_request_method_name", "contents": "http_request_method_name(${1:method})" }, + { "trigger": "http_request_method_register", "contents": "http_request_method_register(${1:method})" }, + { "trigger": "http_request_method_unregister", "contents": "http_request_method_unregister(${1:method})" }, + { "trigger": "http_response_code", "contents": "http_response_code(${1:code})" }, + { "trigger": "http_send_content_disposition", "contents": "http_send_content_disposition(${1:filename})" }, + { "trigger": "http_send_content_type", "contents": "http_send_content_type()" }, + { "trigger": "http_send_data", "contents": "http_send_data(${1:data})" }, + { "trigger": "http_send_file", "contents": "http_send_file(${1:file})" }, + { "trigger": "http_send_last_modified", "contents": "http_send_last_modified()" }, + { "trigger": "http_send_status", "contents": "http_send_status(${1:status})" }, + { "trigger": "http_send_stream", "contents": "http_send_stream(${1:stream})" }, + { "trigger": "http_support", "contents": "http_support()" }, + { "trigger": "http_throttle", "contents": "http_throttle(${1:sec})" }, + { "trigger": "hw_Array2Objrec", "contents": "hw_Array2Objrec(${1:object_array})" }, + { "trigger": "hw_changeobject", "contents": "hw_changeobject(${1:link}, ${2:objid}, ${3:attributes})" }, + { "trigger": "hw_Children", "contents": "hw_Children(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_ChildrenObj", "contents": "hw_ChildrenObj(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_Close", "contents": "hw_Close(${1:connection})" }, + { "trigger": "hw_Connect", "contents": "hw_Connect(${1:host}, ${2:port})" }, + { "trigger": "hw_connection_info", "contents": "hw_connection_info(${1:link})" }, + { "trigger": "hw_cp", "contents": "hw_cp(${1:connection}, ${2:object_id_array}, ${3:destination_id})" }, + { "trigger": "hw_Deleteobject", "contents": "hw_Deleteobject(${1:connection}, ${2:object_to_delete})" }, + { "trigger": "hw_DocByAnchor", "contents": "hw_DocByAnchor(${1:connection}, ${2:anchorID})" }, + { "trigger": "hw_DocByAnchorObj", "contents": "hw_DocByAnchorObj(${1:connection}, ${2:anchorID})" }, + { "trigger": "hw_Document_Attributes", "contents": "hw_Document_Attributes(${1:hw_document})" }, + { "trigger": "hw_Document_BodyTag", "contents": "hw_Document_BodyTag(${1:hw_document})" }, + { "trigger": "hw_Document_Content", "contents": "hw_Document_Content(${1:hw_document})" }, + { "trigger": "hw_Document_SetContent", "contents": "hw_Document_SetContent(${1:hw_document}, ${2:content})" }, + { "trigger": "hw_Document_Size", "contents": "hw_Document_Size(${1:hw_document})" }, + { "trigger": "hw_dummy", "contents": "hw_dummy(${1:link}, ${2:id}, ${3:msgid})" }, + { "trigger": "hw_EditText", "contents": "hw_EditText(${1:connection}, ${2:hw_document})" }, + { "trigger": "hw_Error", "contents": "hw_Error(${1:connection})" }, + { "trigger": "hw_ErrorMsg", "contents": "hw_ErrorMsg(${1:connection})" }, + { "trigger": "hw_Free_Document", "contents": "hw_Free_Document(${1:hw_document})" }, + { "trigger": "hw_GetAnchors", "contents": "hw_GetAnchors(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetAnchorsObj", "contents": "hw_GetAnchorsObj(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetAndLock", "contents": "hw_GetAndLock(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetChildColl", "contents": "hw_GetChildColl(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetChildCollObj", "contents": "hw_GetChildCollObj(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetChildDocColl", "contents": "hw_GetChildDocColl(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetChildDocCollObj", "contents": "hw_GetChildDocCollObj(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetObject", "contents": "hw_GetObject(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetObjectByQuery", "contents": "hw_GetObjectByQuery(${1:connection}, ${2:query}, ${3:max_hits})" }, + { "trigger": "hw_GetObjectByQueryColl", "contents": "hw_GetObjectByQueryColl(${1:connection}, ${2:objectID}, ${3:query}, ${4:max_hits})" }, + { "trigger": "hw_GetObjectByQueryCollObj", "contents": "hw_GetObjectByQueryCollObj(${1:connection}, ${2:objectID}, ${3:query}, ${4:max_hits})" }, + { "trigger": "hw_GetObjectByQueryObj", "contents": "hw_GetObjectByQueryObj(${1:connection}, ${2:query}, ${3:max_hits})" }, + { "trigger": "hw_GetParents", "contents": "hw_GetParents(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetParentsObj", "contents": "hw_GetParentsObj(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_getrellink", "contents": "hw_getrellink(${1:link}, ${2:rootid}, ${3:sourceid}, ${4:destid})" }, + { "trigger": "hw_GetRemote", "contents": "hw_GetRemote(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_getremotechildren", "contents": "hw_getremotechildren(${1:connection}, ${2:object_record})" }, + { "trigger": "hw_GetSrcByDestObj", "contents": "hw_GetSrcByDestObj(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_GetText", "contents": "hw_GetText(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_getusername", "contents": "hw_getusername(${1:connection})" }, + { "trigger": "hw_Identify", "contents": "hw_Identify(${1:link}, ${2:username}, ${3:password})" }, + { "trigger": "hw_InCollections", "contents": "hw_InCollections(${1:connection}, ${2:object_id_array}, ${3:collection_id_array}, ${4:return_collections})" }, + { "trigger": "hw_Info", "contents": "hw_Info(${1:connection})" }, + { "trigger": "hw_InsColl", "contents": "hw_InsColl(${1:connection}, ${2:objectID}, ${3:object_array})" }, + { "trigger": "hw_InsDoc", "contents": "hw_InsDoc(${1:connection}, ${2:parentID}, ${3:object_record})" }, + { "trigger": "hw_insertanchors", "contents": "hw_insertanchors(${1:hwdoc}, ${2:anchorecs}, ${3:dest})" }, + { "trigger": "hw_InsertDocument", "contents": "hw_InsertDocument(${1:connection}, ${2:parent_id}, ${3:hw_document})" }, + { "trigger": "hw_InsertObject", "contents": "hw_InsertObject(${1:connection}, ${2:object_rec}, ${3:parameter})" }, + { "trigger": "hw_mapid", "contents": "hw_mapid(${1:connection}, ${2:server_id}, ${3:object_id})" }, + { "trigger": "hw_Modifyobject", "contents": "hw_Modifyobject(${1:connection}, ${2:object_to_change}, ${3:remove}, ${4:add})" }, + { "trigger": "hw_mv", "contents": "hw_mv(${1:connection}, ${2:object_id_array}, ${3:source_id}, ${4:destination_id})" }, + { "trigger": "hw_New_Document", "contents": "hw_New_Document(${1:object_record}, ${2:document_data}, ${3:document_size})" }, + { "trigger": "hw_objrec2array", "contents": "hw_objrec2array(${1:object_record})" }, + { "trigger": "hw_Output_Document", "contents": "hw_Output_Document(${1:hw_document})" }, + { "trigger": "hw_pConnect", "contents": "hw_pConnect(${1:host}, ${2:port})" }, + { "trigger": "hw_PipeDocument", "contents": "hw_PipeDocument(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_Root", "contents": "hw_Root()" }, + { "trigger": "hw_setlinkroot", "contents": "hw_setlinkroot(${1:link}, ${2:rootid})" }, + { "trigger": "hw_stat", "contents": "hw_stat(${1:link})" }, + { "trigger": "hw_Unlock", "contents": "hw_Unlock(${1:connection}, ${2:objectID})" }, + { "trigger": "hw_Who", "contents": "hw_Who(${1:connection})" }, + { "trigger": "hw_api_attribute", "contents": "hw_api_attribute()" }, + { "trigger": "hwapi_hgcsp", "contents": "hwapi_hgcsp(${1:hostname})" }, + { "trigger": "hw_api_content", "contents": "hw_api_content(${1:content}, ${2:mimetype})" }, + { "trigger": "hw_api_object", "contents": "hw_api_object(${1:parameter})" }, + { "trigger": "hypot", "contents": "hypot(${1:x}, ${2:y})" }, + { "trigger": "ibase_add_user", "contents": "ibase_add_user(${1:service_handle}, ${2:user_name}, ${3:password})" }, + { "trigger": "ibase_affected_rows", "contents": "ibase_affected_rows()" }, + { "trigger": "ibase_backup", "contents": "ibase_backup(${1:service_handle}, ${2:source_db}, ${3:dest_file})" }, + { "trigger": "ibase_blob_add", "contents": "ibase_blob_add(${1:blob_handle}, ${2:data})" }, + { "trigger": "ibase_blob_cancel", "contents": "ibase_blob_cancel(${1:blob_handle})" }, + { "trigger": "ibase_blob_close", "contents": "ibase_blob_close(${1:blob_handle})" }, + { "trigger": "ibase_blob_create", "contents": "ibase_blob_create()" }, + { "trigger": "ibase_blob_echo", "contents": "ibase_blob_echo(${1:blob_id})" }, + { "trigger": "ibase_blob_get", "contents": "ibase_blob_get(${1:blob_handle}, ${2:len})" }, + { "trigger": "ibase_blob_import", "contents": "ibase_blob_import(${1:link_identifier}, ${2:file_handle})" }, + { "trigger": "ibase_blob_info", "contents": "ibase_blob_info(${1:link_identifier}, ${2:blob_id})" }, + { "trigger": "ibase_blob_open", "contents": "ibase_blob_open(${1:link_identifier}, ${2:blob_id})" }, + { "trigger": "ibase_close", "contents": "ibase_close()" }, + { "trigger": "ibase_commit", "contents": "ibase_commit()" }, + { "trigger": "ibase_commit_ret", "contents": "ibase_commit_ret()" }, + { "trigger": "ibase_connect", "contents": "ibase_connect()" }, + { "trigger": "ibase_db_info", "contents": "ibase_db_info(${1:service_handle}, ${2:db}, ${3:action})" }, + { "trigger": "ibase_delete_user", "contents": "ibase_delete_user(${1:service_handle}, ${2:user_name})" }, + { "trigger": "ibase_drop_db", "contents": "ibase_drop_db()" }, + { "trigger": "ibase_errcode", "contents": "ibase_errcode()" }, + { "trigger": "ibase_errmsg", "contents": "ibase_errmsg()" }, + { "trigger": "ibase_execute", "contents": "ibase_execute(${1:query})" }, + { "trigger": "ibase_fetch_assoc", "contents": "ibase_fetch_assoc(${1:result})" }, + { "trigger": "ibase_fetch_object", "contents": "ibase_fetch_object(${1:result_id})" }, + { "trigger": "ibase_fetch_row", "contents": "ibase_fetch_row(${1:result_identifier})" }, + { "trigger": "ibase_field_info", "contents": "ibase_field_info(${1:result}, ${2:field_number})" }, + { "trigger": "ibase_free_event_handler", "contents": "ibase_free_event_handler(${1:event})" }, + { "trigger": "ibase_free_query", "contents": "ibase_free_query(${1:query})" }, + { "trigger": "ibase_free_result", "contents": "ibase_free_result(${1:result_identifier})" }, + { "trigger": "ibase_gen_id", "contents": "ibase_gen_id(${1:generator})" }, + { "trigger": "ibase_maintain_db", "contents": "ibase_maintain_db(${1:service_handle}, ${2:db}, ${3:action})" }, + { "trigger": "ibase_modify_user", "contents": "ibase_modify_user(${1:service_handle}, ${2:user_name}, ${3:password})" }, + { "trigger": "ibase_name_result", "contents": "ibase_name_result(${1:result}, ${2:name})" }, + { "trigger": "ibase_num_fields", "contents": "ibase_num_fields(${1:result_id})" }, + { "trigger": "ibase_num_params", "contents": "ibase_num_params(${1:query})" }, + { "trigger": "ibase_param_info", "contents": "ibase_param_info(${1:query}, ${2:param_number})" }, + { "trigger": "ibase_pconnect", "contents": "ibase_pconnect()" }, + { "trigger": "ibase_prepare", "contents": "ibase_prepare(${1:query})" }, + { "trigger": "ibase_query", "contents": "ibase_query()" }, + { "trigger": "ibase_restore", "contents": "ibase_restore(${1:service_handle}, ${2:source_file}, ${3:dest_db})" }, + { "trigger": "ibase_rollback", "contents": "ibase_rollback()" }, + { "trigger": "ibase_rollback_ret", "contents": "ibase_rollback_ret()" }, + { "trigger": "ibase_server_info", "contents": "ibase_server_info(${1:service_handle}, ${2:action})" }, + { "trigger": "ibase_service_attach", "contents": "ibase_service_attach(${1:host}, ${2:dba_username}, ${3:dba_password})" }, + { "trigger": "ibase_service_detach", "contents": "ibase_service_detach(${1:service_handle})" }, + { "trigger": "ibase_set_event_handler", "contents": "ibase_set_event_handler(${1:event_handler}, ${2:event_name1})" }, + { "trigger": "ibase_timefmt", "contents": "ibase_timefmt(${1:format})" }, + { "trigger": "ibase_trans", "contents": "ibase_trans()" }, + { "trigger": "ibase_wait_event", "contents": "ibase_wait_event(${1:event_name1})" }, + { "trigger": "iconv", "contents": "iconv(${1:in_charset}, ${2:out_charset}, ${3:str})" }, + { "trigger": "iconv_get_encoding", "contents": "iconv_get_encoding()" }, + { "trigger": "iconv_mime_decode", "contents": "iconv_mime_decode(${1:encoded_header})" }, + { "trigger": "iconv_mime_decode_headers", "contents": "iconv_mime_decode_headers(${1:encoded_headers})" }, + { "trigger": "iconv_mime_encode", "contents": "iconv_mime_encode(${1:field_name}, ${2:field_value})" }, + { "trigger": "iconv_set_encoding", "contents": "iconv_set_encoding(${1:type}, ${2:charset})" }, + { "trigger": "iconv_strlen", "contents": "iconv_strlen(${1:str})" }, + { "trigger": "iconv_strpos", "contents": "iconv_strpos(${1:haystack}, ${2:needle})" }, + { "trigger": "iconv_strrpos", "contents": "iconv_strrpos(${1:haystack}, ${2:needle})" }, + { "trigger": "iconv_substr", "contents": "iconv_substr(${1:str}, ${2:offset})" }, + { "trigger": "id3_get_frame_long_name", "contents": "id3_get_frame_long_name(${1:frameId})" }, + { "trigger": "id3_get_frame_short_name", "contents": "id3_get_frame_short_name(${1:frameId})" }, + { "trigger": "id3_get_genre_id", "contents": "id3_get_genre_id(${1:genre})" }, + { "trigger": "id3_get_genre_list", "contents": "id3_get_genre_list()" }, + { "trigger": "id3_get_genre_name", "contents": "id3_get_genre_name(${1:genre_id})" }, + { "trigger": "id3_get_tag", "contents": "id3_get_tag(${1:filename})" }, + { "trigger": "id3_get_version", "contents": "id3_get_version(${1:filename})" }, + { "trigger": "id3_remove_tag", "contents": "id3_remove_tag(${1:filename})" }, + { "trigger": "id3_set_tag", "contents": "id3_set_tag(${1:filename}, ${2:tag})" }, + { "trigger": "idate", "contents": "idate(${1:format})" }, + { "trigger": "idn_to_ascii", "contents": "idn_to_ascii(${1:domain})" }, + { "trigger": "idn_to_unicode", "contents": "idn_to_unicode()" }, + { "trigger": "idn_to_utf8", "contents": "idn_to_utf8(${1:domain})" }, + { "trigger": "ifx_affected_rows", "contents": "ifx_affected_rows(${1:result_id})" }, + { "trigger": "ifx_blobinfile_mode", "contents": "ifx_blobinfile_mode(${1:mode})" }, + { "trigger": "ifx_byteasvarchar", "contents": "ifx_byteasvarchar(${1:mode})" }, + { "trigger": "ifx_close", "contents": "ifx_close()" }, + { "trigger": "ifx_connect", "contents": "ifx_connect()" }, + { "trigger": "ifx_copy_blob", "contents": "ifx_copy_blob(${1:bid})" }, + { "trigger": "ifx_create_blob", "contents": "ifx_create_blob(${1:type}, ${2:mode}, ${3:param})" }, + { "trigger": "ifx_create_char", "contents": "ifx_create_char(${1:param})" }, + { "trigger": "ifx_do", "contents": "ifx_do(${1:result_id})" }, + { "trigger": "ifx_error", "contents": "ifx_error()" }, + { "trigger": "ifx_errormsg", "contents": "ifx_errormsg()" }, + { "trigger": "ifx_fetch_row", "contents": "ifx_fetch_row(${1:result_id})" }, + { "trigger": "ifx_fieldproperties", "contents": "ifx_fieldproperties(${1:result_id})" }, + { "trigger": "ifx_fieldtypes", "contents": "ifx_fieldtypes(${1:result_id})" }, + { "trigger": "ifx_free_blob", "contents": "ifx_free_blob(${1:bid})" }, + { "trigger": "ifx_free_char", "contents": "ifx_free_char(${1:bid})" }, + { "trigger": "ifx_free_result", "contents": "ifx_free_result(${1:result_id})" }, + { "trigger": "ifx_get_blob", "contents": "ifx_get_blob(${1:bid})" }, + { "trigger": "ifx_get_char", "contents": "ifx_get_char(${1:bid})" }, + { "trigger": "ifx_getsqlca", "contents": "ifx_getsqlca(${1:result_id})" }, + { "trigger": "ifx_htmltbl_result", "contents": "ifx_htmltbl_result(${1:result_id})" }, + { "trigger": "ifx_nullformat", "contents": "ifx_nullformat(${1:mode})" }, + { "trigger": "ifx_num_fields", "contents": "ifx_num_fields(${1:result_id})" }, + { "trigger": "ifx_num_rows", "contents": "ifx_num_rows(${1:result_id})" }, + { "trigger": "ifx_pconnect", "contents": "ifx_pconnect()" }, + { "trigger": "ifx_prepare", "contents": "ifx_prepare(${1:query}, ${2:link_identifier})" }, + { "trigger": "ifx_query", "contents": "ifx_query(${1:query}, ${2:link_identifier})" }, + { "trigger": "ifx_textasvarchar", "contents": "ifx_textasvarchar(${1:mode})" }, + { "trigger": "ifx_update_blob", "contents": "ifx_update_blob(${1:bid}, ${2:content})" }, + { "trigger": "ifx_update_char", "contents": "ifx_update_char(${1:bid}, ${2:content})" }, + { "trigger": "ifxus_close_slob", "contents": "ifxus_close_slob(${1:bid})" }, + { "trigger": "ifxus_create_slob", "contents": "ifxus_create_slob(${1:mode})" }, + { "trigger": "ifxus_free_slob", "contents": "ifxus_free_slob(${1:bid})" }, + { "trigger": "ifxus_open_slob", "contents": "ifxus_open_slob(${1:bid}, ${2:mode})" }, + { "trigger": "ifxus_read_slob", "contents": "ifxus_read_slob(${1:bid}, ${2:nbytes})" }, + { "trigger": "ifxus_seek_slob", "contents": "ifxus_seek_slob(${1:bid}, ${2:mode}, ${3:offset})" }, + { "trigger": "ifxus_tell_slob", "contents": "ifxus_tell_slob(${1:bid})" }, + { "trigger": "ifxus_write_slob", "contents": "ifxus_write_slob(${1:bid}, ${2:content})" }, + { "trigger": "ignore_user_abort", "contents": "ignore_user_abort()" }, + { "trigger": "iis_add_server", "contents": "iis_add_server(${1:path}, ${2:comment}, ${3:server_ip}, ${4:port}, ${5:host_name}, ${6:rights}, ${7:start_server})" }, + { "trigger": "iis_get_dir_security", "contents": "iis_get_dir_security(${1:server_instance}, ${2:virtual_path})" }, + { "trigger": "iis_get_script_map", "contents": "iis_get_script_map(${1:server_instance}, ${2:virtual_path}, ${3:script_extension})" }, + { "trigger": "iis_get_server_by_comment", "contents": "iis_get_server_by_comment(${1:comment})" }, + { "trigger": "iis_get_server_by_path", "contents": "iis_get_server_by_path(${1:path})" }, + { "trigger": "iis_get_server_rights", "contents": "iis_get_server_rights(${1:server_instance}, ${2:virtual_path})" }, + { "trigger": "iis_get_service_state", "contents": "iis_get_service_state(${1:service_id})" }, + { "trigger": "iis_remove_server", "contents": "iis_remove_server(${1:server_instance})" }, + { "trigger": "iis_set_app_settings", "contents": "iis_set_app_settings(${1:server_instance}, ${2:virtual_path}, ${3:application_scope})" }, + { "trigger": "iis_set_dir_security", "contents": "iis_set_dir_security(${1:server_instance}, ${2:virtual_path}, ${3:directory_flags})" }, + { "trigger": "iis_set_script_map", "contents": "iis_set_script_map(${1:server_instance}, ${2:virtual_path}, ${3:script_extension}, ${4:engine_path}, ${5:allow_scripting})" }, + { "trigger": "iis_set_server_rights", "contents": "iis_set_server_rights(${1:server_instance}, ${2:virtual_path}, ${3:directory_flags})" }, + { "trigger": "iis_start_server", "contents": "iis_start_server(${1:server_instance})" }, + { "trigger": "iis_start_service", "contents": "iis_start_service(${1:service_id})" }, + { "trigger": "iis_stop_server", "contents": "iis_stop_server(${1:server_instance})" }, + { "trigger": "iis_stop_service", "contents": "iis_stop_service(${1:service_id})" }, + { "trigger": "image2wbmp", "contents": "image2wbmp(${1:image})" }, + { "trigger": "image_type_to_extension", "contents": "image_type_to_extension(${1:imagetype})" }, + { "trigger": "image_type_to_mime_type", "contents": "image_type_to_mime_type(${1:imagetype})" }, + { "trigger": "imagealphablending", "contents": "imagealphablending(${1:image}, ${2:blendmode})" }, + { "trigger": "imageantialias", "contents": "imageantialias(${1:image}, ${2:enabled})" }, + { "trigger": "imagearc", "contents": "imagearc(${1:image}, ${2:cx}, ${3:cy}, ${4:width}, ${5:height}, ${6:start}, ${7:end}, ${8:color})" }, + { "trigger": "imagechar", "contents": "imagechar(${1:image}, ${2:font}, ${3:x}, ${4:y}, ${5:c}, ${6:color})" }, + { "trigger": "imagecharup", "contents": "imagecharup(${1:image}, ${2:font}, ${3:x}, ${4:y}, ${5:c}, ${6:color})" }, + { "trigger": "imagecolorallocate", "contents": "imagecolorallocate(${1:image}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "imagecolorallocatealpha", "contents": "imagecolorallocatealpha(${1:image}, ${2:red}, ${3:green}, ${4:blue}, ${5:alpha})" }, + { "trigger": "imagecolorat", "contents": "imagecolorat(${1:image}, ${2:x}, ${3:y})" }, + { "trigger": "imagecolorclosest", "contents": "imagecolorclosest(${1:image}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "imagecolorclosestalpha", "contents": "imagecolorclosestalpha(${1:image}, ${2:red}, ${3:green}, ${4:blue}, ${5:alpha})" }, + { "trigger": "imagecolorclosesthwb", "contents": "imagecolorclosesthwb(${1:image}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "imagecolordeallocate", "contents": "imagecolordeallocate(${1:image}, ${2:color})" }, + { "trigger": "imagecolorexact", "contents": "imagecolorexact(${1:image}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "imagecolorexactalpha", "contents": "imagecolorexactalpha(${1:image}, ${2:red}, ${3:green}, ${4:blue}, ${5:alpha})" }, + { "trigger": "imagecolormatch", "contents": "imagecolormatch(${1:image1}, ${2:image2})" }, + { "trigger": "imagecolorresolve", "contents": "imagecolorresolve(${1:image}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "imagecolorresolvealpha", "contents": "imagecolorresolvealpha(${1:image}, ${2:red}, ${3:green}, ${4:blue}, ${5:alpha})" }, + { "trigger": "imagecolorset", "contents": "imagecolorset(${1:image}, ${2:index}, ${3:red}, ${4:green}, ${5:blue})" }, + { "trigger": "imagecolorsforindex", "contents": "imagecolorsforindex(${1:image}, ${2:index})" }, + { "trigger": "imagecolorstotal", "contents": "imagecolorstotal(${1:image})" }, + { "trigger": "imagecolortransparent", "contents": "imagecolortransparent(${1:image})" }, + { "trigger": "imageconvolution", "contents": "imageconvolution(${1:image}, ${2:matrix}, ${3:div}, ${4:offset})" }, + { "trigger": "imagecopy", "contents": "imagecopy(${1:dst_im}, ${2:src_im}, ${3:dst_x}, ${4:dst_y}, ${5:src_x}, ${6:src_y}, ${7:src_w}, ${8:src_h})" }, + { "trigger": "imagecopymerge", "contents": "imagecopymerge(${1:dst_im}, ${2:src_im}, ${3:dst_x}, ${4:dst_y}, ${5:src_x}, ${6:src_y}, ${7:src_w}, ${8:src_h}, ${9:pct})" }, + { "trigger": "imagecopymergegray", "contents": "imagecopymergegray(${1:dst_im}, ${2:src_im}, ${3:dst_x}, ${4:dst_y}, ${5:src_x}, ${6:src_y}, ${7:src_w}, ${8:src_h}, ${9:pct})" }, + { "trigger": "imagecopyresampled", "contents": "imagecopyresampled(${1:dst_image}, ${2:src_image}, ${3:dst_x}, ${4:dst_y}, ${5:src_x}, ${6:src_y}, ${7:dst_w}, ${8:dst_h}, ${9:src_w}, ${10:src_h})" }, + { "trigger": "imagecopyresized", "contents": "imagecopyresized(${1:dst_image}, ${2:src_image}, ${3:dst_x}, ${4:dst_y}, ${5:src_x}, ${6:src_y}, ${7:dst_w}, ${8:dst_h}, ${9:src_w}, ${10:src_h})" }, + { "trigger": "imagecreate", "contents": "imagecreate(${1:width}, ${2:height})" }, + { "trigger": "imagecreatefromgd", "contents": "imagecreatefromgd(${1:filename})" }, + { "trigger": "imagecreatefromgd2", "contents": "imagecreatefromgd2(${1:filename})" }, + { "trigger": "imagecreatefromgd2part", "contents": "imagecreatefromgd2part(${1:filename}, ${2:srcX}, ${3:srcY}, ${4:width}, ${5:height})" }, + { "trigger": "imagecreatefromgif", "contents": "imagecreatefromgif(${1:filename})" }, + { "trigger": "imagecreatefromjpeg", "contents": "imagecreatefromjpeg(${1:filename})" }, + { "trigger": "imagecreatefrompng", "contents": "imagecreatefrompng(${1:filename})" }, + { "trigger": "imagecreatefromstring", "contents": "imagecreatefromstring(${1:data})" }, + { "trigger": "imagecreatefromwbmp", "contents": "imagecreatefromwbmp(${1:filename})" }, + { "trigger": "imagecreatefromxbm", "contents": "imagecreatefromxbm(${1:filename})" }, + { "trigger": "imagecreatefromxpm", "contents": "imagecreatefromxpm(${1:filename})" }, + { "trigger": "imagecreatetruecolor", "contents": "imagecreatetruecolor(${1:width}, ${2:height})" }, + { "trigger": "imagedashedline", "contents": "imagedashedline(${1:image}, ${2:x1}, ${3:y1}, ${4:x2}, ${5:y2}, ${6:color})" }, + { "trigger": "imagedestroy", "contents": "imagedestroy(${1:image})" }, + { "trigger": "imageellipse", "contents": "imageellipse(${1:image}, ${2:cx}, ${3:cy}, ${4:width}, ${5:height}, ${6:color})" }, + { "trigger": "imagefill", "contents": "imagefill(${1:image}, ${2:x}, ${3:y}, ${4:color})" }, + { "trigger": "imagefilledarc", "contents": "imagefilledarc(${1:image}, ${2:cx}, ${3:cy}, ${4:width}, ${5:height}, ${6:start}, ${7:end}, ${8:color}, ${9:style})" }, + { "trigger": "imagefilledellipse", "contents": "imagefilledellipse(${1:image}, ${2:cx}, ${3:cy}, ${4:width}, ${5:height}, ${6:color})" }, + { "trigger": "imagefilledpolygon", "contents": "imagefilledpolygon(${1:image}, ${2:points}, ${3:num_points}, ${4:color})" }, + { "trigger": "imagefilledrectangle", "contents": "imagefilledrectangle(${1:image}, ${2:x1}, ${3:y1}, ${4:x2}, ${5:y2}, ${6:color})" }, + { "trigger": "imagefilltoborder", "contents": "imagefilltoborder(${1:image}, ${2:x}, ${3:y}, ${4:border}, ${5:color})" }, + { "trigger": "imagefilter", "contents": "imagefilter(${1:image}, ${2:filtertype})" }, + { "trigger": "imagefontheight", "contents": "imagefontheight(${1:font})" }, + { "trigger": "imagefontwidth", "contents": "imagefontwidth(${1:font})" }, + { "trigger": "imageftbbox", "contents": "imageftbbox(${1:size}, ${2:angle}, ${3:fontfile}, ${4:text})" }, + { "trigger": "imagefttext", "contents": "imagefttext(${1:image}, ${2:size}, ${3:angle}, ${4:x}, ${5:y}, ${6:color}, ${7:fontfile}, ${8:text})" }, + { "trigger": "imagegammacorrect", "contents": "imagegammacorrect(${1:image}, ${2:inputgamma}, ${3:outputgamma})" }, + { "trigger": "imagegd", "contents": "imagegd(${1:image})" }, + { "trigger": "imagegd2", "contents": "imagegd2(${1:image})" }, + { "trigger": "imagegif", "contents": "imagegif(${1:image})" }, + { "trigger": "imagegrabscreen", "contents": "imagegrabscreen()" }, + { "trigger": "imagegrabwindow", "contents": "imagegrabwindow(${1:window_handle})" }, + { "trigger": "imageinterlace", "contents": "imageinterlace(${1:image})" }, + { "trigger": "imageistruecolor", "contents": "imageistruecolor(${1:image})" }, + { "trigger": "imagejpeg", "contents": "imagejpeg(${1:image})" }, + { "trigger": "imagelayereffect", "contents": "imagelayereffect(${1:image}, ${2:effect})" }, + { "trigger": "imageline", "contents": "imageline(${1:image}, ${2:x1}, ${3:y1}, ${4:x2}, ${5:y2}, ${6:color})" }, + { "trigger": "imageloadfont", "contents": "imageloadfont(${1:file})" }, + { "trigger": "imagepalettecopy", "contents": "imagepalettecopy(${1:destination}, ${2:source})" }, + { "trigger": "imagepng", "contents": "imagepng(${1:image})" }, + { "trigger": "imagepolygon", "contents": "imagepolygon(${1:image}, ${2:points}, ${3:num_points}, ${4:color})" }, + { "trigger": "imagepsbbox", "contents": "imagepsbbox(${1:text}, ${2:font}, ${3:size})" }, + { "trigger": "imagepsencodefont", "contents": "imagepsencodefont(${1:font_index}, ${2:encodingfile})" }, + { "trigger": "imagepsextendfont", "contents": "imagepsextendfont(${1:font_index}, ${2:extend})" }, + { "trigger": "imagepsfreefont", "contents": "imagepsfreefont(${1:font_index})" }, + { "trigger": "imagepsloadfont", "contents": "imagepsloadfont(${1:filename})" }, + { "trigger": "imagepsslantfont", "contents": "imagepsslantfont(${1:font_index}, ${2:slant})" }, + { "trigger": "imagepstext", "contents": "imagepstext(${1:image}, ${2:text}, ${3:font_index}, ${4:size}, ${5:foreground}, ${6:background}, ${7:x}, ${8:y})" }, + { "trigger": "imagerectangle", "contents": "imagerectangle(${1:image}, ${2:x1}, ${3:y1}, ${4:x2}, ${5:y2}, ${6:color})" }, + { "trigger": "imagerotate", "contents": "imagerotate(${1:image}, ${2:angle}, ${3:bgd_color})" }, + { "trigger": "imagesavealpha", "contents": "imagesavealpha(${1:image}, ${2:saveflag})" }, + { "trigger": "imagesetbrush", "contents": "imagesetbrush(${1:image}, ${2:brush})" }, + { "trigger": "imagesetpixel", "contents": "imagesetpixel(${1:image}, ${2:x}, ${3:y}, ${4:color})" }, + { "trigger": "imagesetstyle", "contents": "imagesetstyle(${1:image}, ${2:style})" }, + { "trigger": "imagesetthickness", "contents": "imagesetthickness(${1:image}, ${2:thickness})" }, + { "trigger": "imagesettile", "contents": "imagesettile(${1:image}, ${2:tile})" }, + { "trigger": "imagestring", "contents": "imagestring(${1:image}, ${2:font}, ${3:x}, ${4:y}, ${5:string}, ${6:color})" }, + { "trigger": "imagestringup", "contents": "imagestringup(${1:image}, ${2:font}, ${3:x}, ${4:y}, ${5:string}, ${6:color})" }, + { "trigger": "imagesx", "contents": "imagesx(${1:image})" }, + { "trigger": "imagesy", "contents": "imagesy(${1:image})" }, + { "trigger": "imagetruecolortopalette", "contents": "imagetruecolortopalette(${1:image}, ${2:dither}, ${3:ncolors})" }, + { "trigger": "imagettfbbox", "contents": "imagettfbbox(${1:size}, ${2:angle}, ${3:fontfile}, ${4:text})" }, + { "trigger": "imagettftext", "contents": "imagettftext(${1:image}, ${2:size}, ${3:angle}, ${4:x}, ${5:y}, ${6:color}, ${7:fontfile}, ${8:text})" }, + { "trigger": "imagetypes", "contents": "imagetypes()" }, + { "trigger": "imagewbmp", "contents": "imagewbmp(${1:image})" }, + { "trigger": "imagexbm", "contents": "imagexbm(${1:image}, ${2:filename})" }, + { "trigger": "imap_8bit", "contents": "imap_8bit(${1:string})" }, + { "trigger": "imap_alerts", "contents": "imap_alerts()" }, + { "trigger": "imap_append", "contents": "imap_append(${1:imap_stream}, ${2:mailbox}, ${3:message})" }, + { "trigger": "imap_base64", "contents": "imap_base64(${1:text})" }, + { "trigger": "imap_binary", "contents": "imap_binary(${1:string})" }, + { "trigger": "imap_body", "contents": "imap_body(${1:imap_stream}, ${2:msg_number})" }, + { "trigger": "imap_bodystruct", "contents": "imap_bodystruct(${1:imap_stream}, ${2:msg_number}, ${3:section})" }, + { "trigger": "imap_check", "contents": "imap_check(${1:imap_stream})" }, + { "trigger": "imap_clearflag_full", "contents": "imap_clearflag_full(${1:imap_stream}, ${2:sequence}, ${3:flag})" }, + { "trigger": "imap_close", "contents": "imap_close(${1:imap_stream})" }, + { "trigger": "imap_createmailbox", "contents": "imap_createmailbox(${1:imap_stream}, ${2:mailbox})" }, + { "trigger": "imap_delete", "contents": "imap_delete(${1:imap_stream}, ${2:msg_number})" }, + { "trigger": "imap_deletemailbox", "contents": "imap_deletemailbox(${1:imap_stream}, ${2:mailbox})" }, + { "trigger": "imap_errors", "contents": "imap_errors()" }, + { "trigger": "imap_expunge", "contents": "imap_expunge(${1:imap_stream})" }, + { "trigger": "imap_fetch_overview", "contents": "imap_fetch_overview(${1:imap_stream}, ${2:sequence})" }, + { "trigger": "imap_fetchbody", "contents": "imap_fetchbody(${1:imap_stream}, ${2:msg_number}, ${3:section})" }, + { "trigger": "imap_fetchheader", "contents": "imap_fetchheader(${1:imap_stream}, ${2:msg_number})" }, + { "trigger": "imap_fetchstructure", "contents": "imap_fetchstructure(${1:imap_stream}, ${2:msg_number})" }, + { "trigger": "imap_gc", "contents": "imap_gc(${1:imap_stream}, ${2:caches})" }, + { "trigger": "imap_get_quota", "contents": "imap_get_quota(${1:imap_stream}, ${2:quota_root})" }, + { "trigger": "imap_get_quotaroot", "contents": "imap_get_quotaroot(${1:imap_stream}, ${2:quota_root})" }, + { "trigger": "imap_getacl", "contents": "imap_getacl(${1:imap_stream}, ${2:mailbox})" }, + { "trigger": "imap_getmailboxes", "contents": "imap_getmailboxes(${1:imap_stream}, ${2:ref}, ${3:pattern})" }, + { "trigger": "imap_getsubscribed", "contents": "imap_getsubscribed(${1:imap_stream}, ${2:ref}, ${3:pattern})" }, + { "trigger": "imap_header", "contents": "imap_header()" }, + { "trigger": "imap_headerinfo", "contents": "imap_headerinfo(${1:imap_stream}, ${2:msg_number})" }, + { "trigger": "imap_headers", "contents": "imap_headers(${1:imap_stream})" }, + { "trigger": "imap_last_error", "contents": "imap_last_error()" }, + { "trigger": "imap_list", "contents": "imap_list(${1:imap_stream}, ${2:ref}, ${3:pattern})" }, + { "trigger": "imap_listmailbox", "contents": "imap_listmailbox()" }, + { "trigger": "imap_listscan", "contents": "imap_listscan(${1:imap_stream}, ${2:ref}, ${3:pattern}, ${4:content})" }, + { "trigger": "imap_listsubscribed", "contents": "imap_listsubscribed()" }, + { "trigger": "imap_lsub", "contents": "imap_lsub(${1:imap_stream}, ${2:ref}, ${3:pattern})" }, + { "trigger": "imap_mail", "contents": "imap_mail(${1:to}, ${2:subject}, ${3:message})" }, + { "trigger": "imap_mail_compose", "contents": "imap_mail_compose(${1:envelope}, ${2:body})" }, + { "trigger": "imap_mail_copy", "contents": "imap_mail_copy(${1:imap_stream}, ${2:msglist}, ${3:mailbox})" }, + { "trigger": "imap_mail_move", "contents": "imap_mail_move(${1:imap_stream}, ${2:msglist}, ${3:mailbox})" }, + { "trigger": "imap_mailboxmsginfo", "contents": "imap_mailboxmsginfo(${1:imap_stream})" }, + { "trigger": "imap_mime_header_decode", "contents": "imap_mime_header_decode(${1:text})" }, + { "trigger": "imap_msgno", "contents": "imap_msgno(${1:imap_stream}, ${2:uid})" }, + { "trigger": "imap_num_msg", "contents": "imap_num_msg(${1:imap_stream})" }, + { "trigger": "imap_num_recent", "contents": "imap_num_recent(${1:imap_stream})" }, + { "trigger": "imap_open", "contents": "imap_open(${1:mailbox}, ${2:username}, ${3:password})" }, + { "trigger": "imap_ping", "contents": "imap_ping(${1:imap_stream})" }, + { "trigger": "imap_qprint", "contents": "imap_qprint(${1:string})" }, + { "trigger": "imap_renamemailbox", "contents": "imap_renamemailbox(${1:imap_stream}, ${2:old_mbox}, ${3:new_mbox})" }, + { "trigger": "imap_reopen", "contents": "imap_reopen(${1:imap_stream}, ${2:mailbox})" }, + { "trigger": "imap_rfc822_parse_adrlist", "contents": "imap_rfc822_parse_adrlist(${1:address}, ${2:default_host})" }, + { "trigger": "imap_rfc822_parse_headers", "contents": "imap_rfc822_parse_headers(${1:headers})" }, + { "trigger": "imap_rfc822_write_address", "contents": "imap_rfc822_write_address(${1:mailbox}, ${2:host}, ${3:personal})" }, + { "trigger": "imap_savebody", "contents": "imap_savebody(${1:imap_stream}, ${2:file}, ${3:msg_number})" }, + { "trigger": "imap_scanmailbox", "contents": "imap_scanmailbox()" }, + { "trigger": "imap_search", "contents": "imap_search(${1:imap_stream}, ${2:criteria})" }, + { "trigger": "imap_set_quota", "contents": "imap_set_quota(${1:imap_stream}, ${2:quota_root}, ${3:quota_limit})" }, + { "trigger": "imap_setacl", "contents": "imap_setacl(${1:imap_stream}, ${2:mailbox}, ${3:id}, ${4:rights})" }, + { "trigger": "imap_setflag_full", "contents": "imap_setflag_full(${1:imap_stream}, ${2:sequence}, ${3:flag})" }, + { "trigger": "imap_sort", "contents": "imap_sort(${1:imap_stream}, ${2:criteria}, ${3:reverse})" }, + { "trigger": "imap_status", "contents": "imap_status(${1:imap_stream}, ${2:mailbox}, ${3:options})" }, + { "trigger": "imap_subscribe", "contents": "imap_subscribe(${1:imap_stream}, ${2:mailbox})" }, + { "trigger": "imap_thread", "contents": "imap_thread(${1:imap_stream})" }, + { "trigger": "imap_timeout", "contents": "imap_timeout(${1:timeout_type})" }, + { "trigger": "imap_uid", "contents": "imap_uid(${1:imap_stream}, ${2:msg_number})" }, + { "trigger": "imap_undelete", "contents": "imap_undelete(${1:imap_stream}, ${2:msg_number})" }, + { "trigger": "imap_unsubscribe", "contents": "imap_unsubscribe(${1:imap_stream}, ${2:mailbox})" }, + { "trigger": "imap_utf7_decode", "contents": "imap_utf7_decode(${1:text})" }, + { "trigger": "imap_utf7_encode", "contents": "imap_utf7_encode(${1:data})" }, + { "trigger": "imap_utf8", "contents": "imap_utf8(${1:mime_encoded_text})" }, + { "trigger": "implode", "contents": "implode(${1:glue}, ${2:pieces})" }, + { "trigger": "import_request_variables", "contents": "import_request_variables(${1:types})" }, + { "trigger": "in_array", "contents": "in_array(${1:needle}, ${2:haystack})" }, + { "trigger": "", "contents": "()" }, + { "trigger": "", "contents": "()" }, + { "trigger": "inclued_get_data", "contents": "inclued_get_data()" }, + { "trigger": "inet_ntop", "contents": "inet_ntop(${1:in_addr})" }, + { "trigger": "inet_pton", "contents": "inet_pton(${1:address})" }, + { "trigger": "ingres_autocommit", "contents": "ingres_autocommit(${1:link})" }, + { "trigger": "ingres_autocommit_state", "contents": "ingres_autocommit_state(${1:link})" }, + { "trigger": "ingres_charset", "contents": "ingres_charset(${1:link})" }, + { "trigger": "ingres_close", "contents": "ingres_close(${1:link})" }, + { "trigger": "ingres_commit", "contents": "ingres_commit(${1:link})" }, + { "trigger": "ingres_connect", "contents": "ingres_connect()" }, + { "trigger": "ingres_cursor", "contents": "ingres_cursor(${1:result})" }, + { "trigger": "ingres_errno", "contents": "ingres_errno()" }, + { "trigger": "ingres_error", "contents": "ingres_error()" }, + { "trigger": "ingres_errsqlstate", "contents": "ingres_errsqlstate()" }, + { "trigger": "ingres_escape_string", "contents": "ingres_escape_string(${1:link}, ${2:source_string})" }, + { "trigger": "ingres_execute", "contents": "ingres_execute(${1:result})" }, + { "trigger": "ingres_fetch_array", "contents": "ingres_fetch_array(${1:result})" }, + { "trigger": "ingres_fetch_assoc", "contents": "ingres_fetch_assoc(${1:result})" }, + { "trigger": "ingres_fetch_object", "contents": "ingres_fetch_object(${1:result})" }, + { "trigger": "ingres_fetch_proc_return", "contents": "ingres_fetch_proc_return(${1:result})" }, + { "trigger": "ingres_fetch_row", "contents": "ingres_fetch_row(${1:result})" }, + { "trigger": "ingres_field_length", "contents": "ingres_field_length(${1:result}, ${2:index})" }, + { "trigger": "ingres_field_name", "contents": "ingres_field_name(${1:result}, ${2:index})" }, + { "trigger": "ingres_field_nullable", "contents": "ingres_field_nullable(${1:result}, ${2:index})" }, + { "trigger": "ingres_field_precision", "contents": "ingres_field_precision(${1:result}, ${2:index})" }, + { "trigger": "ingres_field_scale", "contents": "ingres_field_scale(${1:result}, ${2:index})" }, + { "trigger": "ingres_field_type", "contents": "ingres_field_type(${1:result}, ${2:index})" }, + { "trigger": "ingres_free_result", "contents": "ingres_free_result(${1:result})" }, + { "trigger": "ingres_next_error", "contents": "ingres_next_error()" }, + { "trigger": "ingres_num_fields", "contents": "ingres_num_fields(${1:result})" }, + { "trigger": "ingres_num_rows", "contents": "ingres_num_rows(${1:result})" }, + { "trigger": "ingres_pconnect", "contents": "ingres_pconnect()" }, + { "trigger": "ingres_prepare", "contents": "ingres_prepare(${1:link}, ${2:query})" }, + { "trigger": "ingres_query", "contents": "ingres_query(${1:link}, ${2:query})" }, + { "trigger": "ingres_result_seek", "contents": "ingres_result_seek(${1:result}, ${2:position})" }, + { "trigger": "ingres_rollback", "contents": "ingres_rollback(${1:link})" }, + { "trigger": "ingres_set_environment", "contents": "ingres_set_environment(${1:link}, ${2:options})" }, + { "trigger": "ingres_unbuffered_query", "contents": "ingres_unbuffered_query(${1:link}, ${2:query})" }, + { "trigger": "ini_alter", "contents": "ini_alter()" }, + { "trigger": "ini_get", "contents": "ini_get(${1:varname})" }, + { "trigger": "ini_get_all", "contents": "ini_get_all()" }, + { "trigger": "ini_restore", "contents": "ini_restore(${1:varname})" }, + { "trigger": "ini_set", "contents": "ini_set(${1:varname}, ${2:newvalue})" }, + { "trigger": "inotify_add_watch", "contents": "inotify_add_watch(${1:inotify_instance}, ${2:pathname}, ${3:mask})" }, + { "trigger": "inotify_init", "contents": "inotify_init()" }, + { "trigger": "inotify_queue_len", "contents": "inotify_queue_len(${1:inotify_instance})" }, + { "trigger": "inotify_read", "contents": "inotify_read(${1:inotify_instance})" }, + { "trigger": "inotify_rm_watch", "contents": "inotify_rm_watch(${1:inotify_instance}, ${2:watch_descriptor})" }, + { "trigger": "intdiv", "contents": "intdiv(${1:dividend}, ${2:divisor})" }, + { "trigger": "interface_exists", "contents": "interface_exists(${1:interface_name})" }, + { "trigger": "intl_error_name", "contents": "intl_error_name(${1:error_code})" }, + { "trigger": "intl_get_error_code", "contents": "intl_get_error_code()" }, + { "trigger": "intl_get_error_message", "contents": "intl_get_error_message()" }, + { "trigger": "intl_is_failure", "contents": "intl_is_failure(${1:error_code})" }, + { "trigger": "intval", "contents": "intval(${1:var})" }, + { "trigger": "ip2long", "contents": "ip2long(${1:ip_address})" }, + { "trigger": "iptcembed", "contents": "iptcembed(${1:iptcdata}, ${2:jpeg_file_name})" }, + { "trigger": "iptcparse", "contents": "iptcparse(${1:iptcblock})" }, + { "trigger": "is_a", "contents": "is_a(${1:object}, ${2:class_name})" }, + { "trigger": "is_array", "contents": "is_array(${1:var})" }, + { "trigger": "is_bool", "contents": "is_bool(${1:var})" }, + { "trigger": "is_callable", "contents": "is_callable(${1:name})" }, + { "trigger": "is_dir", "contents": "is_dir(${1:filename})" }, + { "trigger": "is_double", "contents": "is_double()" }, + { "trigger": "is_executable", "contents": "is_executable(${1:filename})" }, + { "trigger": "is_file", "contents": "is_file(${1:filename})" }, + { "trigger": "is_finite", "contents": "is_finite(${1:val})" }, + { "trigger": "is_float", "contents": "is_float(${1:var})" }, + { "trigger": "is_infinite", "contents": "is_infinite(${1:val})" }, + { "trigger": "is_int", "contents": "is_int(${1:var})" }, + { "trigger": "is_integer", "contents": "is_integer()" }, + { "trigger": "is_link", "contents": "is_link(${1:filename})" }, + { "trigger": "is_long", "contents": "is_long()" }, + { "trigger": "is_nan", "contents": "is_nan(${1:val})" }, + { "trigger": "is_null", "contents": "is_null(${1:var})" }, + { "trigger": "is_numeric", "contents": "is_numeric(${1:var})" }, + { "trigger": "is_object", "contents": "is_object(${1:var})" }, + { "trigger": "is_readable", "contents": "is_readable(${1:filename})" }, + { "trigger": "is_real", "contents": "is_real()" }, + { "trigger": "is_resource", "contents": "is_resource(${1:var})" }, + { "trigger": "is_scalar", "contents": "is_scalar(${1:var})" }, + { "trigger": "is_soap_fault", "contents": "is_soap_fault(${1:object})" }, + { "trigger": "is_string", "contents": "is_string(${1:var})" }, + { "trigger": "is_subclass_of", "contents": "is_subclass_of(${1:object}, ${2:class_name})" }, + { "trigger": "is_uploaded_file", "contents": "is_uploaded_file(${1:filename})" }, + { "trigger": "is_writable", "contents": "is_writable(${1:filename})" }, + { "trigger": "is_writeable", "contents": "is_writeable()" }, + { "trigger": "isset", "contents": "isset(${1:var})" }, + { "trigger": "iterator_apply", "contents": "iterator_apply(${1:iterator}, ${2:function})" }, + { "trigger": "iterator_count", "contents": "iterator_count(${1:iterator})" }, + { "trigger": "iterator_to_array", "contents": "iterator_to_array(${1:iterator})" }, + { "trigger": "java_last_exception_clear", "contents": "java_last_exception_clear()" }, + { "trigger": "java_last_exception_get", "contents": "java_last_exception_get()" }, + { "trigger": "JDDayOfWeek", "contents": "JDDayOfWeek(${1:julianday})" }, + { "trigger": "JDMonthName", "contents": "JDMonthName(${1:julianday}, ${2:mode})" }, + { "trigger": "JDToFrench", "contents": "JDToFrench(${1:juliandaycount})" }, + { "trigger": "JDToGregorian", "contents": "JDToGregorian(${1:julianday})" }, + { "trigger": "jdtojewish", "contents": "jdtojewish(${1:juliandaycount})" }, + { "trigger": "JDToJulian", "contents": "JDToJulian(${1:julianday})" }, + { "trigger": "jdtounix", "contents": "jdtounix(${1:jday})" }, + { "trigger": "JewishToJD", "contents": "JewishToJD(${1:month}, ${2:day}, ${3:year})" }, + { "trigger": "join", "contents": "join()" }, + { "trigger": "jpeg2wbmp", "contents": "jpeg2wbmp(${1:jpegname}, ${2:wbmpname}, ${3:dest_height}, ${4:dest_width}, ${5:threshold})" }, + { "trigger": "json_decode", "contents": "json_decode(${1:json})" }, + { "trigger": "json_encode", "contents": "json_encode(${1:value})" }, + { "trigger": "json_last_error", "contents": "json_last_error()" }, + { "trigger": "judy_type", "contents": "judy_type(${1:array})" }, + { "trigger": "judy_version", "contents": "judy_version()" }, + { "trigger": "JulianToJD", "contents": "JulianToJD(${1:month}, ${2:day}, ${3:year})" }, + { "trigger": "kadm5_chpass_principal", "contents": "kadm5_chpass_principal(${1:handle}, ${2:principal}, ${3:password})" }, + { "trigger": "kadm5_create_principal", "contents": "kadm5_create_principal(${1:handle}, ${2:principal})" }, + { "trigger": "kadm5_delete_principal", "contents": "kadm5_delete_principal(${1:handle}, ${2:principal})" }, + { "trigger": "kadm5_destroy", "contents": "kadm5_destroy(${1:handle})" }, + { "trigger": "kadm5_flush", "contents": "kadm5_flush(${1:handle})" }, + { "trigger": "kadm5_get_policies", "contents": "kadm5_get_policies(${1:handle})" }, + { "trigger": "kadm5_get_principal", "contents": "kadm5_get_principal(${1:handle}, ${2:principal})" }, + { "trigger": "kadm5_get_principals", "contents": "kadm5_get_principals(${1:handle})" }, + { "trigger": "kadm5_init_with_password", "contents": "kadm5_init_with_password(${1:admin_server}, ${2:realm}, ${3:principal}, ${4:password})" }, + { "trigger": "kadm5_modify_principal", "contents": "kadm5_modify_principal(${1:handle}, ${2:principal}, ${3:options})" }, + { "trigger": "key", "contents": "key(${1:array})" }, + { "trigger": "krsort", "contents": "krsort(${1:array})" }, + { "trigger": "ksort", "contents": "ksort(${1:array})" }, + { "trigger": "lcfirst", "contents": "lcfirst(${1:str})" }, + { "trigger": "lcg_value", "contents": "lcg_value()" }, + { "trigger": "lchgrp", "contents": "lchgrp(${1:filename}, ${2:group})" }, + { "trigger": "lchown", "contents": "lchown(${1:filename}, ${2:user})" }, + { "trigger": "ldap_8859_to_t61", "contents": "ldap_8859_to_t61(${1:value})" }, + { "trigger": "ldap_add", "contents": "ldap_add(${1:link_identifier}, ${2:dn}, ${3:entry})" }, + { "trigger": "ldap_bind", "contents": "ldap_bind(${1:link_identifier})" }, + { "trigger": "ldap_close", "contents": "ldap_close()" }, + { "trigger": "ldap_compare", "contents": "ldap_compare(${1:link_identifier}, ${2:dn}, ${3:attribute}, ${4:value})" }, + { "trigger": "ldap_connect", "contents": "ldap_connect()" }, + { "trigger": "ldap_count_entries", "contents": "ldap_count_entries(${1:link_identifier}, ${2:result_identifier})" }, + { "trigger": "ldap_delete", "contents": "ldap_delete(${1:link_identifier}, ${2:dn})" }, + { "trigger": "ldap_dn2ufn", "contents": "ldap_dn2ufn(${1:dn})" }, + { "trigger": "ldap_err2str", "contents": "ldap_err2str(${1:errno})" }, + { "trigger": "ldap_errno", "contents": "ldap_errno(${1:link_identifier})" }, + { "trigger": "ldap_error", "contents": "ldap_error(${1:link_identifier})" }, + { "trigger": "ldap_explode_dn", "contents": "ldap_explode_dn(${1:dn}, ${2:with_attrib})" }, + { "trigger": "ldap_first_attribute", "contents": "ldap_first_attribute(${1:link_identifier}, ${2:result_entry_identifier})" }, + { "trigger": "ldap_first_entry", "contents": "ldap_first_entry(${1:link_identifier}, ${2:result_identifier})" }, + { "trigger": "ldap_first_reference", "contents": "ldap_first_reference(${1:link}, ${2:result})" }, + { "trigger": "ldap_free_result", "contents": "ldap_free_result(${1:result_identifier})" }, + { "trigger": "ldap_get_attributes", "contents": "ldap_get_attributes(${1:link_identifier}, ${2:result_entry_identifier})" }, + { "trigger": "ldap_get_dn", "contents": "ldap_get_dn(${1:link_identifier}, ${2:result_entry_identifier})" }, + { "trigger": "ldap_get_entries", "contents": "ldap_get_entries(${1:link_identifier}, ${2:result_identifier})" }, + { "trigger": "ldap_get_option", "contents": "ldap_get_option(${1:link_identifier}, ${2:option}, ${3:retval})" }, + { "trigger": "ldap_get_values", "contents": "ldap_get_values(${1:link_identifier}, ${2:result_entry_identifier}, ${3:attribute})" }, + { "trigger": "ldap_get_values_len", "contents": "ldap_get_values_len(${1:link_identifier}, ${2:result_entry_identifier}, ${3:attribute})" }, + { "trigger": "ldap_list", "contents": "ldap_list(${1:link_identifier}, ${2:base_dn}, ${3:filter})" }, + { "trigger": "ldap_mod_add", "contents": "ldap_mod_add(${1:link_identifier}, ${2:dn}, ${3:entry})" }, + { "trigger": "ldap_mod_del", "contents": "ldap_mod_del(${1:link_identifier}, ${2:dn}, ${3:entry})" }, + { "trigger": "ldap_mod_replace", "contents": "ldap_mod_replace(${1:link_identifier}, ${2:dn}, ${3:entry})" }, + { "trigger": "ldap_modify", "contents": "ldap_modify(${1:link_identifier}, ${2:dn}, ${3:entry})" }, + { "trigger": "ldap_next_attribute", "contents": "ldap_next_attribute(${1:link_identifier}, ${2:result_entry_identifier})" }, + { "trigger": "ldap_next_entry", "contents": "ldap_next_entry(${1:link_identifier}, ${2:result_entry_identifier})" }, + { "trigger": "ldap_next_reference", "contents": "ldap_next_reference(${1:link}, ${2:entry})" }, + { "trigger": "ldap_parse_reference", "contents": "ldap_parse_reference(${1:link}, ${2:entry}, ${3:referrals})" }, + { "trigger": "ldap_parse_result", "contents": "ldap_parse_result(${1:link}, ${2:result}, ${3:errcode})" }, + { "trigger": "ldap_read", "contents": "ldap_read(${1:link_identifier}, ${2:base_dn}, ${3:filter})" }, + { "trigger": "ldap_rename", "contents": "ldap_rename(${1:link_identifier}, ${2:dn}, ${3:newrdn}, ${4:newparent}, ${5:deleteoldrdn})" }, + { "trigger": "ldap_sasl_bind", "contents": "ldap_sasl_bind(${1:link})" }, + { "trigger": "ldap_search", "contents": "ldap_search(${1:link_identifier}, ${2:base_dn}, ${3:filter})" }, + { "trigger": "ldap_set_option", "contents": "ldap_set_option(${1:link_identifier}, ${2:option}, ${3:newval})" }, + { "trigger": "ldap_set_rebind_proc", "contents": "ldap_set_rebind_proc(${1:link}, ${2:callback})" }, + { "trigger": "ldap_sort", "contents": "ldap_sort(${1:link}, ${2:result}, ${3:sortfilter})" }, + { "trigger": "ldap_start_tls", "contents": "ldap_start_tls(${1:link})" }, + { "trigger": "ldap_t61_to_8859", "contents": "ldap_t61_to_8859(${1:value})" }, + { "trigger": "ldap_unbind", "contents": "ldap_unbind(${1:link_identifier})" }, + { "trigger": "levenshtein", "contents": "levenshtein(${1:str1}, ${2:str2})" }, + { "trigger": "libxml_clear_errors", "contents": "libxml_clear_errors()" }, + { "trigger": "libxml_disable_entity_loader", "contents": "libxml_disable_entity_loader()" }, + { "trigger": "libxml_get_errors", "contents": "libxml_get_errors()" }, + { "trigger": "libxml_get_last_error", "contents": "libxml_get_last_error()" }, + { "trigger": "libxml_set_streams_context", "contents": "libxml_set_streams_context(${1:streams_context})" }, + { "trigger": "libxml_use_internal_errors", "contents": "libxml_use_internal_errors()" }, + { "trigger": "link", "contents": "link(${1:target}, ${2:link})" }, + { "trigger": "linkinfo", "contents": "linkinfo(${1:path})" }, + { "trigger": "list", "contents": "list(${1:varname})" }, + { "trigger": "localeconv", "contents": "localeconv()" }, + { "trigger": "localtime", "contents": "localtime()" }, + { "trigger": "log", "contents": "log(${1:arg})" }, + { "trigger": "log10", "contents": "log10(${1:arg})" }, + { "trigger": "log1p", "contents": "log1p(${1:number})" }, + { "trigger": "long2ip", "contents": "long2ip(${1:proper_address})" }, + { "trigger": "lstat", "contents": "lstat(${1:filename})" }, + { "trigger": "ltrim", "contents": "ltrim(${1:str})" }, + { "trigger": "lzf_compress", "contents": "lzf_compress(${1:data})" }, + { "trigger": "lzf_decompress", "contents": "lzf_decompress(${1:data})" }, + { "trigger": "lzf_optimized_for", "contents": "lzf_optimized_for()" }, + { "trigger": "m_checkstatus", "contents": "m_checkstatus(${1:conn}, ${2:identifier})" }, + { "trigger": "m_completeauthorizations", "contents": "m_completeauthorizations(${1:conn}, ${2:array})" }, + { "trigger": "m_connect", "contents": "m_connect(${1:conn})" }, + { "trigger": "m_connectionerror", "contents": "m_connectionerror(${1:conn})" }, + { "trigger": "m_deletetrans", "contents": "m_deletetrans(${1:conn}, ${2:identifier})" }, + { "trigger": "m_destroyconn", "contents": "m_destroyconn(${1:conn})" }, + { "trigger": "m_destroyengine", "contents": "m_destroyengine()" }, + { "trigger": "m_getcell", "contents": "m_getcell(${1:conn}, ${2:identifier}, ${3:column}, ${4:row})" }, + { "trigger": "m_getcellbynum", "contents": "m_getcellbynum(${1:conn}, ${2:identifier}, ${3:column}, ${4:row})" }, + { "trigger": "m_getcommadelimited", "contents": "m_getcommadelimited(${1:conn}, ${2:identifier})" }, + { "trigger": "m_getheader", "contents": "m_getheader(${1:conn}, ${2:identifier}, ${3:column_num})" }, + { "trigger": "m_initconn", "contents": "m_initconn()" }, + { "trigger": "m_initengine", "contents": "m_initengine(${1:location})" }, + { "trigger": "m_iscommadelimited", "contents": "m_iscommadelimited(${1:conn}, ${2:identifier})" }, + { "trigger": "m_maxconntimeout", "contents": "m_maxconntimeout(${1:conn}, ${2:secs})" }, + { "trigger": "m_monitor", "contents": "m_monitor(${1:conn})" }, + { "trigger": "m_numcolumns", "contents": "m_numcolumns(${1:conn}, ${2:identifier})" }, + { "trigger": "m_numrows", "contents": "m_numrows(${1:conn}, ${2:identifier})" }, + { "trigger": "m_parsecommadelimited", "contents": "m_parsecommadelimited(${1:conn}, ${2:identifier})" }, + { "trigger": "m_responsekeys", "contents": "m_responsekeys(${1:conn}, ${2:identifier})" }, + { "trigger": "m_responseparam", "contents": "m_responseparam(${1:conn}, ${2:identifier}, ${3:key})" }, + { "trigger": "m_returnstatus", "contents": "m_returnstatus(${1:conn}, ${2:identifier})" }, + { "trigger": "m_setblocking", "contents": "m_setblocking(${1:conn}, ${2:tf})" }, + { "trigger": "m_setdropfile", "contents": "m_setdropfile(${1:conn}, ${2:directory})" }, + { "trigger": "m_setip", "contents": "m_setip(${1:conn}, ${2:host}, ${3:port})" }, + { "trigger": "m_setssl", "contents": "m_setssl(${1:conn}, ${2:host}, ${3:port})" }, + { "trigger": "m_setssl_cafile", "contents": "m_setssl_cafile(${1:conn}, ${2:cafile})" }, + { "trigger": "m_setssl_files", "contents": "m_setssl_files(${1:conn}, ${2:sslkeyfile}, ${3:sslcertfile})" }, + { "trigger": "m_settimeout", "contents": "m_settimeout(${1:conn}, ${2:seconds})" }, + { "trigger": "m_sslcert_gen_hash", "contents": "m_sslcert_gen_hash(${1:filename})" }, + { "trigger": "m_transactionssent", "contents": "m_transactionssent(${1:conn})" }, + { "trigger": "m_transinqueue", "contents": "m_transinqueue(${1:conn})" }, + { "trigger": "m_transkeyval", "contents": "m_transkeyval(${1:conn}, ${2:identifier}, ${3:key}, ${4:value})" }, + { "trigger": "m_transnew", "contents": "m_transnew(${1:conn})" }, + { "trigger": "m_transsend", "contents": "m_transsend(${1:conn}, ${2:identifier})" }, + { "trigger": "m_uwait", "contents": "m_uwait(${1:microsecs})" }, + { "trigger": "m_validateidentifier", "contents": "m_validateidentifier(${1:conn}, ${2:tf})" }, + { "trigger": "m_verifyconnection", "contents": "m_verifyconnection(${1:conn}, ${2:tf})" }, + { "trigger": "m_verifysslcert", "contents": "m_verifysslcert(${1:conn}, ${2:tf})" }, + { "trigger": "magic_quotes_runtime", "contents": "magic_quotes_runtime()" }, + { "trigger": "mail", "contents": "mail(${1:to}, ${2:subject}, ${3:message})" }, + { "trigger": "mailparse_determine_best_xfer_encoding", "contents": "mailparse_determine_best_xfer_encoding(${1:fp})" }, + { "trigger": "mailparse_msg_create", "contents": "mailparse_msg_create()" }, + { "trigger": "mailparse_msg_extract_part", "contents": "mailparse_msg_extract_part(${1:mimemail}, ${2:msgbody})" }, + { "trigger": "mailparse_msg_extract_part_file", "contents": "mailparse_msg_extract_part_file(${1:mimemail}, ${2:filename})" }, + { "trigger": "mailparse_msg_extract_whole_part_file", "contents": "mailparse_msg_extract_whole_part_file(${1:mimemail}, ${2:filename})" }, + { "trigger": "mailparse_msg_free", "contents": "mailparse_msg_free(${1:mimemail})" }, + { "trigger": "mailparse_msg_get_part", "contents": "mailparse_msg_get_part(${1:mimemail}, ${2:mimesection})" }, + { "trigger": "mailparse_msg_get_part_data", "contents": "mailparse_msg_get_part_data(${1:mimemail})" }, + { "trigger": "mailparse_msg_get_structure", "contents": "mailparse_msg_get_structure(${1:mimemail})" }, + { "trigger": "mailparse_msg_parse", "contents": "mailparse_msg_parse(${1:mimemail}, ${2:data})" }, + { "trigger": "mailparse_msg_parse_file", "contents": "mailparse_msg_parse_file(${1:filename})" }, + { "trigger": "mailparse_rfc822_parse_addresses", "contents": "mailparse_rfc822_parse_addresses(${1:addresses})" }, + { "trigger": "mailparse_stream_encode", "contents": "mailparse_stream_encode(${1:sourcefp}, ${2:destfp}, ${3:encoding})" }, + { "trigger": "mailparse_uudecode_all", "contents": "mailparse_uudecode_all(${1:fp})" }, + { "trigger": "main", "contents": "main()" }, + { "trigger": "max", "contents": "max(${1:values})" }, + { "trigger": "maxdb_bind_param", "contents": "maxdb_bind_param()" }, + { "trigger": "maxdb_bind_result", "contents": "maxdb_bind_result()" }, + { "trigger": "maxdb_client_encoding", "contents": "maxdb_client_encoding()" }, + { "trigger": "maxdb_connect_errno", "contents": "maxdb_connect_errno()" }, + { "trigger": "maxdb_connect_error", "contents": "maxdb_connect_error()" }, + { "trigger": "maxdb_debug", "contents": "maxdb_debug(${1:debug})" }, + { "trigger": "maxdb_disable_rpl_parse", "contents": "maxdb_disable_rpl_parse(${1:link})" }, + { "trigger": "maxdb_dump_debug_info", "contents": "maxdb_dump_debug_info(${1:link})" }, + { "trigger": "maxdb_embedded_connect", "contents": "maxdb_embedded_connect()" }, + { "trigger": "maxdb_enable_reads_from_master", "contents": "maxdb_enable_reads_from_master(${1:link})" }, + { "trigger": "maxdb_enable_rpl_parse", "contents": "maxdb_enable_rpl_parse(${1:link})" }, + { "trigger": "maxdb_escape_string", "contents": "maxdb_escape_string()" }, + { "trigger": "maxdb_execute", "contents": "maxdb_execute()" }, + { "trigger": "maxdb_fetch", "contents": "maxdb_fetch()" }, + { "trigger": "maxdb_get_client_info", "contents": "maxdb_get_client_info()" }, + { "trigger": "maxdb_get_client_version", "contents": "maxdb_get_client_version()" }, + { "trigger": "maxdb_get_metadata", "contents": "maxdb_get_metadata()" }, + { "trigger": "maxdb_init", "contents": "maxdb_init()" }, + { "trigger": "maxdb_master_query", "contents": "maxdb_master_query(${1:link}, ${2:query})" }, + { "trigger": "maxdb_param_count", "contents": "maxdb_param_count()" }, + { "trigger": "maxdb_report", "contents": "maxdb_report(${1:flags})" }, + { "trigger": "maxdb_rpl_parse_enabled", "contents": "maxdb_rpl_parse_enabled(${1:link})" }, + { "trigger": "maxdb_rpl_probe", "contents": "maxdb_rpl_probe(${1:link})" }, + { "trigger": "maxdb_send_long_data", "contents": "maxdb_send_long_data()" }, + { "trigger": "maxdb_server_end", "contents": "maxdb_server_end()" }, + { "trigger": "maxdb_server_init", "contents": "maxdb_server_init()" }, + { "trigger": "maxdb_set_opt", "contents": "maxdb_set_opt()" }, + { "trigger": "maxdb_stmt_sqlstate", "contents": "maxdb_stmt_sqlstate(${1:stmt})" }, + { "trigger": "maxdb_thread_safe", "contents": "maxdb_thread_safe()" }, + { "trigger": "mb_check_encoding", "contents": "mb_check_encoding()" }, + { "trigger": "mb_convert_case", "contents": "mb_convert_case(${1:str}, ${2:mode = MB_CASE_UPPER})" }, + { "trigger": "mb_convert_encoding", "contents": "mb_convert_encoding(${1:str}, ${2:to_encoding})" }, + { "trigger": "mb_convert_kana", "contents": "mb_convert_kana(${1:str})" }, + { "trigger": "mb_convert_variables", "contents": "mb_convert_variables(${1:to_encoding}, ${2:from_encoding}, ${3:vars})" }, + { "trigger": "mb_decode_mimeheader", "contents": "mb_decode_mimeheader(${1:str})" }, + { "trigger": "mb_decode_numericentity", "contents": "mb_decode_numericentity(${1:str}, ${2:convmap}, ${3:encoding})" }, + { "trigger": "mb_detect_encoding", "contents": "mb_detect_encoding(${1:str})" }, + { "trigger": "mb_detect_order", "contents": "mb_detect_order()" }, + { "trigger": "mb_encode_mimeheader", "contents": "mb_encode_mimeheader(${1:str})" }, + { "trigger": "mb_encode_numericentity", "contents": "mb_encode_numericentity(${1:str}, ${2:convmap}, ${3:encoding})" }, + { "trigger": "mb_encoding_aliases", "contents": "mb_encoding_aliases(${1:encoding})" }, + { "trigger": "mb_ereg", "contents": "mb_ereg(${1:pattern}, ${2:string})" }, + { "trigger": "mb_ereg_match", "contents": "mb_ereg_match(${1:pattern}, ${2:string})" }, + { "trigger": "mb_ereg_replace", "contents": "mb_ereg_replace(${1:pattern}, ${2:replacement}, ${3:string})" }, + { "trigger": "mb_ereg_search", "contents": "mb_ereg_search()" }, + { "trigger": "mb_ereg_search_getpos", "contents": "mb_ereg_search_getpos()" }, + { "trigger": "mb_ereg_search_getregs", "contents": "mb_ereg_search_getregs()" }, + { "trigger": "mb_ereg_search_init", "contents": "mb_ereg_search_init(${1:string})" }, + { "trigger": "mb_ereg_search_pos", "contents": "mb_ereg_search_pos()" }, + { "trigger": "mb_ereg_search_regs", "contents": "mb_ereg_search_regs()" }, + { "trigger": "mb_ereg_search_setpos", "contents": "mb_ereg_search_setpos(${1:position})" }, + { "trigger": "mb_eregi", "contents": "mb_eregi(${1:pattern}, ${2:string})" }, + { "trigger": "mb_eregi_replace", "contents": "mb_eregi_replace(${1:pattern}, ${2:replace}, ${3:string})" }, + { "trigger": "mb_get_info", "contents": "mb_get_info()" }, + { "trigger": "mb_http_input", "contents": "mb_http_input()" }, + { "trigger": "mb_http_output", "contents": "mb_http_output()" }, + { "trigger": "mb_internal_encoding", "contents": "mb_internal_encoding()" }, + { "trigger": "mb_language", "contents": "mb_language()" }, + { "trigger": "mb_list_encodings", "contents": "mb_list_encodings()" }, + { "trigger": "mb_output_handler", "contents": "mb_output_handler(${1:contents}, ${2:status})" }, + { "trigger": "mb_parse_str", "contents": "mb_parse_str(${1:encoded_string})" }, + { "trigger": "mb_preferred_mime_name", "contents": "mb_preferred_mime_name(${1:encoding})" }, + { "trigger": "mb_regex_encoding", "contents": "mb_regex_encoding()" }, + { "trigger": "mb_regex_set_options", "contents": "mb_regex_set_options()" }, + { "trigger": "mb_send_mail", "contents": "mb_send_mail(${1:to}, ${2:subject}, ${3:message})" }, + { "trigger": "mb_split", "contents": "mb_split(${1:pattern}, ${2:string})" }, + { "trigger": "mb_strcut", "contents": "mb_strcut(${1:str}, ${2:start})" }, + { "trigger": "mb_strimwidth", "contents": "mb_strimwidth(${1:str}, ${2:start}, ${3:width})" }, + { "trigger": "mb_stripos", "contents": "mb_stripos(${1:haystack}, ${2:needle})" }, + { "trigger": "mb_stristr", "contents": "mb_stristr(${1:haystack}, ${2:needle})" }, + { "trigger": "mb_strlen", "contents": "mb_strlen(${1:str})" }, + { "trigger": "mb_strpos", "contents": "mb_strpos(${1:haystack}, ${2:needle})" }, + { "trigger": "mb_strrchr", "contents": "mb_strrchr(${1:haystack}, ${2:needle})" }, + { "trigger": "mb_strrichr", "contents": "mb_strrichr(${1:haystack}, ${2:needle})" }, + { "trigger": "mb_strripos", "contents": "mb_strripos(${1:haystack}, ${2:needle})" }, + { "trigger": "mb_strrpos", "contents": "mb_strrpos(${1:haystack}, ${2:needle})" }, + { "trigger": "mb_strstr", "contents": "mb_strstr(${1:haystack}, ${2:needle})" }, + { "trigger": "mb_strtolower", "contents": "mb_strtolower(${1:str})" }, + { "trigger": "mb_strtoupper", "contents": "mb_strtoupper(${1:str})" }, + { "trigger": "mb_strwidth", "contents": "mb_strwidth(${1:str})" }, + { "trigger": "mb_substitute_character", "contents": "mb_substitute_character()" }, + { "trigger": "mb_substr", "contents": "mb_substr(${1:str}, ${2:start})" }, + { "trigger": "mb_substr_count", "contents": "mb_substr_count(${1:haystack}, ${2:needle})" }, + { "trigger": "mcrypt_cbc", "contents": "mcrypt_cbc(${1:cipher}, ${2:key}, ${3:data}, ${4:mode})" }, + { "trigger": "mcrypt_cfb", "contents": "mcrypt_cfb(${1:cipher}, ${2:key}, ${3:data}, ${4:mode}, ${5:iv})" }, + { "trigger": "mcrypt_create_iv", "contents": "mcrypt_create_iv(${1:size})" }, + { "trigger": "mcrypt_decrypt", "contents": "mcrypt_decrypt(${1:cipher}, ${2:key}, ${3:data}, ${4:mode})" }, + { "trigger": "mcrypt_ecb", "contents": "mcrypt_ecb(${1:cipher}, ${2:key}, ${3:data}, ${4:mode})" }, + { "trigger": "mcrypt_enc_get_algorithms_name", "contents": "mcrypt_enc_get_algorithms_name(${1:td})" }, + { "trigger": "mcrypt_enc_get_block_size", "contents": "mcrypt_enc_get_block_size(${1:td})" }, + { "trigger": "mcrypt_enc_get_iv_size", "contents": "mcrypt_enc_get_iv_size(${1:td})" }, + { "trigger": "mcrypt_enc_get_key_size", "contents": "mcrypt_enc_get_key_size(${1:td})" }, + { "trigger": "mcrypt_enc_get_modes_name", "contents": "mcrypt_enc_get_modes_name(${1:td})" }, + { "trigger": "mcrypt_enc_get_supported_key_sizes", "contents": "mcrypt_enc_get_supported_key_sizes(${1:td})" }, + { "trigger": "mcrypt_enc_is_block_algorithm", "contents": "mcrypt_enc_is_block_algorithm(${1:td})" }, + { "trigger": "mcrypt_enc_is_block_algorithm_mode", "contents": "mcrypt_enc_is_block_algorithm_mode(${1:td})" }, + { "trigger": "mcrypt_enc_is_block_mode", "contents": "mcrypt_enc_is_block_mode(${1:td})" }, + { "trigger": "mcrypt_enc_self_test", "contents": "mcrypt_enc_self_test(${1:td})" }, + { "trigger": "mcrypt_encrypt", "contents": "mcrypt_encrypt(${1:cipher}, ${2:key}, ${3:data}, ${4:mode})" }, + { "trigger": "mcrypt_generic", "contents": "mcrypt_generic(${1:td}, ${2:data})" }, + { "trigger": "mcrypt_generic_deinit", "contents": "mcrypt_generic_deinit(${1:td})" }, + { "trigger": "mcrypt_generic_end", "contents": "mcrypt_generic_end(${1:td})" }, + { "trigger": "mcrypt_generic_init", "contents": "mcrypt_generic_init(${1:td}, ${2:key}, ${3:iv})" }, + { "trigger": "mcrypt_get_block_size", "contents": "mcrypt_get_block_size(${1:cipher})" }, + { "trigger": "mcrypt_get_cipher_name", "contents": "mcrypt_get_cipher_name(${1:cipher})" }, + { "trigger": "mcrypt_get_iv_size", "contents": "mcrypt_get_iv_size(${1:cipher}, ${2:mode})" }, + { "trigger": "mcrypt_get_key_size", "contents": "mcrypt_get_key_size(${1:cipher})" }, + { "trigger": "mcrypt_list_algorithms", "contents": "mcrypt_list_algorithms()" }, + { "trigger": "mcrypt_list_modes", "contents": "mcrypt_list_modes()" }, + { "trigger": "mcrypt_module_close", "contents": "mcrypt_module_close(${1:td})" }, + { "trigger": "mcrypt_module_get_algo_block_size", "contents": "mcrypt_module_get_algo_block_size(${1:algorithm})" }, + { "trigger": "mcrypt_module_get_algo_key_size", "contents": "mcrypt_module_get_algo_key_size(${1:algorithm})" }, + { "trigger": "mcrypt_module_get_supported_key_sizes", "contents": "mcrypt_module_get_supported_key_sizes(${1:algorithm})" }, + { "trigger": "mcrypt_module_is_block_algorithm", "contents": "mcrypt_module_is_block_algorithm(${1:algorithm})" }, + { "trigger": "mcrypt_module_is_block_algorithm_mode", "contents": "mcrypt_module_is_block_algorithm_mode(${1:mode})" }, + { "trigger": "mcrypt_module_is_block_mode", "contents": "mcrypt_module_is_block_mode(${1:mode})" }, + { "trigger": "mcrypt_module_open", "contents": "mcrypt_module_open(${1:algorithm}, ${2:algorithm_directory}, ${3:mode}, ${4:mode_directory})" }, + { "trigger": "mcrypt_module_self_test", "contents": "mcrypt_module_self_test(${1:algorithm})" }, + { "trigger": "mcrypt_ofb", "contents": "mcrypt_ofb(${1:cipher}, ${2:key}, ${3:data}, ${4:mode}, ${5:iv})" }, + { "trigger": "md5", "contents": "md5(${1:str})" }, + { "trigger": "md5_file", "contents": "md5_file(${1:filename})" }, + { "trigger": "mdecrypt_generic", "contents": "mdecrypt_generic(${1:td}, ${2:data})" }, + { "trigger": "memcache_debug", "contents": "memcache_debug(${1:on_off})" }, + { "trigger": "memory_get_peak_usage", "contents": "memory_get_peak_usage()" }, + { "trigger": "memory_get_usage", "contents": "memory_get_usage()" }, + { "trigger": "metaphone", "contents": "metaphone(${1:str})" }, + { "trigger": "method_exists", "contents": "method_exists(${1:object}, ${2:method_name})" }, + { "trigger": "mhash", "contents": "mhash(${1:hash}, ${2:data})" }, + { "trigger": "mhash_count", "contents": "mhash_count()" }, + { "trigger": "mhash_get_block_size", "contents": "mhash_get_block_size(${1:hash})" }, + { "trigger": "mhash_get_hash_name", "contents": "mhash_get_hash_name(${1:hash})" }, + { "trigger": "mhash_keygen_s2k", "contents": "mhash_keygen_s2k(${1:hash}, ${2:password}, ${3:salt}, ${4:bytes})" }, + { "trigger": "microtime", "contents": "microtime()" }, + { "trigger": "mime_content_type", "contents": "mime_content_type(${1:filename})" }, + { "trigger": "min", "contents": "min(${1:values})" }, + { "trigger": "ming_keypress", "contents": "ming_keypress(${1:char})" }, + { "trigger": "ming_setcubicthreshold", "contents": "ming_setcubicthreshold(${1:threshold})" }, + { "trigger": "ming_setscale", "contents": "ming_setscale(${1:scale})" }, + { "trigger": "ming_setswfcompression", "contents": "ming_setswfcompression(${1:level})" }, + { "trigger": "ming_useconstants", "contents": "ming_useconstants(${1:use})" }, + { "trigger": "ming_useswfversion", "contents": "ming_useswfversion(${1:version})" }, + { "trigger": "mkdir", "contents": "mkdir(${1:pathname})" }, + { "trigger": "mktime", "contents": "mktime()" }, + { "trigger": "money_format", "contents": "money_format(${1:format}, ${2:number})" }, + { "trigger": "move_uploaded_file", "contents": "move_uploaded_file(${1:filename}, ${2:destination})" }, + { "trigger": "mqseries_back", "contents": "mqseries_back(${1:hconn}, ${2:compCode}, ${3:reason})" }, + { "trigger": "mqseries_begin", "contents": "mqseries_begin(${1:hconn}, ${2:beginOptions}, ${3:compCode}, ${4:reason})" }, + { "trigger": "mqseries_close", "contents": "mqseries_close(${1:hconn}, ${2:hobj}, ${3:options}, ${4:compCode}, ${5:reason})" }, + { "trigger": "mqseries_cmit", "contents": "mqseries_cmit(${1:hconn}, ${2:compCode}, ${3:reason})" }, + { "trigger": "mqseries_conn", "contents": "mqseries_conn(${1:qManagerName}, ${2:hconn}, ${3:compCode}, ${4:reason})" }, + { "trigger": "mqseries_connx", "contents": "mqseries_connx(${1:qManagerName}, ${2:connOptions}, ${3:hconn}, ${4:compCode}, ${5:reason})" }, + { "trigger": "mqseries_disc", "contents": "mqseries_disc(${1:hconn}, ${2:compCode}, ${3:reason})" }, + { "trigger": "mqseries_get", "contents": "mqseries_get(${1:hConn}, ${2:hObj}, ${3:md}, ${4:gmo}, ${5:bufferLength}, ${6:msg}, ${7:data_length}, ${8:compCode}, ${9:reason})" }, + { "trigger": "mqseries_inq", "contents": "mqseries_inq(${1:hconn}, ${2:hobj}, ${3:selectorCount}, ${4:selectors}, ${5:intAttrCount}, ${6:intAttr}, ${7:charAttrLength}, ${8:charAttr}, ${9:compCode}, ${10:reason})" }, + { "trigger": "mqseries_open", "contents": "mqseries_open(${1:hconn}, ${2:objDesc}, ${3:option}, ${4:hobj}, ${5:compCode}, ${6:reason})" }, + { "trigger": "mqseries_put", "contents": "mqseries_put(${1:hConn}, ${2:hObj}, ${3:md}, ${4:pmo}, ${5:message}, ${6:compCode}, ${7:reason})" }, + { "trigger": "mqseries_put1", "contents": "mqseries_put1(${1:hconn}, ${2:objDesc}, ${3:msgDesc}, ${4:pmo}, ${5:buffer}, ${6:compCode}, ${7:reason})" }, + { "trigger": "mqseries_set", "contents": "mqseries_set(${1:hconn}, ${2:hobj}, ${3:selectorcount}, ${4:selectors}, ${5:intattrcount}, ${6:intattrs}, ${7:charattrlength}, ${8:charattrs}, ${9:compCode}, ${10:reason})" }, + { "trigger": "mqseries_strerror", "contents": "mqseries_strerror(${1:reason})" }, + { "trigger": "msession_connect", "contents": "msession_connect(${1:host}, ${2:port})" }, + { "trigger": "msession_count", "contents": "msession_count()" }, + { "trigger": "msession_create", "contents": "msession_create(${1:session})" }, + { "trigger": "msession_destroy", "contents": "msession_destroy(${1:name})" }, + { "trigger": "msession_disconnect", "contents": "msession_disconnect()" }, + { "trigger": "msession_find", "contents": "msession_find(${1:name}, ${2:value})" }, + { "trigger": "msession_get", "contents": "msession_get(${1:session}, ${2:name}, ${3:value})" }, + { "trigger": "msession_get_array", "contents": "msession_get_array(${1:session})" }, + { "trigger": "msession_get_data", "contents": "msession_get_data(${1:session})" }, + { "trigger": "msession_inc", "contents": "msession_inc(${1:session}, ${2:name})" }, + { "trigger": "msession_list", "contents": "msession_list()" }, + { "trigger": "msession_listvar", "contents": "msession_listvar(${1:name})" }, + { "trigger": "msession_lock", "contents": "msession_lock(${1:name})" }, + { "trigger": "msession_plugin", "contents": "msession_plugin(${1:session}, ${2:val})" }, + { "trigger": "msession_randstr", "contents": "msession_randstr(${1:param})" }, + { "trigger": "msession_set", "contents": "msession_set(${1:session}, ${2:name}, ${3:value})" }, + { "trigger": "msession_set_array", "contents": "msession_set_array(${1:session}, ${2:tuples})" }, + { "trigger": "msession_set_data", "contents": "msession_set_data(${1:session}, ${2:value})" }, + { "trigger": "msession_timeout", "contents": "msession_timeout(${1:session})" }, + { "trigger": "msession_uniq", "contents": "msession_uniq(${1:param})" }, + { "trigger": "msession_unlock", "contents": "msession_unlock(${1:session}, ${2:key})" }, + { "trigger": "msg_get_queue", "contents": "msg_get_queue(${1:key})" }, + { "trigger": "msg_queue_exists", "contents": "msg_queue_exists(${1:key})" }, + { "trigger": "msg_receive", "contents": "msg_receive(${1:queue}, ${2:desiredmsgtype}, ${3:msgtype}, ${4:maxsize}, ${5:message})" }, + { "trigger": "msg_remove_queue", "contents": "msg_remove_queue(${1:queue})" }, + { "trigger": "msg_send", "contents": "msg_send(${1:queue}, ${2:msgtype}, ${3:message})" }, + { "trigger": "msg_set_queue", "contents": "msg_set_queue(${1:queue}, ${2:data})" }, + { "trigger": "msg_stat_queue", "contents": "msg_stat_queue(${1:queue})" }, + { "trigger": "msql", "contents": "msql()" }, + { "trigger": "msql_affected_rows", "contents": "msql_affected_rows(${1:result})" }, + { "trigger": "msql_close", "contents": "msql_close()" }, + { "trigger": "msql_connect", "contents": "msql_connect()" }, + { "trigger": "msql_create_db", "contents": "msql_create_db(${1:database_name})" }, + { "trigger": "msql_createdb", "contents": "msql_createdb()" }, + { "trigger": "msql_data_seek", "contents": "msql_data_seek(${1:result}, ${2:row_number})" }, + { "trigger": "msql_db_query", "contents": "msql_db_query(${1:database}, ${2:query})" }, + { "trigger": "msql_dbname", "contents": "msql_dbname()" }, + { "trigger": "msql_drop_db", "contents": "msql_drop_db(${1:database_name})" }, + { "trigger": "msql_error", "contents": "msql_error()" }, + { "trigger": "msql_fetch_array", "contents": "msql_fetch_array(${1:result})" }, + { "trigger": "msql_fetch_field", "contents": "msql_fetch_field(${1:result})" }, + { "trigger": "msql_fetch_object", "contents": "msql_fetch_object(${1:result})" }, + { "trigger": "msql_fetch_row", "contents": "msql_fetch_row(${1:result})" }, + { "trigger": "msql_field_flags", "contents": "msql_field_flags(${1:result}, ${2:field_offset})" }, + { "trigger": "msql_field_len", "contents": "msql_field_len(${1:result}, ${2:field_offset})" }, + { "trigger": "msql_field_name", "contents": "msql_field_name(${1:result}, ${2:field_offset})" }, + { "trigger": "msql_field_seek", "contents": "msql_field_seek(${1:result}, ${2:field_offset})" }, + { "trigger": "msql_field_table", "contents": "msql_field_table(${1:result}, ${2:field_offset})" }, + { "trigger": "msql_field_type", "contents": "msql_field_type(${1:result}, ${2:field_offset})" }, + { "trigger": "msql_fieldflags", "contents": "msql_fieldflags()" }, + { "trigger": "msql_fieldlen", "contents": "msql_fieldlen()" }, + { "trigger": "msql_fieldname", "contents": "msql_fieldname()" }, + { "trigger": "msql_fieldtable", "contents": "msql_fieldtable()" }, + { "trigger": "msql_fieldtype", "contents": "msql_fieldtype()" }, + { "trigger": "msql_free_result", "contents": "msql_free_result(${1:result})" }, + { "trigger": "msql_list_dbs", "contents": "msql_list_dbs()" }, + { "trigger": "msql_list_fields", "contents": "msql_list_fields(${1:database}, ${2:tablename})" }, + { "trigger": "msql_list_tables", "contents": "msql_list_tables(${1:database})" }, + { "trigger": "msql_num_fields", "contents": "msql_num_fields(${1:result})" }, + { "trigger": "msql_num_rows", "contents": "msql_num_rows(${1:query_identifier})" }, + { "trigger": "msql_numfields", "contents": "msql_numfields()" }, + { "trigger": "msql_numrows", "contents": "msql_numrows()" }, + { "trigger": "msql_pconnect", "contents": "msql_pconnect()" }, + { "trigger": "msql_query", "contents": "msql_query(${1:query})" }, + { "trigger": "msql_regcase", "contents": "msql_regcase()" }, + { "trigger": "msql_result", "contents": "msql_result(${1:result}, ${2:row})" }, + { "trigger": "msql_select_db", "contents": "msql_select_db(${1:database_name})" }, + { "trigger": "msql_tablename", "contents": "msql_tablename()" }, + { "trigger": "mssql_bind", "contents": "mssql_bind(${1:stmt}, ${2:param_name}, ${3:var}, ${4:type})" }, + { "trigger": "mssql_close", "contents": "mssql_close()" }, + { "trigger": "mssql_connect", "contents": "mssql_connect()" }, + { "trigger": "mssql_data_seek", "contents": "mssql_data_seek(${1:result_identifier}, ${2:row_number})" }, + { "trigger": "mssql_execute", "contents": "mssql_execute(${1:stmt})" }, + { "trigger": "mssql_fetch_array", "contents": "mssql_fetch_array(${1:result})" }, + { "trigger": "mssql_fetch_assoc", "contents": "mssql_fetch_assoc(${1:result_id})" }, + { "trigger": "mssql_fetch_batch", "contents": "mssql_fetch_batch(${1:result})" }, + { "trigger": "mssql_fetch_field", "contents": "mssql_fetch_field(${1:result})" }, + { "trigger": "mssql_fetch_object", "contents": "mssql_fetch_object(${1:result})" }, + { "trigger": "mssql_fetch_row", "contents": "mssql_fetch_row(${1:result})" }, + { "trigger": "mssql_field_length", "contents": "mssql_field_length(${1:result})" }, + { "trigger": "mssql_field_name", "contents": "mssql_field_name(${1:result})" }, + { "trigger": "mssql_field_seek", "contents": "mssql_field_seek(${1:result}, ${2:field_offset})" }, + { "trigger": "mssql_field_type", "contents": "mssql_field_type(${1:result})" }, + { "trigger": "mssql_free_result", "contents": "mssql_free_result(${1:result})" }, + { "trigger": "mssql_free_statement", "contents": "mssql_free_statement(${1:stmt})" }, + { "trigger": "mssql_get_last_message", "contents": "mssql_get_last_message()" }, + { "trigger": "mssql_guid_string", "contents": "mssql_guid_string(${1:binary})" }, + { "trigger": "mssql_init", "contents": "mssql_init(${1:sp_name})" }, + { "trigger": "mssql_min_error_severity", "contents": "mssql_min_error_severity(${1:severity})" }, + { "trigger": "mssql_min_message_severity", "contents": "mssql_min_message_severity(${1:severity})" }, + { "trigger": "mssql_next_result", "contents": "mssql_next_result(${1:result_id})" }, + { "trigger": "mssql_num_fields", "contents": "mssql_num_fields(${1:result})" }, + { "trigger": "mssql_num_rows", "contents": "mssql_num_rows(${1:result})" }, + { "trigger": "mssql_pconnect", "contents": "mssql_pconnect()" }, + { "trigger": "mssql_query", "contents": "mssql_query(${1:query})" }, + { "trigger": "mssql_result", "contents": "mssql_result(${1:result}, ${2:row}, ${3:field})" }, + { "trigger": "mssql_rows_affected", "contents": "mssql_rows_affected(${1:link_identifier})" }, + { "trigger": "mssql_select_db", "contents": "mssql_select_db(${1:database_name})" }, + { "trigger": "mt_getrandmax", "contents": "mt_getrandmax()" }, + { "trigger": "mt_rand", "contents": "mt_rand()" }, + { "trigger": "mt_srand", "contents": "mt_srand()" }, + { "trigger": "mysql_affected_rows", "contents": "mysql_affected_rows()" }, + { "trigger": "mysql_client_encoding", "contents": "mysql_client_encoding()" }, + { "trigger": "mysql_close", "contents": "mysql_close()" }, + { "trigger": "mysql_connect", "contents": "mysql_connect()" }, + { "trigger": "mysql_create_db", "contents": "mysql_create_db(${1:database_name})" }, + { "trigger": "mysql_data_seek", "contents": "mysql_data_seek(${1:result}, ${2:row_number})" }, + { "trigger": "mysql_db_name", "contents": "mysql_db_name(${1:result}, ${2:row})" }, + { "trigger": "mysql_db_query", "contents": "mysql_db_query(${1:database}, ${2:query})" }, + { "trigger": "mysql_drop_db", "contents": "mysql_drop_db(${1:database_name})" }, + { "trigger": "mysql_errno", "contents": "mysql_errno()" }, + { "trigger": "mysql_error", "contents": "mysql_error()" }, + { "trigger": "mysql_escape_string", "contents": "mysql_escape_string(${1:unescaped_string})" }, + { "trigger": "mysql_fetch_array", "contents": "mysql_fetch_array(${1:result})" }, + { "trigger": "mysql_fetch_assoc", "contents": "mysql_fetch_assoc(${1:result})" }, + { "trigger": "mysql_fetch_field", "contents": "mysql_fetch_field(${1:result})" }, + { "trigger": "mysql_fetch_lengths", "contents": "mysql_fetch_lengths(${1:result})" }, + { "trigger": "mysql_fetch_object", "contents": "mysql_fetch_object(${1:result})" }, + { "trigger": "mysql_fetch_row", "contents": "mysql_fetch_row(${1:result})" }, + { "trigger": "mysql_field_flags", "contents": "mysql_field_flags(${1:result}, ${2:field_offset})" }, + { "trigger": "mysql_field_len", "contents": "mysql_field_len(${1:result}, ${2:field_offset})" }, + { "trigger": "mysql_field_name", "contents": "mysql_field_name(${1:result}, ${2:field_offset})" }, + { "trigger": "mysql_field_seek", "contents": "mysql_field_seek(${1:result}, ${2:field_offset})" }, + { "trigger": "mysql_field_table", "contents": "mysql_field_table(${1:result}, ${2:field_offset})" }, + { "trigger": "mysql_field_type", "contents": "mysql_field_type(${1:result}, ${2:field_offset})" }, + { "trigger": "mysql_free_result", "contents": "mysql_free_result(${1:result})" }, + { "trigger": "mysql_get_client_info", "contents": "mysql_get_client_info()" }, + { "trigger": "mysql_get_host_info", "contents": "mysql_get_host_info()" }, + { "trigger": "mysql_get_proto_info", "contents": "mysql_get_proto_info()" }, + { "trigger": "mysql_get_server_info", "contents": "mysql_get_server_info()" }, + { "trigger": "mysql_info", "contents": "mysql_info()" }, + { "trigger": "mysql_insert_id", "contents": "mysql_insert_id()" }, + { "trigger": "mysql_list_dbs", "contents": "mysql_list_dbs()" }, + { "trigger": "mysql_list_fields", "contents": "mysql_list_fields(${1:database_name}, ${2:table_name})" }, + { "trigger": "mysql_list_processes", "contents": "mysql_list_processes()" }, + { "trigger": "mysql_list_tables", "contents": "mysql_list_tables(${1:database})" }, + { "trigger": "mysql_num_fields", "contents": "mysql_num_fields(${1:result})" }, + { "trigger": "mysql_num_rows", "contents": "mysql_num_rows(${1:result})" }, + { "trigger": "mysql_pconnect", "contents": "mysql_pconnect()" }, + { "trigger": "mysql_ping", "contents": "mysql_ping()" }, + { "trigger": "mysql_query", "contents": "mysql_query(${1:query})" }, + { "trigger": "mysql_real_escape_string", "contents": "mysql_real_escape_string(${1:unescaped_string})" }, + { "trigger": "mysql_result", "contents": "mysql_result(${1:result}, ${2:row})" }, + { "trigger": "mysql_select_db", "contents": "mysql_select_db(${1:database_name})" }, + { "trigger": "mysql_set_charset", "contents": "mysql_set_charset(${1:charset})" }, + { "trigger": "mysql_stat", "contents": "mysql_stat()" }, + { "trigger": "mysql_tablename", "contents": "mysql_tablename(${1:result}, ${2:i})" }, + { "trigger": "mysql_thread_id", "contents": "mysql_thread_id()" }, + { "trigger": "mysql_unbuffered_query", "contents": "mysql_unbuffered_query(${1:query})" }, + { "trigger": "mysqli_bind_param", "contents": "mysqli_bind_param()" }, + { "trigger": "mysqli_bind_result", "contents": "mysqli_bind_result()" }, + { "trigger": "mysqli_client_encoding", "contents": "mysqli_client_encoding()" }, + { "trigger": "mysqli_connect", "contents": "mysqli_connect()" }, + { "trigger": "mysqli_disable_rpl_parse", "contents": "mysqli_disable_rpl_parse(${1:link})" }, + { "trigger": "mysqli_enable_reads_from_master", "contents": "mysqli_enable_reads_from_master(${1:link})" }, + { "trigger": "mysqli_enable_rpl_parse", "contents": "mysqli_enable_rpl_parse(${1:link})" }, + { "trigger": "mysqli_escape_string", "contents": "mysqli_escape_string()" }, + { "trigger": "mysqli_execute", "contents": "mysqli_execute()" }, + { "trigger": "mysqli_fetch", "contents": "mysqli_fetch()" }, + { "trigger": "mysqli_get_metadata", "contents": "mysqli_get_metadata()" }, + { "trigger": "mysqli_master_query", "contents": "mysqli_master_query(${1:link}, ${2:query})" }, + { "trigger": "mysqli_param_count", "contents": "mysqli_param_count()" }, + { "trigger": "mysqli_report", "contents": "mysqli_report(${1:flags})" }, + { "trigger": "mysqli_rpl_parse_enabled", "contents": "mysqli_rpl_parse_enabled(${1:link})" }, + { "trigger": "mysqli_rpl_probe", "contents": "mysqli_rpl_probe(${1:link})" }, + { "trigger": "mysqli_send_long_data", "contents": "mysqli_send_long_data()" }, + { "trigger": "mysqli_set_opt", "contents": "mysqli_set_opt()" }, + { "trigger": "mysqli_slave_query", "contents": "mysqli_slave_query(${1:link}, ${2:query})" }, + { "trigger": "mysqlnd_qc_change_handler", "contents": "mysqlnd_qc_change_handler(${1:handler})" }, + { "trigger": "mysqlnd_qc_clear_cache", "contents": "mysqlnd_qc_clear_cache()" }, + { "trigger": "mysqlnd_qc_get_cache_info", "contents": "mysqlnd_qc_get_cache_info()" }, + { "trigger": "mysqlnd_qc_get_core_stats", "contents": "mysqlnd_qc_get_core_stats()" }, + { "trigger": "mysqlnd_qc_get_handler", "contents": "mysqlnd_qc_get_handler()" }, + { "trigger": "mysqlnd_qc_get_query_trace_log", "contents": "mysqlnd_qc_get_query_trace_log()" }, + { "trigger": "mysqlnd_qc_set_user_handlers", "contents": "mysqlnd_qc_set_user_handlers(${1:get_hash}, ${2:find_query_in_cache}, ${3:return_to_cache}, ${4:add_query_to_cache_if_not_exists}, ${5:query_is_select}, ${6:update_query_run_time_stats}, ${7:get_stats}, ${8:clear_cache})" }, + { "trigger": "natcasesort", "contents": "natcasesort(${1:array})" }, + { "trigger": "natsort", "contents": "natsort(${1:array})" }, + { "trigger": "ncurses_addch", "contents": "ncurses_addch(${1:ch})" }, + { "trigger": "ncurses_addchnstr", "contents": "ncurses_addchnstr(${1:s}, ${2:n})" }, + { "trigger": "ncurses_addchstr", "contents": "ncurses_addchstr(${1:s})" }, + { "trigger": "ncurses_addnstr", "contents": "ncurses_addnstr(${1:s}, ${2:n})" }, + { "trigger": "ncurses_addstr", "contents": "ncurses_addstr(${1:text})" }, + { "trigger": "ncurses_assume_default_colors", "contents": "ncurses_assume_default_colors(${1:fg}, ${2:bg})" }, + { "trigger": "ncurses_attroff", "contents": "ncurses_attroff(${1:attributes})" }, + { "trigger": "ncurses_attron", "contents": "ncurses_attron(${1:attributes})" }, + { "trigger": "ncurses_attrset", "contents": "ncurses_attrset(${1:attributes})" }, + { "trigger": "ncurses_baudrate", "contents": "ncurses_baudrate()" }, + { "trigger": "ncurses_beep", "contents": "ncurses_beep()" }, + { "trigger": "ncurses_bkgd", "contents": "ncurses_bkgd(${1:attrchar})" }, + { "trigger": "ncurses_bkgdset", "contents": "ncurses_bkgdset(${1:attrchar})" }, + { "trigger": "ncurses_border", "contents": "ncurses_border(${1:left}, ${2:right}, ${3:top}, ${4:bottom}, ${5:tl_corner}, ${6:tr_corner}, ${7:bl_corner}, ${8:br_corner})" }, + { "trigger": "ncurses_bottom_panel", "contents": "ncurses_bottom_panel(${1:panel})" }, + { "trigger": "ncurses_can_change_color", "contents": "ncurses_can_change_color()" }, + { "trigger": "ncurses_cbreak", "contents": "ncurses_cbreak()" }, + { "trigger": "ncurses_clear", "contents": "ncurses_clear()" }, + { "trigger": "ncurses_clrtobot", "contents": "ncurses_clrtobot()" }, + { "trigger": "ncurses_clrtoeol", "contents": "ncurses_clrtoeol()" }, + { "trigger": "ncurses_color_content", "contents": "ncurses_color_content(${1:color}, ${2:r}, ${3:g}, ${4:b})" }, + { "trigger": "ncurses_color_set", "contents": "ncurses_color_set(${1:pair})" }, + { "trigger": "ncurses_curs_set", "contents": "ncurses_curs_set(${1:visibility})" }, + { "trigger": "ncurses_def_prog_mode", "contents": "ncurses_def_prog_mode()" }, + { "trigger": "ncurses_def_shell_mode", "contents": "ncurses_def_shell_mode()" }, + { "trigger": "ncurses_define_key", "contents": "ncurses_define_key(${1:definition}, ${2:keycode})" }, + { "trigger": "ncurses_del_panel", "contents": "ncurses_del_panel(${1:panel})" }, + { "trigger": "ncurses_delay_output", "contents": "ncurses_delay_output(${1:milliseconds})" }, + { "trigger": "ncurses_delch", "contents": "ncurses_delch()" }, + { "trigger": "ncurses_deleteln", "contents": "ncurses_deleteln()" }, + { "trigger": "ncurses_delwin", "contents": "ncurses_delwin(${1:window})" }, + { "trigger": "ncurses_doupdate", "contents": "ncurses_doupdate()" }, + { "trigger": "ncurses_echo", "contents": "ncurses_echo()" }, + { "trigger": "ncurses_echochar", "contents": "ncurses_echochar(${1:character})" }, + { "trigger": "ncurses_end", "contents": "ncurses_end()" }, + { "trigger": "ncurses_erase", "contents": "ncurses_erase()" }, + { "trigger": "ncurses_erasechar", "contents": "ncurses_erasechar()" }, + { "trigger": "ncurses_filter", "contents": "ncurses_filter()" }, + { "trigger": "ncurses_flash", "contents": "ncurses_flash()" }, + { "trigger": "ncurses_flushinp", "contents": "ncurses_flushinp()" }, + { "trigger": "ncurses_getch", "contents": "ncurses_getch()" }, + { "trigger": "ncurses_getmaxyx", "contents": "ncurses_getmaxyx(${1:window}, ${2:y}, ${3:x})" }, + { "trigger": "ncurses_getmouse", "contents": "ncurses_getmouse(${1:mevent})" }, + { "trigger": "ncurses_getyx", "contents": "ncurses_getyx(${1:window}, ${2:y}, ${3:x})" }, + { "trigger": "ncurses_halfdelay", "contents": "ncurses_halfdelay(${1:tenth})" }, + { "trigger": "ncurses_has_colors", "contents": "ncurses_has_colors()" }, + { "trigger": "ncurses_has_ic", "contents": "ncurses_has_ic()" }, + { "trigger": "ncurses_has_il", "contents": "ncurses_has_il()" }, + { "trigger": "ncurses_has_key", "contents": "ncurses_has_key(${1:keycode})" }, + { "trigger": "ncurses_hide_panel", "contents": "ncurses_hide_panel(${1:panel})" }, + { "trigger": "ncurses_hline", "contents": "ncurses_hline(${1:charattr}, ${2:n})" }, + { "trigger": "ncurses_inch", "contents": "ncurses_inch()" }, + { "trigger": "ncurses_init", "contents": "ncurses_init()" }, + { "trigger": "ncurses_init_color", "contents": "ncurses_init_color(${1:color}, ${2:r}, ${3:g}, ${4:b})" }, + { "trigger": "ncurses_init_pair", "contents": "ncurses_init_pair(${1:pair}, ${2:fg}, ${3:bg})" }, + { "trigger": "ncurses_insch", "contents": "ncurses_insch(${1:character})" }, + { "trigger": "ncurses_insdelln", "contents": "ncurses_insdelln(${1:count})" }, + { "trigger": "ncurses_insertln", "contents": "ncurses_insertln()" }, + { "trigger": "ncurses_insstr", "contents": "ncurses_insstr(${1:text})" }, + { "trigger": "ncurses_instr", "contents": "ncurses_instr(${1:buffer})" }, + { "trigger": "ncurses_isendwin", "contents": "ncurses_isendwin()" }, + { "trigger": "ncurses_keyok", "contents": "ncurses_keyok(${1:keycode}, ${2:enable})" }, + { "trigger": "ncurses_keypad", "contents": "ncurses_keypad(${1:window}, ${2:bf})" }, + { "trigger": "ncurses_killchar", "contents": "ncurses_killchar()" }, + { "trigger": "ncurses_longname", "contents": "ncurses_longname()" }, + { "trigger": "ncurses_meta", "contents": "ncurses_meta(${1:window}, ${2:8bit})" }, + { "trigger": "ncurses_mouse_trafo", "contents": "ncurses_mouse_trafo(${1:y}, ${2:x}, ${3:toscreen})" }, + { "trigger": "ncurses_mouseinterval", "contents": "ncurses_mouseinterval(${1:milliseconds})" }, + { "trigger": "ncurses_mousemask", "contents": "ncurses_mousemask(${1:newmask}, ${2:oldmask})" }, + { "trigger": "ncurses_move", "contents": "ncurses_move(${1:y}, ${2:x})" }, + { "trigger": "ncurses_move_panel", "contents": "ncurses_move_panel(${1:panel}, ${2:startx}, ${3:starty})" }, + { "trigger": "ncurses_mvaddch", "contents": "ncurses_mvaddch(${1:y}, ${2:x}, ${3:c})" }, + { "trigger": "ncurses_mvaddchnstr", "contents": "ncurses_mvaddchnstr(${1:y}, ${2:x}, ${3:s}, ${4:n})" }, + { "trigger": "ncurses_mvaddchstr", "contents": "ncurses_mvaddchstr(${1:y}, ${2:x}, ${3:s})" }, + { "trigger": "ncurses_mvaddnstr", "contents": "ncurses_mvaddnstr(${1:y}, ${2:x}, ${3:s}, ${4:n})" }, + { "trigger": "ncurses_mvaddstr", "contents": "ncurses_mvaddstr(${1:y}, ${2:x}, ${3:s})" }, + { "trigger": "ncurses_mvcur", "contents": "ncurses_mvcur(${1:old_y}, ${2:old_x}, ${3:new_y}, ${4:new_x})" }, + { "trigger": "ncurses_mvdelch", "contents": "ncurses_mvdelch(${1:y}, ${2:x})" }, + { "trigger": "ncurses_mvgetch", "contents": "ncurses_mvgetch(${1:y}, ${2:x})" }, + { "trigger": "ncurses_mvhline", "contents": "ncurses_mvhline(${1:y}, ${2:x}, ${3:attrchar}, ${4:n})" }, + { "trigger": "ncurses_mvinch", "contents": "ncurses_mvinch(${1:y}, ${2:x})" }, + { "trigger": "ncurses_mvvline", "contents": "ncurses_mvvline(${1:y}, ${2:x}, ${3:attrchar}, ${4:n})" }, + { "trigger": "ncurses_mvwaddstr", "contents": "ncurses_mvwaddstr(${1:window}, ${2:y}, ${3:x}, ${4:text})" }, + { "trigger": "ncurses_napms", "contents": "ncurses_napms(${1:milliseconds})" }, + { "trigger": "ncurses_new_panel", "contents": "ncurses_new_panel(${1:window})" }, + { "trigger": "ncurses_newpad", "contents": "ncurses_newpad(${1:rows}, ${2:cols})" }, + { "trigger": "ncurses_newwin", "contents": "ncurses_newwin(${1:rows}, ${2:cols}, ${3:y}, ${4:x})" }, + { "trigger": "ncurses_nl", "contents": "ncurses_nl()" }, + { "trigger": "ncurses_nocbreak", "contents": "ncurses_nocbreak()" }, + { "trigger": "ncurses_noecho", "contents": "ncurses_noecho()" }, + { "trigger": "ncurses_nonl", "contents": "ncurses_nonl()" }, + { "trigger": "ncurses_noqiflush", "contents": "ncurses_noqiflush()" }, + { "trigger": "ncurses_noraw", "contents": "ncurses_noraw()" }, + { "trigger": "ncurses_pair_content", "contents": "ncurses_pair_content(${1:pair}, ${2:f}, ${3:b})" }, + { "trigger": "ncurses_panel_above", "contents": "ncurses_panel_above(${1:panel})" }, + { "trigger": "ncurses_panel_below", "contents": "ncurses_panel_below(${1:panel})" }, + { "trigger": "ncurses_panel_window", "contents": "ncurses_panel_window(${1:panel})" }, + { "trigger": "ncurses_pnoutrefresh", "contents": "ncurses_pnoutrefresh(${1:pad}, ${2:pminrow}, ${3:pmincol}, ${4:sminrow}, ${5:smincol}, ${6:smaxrow}, ${7:smaxcol})" }, + { "trigger": "ncurses_prefresh", "contents": "ncurses_prefresh(${1:pad}, ${2:pminrow}, ${3:pmincol}, ${4:sminrow}, ${5:smincol}, ${6:smaxrow}, ${7:smaxcol})" }, + { "trigger": "ncurses_putp", "contents": "ncurses_putp(${1:text})" }, + { "trigger": "ncurses_qiflush", "contents": "ncurses_qiflush()" }, + { "trigger": "ncurses_raw", "contents": "ncurses_raw()" }, + { "trigger": "ncurses_refresh", "contents": "ncurses_refresh(${1:ch})" }, + { "trigger": "ncurses_replace_panel", "contents": "ncurses_replace_panel(${1:panel}, ${2:window})" }, + { "trigger": "ncurses_reset_prog_mode", "contents": "ncurses_reset_prog_mode()" }, + { "trigger": "ncurses_reset_shell_mode", "contents": "ncurses_reset_shell_mode()" }, + { "trigger": "ncurses_resetty", "contents": "ncurses_resetty()" }, + { "trigger": "ncurses_savetty", "contents": "ncurses_savetty()" }, + { "trigger": "ncurses_scr_dump", "contents": "ncurses_scr_dump(${1:filename})" }, + { "trigger": "ncurses_scr_init", "contents": "ncurses_scr_init(${1:filename})" }, + { "trigger": "ncurses_scr_restore", "contents": "ncurses_scr_restore(${1:filename})" }, + { "trigger": "ncurses_scr_set", "contents": "ncurses_scr_set(${1:filename})" }, + { "trigger": "ncurses_scrl", "contents": "ncurses_scrl(${1:count})" }, + { "trigger": "ncurses_show_panel", "contents": "ncurses_show_panel(${1:panel})" }, + { "trigger": "ncurses_slk_attr", "contents": "ncurses_slk_attr()" }, + { "trigger": "ncurses_slk_attroff", "contents": "ncurses_slk_attroff(${1:intarg})" }, + { "trigger": "ncurses_slk_attron", "contents": "ncurses_slk_attron(${1:intarg})" }, + { "trigger": "ncurses_slk_attrset", "contents": "ncurses_slk_attrset(${1:intarg})" }, + { "trigger": "ncurses_slk_clear", "contents": "ncurses_slk_clear()" }, + { "trigger": "ncurses_slk_color", "contents": "ncurses_slk_color(${1:intarg})" }, + { "trigger": "ncurses_slk_init", "contents": "ncurses_slk_init(${1:format})" }, + { "trigger": "ncurses_slk_noutrefresh", "contents": "ncurses_slk_noutrefresh()" }, + { "trigger": "ncurses_slk_refresh", "contents": "ncurses_slk_refresh()" }, + { "trigger": "ncurses_slk_restore", "contents": "ncurses_slk_restore()" }, + { "trigger": "ncurses_slk_set", "contents": "ncurses_slk_set(${1:labelnr}, ${2:label}, ${3:format})" }, + { "trigger": "ncurses_slk_touch", "contents": "ncurses_slk_touch()" }, + { "trigger": "ncurses_standend", "contents": "ncurses_standend()" }, + { "trigger": "ncurses_standout", "contents": "ncurses_standout()" }, + { "trigger": "ncurses_start_color", "contents": "ncurses_start_color()" }, + { "trigger": "ncurses_termattrs", "contents": "ncurses_termattrs()" }, + { "trigger": "ncurses_termname", "contents": "ncurses_termname()" }, + { "trigger": "ncurses_timeout", "contents": "ncurses_timeout(${1:millisec})" }, + { "trigger": "ncurses_top_panel", "contents": "ncurses_top_panel(${1:panel})" }, + { "trigger": "ncurses_typeahead", "contents": "ncurses_typeahead(${1:fd})" }, + { "trigger": "ncurses_ungetch", "contents": "ncurses_ungetch(${1:keycode})" }, + { "trigger": "ncurses_ungetmouse", "contents": "ncurses_ungetmouse(${1:mevent})" }, + { "trigger": "ncurses_update_panels", "contents": "ncurses_update_panels()" }, + { "trigger": "ncurses_use_default_colors", "contents": "ncurses_use_default_colors()" }, + { "trigger": "ncurses_use_env", "contents": "ncurses_use_env(${1:flag})" }, + { "trigger": "ncurses_use_extended_names", "contents": "ncurses_use_extended_names(${1:flag})" }, + { "trigger": "ncurses_vidattr", "contents": "ncurses_vidattr(${1:intarg})" }, + { "trigger": "ncurses_vline", "contents": "ncurses_vline(${1:charattr}, ${2:n})" }, + { "trigger": "ncurses_waddch", "contents": "ncurses_waddch(${1:window}, ${2:ch})" }, + { "trigger": "ncurses_waddstr", "contents": "ncurses_waddstr(${1:window}, ${2:str})" }, + { "trigger": "ncurses_wattroff", "contents": "ncurses_wattroff(${1:window}, ${2:attrs})" }, + { "trigger": "ncurses_wattron", "contents": "ncurses_wattron(${1:window}, ${2:attrs})" }, + { "trigger": "ncurses_wattrset", "contents": "ncurses_wattrset(${1:window}, ${2:attrs})" }, + { "trigger": "ncurses_wborder", "contents": "ncurses_wborder(${1:window}, ${2:left}, ${3:right}, ${4:top}, ${5:bottom}, ${6:tl_corner}, ${7:tr_corner}, ${8:bl_corner}, ${9:br_corner})" }, + { "trigger": "ncurses_wclear", "contents": "ncurses_wclear(${1:window})" }, + { "trigger": "ncurses_wcolor_set", "contents": "ncurses_wcolor_set(${1:window}, ${2:color_pair})" }, + { "trigger": "ncurses_werase", "contents": "ncurses_werase(${1:window})" }, + { "trigger": "ncurses_wgetch", "contents": "ncurses_wgetch(${1:window})" }, + { "trigger": "ncurses_whline", "contents": "ncurses_whline(${1:window}, ${2:charattr}, ${3:n})" }, + { "trigger": "ncurses_wmouse_trafo", "contents": "ncurses_wmouse_trafo(${1:window}, ${2:y}, ${3:x}, ${4:toscreen})" }, + { "trigger": "ncurses_wmove", "contents": "ncurses_wmove(${1:window}, ${2:y}, ${3:x})" }, + { "trigger": "ncurses_wnoutrefresh", "contents": "ncurses_wnoutrefresh(${1:window})" }, + { "trigger": "ncurses_wrefresh", "contents": "ncurses_wrefresh(${1:window})" }, + { "trigger": "ncurses_wstandend", "contents": "ncurses_wstandend(${1:window})" }, + { "trigger": "ncurses_wstandout", "contents": "ncurses_wstandout(${1:window})" }, + { "trigger": "ncurses_wvline", "contents": "ncurses_wvline(${1:window}, ${2:charattr}, ${3:n})" }, + { "trigger": "newt_bell", "contents": "newt_bell()" }, + { "trigger": "newt_button", "contents": "newt_button(${1:left}, ${2:top}, ${3:text})" }, + { "trigger": "newt_button_bar", "contents": "newt_button_bar(${1:buttons})" }, + { "trigger": "newt_centered_window", "contents": "newt_centered_window(${1:width}, ${2:height})" }, + { "trigger": "newt_checkbox", "contents": "newt_checkbox(${1:left}, ${2:top}, ${3:text}, ${4:def_value})" }, + { "trigger": "newt_checkbox_get_value", "contents": "newt_checkbox_get_value(${1:checkbox})" }, + { "trigger": "newt_checkbox_set_flags", "contents": "newt_checkbox_set_flags(${1:checkbox}, ${2:flags}, ${3:sense})" }, + { "trigger": "newt_checkbox_set_value", "contents": "newt_checkbox_set_value(${1:checkbox}, ${2:value})" }, + { "trigger": "newt_checkbox_tree", "contents": "newt_checkbox_tree(${1:left}, ${2:top}, ${3:height})" }, + { "trigger": "newt_checkbox_tree_add_item", "contents": "newt_checkbox_tree_add_item(${1:checkboxtree}, ${2:text}, ${3:data}, ${4:flags}, ${5:index})" }, + { "trigger": "newt_checkbox_tree_find_item", "contents": "newt_checkbox_tree_find_item(${1:checkboxtree}, ${2:data})" }, + { "trigger": "newt_checkbox_tree_get_current", "contents": "newt_checkbox_tree_get_current(${1:checkboxtree})" }, + { "trigger": "newt_checkbox_tree_get_entry_value", "contents": "newt_checkbox_tree_get_entry_value(${1:checkboxtree}, ${2:data})" }, + { "trigger": "newt_checkbox_tree_get_multi_selection", "contents": "newt_checkbox_tree_get_multi_selection(${1:checkboxtree}, ${2:seqnum})" }, + { "trigger": "newt_checkbox_tree_get_selection", "contents": "newt_checkbox_tree_get_selection(${1:checkboxtree})" }, + { "trigger": "newt_checkbox_tree_multi", "contents": "newt_checkbox_tree_multi(${1:left}, ${2:top}, ${3:height}, ${4:seq})" }, + { "trigger": "newt_checkbox_tree_set_current", "contents": "newt_checkbox_tree_set_current(${1:checkboxtree}, ${2:data})" }, + { "trigger": "newt_checkbox_tree_set_entry", "contents": "newt_checkbox_tree_set_entry(${1:checkboxtree}, ${2:data}, ${3:text})" }, + { "trigger": "newt_checkbox_tree_set_entry_value", "contents": "newt_checkbox_tree_set_entry_value(${1:checkboxtree}, ${2:data}, ${3:value})" }, + { "trigger": "newt_checkbox_tree_set_width", "contents": "newt_checkbox_tree_set_width(${1:checkbox_tree}, ${2:width})" }, + { "trigger": "newt_clear_key_buffer", "contents": "newt_clear_key_buffer()" }, + { "trigger": "newt_cls", "contents": "newt_cls()" }, + { "trigger": "newt_compact_button", "contents": "newt_compact_button(${1:left}, ${2:top}, ${3:text})" }, + { "trigger": "newt_component_add_callback", "contents": "newt_component_add_callback(${1:component}, ${2:func_name}, ${3:data})" }, + { "trigger": "newt_component_takes_focus", "contents": "newt_component_takes_focus(${1:component}, ${2:takes_focus})" }, + { "trigger": "newt_create_grid", "contents": "newt_create_grid(${1:cols}, ${2:rows})" }, + { "trigger": "newt_cursor_off", "contents": "newt_cursor_off()" }, + { "trigger": "newt_cursor_on", "contents": "newt_cursor_on()" }, + { "trigger": "newt_delay", "contents": "newt_delay(${1:microseconds})" }, + { "trigger": "newt_draw_form", "contents": "newt_draw_form(${1:form})" }, + { "trigger": "newt_draw_root_text", "contents": "newt_draw_root_text(${1:left}, ${2:top}, ${3:text})" }, + { "trigger": "newt_entry", "contents": "newt_entry(${1:left}, ${2:top}, ${3:width})" }, + { "trigger": "newt_entry_get_value", "contents": "newt_entry_get_value(${1:entry})" }, + { "trigger": "newt_entry_set", "contents": "newt_entry_set(${1:entry}, ${2:value})" }, + { "trigger": "newt_entry_set_filter", "contents": "newt_entry_set_filter(${1:entry}, ${2:filter}, ${3:data})" }, + { "trigger": "newt_entry_set_flags", "contents": "newt_entry_set_flags(${1:entry}, ${2:flags}, ${3:sense})" }, + { "trigger": "newt_finished", "contents": "newt_finished()" }, + { "trigger": "newt_form", "contents": "newt_form()" }, + { "trigger": "newt_form_add_component", "contents": "newt_form_add_component(${1:form}, ${2:component})" }, + { "trigger": "newt_form_add_components", "contents": "newt_form_add_components(${1:form}, ${2:components})" }, + { "trigger": "newt_form_add_hot_key", "contents": "newt_form_add_hot_key(${1:form}, ${2:key})" }, + { "trigger": "newt_form_destroy", "contents": "newt_form_destroy(${1:form})" }, + { "trigger": "newt_form_get_current", "contents": "newt_form_get_current(${1:form})" }, + { "trigger": "newt_form_run", "contents": "newt_form_run(${1:form}, ${2:exit_struct})" }, + { "trigger": "newt_form_set_background", "contents": "newt_form_set_background(${1:from}, ${2:background})" }, + { "trigger": "newt_form_set_height", "contents": "newt_form_set_height(${1:form}, ${2:height})" }, + { "trigger": "newt_form_set_size", "contents": "newt_form_set_size(${1:form})" }, + { "trigger": "newt_form_set_timer", "contents": "newt_form_set_timer(${1:form}, ${2:milliseconds})" }, + { "trigger": "newt_form_set_width", "contents": "newt_form_set_width(${1:form}, ${2:width})" }, + { "trigger": "newt_form_watch_fd", "contents": "newt_form_watch_fd(${1:form}, ${2:stream})" }, + { "trigger": "newt_get_screen_size", "contents": "newt_get_screen_size(${1:cols}, ${2:rows})" }, + { "trigger": "newt_grid_add_components_to_form", "contents": "newt_grid_add_components_to_form(${1:grid}, ${2:form}, ${3:recurse})" }, + { "trigger": "newt_grid_basic_window", "contents": "newt_grid_basic_window(${1:text}, ${2:middle}, ${3:buttons})" }, + { "trigger": "newt_grid_free", "contents": "newt_grid_free(${1:grid}, ${2:recurse})" }, + { "trigger": "newt_grid_get_size", "contents": "newt_grid_get_size(${1:grid}, ${2:width}, ${3:height})" }, + { "trigger": "newt_grid_h_close_stacked", "contents": "newt_grid_h_close_stacked(${1:element1_type}, ${2:element1})" }, + { "trigger": "newt_grid_h_stacked", "contents": "newt_grid_h_stacked(${1:element1_type}, ${2:element1})" }, + { "trigger": "newt_grid_place", "contents": "newt_grid_place(${1:grid}, ${2:left}, ${3:top})" }, + { "trigger": "newt_grid_set_field", "contents": "newt_grid_set_field(${1:grid}, ${2:col}, ${3:row}, ${4:type}, ${5:val}, ${6:pad_left}, ${7:pad_top}, ${8:pad_right}, ${9:pad_bottom}, ${10:anchor})" }, + { "trigger": "newt_grid_simple_window", "contents": "newt_grid_simple_window(${1:text}, ${2:middle}, ${3:buttons})" }, + { "trigger": "newt_grid_v_close_stacked", "contents": "newt_grid_v_close_stacked(${1:element1_type}, ${2:element1})" }, + { "trigger": "newt_grid_v_stacked", "contents": "newt_grid_v_stacked(${1:element1_type}, ${2:element1})" }, + { "trigger": "newt_grid_wrapped_window", "contents": "newt_grid_wrapped_window(${1:grid}, ${2:title})" }, + { "trigger": "newt_grid_wrapped_window_at", "contents": "newt_grid_wrapped_window_at(${1:grid}, ${2:title}, ${3:left}, ${4:top})" }, + { "trigger": "newt_init", "contents": "newt_init()" }, + { "trigger": "newt_label", "contents": "newt_label(${1:left}, ${2:top}, ${3:text})" }, + { "trigger": "newt_label_set_text", "contents": "newt_label_set_text(${1:label}, ${2:text})" }, + { "trigger": "newt_listbox", "contents": "newt_listbox(${1:left}, ${2:top}, ${3:height})" }, + { "trigger": "newt_listbox_append_entry", "contents": "newt_listbox_append_entry(${1:listbox}, ${2:text}, ${3:data})" }, + { "trigger": "newt_listbox_clear", "contents": "newt_listbox_clear(${1:listobx})" }, + { "trigger": "newt_listbox_clear_selection", "contents": "newt_listbox_clear_selection(${1:listbox})" }, + { "trigger": "newt_listbox_delete_entry", "contents": "newt_listbox_delete_entry(${1:listbox}, ${2:key})" }, + { "trigger": "newt_listbox_get_current", "contents": "newt_listbox_get_current(${1:listbox})" }, + { "trigger": "newt_listbox_get_selection", "contents": "newt_listbox_get_selection(${1:listbox})" }, + { "trigger": "newt_listbox_insert_entry", "contents": "newt_listbox_insert_entry(${1:listbox}, ${2:text}, ${3:data}, ${4:key})" }, + { "trigger": "newt_listbox_item_count", "contents": "newt_listbox_item_count(${1:listbox})" }, + { "trigger": "newt_listbox_select_item", "contents": "newt_listbox_select_item(${1:listbox}, ${2:key}, ${3:sense})" }, + { "trigger": "newt_listbox_set_current", "contents": "newt_listbox_set_current(${1:listbox}, ${2:num})" }, + { "trigger": "newt_listbox_set_current_by_key", "contents": "newt_listbox_set_current_by_key(${1:listbox}, ${2:key})" }, + { "trigger": "newt_listbox_set_data", "contents": "newt_listbox_set_data(${1:listbox}, ${2:num}, ${3:data})" }, + { "trigger": "newt_listbox_set_entry", "contents": "newt_listbox_set_entry(${1:listbox}, ${2:num}, ${3:text})" }, + { "trigger": "newt_listbox_set_width", "contents": "newt_listbox_set_width(${1:listbox}, ${2:width})" }, + { "trigger": "newt_listitem", "contents": "newt_listitem(${1:left}, ${2:top}, ${3:text}, ${4:is_default}, ${5:prev_item}, ${6:data})" }, + { "trigger": "newt_listitem_get_data", "contents": "newt_listitem_get_data(${1:item})" }, + { "trigger": "newt_listitem_set", "contents": "newt_listitem_set(${1:item}, ${2:text})" }, + { "trigger": "newt_open_window", "contents": "newt_open_window(${1:left}, ${2:top}, ${3:width}, ${4:height})" }, + { "trigger": "newt_pop_help_line", "contents": "newt_pop_help_line()" }, + { "trigger": "newt_pop_window", "contents": "newt_pop_window()" }, + { "trigger": "newt_push_help_line", "contents": "newt_push_help_line()" }, + { "trigger": "newt_radio_get_current", "contents": "newt_radio_get_current(${1:set_member})" }, + { "trigger": "newt_radiobutton", "contents": "newt_radiobutton(${1:left}, ${2:top}, ${3:text}, ${4:is_default})" }, + { "trigger": "newt_redraw_help_line", "contents": "newt_redraw_help_line()" }, + { "trigger": "newt_reflow_text", "contents": "newt_reflow_text(${1:text}, ${2:width}, ${3:flex_down}, ${4:flex_up}, ${5:actual_width}, ${6:actual_height})" }, + { "trigger": "newt_refresh", "contents": "newt_refresh()" }, + { "trigger": "newt_resize_screen", "contents": "newt_resize_screen()" }, + { "trigger": "newt_resume", "contents": "newt_resume()" }, + { "trigger": "newt_run_form", "contents": "newt_run_form(${1:form})" }, + { "trigger": "newt_scale", "contents": "newt_scale(${1:left}, ${2:top}, ${3:width}, ${4:full_value})" }, + { "trigger": "newt_scale_set", "contents": "newt_scale_set(${1:scale}, ${2:amount})" }, + { "trigger": "newt_scrollbar_set", "contents": "newt_scrollbar_set(${1:scrollbar}, ${2:where}, ${3:total})" }, + { "trigger": "newt_set_help_callback", "contents": "newt_set_help_callback(${1:function})" }, + { "trigger": "newt_set_suspend_callback", "contents": "newt_set_suspend_callback(${1:function}, ${2:data})" }, + { "trigger": "newt_suspend", "contents": "newt_suspend()" }, + { "trigger": "newt_textbox", "contents": "newt_textbox(${1:left}, ${2:top}, ${3:width}, ${4:height})" }, + { "trigger": "newt_textbox_get_num_lines", "contents": "newt_textbox_get_num_lines(${1:textbox})" }, + { "trigger": "newt_textbox_reflowed", "contents": "newt_textbox_reflowed(${1:left}, ${2:top}, ${3:*text}, ${4:width}, ${5:flex_down}, ${6:flex_up})" }, + { "trigger": "newt_textbox_set_height", "contents": "newt_textbox_set_height(${1:textbox}, ${2:height})" }, + { "trigger": "newt_textbox_set_text", "contents": "newt_textbox_set_text(${1:textbox}, ${2:text})" }, + { "trigger": "newt_vertical_scrollbar", "contents": "newt_vertical_scrollbar(${1:left}, ${2:top}, ${3:height})" }, + { "trigger": "newt_wait_for_key", "contents": "newt_wait_for_key()" }, + { "trigger": "newt_win_choice", "contents": "newt_win_choice(${1:title}, ${2:button1_text}, ${3:button2_text}, ${4:format})" }, + { "trigger": "newt_win_entries", "contents": "newt_win_entries(${1:title}, ${2:text}, ${3:suggested_width}, ${4:flex_down}, ${5:flex_up}, ${6:data_width}, ${7:items}, ${8:button1})" }, + { "trigger": "newt_win_menu", "contents": "newt_win_menu(${1:title}, ${2:text}, ${3:suggestedWidth}, ${4:flexDown}, ${5:flexUp}, ${6:maxListHeight}, ${7:items}, ${8:listItem})" }, + { "trigger": "newt_win_message", "contents": "newt_win_message(${1:title}, ${2:button_text}, ${3:format})" }, + { "trigger": "newt_win_messagev", "contents": "newt_win_messagev(${1:title}, ${2:button_text}, ${3:format}, ${4:args})" }, + { "trigger": "newt_win_ternary", "contents": "newt_win_ternary(${1:title}, ${2:button1_text}, ${3:button2_text}, ${4:button3_text}, ${5:format})" }, + { "trigger": "next", "contents": "next(${1:array})" }, + { "trigger": "ngettext", "contents": "ngettext(${1:msgid1}, ${2:msgid2}, ${3:n})" }, + { "trigger": "nl2br", "contents": "nl2br(${1:string})" }, + { "trigger": "nl_langinfo", "contents": "nl_langinfo(${1:item})" }, + { "trigger": "notes_body", "contents": "notes_body(${1:server}, ${2:mailbox}, ${3:msg_number})" }, + { "trigger": "notes_copy_db", "contents": "notes_copy_db(${1:from_database_name}, ${2:to_database_name})" }, + { "trigger": "notes_create_db", "contents": "notes_create_db(${1:database_name})" }, + { "trigger": "notes_create_note", "contents": "notes_create_note(${1:database_name}, ${2:form_name})" }, + { "trigger": "notes_drop_db", "contents": "notes_drop_db(${1:database_name})" }, + { "trigger": "notes_find_note", "contents": "notes_find_note(${1:database_name}, ${2:name})" }, + { "trigger": "notes_header_info", "contents": "notes_header_info(${1:server}, ${2:mailbox}, ${3:msg_number})" }, + { "trigger": "notes_list_msgs", "contents": "notes_list_msgs(${1:db})" }, + { "trigger": "notes_mark_read", "contents": "notes_mark_read(${1:database_name}, ${2:user_name}, ${3:note_id})" }, + { "trigger": "notes_mark_unread", "contents": "notes_mark_unread(${1:database_name}, ${2:user_name}, ${3:note_id})" }, + { "trigger": "notes_nav_create", "contents": "notes_nav_create(${1:database_name}, ${2:name})" }, + { "trigger": "notes_search", "contents": "notes_search(${1:database_name}, ${2:keywords})" }, + { "trigger": "notes_unread", "contents": "notes_unread(${1:database_name}, ${2:user_name})" }, + { "trigger": "notes_version", "contents": "notes_version(${1:database_name})" }, + { "trigger": "nsapi_request_headers", "contents": "nsapi_request_headers()" }, + { "trigger": "nsapi_response_headers", "contents": "nsapi_response_headers()" }, + { "trigger": "nsapi_virtual", "contents": "nsapi_virtual(${1:uri})" }, + { "trigger": "nthmac", "contents": "nthmac(${1:clent}, ${2:data})" }, + { "trigger": "number_format", "contents": "number_format(${1:number})" }, + { "trigger": "oauth_get_sbs", "contents": "oauth_get_sbs(${1:http_method}, ${2:uri})" }, + { "trigger": "oauth_urlencode", "contents": "oauth_urlencode(${1:uri})" }, + { "trigger": "ob_clean", "contents": "ob_clean()" }, + { "trigger": "ob_deflatehandler", "contents": "ob_deflatehandler(${1:data}, ${2:mode})" }, + { "trigger": "ob_end_clean", "contents": "ob_end_clean()" }, + { "trigger": "ob_end_flush", "contents": "ob_end_flush()" }, + { "trigger": "ob_etaghandler", "contents": "ob_etaghandler(${1:data}, ${2:mode})" }, + { "trigger": "ob_flush", "contents": "ob_flush()" }, + { "trigger": "ob_get_clean", "contents": "ob_get_clean()" }, + { "trigger": "ob_get_contents", "contents": "ob_get_contents()" }, + { "trigger": "ob_get_flush", "contents": "ob_get_flush()" }, + { "trigger": "ob_get_length", "contents": "ob_get_length()" }, + { "trigger": "ob_get_level", "contents": "ob_get_level()" }, + { "trigger": "ob_get_status", "contents": "ob_get_status()" }, + { "trigger": "ob_gzhandler", "contents": "ob_gzhandler(${1:buffer}, ${2:mode})" }, + { "trigger": "ob_iconv_handler", "contents": "ob_iconv_handler(${1:contents}, ${2:status})" }, + { "trigger": "ob_implicit_flush", "contents": "ob_implicit_flush()" }, + { "trigger": "ob_inflatehandler", "contents": "ob_inflatehandler(${1:data}, ${2:mode})" }, + { "trigger": "ob_list_handlers", "contents": "ob_list_handlers()" }, + { "trigger": "ob_start", "contents": "ob_start()" }, + { "trigger": "ob_tidyhandler", "contents": "ob_tidyhandler(${1:input})" }, + { "trigger": "oci_bind_array_by_name", "contents": "oci_bind_array_by_name(${1:statement}, ${2:name}, ${3:var_array}, ${4:max_table_length})" }, + { "trigger": "oci_bind_by_name", "contents": "oci_bind_by_name(${1:statement}, ${2:bv_name}, ${3:variable})" }, + { "trigger": "oci_cancel", "contents": "oci_cancel(${1:statement})" }, + { "trigger": "oci_close", "contents": "oci_close(${1:connection})" }, + { "trigger": "oci_commit", "contents": "oci_commit(${1:connection})" }, + { "trigger": "oci_connect", "contents": "oci_connect(${1:username}, ${2:password})" }, + { "trigger": "oci_define_by_name", "contents": "oci_define_by_name(${1:statement}, ${2:column_name}, ${3:variable})" }, + { "trigger": "oci_error", "contents": "oci_error()" }, + { "trigger": "oci_execute", "contents": "oci_execute(${1:statement})" }, + { "trigger": "oci_fetch", "contents": "oci_fetch(${1:statement})" }, + { "trigger": "oci_fetch_all", "contents": "oci_fetch_all(${1:statement}, ${2:output})" }, + { "trigger": "oci_fetch_array", "contents": "oci_fetch_array(${1:statement})" }, + { "trigger": "oci_fetch_assoc", "contents": "oci_fetch_assoc(${1:statement})" }, + { "trigger": "oci_fetch_object", "contents": "oci_fetch_object(${1:statement})" }, + { "trigger": "oci_fetch_row", "contents": "oci_fetch_row(${1:statement})" }, + { "trigger": "oci_field_is_null", "contents": "oci_field_is_null(${1:statement}, ${2:field})" }, + { "trigger": "oci_field_name", "contents": "oci_field_name(${1:statement}, ${2:field})" }, + { "trigger": "oci_field_precision", "contents": "oci_field_precision(${1:statement}, ${2:field})" }, + { "trigger": "oci_field_scale", "contents": "oci_field_scale(${1:statement}, ${2:field})" }, + { "trigger": "oci_field_size", "contents": "oci_field_size(${1:statement}, ${2:field})" }, + { "trigger": "oci_field_type", "contents": "oci_field_type(${1:statement}, ${2:field})" }, + { "trigger": "oci_field_type_raw", "contents": "oci_field_type_raw(${1:statement}, ${2:field})" }, + { "trigger": "oci_free_statement", "contents": "oci_free_statement(${1:statement})" }, + { "trigger": "oci_internal_debug", "contents": "oci_internal_debug(${1:onoff})" }, + { "trigger": "oci_lob_copy", "contents": "oci_lob_copy(${1:lob_to}, ${2:lob_from})" }, + { "trigger": "oci_lob_is_equal", "contents": "oci_lob_is_equal(${1:lob1}, ${2:lob2})" }, + { "trigger": "oci_new_collection", "contents": "oci_new_collection(${1:connection}, ${2:tdo})" }, + { "trigger": "oci_new_connect", "contents": "oci_new_connect(${1:username}, ${2:password})" }, + { "trigger": "oci_new_cursor", "contents": "oci_new_cursor(${1:connection})" }, + { "trigger": "oci_new_descriptor", "contents": "oci_new_descriptor(${1:connection})" }, + { "trigger": "oci_num_fields", "contents": "oci_num_fields(${1:statement})" }, + { "trigger": "oci_num_rows", "contents": "oci_num_rows(${1:statement})" }, + { "trigger": "oci_parse", "contents": "oci_parse(${1:connection}, ${2:sql_text})" }, + { "trigger": "oci_password_change", "contents": "oci_password_change(${1:connection}, ${2:username}, ${3:old_password}, ${4:new_password})" }, + { "trigger": "oci_pconnect", "contents": "oci_pconnect(${1:username}, ${2:password})" }, + { "trigger": "oci_result", "contents": "oci_result(${1:statement}, ${2:field})" }, + { "trigger": "oci_rollback", "contents": "oci_rollback(${1:connection})" }, + { "trigger": "oci_server_version", "contents": "oci_server_version(${1:connection})" }, + { "trigger": "oci_set_action", "contents": "oci_set_action(${1:connection}, ${2:action_name})" }, + { "trigger": "oci_set_client_identifier", "contents": "oci_set_client_identifier(${1:connection}, ${2:client_identifier})" }, + { "trigger": "oci_set_client_info", "contents": "oci_set_client_info(${1:connection}, ${2:client_info})" }, + { "trigger": "oci_set_edition", "contents": "oci_set_edition(${1:edition})" }, + { "trigger": "oci_set_module_name", "contents": "oci_set_module_name(${1:connection}, ${2:module_name})" }, + { "trigger": "oci_set_prefetch", "contents": "oci_set_prefetch(${1:statement}, ${2:rows})" }, + { "trigger": "oci_statement_type", "contents": "oci_statement_type(${1:statement})" }, + { "trigger": "ocibindbyname", "contents": "ocibindbyname()" }, + { "trigger": "ocicancel", "contents": "ocicancel()" }, + { "trigger": "ocicloselob", "contents": "ocicloselob()" }, + { "trigger": "ocicollappend", "contents": "ocicollappend()" }, + { "trigger": "ocicollassign", "contents": "ocicollassign()" }, + { "trigger": "ocicollassignelem", "contents": "ocicollassignelem()" }, + { "trigger": "ocicollgetelem", "contents": "ocicollgetelem()" }, + { "trigger": "ocicollmax", "contents": "ocicollmax()" }, + { "trigger": "ocicollsize", "contents": "ocicollsize()" }, + { "trigger": "ocicolltrim", "contents": "ocicolltrim()" }, + { "trigger": "ocicolumnisnull", "contents": "ocicolumnisnull()" }, + { "trigger": "ocicolumnname", "contents": "ocicolumnname()" }, + { "trigger": "ocicolumnprecision", "contents": "ocicolumnprecision()" }, + { "trigger": "ocicolumnscale", "contents": "ocicolumnscale()" }, + { "trigger": "ocicolumnsize", "contents": "ocicolumnsize()" }, + { "trigger": "ocicolumntype", "contents": "ocicolumntype()" }, + { "trigger": "ocicolumntyperaw", "contents": "ocicolumntyperaw()" }, + { "trigger": "ocicommit", "contents": "ocicommit()" }, + { "trigger": "ocidefinebyname", "contents": "ocidefinebyname()" }, + { "trigger": "ocierror", "contents": "ocierror()" }, + { "trigger": "ociexecute", "contents": "ociexecute()" }, + { "trigger": "ocifetch", "contents": "ocifetch()" }, + { "trigger": "ocifetchinto", "contents": "ocifetchinto(${1:statement}, ${2:result})" }, + { "trigger": "ocifetchstatement", "contents": "ocifetchstatement()" }, + { "trigger": "ocifreecollection", "contents": "ocifreecollection()" }, + { "trigger": "ocifreecursor", "contents": "ocifreecursor()" }, + { "trigger": "ocifreedesc", "contents": "ocifreedesc()" }, + { "trigger": "ocifreestatement", "contents": "ocifreestatement()" }, + { "trigger": "ociinternaldebug", "contents": "ociinternaldebug()" }, + { "trigger": "ociloadlob", "contents": "ociloadlob()" }, + { "trigger": "ocilogoff", "contents": "ocilogoff()" }, + { "trigger": "ocilogon", "contents": "ocilogon()" }, + { "trigger": "ocinewcollection", "contents": "ocinewcollection()" }, + { "trigger": "ocinewcursor", "contents": "ocinewcursor()" }, + { "trigger": "ocinewdescriptor", "contents": "ocinewdescriptor()" }, + { "trigger": "ocinlogon", "contents": "ocinlogon()" }, + { "trigger": "ocinumcols", "contents": "ocinumcols()" }, + { "trigger": "ociparse", "contents": "ociparse()" }, + { "trigger": "ociplogon", "contents": "ociplogon()" }, + { "trigger": "ociresult", "contents": "ociresult()" }, + { "trigger": "ocirollback", "contents": "ocirollback()" }, + { "trigger": "ocirowcount", "contents": "ocirowcount()" }, + { "trigger": "ocisavelob", "contents": "ocisavelob()" }, + { "trigger": "ocisavelobfile", "contents": "ocisavelobfile()" }, + { "trigger": "ociserverversion", "contents": "ociserverversion()" }, + { "trigger": "ocisetprefetch", "contents": "ocisetprefetch()" }, + { "trigger": "ocistatementtype", "contents": "ocistatementtype()" }, + { "trigger": "ociwritelobtofile", "contents": "ociwritelobtofile()" }, + { "trigger": "ociwritetemporarylob", "contents": "ociwritetemporarylob()" }, + { "trigger": "octdec", "contents": "octdec(${1:octal_string})" }, + { "trigger": "odbc_autocommit", "contents": "odbc_autocommit(${1:connection_id})" }, + { "trigger": "odbc_binmode", "contents": "odbc_binmode(${1:result_id}, ${2:mode})" }, + { "trigger": "odbc_close", "contents": "odbc_close(${1:connection_id})" }, + { "trigger": "odbc_close_all", "contents": "odbc_close_all()" }, + { "trigger": "odbc_columnprivileges", "contents": "odbc_columnprivileges(${1:connection_id}, ${2:qualifier}, ${3:owner}, ${4:table_name}, ${5:column_name})" }, + { "trigger": "odbc_columns", "contents": "odbc_columns(${1:connection_id})" }, + { "trigger": "odbc_commit", "contents": "odbc_commit(${1:connection_id})" }, + { "trigger": "odbc_connect", "contents": "odbc_connect(${1:dsn}, ${2:user}, ${3:password})" }, + { "trigger": "odbc_cursor", "contents": "odbc_cursor(${1:result_id})" }, + { "trigger": "odbc_data_source", "contents": "odbc_data_source(${1:connection_id}, ${2:fetch_type})" }, + { "trigger": "odbc_do", "contents": "odbc_do()" }, + { "trigger": "odbc_error", "contents": "odbc_error()" }, + { "trigger": "odbc_errormsg", "contents": "odbc_errormsg()" }, + { "trigger": "odbc_exec", "contents": "odbc_exec(${1:connection_id}, ${2:query_string})" }, + { "trigger": "odbc_execute", "contents": "odbc_execute(${1:result_id})" }, + { "trigger": "odbc_fetch_array", "contents": "odbc_fetch_array(${1:result})" }, + { "trigger": "odbc_fetch_into", "contents": "odbc_fetch_into(${1:result_id}, ${2:result_array})" }, + { "trigger": "odbc_fetch_object", "contents": "odbc_fetch_object(${1:result})" }, + { "trigger": "odbc_fetch_row", "contents": "odbc_fetch_row(${1:result_id})" }, + { "trigger": "odbc_field_len", "contents": "odbc_field_len(${1:result_id}, ${2:field_number})" }, + { "trigger": "odbc_field_name", "contents": "odbc_field_name(${1:result_id}, ${2:field_number})" }, + { "trigger": "odbc_field_num", "contents": "odbc_field_num(${1:result_id}, ${2:field_name})" }, + { "trigger": "odbc_field_precision", "contents": "odbc_field_precision()" }, + { "trigger": "odbc_field_scale", "contents": "odbc_field_scale(${1:result_id}, ${2:field_number})" }, + { "trigger": "odbc_field_type", "contents": "odbc_field_type(${1:result_id}, ${2:field_number})" }, + { "trigger": "odbc_foreignkeys", "contents": "odbc_foreignkeys(${1:connection_id}, ${2:pk_qualifier}, ${3:pk_owner}, ${4:pk_table}, ${5:fk_qualifier}, ${6:fk_owner}, ${7:fk_table})" }, + { "trigger": "odbc_free_result", "contents": "odbc_free_result(${1:result_id})" }, + { "trigger": "odbc_gettypeinfo", "contents": "odbc_gettypeinfo(${1:connection_id})" }, + { "trigger": "odbc_longreadlen", "contents": "odbc_longreadlen(${1:result_id}, ${2:length})" }, + { "trigger": "odbc_next_result", "contents": "odbc_next_result(${1:result_id})" }, + { "trigger": "odbc_num_fields", "contents": "odbc_num_fields(${1:result_id})" }, + { "trigger": "odbc_num_rows", "contents": "odbc_num_rows(${1:result_id})" }, + { "trigger": "odbc_pconnect", "contents": "odbc_pconnect(${1:dsn}, ${2:user}, ${3:password})" }, + { "trigger": "odbc_prepare", "contents": "odbc_prepare(${1:connection_id}, ${2:query_string})" }, + { "trigger": "odbc_primarykeys", "contents": "odbc_primarykeys(${1:connection_id}, ${2:qualifier}, ${3:owner}, ${4:table})" }, + { "trigger": "odbc_procedurecolumns", "contents": "odbc_procedurecolumns(${1:connection_id})" }, + { "trigger": "odbc_procedures", "contents": "odbc_procedures(${1:connection_id})" }, + { "trigger": "odbc_result", "contents": "odbc_result(${1:result_id}, ${2:field})" }, + { "trigger": "odbc_result_all", "contents": "odbc_result_all(${1:result_id})" }, + { "trigger": "odbc_rollback", "contents": "odbc_rollback(${1:connection_id})" }, + { "trigger": "odbc_setoption", "contents": "odbc_setoption(${1:id}, ${2:function}, ${3:option}, ${4:param})" }, + { "trigger": "odbc_specialcolumns", "contents": "odbc_specialcolumns(${1:connection_id}, ${2:type}, ${3:qualifier}, ${4:owner}, ${5:table}, ${6:scope}, ${7:nullable})" }, + { "trigger": "odbc_statistics", "contents": "odbc_statistics(${1:connection_id}, ${2:qualifier}, ${3:owner}, ${4:table_name}, ${5:unique}, ${6:accuracy})" }, + { "trigger": "odbc_tableprivileges", "contents": "odbc_tableprivileges(${1:connection_id}, ${2:qualifier}, ${3:owner}, ${4:name})" }, + { "trigger": "odbc_tables", "contents": "odbc_tables(${1:connection_id})" }, + { "trigger": "openal_buffer_create", "contents": "openal_buffer_create()" }, + { "trigger": "openal_buffer_data", "contents": "openal_buffer_data(${1:buffer}, ${2:format}, ${3:data}, ${4:freq})" }, + { "trigger": "openal_buffer_destroy", "contents": "openal_buffer_destroy(${1:buffer})" }, + { "trigger": "openal_buffer_get", "contents": "openal_buffer_get(${1:buffer}, ${2:property})" }, + { "trigger": "openal_buffer_loadwav", "contents": "openal_buffer_loadwav(${1:buffer}, ${2:wavfile})" }, + { "trigger": "openal_context_create", "contents": "openal_context_create(${1:device})" }, + { "trigger": "openal_context_current", "contents": "openal_context_current(${1:context})" }, + { "trigger": "openal_context_destroy", "contents": "openal_context_destroy(${1:context})" }, + { "trigger": "openal_context_process", "contents": "openal_context_process(${1:context})" }, + { "trigger": "openal_context_suspend", "contents": "openal_context_suspend(${1:context})" }, + { "trigger": "openal_device_close", "contents": "openal_device_close(${1:device})" }, + { "trigger": "openal_device_open", "contents": "openal_device_open()" }, + { "trigger": "openal_listener_get", "contents": "openal_listener_get(${1:property})" }, + { "trigger": "openal_listener_set", "contents": "openal_listener_set(${1:property}, ${2:setting})" }, + { "trigger": "openal_source_create", "contents": "openal_source_create()" }, + { "trigger": "openal_source_destroy", "contents": "openal_source_destroy(${1:source})" }, + { "trigger": "openal_source_get", "contents": "openal_source_get(${1:source}, ${2:property})" }, + { "trigger": "openal_source_pause", "contents": "openal_source_pause(${1:source})" }, + { "trigger": "openal_source_play", "contents": "openal_source_play(${1:source})" }, + { "trigger": "openal_source_rewind", "contents": "openal_source_rewind(${1:source})" }, + { "trigger": "openal_source_set", "contents": "openal_source_set(${1:source}, ${2:property}, ${3:setting})" }, + { "trigger": "openal_source_stop", "contents": "openal_source_stop(${1:source})" }, + { "trigger": "openal_stream", "contents": "openal_stream(${1:source}, ${2:format}, ${3:rate})" }, + { "trigger": "opendir", "contents": "opendir(${1:path})" }, + { "trigger": "openlog", "contents": "openlog(${1:ident}, ${2:option}, ${3:facility})" }, + { "trigger": "openssl_csr_export", "contents": "openssl_csr_export(${1:csr}, ${2:out})" }, + { "trigger": "openssl_csr_export_to_file", "contents": "openssl_csr_export_to_file(${1:csr}, ${2:outfilename})" }, + { "trigger": "openssl_csr_get_public_key", "contents": "openssl_csr_get_public_key(${1:csr})" }, + { "trigger": "openssl_csr_get_subject", "contents": "openssl_csr_get_subject(${1:csr})" }, + { "trigger": "openssl_csr_new", "contents": "openssl_csr_new(${1:dn}, ${2:privkey})" }, + { "trigger": "openssl_csr_sign", "contents": "openssl_csr_sign(${1:csr}, ${2:cacert}, ${3:priv_key}, ${4:days})" }, + { "trigger": "openssl_decrypt", "contents": "openssl_decrypt(${1:data}, ${2:method}, ${3:password})" }, + { "trigger": "openssl_dh_compute_key", "contents": "openssl_dh_compute_key(${1:pub_key}, ${2:dh_key})" }, + { "trigger": "openssl_digest", "contents": "openssl_digest(${1:data}, ${2:method})" }, + { "trigger": "openssl_encrypt", "contents": "openssl_encrypt(${1:data}, ${2:method}, ${3:password})" }, + { "trigger": "openssl_error_string", "contents": "openssl_error_string()" }, + { "trigger": "openssl_free_key", "contents": "openssl_free_key(${1:key_identifier})" }, + { "trigger": "openssl_get_cipher_methods", "contents": "openssl_get_cipher_methods()" }, + { "trigger": "openssl_get_md_methods", "contents": "openssl_get_md_methods()" }, + { "trigger": "openssl_get_privatekey", "contents": "openssl_get_privatekey()" }, + { "trigger": "openssl_get_publickey", "contents": "openssl_get_publickey()" }, + { "trigger": "openssl_open", "contents": "openssl_open(${1:sealed_data}, ${2:open_data}, ${3:env_key}, ${4:priv_key_id})" }, + { "trigger": "openssl_pkcs12_export", "contents": "openssl_pkcs12_export(${1:x509}, ${2:out}, ${3:priv_key}, ${4:pass})" }, + { "trigger": "openssl_pkcs12_export_to_file", "contents": "openssl_pkcs12_export_to_file(${1:x509}, ${2:filename}, ${3:priv_key}, ${4:pass})" }, + { "trigger": "openssl_pkcs12_read", "contents": "openssl_pkcs12_read(${1:pkcs12}, ${2:certs}, ${3:pass})" }, + { "trigger": "openssl_pkcs7_decrypt", "contents": "openssl_pkcs7_decrypt(${1:infilename}, ${2:outfilename}, ${3:recipcert})" }, + { "trigger": "openssl_pkcs7_encrypt", "contents": "openssl_pkcs7_encrypt(${1:infile}, ${2:outfile}, ${3:recipcerts}, ${4:headers})" }, + { "trigger": "openssl_pkcs7_sign", "contents": "openssl_pkcs7_sign(${1:infilename}, ${2:outfilename}, ${3:signcert}, ${4:privkey}, ${5:headers})" }, + { "trigger": "openssl_pkcs7_verify", "contents": "openssl_pkcs7_verify(${1:filename}, ${2:flags})" }, + { "trigger": "openssl_pkey_export", "contents": "openssl_pkey_export(${1:key}, ${2:out})" }, + { "trigger": "openssl_pkey_export_to_file", "contents": "openssl_pkey_export_to_file(${1:key}, ${2:outfilename})" }, + { "trigger": "openssl_pkey_free", "contents": "openssl_pkey_free(${1:key})" }, + { "trigger": "openssl_pkey_get_details", "contents": "openssl_pkey_get_details(${1:key})" }, + { "trigger": "openssl_pkey_get_private", "contents": "openssl_pkey_get_private(${1:key})" }, + { "trigger": "openssl_pkey_get_public", "contents": "openssl_pkey_get_public(${1:certificate})" }, + { "trigger": "openssl_pkey_new", "contents": "openssl_pkey_new()" }, + { "trigger": "openssl_private_decrypt", "contents": "openssl_private_decrypt(${1:data}, ${2:decrypted}, ${3:key})" }, + { "trigger": "openssl_private_encrypt", "contents": "openssl_private_encrypt(${1:data}, ${2:crypted}, ${3:key})" }, + { "trigger": "openssl_public_decrypt", "contents": "openssl_public_decrypt(${1:data}, ${2:decrypted}, ${3:key})" }, + { "trigger": "openssl_public_encrypt", "contents": "openssl_public_encrypt(${1:data}, ${2:crypted}, ${3:key})" }, + { "trigger": "openssl_random_pseudo_bytes", "contents": "openssl_random_pseudo_bytes(${1:length})" }, + { "trigger": "openssl_seal", "contents": "openssl_seal(${1:data}, ${2:sealed_data}, ${3:env_keys}, ${4:pub_key_ids})" }, + { "trigger": "openssl_sign", "contents": "openssl_sign(${1:data}, ${2:signature}, ${3:priv_key_id})" }, + { "trigger": "openssl_verify", "contents": "openssl_verify(${1:data}, ${2:signature}, ${3:pub_key_id})" }, + { "trigger": "openssl_x509_check_private_key", "contents": "openssl_x509_check_private_key(${1:cert}, ${2:key})" }, + { "trigger": "openssl_x509_checkpurpose", "contents": "openssl_x509_checkpurpose(${1:x509cert}, ${2:purpose})" }, + { "trigger": "openssl_x509_export", "contents": "openssl_x509_export(${1:x509}, ${2:output})" }, + { "trigger": "openssl_x509_export_to_file", "contents": "openssl_x509_export_to_file(${1:x509}, ${2:outfilename})" }, + { "trigger": "openssl_x509_free", "contents": "openssl_x509_free(${1:x509cert})" }, + { "trigger": "openssl_x509_parse", "contents": "openssl_x509_parse(${1:x509cert})" }, + { "trigger": "openssl_x509_read", "contents": "openssl_x509_read(${1:x509certdata})" }, + { "trigger": "ord", "contents": "ord(${1:string})" }, + { "trigger": "output_add_rewrite_var", "contents": "output_add_rewrite_var(${1:name}, ${2:value})" }, + { "trigger": "output_reset_rewrite_vars", "contents": "output_reset_rewrite_vars()" }, + { "trigger": "overload", "contents": "overload(${1:class_name})" }, + { "trigger": "override_function", "contents": "override_function(${1:function_name}, ${2:function_args}, ${3:function_code})" }, + { "trigger": "ovrimos_close", "contents": "ovrimos_close(${1:connection})" }, + { "trigger": "ovrimos_commit", "contents": "ovrimos_commit(${1:connection_id})" }, + { "trigger": "ovrimos_connect", "contents": "ovrimos_connect(${1:host}, ${2:dborport}, ${3:user}, ${4:password})" }, + { "trigger": "ovrimos_cursor", "contents": "ovrimos_cursor(${1:result_id})" }, + { "trigger": "ovrimos_exec", "contents": "ovrimos_exec(${1:connection_id}, ${2:query})" }, + { "trigger": "ovrimos_execute", "contents": "ovrimos_execute(${1:result_id})" }, + { "trigger": "ovrimos_fetch_into", "contents": "ovrimos_fetch_into(${1:result_id}, ${2:result_array})" }, + { "trigger": "ovrimos_fetch_row", "contents": "ovrimos_fetch_row(${1:result_id})" }, + { "trigger": "ovrimos_field_len", "contents": "ovrimos_field_len(${1:result_id}, ${2:field_number})" }, + { "trigger": "ovrimos_field_name", "contents": "ovrimos_field_name(${1:result_id}, ${2:field_number})" }, + { "trigger": "ovrimos_field_num", "contents": "ovrimos_field_num(${1:result_id}, ${2:field_name})" }, + { "trigger": "ovrimos_field_type", "contents": "ovrimos_field_type(${1:result_id}, ${2:field_number})" }, + { "trigger": "ovrimos_free_result", "contents": "ovrimos_free_result(${1:result_id})" }, + { "trigger": "ovrimos_longreadlen", "contents": "ovrimos_longreadlen(${1:result_id}, ${2:length})" }, + { "trigger": "ovrimos_num_fields", "contents": "ovrimos_num_fields(${1:result_id})" }, + { "trigger": "ovrimos_num_rows", "contents": "ovrimos_num_rows(${1:result_id})" }, + { "trigger": "ovrimos_prepare", "contents": "ovrimos_prepare(${1:connection_id}, ${2:query})" }, + { "trigger": "ovrimos_result", "contents": "ovrimos_result(${1:result_id}, ${2:field})" }, + { "trigger": "ovrimos_result_all", "contents": "ovrimos_result_all(${1:result_id})" }, + { "trigger": "ovrimos_rollback", "contents": "ovrimos_rollback(${1:connection_id})" }, + { "trigger": "pack", "contents": "pack(${1:format})" }, + { "trigger": "parse_ini_file", "contents": "parse_ini_file(${1:filename})" }, + { "trigger": "parse_ini_string", "contents": "parse_ini_string(${1:ini})" }, + { "trigger": "parse_str", "contents": "parse_str(${1:str})" }, + { "trigger": "parse_url", "contents": "parse_url(${1:url})" }, + { "trigger": "parsekit_compile_file", "contents": "parsekit_compile_file(${1:filename})" }, + { "trigger": "parsekit_compile_string", "contents": "parsekit_compile_string(${1:phpcode})" }, + { "trigger": "parsekit_func_arginfo", "contents": "parsekit_func_arginfo(${1:function})" }, + { "trigger": "passthru", "contents": "passthru(${1:command})" }, + { "trigger": "pathinfo", "contents": "pathinfo(${1:path})" }, + { "trigger": "pclose", "contents": "pclose(${1:handle})" }, + { "trigger": "pcntl_alarm", "contents": "pcntl_alarm(${1:seconds})" }, + { "trigger": "pcntl_exec", "contents": "pcntl_exec(${1:path})" }, + { "trigger": "pcntl_fork", "contents": "pcntl_fork()" }, + { "trigger": "pcntl_getpriority", "contents": "pcntl_getpriority()" }, + { "trigger": "pcntl_setpriority", "contents": "pcntl_setpriority(${1:priority})" }, + { "trigger": "pcntl_signal", "contents": "pcntl_signal(${1:signo}, ${2:handler})" }, + { "trigger": "pcntl_signal_dispatch", "contents": "pcntl_signal_dispatch()" }, + { "trigger": "pcntl_sigprocmask", "contents": "pcntl_sigprocmask(${1:how}, ${2:set})" }, + { "trigger": "pcntl_sigtimedwait", "contents": "pcntl_sigtimedwait(${1:set})" }, + { "trigger": "pcntl_sigwaitinfo", "contents": "pcntl_sigwaitinfo(${1:set})" }, + { "trigger": "pcntl_wait", "contents": "pcntl_wait(${1:status})" }, + { "trigger": "pcntl_waitpid", "contents": "pcntl_waitpid(${1:pid}, ${2:status})" }, + { "trigger": "pcntl_wexitstatus", "contents": "pcntl_wexitstatus(${1:status})" }, + { "trigger": "pcntl_wifexited", "contents": "pcntl_wifexited(${1:status})" }, + { "trigger": "pcntl_wifsignaled", "contents": "pcntl_wifsignaled(${1:status})" }, + { "trigger": "pcntl_wifstopped", "contents": "pcntl_wifstopped(${1:status})" }, + { "trigger": "pcntl_wstopsig", "contents": "pcntl_wstopsig(${1:status})" }, + { "trigger": "pcntl_wtermsig", "contents": "pcntl_wtermsig(${1:status})" }, + { "trigger": "PDF_activate_item", "contents": "PDF_activate_item(${1:pdfdoc}, ${2:id})" }, + { "trigger": "PDF_add_annotation", "contents": "PDF_add_annotation()" }, + { "trigger": "PDF_add_bookmark", "contents": "PDF_add_bookmark()" }, + { "trigger": "PDF_add_launchlink", "contents": "PDF_add_launchlink(${1:pdfdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:filename})" }, + { "trigger": "PDF_add_locallink", "contents": "PDF_add_locallink(${1:pdfdoc}, ${2:lowerleftx}, ${3:lowerlefty}, ${4:upperrightx}, ${5:upperrighty}, ${6:page}, ${7:dest})" }, + { "trigger": "PDF_add_nameddest", "contents": "PDF_add_nameddest(${1:pdfdoc}, ${2:name}, ${3:optlist})" }, + { "trigger": "PDF_add_note", "contents": "PDF_add_note(${1:pdfdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:contents}, ${7:title}, ${8:icon}, ${9:open})" }, + { "trigger": "PDF_add_outline", "contents": "PDF_add_outline()" }, + { "trigger": "PDF_add_pdflink", "contents": "PDF_add_pdflink(${1:pdfdoc}, ${2:bottom_left_x}, ${3:bottom_left_y}, ${4:up_right_x}, ${5:up_right_y}, ${6:filename}, ${7:page}, ${8:dest})" }, + { "trigger": "PDF_add_table_cell", "contents": "PDF_add_table_cell(${1:pdfdoc}, ${2:table}, ${3:column}, ${4:row}, ${5:text}, ${6:optlist})" }, + { "trigger": "PDF_add_textflow", "contents": "PDF_add_textflow(${1:pdfdoc}, ${2:textflow}, ${3:text}, ${4:optlist})" }, + { "trigger": "PDF_add_thumbnail", "contents": "PDF_add_thumbnail(${1:pdfdoc}, ${2:image})" }, + { "trigger": "PDF_add_weblink", "contents": "PDF_add_weblink(${1:pdfdoc}, ${2:lowerleftx}, ${3:lowerlefty}, ${4:upperrightx}, ${5:upperrighty}, ${6:url})" }, + { "trigger": "PDF_arc", "contents": "PDF_arc(${1:p}, ${2:x}, ${3:y}, ${4:r}, ${5:alpha}, ${6:beta})" }, + { "trigger": "PDF_arcn", "contents": "PDF_arcn(${1:p}, ${2:x}, ${3:y}, ${4:r}, ${5:alpha}, ${6:beta})" }, + { "trigger": "PDF_attach_file", "contents": "PDF_attach_file(${1:pdfdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:filename}, ${7:description}, ${8:author}, ${9:mimetype}, ${10:icon})" }, + { "trigger": "PDF_begin_document", "contents": "PDF_begin_document(${1:pdfdoc}, ${2:filename}, ${3:optlist})" }, + { "trigger": "PDF_begin_font", "contents": "PDF_begin_font(${1:pdfdoc}, ${2:filename}, ${3:a}, ${4:b}, ${5:c}, ${6:d}, ${7:e}, ${8:f}, ${9:optlist})" }, + { "trigger": "PDF_begin_glyph", "contents": "PDF_begin_glyph(${1:pdfdoc}, ${2:glyphname}, ${3:wx}, ${4:llx}, ${5:lly}, ${6:urx}, ${7:ury})" }, + { "trigger": "PDF_begin_item", "contents": "PDF_begin_item(${1:pdfdoc}, ${2:tag}, ${3:optlist})" }, + { "trigger": "PDF_begin_layer", "contents": "PDF_begin_layer(${1:pdfdoc}, ${2:layer})" }, + { "trigger": "PDF_begin_page", "contents": "PDF_begin_page(${1:pdfdoc}, ${2:width}, ${3:height})" }, + { "trigger": "PDF_begin_page_ext", "contents": "PDF_begin_page_ext(${1:pdfdoc}, ${2:width}, ${3:height}, ${4:optlist})" }, + { "trigger": "PDF_begin_pattern", "contents": "PDF_begin_pattern(${1:pdfdoc}, ${2:width}, ${3:height}, ${4:xstep}, ${5:ystep}, ${6:painttype})" }, + { "trigger": "PDF_begin_template", "contents": "PDF_begin_template(${1:pdfdoc}, ${2:width}, ${3:height})" }, + { "trigger": "PDF_begin_template_ext", "contents": "PDF_begin_template_ext(${1:pdfdoc}, ${2:width}, ${3:height}, ${4:optlist})" }, + { "trigger": "PDF_circle", "contents": "PDF_circle(${1:pdfdoc}, ${2:x}, ${3:y}, ${4:r})" }, + { "trigger": "PDF_clip", "contents": "PDF_clip(${1:p})" }, + { "trigger": "PDF_close", "contents": "PDF_close(${1:p})" }, + { "trigger": "PDF_close_image", "contents": "PDF_close_image(${1:p}, ${2:image})" }, + { "trigger": "PDF_close_pdi", "contents": "PDF_close_pdi(${1:p}, ${2:doc})" }, + { "trigger": "PDF_close_pdi_page", "contents": "PDF_close_pdi_page(${1:p}, ${2:page})" }, + { "trigger": "PDF_closepath", "contents": "PDF_closepath(${1:p})" }, + { "trigger": "PDF_closepath_fill_stroke", "contents": "PDF_closepath_fill_stroke(${1:p})" }, + { "trigger": "PDF_closepath_stroke", "contents": "PDF_closepath_stroke(${1:p})" }, + { "trigger": "PDF_concat", "contents": "PDF_concat(${1:p}, ${2:a}, ${3:b}, ${4:c}, ${5:d}, ${6:e}, ${7:f})" }, + { "trigger": "PDF_continue_text", "contents": "PDF_continue_text(${1:p}, ${2:text})" }, + { "trigger": "PDF_create_3dview", "contents": "PDF_create_3dview(${1:pdfdoc}, ${2:username}, ${3:optlist})" }, + { "trigger": "PDF_create_action", "contents": "PDF_create_action(${1:pdfdoc}, ${2:type}, ${3:optlist})" }, + { "trigger": "PDF_create_annotation", "contents": "PDF_create_annotation(${1:pdfdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:type}, ${7:optlist})" }, + { "trigger": "PDF_create_bookmark", "contents": "PDF_create_bookmark(${1:pdfdoc}, ${2:text}, ${3:optlist})" }, + { "trigger": "PDF_create_field", "contents": "PDF_create_field(${1:pdfdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:name}, ${7:type}, ${8:optlist})" }, + { "trigger": "PDF_create_fieldgroup", "contents": "PDF_create_fieldgroup(${1:pdfdoc}, ${2:name}, ${3:optlist})" }, + { "trigger": "PDF_create_gstate", "contents": "PDF_create_gstate(${1:pdfdoc}, ${2:optlist})" }, + { "trigger": "PDF_create_pvf", "contents": "PDF_create_pvf(${1:pdfdoc}, ${2:filename}, ${3:data}, ${4:optlist})" }, + { "trigger": "PDF_create_textflow", "contents": "PDF_create_textflow(${1:pdfdoc}, ${2:text}, ${3:optlist})" }, + { "trigger": "PDF_curveto", "contents": "PDF_curveto(${1:p}, ${2:x1}, ${3:y1}, ${4:x2}, ${5:y2}, ${6:x3}, ${7:y3})" }, + { "trigger": "PDF_define_layer", "contents": "PDF_define_layer(${1:pdfdoc}, ${2:name}, ${3:optlist})" }, + { "trigger": "PDF_delete", "contents": "PDF_delete(${1:pdfdoc})" }, + { "trigger": "PDF_delete_pvf", "contents": "PDF_delete_pvf(${1:pdfdoc}, ${2:filename})" }, + { "trigger": "PDF_delete_table", "contents": "PDF_delete_table(${1:pdfdoc}, ${2:table}, ${3:optlist})" }, + { "trigger": "PDF_delete_textflow", "contents": "PDF_delete_textflow(${1:pdfdoc}, ${2:textflow})" }, + { "trigger": "PDF_encoding_set_char", "contents": "PDF_encoding_set_char(${1:pdfdoc}, ${2:encoding}, ${3:slot}, ${4:glyphname}, ${5:uv})" }, + { "trigger": "PDF_end_document", "contents": "PDF_end_document(${1:pdfdoc}, ${2:optlist})" }, + { "trigger": "PDF_end_font", "contents": "PDF_end_font(${1:pdfdoc})" }, + { "trigger": "PDF_end_glyph", "contents": "PDF_end_glyph(${1:pdfdoc})" }, + { "trigger": "PDF_end_item", "contents": "PDF_end_item(${1:pdfdoc}, ${2:id})" }, + { "trigger": "PDF_end_layer", "contents": "PDF_end_layer(${1:pdfdoc})" }, + { "trigger": "PDF_end_page", "contents": "PDF_end_page(${1:p})" }, + { "trigger": "PDF_end_page_ext", "contents": "PDF_end_page_ext(${1:pdfdoc}, ${2:optlist})" }, + { "trigger": "PDF_end_pattern", "contents": "PDF_end_pattern(${1:p})" }, + { "trigger": "PDF_end_template", "contents": "PDF_end_template(${1:p})" }, + { "trigger": "PDF_endpath", "contents": "PDF_endpath(${1:p})" }, + { "trigger": "PDF_fill", "contents": "PDF_fill(${1:p})" }, + { "trigger": "PDF_fill_imageblock", "contents": "PDF_fill_imageblock(${1:pdfdoc}, ${2:page}, ${3:blockname}, ${4:image}, ${5:optlist})" }, + { "trigger": "PDF_fill_pdfblock", "contents": "PDF_fill_pdfblock(${1:pdfdoc}, ${2:page}, ${3:blockname}, ${4:contents}, ${5:optlist})" }, + { "trigger": "PDF_fill_stroke", "contents": "PDF_fill_stroke(${1:p})" }, + { "trigger": "PDF_fill_textblock", "contents": "PDF_fill_textblock(${1:pdfdoc}, ${2:page}, ${3:blockname}, ${4:text}, ${5:optlist})" }, + { "trigger": "PDF_findfont", "contents": "PDF_findfont(${1:p}, ${2:fontname}, ${3:encoding}, ${4:embed})" }, + { "trigger": "PDF_fit_image", "contents": "PDF_fit_image(${1:pdfdoc}, ${2:image}, ${3:x}, ${4:y}, ${5:optlist})" }, + { "trigger": "PDF_fit_pdi_page", "contents": "PDF_fit_pdi_page(${1:pdfdoc}, ${2:page}, ${3:x}, ${4:y}, ${5:optlist})" }, + { "trigger": "PDF_fit_table", "contents": "PDF_fit_table(${1:pdfdoc}, ${2:table}, ${3:llx}, ${4:lly}, ${5:urx}, ${6:ury}, ${7:optlist})" }, + { "trigger": "PDF_fit_textflow", "contents": "PDF_fit_textflow(${1:pdfdoc}, ${2:textflow}, ${3:llx}, ${4:lly}, ${5:urx}, ${6:ury}, ${7:optlist})" }, + { "trigger": "PDF_fit_textline", "contents": "PDF_fit_textline(${1:pdfdoc}, ${2:text}, ${3:x}, ${4:y}, ${5:optlist})" }, + { "trigger": "PDF_get_apiname", "contents": "PDF_get_apiname(${1:pdfdoc})" }, + { "trigger": "PDF_get_buffer", "contents": "PDF_get_buffer(${1:p})" }, + { "trigger": "PDF_get_errmsg", "contents": "PDF_get_errmsg(${1:pdfdoc})" }, + { "trigger": "PDF_get_errnum", "contents": "PDF_get_errnum(${1:pdfdoc})" }, + { "trigger": "PDF_get_font", "contents": "PDF_get_font()" }, + { "trigger": "PDF_get_fontname", "contents": "PDF_get_fontname()" }, + { "trigger": "PDF_get_fontsize", "contents": "PDF_get_fontsize()" }, + { "trigger": "PDF_get_image_height", "contents": "PDF_get_image_height()" }, + { "trigger": "PDF_get_image_width", "contents": "PDF_get_image_width()" }, + { "trigger": "PDF_get_majorversion", "contents": "PDF_get_majorversion()" }, + { "trigger": "PDF_get_minorversion", "contents": "PDF_get_minorversion()" }, + { "trigger": "PDF_get_parameter", "contents": "PDF_get_parameter(${1:p}, ${2:key}, ${3:modifier})" }, + { "trigger": "PDF_get_pdi_parameter", "contents": "PDF_get_pdi_parameter(${1:p}, ${2:key}, ${3:doc}, ${4:page}, ${5:reserved})" }, + { "trigger": "PDF_get_pdi_value", "contents": "PDF_get_pdi_value(${1:p}, ${2:key}, ${3:doc}, ${4:page}, ${5:reserved})" }, + { "trigger": "PDF_get_value", "contents": "PDF_get_value(${1:p}, ${2:key}, ${3:modifier})" }, + { "trigger": "PDF_info_font", "contents": "PDF_info_font(${1:pdfdoc}, ${2:font}, ${3:keyword}, ${4:optlist})" }, + { "trigger": "PDF_info_matchbox", "contents": "PDF_info_matchbox(${1:pdfdoc}, ${2:boxname}, ${3:num}, ${4:keyword})" }, + { "trigger": "PDF_info_table", "contents": "PDF_info_table(${1:pdfdoc}, ${2:table}, ${3:keyword})" }, + { "trigger": "PDF_info_textflow", "contents": "PDF_info_textflow(${1:pdfdoc}, ${2:textflow}, ${3:keyword})" }, + { "trigger": "PDF_info_textline", "contents": "PDF_info_textline(${1:pdfdoc}, ${2:text}, ${3:keyword}, ${4:optlist})" }, + { "trigger": "PDF_initgraphics", "contents": "PDF_initgraphics(${1:p})" }, + { "trigger": "PDF_lineto", "contents": "PDF_lineto(${1:p}, ${2:x}, ${3:y})" }, + { "trigger": "PDF_load_3ddata", "contents": "PDF_load_3ddata(${1:pdfdoc}, ${2:filename}, ${3:optlist})" }, + { "trigger": "PDF_load_font", "contents": "PDF_load_font(${1:pdfdoc}, ${2:fontname}, ${3:encoding}, ${4:optlist})" }, + { "trigger": "PDF_load_iccprofile", "contents": "PDF_load_iccprofile(${1:pdfdoc}, ${2:profilename}, ${3:optlist})" }, + { "trigger": "PDF_load_image", "contents": "PDF_load_image(${1:pdfdoc}, ${2:imagetype}, ${3:filename}, ${4:optlist})" }, + { "trigger": "PDF_makespotcolor", "contents": "PDF_makespotcolor(${1:p}, ${2:spotname})" }, + { "trigger": "PDF_moveto", "contents": "PDF_moveto(${1:p}, ${2:x}, ${3:y})" }, + { "trigger": "PDF_new", "contents": "PDF_new()" }, + { "trigger": "PDF_open_ccitt", "contents": "PDF_open_ccitt(${1:pdfdoc}, ${2:filename}, ${3:width}, ${4:height}, ${5:BitReverse}, ${6:k}, ${7:Blackls1})" }, + { "trigger": "PDF_open_file", "contents": "PDF_open_file(${1:p}, ${2:filename})" }, + { "trigger": "PDF_open_gif", "contents": "PDF_open_gif()" }, + { "trigger": "PDF_open_image", "contents": "PDF_open_image(${1:p}, ${2:imagetype}, ${3:source}, ${4:data}, ${5:length}, ${6:width}, ${7:height}, ${8:components}, ${9:bpc}, ${10:params})" }, + { "trigger": "PDF_open_image_file", "contents": "PDF_open_image_file(${1:p}, ${2:imagetype}, ${3:filename}, ${4:stringparam}, ${5:intparam})" }, + { "trigger": "PDF_open_jpeg", "contents": "PDF_open_jpeg()" }, + { "trigger": "PDF_open_memory_image", "contents": "PDF_open_memory_image(${1:p}, ${2:image})" }, + { "trigger": "PDF_open_pdi", "contents": "PDF_open_pdi(${1:pdfdoc}, ${2:filename}, ${3:optlist}, ${4:len})" }, + { "trigger": "PDF_open_pdi_document", "contents": "PDF_open_pdi_document(${1:p}, ${2:filename}, ${3:optlist})" }, + { "trigger": "PDF_open_pdi_page", "contents": "PDF_open_pdi_page(${1:p}, ${2:doc}, ${3:pagenumber}, ${4:optlist})" }, + { "trigger": "PDF_open_tiff", "contents": "PDF_open_tiff()" }, + { "trigger": "PDF_pcos_get_number", "contents": "PDF_pcos_get_number(${1:p}, ${2:doc}, ${3:path})" }, + { "trigger": "PDF_pcos_get_stream", "contents": "PDF_pcos_get_stream(${1:p}, ${2:doc}, ${3:optlist}, ${4:path})" }, + { "trigger": "PDF_pcos_get_string", "contents": "PDF_pcos_get_string(${1:p}, ${2:doc}, ${3:path})" }, + { "trigger": "PDF_place_image", "contents": "PDF_place_image(${1:pdfdoc}, ${2:image}, ${3:x}, ${4:y}, ${5:scale})" }, + { "trigger": "PDF_place_pdi_page", "contents": "PDF_place_pdi_page(${1:pdfdoc}, ${2:page}, ${3:x}, ${4:y}, ${5:sx}, ${6:sy})" }, + { "trigger": "PDF_process_pdi", "contents": "PDF_process_pdi(${1:pdfdoc}, ${2:doc}, ${3:page}, ${4:optlist})" }, + { "trigger": "PDF_rect", "contents": "PDF_rect(${1:p}, ${2:x}, ${3:y}, ${4:width}, ${5:height})" }, + { "trigger": "PDF_restore", "contents": "PDF_restore(${1:p})" }, + { "trigger": "PDF_resume_page", "contents": "PDF_resume_page(${1:pdfdoc}, ${2:optlist})" }, + { "trigger": "PDF_rotate", "contents": "PDF_rotate(${1:p}, ${2:phi})" }, + { "trigger": "PDF_save", "contents": "PDF_save(${1:p})" }, + { "trigger": "PDF_scale", "contents": "PDF_scale(${1:p}, ${2:sx}, ${3:sy})" }, + { "trigger": "PDF_set_border_color", "contents": "PDF_set_border_color(${1:p}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "PDF_set_border_dash", "contents": "PDF_set_border_dash(${1:pdfdoc}, ${2:black}, ${3:white})" }, + { "trigger": "PDF_set_border_style", "contents": "PDF_set_border_style(${1:pdfdoc}, ${2:style}, ${3:width})" }, + { "trigger": "PDF_set_char_spacing", "contents": "PDF_set_char_spacing()" }, + { "trigger": "PDF_set_duration", "contents": "PDF_set_duration()" }, + { "trigger": "PDF_set_gstate", "contents": "PDF_set_gstate(${1:pdfdoc}, ${2:gstate})" }, + { "trigger": "PDF_set_horiz_scaling", "contents": "PDF_set_horiz_scaling()" }, + { "trigger": "PDF_set_info", "contents": "PDF_set_info(${1:p}, ${2:key}, ${3:value})" }, + { "trigger": "PDF_set_info_author", "contents": "PDF_set_info_author()" }, + { "trigger": "PDF_set_info_creator", "contents": "PDF_set_info_creator()" }, + { "trigger": "PDF_set_info_keywords", "contents": "PDF_set_info_keywords()" }, + { "trigger": "PDF_set_info_subject", "contents": "PDF_set_info_subject()" }, + { "trigger": "PDF_set_info_title", "contents": "PDF_set_info_title()" }, + { "trigger": "PDF_set_layer_dependency", "contents": "PDF_set_layer_dependency(${1:pdfdoc}, ${2:type}, ${3:optlist})" }, + { "trigger": "PDF_set_leading", "contents": "PDF_set_leading()" }, + { "trigger": "PDF_set_parameter", "contents": "PDF_set_parameter(${1:p}, ${2:key}, ${3:value})" }, + { "trigger": "PDF_set_text_matrix", "contents": "PDF_set_text_matrix()" }, + { "trigger": "PDF_set_text_pos", "contents": "PDF_set_text_pos(${1:p}, ${2:x}, ${3:y})" }, + { "trigger": "PDF_set_text_rendering", "contents": "PDF_set_text_rendering()" }, + { "trigger": "PDF_set_text_rise", "contents": "PDF_set_text_rise()" }, + { "trigger": "PDF_set_value", "contents": "PDF_set_value(${1:p}, ${2:key}, ${3:value})" }, + { "trigger": "PDF_set_word_spacing", "contents": "PDF_set_word_spacing()" }, + { "trigger": "PDF_setcolor", "contents": "PDF_setcolor(${1:p}, ${2:fstype}, ${3:colorspace}, ${4:c1}, ${5:c2}, ${6:c3}, ${7:c4})" }, + { "trigger": "PDF_setdash", "contents": "PDF_setdash(${1:pdfdoc}, ${2:b}, ${3:w})" }, + { "trigger": "PDF_setdashpattern", "contents": "PDF_setdashpattern(${1:pdfdoc}, ${2:optlist})" }, + { "trigger": "PDF_setflat", "contents": "PDF_setflat(${1:pdfdoc}, ${2:flatness})" }, + { "trigger": "PDF_setfont", "contents": "PDF_setfont(${1:pdfdoc}, ${2:font}, ${3:fontsize})" }, + { "trigger": "PDF_setgray", "contents": "PDF_setgray(${1:p}, ${2:g})" }, + { "trigger": "PDF_setgray_fill", "contents": "PDF_setgray_fill(${1:p}, ${2:g})" }, + { "trigger": "PDF_setgray_stroke", "contents": "PDF_setgray_stroke(${1:p}, ${2:g})" }, + { "trigger": "PDF_setlinecap", "contents": "PDF_setlinecap(${1:p}, ${2:linecap})" }, + { "trigger": "PDF_setlinejoin", "contents": "PDF_setlinejoin(${1:p}, ${2:value})" }, + { "trigger": "PDF_setlinewidth", "contents": "PDF_setlinewidth(${1:p}, ${2:width})" }, + { "trigger": "PDF_setmatrix", "contents": "PDF_setmatrix(${1:p}, ${2:a}, ${3:b}, ${4:c}, ${5:d}, ${6:e}, ${7:f})" }, + { "trigger": "PDF_setmiterlimit", "contents": "PDF_setmiterlimit(${1:pdfdoc}, ${2:miter})" }, + { "trigger": "PDF_setpolydash", "contents": "PDF_setpolydash()" }, + { "trigger": "PDF_setrgbcolor", "contents": "PDF_setrgbcolor(${1:p}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "PDF_setrgbcolor_fill", "contents": "PDF_setrgbcolor_fill(${1:p}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "PDF_setrgbcolor_stroke", "contents": "PDF_setrgbcolor_stroke(${1:p}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "PDF_shading", "contents": "PDF_shading(${1:pdfdoc}, ${2:shtype}, ${3:x0}, ${4:y0}, ${5:x1}, ${6:y1}, ${7:c1}, ${8:c2}, ${9:c3}, ${10:c4}, ${11:optlist})" }, + { "trigger": "PDF_shading_pattern", "contents": "PDF_shading_pattern(${1:pdfdoc}, ${2:shading}, ${3:optlist})" }, + { "trigger": "PDF_shfill", "contents": "PDF_shfill(${1:pdfdoc}, ${2:shading})" }, + { "trigger": "PDF_show", "contents": "PDF_show(${1:pdfdoc}, ${2:text})" }, + { "trigger": "PDF_show_boxed", "contents": "PDF_show_boxed(${1:p}, ${2:text}, ${3:left}, ${4:top}, ${5:width}, ${6:height}, ${7:mode}, ${8:feature})" }, + { "trigger": "PDF_show_xy", "contents": "PDF_show_xy(${1:p}, ${2:text}, ${3:x}, ${4:y})" }, + { "trigger": "PDF_skew", "contents": "PDF_skew(${1:p}, ${2:alpha}, ${3:beta})" }, + { "trigger": "PDF_stringwidth", "contents": "PDF_stringwidth(${1:p}, ${2:text}, ${3:font}, ${4:fontsize})" }, + { "trigger": "PDF_stroke", "contents": "PDF_stroke(${1:p})" }, + { "trigger": "PDF_suspend_page", "contents": "PDF_suspend_page(${1:pdfdoc}, ${2:optlist})" }, + { "trigger": "PDF_translate", "contents": "PDF_translate(${1:p}, ${2:tx}, ${3:ty})" }, + { "trigger": "PDF_utf16_to_utf8", "contents": "PDF_utf16_to_utf8(${1:pdfdoc}, ${2:utf16string})" }, + { "trigger": "PDF_utf32_to_utf16", "contents": "PDF_utf32_to_utf16(${1:pdfdoc}, ${2:utf32string}, ${3:ordering})" }, + { "trigger": "PDF_utf8_to_utf16", "contents": "PDF_utf8_to_utf16(${1:pdfdoc}, ${2:utf8string}, ${3:ordering})" }, + { "trigger": "pfsockopen", "contents": "pfsockopen(${1:hostname})" }, + { "trigger": "pg_affected_rows", "contents": "pg_affected_rows(${1:result})" }, + { "trigger": "pg_cancel_query", "contents": "pg_cancel_query(${1:connection})" }, + { "trigger": "pg_client_encoding", "contents": "pg_client_encoding()" }, + { "trigger": "pg_close", "contents": "pg_close()" }, + { "trigger": "pg_connect", "contents": "pg_connect(${1:connection_string})" }, + { "trigger": "pg_connection_busy", "contents": "pg_connection_busy(${1:connection})" }, + { "trigger": "pg_connection_reset", "contents": "pg_connection_reset(${1:connection})" }, + { "trigger": "pg_connection_status", "contents": "pg_connection_status(${1:connection})" }, + { "trigger": "pg_convert", "contents": "pg_convert(${1:connection}, ${2:table_name}, ${3:assoc_array})" }, + { "trigger": "pg_copy_from", "contents": "pg_copy_from(${1:connection}, ${2:table_name}, ${3:rows})" }, + { "trigger": "pg_copy_to", "contents": "pg_copy_to(${1:connection}, ${2:table_name})" }, + { "trigger": "pg_dbname", "contents": "pg_dbname()" }, + { "trigger": "pg_delete", "contents": "pg_delete(${1:connection}, ${2:table_name}, ${3:assoc_array})" }, + { "trigger": "pg_end_copy", "contents": "pg_end_copy()" }, + { "trigger": "pg_escape_bytea", "contents": "pg_escape_bytea()" }, + { "trigger": "pg_escape_string", "contents": "pg_escape_string()" }, + { "trigger": "pg_execute", "contents": "pg_execute()" }, + { "trigger": "pg_fetch_all", "contents": "pg_fetch_all(${1:result})" }, + { "trigger": "pg_fetch_all_columns", "contents": "pg_fetch_all_columns(${1:result})" }, + { "trigger": "pg_fetch_array", "contents": "pg_fetch_array(${1:result})" }, + { "trigger": "pg_fetch_assoc", "contents": "pg_fetch_assoc(${1:result})" }, + { "trigger": "pg_fetch_object", "contents": "pg_fetch_object(${1:result})" }, + { "trigger": "pg_fetch_result", "contents": "pg_fetch_result(${1:result}, ${2:row}, ${3:field})" }, + { "trigger": "pg_fetch_row", "contents": "pg_fetch_row(${1:result})" }, + { "trigger": "pg_field_is_null", "contents": "pg_field_is_null(${1:result}, ${2:row}, ${3:field})" }, + { "trigger": "pg_field_name", "contents": "pg_field_name(${1:result}, ${2:field_number})" }, + { "trigger": "pg_field_num", "contents": "pg_field_num(${1:result}, ${2:field_name})" }, + { "trigger": "pg_field_prtlen", "contents": "pg_field_prtlen(${1:result}, ${2:row_number}, ${3:field_name_or_number})" }, + { "trigger": "pg_field_size", "contents": "pg_field_size(${1:result}, ${2:field_number})" }, + { "trigger": "pg_field_table", "contents": "pg_field_table(${1:result}, ${2:field_number})" }, + { "trigger": "pg_field_type", "contents": "pg_field_type(${1:result}, ${2:field_number})" }, + { "trigger": "pg_field_type_oid", "contents": "pg_field_type_oid(${1:result}, ${2:field_number})" }, + { "trigger": "pg_free_result", "contents": "pg_free_result(${1:result})" }, + { "trigger": "pg_get_notify", "contents": "pg_get_notify(${1:connection})" }, + { "trigger": "pg_get_pid", "contents": "pg_get_pid(${1:connection})" }, + { "trigger": "pg_get_result", "contents": "pg_get_result()" }, + { "trigger": "pg_host", "contents": "pg_host()" }, + { "trigger": "pg_insert", "contents": "pg_insert(${1:connection}, ${2:table_name}, ${3:assoc_array})" }, + { "trigger": "pg_last_error", "contents": "pg_last_error()" }, + { "trigger": "pg_last_notice", "contents": "pg_last_notice(${1:connection})" }, + { "trigger": "pg_last_oid", "contents": "pg_last_oid(${1:result})" }, + { "trigger": "pg_lo_close", "contents": "pg_lo_close(${1:large_object})" }, + { "trigger": "pg_lo_create", "contents": "pg_lo_create()" }, + { "trigger": "pg_lo_export", "contents": "pg_lo_export()" }, + { "trigger": "pg_lo_import", "contents": "pg_lo_import()" }, + { "trigger": "pg_lo_open", "contents": "pg_lo_open(${1:connection}, ${2:oid}, ${3:mode})" }, + { "trigger": "pg_lo_read", "contents": "pg_lo_read(${1:large_object})" }, + { "trigger": "pg_lo_read_all", "contents": "pg_lo_read_all(${1:large_object})" }, + { "trigger": "pg_lo_seek", "contents": "pg_lo_seek(${1:large_object}, ${2:offset})" }, + { "trigger": "pg_lo_tell", "contents": "pg_lo_tell(${1:large_object})" }, + { "trigger": "pg_lo_unlink", "contents": "pg_lo_unlink(${1:connection}, ${2:oid})" }, + { "trigger": "pg_lo_write", "contents": "pg_lo_write(${1:large_object}, ${2:data})" }, + { "trigger": "pg_meta_data", "contents": "pg_meta_data(${1:connection}, ${2:table_name})" }, + { "trigger": "pg_num_fields", "contents": "pg_num_fields(${1:result})" }, + { "trigger": "pg_num_rows", "contents": "pg_num_rows(${1:result})" }, + { "trigger": "pg_options", "contents": "pg_options()" }, + { "trigger": "pg_parameter_status", "contents": "pg_parameter_status()" }, + { "trigger": "pg_pconnect", "contents": "pg_pconnect(${1:connection_string})" }, + { "trigger": "pg_ping", "contents": "pg_ping()" }, + { "trigger": "pg_port", "contents": "pg_port()" }, + { "trigger": "pg_prepare", "contents": "pg_prepare()" }, + { "trigger": "pg_put_line", "contents": "pg_put_line()" }, + { "trigger": "pg_query", "contents": "pg_query()" }, + { "trigger": "pg_query_params", "contents": "pg_query_params()" }, + { "trigger": "pg_result_error", "contents": "pg_result_error(${1:result})" }, + { "trigger": "pg_result_error_field", "contents": "pg_result_error_field(${1:result}, ${2:fieldcode})" }, + { "trigger": "pg_result_seek", "contents": "pg_result_seek(${1:result}, ${2:offset})" }, + { "trigger": "pg_result_status", "contents": "pg_result_status(${1:result})" }, + { "trigger": "pg_select", "contents": "pg_select(${1:connection}, ${2:table_name}, ${3:assoc_array})" }, + { "trigger": "pg_send_execute", "contents": "pg_send_execute(${1:connection}, ${2:stmtname}, ${3:params})" }, + { "trigger": "pg_send_prepare", "contents": "pg_send_prepare(${1:connection}, ${2:stmtname}, ${3:query})" }, + { "trigger": "pg_send_query", "contents": "pg_send_query(${1:connection}, ${2:query})" }, + { "trigger": "pg_send_query_params", "contents": "pg_send_query_params(${1:connection}, ${2:query}, ${3:params})" }, + { "trigger": "pg_set_client_encoding", "contents": "pg_set_client_encoding()" }, + { "trigger": "pg_set_error_verbosity", "contents": "pg_set_error_verbosity()" }, + { "trigger": "pg_trace", "contents": "pg_trace(${1:pathname})" }, + { "trigger": "pg_transaction_status", "contents": "pg_transaction_status(${1:connection})" }, + { "trigger": "pg_tty", "contents": "pg_tty()" }, + { "trigger": "pg_unescape_bytea", "contents": "pg_unescape_bytea(${1:data})" }, + { "trigger": "pg_untrace", "contents": "pg_untrace()" }, + { "trigger": "pg_update", "contents": "pg_update(${1:connection}, ${2:table_name}, ${3:data}, ${4:condition})" }, + { "trigger": "pg_version", "contents": "pg_version()" }, + { "trigger": "php_check_syntax", "contents": "php_check_syntax(${1:filename})" }, + { "trigger": "php_ini_loaded_file", "contents": "php_ini_loaded_file()" }, + { "trigger": "php_ini_scanned_files", "contents": "php_ini_scanned_files()" }, + { "trigger": "php_logo_guid", "contents": "php_logo_guid()" }, + { "trigger": "php_sapi_name", "contents": "php_sapi_name()" }, + { "trigger": "php_strip_whitespace", "contents": "php_strip_whitespace(${1:filename})" }, + { "trigger": "php_uname", "contents": "php_uname()" }, + { "trigger": "phpcredits", "contents": "phpcredits()" }, + { "trigger": "phpinfo", "contents": "phpinfo()" }, + { "trigger": "phpversion", "contents": "phpversion()" }, + { "trigger": "pi", "contents": "pi()" }, + { "trigger": "png2wbmp", "contents": "png2wbmp(${1:pngname}, ${2:wbmpname}, ${3:dest_height}, ${4:dest_width}, ${5:threshold})" }, + { "trigger": "popen", "contents": "popen(${1:command}, ${2:mode})" }, + { "trigger": "pos", "contents": "pos()" }, + { "trigger": "posix_access", "contents": "posix_access(${1:file})" }, + { "trigger": "posix_ctermid", "contents": "posix_ctermid()" }, + { "trigger": "posix_errno", "contents": "posix_errno()" }, + { "trigger": "posix_get_last_error", "contents": "posix_get_last_error()" }, + { "trigger": "posix_getcwd", "contents": "posix_getcwd()" }, + { "trigger": "posix_getegid", "contents": "posix_getegid()" }, + { "trigger": "posix_geteuid", "contents": "posix_geteuid()" }, + { "trigger": "posix_getgid", "contents": "posix_getgid()" }, + { "trigger": "posix_getgrgid", "contents": "posix_getgrgid(${1:gid})" }, + { "trigger": "posix_getgrnam", "contents": "posix_getgrnam(${1:name})" }, + { "trigger": "posix_getgroups", "contents": "posix_getgroups()" }, + { "trigger": "posix_getlogin", "contents": "posix_getlogin()" }, + { "trigger": "posix_getpgid", "contents": "posix_getpgid(${1:pid})" }, + { "trigger": "posix_getpgrp", "contents": "posix_getpgrp()" }, + { "trigger": "posix_getpid", "contents": "posix_getpid()" }, + { "trigger": "posix_getppid", "contents": "posix_getppid()" }, + { "trigger": "posix_getpwnam", "contents": "posix_getpwnam(${1:username})" }, + { "trigger": "posix_getpwuid", "contents": "posix_getpwuid(${1:uid})" }, + { "trigger": "posix_getrlimit", "contents": "posix_getrlimit()" }, + { "trigger": "posix_getsid", "contents": "posix_getsid(${1:pid})" }, + { "trigger": "posix_getuid", "contents": "posix_getuid()" }, + { "trigger": "posix_initgroups", "contents": "posix_initgroups(${1:name}, ${2:base_group_id})" }, + { "trigger": "posix_isatty", "contents": "posix_isatty(${1:fd})" }, + { "trigger": "posix_kill", "contents": "posix_kill(${1:pid}, ${2:sig})" }, + { "trigger": "posix_mkfifo", "contents": "posix_mkfifo(${1:pathname}, ${2:mode})" }, + { "trigger": "posix_mknod", "contents": "posix_mknod(${1:pathname}, ${2:mode})" }, + { "trigger": "posix_setegid", "contents": "posix_setegid(${1:gid})" }, + { "trigger": "posix_seteuid", "contents": "posix_seteuid(${1:uid})" }, + { "trigger": "posix_setgid", "contents": "posix_setgid(${1:gid})" }, + { "trigger": "posix_setpgid", "contents": "posix_setpgid(${1:pid}, ${2:pgid})" }, + { "trigger": "posix_setsid", "contents": "posix_setsid()" }, + { "trigger": "posix_setuid", "contents": "posix_setuid(${1:uid})" }, + { "trigger": "posix_strerror", "contents": "posix_strerror(${1:errno})" }, + { "trigger": "posix_times", "contents": "posix_times()" }, + { "trigger": "posix_ttyname", "contents": "posix_ttyname(${1:fd})" }, + { "trigger": "posix_uname", "contents": "posix_uname()" }, + { "trigger": "pow", "contents": "pow(${1:base}, ${2:exp})" }, + { "trigger": "preg_filter", "contents": "preg_filter(${1:pattern}, ${2:replacement}, ${3:subject})" }, + { "trigger": "preg_grep", "contents": "preg_grep(${1:pattern}, ${2:input})" }, + { "trigger": "preg_last_error", "contents": "preg_last_error()" }, + { "trigger": "preg_match", "contents": "preg_match(${1:pattern}, ${2:subject})" }, + { "trigger": "preg_match_all", "contents": "preg_match_all(${1:pattern}, ${2:subject}, ${3:matches})" }, + { "trigger": "preg_quote", "contents": "preg_quote(${1:str})" }, + { "trigger": "preg_replace", "contents": "preg_replace(${1:pattern}, ${2:replacement}, ${3:subject})" }, + { "trigger": "preg_replace_callback", "contents": "preg_replace_callback(${1:pattern}, ${2:callback}, ${3:subject})" }, + { "trigger": "preg_replace_callback_array", "contents": "preg_replace_callback_array(${1:patterns_and_callbacks}, ${2:subject})" }, + { "trigger": "preg_split", "contents": "preg_split(${1:pattern}, ${2:subject})" }, + { "trigger": "prev", "contents": "prev(${1:array})" }, + { "trigger": "print", "contents": "print(${1:arg})" }, + { "trigger": "print_r", "contents": "print_r(${1:expression})" }, + { "trigger": "printer_abort", "contents": "printer_abort(${1:printer_handle})" }, + { "trigger": "printer_close", "contents": "printer_close(${1:printer_handle})" }, + { "trigger": "printer_create_brush", "contents": "printer_create_brush(${1:style}, ${2:color})" }, + { "trigger": "printer_create_dc", "contents": "printer_create_dc(${1:printer_handle})" }, + { "trigger": "printer_create_font", "contents": "printer_create_font(${1:face}, ${2:height}, ${3:width}, ${4:font_weight}, ${5:italic}, ${6:underline}, ${7:strikeout}, ${8:orientation})" }, + { "trigger": "printer_create_pen", "contents": "printer_create_pen(${1:style}, ${2:width}, ${3:color})" }, + { "trigger": "printer_delete_brush", "contents": "printer_delete_brush(${1:brush_handle})" }, + { "trigger": "printer_delete_dc", "contents": "printer_delete_dc(${1:printer_handle})" }, + { "trigger": "printer_delete_font", "contents": "printer_delete_font(${1:font_handle})" }, + { "trigger": "printer_delete_pen", "contents": "printer_delete_pen(${1:pen_handle})" }, + { "trigger": "printer_draw_bmp", "contents": "printer_draw_bmp(${1:printer_handle}, ${2:filename}, ${3:x}, ${4:y})" }, + { "trigger": "printer_draw_chord", "contents": "printer_draw_chord(${1:printer_handle}, ${2:rec_x}, ${3:rec_y}, ${4:rec_x1}, ${5:rec_y1}, ${6:rad_x}, ${7:rad_y}, ${8:rad_x1}, ${9:rad_y1})" }, + { "trigger": "printer_draw_elipse", "contents": "printer_draw_elipse(${1:printer_handle}, ${2:ul_x}, ${3:ul_y}, ${4:lr_x}, ${5:lr_y})" }, + { "trigger": "printer_draw_line", "contents": "printer_draw_line(${1:printer_handle}, ${2:from_x}, ${3:from_y}, ${4:to_x}, ${5:to_y})" }, + { "trigger": "printer_draw_pie", "contents": "printer_draw_pie(${1:printer_handle}, ${2:rec_x}, ${3:rec_y}, ${4:rec_x1}, ${5:rec_y1}, ${6:rad1_x}, ${7:rad1_y}, ${8:rad2_x}, ${9:rad2_y})" }, + { "trigger": "printer_draw_rectangle", "contents": "printer_draw_rectangle(${1:printer_handle}, ${2:ul_x}, ${3:ul_y}, ${4:lr_x}, ${5:lr_y})" }, + { "trigger": "printer_draw_roundrect", "contents": "printer_draw_roundrect(${1:printer_handle}, ${2:ul_x}, ${3:ul_y}, ${4:lr_x}, ${5:lr_y}, ${6:width}, ${7:height})" }, + { "trigger": "printer_draw_text", "contents": "printer_draw_text(${1:printer_handle}, ${2:text}, ${3:x}, ${4:y})" }, + { "trigger": "printer_end_doc", "contents": "printer_end_doc(${1:printer_handle})" }, + { "trigger": "printer_end_page", "contents": "printer_end_page(${1:printer_handle})" }, + { "trigger": "printer_get_option", "contents": "printer_get_option(${1:printer_handle}, ${2:option})" }, + { "trigger": "printer_list", "contents": "printer_list(${1:enumtype})" }, + { "trigger": "printer_logical_fontheight", "contents": "printer_logical_fontheight(${1:printer_handle}, ${2:height})" }, + { "trigger": "printer_open", "contents": "printer_open()" }, + { "trigger": "printer_select_brush", "contents": "printer_select_brush(${1:printer_handle}, ${2:brush_handle})" }, + { "trigger": "printer_select_font", "contents": "printer_select_font(${1:printer_handle}, ${2:font_handle})" }, + { "trigger": "printer_select_pen", "contents": "printer_select_pen(${1:printer_handle}, ${2:pen_handle})" }, + { "trigger": "printer_set_option", "contents": "printer_set_option(${1:printer_handle}, ${2:option}, ${3:value})" }, + { "trigger": "printer_start_doc", "contents": "printer_start_doc(${1:printer_handle})" }, + { "trigger": "printer_start_page", "contents": "printer_start_page(${1:printer_handle})" }, + { "trigger": "printer_write", "contents": "printer_write(${1:printer_handle}, ${2:content})" }, + { "trigger": "printf", "contents": "printf(${1:format})" }, + { "trigger": "proc_close", "contents": "proc_close(${1:process})" }, + { "trigger": "proc_get_status", "contents": "proc_get_status(${1:process})" }, + { "trigger": "proc_nice", "contents": "proc_nice(${1:increment})" }, + { "trigger": "proc_open", "contents": "proc_open(${1:cmd}, ${2:descriptorspec}, ${3:pipes})" }, + { "trigger": "proc_terminate", "contents": "proc_terminate(${1:process})" }, + { "trigger": "property_exists", "contents": "property_exists(${1:class}, ${2:property})" }, + { "trigger": "ps_add_bookmark", "contents": "ps_add_bookmark(${1:psdoc}, ${2:text})" }, + { "trigger": "ps_add_launchlink", "contents": "ps_add_launchlink(${1:psdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:filename})" }, + { "trigger": "ps_add_locallink", "contents": "ps_add_locallink(${1:psdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:page}, ${7:dest})" }, + { "trigger": "ps_add_note", "contents": "ps_add_note(${1:psdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:contents}, ${7:title}, ${8:icon}, ${9:open})" }, + { "trigger": "ps_add_pdflink", "contents": "ps_add_pdflink(${1:psdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:filename}, ${7:page}, ${8:dest})" }, + { "trigger": "ps_add_weblink", "contents": "ps_add_weblink(${1:psdoc}, ${2:llx}, ${3:lly}, ${4:urx}, ${5:ury}, ${6:url})" }, + { "trigger": "ps_arc", "contents": "ps_arc(${1:psdoc}, ${2:x}, ${3:y}, ${4:radius}, ${5:alpha}, ${6:beta})" }, + { "trigger": "ps_arcn", "contents": "ps_arcn(${1:psdoc}, ${2:x}, ${3:y}, ${4:radius}, ${5:alpha}, ${6:beta})" }, + { "trigger": "ps_begin_page", "contents": "ps_begin_page(${1:psdoc}, ${2:width}, ${3:height})" }, + { "trigger": "ps_begin_pattern", "contents": "ps_begin_pattern(${1:psdoc}, ${2:width}, ${3:height}, ${4:xstep}, ${5:ystep}, ${6:painttype})" }, + { "trigger": "ps_begin_template", "contents": "ps_begin_template(${1:psdoc}, ${2:width}, ${3:height})" }, + { "trigger": "ps_circle", "contents": "ps_circle(${1:psdoc}, ${2:x}, ${3:y}, ${4:radius})" }, + { "trigger": "ps_clip", "contents": "ps_clip(${1:psdoc})" }, + { "trigger": "ps_close", "contents": "ps_close(${1:psdoc})" }, + { "trigger": "ps_close_image", "contents": "ps_close_image(${1:psdoc}, ${2:imageid})" }, + { "trigger": "ps_closepath", "contents": "ps_closepath(${1:psdoc})" }, + { "trigger": "ps_closepath_stroke", "contents": "ps_closepath_stroke(${1:psdoc})" }, + { "trigger": "ps_continue_text", "contents": "ps_continue_text(${1:psdoc}, ${2:text})" }, + { "trigger": "ps_curveto", "contents": "ps_curveto(${1:psdoc}, ${2:x1}, ${3:y1}, ${4:x2}, ${5:y2}, ${6:x3}, ${7:y3})" }, + { "trigger": "ps_delete", "contents": "ps_delete(${1:psdoc})" }, + { "trigger": "ps_end_page", "contents": "ps_end_page(${1:psdoc})" }, + { "trigger": "ps_end_pattern", "contents": "ps_end_pattern(${1:psdoc})" }, + { "trigger": "ps_end_template", "contents": "ps_end_template(${1:psdoc})" }, + { "trigger": "ps_fill", "contents": "ps_fill(${1:psdoc})" }, + { "trigger": "ps_fill_stroke", "contents": "ps_fill_stroke(${1:psdoc})" }, + { "trigger": "ps_findfont", "contents": "ps_findfont(${1:psdoc}, ${2:fontname}, ${3:encoding})" }, + { "trigger": "ps_get_buffer", "contents": "ps_get_buffer(${1:psdoc})" }, + { "trigger": "ps_get_parameter", "contents": "ps_get_parameter(${1:psdoc}, ${2:name})" }, + { "trigger": "ps_get_value", "contents": "ps_get_value(${1:psdoc}, ${2:name})" }, + { "trigger": "ps_hyphenate", "contents": "ps_hyphenate(${1:psdoc}, ${2:text})" }, + { "trigger": "ps_include_file", "contents": "ps_include_file(${1:psdoc}, ${2:file})" }, + { "trigger": "ps_lineto", "contents": "ps_lineto(${1:psdoc}, ${2:x}, ${3:y})" }, + { "trigger": "ps_makespotcolor", "contents": "ps_makespotcolor(${1:psdoc}, ${2:name})" }, + { "trigger": "ps_moveto", "contents": "ps_moveto(${1:psdoc}, ${2:x}, ${3:y})" }, + { "trigger": "ps_new", "contents": "ps_new()" }, + { "trigger": "ps_open_file", "contents": "ps_open_file(${1:psdoc})" }, + { "trigger": "ps_open_image", "contents": "ps_open_image(${1:psdoc}, ${2:type}, ${3:source}, ${4:data}, ${5:lenght}, ${6:width}, ${7:height}, ${8:components}, ${9:bpc}, ${10:params})" }, + { "trigger": "ps_open_image_file", "contents": "ps_open_image_file(${1:psdoc}, ${2:type}, ${3:filename})" }, + { "trigger": "ps_open_memory_image", "contents": "ps_open_memory_image(${1:psdoc}, ${2:gd})" }, + { "trigger": "ps_place_image", "contents": "ps_place_image(${1:psdoc}, ${2:imageid}, ${3:x}, ${4:y}, ${5:scale})" }, + { "trigger": "ps_rect", "contents": "ps_rect(${1:psdoc}, ${2:x}, ${3:y}, ${4:width}, ${5:height})" }, + { "trigger": "ps_restore", "contents": "ps_restore(${1:psdoc})" }, + { "trigger": "ps_rotate", "contents": "ps_rotate(${1:psdoc}, ${2:rot})" }, + { "trigger": "ps_save", "contents": "ps_save(${1:psdoc})" }, + { "trigger": "ps_scale", "contents": "ps_scale(${1:psdoc}, ${2:x}, ${3:y})" }, + { "trigger": "ps_set_border_color", "contents": "ps_set_border_color(${1:psdoc}, ${2:red}, ${3:green}, ${4:blue})" }, + { "trigger": "ps_set_border_dash", "contents": "ps_set_border_dash(${1:psdoc}, ${2:black}, ${3:white})" }, + { "trigger": "ps_set_border_style", "contents": "ps_set_border_style(${1:psdoc}, ${2:style}, ${3:width})" }, + { "trigger": "ps_set_info", "contents": "ps_set_info(${1:p}, ${2:key}, ${3:val})" }, + { "trigger": "ps_set_parameter", "contents": "ps_set_parameter(${1:psdoc}, ${2:name}, ${3:value})" }, + { "trigger": "ps_set_text_pos", "contents": "ps_set_text_pos(${1:psdoc}, ${2:x}, ${3:y})" }, + { "trigger": "ps_set_value", "contents": "ps_set_value(${1:psdoc}, ${2:name}, ${3:value})" }, + { "trigger": "ps_setcolor", "contents": "ps_setcolor(${1:psdoc}, ${2:type}, ${3:colorspace}, ${4:c1}, ${5:c2}, ${6:c3}, ${7:c4})" }, + { "trigger": "ps_setdash", "contents": "ps_setdash(${1:psdoc}, ${2:on}, ${3:off})" }, + { "trigger": "ps_setflat", "contents": "ps_setflat(${1:psdoc}, ${2:value})" }, + { "trigger": "ps_setfont", "contents": "ps_setfont(${1:psdoc}, ${2:fontid}, ${3:size})" }, + { "trigger": "ps_setgray", "contents": "ps_setgray(${1:psdoc}, ${2:gray})" }, + { "trigger": "ps_setlinecap", "contents": "ps_setlinecap(${1:psdoc}, ${2:type})" }, + { "trigger": "ps_setlinejoin", "contents": "ps_setlinejoin(${1:psdoc}, ${2:type})" }, + { "trigger": "ps_setlinewidth", "contents": "ps_setlinewidth(${1:psdoc}, ${2:width})" }, + { "trigger": "ps_setmiterlimit", "contents": "ps_setmiterlimit(${1:psdoc}, ${2:value})" }, + { "trigger": "ps_setoverprintmode", "contents": "ps_setoverprintmode(${1:psdoc}, ${2:mode})" }, + { "trigger": "ps_setpolydash", "contents": "ps_setpolydash(${1:psdoc}, ${2:arr})" }, + { "trigger": "ps_shading", "contents": "ps_shading(${1:psdoc}, ${2:type}, ${3:x0}, ${4:y0}, ${5:x1}, ${6:y1}, ${7:c1}, ${8:c2}, ${9:c3}, ${10:c4}, ${11:optlist})" }, + { "trigger": "ps_shading_pattern", "contents": "ps_shading_pattern(${1:psdoc}, ${2:shadingid}, ${3:optlist})" }, + { "trigger": "ps_shfill", "contents": "ps_shfill(${1:psdoc}, ${2:shadingid})" }, + { "trigger": "ps_show", "contents": "ps_show(${1:psdoc}, ${2:text})" }, + { "trigger": "ps_show2", "contents": "ps_show2(${1:psdoc}, ${2:text}, ${3:len})" }, + { "trigger": "ps_show_boxed", "contents": "ps_show_boxed(${1:psdoc}, ${2:text}, ${3:left}, ${4:bottom}, ${5:width}, ${6:height}, ${7:hmode})" }, + { "trigger": "ps_show_xy", "contents": "ps_show_xy(${1:psdoc}, ${2:text}, ${3:x}, ${4:y})" }, + { "trigger": "ps_show_xy2", "contents": "ps_show_xy2(${1:psdoc}, ${2:text}, ${3:len}, ${4:xcoor}, ${5:ycoor})" }, + { "trigger": "ps_string_geometry", "contents": "ps_string_geometry(${1:psdoc}, ${2:text})" }, + { "trigger": "ps_stringwidth", "contents": "ps_stringwidth(${1:psdoc}, ${2:text})" }, + { "trigger": "ps_stroke", "contents": "ps_stroke(${1:psdoc})" }, + { "trigger": "ps_symbol", "contents": "ps_symbol(${1:psdoc}, ${2:ord})" }, + { "trigger": "ps_symbol_name", "contents": "ps_symbol_name(${1:psdoc}, ${2:ord})" }, + { "trigger": "ps_symbol_width", "contents": "ps_symbol_width(${1:psdoc}, ${2:ord})" }, + { "trigger": "ps_translate", "contents": "ps_translate(${1:psdoc}, ${2:x}, ${3:y})" }, + { "trigger": "pspell_add_to_personal", "contents": "pspell_add_to_personal(${1:dictionary_link}, ${2:word})" }, + { "trigger": "pspell_add_to_session", "contents": "pspell_add_to_session(${1:dictionary_link}, ${2:word})" }, + { "trigger": "pspell_check", "contents": "pspell_check(${1:dictionary_link}, ${2:word})" }, + { "trigger": "pspell_clear_session", "contents": "pspell_clear_session(${1:dictionary_link})" }, + { "trigger": "pspell_config_create", "contents": "pspell_config_create(${1:language})" }, + { "trigger": "pspell_config_data_dir", "contents": "pspell_config_data_dir(${1:conf}, ${2:directory})" }, + { "trigger": "pspell_config_dict_dir", "contents": "pspell_config_dict_dir(${1:conf}, ${2:directory})" }, + { "trigger": "pspell_config_ignore", "contents": "pspell_config_ignore(${1:dictionary_link}, ${2:n})" }, + { "trigger": "pspell_config_mode", "contents": "pspell_config_mode(${1:dictionary_link}, ${2:mode})" }, + { "trigger": "pspell_config_personal", "contents": "pspell_config_personal(${1:dictionary_link}, ${2:file})" }, + { "trigger": "pspell_config_repl", "contents": "pspell_config_repl(${1:dictionary_link}, ${2:file})" }, + { "trigger": "pspell_config_runtogether", "contents": "pspell_config_runtogether(${1:dictionary_link}, ${2:flag})" }, + { "trigger": "pspell_config_save_repl", "contents": "pspell_config_save_repl(${1:dictionary_link}, ${2:flag})" }, + { "trigger": "pspell_new", "contents": "pspell_new(${1:language})" }, + { "trigger": "pspell_new_config", "contents": "pspell_new_config(${1:config})" }, + { "trigger": "pspell_new_personal", "contents": "pspell_new_personal(${1:personal}, ${2:language})" }, + { "trigger": "pspell_save_wordlist", "contents": "pspell_save_wordlist(${1:dictionary_link})" }, + { "trigger": "pspell_store_replacement", "contents": "pspell_store_replacement(${1:dictionary_link}, ${2:misspelled}, ${3:correct})" }, + { "trigger": "pspell_suggest", "contents": "pspell_suggest(${1:dictionary_link}, ${2:word})" }, + { "trigger": "putenv", "contents": "putenv(${1:setting})" }, + { "trigger": "px_close", "contents": "px_close(${1:pxdoc})" }, + { "trigger": "px_create_fp", "contents": "px_create_fp(${1:pxdoc}, ${2:file}, ${3:fielddesc})" }, + { "trigger": "px_date2string", "contents": "px_date2string(${1:pxdoc}, ${2:value}, ${3:format})" }, + { "trigger": "px_delete", "contents": "px_delete(${1:pxdoc})" }, + { "trigger": "px_delete_record", "contents": "px_delete_record(${1:pxdoc}, ${2:num})" }, + { "trigger": "px_get_field", "contents": "px_get_field(${1:pxdoc}, ${2:fieldno})" }, + { "trigger": "px_get_info", "contents": "px_get_info(${1:pxdoc})" }, + { "trigger": "px_get_parameter", "contents": "px_get_parameter(${1:pxdoc}, ${2:name})" }, + { "trigger": "px_get_record", "contents": "px_get_record(${1:pxdoc}, ${2:num})" }, + { "trigger": "px_get_schema", "contents": "px_get_schema(${1:pxdoc})" }, + { "trigger": "px_get_value", "contents": "px_get_value(${1:pxdoc}, ${2:name})" }, + { "trigger": "px_insert_record", "contents": "px_insert_record(${1:pxdoc}, ${2:data})" }, + { "trigger": "px_new", "contents": "px_new()" }, + { "trigger": "px_numfields", "contents": "px_numfields(${1:pxdoc})" }, + { "trigger": "px_numrecords", "contents": "px_numrecords(${1:pxdoc})" }, + { "trigger": "px_open_fp", "contents": "px_open_fp(${1:pxdoc}, ${2:file})" }, + { "trigger": "px_put_record", "contents": "px_put_record(${1:pxdoc}, ${2:record})" }, + { "trigger": "px_retrieve_record", "contents": "px_retrieve_record(${1:pxdoc}, ${2:num})" }, + { "trigger": "px_set_blob_file", "contents": "px_set_blob_file(${1:pxdoc}, ${2:filename})" }, + { "trigger": "px_set_parameter", "contents": "px_set_parameter(${1:pxdoc}, ${2:name}, ${3:value})" }, + { "trigger": "px_set_tablename", "contents": "px_set_tablename(${1:pxdoc}, ${2:name})" }, + { "trigger": "px_set_targetencoding", "contents": "px_set_targetencoding(${1:pxdoc}, ${2:encoding})" }, + { "trigger": "px_set_value", "contents": "px_set_value(${1:pxdoc}, ${2:name}, ${3:value})" }, + { "trigger": "px_timestamp2string", "contents": "px_timestamp2string(${1:pxdoc}, ${2:value}, ${3:format})" }, + { "trigger": "px_update_record", "contents": "px_update_record(${1:pxdoc}, ${2:data}, ${3:num})" }, + { "trigger": "qdom_error", "contents": "qdom_error()" }, + { "trigger": "qdom_tree", "contents": "qdom_tree(${1:doc})" }, + { "trigger": "quoted_printable_decode", "contents": "quoted_printable_decode(${1:str})" }, + { "trigger": "quoted_printable_encode", "contents": "quoted_printable_encode(${1:str})" }, + { "trigger": "quotemeta", "contents": "quotemeta(${1:str})" }, + { "trigger": "rad2deg", "contents": "rad2deg(${1:number})" }, + { "trigger": "radius_acct_open", "contents": "radius_acct_open()" }, + { "trigger": "radius_add_server", "contents": "radius_add_server(${1:radius_handle}, ${2:hostname}, ${3:port}, ${4:secret}, ${5:timeout}, ${6:max_tries})" }, + { "trigger": "radius_auth_open", "contents": "radius_auth_open()" }, + { "trigger": "radius_close", "contents": "radius_close(${1:radius_handle})" }, + { "trigger": "radius_config", "contents": "radius_config(${1:radius_handle}, ${2:file})" }, + { "trigger": "radius_create_request", "contents": "radius_create_request(${1:radius_handle}, ${2:type})" }, + { "trigger": "radius_cvt_addr", "contents": "radius_cvt_addr(${1:data})" }, + { "trigger": "radius_cvt_int", "contents": "radius_cvt_int(${1:data})" }, + { "trigger": "radius_cvt_string", "contents": "radius_cvt_string(${1:data})" }, + { "trigger": "radius_demangle", "contents": "radius_demangle(${1:radius_handle}, ${2:mangled})" }, + { "trigger": "radius_demangle_mppe_key", "contents": "radius_demangle_mppe_key(${1:radius_handle}, ${2:mangled})" }, + { "trigger": "radius_get_attr", "contents": "radius_get_attr(${1:radius_handle})" }, + { "trigger": "radius_get_vendor_attr", "contents": "radius_get_vendor_attr(${1:data})" }, + { "trigger": "radius_put_addr", "contents": "radius_put_addr(${1:radius_handle}, ${2:type}, ${3:addr})" }, + { "trigger": "radius_put_attr", "contents": "radius_put_attr(${1:radius_handle}, ${2:type}, ${3:value})" }, + { "trigger": "radius_put_int", "contents": "radius_put_int(${1:radius_handle}, ${2:type}, ${3:value})" }, + { "trigger": "radius_put_string", "contents": "radius_put_string(${1:radius_handle}, ${2:type}, ${3:value})" }, + { "trigger": "radius_put_vendor_addr", "contents": "radius_put_vendor_addr(${1:radius_handle}, ${2:vendor}, ${3:type}, ${4:addr})" }, + { "trigger": "radius_put_vendor_attr", "contents": "radius_put_vendor_attr(${1:radius_handle}, ${2:vendor}, ${3:type}, ${4:value})" }, + { "trigger": "radius_put_vendor_int", "contents": "radius_put_vendor_int(${1:radius_handle}, ${2:vendor}, ${3:type}, ${4:value})" }, + { "trigger": "radius_put_vendor_string", "contents": "radius_put_vendor_string(${1:radius_handle}, ${2:vendor}, ${3:type}, ${4:value})" }, + { "trigger": "radius_request_authenticator", "contents": "radius_request_authenticator(${1:radius_handle})" }, + { "trigger": "radius_send_request", "contents": "radius_send_request(${1:radius_handle})" }, + { "trigger": "radius_server_secret", "contents": "radius_server_secret(${1:radius_handle})" }, + { "trigger": "radius_strerror", "contents": "radius_strerror(${1:radius_handle})" }, + { "trigger": "rand", "contents": "rand()" }, + { "trigger": "random_bytes", "contents": "random_bytes(${1:length})" }, + { "trigger": "random_int", "contents": "random_int(${1:min}, ${2:max})" }, + { "trigger": "range", "contents": "range(${1:low}, ${2:high})" }, + { "trigger": "rar_wrapper_cache_stats", "contents": "rar_wrapper_cache_stats()" }, + { "trigger": "rawurldecode", "contents": "rawurldecode(${1:str})" }, + { "trigger": "rawurlencode", "contents": "rawurlencode(${1:str})" }, + { "trigger": "read_exif_data", "contents": "read_exif_data()" }, + { "trigger": "readdir", "contents": "readdir()" }, + { "trigger": "readfile", "contents": "readfile(${1:filename})" }, + { "trigger": "readgzfile", "contents": "readgzfile(${1:filename})" }, + { "trigger": "readline", "contents": "readline()" }, + { "trigger": "readline_add_history", "contents": "readline_add_history(${1:line})" }, + { "trigger": "readline_callback_handler_install", "contents": "readline_callback_handler_install(${1:prompt}, ${2:callback})" }, + { "trigger": "readline_callback_handler_remove", "contents": "readline_callback_handler_remove()" }, + { "trigger": "readline_callback_read_char", "contents": "readline_callback_read_char()" }, + { "trigger": "readline_clear_history", "contents": "readline_clear_history()" }, + { "trigger": "readline_completion_function", "contents": "readline_completion_function(${1:function})" }, + { "trigger": "readline_info", "contents": "readline_info()" }, + { "trigger": "readline_list_history", "contents": "readline_list_history()" }, + { "trigger": "readline_on_new_line", "contents": "readline_on_new_line()" }, + { "trigger": "readline_read_history", "contents": "readline_read_history()" }, + { "trigger": "readline_redisplay", "contents": "readline_redisplay()" }, + { "trigger": "readline_write_history", "contents": "readline_write_history()" }, + { "trigger": "readlink", "contents": "readlink(${1:path})" }, + { "trigger": "realpath", "contents": "realpath(${1:path})" }, + { "trigger": "realpath_cache_get", "contents": "realpath_cache_get()" }, + { "trigger": "realpath_cache_size", "contents": "realpath_cache_size()" }, + { "trigger": "recode", "contents": "recode()" }, + { "trigger": "recode_file", "contents": "recode_file(${1:request}, ${2:input}, ${3:output})" }, + { "trigger": "recode_string", "contents": "recode_string(${1:request}, ${2:string})" }, + { "trigger": "", "contents": "(${1:name})" }, + { "trigger": "register_shutdown_function", "contents": "register_shutdown_function(${1:function})" }, + { "trigger": "register_tick_function", "contents": "register_tick_function(${1:function})" }, + { "trigger": "rename", "contents": "rename(${1:oldname}, ${2:newname})" }, + { "trigger": "rename_function", "contents": "rename_function(${1:original_name}, ${2:new_name})" }, + { "trigger": "", "contents": "()" }, + { "trigger": "", "contents": "()" }, + { "trigger": "reset", "contents": "reset(${1:array})" }, + { "trigger": "restore_error_handler", "contents": "restore_error_handler()" }, + { "trigger": "restore_exception_handler", "contents": "restore_exception_handler()" }, + { "trigger": "restore_include_path", "contents": "restore_include_path()" }, + { "trigger": "", "contents": "()" }, + { "trigger": "rewind", "contents": "rewind(${1:handle})" }, + { "trigger": "rewinddir", "contents": "rewinddir()" }, + { "trigger": "rmdir", "contents": "rmdir(${1:dirname})" }, + { "trigger": "round", "contents": "round(${1:val})" }, + { "trigger": "rpm_close", "contents": "rpm_close(${1:rpmr})" }, + { "trigger": "rpm_get_tag", "contents": "rpm_get_tag(${1:rpmr}, ${2:tagnum})" }, + { "trigger": "rpm_is_valid", "contents": "rpm_is_valid(${1:filename})" }, + { "trigger": "rpm_open", "contents": "rpm_open(${1:filename})" }, + { "trigger": "rpm_version", "contents": "rpm_version()" }, + { "trigger": "rsort", "contents": "rsort(${1:array})" }, + { "trigger": "rtrim", "contents": "rtrim(${1:str})" }, + { "trigger": "runkit_class_adopt", "contents": "runkit_class_adopt(${1:classname}, ${2:parentname})" }, + { "trigger": "runkit_class_emancipate", "contents": "runkit_class_emancipate(${1:classname})" }, + { "trigger": "runkit_constant_add", "contents": "runkit_constant_add(${1:constname}, ${2:value})" }, + { "trigger": "runkit_constant_redefine", "contents": "runkit_constant_redefine(${1:constname}, ${2:newvalue})" }, + { "trigger": "runkit_constant_remove", "contents": "runkit_constant_remove(${1:constname})" }, + { "trigger": "runkit_function_add", "contents": "runkit_function_add(${1:funcname}, ${2:arglist}, ${3:code})" }, + { "trigger": "runkit_function_copy", "contents": "runkit_function_copy(${1:funcname}, ${2:targetname})" }, + { "trigger": "runkit_function_redefine", "contents": "runkit_function_redefine(${1:funcname}, ${2:arglist}, ${3:code})" }, + { "trigger": "runkit_function_remove", "contents": "runkit_function_remove(${1:funcname})" }, + { "trigger": "runkit_function_rename", "contents": "runkit_function_rename(${1:funcname}, ${2:newname})" }, + { "trigger": "runkit_import", "contents": "runkit_import(${1:filename})" }, + { "trigger": "runkit_lint", "contents": "runkit_lint(${1:code})" }, + { "trigger": "runkit_lint_file", "contents": "runkit_lint_file(${1:filename})" }, + { "trigger": "runkit_method_add", "contents": "runkit_method_add(${1:classname}, ${2:methodname}, ${3:args}, ${4:code})" }, + { "trigger": "runkit_method_copy", "contents": "runkit_method_copy(${1:dClass}, ${2:dMethod}, ${3:sClass})" }, + { "trigger": "runkit_method_redefine", "contents": "runkit_method_redefine(${1:classname}, ${2:methodname}, ${3:args}, ${4:code})" }, + { "trigger": "runkit_method_remove", "contents": "runkit_method_remove(${1:classname}, ${2:methodname})" }, + { "trigger": "runkit_method_rename", "contents": "runkit_method_rename(${1:classname}, ${2:methodname}, ${3:newname})" }, + { "trigger": "runkit_return_value_used", "contents": "runkit_return_value_used()" }, + { "trigger": "runkit_sandbox_output_handler", "contents": "runkit_sandbox_output_handler(${1:sandbox})" }, + { "trigger": "runkit_superglobals", "contents": "runkit_superglobals()" }, + { "trigger": "scandir", "contents": "scandir(${1:directory})" }, + { "trigger": "sem_acquire", "contents": "sem_acquire(${1:sem_identifier})" }, + { "trigger": "sem_get", "contents": "sem_get(${1:key})" }, + { "trigger": "sem_release", "contents": "sem_release(${1:sem_identifier})" }, + { "trigger": "sem_remove", "contents": "sem_remove(${1:sem_identifier})" }, + { "trigger": "serialize", "contents": "serialize(${1:value})" }, + { "trigger": "session_cache_expire", "contents": "session_cache_expire()" }, + { "trigger": "session_cache_limiter", "contents": "session_cache_limiter()" }, + { "trigger": "session_commit", "contents": "session_commit()" }, + { "trigger": "session_decode", "contents": "session_decode(${1:data})" }, + { "trigger": "session_destroy", "contents": "session_destroy()" }, + { "trigger": "session_encode", "contents": "session_encode()" }, + { "trigger": "session_get_cookie_params", "contents": "session_get_cookie_params()" }, + { "trigger": "session_id", "contents": "session_id()" }, + { "trigger": "session_is_registered", "contents": "session_is_registered(${1:name})" }, + { "trigger": "session_module_name", "contents": "session_module_name()" }, + { "trigger": "session_name", "contents": "session_name()" }, + { "trigger": "session_pgsql_add_error", "contents": "session_pgsql_add_error(${1:error_level})" }, + { "trigger": "session_pgsql_get_error", "contents": "session_pgsql_get_error()" }, + { "trigger": "session_pgsql_get_field", "contents": "session_pgsql_get_field()" }, + { "trigger": "session_pgsql_reset", "contents": "session_pgsql_reset()" }, + { "trigger": "session_pgsql_set_field", "contents": "session_pgsql_set_field(${1:value})" }, + { "trigger": "session_pgsql_status", "contents": "session_pgsql_status()" }, + { "trigger": "session_regenerate_id", "contents": "session_regenerate_id()" }, + { "trigger": "session_register", "contents": "session_register(${1:name})" }, + { "trigger": "session_save_path", "contents": "session_save_path()" }, + { "trigger": "session_set_cookie_params", "contents": "session_set_cookie_params(${1:lifetime})" }, + { "trigger": "session_set_save_handler", "contents": "session_set_save_handler(${1:open}, ${2:close}, ${3:read}, ${4:write}, ${5:destroy}, ${6:gc})" }, + { "trigger": "session_start", "contents": "session_start()" }, + { "trigger": "session_unregister", "contents": "session_unregister(${1:name})" }, + { "trigger": "session_unset", "contents": "session_unset()" }, + { "trigger": "session_write_close", "contents": "session_write_close()" }, + { "trigger": "set_error_handler", "contents": "set_error_handler(${1:error_handler})" }, + { "trigger": "set_exception_handler", "contents": "set_exception_handler(${1:exception_handler})" }, + { "trigger": "set_file_buffer", "contents": "set_file_buffer()" }, + { "trigger": "set_include_path", "contents": "set_include_path(${1:new_include_path})" }, + { "trigger": "set_magic_quotes_runtime", "contents": "set_magic_quotes_runtime(${1:new_setting})" }, + { "trigger": "set_socket_blocking", "contents": "set_socket_blocking()" }, + { "trigger": "set_time_limit", "contents": "set_time_limit(${1:seconds})" }, + { "trigger": "setcookie", "contents": "setcookie(${1:name})" }, + { "trigger": "setlocale", "contents": "setlocale(${1:category}, ${2:locale})" }, + { "trigger": "setrawcookie", "contents": "setrawcookie(${1:name})" }, + { "trigger": "settype", "contents": "settype(${1:var}, ${2:type})" }, + { "trigger": "sha1", "contents": "sha1(${1:str})" }, + { "trigger": "sha1_file", "contents": "sha1_file(${1:filename})" }, + { "trigger": "shell_exec", "contents": "shell_exec(${1:cmd})" }, + { "trigger": "shm_attach", "contents": "shm_attach(${1:key})" }, + { "trigger": "shm_detach", "contents": "shm_detach(${1:shm_identifier})" }, + { "trigger": "shm_get_var", "contents": "shm_get_var(${1:shm_identifier}, ${2:variable_key})" }, + { "trigger": "shm_has_var", "contents": "shm_has_var(${1:shm_identifier}, ${2:variable_key})" }, + { "trigger": "shm_put_var", "contents": "shm_put_var(${1:shm_identifier}, ${2:variable_key}, ${3:variable})" }, + { "trigger": "shm_remove", "contents": "shm_remove(${1:shm_identifier})" }, + { "trigger": "shm_remove_var", "contents": "shm_remove_var(${1:shm_identifier}, ${2:variable_key})" }, + { "trigger": "shmop_close", "contents": "shmop_close(${1:shmid})" }, + { "trigger": "shmop_delete", "contents": "shmop_delete(${1:shmid})" }, + { "trigger": "shmop_open", "contents": "shmop_open(${1:key}, ${2:flags}, ${3:mode}, ${4:size})" }, + { "trigger": "shmop_read", "contents": "shmop_read(${1:shmid}, ${2:start}, ${3:count})" }, + { "trigger": "shmop_size", "contents": "shmop_size(${1:shmid})" }, + { "trigger": "shmop_write", "contents": "shmop_write(${1:shmid}, ${2:data}, ${3:offset})" }, + { "trigger": "show_source", "contents": "show_source()" }, + { "trigger": "shuffle", "contents": "shuffle(${1:array})" }, + { "trigger": "signeurlpaiement", "contents": "signeurlpaiement(${1:clent}, ${2:data})" }, + { "trigger": "similar_text", "contents": "similar_text(${1:first}, ${2:second})" }, + { "trigger": "simplexml_import_dom", "contents": "simplexml_import_dom(${1:node})" }, + { "trigger": "simplexml_load_file", "contents": "simplexml_load_file(${1:filename})" }, + { "trigger": "simplexml_load_string", "contents": "simplexml_load_string(${1:data})" }, + { "trigger": "sin", "contents": "sin(${1:arg})" }, + { "trigger": "sinh", "contents": "sinh(${1:arg})" }, + { "trigger": "sizeof", "contents": "sizeof()" }, + { "trigger": "sleep", "contents": "sleep(${1:seconds})" }, + { "trigger": "snmp2_get", "contents": "snmp2_get(${1:host}, ${2:community}, ${3:object_id})" }, + { "trigger": "snmp2_getnext", "contents": "snmp2_getnext(${1:host}, ${2:community}, ${3:object_id})" }, + { "trigger": "snmp2_real_walk", "contents": "snmp2_real_walk(${1:host}, ${2:community}, ${3:object_id})" }, + { "trigger": "snmp2_set", "contents": "snmp2_set(${1:host}, ${2:community}, ${3:object_id}, ${4:type}, ${5:value})" }, + { "trigger": "snmp2_walk", "contents": "snmp2_walk(${1:host}, ${2:community}, ${3:object_id})" }, + { "trigger": "snmp3_get", "contents": "snmp3_get(${1:host}, ${2:sec_name}, ${3:sec_level}, ${4:auth_protocol}, ${5:auth_passphrase}, ${6:priv_protocol}, ${7:priv_passphrase}, ${8:object_id})" }, + { "trigger": "snmp3_getnext", "contents": "snmp3_getnext(${1:host}, ${2:sec_name}, ${3:sec_level}, ${4:auth_protocol}, ${5:auth_passphrase}, ${6:priv_protocol}, ${7:priv_passphrase}, ${8:object_id})" }, + { "trigger": "snmp3_real_walk", "contents": "snmp3_real_walk(${1:host}, ${2:sec_name}, ${3:sec_level}, ${4:auth_protocol}, ${5:auth_passphrase}, ${6:priv_protocol}, ${7:priv_passphrase}, ${8:object_id})" }, + { "trigger": "snmp3_set", "contents": "snmp3_set(${1:host}, ${2:sec_name}, ${3:sec_level}, ${4:auth_protocol}, ${5:auth_passphrase}, ${6:priv_protocol}, ${7:priv_passphrase}, ${8:object_id}, ${9:type}, ${10:value})" }, + { "trigger": "snmp3_walk", "contents": "snmp3_walk(${1:host}, ${2:sec_name}, ${3:sec_level}, ${4:auth_protocol}, ${5:auth_passphrase}, ${6:priv_protocol}, ${7:priv_passphrase}, ${8:object_id})" }, + { "trigger": "snmp_get_quick_print", "contents": "snmp_get_quick_print()" }, + { "trigger": "snmp_get_valueretrieval", "contents": "snmp_get_valueretrieval()" }, + { "trigger": "snmp_read_mib", "contents": "snmp_read_mib(${1:filename})" }, + { "trigger": "snmp_set_enum_print", "contents": "snmp_set_enum_print(${1:enum_print})" }, + { "trigger": "snmp_set_oid_numeric_print", "contents": "snmp_set_oid_numeric_print(${1:oid_numeric_print})" }, + { "trigger": "snmp_set_oid_output_format", "contents": "snmp_set_oid_output_format(${1:oid_format = SNMP_OID_OUTPUT_MODULE})" }, + { "trigger": "snmp_set_quick_print", "contents": "snmp_set_quick_print(${1:quick_print})" }, + { "trigger": "snmp_set_valueretrieval", "contents": "snmp_set_valueretrieval(${1:method})" }, + { "trigger": "snmpget", "contents": "snmpget(${1:hostname}, ${2:community}, ${3:object_id})" }, + { "trigger": "snmpgetnext", "contents": "snmpgetnext(${1:host}, ${2:community}, ${3:object_id})" }, + { "trigger": "snmprealwalk", "contents": "snmprealwalk(${1:host}, ${2:community}, ${3:object_id})" }, + { "trigger": "snmpset", "contents": "snmpset(${1:host}, ${2:community}, ${3:object_id}, ${4:type}, ${5:value})" }, + { "trigger": "snmpwalk", "contents": "snmpwalk(${1:hostname}, ${2:community}, ${3:object_id})" }, + { "trigger": "snmpwalkoid", "contents": "snmpwalkoid(${1:hostname}, ${2:community}, ${3:object_id})" }, + { "trigger": "socket_accept", "contents": "socket_accept(${1:socket})" }, + { "trigger": "socket_bind", "contents": "socket_bind(${1:socket}, ${2:address})" }, + { "trigger": "socket_clear_error", "contents": "socket_clear_error()" }, + { "trigger": "socket_close", "contents": "socket_close(${1:socket})" }, + { "trigger": "socket_connect", "contents": "socket_connect(${1:socket}, ${2:address})" }, + { "trigger": "socket_create", "contents": "socket_create(${1:domain}, ${2:type}, ${3:protocol})" }, + { "trigger": "socket_create_listen", "contents": "socket_create_listen(${1:port})" }, + { "trigger": "socket_create_pair", "contents": "socket_create_pair(${1:domain}, ${2:type}, ${3:protocol}, ${4:fd})" }, + { "trigger": "socket_get_option", "contents": "socket_get_option(${1:socket}, ${2:level}, ${3:optname})" }, + { "trigger": "socket_get_status", "contents": "socket_get_status()" }, + { "trigger": "socket_getpeername", "contents": "socket_getpeername(${1:socket}, ${2:address})" }, + { "trigger": "socket_getsockname", "contents": "socket_getsockname(${1:socket}, ${2:addr})" }, + { "trigger": "socket_last_error", "contents": "socket_last_error()" }, + { "trigger": "socket_listen", "contents": "socket_listen(${1:socket})" }, + { "trigger": "socket_read", "contents": "socket_read(${1:socket}, ${2:length})" }, + { "trigger": "socket_recv", "contents": "socket_recv(${1:socket}, ${2:buf}, ${3:len}, ${4:flags})" }, + { "trigger": "socket_recvfrom", "contents": "socket_recvfrom(${1:socket}, ${2:buf}, ${3:len}, ${4:flags}, ${5:name})" }, + { "trigger": "socket_select", "contents": "socket_select(${1:read}, ${2:write}, ${3:except}, ${4:tv_sec})" }, + { "trigger": "socket_send", "contents": "socket_send(${1:socket}, ${2:buf}, ${3:len}, ${4:flags})" }, + { "trigger": "socket_sendto", "contents": "socket_sendto(${1:socket}, ${2:buf}, ${3:len}, ${4:flags}, ${5:addr})" }, + { "trigger": "socket_set_block", "contents": "socket_set_block(${1:socket})" }, + { "trigger": "socket_set_blocking", "contents": "socket_set_blocking()" }, + { "trigger": "socket_set_nonblock", "contents": "socket_set_nonblock(${1:socket})" }, + { "trigger": "socket_set_option", "contents": "socket_set_option(${1:socket}, ${2:level}, ${3:optname}, ${4:optval})" }, + { "trigger": "socket_set_timeout", "contents": "socket_set_timeout()" }, + { "trigger": "socket_shutdown", "contents": "socket_shutdown(${1:socket})" }, + { "trigger": "socket_strerror", "contents": "socket_strerror(${1:errno})" }, + { "trigger": "socket_write", "contents": "socket_write(${1:socket}, ${2:buffer})" }, + { "trigger": "solr_get_version", "contents": "solr_get_version()" }, + { "trigger": "sort", "contents": "sort(${1:array})" }, + { "trigger": "soundex", "contents": "soundex(${1:str})" }, + { "trigger": "spl_autoload", "contents": "spl_autoload(${1:class_name})" }, + { "trigger": "spl_autoload_call", "contents": "spl_autoload_call(${1:class_name})" }, + { "trigger": "spl_autoload_extensions", "contents": "spl_autoload_extensions()" }, + { "trigger": "spl_autoload_functions", "contents": "spl_autoload_functions()" }, + { "trigger": "spl_autoload_register", "contents": "spl_autoload_register()" }, + { "trigger": "spl_autoload_unregister", "contents": "spl_autoload_unregister(${1:autoload_function})" }, + { "trigger": "spl_classes", "contents": "spl_classes()" }, + { "trigger": "spl_object_hash", "contents": "spl_object_hash(${1:obj})" }, + { "trigger": "split", "contents": "split(${1:pattern}, ${2:string})" }, + { "trigger": "spliti", "contents": "spliti(${1:pattern}, ${2:string})" }, + { "trigger": "sprintf", "contents": "sprintf(${1:format})" }, + { "trigger": "sql_regcase", "contents": "sql_regcase(${1:string})" }, + { "trigger": "sqlite_close", "contents": "sqlite_close(${1:dbhandle})" }, + { "trigger": "sqlite_error_string", "contents": "sqlite_error_string(${1:error_code})" }, + { "trigger": "sqlite_escape_string", "contents": "sqlite_escape_string(${1:item})" }, + { "trigger": "sqlite_factory", "contents": "sqlite_factory(${1:filename})" }, + { "trigger": "sqlite_fetch_string", "contents": "sqlite_fetch_string()" }, + { "trigger": "sqlite_has_more", "contents": "sqlite_has_more(${1:result})" }, + { "trigger": "sqlite_libencoding", "contents": "sqlite_libencoding()" }, + { "trigger": "sqlite_libversion", "contents": "sqlite_libversion()" }, + { "trigger": "sqlite_open", "contents": "sqlite_open(${1:filename})" }, + { "trigger": "sqlite_popen", "contents": "sqlite_popen(${1:filename})" }, + { "trigger": "sqlite_udf_decode_binary", "contents": "sqlite_udf_decode_binary(${1:data})" }, + { "trigger": "sqlite_udf_encode_binary", "contents": "sqlite_udf_encode_binary(${1:data})" }, + { "trigger": "sqrt", "contents": "sqrt(${1:arg})" }, + { "trigger": "srand", "contents": "srand()" }, + { "trigger": "sscanf", "contents": "sscanf(${1:str}, ${2:format})" }, + { "trigger": "ssdeep_fuzzy_compare", "contents": "ssdeep_fuzzy_compare(${1:signature1}, ${2:signature2})" }, + { "trigger": "ssdeep_fuzzy_hash", "contents": "ssdeep_fuzzy_hash(${1:to_hash})" }, + { "trigger": "ssdeep_fuzzy_hash_filename", "contents": "ssdeep_fuzzy_hash_filename(${1:file_name})" }, + { "trigger": "ssh2_auth_hostbased_file", "contents": "ssh2_auth_hostbased_file(${1:session}, ${2:username}, ${3:hostname}, ${4:pubkeyfile}, ${5:privkeyfile})" }, + { "trigger": "ssh2_auth_none", "contents": "ssh2_auth_none(${1:session}, ${2:username})" }, + { "trigger": "ssh2_auth_password", "contents": "ssh2_auth_password(${1:session}, ${2:username}, ${3:password})" }, + { "trigger": "ssh2_auth_pubkey_file", "contents": "ssh2_auth_pubkey_file(${1:session}, ${2:username}, ${3:pubkeyfile}, ${4:privkeyfile})" }, + { "trigger": "ssh2_connect", "contents": "ssh2_connect(${1:host})" }, + { "trigger": "ssh2_exec", "contents": "ssh2_exec(${1:session}, ${2:command})" }, + { "trigger": "ssh2_fetch_stream", "contents": "ssh2_fetch_stream(${1:channel}, ${2:streamid})" }, + { "trigger": "ssh2_fingerprint", "contents": "ssh2_fingerprint(${1:session})" }, + { "trigger": "ssh2_methods_negotiated", "contents": "ssh2_methods_negotiated(${1:session})" }, + { "trigger": "ssh2_publickey_add", "contents": "ssh2_publickey_add(${1:pkey}, ${2:algoname}, ${3:blob})" }, + { "trigger": "ssh2_publickey_init", "contents": "ssh2_publickey_init(${1:session})" }, + { "trigger": "ssh2_publickey_list", "contents": "ssh2_publickey_list(${1:pkey})" }, + { "trigger": "ssh2_publickey_remove", "contents": "ssh2_publickey_remove(${1:pkey}, ${2:algoname}, ${3:blob})" }, + { "trigger": "ssh2_scp_recv", "contents": "ssh2_scp_recv(${1:session}, ${2:remote_file}, ${3:local_file})" }, + { "trigger": "ssh2_scp_send", "contents": "ssh2_scp_send(${1:session}, ${2:local_file}, ${3:remote_file})" }, + { "trigger": "ssh2_sftp", "contents": "ssh2_sftp(${1:session})" }, + { "trigger": "ssh2_sftp_lstat", "contents": "ssh2_sftp_lstat(${1:sftp}, ${2:path})" }, + { "trigger": "ssh2_sftp_mkdir", "contents": "ssh2_sftp_mkdir(${1:sftp}, ${2:dirname})" }, + { "trigger": "ssh2_sftp_readlink", "contents": "ssh2_sftp_readlink(${1:sftp}, ${2:link})" }, + { "trigger": "ssh2_sftp_realpath", "contents": "ssh2_sftp_realpath(${1:sftp}, ${2:filename})" }, + { "trigger": "ssh2_sftp_rename", "contents": "ssh2_sftp_rename(${1:sftp}, ${2:from}, ${3:to})" }, + { "trigger": "ssh2_sftp_rmdir", "contents": "ssh2_sftp_rmdir(${1:sftp}, ${2:dirname})" }, + { "trigger": "ssh2_sftp_stat", "contents": "ssh2_sftp_stat(${1:sftp}, ${2:path})" }, + { "trigger": "ssh2_sftp_symlink", "contents": "ssh2_sftp_symlink(${1:sftp}, ${2:target}, ${3:link})" }, + { "trigger": "ssh2_sftp_unlink", "contents": "ssh2_sftp_unlink(${1:sftp}, ${2:filename})" }, + { "trigger": "ssh2_shell", "contents": "ssh2_shell(${1:session})" }, + { "trigger": "ssh2_tunnel", "contents": "ssh2_tunnel(${1:session}, ${2:host}, ${3:port})" }, + { "trigger": "stat", "contents": "stat(${1:filename})" }, + { "trigger": "stats_absolute_deviation", "contents": "stats_absolute_deviation(${1:a})" }, + { "trigger": "stats_cdf_beta", "contents": "stats_cdf_beta(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_binomial", "contents": "stats_cdf_binomial(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_cauchy", "contents": "stats_cdf_cauchy(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_chisquare", "contents": "stats_cdf_chisquare(${1:par1}, ${2:par2}, ${3:which})" }, + { "trigger": "stats_cdf_exponential", "contents": "stats_cdf_exponential(${1:par1}, ${2:par2}, ${3:which})" }, + { "trigger": "stats_cdf_f", "contents": "stats_cdf_f(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_gamma", "contents": "stats_cdf_gamma(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_laplace", "contents": "stats_cdf_laplace(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_logistic", "contents": "stats_cdf_logistic(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_negative_binomial", "contents": "stats_cdf_negative_binomial(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_noncentral_chisquare", "contents": "stats_cdf_noncentral_chisquare(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_noncentral_f", "contents": "stats_cdf_noncentral_f(${1:par1}, ${2:par2}, ${3:par3}, ${4:par4}, ${5:which})" }, + { "trigger": "stats_cdf_poisson", "contents": "stats_cdf_poisson(${1:par1}, ${2:par2}, ${3:which})" }, + { "trigger": "stats_cdf_t", "contents": "stats_cdf_t(${1:par1}, ${2:par2}, ${3:which})" }, + { "trigger": "stats_cdf_uniform", "contents": "stats_cdf_uniform(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_cdf_weibull", "contents": "stats_cdf_weibull(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_covariance", "contents": "stats_covariance(${1:a}, ${2:b})" }, + { "trigger": "stats_den_uniform", "contents": "stats_den_uniform(${1:x}, ${2:a}, ${3:b})" }, + { "trigger": "stats_dens_beta", "contents": "stats_dens_beta(${1:x}, ${2:a}, ${3:b})" }, + { "trigger": "stats_dens_cauchy", "contents": "stats_dens_cauchy(${1:x}, ${2:ave}, ${3:stdev})" }, + { "trigger": "stats_dens_chisquare", "contents": "stats_dens_chisquare(${1:x}, ${2:dfr})" }, + { "trigger": "stats_dens_exponential", "contents": "stats_dens_exponential(${1:x}, ${2:scale})" }, + { "trigger": "stats_dens_f", "contents": "stats_dens_f(${1:x}, ${2:dfr1}, ${3:dfr2})" }, + { "trigger": "stats_dens_gamma", "contents": "stats_dens_gamma(${1:x}, ${2:shape}, ${3:scale})" }, + { "trigger": "stats_dens_laplace", "contents": "stats_dens_laplace(${1:x}, ${2:ave}, ${3:stdev})" }, + { "trigger": "stats_dens_logistic", "contents": "stats_dens_logistic(${1:x}, ${2:ave}, ${3:stdev})" }, + { "trigger": "stats_dens_negative_binomial", "contents": "stats_dens_negative_binomial(${1:x}, ${2:n}, ${3:pi})" }, + { "trigger": "stats_dens_normal", "contents": "stats_dens_normal(${1:x}, ${2:ave}, ${3:stdev})" }, + { "trigger": "stats_dens_pmf_binomial", "contents": "stats_dens_pmf_binomial(${1:x}, ${2:n}, ${3:pi})" }, + { "trigger": "stats_dens_pmf_hypergeometric", "contents": "stats_dens_pmf_hypergeometric(${1:n1}, ${2:n2}, ${3:N1}, ${4:N2})" }, + { "trigger": "stats_dens_pmf_poisson", "contents": "stats_dens_pmf_poisson(${1:x}, ${2:lb})" }, + { "trigger": "stats_dens_t", "contents": "stats_dens_t(${1:x}, ${2:dfr})" }, + { "trigger": "stats_dens_weibull", "contents": "stats_dens_weibull(${1:x}, ${2:a}, ${3:b})" }, + { "trigger": "stats_harmonic_mean", "contents": "stats_harmonic_mean(${1:a})" }, + { "trigger": "stats_kurtosis", "contents": "stats_kurtosis(${1:a})" }, + { "trigger": "stats_rand_gen_beta", "contents": "stats_rand_gen_beta(${1:a}, ${2:b})" }, + { "trigger": "stats_rand_gen_chisquare", "contents": "stats_rand_gen_chisquare(${1:df})" }, + { "trigger": "stats_rand_gen_exponential", "contents": "stats_rand_gen_exponential(${1:av})" }, + { "trigger": "stats_rand_gen_f", "contents": "stats_rand_gen_f(${1:dfn}, ${2:dfd})" }, + { "trigger": "stats_rand_gen_funiform", "contents": "stats_rand_gen_funiform(${1:low}, ${2:high})" }, + { "trigger": "stats_rand_gen_gamma", "contents": "stats_rand_gen_gamma(${1:a}, ${2:r})" }, + { "trigger": "stats_rand_gen_ibinomial", "contents": "stats_rand_gen_ibinomial(${1:n}, ${2:pp})" }, + { "trigger": "stats_rand_gen_ibinomial_negative", "contents": "stats_rand_gen_ibinomial_negative(${1:n}, ${2:p})" }, + { "trigger": "stats_rand_gen_int", "contents": "stats_rand_gen_int()" }, + { "trigger": "stats_rand_gen_ipoisson", "contents": "stats_rand_gen_ipoisson(${1:mu})" }, + { "trigger": "stats_rand_gen_iuniform", "contents": "stats_rand_gen_iuniform(${1:low}, ${2:high})" }, + { "trigger": "stats_rand_gen_noncenral_chisquare", "contents": "stats_rand_gen_noncenral_chisquare(${1:df}, ${2:xnonc})" }, + { "trigger": "stats_rand_gen_noncentral_f", "contents": "stats_rand_gen_noncentral_f(${1:dfn}, ${2:dfd}, ${3:xnonc})" }, + { "trigger": "stats_rand_gen_noncentral_t", "contents": "stats_rand_gen_noncentral_t(${1:df}, ${2:xnonc})" }, + { "trigger": "stats_rand_gen_normal", "contents": "stats_rand_gen_normal(${1:av}, ${2:sd})" }, + { "trigger": "stats_rand_gen_t", "contents": "stats_rand_gen_t(${1:df})" }, + { "trigger": "stats_rand_get_seeds", "contents": "stats_rand_get_seeds()" }, + { "trigger": "stats_rand_phrase_to_seeds", "contents": "stats_rand_phrase_to_seeds(${1:phrase})" }, + { "trigger": "stats_rand_ranf", "contents": "stats_rand_ranf()" }, + { "trigger": "stats_rand_setall", "contents": "stats_rand_setall(${1:iseed1}, ${2:iseed2})" }, + { "trigger": "stats_skew", "contents": "stats_skew(${1:a})" }, + { "trigger": "stats_standard_deviation", "contents": "stats_standard_deviation(${1:a})" }, + { "trigger": "stats_stat_binomial_coef", "contents": "stats_stat_binomial_coef(${1:x}, ${2:n})" }, + { "trigger": "stats_stat_correlation", "contents": "stats_stat_correlation(${1:arr1}, ${2:arr2})" }, + { "trigger": "stats_stat_gennch", "contents": "stats_stat_gennch(${1:n})" }, + { "trigger": "stats_stat_independent_t", "contents": "stats_stat_independent_t(${1:arr1}, ${2:arr2})" }, + { "trigger": "stats_stat_innerproduct", "contents": "stats_stat_innerproduct(${1:arr1}, ${2:arr2})" }, + { "trigger": "stats_stat_noncentral_t", "contents": "stats_stat_noncentral_t(${1:par1}, ${2:par2}, ${3:par3}, ${4:which})" }, + { "trigger": "stats_stat_paired_t", "contents": "stats_stat_paired_t(${1:arr1}, ${2:arr2})" }, + { "trigger": "stats_stat_percentile", "contents": "stats_stat_percentile(${1:df}, ${2:xnonc})" }, + { "trigger": "stats_stat_powersum", "contents": "stats_stat_powersum(${1:arr}, ${2:power})" }, + { "trigger": "stats_variance", "contents": "stats_variance(${1:a})" }, + { "trigger": "stomp_connect_error", "contents": "stomp_connect_error()" }, + { "trigger": "stomp_version", "contents": "stomp_version()" }, + { "trigger": "str_getcsv", "contents": "str_getcsv(${1:input})" }, + { "trigger": "str_ireplace", "contents": "str_ireplace(${1:search}, ${2:replace}, ${3:subject})" }, + { "trigger": "str_pad", "contents": "str_pad(${1:input}, ${2:pad_length})" }, + { "trigger": "str_repeat", "contents": "str_repeat(${1:input}, ${2:multiplier})" }, + { "trigger": "str_replace", "contents": "str_replace(${1:search}, ${2:replace}, ${3:subject})" }, + { "trigger": "str_rot13", "contents": "str_rot13(${1:str})" }, + { "trigger": "str_shuffle", "contents": "str_shuffle(${1:str})" }, + { "trigger": "str_split", "contents": "str_split(${1:string})" }, + { "trigger": "str_word_count", "contents": "str_word_count(${1:string})" }, + { "trigger": "strcasecmp", "contents": "strcasecmp(${1:str1}, ${2:str2})" }, + { "trigger": "strchr", "contents": "strchr()" }, + { "trigger": "strcmp", "contents": "strcmp(${1:str1}, ${2:str2})" }, + { "trigger": "strcoll", "contents": "strcoll(${1:str1}, ${2:str2})" }, + { "trigger": "strcspn", "contents": "strcspn(${1:str1}, ${2:str2})" }, + { "trigger": "stream_bucket_append", "contents": "stream_bucket_append(${1:brigade}, ${2:bucket})" }, + { "trigger": "stream_bucket_make_writeable", "contents": "stream_bucket_make_writeable(${1:brigade})" }, + { "trigger": "stream_bucket_new", "contents": "stream_bucket_new(${1:stream}, ${2:buffer})" }, + { "trigger": "stream_bucket_prepend", "contents": "stream_bucket_prepend(${1:brigade}, ${2:bucket})" }, + { "trigger": "stream_context_create", "contents": "stream_context_create()" }, + { "trigger": "stream_context_get_default", "contents": "stream_context_get_default()" }, + { "trigger": "stream_context_get_options", "contents": "stream_context_get_options(${1:stream_or_context})" }, + { "trigger": "stream_context_get_params", "contents": "stream_context_get_params(${1:stream_or_context})" }, + { "trigger": "stream_context_set_default", "contents": "stream_context_set_default(${1:options})" }, + { "trigger": "stream_context_set_option", "contents": "stream_context_set_option(${1:stream_or_context}, ${2:wrapper}, ${3:option}, ${4:value})" }, + { "trigger": "stream_context_set_params", "contents": "stream_context_set_params(${1:stream_or_context}, ${2:params})" }, + { "trigger": "stream_copy_to_stream", "contents": "stream_copy_to_stream(${1:source}, ${2:dest})" }, + { "trigger": "stream_encoding", "contents": "stream_encoding(${1:stream})" }, + { "trigger": "stream_filter_append", "contents": "stream_filter_append(${1:stream}, ${2:filtername})" }, + { "trigger": "stream_filter_prepend", "contents": "stream_filter_prepend(${1:stream}, ${2:filtername})" }, + { "trigger": "stream_filter_register", "contents": "stream_filter_register(${1:filtername}, ${2:classname})" }, + { "trigger": "stream_filter_remove", "contents": "stream_filter_remove(${1:stream_filter})" }, + { "trigger": "stream_get_contents", "contents": "stream_get_contents(${1:handle})" }, + { "trigger": "stream_get_filters", "contents": "stream_get_filters()" }, + { "trigger": "stream_get_line", "contents": "stream_get_line(${1:handle}, ${2:length})" }, + { "trigger": "stream_get_meta_data", "contents": "stream_get_meta_data(${1:stream})" }, + { "trigger": "stream_get_transports", "contents": "stream_get_transports()" }, + { "trigger": "stream_get_wrappers", "contents": "stream_get_wrappers()" }, + { "trigger": "stream_is_local", "contents": "stream_is_local(${1:stream_or_url})" }, + { "trigger": "stream_notification_callback", "contents": "stream_notification_callback(${1:notification_code}, ${2:severity}, ${3:message}, ${4:message_code}, ${5:bytes_transferred}, ${6:bytes_max})" }, + { "trigger": "stream_register_wrapper", "contents": "stream_register_wrapper()" }, + { "trigger": "stream_resolve_include_path", "contents": "stream_resolve_include_path(${1:filename})" }, + { "trigger": "stream_select", "contents": "stream_select(${1:read}, ${2:write}, ${3:except}, ${4:tv_sec})" }, + { "trigger": "stream_set_blocking", "contents": "stream_set_blocking(${1:stream}, ${2:mode})" }, + { "trigger": "stream_set_read_buffer", "contents": "stream_set_read_buffer(${1:stream}, ${2:buffer})" }, + { "trigger": "stream_set_timeout", "contents": "stream_set_timeout(${1:stream}, ${2:seconds})" }, + { "trigger": "stream_set_write_buffer", "contents": "stream_set_write_buffer(${1:stream}, ${2:buffer})" }, + { "trigger": "stream_socket_accept", "contents": "stream_socket_accept(${1:server_socket})" }, + { "trigger": "stream_socket_client", "contents": "stream_socket_client(${1:remote_socket})" }, + { "trigger": "stream_socket_enable_crypto", "contents": "stream_socket_enable_crypto(${1:stream}, ${2:enable})" }, + { "trigger": "stream_socket_get_name", "contents": "stream_socket_get_name(${1:handle}, ${2:want_peer})" }, + { "trigger": "stream_socket_pair", "contents": "stream_socket_pair(${1:domain}, ${2:type}, ${3:protocol})" }, + { "trigger": "stream_socket_recvfrom", "contents": "stream_socket_recvfrom(${1:socket}, ${2:length})" }, + { "trigger": "stream_socket_sendto", "contents": "stream_socket_sendto(${1:socket}, ${2:data})" }, + { "trigger": "stream_socket_server", "contents": "stream_socket_server(${1:local_socket})" }, + { "trigger": "stream_socket_shutdown", "contents": "stream_socket_shutdown(${1:stream}, ${2:how})" }, + { "trigger": "stream_supports_lock", "contents": "stream_supports_lock(${1:stream})" }, + { "trigger": "stream_wrapper_register", "contents": "stream_wrapper_register(${1:protocol}, ${2:classname})" }, + { "trigger": "stream_wrapper_restore", "contents": "stream_wrapper_restore(${1:protocol})" }, + { "trigger": "stream_wrapper_unregister", "contents": "stream_wrapper_unregister(${1:protocol})" }, + { "trigger": "strftime", "contents": "strftime(${1:format})" }, + { "trigger": "strip_tags", "contents": "strip_tags(${1:str})" }, + { "trigger": "stripcslashes", "contents": "stripcslashes(${1:str})" }, + { "trigger": "stripos", "contents": "stripos(${1:haystack}, ${2:needle})" }, + { "trigger": "stripslashes", "contents": "stripslashes(${1:str})" }, + { "trigger": "stristr", "contents": "stristr(${1:haystack}, ${2:needle})" }, + { "trigger": "strlen", "contents": "strlen(${1:string})" }, + { "trigger": "strnatcasecmp", "contents": "strnatcasecmp(${1:str1}, ${2:str2})" }, + { "trigger": "strnatcmp", "contents": "strnatcmp(${1:str1}, ${2:str2})" }, + { "trigger": "strncasecmp", "contents": "strncasecmp(${1:str1}, ${2:str2}, ${3:len})" }, + { "trigger": "strncmp", "contents": "strncmp(${1:str1}, ${2:str2}, ${3:len})" }, + { "trigger": "strpbrk", "contents": "strpbrk(${1:haystack}, ${2:char_list})" }, + { "trigger": "strpos", "contents": "strpos(${1:haystack}, ${2:needle})" }, + { "trigger": "strptime", "contents": "strptime(${1:date}, ${2:format})" }, + { "trigger": "strrchr", "contents": "strrchr(${1:haystack}, ${2:needle})" }, + { "trigger": "strrev", "contents": "strrev(${1:string})" }, + { "trigger": "strripos", "contents": "strripos(${1:haystack}, ${2:needle})" }, + { "trigger": "strrpos", "contents": "strrpos(${1:haystack}, ${2:needle})" }, + { "trigger": "strspn", "contents": "strspn(${1:subject}, ${2:mask})" }, + { "trigger": "strstr", "contents": "strstr(${1:haystack}, ${2:needle})" }, + { "trigger": "strtok", "contents": "strtok(${1:str}, ${2:token})" }, + { "trigger": "strtolower", "contents": "strtolower(${1:str})" }, + { "trigger": "strtotime", "contents": "strtotime(${1:time})" }, + { "trigger": "strtoupper", "contents": "strtoupper(${1:string})" }, + { "trigger": "strtr", "contents": "strtr(${1:str}, ${2:from}, ${3:to})" }, + { "trigger": "strval", "contents": "strval(${1:var})" }, + { "trigger": "substr", "contents": "substr(${1:string}, ${2:start})" }, + { "trigger": "substr_compare", "contents": "substr_compare(${1:main_str}, ${2:str}, ${3:offset})" }, + { "trigger": "substr_count", "contents": "substr_count(${1:haystack}, ${2:needle})" }, + { "trigger": "substr_replace", "contents": "substr_replace(${1:string}, ${2:replacement}, ${3:start})" }, + { "trigger": "svn_add", "contents": "svn_add(${1:path})" }, + { "trigger": "svn_auth_get_parameter", "contents": "svn_auth_get_parameter(${1:key})" }, + { "trigger": "svn_auth_set_parameter", "contents": "svn_auth_set_parameter(${1:key}, ${2:value})" }, + { "trigger": "svn_blame", "contents": "svn_blame(${1:repository_url})" }, + { "trigger": "svn_cat", "contents": "svn_cat(${1:repos_url})" }, + { "trigger": "svn_checkout", "contents": "svn_checkout(${1:repos}, ${2:targetpath})" }, + { "trigger": "svn_cleanup", "contents": "svn_cleanup(${1:workingdir})" }, + { "trigger": "svn_client_version", "contents": "svn_client_version()" }, + { "trigger": "svn_commit", "contents": "svn_commit(${1:log}, ${2:targets})" }, + { "trigger": "svn_delete", "contents": "svn_delete(${1:path})" }, + { "trigger": "svn_diff", "contents": "svn_diff(${1:path1}, ${2:rev1}, ${3:path2}, ${4:rev2})" }, + { "trigger": "svn_export", "contents": "svn_export(${1:frompath}, ${2:topath})" }, + { "trigger": "svn_fs_abort_txn", "contents": "svn_fs_abort_txn(${1:txn})" }, + { "trigger": "svn_fs_apply_text", "contents": "svn_fs_apply_text(${1:root}, ${2:path})" }, + { "trigger": "svn_fs_begin_txn2", "contents": "svn_fs_begin_txn2(${1:repos}, ${2:rev})" }, + { "trigger": "svn_fs_change_node_prop", "contents": "svn_fs_change_node_prop(${1:root}, ${2:path}, ${3:name}, ${4:value})" }, + { "trigger": "svn_fs_check_path", "contents": "svn_fs_check_path(${1:fsroot}, ${2:path})" }, + { "trigger": "svn_fs_contents_changed", "contents": "svn_fs_contents_changed(${1:root1}, ${2:path1}, ${3:root2}, ${4:path2})" }, + { "trigger": "svn_fs_copy", "contents": "svn_fs_copy(${1:from_root}, ${2:from_path}, ${3:to_root}, ${4:to_path})" }, + { "trigger": "svn_fs_delete", "contents": "svn_fs_delete(${1:root}, ${2:path})" }, + { "trigger": "svn_fs_dir_entries", "contents": "svn_fs_dir_entries(${1:fsroot}, ${2:path})" }, + { "trigger": "svn_fs_file_contents", "contents": "svn_fs_file_contents(${1:fsroot}, ${2:path})" }, + { "trigger": "svn_fs_file_length", "contents": "svn_fs_file_length(${1:fsroot}, ${2:path})" }, + { "trigger": "svn_fs_is_dir", "contents": "svn_fs_is_dir(${1:root}, ${2:path})" }, + { "trigger": "svn_fs_is_file", "contents": "svn_fs_is_file(${1:root}, ${2:path})" }, + { "trigger": "svn_fs_make_dir", "contents": "svn_fs_make_dir(${1:root}, ${2:path})" }, + { "trigger": "svn_fs_make_file", "contents": "svn_fs_make_file(${1:root}, ${2:path})" }, + { "trigger": "svn_fs_node_created_rev", "contents": "svn_fs_node_created_rev(${1:fsroot}, ${2:path})" }, + { "trigger": "svn_fs_node_prop", "contents": "svn_fs_node_prop(${1:fsroot}, ${2:path}, ${3:propname})" }, + { "trigger": "svn_fs_props_changed", "contents": "svn_fs_props_changed(${1:root1}, ${2:path1}, ${3:root2}, ${4:path2})" }, + { "trigger": "svn_fs_revision_prop", "contents": "svn_fs_revision_prop(${1:fs}, ${2:revnum}, ${3:propname})" }, + { "trigger": "svn_fs_revision_root", "contents": "svn_fs_revision_root(${1:fs}, ${2:revnum})" }, + { "trigger": "svn_fs_txn_root", "contents": "svn_fs_txn_root(${1:txn})" }, + { "trigger": "svn_fs_youngest_rev", "contents": "svn_fs_youngest_rev(${1:fs})" }, + { "trigger": "svn_import", "contents": "svn_import(${1:path}, ${2:url}, ${3:nonrecursive})" }, + { "trigger": "svn_log", "contents": "svn_log(${1:repos_url})" }, + { "trigger": "svn_ls", "contents": "svn_ls(${1:repos_url})" }, + { "trigger": "svn_mkdir", "contents": "svn_mkdir(${1:path})" }, + { "trigger": "svn_repos_create", "contents": "svn_repos_create(${1:path})" }, + { "trigger": "svn_repos_fs", "contents": "svn_repos_fs(${1:repos})" }, + { "trigger": "svn_repos_fs_begin_txn_for_commit", "contents": "svn_repos_fs_begin_txn_for_commit(${1:repos}, ${2:rev}, ${3:author}, ${4:log_msg})" }, + { "trigger": "svn_repos_fs_commit_txn", "contents": "svn_repos_fs_commit_txn(${1:txn})" }, + { "trigger": "svn_repos_hotcopy", "contents": "svn_repos_hotcopy(${1:repospath}, ${2:destpath}, ${3:cleanlogs})" }, + { "trigger": "svn_repos_open", "contents": "svn_repos_open(${1:path})" }, + { "trigger": "svn_repos_recover", "contents": "svn_repos_recover(${1:path})" }, + { "trigger": "svn_revert", "contents": "svn_revert(${1:path})" }, + { "trigger": "svn_status", "contents": "svn_status(${1:path})" }, + { "trigger": "svn_update", "contents": "svn_update(${1:path})" }, + { "trigger": "swf_actiongeturl", "contents": "swf_actiongeturl(${1:url}, ${2:target})" }, + { "trigger": "swf_actiongotoframe", "contents": "swf_actiongotoframe(${1:framenumber})" }, + { "trigger": "swf_actiongotolabel", "contents": "swf_actiongotolabel(${1:label})" }, + { "trigger": "swf_actionnextframe", "contents": "swf_actionnextframe()" }, + { "trigger": "swf_actionplay", "contents": "swf_actionplay()" }, + { "trigger": "swf_actionprevframe", "contents": "swf_actionprevframe()" }, + { "trigger": "swf_actionsettarget", "contents": "swf_actionsettarget(${1:target})" }, + { "trigger": "swf_actionstop", "contents": "swf_actionstop()" }, + { "trigger": "swf_actiontogglequality", "contents": "swf_actiontogglequality()" }, + { "trigger": "swf_actionwaitforframe", "contents": "swf_actionwaitforframe(${1:framenumber}, ${2:skipcount})" }, + { "trigger": "swf_addbuttonrecord", "contents": "swf_addbuttonrecord(${1:states}, ${2:shapeid}, ${3:depth})" }, + { "trigger": "swf_addcolor", "contents": "swf_addcolor(${1:r}, ${2:g}, ${3:b}, ${4:a})" }, + { "trigger": "swf_closefile", "contents": "swf_closefile()" }, + { "trigger": "swf_definebitmap", "contents": "swf_definebitmap(${1:objid}, ${2:image_name})" }, + { "trigger": "swf_definefont", "contents": "swf_definefont(${1:fontid}, ${2:fontname})" }, + { "trigger": "swf_defineline", "contents": "swf_defineline(${1:objid}, ${2:x1}, ${3:y1}, ${4:x2}, ${5:y2}, ${6:width})" }, + { "trigger": "swf_definepoly", "contents": "swf_definepoly(${1:objid}, ${2:coords}, ${3:npoints}, ${4:width})" }, + { "trigger": "swf_definerect", "contents": "swf_definerect(${1:objid}, ${2:x1}, ${3:y1}, ${4:x2}, ${5:y2}, ${6:width})" }, + { "trigger": "swf_definetext", "contents": "swf_definetext(${1:objid}, ${2:str}, ${3:docenter})" }, + { "trigger": "swf_endbutton", "contents": "swf_endbutton()" }, + { "trigger": "swf_enddoaction", "contents": "swf_enddoaction()" }, + { "trigger": "swf_endshape", "contents": "swf_endshape()" }, + { "trigger": "swf_endsymbol", "contents": "swf_endsymbol()" }, + { "trigger": "swf_fontsize", "contents": "swf_fontsize(${1:size})" }, + { "trigger": "swf_fontslant", "contents": "swf_fontslant(${1:slant})" }, + { "trigger": "swf_fonttracking", "contents": "swf_fonttracking(${1:tracking})" }, + { "trigger": "swf_getbitmapinfo", "contents": "swf_getbitmapinfo(${1:bitmapid})" }, + { "trigger": "swf_getfontinfo", "contents": "swf_getfontinfo()" }, + { "trigger": "swf_getframe", "contents": "swf_getframe()" }, + { "trigger": "swf_labelframe", "contents": "swf_labelframe(${1:name})" }, + { "trigger": "swf_lookat", "contents": "swf_lookat(${1:view_x}, ${2:view_y}, ${3:view_z}, ${4:reference_x}, ${5:reference_y}, ${6:reference_z}, ${7:twist})" }, + { "trigger": "swf_modifyobject", "contents": "swf_modifyobject(${1:depth}, ${2:how})" }, + { "trigger": "swf_mulcolor", "contents": "swf_mulcolor(${1:r}, ${2:g}, ${3:b}, ${4:a})" }, + { "trigger": "swf_nextid", "contents": "swf_nextid()" }, + { "trigger": "swf_oncondition", "contents": "swf_oncondition(${1:transition})" }, + { "trigger": "swf_openfile", "contents": "swf_openfile(${1:filename}, ${2:width}, ${3:height}, ${4:framerate}, ${5:r}, ${6:g}, ${7:b})" }, + { "trigger": "swf_ortho", "contents": "swf_ortho(${1:xmin}, ${2:xmax}, ${3:ymin}, ${4:ymax}, ${5:zmin}, ${6:zmax})" }, + { "trigger": "swf_ortho2", "contents": "swf_ortho2(${1:xmin}, ${2:xmax}, ${3:ymin}, ${4:ymax})" }, + { "trigger": "swf_perspective", "contents": "swf_perspective(${1:fovy}, ${2:aspect}, ${3:near}, ${4:far})" }, + { "trigger": "swf_placeobject", "contents": "swf_placeobject(${1:objid}, ${2:depth})" }, + { "trigger": "swf_polarview", "contents": "swf_polarview(${1:dist}, ${2:azimuth}, ${3:incidence}, ${4:twist})" }, + { "trigger": "swf_popmatrix", "contents": "swf_popmatrix()" }, + { "trigger": "swf_posround", "contents": "swf_posround(${1:round})" }, + { "trigger": "swf_pushmatrix", "contents": "swf_pushmatrix()" }, + { "trigger": "swf_removeobject", "contents": "swf_removeobject(${1:depth})" }, + { "trigger": "swf_rotate", "contents": "swf_rotate(${1:angle}, ${2:axis})" }, + { "trigger": "swf_scale", "contents": "swf_scale(${1:x}, ${2:y}, ${3:z})" }, + { "trigger": "swf_setfont", "contents": "swf_setfont(${1:fontid})" }, + { "trigger": "swf_setframe", "contents": "swf_setframe(${1:framenumber})" }, + { "trigger": "swf_shapearc", "contents": "swf_shapearc(${1:x}, ${2:y}, ${3:r}, ${4:ang1}, ${5:ang2})" }, + { "trigger": "swf_shapecurveto", "contents": "swf_shapecurveto(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2})" }, + { "trigger": "swf_shapecurveto3", "contents": "swf_shapecurveto3(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${6:y3})" }, + { "trigger": "swf_shapefillbitmapclip", "contents": "swf_shapefillbitmapclip(${1:bitmapid})" }, + { "trigger": "swf_shapefillbitmaptile", "contents": "swf_shapefillbitmaptile(${1:bitmapid})" }, + { "trigger": "swf_shapefilloff", "contents": "swf_shapefilloff()" }, + { "trigger": "swf_shapefillsolid", "contents": "swf_shapefillsolid(${1:r}, ${2:g}, ${3:b}, ${4:a})" }, + { "trigger": "swf_shapelinesolid", "contents": "swf_shapelinesolid(${1:r}, ${2:g}, ${3:b}, ${4:a}, ${5:width})" }, + { "trigger": "swf_shapelineto", "contents": "swf_shapelineto(${1:x}, ${2:y})" }, + { "trigger": "swf_shapemoveto", "contents": "swf_shapemoveto(${1:x}, ${2:y})" }, + { "trigger": "swf_showframe", "contents": "swf_showframe()" }, + { "trigger": "swf_startbutton", "contents": "swf_startbutton(${1:objid}, ${2:type})" }, + { "trigger": "swf_startdoaction", "contents": "swf_startdoaction()" }, + { "trigger": "swf_startshape", "contents": "swf_startshape(${1:objid})" }, + { "trigger": "swf_startsymbol", "contents": "swf_startsymbol(${1:objid})" }, + { "trigger": "swf_textwidth", "contents": "swf_textwidth(${1:str})" }, + { "trigger": "swf_translate", "contents": "swf_translate(${1:x}, ${2:y}, ${3:z})" }, + { "trigger": "swf_viewport", "contents": "swf_viewport(${1:xmin}, ${2:xmax}, ${3:ymin}, ${4:ymax})" }, + { "trigger": "SWFSound", "contents": "SWFSound(${1:filename})" }, + { "trigger": "sybase_affected_rows", "contents": "sybase_affected_rows()" }, + { "trigger": "sybase_close", "contents": "sybase_close()" }, + { "trigger": "sybase_connect", "contents": "sybase_connect()" }, + { "trigger": "sybase_data_seek", "contents": "sybase_data_seek(${1:result_identifier}, ${2:row_number})" }, + { "trigger": "sybase_deadlock_retry_count", "contents": "sybase_deadlock_retry_count(${1:retry_count})" }, + { "trigger": "sybase_fetch_array", "contents": "sybase_fetch_array(${1:result})" }, + { "trigger": "sybase_fetch_assoc", "contents": "sybase_fetch_assoc(${1:result})" }, + { "trigger": "sybase_fetch_field", "contents": "sybase_fetch_field(${1:result})" }, + { "trigger": "sybase_fetch_object", "contents": "sybase_fetch_object(${1:result})" }, + { "trigger": "sybase_fetch_row", "contents": "sybase_fetch_row(${1:result})" }, + { "trigger": "sybase_field_seek", "contents": "sybase_field_seek(${1:result}, ${2:field_offset})" }, + { "trigger": "sybase_free_result", "contents": "sybase_free_result(${1:result})" }, + { "trigger": "sybase_get_last_message", "contents": "sybase_get_last_message()" }, + { "trigger": "sybase_min_client_severity", "contents": "sybase_min_client_severity(${1:severity})" }, + { "trigger": "sybase_min_error_severity", "contents": "sybase_min_error_severity(${1:severity})" }, + { "trigger": "sybase_min_message_severity", "contents": "sybase_min_message_severity(${1:severity})" }, + { "trigger": "sybase_min_server_severity", "contents": "sybase_min_server_severity(${1:severity})" }, + { "trigger": "sybase_num_fields", "contents": "sybase_num_fields(${1:result})" }, + { "trigger": "sybase_num_rows", "contents": "sybase_num_rows(${1:result})" }, + { "trigger": "sybase_pconnect", "contents": "sybase_pconnect()" }, + { "trigger": "sybase_query", "contents": "sybase_query(${1:query})" }, + { "trigger": "sybase_result", "contents": "sybase_result(${1:result}, ${2:row}, ${3:field})" }, + { "trigger": "sybase_select_db", "contents": "sybase_select_db(${1:database_name})" }, + { "trigger": "sybase_set_message_handler", "contents": "sybase_set_message_handler(${1:handler})" }, + { "trigger": "sybase_unbuffered_query", "contents": "sybase_unbuffered_query(${1:query}, ${2:link_identifier})" }, + { "trigger": "symlink", "contents": "symlink(${1:target}, ${2:link})" }, + { "trigger": "sys_get_temp_dir", "contents": "sys_get_temp_dir()" }, + { "trigger": "sys_getloadavg", "contents": "sys_getloadavg()" }, + { "trigger": "syslog", "contents": "syslog(${1:priority}, ${2:message})" }, + { "trigger": "system", "contents": "system(${1:command})" }, + { "trigger": "tan", "contents": "tan(${1:arg})" }, + { "trigger": "tanh", "contents": "tanh(${1:arg})" }, + { "trigger": "tcpwrap_check", "contents": "tcpwrap_check(${1:daemon}, ${2:address})" }, + { "trigger": "tempnam", "contents": "tempnam(${1:dir}, ${2:prefix})" }, + { "trigger": "textdomain", "contents": "textdomain(${1:text_domain})" }, + { "trigger": "tidy_access_count", "contents": "tidy_access_count(${1:object})" }, + { "trigger": "tidy_config_count", "contents": "tidy_config_count(${1:object})" }, + { "trigger": "tidy_error_count", "contents": "tidy_error_count(${1:object})" }, + { "trigger": "tidy_get_error_buffer", "contents": "tidy_get_error_buffer(${1:object})" }, + { "trigger": "tidy_get_output", "contents": "tidy_get_output(${1:object})" }, + { "trigger": "tidy_load_config", "contents": "tidy_load_config(${1:filename}, ${2:encoding})" }, + { "trigger": "tidy_reset_config", "contents": "tidy_reset_config()" }, + { "trigger": "tidy_save_config", "contents": "tidy_save_config(${1:filename})" }, + { "trigger": "tidy_set_encoding", "contents": "tidy_set_encoding(${1:encoding})" }, + { "trigger": "tidy_setopt", "contents": "tidy_setopt(${1:option}, ${2:value})" }, + { "trigger": "tidy_warning_count", "contents": "tidy_warning_count(${1:object})" }, + { "trigger": "time", "contents": "time()" }, + { "trigger": "time_nanosleep", "contents": "time_nanosleep(${1:seconds}, ${2:nanoseconds})" }, + { "trigger": "time_sleep_until", "contents": "time_sleep_until(${1:timestamp})" }, + { "trigger": "timezone_abbreviations_list", "contents": "timezone_abbreviations_list()" }, + { "trigger": "timezone_identifiers_list", "contents": "timezone_identifiers_list()" }, + { "trigger": "timezone_location_get", "contents": "timezone_location_get()" }, + { "trigger": "timezone_name_from_abbr", "contents": "timezone_name_from_abbr(${1:abbr})" }, + { "trigger": "timezone_name_get", "contents": "timezone_name_get()" }, + { "trigger": "timezone_offset_get", "contents": "timezone_offset_get()" }, + { "trigger": "timezone_open", "contents": "timezone_open()" }, + { "trigger": "timezone_transitions_get", "contents": "timezone_transitions_get()" }, + { "trigger": "timezone_version_get", "contents": "timezone_version_get()" }, + { "trigger": "tmpfile", "contents": "tmpfile()" }, + { "trigger": "token_get_all", "contents": "token_get_all(${1:source})" }, + { "trigger": "token_name", "contents": "token_name(${1:token})" }, + { "trigger": "touch", "contents": "touch(${1:filename})" }, + { "trigger": "trigger_error", "contents": "trigger_error(${1:error_msg})" }, + { "trigger": "trim", "contents": "trim(${1:str})" }, + { "trigger": "uasort", "contents": "uasort(${1:array}, ${2:cmp_function})" }, + { "trigger": "ucfirst", "contents": "ucfirst(${1:str})" }, + { "trigger": "ucwords", "contents": "ucwords(${1:str})" }, + { "trigger": "udm_add_search_limit", "contents": "udm_add_search_limit(${1:agent}, ${2:var}, ${3:val})" }, + { "trigger": "udm_alloc_agent", "contents": "udm_alloc_agent(${1:dbaddr})" }, + { "trigger": "udm_alloc_agent_array", "contents": "udm_alloc_agent_array(${1:databases})" }, + { "trigger": "udm_api_version", "contents": "udm_api_version()" }, + { "trigger": "udm_cat_list", "contents": "udm_cat_list(${1:agent}, ${2:category})" }, + { "trigger": "udm_cat_path", "contents": "udm_cat_path(${1:agent}, ${2:category})" }, + { "trigger": "udm_check_charset", "contents": "udm_check_charset(${1:agent}, ${2:charset})" }, + { "trigger": "udm_check_stored", "contents": "udm_check_stored(${1:agent}, ${2:link}, ${3:doc_id})" }, + { "trigger": "udm_clear_search_limits", "contents": "udm_clear_search_limits(${1:agent})" }, + { "trigger": "udm_close_stored", "contents": "udm_close_stored(${1:agent}, ${2:link})" }, + { "trigger": "udm_crc32", "contents": "udm_crc32(${1:agent}, ${2:str})" }, + { "trigger": "udm_errno", "contents": "udm_errno(${1:agent})" }, + { "trigger": "udm_error", "contents": "udm_error(${1:agent})" }, + { "trigger": "udm_find", "contents": "udm_find(${1:agent}, ${2:query})" }, + { "trigger": "udm_free_agent", "contents": "udm_free_agent(${1:agent})" }, + { "trigger": "udm_free_ispell_data", "contents": "udm_free_ispell_data(${1:agent})" }, + { "trigger": "udm_free_res", "contents": "udm_free_res(${1:res})" }, + { "trigger": "udm_get_doc_count", "contents": "udm_get_doc_count(${1:agent})" }, + { "trigger": "udm_get_res_field", "contents": "udm_get_res_field(${1:res}, ${2:row}, ${3:field})" }, + { "trigger": "udm_get_res_param", "contents": "udm_get_res_param(${1:res}, ${2:param})" }, + { "trigger": "udm_hash32", "contents": "udm_hash32(${1:agent}, ${2:str})" }, + { "trigger": "udm_load_ispell_data", "contents": "udm_load_ispell_data(${1:agent}, ${2:var}, ${3:val1}, ${4:val2}, ${5:flag})" }, + { "trigger": "udm_open_stored", "contents": "udm_open_stored(${1:agent}, ${2:storedaddr})" }, + { "trigger": "udm_set_agent_param", "contents": "udm_set_agent_param(${1:agent}, ${2:var}, ${3:val})" }, + { "trigger": "uksort", "contents": "uksort(${1:array}, ${2:cmp_function})" }, + { "trigger": "umask", "contents": "umask()" }, + { "trigger": "uniqid", "contents": "uniqid()" }, + { "trigger": "unixtojd", "contents": "unixtojd()" }, + { "trigger": "unlink", "contents": "unlink(${1:filename})" }, + { "trigger": "unpack", "contents": "unpack(${1:format}, ${2:data})" }, + { "trigger": "unregister_tick_function", "contents": "unregister_tick_function(${1:function_name})" }, + { "trigger": "unserialize", "contents": "unserialize(${1:str})" }, + { "trigger": "unset", "contents": "unset(${1:var})" }, + { "trigger": "urldecode", "contents": "urldecode(${1:str})" }, + { "trigger": "urlencode", "contents": "urlencode(${1:str})" }, + { "trigger": "use_soap_error_handler", "contents": "use_soap_error_handler()" }, + { "trigger": "user_error", "contents": "user_error()" }, + { "trigger": "usleep", "contents": "usleep(${1:micro_seconds})" }, + { "trigger": "usort", "contents": "usort(${1:array}, ${2:cmp_function})" }, + { "trigger": "utf8_decode", "contents": "utf8_decode(${1:data})" }, + { "trigger": "utf8_encode", "contents": "utf8_encode(${1:data})" }, + { "trigger": "var_dump", "contents": "var_dump(${1:expression})" }, + { "trigger": "var_export", "contents": "var_export(${1:expression})" }, + { "trigger": "variant_abs", "contents": "variant_abs(${1:val})" }, + { "trigger": "variant_add", "contents": "variant_add(${1:left}, ${2:right})" }, + { "trigger": "variant_and", "contents": "variant_and(${1:left}, ${2:right})" }, + { "trigger": "variant_cast", "contents": "variant_cast(${1:variant}, ${2:type})" }, + { "trigger": "variant_cat", "contents": "variant_cat(${1:left}, ${2:right})" }, + { "trigger": "variant_cmp", "contents": "variant_cmp(${1:left}, ${2:right})" }, + { "trigger": "variant_date_from_timestamp", "contents": "variant_date_from_timestamp(${1:timestamp})" }, + { "trigger": "variant_date_to_timestamp", "contents": "variant_date_to_timestamp(${1:variant})" }, + { "trigger": "variant_div", "contents": "variant_div(${1:left}, ${2:right})" }, + { "trigger": "variant_eqv", "contents": "variant_eqv(${1:left}, ${2:right})" }, + { "trigger": "variant_fix", "contents": "variant_fix(${1:variant})" }, + { "trigger": "variant_get_type", "contents": "variant_get_type(${1:variant})" }, + { "trigger": "variant_idiv", "contents": "variant_idiv(${1:left}, ${2:right})" }, + { "trigger": "variant_imp", "contents": "variant_imp(${1:left}, ${2:right})" }, + { "trigger": "variant_int", "contents": "variant_int(${1:variant})" }, + { "trigger": "variant_mod", "contents": "variant_mod(${1:left}, ${2:right})" }, + { "trigger": "variant_mul", "contents": "variant_mul(${1:left}, ${2:right})" }, + { "trigger": "variant_neg", "contents": "variant_neg(${1:variant})" }, + { "trigger": "variant_not", "contents": "variant_not(${1:variant})" }, + { "trigger": "variant_or", "contents": "variant_or(${1:left}, ${2:right})" }, + { "trigger": "variant_pow", "contents": "variant_pow(${1:left}, ${2:right})" }, + { "trigger": "variant_round", "contents": "variant_round(${1:variant}, ${2:decimals})" }, + { "trigger": "variant_set", "contents": "variant_set(${1:variant}, ${2:value})" }, + { "trigger": "variant_set_type", "contents": "variant_set_type(${1:variant}, ${2:type})" }, + { "trigger": "variant_sub", "contents": "variant_sub(${1:left}, ${2:right})" }, + { "trigger": "variant_xor", "contents": "variant_xor(${1:left}, ${2:right})" }, + { "trigger": "version_compare", "contents": "version_compare(${1:version1}, ${2:version2})" }, + { "trigger": "vfprintf", "contents": "vfprintf(${1:handle}, ${2:format}, ${3:args})" }, + { "trigger": "virtual", "contents": "virtual(${1:filename})" }, + { "trigger": "vpopmail_add_alias_domain", "contents": "vpopmail_add_alias_domain(${1:domain}, ${2:aliasdomain})" }, + { "trigger": "vpopmail_add_alias_domain_ex", "contents": "vpopmail_add_alias_domain_ex(${1:olddomain}, ${2:newdomain})" }, + { "trigger": "vpopmail_add_domain", "contents": "vpopmail_add_domain(${1:domain}, ${2:dir}, ${3:uid}, ${4:gid})" }, + { "trigger": "vpopmail_add_domain_ex", "contents": "vpopmail_add_domain_ex(${1:domain}, ${2:passwd})" }, + { "trigger": "vpopmail_add_user", "contents": "vpopmail_add_user(${1:user}, ${2:domain}, ${3:password})" }, + { "trigger": "vpopmail_alias_add", "contents": "vpopmail_alias_add(${1:user}, ${2:domain}, ${3:alias})" }, + { "trigger": "vpopmail_alias_del", "contents": "vpopmail_alias_del(${1:user}, ${2:domain})" }, + { "trigger": "vpopmail_alias_del_domain", "contents": "vpopmail_alias_del_domain(${1:domain})" }, + { "trigger": "vpopmail_alias_get", "contents": "vpopmail_alias_get(${1:alias}, ${2:domain})" }, + { "trigger": "vpopmail_alias_get_all", "contents": "vpopmail_alias_get_all(${1:domain})" }, + { "trigger": "vpopmail_auth_user", "contents": "vpopmail_auth_user(${1:user}, ${2:domain}, ${3:password})" }, + { "trigger": "vpopmail_del_domain", "contents": "vpopmail_del_domain(${1:domain})" }, + { "trigger": "vpopmail_del_domain_ex", "contents": "vpopmail_del_domain_ex(${1:domain})" }, + { "trigger": "vpopmail_del_user", "contents": "vpopmail_del_user(${1:user}, ${2:domain})" }, + { "trigger": "vpopmail_error", "contents": "vpopmail_error()" }, + { "trigger": "vpopmail_passwd", "contents": "vpopmail_passwd(${1:user}, ${2:domain}, ${3:password})" }, + { "trigger": "vpopmail_set_user_quota", "contents": "vpopmail_set_user_quota(${1:user}, ${2:domain}, ${3:quota})" }, + { "trigger": "vprintf", "contents": "vprintf(${1:format}, ${2:args})" }, + { "trigger": "vsprintf", "contents": "vsprintf(${1:format}, ${2:args})" }, + { "trigger": "w32api_deftype", "contents": "w32api_deftype(${1:typename}, ${2:member1_type}, ${3:member1_name})" }, + { "trigger": "w32api_init_dtype", "contents": "w32api_init_dtype(${1:typename}, ${2:value})" }, + { "trigger": "w32api_invoke_function", "contents": "w32api_invoke_function(${1:funcname}, ${2:argument})" }, + { "trigger": "w32api_register_function", "contents": "w32api_register_function(${1:library}, ${2:function_name}, ${3:return_type})" }, + { "trigger": "w32api_set_call_method", "contents": "w32api_set_call_method(${1:method})" }, + { "trigger": "wddx_add_vars", "contents": "wddx_add_vars(${1:packet_id}, ${2:var_name})" }, + { "trigger": "wddx_deserialize", "contents": "wddx_deserialize()" }, + { "trigger": "wddx_packet_end", "contents": "wddx_packet_end(${1:packet_id})" }, + { "trigger": "wddx_packet_start", "contents": "wddx_packet_start()" }, + { "trigger": "wddx_serialize_value", "contents": "wddx_serialize_value(${1:var})" }, + { "trigger": "wddx_serialize_vars", "contents": "wddx_serialize_vars(${1:var_name})" }, + { "trigger": "wddx_unserialize", "contents": "wddx_unserialize(${1:packet})" }, + { "trigger": "win32_continue_service", "contents": "win32_continue_service(${1:servicename})" }, + { "trigger": "win32_create_service", "contents": "win32_create_service(${1:details})" }, + { "trigger": "win32_delete_service", "contents": "win32_delete_service(${1:servicename})" }, + { "trigger": "win32_get_last_control_message", "contents": "win32_get_last_control_message()" }, + { "trigger": "win32_pause_service", "contents": "win32_pause_service(${1:servicename})" }, + { "trigger": "win32_ps_list_procs", "contents": "win32_ps_list_procs()" }, + { "trigger": "win32_ps_stat_mem", "contents": "win32_ps_stat_mem()" }, + { "trigger": "win32_ps_stat_proc", "contents": "win32_ps_stat_proc()" }, + { "trigger": "win32_query_service_status", "contents": "win32_query_service_status(${1:servicename})" }, + { "trigger": "win32_set_service_status", "contents": "win32_set_service_status(${1:status})" }, + { "trigger": "win32_start_service", "contents": "win32_start_service(${1:servicename})" }, + { "trigger": "win32_start_service_ctrl_dispatcher", "contents": "win32_start_service_ctrl_dispatcher(${1:name})" }, + { "trigger": "win32_stop_service", "contents": "win32_stop_service(${1:servicename})" }, + { "trigger": "wincache_fcache_fileinfo", "contents": "wincache_fcache_fileinfo()" }, + { "trigger": "wincache_fcache_meminfo", "contents": "wincache_fcache_meminfo()" }, + { "trigger": "wincache_lock", "contents": "wincache_lock(${1:key})" }, + { "trigger": "wincache_ocache_fileinfo", "contents": "wincache_ocache_fileinfo()" }, + { "trigger": "wincache_ocache_meminfo", "contents": "wincache_ocache_meminfo()" }, + { "trigger": "wincache_refresh_if_changed", "contents": "wincache_refresh_if_changed()" }, + { "trigger": "wincache_rplist_fileinfo", "contents": "wincache_rplist_fileinfo()" }, + { "trigger": "wincache_rplist_meminfo", "contents": "wincache_rplist_meminfo()" }, + { "trigger": "wincache_scache_info", "contents": "wincache_scache_info()" }, + { "trigger": "wincache_scache_meminfo", "contents": "wincache_scache_meminfo()" }, + { "trigger": "wincache_ucache_add", "contents": "wincache_ucache_add(${1:key}, ${2:value})" }, + { "trigger": "wincache_ucache_cas", "contents": "wincache_ucache_cas(${1:key}, ${2:old_value}, ${3:new_value})" }, + { "trigger": "wincache_ucache_clear", "contents": "wincache_ucache_clear()" }, + { "trigger": "wincache_ucache_dec", "contents": "wincache_ucache_dec(${1:key})" }, + { "trigger": "wincache_ucache_delete", "contents": "wincache_ucache_delete(${1:key})" }, + { "trigger": "wincache_ucache_exists", "contents": "wincache_ucache_exists(${1:key})" }, + { "trigger": "wincache_ucache_get", "contents": "wincache_ucache_get(${1:key})" }, + { "trigger": "wincache_ucache_inc", "contents": "wincache_ucache_inc(${1:key})" }, + { "trigger": "wincache_ucache_info", "contents": "wincache_ucache_info()" }, + { "trigger": "wincache_ucache_meminfo", "contents": "wincache_ucache_meminfo()" }, + { "trigger": "wincache_ucache_set", "contents": "wincache_ucache_set(${1:key}, ${2:value})" }, + { "trigger": "wincache_unlock", "contents": "wincache_unlock(${1:key})" }, + { "trigger": "wordwrap", "contents": "wordwrap(${1:str})" }, + { "trigger": "xattr_get", "contents": "xattr_get(${1:filename}, ${2:name})" }, + { "trigger": "xattr_list", "contents": "xattr_list(${1:filename})" }, + { "trigger": "xattr_remove", "contents": "xattr_remove(${1:filename}, ${2:name})" }, + { "trigger": "xattr_set", "contents": "xattr_set(${1:filename}, ${2:name}, ${3:value})" }, + { "trigger": "xattr_supported", "contents": "xattr_supported(${1:filename})" }, + { "trigger": "xdiff_file_bdiff", "contents": "xdiff_file_bdiff(${1:old_file}, ${2:new_file}, ${3:dest})" }, + { "trigger": "xdiff_file_bdiff_size", "contents": "xdiff_file_bdiff_size(${1:file})" }, + { "trigger": "xdiff_file_bpatch", "contents": "xdiff_file_bpatch(${1:file}, ${2:patch}, ${3:dest})" }, + { "trigger": "xdiff_file_diff", "contents": "xdiff_file_diff(${1:old_file}, ${2:new_file}, ${3:dest})" }, + { "trigger": "xdiff_file_diff_binary", "contents": "xdiff_file_diff_binary(${1:old_file}, ${2:new_file}, ${3:dest})" }, + { "trigger": "xdiff_file_merge3", "contents": "xdiff_file_merge3(${1:old_file}, ${2:new_file1}, ${3:new_file2}, ${4:dest})" }, + { "trigger": "xdiff_file_patch", "contents": "xdiff_file_patch(${1:file}, ${2:patch}, ${3:dest})" }, + { "trigger": "xdiff_file_patch_binary", "contents": "xdiff_file_patch_binary(${1:file}, ${2:patch}, ${3:dest})" }, + { "trigger": "xdiff_file_rabdiff", "contents": "xdiff_file_rabdiff(${1:old_file}, ${2:new_file}, ${3:dest})" }, + { "trigger": "xdiff_string_bdiff", "contents": "xdiff_string_bdiff(${1:old_data}, ${2:new_data})" }, + { "trigger": "xdiff_string_bdiff_size", "contents": "xdiff_string_bdiff_size(${1:patch})" }, + { "trigger": "xdiff_string_bpatch", "contents": "xdiff_string_bpatch(${1:str}, ${2:patch})" }, + { "trigger": "xdiff_string_diff", "contents": "xdiff_string_diff(${1:old_data}, ${2:new_data})" }, + { "trigger": "xdiff_string_diff_binary", "contents": "xdiff_string_diff_binary(${1:old_data}, ${2:new_data})" }, + { "trigger": "xdiff_string_merge3", "contents": "xdiff_string_merge3(${1:old_data}, ${2:new_data1}, ${3:new_data2})" }, + { "trigger": "xdiff_string_patch", "contents": "xdiff_string_patch(${1:str}, ${2:patch})" }, + { "trigger": "xdiff_string_patch_binary", "contents": "xdiff_string_patch_binary(${1:str}, ${2:patch})" }, + { "trigger": "xdiff_string_rabdiff", "contents": "xdiff_string_rabdiff(${1:old_data}, ${2:new_data})" }, + { "trigger": "xml_error_string", "contents": "xml_error_string(${1:code})" }, + { "trigger": "xml_get_current_byte_index", "contents": "xml_get_current_byte_index(${1:parser})" }, + { "trigger": "xml_get_current_column_number", "contents": "xml_get_current_column_number(${1:parser})" }, + { "trigger": "xml_get_current_line_number", "contents": "xml_get_current_line_number(${1:parser})" }, + { "trigger": "xml_get_error_code", "contents": "xml_get_error_code(${1:parser})" }, + { "trigger": "xml_parse", "contents": "xml_parse(${1:parser}, ${2:data})" }, + { "trigger": "xml_parse_into_struct", "contents": "xml_parse_into_struct(${1:parser}, ${2:data}, ${3:values})" }, + { "trigger": "xml_parser_create", "contents": "xml_parser_create()" }, + { "trigger": "xml_parser_create_ns", "contents": "xml_parser_create_ns()" }, + { "trigger": "xml_parser_free", "contents": "xml_parser_free(${1:parser})" }, + { "trigger": "xml_parser_get_option", "contents": "xml_parser_get_option(${1:parser}, ${2:option})" }, + { "trigger": "xml_parser_set_option", "contents": "xml_parser_set_option(${1:parser}, ${2:option}, ${3:value})" }, + { "trigger": "xml_set_character_data_handler", "contents": "xml_set_character_data_handler(${1:parser}, ${2:handler})" }, + { "trigger": "xml_set_default_handler", "contents": "xml_set_default_handler(${1:parser}, ${2:handler})" }, + { "trigger": "xml_set_element_handler", "contents": "xml_set_element_handler(${1:parser}, ${2:start_element_handler}, ${3:end_element_handler})" }, + { "trigger": "xml_set_end_namespace_decl_handler", "contents": "xml_set_end_namespace_decl_handler(${1:parser}, ${2:handler})" }, + { "trigger": "xml_set_external_entity_ref_handler", "contents": "xml_set_external_entity_ref_handler(${1:parser}, ${2:handler})" }, + { "trigger": "xml_set_notation_decl_handler", "contents": "xml_set_notation_decl_handler(${1:parser}, ${2:handler})" }, + { "trigger": "xml_set_object", "contents": "xml_set_object(${1:parser}, ${2:object})" }, + { "trigger": "xml_set_processing_instruction_handler", "contents": "xml_set_processing_instruction_handler(${1:parser}, ${2:handler})" }, + { "trigger": "xml_set_start_namespace_decl_handler", "contents": "xml_set_start_namespace_decl_handler(${1:parser}, ${2:handler})" }, + { "trigger": "xml_set_unparsed_entity_decl_handler", "contents": "xml_set_unparsed_entity_decl_handler(${1:parser}, ${2:handler})" }, + { "trigger": "xmlrpc_decode", "contents": "xmlrpc_decode(${1:xml})" }, + { "trigger": "xmlrpc_decode_request", "contents": "xmlrpc_decode_request(${1:xml}, ${2:method})" }, + { "trigger": "xmlrpc_encode", "contents": "xmlrpc_encode(${1:value})" }, + { "trigger": "xmlrpc_encode_request", "contents": "xmlrpc_encode_request(${1:method}, ${2:params})" }, + { "trigger": "xmlrpc_get_type", "contents": "xmlrpc_get_type(${1:value})" }, + { "trigger": "xmlrpc_is_fault", "contents": "xmlrpc_is_fault(${1:arg})" }, + { "trigger": "xmlrpc_parse_method_descriptions", "contents": "xmlrpc_parse_method_descriptions(${1:xml})" }, + { "trigger": "xmlrpc_server_add_introspection_data", "contents": "xmlrpc_server_add_introspection_data(${1:server}, ${2:desc})" }, + { "trigger": "xmlrpc_server_call_method", "contents": "xmlrpc_server_call_method(${1:server}, ${2:xml}, ${3:user_data})" }, + { "trigger": "xmlrpc_server_create", "contents": "xmlrpc_server_create()" }, + { "trigger": "xmlrpc_server_destroy", "contents": "xmlrpc_server_destroy(${1:server})" }, + { "trigger": "xmlrpc_server_register_introspection_callback", "contents": "xmlrpc_server_register_introspection_callback(${1:server}, ${2:function})" }, + { "trigger": "xmlrpc_server_register_method", "contents": "xmlrpc_server_register_method(${1:server}, ${2:method_name}, ${3:function})" }, + { "trigger": "xmlrpc_set_type", "contents": "xmlrpc_set_type(${1:value}, ${2:type})" }, + { "trigger": "xpath_eval", "contents": "xpath_eval(${1:xpath_expression})" }, + { "trigger": "xpath_eval_expression", "contents": "xpath_eval_expression(${1:expression})" }, + { "trigger": "xpath_new_context", "contents": "xpath_new_context(${1:dom_document})" }, + { "trigger": "xpath_register_ns", "contents": "xpath_register_ns(${1:xpath_context}, ${2:prefix}, ${3:uri})" }, + { "trigger": "xpath_register_ns_auto", "contents": "xpath_register_ns_auto(${1:xpath_context})" }, + { "trigger": "xptr_eval", "contents": "xptr_eval(${1:eval_str})" }, + { "trigger": "xptr_new_context", "contents": "xptr_new_context()" }, + { "trigger": "xslt_backend_info", "contents": "xslt_backend_info()" }, + { "trigger": "xslt_backend_name", "contents": "xslt_backend_name()" }, + { "trigger": "xslt_backend_version", "contents": "xslt_backend_version()" }, + { "trigger": "xslt_create", "contents": "xslt_create()" }, + { "trigger": "xslt_errno", "contents": "xslt_errno(${1:xh})" }, + { "trigger": "xslt_error", "contents": "xslt_error(${1:xh})" }, + { "trigger": "xslt_free", "contents": "xslt_free(${1:xh})" }, + { "trigger": "xslt_getopt", "contents": "xslt_getopt(${1:processor})" }, + { "trigger": "xslt_process", "contents": "xslt_process(${1:xh}, ${2:xmlcontainer}, ${3:xslcontainer})" }, + { "trigger": "xslt_set_base", "contents": "xslt_set_base(${1:xh}, ${2:uri})" }, + { "trigger": "xslt_set_encoding", "contents": "xslt_set_encoding(${1:xh}, ${2:encoding})" }, + { "trigger": "xslt_set_error_handler", "contents": "xslt_set_error_handler(${1:xh}, ${2:handler})" }, + { "trigger": "xslt_set_log", "contents": "xslt_set_log(${1:xh})" }, + { "trigger": "xslt_set_object", "contents": "xslt_set_object(${1:processor}, ${2:obj})" }, + { "trigger": "xslt_set_sax_handler", "contents": "xslt_set_sax_handler(${1:xh}, ${2:handlers})" }, + { "trigger": "xslt_set_sax_handlers", "contents": "xslt_set_sax_handlers(${1:processor}, ${2:handlers})" }, + { "trigger": "xslt_set_scheme_handler", "contents": "xslt_set_scheme_handler(${1:xh}, ${2:handlers})" }, + { "trigger": "xslt_set_scheme_handlers", "contents": "xslt_set_scheme_handlers(${1:xh}, ${2:handlers})" }, + { "trigger": "xslt_setopt", "contents": "xslt_setopt(${1:processor}, ${2:newmask})" }, + { "trigger": "yaml_emit", "contents": "yaml_emit(${1:data})" }, + { "trigger": "yaml_emit_file", "contents": "yaml_emit_file(${1:filename}, ${2:data})" }, + { "trigger": "yaml_parse", "contents": "yaml_parse(${1:input})" }, + { "trigger": "yaml_parse_file", "contents": "yaml_parse_file(${1:filename})" }, + { "trigger": "yaml_parse_url", "contents": "yaml_parse_url(${1:url})" }, + { "trigger": "yaz_addinfo", "contents": "yaz_addinfo(${1:id})" }, + { "trigger": "yaz_ccl_conf", "contents": "yaz_ccl_conf(${1:id}, ${2:config})" }, + { "trigger": "yaz_ccl_parse", "contents": "yaz_ccl_parse(${1:id}, ${2:query}, ${3:result})" }, + { "trigger": "yaz_close", "contents": "yaz_close(${1:id})" }, + { "trigger": "yaz_connect", "contents": "yaz_connect(${1:zurl})" }, + { "trigger": "yaz_database", "contents": "yaz_database(${1:id}, ${2:databases})" }, + { "trigger": "yaz_element", "contents": "yaz_element(${1:id}, ${2:elementset})" }, + { "trigger": "yaz_errno", "contents": "yaz_errno(${1:id})" }, + { "trigger": "yaz_error", "contents": "yaz_error(${1:id})" }, + { "trigger": "yaz_es", "contents": "yaz_es(${1:id}, ${2:type}, ${3:args})" }, + { "trigger": "yaz_es_result", "contents": "yaz_es_result(${1:id})" }, + { "trigger": "yaz_get_option", "contents": "yaz_get_option(${1:id}, ${2:name})" }, + { "trigger": "yaz_hits", "contents": "yaz_hits(${1:id})" }, + { "trigger": "yaz_itemorder", "contents": "yaz_itemorder(${1:id}, ${2:args})" }, + { "trigger": "yaz_present", "contents": "yaz_present(${1:id})" }, + { "trigger": "yaz_range", "contents": "yaz_range(${1:id}, ${2:start}, ${3:number})" }, + { "trigger": "yaz_record", "contents": "yaz_record(${1:id}, ${2:pos}, ${3:type})" }, + { "trigger": "yaz_scan", "contents": "yaz_scan(${1:id}, ${2:type}, ${3:startterm})" }, + { "trigger": "yaz_scan_result", "contents": "yaz_scan_result(${1:id})" }, + { "trigger": "yaz_schema", "contents": "yaz_schema(${1:id}, ${2:schema})" }, + { "trigger": "yaz_search", "contents": "yaz_search(${1:id}, ${2:type}, ${3:query})" }, + { "trigger": "yaz_set_option", "contents": "yaz_set_option(${1:id}, ${2:name}, ${3:value})" }, + { "trigger": "yaz_sort", "contents": "yaz_sort(${1:id}, ${2:criteria})" }, + { "trigger": "yaz_syntax", "contents": "yaz_syntax(${1:id}, ${2:syntax})" }, + { "trigger": "yaz_wait", "contents": "yaz_wait()" }, + { "trigger": "yp_all", "contents": "yp_all(${1:domain}, ${2:map}, ${3:callback})" }, + { "trigger": "yp_cat", "contents": "yp_cat(${1:domain}, ${2:map})" }, + { "trigger": "yp_err_string", "contents": "yp_err_string(${1:errorcode})" }, + { "trigger": "yp_errno", "contents": "yp_errno()" }, + { "trigger": "yp_first", "contents": "yp_first(${1:domain}, ${2:map})" }, + { "trigger": "yp_get_default_domain", "contents": "yp_get_default_domain()" }, + { "trigger": "yp_master", "contents": "yp_master(${1:domain}, ${2:map})" }, + { "trigger": "yp_match", "contents": "yp_match(${1:domain}, ${2:map}, ${3:key})" }, + { "trigger": "yp_next", "contents": "yp_next(${1:domain}, ${2:map}, ${3:key})" }, + { "trigger": "yp_order", "contents": "yp_order(${1:domain}, ${2:map})" }, + { "trigger": "zend_logo_guid", "contents": "zend_logo_guid()" }, + { "trigger": "zend_thread_id", "contents": "zend_thread_id()" }, + { "trigger": "zend_version", "contents": "zend_version()" }, + { "trigger": "zip_close", "contents": "zip_close(${1:zip})" }, + { "trigger": "zip_entry_close", "contents": "zip_entry_close(${1:zip_entry})" }, + { "trigger": "zip_entry_compressedsize", "contents": "zip_entry_compressedsize(${1:zip_entry})" }, + { "trigger": "zip_entry_compressionmethod", "contents": "zip_entry_compressionmethod(${1:zip_entry})" }, + { "trigger": "zip_entry_filesize", "contents": "zip_entry_filesize(${1:zip_entry})" }, + { "trigger": "zip_entry_name", "contents": "zip_entry_name(${1:zip_entry})" }, + { "trigger": "zip_entry_open", "contents": "zip_entry_open(${1:zip}, ${2:zip_entry})" }, + { "trigger": "zip_entry_read", "contents": "zip_entry_read(${1:zip_entry})" }, + { "trigger": "zip_open", "contents": "zip_open(${1:filename})" }, + { "trigger": "zip_read", "contents": "zip_read(${1:zip})" }, + { "trigger": "zlib_get_coding_type", "contents": "zlib_get_coding_type()" }, + { "trigger": "password_hash", "contents": "password_hash(${1:string}, ${2:PASSWORD_DEFAULT})" }, + { "trigger": "password_verify", "contents": "password_verify(${1:password}, ${2:hash})" }, + { "trigger": "password_get_info", "contents": "password_get_info(${1:hash})" }, + { "trigger": "password_needs_rehash", "contents": "password_needs_rehash(${1:hash}, ${2:PASSWORD_DEFAULT})" } + ] +} diff --git a/assets/syntaxes/Packages/PHP/PHP.sublime-syntax b/assets/syntaxes/Packages/PHP/PHP.sublime-syntax new file mode 100644 index 000000000..46e8d14c2 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/PHP.sublime-syntax @@ -0,0 +1,40 @@ +%YAML 1.2 +--- +name: PHP +file_extensions: + - php + - php3 + - php4 + - php5 + - php7 + - phps + - phpt + - phtml +first_line_match: '^(#!.*[^-]php[0-9]?|<\?php)\b' +scope: embedding.php +contexts: + main: + - match: '' + push: scope:text.html.basic + with_prototype: + - match: <\?(?i:php|=)?(?![^?]*\?>) + scope: punctuation.section.embedded.begin.php + push: + - meta_scope: meta.embedded.block.php + - meta_content_scope: source.php + - include: php-end-tag-pop + - include: scope:source.php + - match: <\?(?i:php|=)? + scope: punctuation.section.embedded.begin.php + push: + - meta_scope: meta.embedded.line.php + - meta_content_scope: source.php + - include: php-end-tag-pop + - include: scope:source.php + + php-end-tag-pop: + - match: (\?>)(\s*\n)? + captures: + 1: punctuation.section.embedded.end.php + 2: meta.html-newline-after-php.php + pop: true diff --git a/assets/syntaxes/Packages/PHP/Regular Expressions (PHP).sublime-syntax b/assets/syntaxes/Packages/PHP/Regular Expressions (PHP).sublime-syntax new file mode 100644 index 000000000..a2d302024 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Regular Expressions (PHP).sublime-syntax @@ -0,0 +1,141 @@ +%YAML 1.2 +--- +# http://php.net/manual/en/reference.pcre.pattern.syntax.php +name: Regular Expressions (PHP) +comment: Matches PHP's regular expression syntax. +scope: source.regexp.php +hidden: true +contexts: + main: + # comment + # ref: http://php.net/manual/en/regexp.reference.comments.php + - match: \(\?\# + scope: punctuation.definition.comment.begin.regexp + push: + - meta_scope: comment.block.regexp + - match: \) + scope: punctuation.definition.comment.end.regexp + pop: true + + # backreference + # ref: http://php.net/manual/en/regexp.reference.back-references.php + - match: \\{1,2}[1-9] + scope: keyword.other.back-reference.regexp + - match: \\{1,2}g([1-9]|\{-?[0-9]+\}) + scope: keyword.other.back-reference.regexp + + # named group backreference + # ref: http://php.net/manual/en/regexp.reference.back-references.php + - match: \\{1,2}(?:[gk]\{([^\}]+)\}|k(?:<([^>]+)>|'([^']+)')) + scope: keyword.other.back-reference.named.regexp + captures: + 1: entity.name.other.group.regexp + 2: entity.name.other.group.regexp + 3: entity.name.other.group.regexp + - match: (\()(\?P=)([a-zA-Z_][a-zA-Z_0-9]*\w*)(\)) + captures: + 1: punctuation.definition.group.begin.regexp + 2: keyword.other.back-reference.named.regexp + 3: entity.name.other.group.regexp + 4: punctuation.definition.group.begin.regexp + + # anchor + # ref: http://php.net/manual/en/regexp.reference.anchors.php + - match: \\{1,2}[bBAZzG]|\^|\$ + scope: keyword.control.anchor.regexp + + # repetition + # ref: http://php.net/manual/en/regexp.reference.repetition.php + - match: '[?+*][?+]?|\{([0-9]+(,([0-9]+)?)?|,[0-9]+)\}\??' + scope: keyword.operator.quantifier.regexp + + # alternation + # ref: http://php.net/manual/en/regexp.reference.alternation.php + - match: \| + scope: keyword.operator.or.regexp + + # recursive pattern + # ref: http://php.net/manual/en/regexp.reference.recursive.php + - match: \(\?R\) + scope: keyword.other.recursive-pattern.regexp + + # option setting + # ref: http://php.net/manual/en/regexp.reference.internal-options.php + - match: \(\?[imsxJUX]+\) + scope: keyword.other.option-toggle.regexp + + # group assertion + - match: (\()((\?=)|(\?!)|(\?<=)|(\?)|(\?:)|(\?\|)|(\?[imsxJUX]+:)) + captures: + 1: punctuation.definition.group.begin.regexp + 2: constant.other.assertion.regexp + 3: meta.assertion.look-ahead.regexp + 4: meta.assertion.negative-look-ahead.regexp + 5: meta.assertion.look-behind.regexp + 6: meta.assertion.negative-look-behind.regexp + 7: meta.assertion.atomic-group.regexp + 8: meta.assertion.no-capture-group.regexp + 9: meta.assertion.branch-reset-group.regexp + 10: keyword.other.option-toggle.regexp + push: + - meta_scope: meta.group.assertion.regexp + - match: \) + scope: punctuation.definition.group.end.regexp + pop: true + - include: main + + # named group + # ref: http://php.net/manual/en/regexp.reference.subpatterns.php + - match: (\()(\?)(?:(P)?(<)([^>]+)(>)|(')([^']+)(')) + captures: + 1: punctuation.definition.group.begin.regexp + 2: constant.other.assertion.regexp + 3: constant.other.assertion.regexp + 4: punctuation.definition.group.capture.begin.regexp + 5: entity.name.other.group.regexp + 6: punctuation.definition.group.capture.end.regexp + 7: punctuation.definition.group.capture.begin.regexp + 8: entity.name.other.group.regexp + 9: punctuation.definition.group.capture.end.regexp + push: + - meta_scope: meta.group.regexp + - match: \) + scope: punctuation.definition.group.end.regexp + pop: true + - include: main + + # capture group + - match: (\() + scope: punctuation.definition.group.begin.regexp + push: + - meta_scope: meta.group.regexp + - match: \) + scope: punctuation.definition.group.end.regexp + pop: true + - include: main + + - include: character-class + + character-class: + # 3~4 backslashes = matches actualy 1 backslash + # 1~2 backslashes = esacpe the next character + # ref: http://php.net/manual/en/regexp.reference.escape.php + - match: \\{1,2}(\\{2}|[^wWsSdDhH\\]) + scope: constant.character.escape.backslash.regexp + - match: \\{1,2}[wWsSdDhH]|\. + scope: constant.character.character-class.regexp + - match: (\[)(\^)? + captures: + 1: punctuation.definition.character-class.begin.regexp + 2: keyword.operator.negation.regexp + push: + - meta_scope: constant.other.character-class.set.regexp + - match: \] + scope: punctuation.definition.character-class.end.regexp + pop: true + - include: character-class + - match: ((\\{1,2}.)|.)\-((\\{1,2}.)|[^\]]) + scope: constant.other.character-class.range.regexp + captures: + 2: constant.character.escape.backslash.regexp + 4: constant.character.escape.backslash.regexp diff --git a/assets/syntaxes/Packages/PHP/Snippets/$GLOBALS[''].sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/$GLOBALS[''].sublime-snippet new file mode 100644 index 000000000..0b3b3e78a --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/$GLOBALS[''].sublime-snippet @@ -0,0 +1,6 @@ + + + globals + source.php - string.quoted.single - comment + $GLOBALS['…'] + diff --git a/assets/syntaxes/Packages/PHP/Snippets/$_COOKIE[''].sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/$_COOKIE[''].sublime-snippet new file mode 100644 index 000000000..b7aeb22c2 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/$_COOKIE[''].sublime-snippet @@ -0,0 +1,6 @@ + + + $_ + source.php - string.quoted.single - comment + COOKIE['…'] + diff --git a/assets/syntaxes/Packages/PHP/Snippets/$_ENV[''].sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/$_ENV[''].sublime-snippet new file mode 100644 index 000000000..a88fab80a --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/$_ENV[''].sublime-snippet @@ -0,0 +1,6 @@ + + + $_ + source.php - string.quoted.single - comment + ENV['…'] + diff --git a/assets/syntaxes/Packages/PHP/Snippets/$_FILES[''].sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/$_FILES[''].sublime-snippet new file mode 100644 index 000000000..be30dbcff --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/$_FILES[''].sublime-snippet @@ -0,0 +1,6 @@ + + + $_ + source.php - string.quoted.single - comment + FILES['…'] + diff --git a/assets/syntaxes/Packages/PHP/Snippets/$_GET[''].sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/$_GET[''].sublime-snippet new file mode 100644 index 000000000..3312757fb --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/$_GET[''].sublime-snippet @@ -0,0 +1,6 @@ + + + $_ + source.php - string.quoted.single - comment + GET['…'] + diff --git a/assets/syntaxes/Packages/PHP/Snippets/$_POST[''].sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/$_POST[''].sublime-snippet new file mode 100644 index 000000000..f143bca41 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/$_POST[''].sublime-snippet @@ -0,0 +1,6 @@ + + + $_ + source.php - string.quoted.single - comment + POST['…'] + diff --git a/assets/syntaxes/Packages/PHP/Snippets/$_REQUEST[''].sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/$_REQUEST[''].sublime-snippet new file mode 100644 index 000000000..25d59ea9c --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/$_REQUEST[''].sublime-snippet @@ -0,0 +1,6 @@ + + + $_ + source.php - string.quoted.single - comment + REQUEST['…'] + diff --git a/assets/syntaxes/Packages/PHP/Snippets/$_SERVER[''].sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/$_SERVER[''].sublime-snippet new file mode 100644 index 000000000..b7ce38f48 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/$_SERVER[''].sublime-snippet @@ -0,0 +1,6 @@ + + + $_ + source.php - string.quoted.single - comment + SERVER['…'] + diff --git a/assets/syntaxes/Packages/PHP/Snippets/$_SESSION[''].sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/$_SESSION[''].sublime-snippet new file mode 100644 index 000000000..e5ed6b23a --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/$_SESSION[''].sublime-snippet @@ -0,0 +1,6 @@ + + + $_ + source.php - string.quoted.single - comment + SESSION['…'] + diff --git a/assets/syntaxes/Packages/PHP/Snippets/Constructor.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/Constructor.sublime-snippet new file mode 100644 index 000000000..8fd2fd7b8 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/Constructor.sublime-snippet @@ -0,0 +1,9 @@ + + $0 = \$$0;/}$0 +}]]> + con + source.php - string - comment + function __construct + diff --git a/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-class-var.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-class-var.sublime-snippet new file mode 100644 index 000000000..0b0ecce48 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-class-var.sublime-snippet @@ -0,0 +1,11 @@ + + + doc_v + source.php - string - comment + Class Variable + diff --git a/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-class.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-class.sublime-snippet new file mode 100644 index 000000000..4500293c4 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-class.sublime-snippet @@ -0,0 +1,14 @@ + + + doc_c + source.php - string - comment + Class + diff --git a/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-constant-definition.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-constant-definition.sublime-snippet new file mode 100644 index 000000000..fe66b4174 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-constant-definition.sublime-snippet @@ -0,0 +1,9 @@ + + + doc_d + source.php - string - comment + Constant Definition + diff --git a/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-function-signature.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-function-signature.sublime-snippet new file mode 100644 index 000000000..8adcdbcd3 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-function-signature.sublime-snippet @@ -0,0 +1,12 @@ + + + doc_s + source.php - string - comment + Function Signature + diff --git a/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-function.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-function.sublime-snippet new file mode 100644 index 000000000..2d4400dba --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-function.sublime-snippet @@ -0,0 +1,14 @@ + + + doc_f + source.php - string - comment + Function + diff --git a/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-interface.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-interface.sublime-snippet new file mode 100644 index 000000000..19e497fc3 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/PHPDoc-interface.sublime-snippet @@ -0,0 +1,14 @@ + + + doc_i + source.php - string - comment + Interface + diff --git a/assets/syntaxes/Packages/PHP/Snippets/Start-Docblock.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/Start-Docblock.sublime-snippet new file mode 100644 index 000000000..ded4d953b --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/Start-Docblock.sublime-snippet @@ -0,0 +1,8 @@ + + + /** + source.php comment + Start Docblock + diff --git a/assets/syntaxes/Packages/PHP/Snippets/class-{-}.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/class-{-}.sublime-snippet new file mode 100644 index 000000000..356fad81a --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/class-{-}.sublime-snippet @@ -0,0 +1,17 @@ + + + class + source.php - string - comment + class … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/define(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/define(-).sublime-snippet new file mode 100644 index 000000000..9ec4ae228 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/define(-).sublime-snippet @@ -0,0 +1,7 @@ + + + def + source.php - string - comment + define(…, …) + diff --git a/assets/syntaxes/Packages/PHP/Snippets/defined(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/defined(-).sublime-snippet new file mode 100644 index 000000000..b41196145 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/defined(-).sublime-snippet @@ -0,0 +1,6 @@ + + + def? + source.php - string - comment + defined(…) + diff --git a/assets/syntaxes/Packages/PHP/Snippets/do-while(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/do-while(-).sublime-snippet new file mode 100644 index 000000000..f7f5d0951 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/do-while(-).sublime-snippet @@ -0,0 +1,8 @@ + + + do + source.php - string - comment + do … while … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/echo-___.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/echo-___.sublime-snippet new file mode 100644 index 000000000..f973a66d1 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/echo-___.sublime-snippet @@ -0,0 +1,6 @@ + + + echo + source.php - string - comment + echo "…" + diff --git a/assets/syntaxes/Packages/PHP/Snippets/elseif(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/elseif(-).sublime-snippet new file mode 100644 index 000000000..74811b494 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/elseif(-).sublime-snippet @@ -0,0 +1,8 @@ + + + elseif + source.php - string - comment + elseif … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/for(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/for(-).sublime-snippet new file mode 100644 index 000000000..addbfe79a --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/for(-).sublime-snippet @@ -0,0 +1,8 @@ + + + for + source.php - string - comment + for … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/foreach(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/foreach(-).sublime-snippet new file mode 100644 index 000000000..6e401b41d --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/foreach(-).sublime-snippet @@ -0,0 +1,8 @@ + + \$${4:value}}) { + ${0:# code...} +}]]> + foreach + source.php - string - comment + foreach … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/function-xx(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/function-xx(-).sublime-snippet new file mode 100644 index 000000000..50751be2b --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/function-xx(-).sublime-snippet @@ -0,0 +1,9 @@ + + + fun + source.php - string - comment + function … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/if(-)-else(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/if(-)-else(-).sublime-snippet new file mode 100644 index 000000000..6b998775e --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/if(-)-else(-).sublime-snippet @@ -0,0 +1,11 @@ + + + ifelse + source.php - string - comment + if … else … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/if(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/if(-).sublime-snippet new file mode 100644 index 000000000..bc17407aa --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/if(-).sublime-snippet @@ -0,0 +1,8 @@ + + + if + source.php - string - comment + if … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/if-a-b;.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/if-a-b;.sublime-snippet new file mode 100644 index 000000000..99e613b56 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/if-a-b;.sublime-snippet @@ -0,0 +1,6 @@ + + + if? + source.php - string - comment + $… = ( … ) ? … : … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/include(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/include(-).sublime-snippet new file mode 100644 index 000000000..c8890edc6 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/include(-).sublime-snippet @@ -0,0 +1,6 @@ + + + incl + source.php - string - comment + include … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/include_once(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/include_once(-).sublime-snippet new file mode 100644 index 000000000..bab4a3ada --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/include_once(-).sublime-snippet @@ -0,0 +1,6 @@ + + + incl1 + source.php - string - comment + include_once … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/new-array(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/new-array(-).sublime-snippet new file mode 100644 index 000000000..2882a7fea --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/new-array(-).sublime-snippet @@ -0,0 +1,6 @@ + + $3${4:,} $0);]]> + array + source.php - variable.other.php + $… = array (…) + diff --git a/assets/syntaxes/Packages/PHP/Snippets/php-$this.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/php-$this.sublime-snippet new file mode 100644 index 000000000..2f47371fd --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/php-$this.sublime-snippet @@ -0,0 +1,6 @@ + + $0 ?>]]> + this + embedding.php text.html - source.php + <?php $this->… ?> + diff --git a/assets/syntaxes/Packages/PHP/Snippets/php-echo-$this.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/php-echo-$this.sublime-snippet new file mode 100644 index 000000000..364ff7a5c --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/php-echo-$this.sublime-snippet @@ -0,0 +1,6 @@ + + $0 ?>]]> + ethis + embedding.php text.html - source.php + <?php echo $this->… ?> + diff --git a/assets/syntaxes/Packages/PHP/Snippets/php-echo-___.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/php-echo-___.sublime-snippet new file mode 100644 index 000000000..982f423a6 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/php-echo-___.sublime-snippet @@ -0,0 +1,6 @@ + + $0]]> + echo + embedding.php text.html - source.php + <?php echo … ?> + diff --git a/assets/syntaxes/Packages/PHP/Snippets/php-echo-htmlentities(___).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/php-echo-htmlentities(___).sublime-snippet new file mode 100644 index 000000000..5c6242b0d --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/php-echo-htmlentities(___).sublime-snippet @@ -0,0 +1,6 @@ + + $0]]> + echoh + embedding.php text.html - source.php + <?php echo htmlentities(…) ?> + diff --git a/assets/syntaxes/Packages/PHP/Snippets/php-else.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/php-else.sublime-snippet new file mode 100644 index 000000000..a97807060 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/php-else.sublime-snippet @@ -0,0 +1,6 @@ + + ]]> + else + embedding.php text.html - source.php + <?php else: ?> + diff --git a/assets/syntaxes/Packages/PHP/Snippets/php-foreach-(___)-___-php-endforeach.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/php-foreach-(___)-___-php-endforeach.sublime-snippet new file mode 100644 index 000000000..4eec56036 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/php-foreach-(___)-___-php-endforeach.sublime-snippet @@ -0,0 +1,8 @@ + + \$${4:value}}): ?> + ${0} +]]> + foreach + embedding.php text.html - source.php + <?php foreach (…) … <?php endforeach ?> + diff --git a/assets/syntaxes/Packages/PHP/Snippets/php-if-(___)-___-php-else-___-php-endif.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/php-if-(___)-___-php-else-___-php-endif.sublime-snippet new file mode 100644 index 000000000..0591ae856 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/php-if-(___)-___-php-else-___-php-endif.sublime-snippet @@ -0,0 +1,10 @@ + + + $2 + + $0 +]]> + ifelse + embedding.php text.html - source.php + <?php if (…) ?> … <?php else ?> … <?php endif ?> + diff --git a/assets/syntaxes/Packages/PHP/Snippets/php-if-(___)-___-php-endif.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/php-if-(___)-___-php-endif.sublime-snippet new file mode 100644 index 000000000..159356b3f --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/php-if-(___)-___-php-endif.sublime-snippet @@ -0,0 +1,8 @@ + + + $0 +]]> + if + embedding.php text.html - source.php + <?php if (…) ?> … <?php endif ?> + diff --git a/assets/syntaxes/Packages/PHP/Snippets/php.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/php.sublime-snippet new file mode 100644 index 000000000..b6d0491b2 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/php.sublime-snippet @@ -0,0 +1,6 @@ + + ]]> + php + embedding.php text.html - source.php + <?php … ?> + diff --git a/assets/syntaxes/Packages/PHP/Snippets/require(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/require(-).sublime-snippet new file mode 100644 index 000000000..19a1b07bb --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/require(-).sublime-snippet @@ -0,0 +1,6 @@ + + + req + source.php - string - comment + require … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/require_once(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/require_once(-).sublime-snippet new file mode 100644 index 000000000..974e5c5a7 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/require_once(-).sublime-snippet @@ -0,0 +1,6 @@ + + + req1 + source.php - string - comment + require_once … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/return-$retVal;.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/return-$retVal;.sublime-snippet new file mode 100644 index 000000000..60fe3a739 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/return-$retVal;.sublime-snippet @@ -0,0 +1,6 @@ + + + ret + source.php - string - comment + return + diff --git a/assets/syntaxes/Packages/PHP/Snippets/return-FALSE;.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/return-FALSE;.sublime-snippet new file mode 100644 index 000000000..49a064514 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/return-FALSE;.sublime-snippet @@ -0,0 +1,6 @@ + + + ret0 + source.php - string - comment + return false + diff --git a/assets/syntaxes/Packages/PHP/Snippets/return-TRUE;.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/return-TRUE;.sublime-snippet new file mode 100644 index 000000000..0427d8040 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/return-TRUE;.sublime-snippet @@ -0,0 +1,6 @@ + + + ret1 + source.php - string - comment + return true + diff --git a/assets/syntaxes/Packages/PHP/Snippets/switch(-)-case.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/switch(-)-case.sublime-snippet new file mode 100644 index 000000000..1fef62012 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/switch(-)-case.sublime-snippet @@ -0,0 +1,8 @@ + + + case + source.php - string - comment + case … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/switch(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/switch(-).sublime-snippet new file mode 100644 index 000000000..eff236d42 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/switch(-).sublime-snippet @@ -0,0 +1,14 @@ + + + switch + source.php - string - comment + switch … + diff --git a/assets/syntaxes/Packages/PHP/Snippets/throw.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/throw.sublime-snippet new file mode 100644 index 000000000..13c28d006 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/throw.sublime-snippet @@ -0,0 +1,7 @@ + + + throw + source.php - string - comment + Throw Exception + diff --git a/assets/syntaxes/Packages/PHP/Snippets/try-{-___-}-catch-(___)-{-___-}.sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/try-{-___-}-catch-(___)-{-___-}.sublime-snippet new file mode 100644 index 000000000..bdac4e37e --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/try-{-___-}-catch-(___)-{-___-}.sublime-snippet @@ -0,0 +1,10 @@ + + + try + source.php - string - comment + Wrap in try { … } catch (…) { … } + diff --git a/assets/syntaxes/Packages/PHP/Snippets/while(-).sublime-snippet b/assets/syntaxes/Packages/PHP/Snippets/while(-).sublime-snippet new file mode 100644 index 000000000..c0c3ec66c --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Snippets/while(-).sublime-snippet @@ -0,0 +1,8 @@ + + + while + source.php - string - comment + while … + diff --git a/assets/syntaxes/Packages/PHP/Symbol List.tmPreferences b/assets/syntaxes/Packages/PHP/Symbol List.tmPreferences new file mode 100644 index 000000000..cc4f60815 --- /dev/null +++ b/assets/syntaxes/Packages/PHP/Symbol List.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbols List: Indent Functions + scope + entity.name.function.php, support.function.magic.php, entity.name.class.php, entity.name.interface.php, entity.name.trait.php + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/assets/syntaxes/Packages/PHP/syntax_test_php.php b/assets/syntaxes/Packages/PHP/syntax_test_php.php new file mode 100644 index 000000000..84ea543bf --- /dev/null +++ b/assets/syntaxes/Packages/PHP/syntax_test_php.php @@ -0,0 +1,1682 @@ +// SYNTAX TEST "Packages/PHP/PHP.sublime-syntax" + $arr[$x], $keys, fn($x) => $arr[$x]); +// ^^ meta.function.arrow-function storage.type.function +// ^ punctuation.section.group.begin +// ^^ variable.parameter +// ^ punctuation.section.group.end +// ^^ punctuation.definition.arrow-function.php +} + +$fn = fn($x) => fn($y) => $x * $y + $z; +// ^^ meta.function.arrow-function storage.type.function +// ^ punctuation.section.group.begin +// ^^ variable.parameter +// ^ punctuation.section.group.end +// ^^ punctuation.definition.arrow-function.php +// ^^ meta.function.arrow-function storage.type.function +// ^ punctuation.section.group.begin +// ^^ variable.parameter +// ^ punctuation.section.group.end +// ^^ punctuation.definition.arrow-function.php + +$var = function(array $ar=array(), ClassName $cls) use ($var1, $var2) { +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +// ^^^^^^^^ meta.function.closure +// ^^ meta.function.parameters meta.group +// ^ punctuation.section.group.begin +// ^^^^^ storage.type +// ^^^ variable.parameter +// ^ keyword.operator.assignment +// ^^^^^^^ meta.array.empty +// ^ punctuation.separator +// ^^^^^^^^^ meta.path +// ^^^^^^^^^ support.class +// ^^^^ variable.parameter +// ^ punctuation.section.group.end +// ^^^^^^^^^^^^^^^^^^ meta.function.closure.use +// ^ meta.block punctuation.section.block.begin + +}; +// <- meta.function meta.block punctuation.section.block.end + +function foo(?stinrg ...$args) {} +// ^ storage.type.nullable +// ^^^^^^ support.class +// ^^^ keyword.operator.spread +// ^^^^^ variable.parameter + +$arr4 = ['a', ...$arr1, 'b', ...$arr2, 'c']; +// ^^^ keyword.operator.spread +// ^^^^^ variable.other +// ^^^ keyword.operator.spread + +$array = [ ]; +// ^ meta.array.empty.php punctuation.section.array.begin.php +// ^ meta.array.empty.php punctuation.section.array.end.php + []; +// ^ meta.array.empty.php punctuation.section.array.begin.php +// ^ meta.array.empty.php punctuation.section.array.end.php + +$array = [ +// ^ meta.array.php punctuation.section.array.begin.php + 'abc' => $arr['key']['key2'] +// ^ meta.item-access punctuation.section.brackets.begin.php +// ^^^^^ meta.item-access.arguments +// ^ meta.item-access punctuation.section.brackets.end.php +// ^ meta.item-access.php punctuation.section.brackets.begin.php +// ^^^^^^ meta.item-access.arguments +// ^ meta.item-access punctuation.section.brackets.end.php +]; + +$array[ ]; +// ^^^^ meta.item-access +// ^ punctuation.section.brackets.begin.php +// ^ punctuation.section.brackets.end.php + +$var->meth()[10]; +// ^^^^ meta.item-access +// ^ punctuation.section.brackets.begin.php +// ^ punctuation.section.brackets.end.php + +/** + No longer a phpdoc comment since no leading * + * @return +// ^ comment.block - keyword.other.phpdoc + */ +// ^ source - comment.block + +/** + * +// ^ text.html.basic meta.embedded.block.php source.php comment.block.documentation.phpdoc.php punctuation.definition.comment.php +*/ + +/** @var Properties: class properties. */ +// ^ keyword.other.phpdoc + +/* No phpdoc highlight since there are not two * after the opening / + * @return +// ^ comment.block - keyword.other.phpdoc + */ + +/** + * @api Methods: declares that elements are suitable for consumption by third parties. +// ^ keyword.other.phpdoc + */ + +/** + * @author Any: documents the author of the associated element. +// ^ keyword.other.phpdoc + */ + +/** + * @category File, Class: groups a series of packages together. +// ^ keyword.other.phpdoc + */ + +/** + * @copyright Any: documents the copyright information for the associated element. +// ^ keyword.other.phpdoc + */ + +/** + * @deprecated Any: indicates that the associated element is deprecated and can be removed in a future version. +// ^ keyword.other.phpdoc + */ + +/** + * @example Any: shows the code of a specified example file or, optionally, just a portion of it. +// ^ keyword.other.phpdoc + */ + +/** + * @filesource File: includes the source of the current file for use in the output. +// ^ keyword.other.phpdoc + */ + +/** + * @global Variable: informs phpDocumentor of a global variable or its usage. +// ^ keyword.other.phpdoc + */ + +/** + * @ignore Any: tells phpDocumentor that the associated element is not to be included in the documentation. +// ^ keyword.other.phpdoc + */ + +/** + * @internal Any: denotes that the associated elements is internal to this application or library and hides it by default. +// ^ keyword.other.phpdoc + */ + +/** + * @license File, Class: indicates which license is applicable for the associated element. +// ^ keyword.other.phpdoc + */ + +/** + * @link Any: indicates a relation between the associated element and a page of a website. +// ^ keyword.other.phpdoc + */ + +/** + * @method Class: allows a class to know which ‘magic’ methods are callable. +// ^ keyword.other.phpdoc + */ + +/** + * @package File, Class: categorizes the associated element into a logical grouping or subdivision. +// ^ keyword.other.phpdoc + */ + +/** + * @param Method, Function: documents a single argument of a function or method. +// ^ keyword.other.phpdoc + */ + +/** + * @property Class: allows a class to know which ‘magic’ properties are present. +// ^ keyword.other.phpdoc + */ + +/** + * @property-read Class: allows a class to know which ‘magic’ properties are present that are read-only. +// ^^^^^^^^^^^^^ keyword.other.phpdoc + */ + +/** + * @property-write Class: allows a class to know which ‘magic’ properties are present that are write-only. +// ^^^^^^^^^^^^^^ keyword.other.phpdoc + */ + +/** + * @return Method, Function: documents the return value of functions or methods. +// ^ keyword.other.phpdoc + */ + +/** + * @see Any: indicates a reference from the associated element to a website or other elements. +// ^ keyword.other.phpdoc + */ + +/** + * @since Any: indicates at which version the associated element became available. +// ^ keyword.other.phpdoc + */ + +/** + * @source Any, except File: shows the source code of the associated element. +// ^ keyword.other.phpdoc + */ + +/** + * @subpackage File, Class: categorizes the associated element into a logical grouping or subdivision. +// ^ keyword.other.phpdoc + */ + +/** + * @throws Method, Function: indicates whether the associated element could throw a specific type of exception. +// ^ keyword.other.phpdoc + */ + +/** + * @todo Any: indicates whether any development activity should still be executed on the associated element. +// ^ keyword.other.phpdoc + */ + +/** + * @uses Any: indicates a reference to (and from) a single associated element. +// ^ keyword.other.phpdoc + */ + +/** + * @var Properties: class properties. +// ^ keyword.other.phpdoc + */ + +/** + * @version Any: indicates the current version of Structural Elements. +// ^ keyword.other.phpdoc + */ + +/** + * @after +// ^ keyword.other.phpunit + */ + +/** + * @afterClass +// ^ keyword.other.phpunit + */ + +/** + * @backupGlobals +// ^ keyword.other.phpunit + */ + +/** + * @backupStaticAttributes +// ^ keyword.other.phpunit + */ + +/** + * @before +// ^ keyword.other.phpunit + */ + +/** + * @beforeClass +// ^ keyword.other.phpunit + */ + +/** + * @codeCoverageIgnore* +// ^ keyword.other.phpunit + */ + +/** + * @covers +// ^ keyword.other.phpunit + */ + +/** + * @coversDefaultClass +// ^ keyword.other.phpunit + */ + +/** + * @coversNothing +// ^ keyword.other.phpunit + */ + +/** + * @dataProvider +// ^ keyword.other.phpunit + */ + +/** + * @depends +// ^ keyword.other.phpunit + */ + +/** + * @doesNotPerformAssertions +// ^ keyword.other.phpunit + */ + +/** + * @expectedException +// ^ keyword.other.phpunit + */ + +/** + * @expectedExceptionCode +// ^ keyword.other.phpunit + */ + +/** + * @expectedExceptionMessage +// ^ keyword.other.phpunit + */ + +/** + * @expectedExceptionMessageRegExp +// ^ keyword.other.phpunit + */ + +/** + * @group +// ^ keyword.other.phpunit + */ + +/** + * @large +// ^ keyword.other.phpunit + */ + +/** + * @medium +// ^ keyword.other.phpunit + */ + +/** + * @preserveGlobalState +// ^ keyword.other.phpunit + */ + +/** + * @requires +// ^ keyword.other.phpunit + */ + +/** + * @runTestsInSeparateProcesses +// ^ keyword.other.phpunit + */ + +/** + * @runInSeparateProcess +// ^ keyword.other.phpunit + */ + +/** + * @small +// ^ keyword.other.phpunit + */ + +/** + * @test +// ^ keyword.other.phpunit + */ + +/** + * @testdox +// ^ keyword.other.phpunit + */ + +/** + * @testWith +// ^ keyword.other.phpunit + */ + +/** + * @ticket +// ^ keyword.other.phpunit + */ + +/** + * PHP comment from issue #1378 + * + * @see + * @author + * @package + * @version + NOTE: Modified */ +//^^^^^^^^^^^^^^^^ comment.block - comment.block.documentation +// ^^ punctuation.definition.comment.end +// ^ - comment + + class Test1 extends stdClass implements Countable {} +// ^ storage.type.class.php +// ^ entity.name.class.php +// ^ storage.modifier.extends.php +// ^^^^^^^^ meta.path +// ^ entity.other.inherited-class.php +// ^ storage.modifier.implements.php +// ^^^^^^^^^ meta.path +// ^ entity.other.inherited-class.php + +class ClassName extends /* */ \MyNamespace\Foo implements \MyNamespace\Baz { +// ^ entity.name.class +// ^ storage.modifier +// ^ comment.block +// ^^^^^^^^^^^^^^^^ meta.path +// ^^^^^^^^^^^^^^^^ entity.other.inherited-class +// ^ punctuation.separator.namespace +// ^ punctuation.separator.namespace +// ^ storage.modifier +// ^^^^^^^^^^^^^^^^ meta.path +// ^^^^^^^^^^^^^^^^ entity.other.inherited-class +// ^ punctuation.separator.namespace +// ^ punctuation.separator.namespace +} + +interface MyInter {} +// <- storage.type +// ^ entity.name.interface + +interface MyInter2 extends \MyNamespace\Foo { +// <- storage.type +// ^ entity.name.interface +// ^ storage.modifier +// ^^^^^^^^^^^^^^^^ meta.path +// ^^^^^^^^^^^^^^^^ entity.other.inherited-class +// ^ punctuation.separator.namespace +// ^ punctuation.separator.namespace +} + +if ($foo instanceof \Mynamespace\ClassName) { +// ^ variable.other +// ^ keyword.operator +// ^^^^^^^^^^^^^^^^^^^^^^ meta.path +// ^ punctuation.separator.namespace +// ^ support.other.namespace +// ^ punctuation.separator.namespace +// ^^^^^^^^^ support.class +} + +$var = new \MyNamespce\ClassName(); +// <- variable.other +// ^ keyword.other +// ^^^^^^^^^^^^^^^^^^^^^ meta.path +// ^ punctuation.separator.namespace +// ^ support.other.namespace +// ^ punctuation.separator.namespace +// ^ support.class + +\MyNamespace\Foo::BAR; +// <- punctuation.separator.namespace + // <- support.other.namespace +//^^^^^^^^^^^^^^ meta.path +// ^ punctuation.separator.namespace +// ^ support.class +// ^^ punctuation.accessor +// ^^^ constant.other + +\MyNamespace\Foo::bar(); +// <- punctuation.separator.namespace + // <- support.other.namespace +//^^^^^^^^^^^^^^ meta.path +// ^ punctuation.separator.namespace +// ^^^ support.class +// ^^ punctuation.accessor +// ^^^^^ meta.function-call +// ^^^ variable.function +// ^^ meta.group +// ^ punctuation.section.group.begin +// ^ punctuation.section.group.end + +\MyNamespace\Foo(); +//^^^^^^^^^^^^^^^^ meta.function-call +// <- punctuation.separator.namespace + // <- support.other.namespace +//^^^^^^^^^^^^^^ meta.path +// ^ punctuation.separator.namespace +// ^^^ variable.function +// ^^ meta.group +// ^ punctuation.section.group.begin +// ^ punctuation.section.group.end + +\MyNamespace\Foo; +// <- punctuation.separator.namespace + // <- support.other.namespace +//^^^^^^^^^^^^^^ meta.path +// ^ punctuation.separator.namespace +// ^ constant.other + +func_call(true, 1, "string"); +//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call +// ^ - meta.function-call +//^^^^^^^ variable.function +// ^^^^^^^^^^^^^^^^^^^ meta.group +// ^ - meta.group +// ^ punctuation.section.group.begin +// ^ punctuation.section.group.end +// ^^^^ constant.language +// ^ punctuation.separator.php +// ^ constant.numeric.integer.decimal +// ^ punctuation.separator.php +// ^^^^^^^^ string.quoted.double + +$object->method(func_call()); +// ^^^^^^^^^^^^^^^^^^^^^ meta.function-call +// ^^^^^^ variable.function +// ^^^^^^^^^^^^^ meta.group +// ^^^^^^^^^^^ meta.function-call meta.function-call +// ^^^^^^^^^ variable.function +// ^^ meta.group meta.group + +$object->property::method(); +// ^^ punctuation.accessor.arrow +// ^^ punctuation.accessor.double-colon +// ^^^^^^ meta.function-call.static variable.function +// ^^ meta.group + +strval($foo); +//^^^^^^^^^^ meta.function-call +//^^^^ support.function.var - variable.function +// ^^^^^^ meta.group + +$test = new Test1; +// ^ keyword.other.new.php +// ^^^^^ meta.path +// ^ support.class.php + +$anon = new class{}; +// ^ keyword.other.new.php +// ^ storage.type.class.php +// ^^ meta.class.php +// ^^ meta.block.php +// ^ punctuation.section.block.php - meta.class meta.class +// ^ punctuation.section.block.php + +$anon = new class($param1, $param2) extends Test1 implements Countable {}; +// ^ keyword.other.new.php +// ^ storage.type.class.php +// ^^^^^^^^^^^^^^^^^^ meta.function-call.php +// ^ punctuation.section.group.begin.php +// ^ variable.other.php +// ^ punctuation.separator.php +// ^ variable.other.php +// ^ punctuation.section.group.end.php +// ^ storage.modifier.extends.php +// ^^^^^ meta.path +// ^ entity.other.inherited-class.php +// ^ storage.modifier.implements.php +// ^^^^^^^^^ meta.path +// ^ entity.other.inherited-class.php +// ^^ meta.class.php +// ^^ meta.block.php + + function noReturnType(array $param1, int $param2) {} +// ^ storage.type.function.php +// ^ entity.name.function.php +// ^ punctuation.section.group.begin.php +// ^ meta.function.parameters +// ^ punctuation.definition.variable.php +// ^ meta.function.parameters +// ^ punctuation.definition.variable.php +// ^ punctuation.section.group.end.php +// ^^ meta.block.php +// ^ punctuation.section.block.begin.php +// ^ punctuation.section.block.end.php + + function scalarReturnType($param1): bool {} +// ^ storage.type.function.php +// ^ entity.name.function.php +// ^ punctuation.section.group.begin.php +// ^ punctuation.section.group.end.php +// ^ storage.type.php + + function classReturnType($param1): stringSpace\Test1 {} +// ^ storage.type.function.php +// ^ entity.name.function.php +// ^ punctuation.section.group.begin.php +// ^ punctuation.section.group.end.php +// ^^^^^^^^^^^^^^^^^ meta.path +// ^ support.other.namespace.php +// ^ support.class.php + + function nullableReturnType(?int $param1): ?bool {} +// ^ storage.type.function.php +// ^ entity.name.function.php +// ^ punctuation.section.group.begin.php +// ^ storage.type.nullable.php +// ^ meta.function.parameters +// ^ punctuation.section.group.end.php +// ^ storage.type.nullable.php +// ^ storage.type.php + + function nullableObjectReturnType(?int $param1): ?object {} +// ^ storage.type.function.php +// ^ entity.name.function.php +// ^ punctuation.section.group.begin.php +// ^ storage.type.nullable.php +// ^ meta.function.parameters +// ^ punctuation.section.group.end.php +// ^ storage.type.nullable.php +// ^ storage.type.php + +$test = "\0 \12 \345g \x0f \u{a} \u{9999} \u{999}"; +// ^^ constant.character.escape.octal.php +// ^^^ constant.character.escape.octal.php +// ^^^^ constant.character.escape.octal.php +// ^ meta.string-contents.quoted.double.php +// ^^^^ constant.character.escape.hex.php +// ^^^^^ constant.character.escape.unicodepoint.php +// ^^^^^^^^ constant.character.escape.unicodepoint.php +// ^^^^^^^ meta.string-contents.quoted.double.php + +"$a then $b->c or ${d} with {$e} then $f[0] followed by $g[$h] or $i[k] and finally {$l . $m->n . o}" + // <- variable.other punctuation.definition.variable +//^ variable.other +// ^^ variable.other +// ^ punctuation.definition.variable +// ^^ punctuation.accessor +// ^ variable.other.member +// ^^^^ variable.other +// ^^ punctuation.definition.variable +// ^ punctuation.definition.variable +// ^ punctuation.definition.expression +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.definition.expression +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.section.brackets.begin +// ^ constant.numeric.integer.decimal +// ^ punctuation.section.brackets.end +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.section.brackets.begin +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.section.brackets.end +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.section.brackets.begin +// ^ constant.other +// ^ punctuation.section.brackets.end +// ^ punctuation.definition.expression +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ keyword.operator +// ^^ variable.other +// ^ punctuation.definition.variable +// ^^ punctuation.accessor +// ^ variable.other.member +// ^ keyword.operator +// ^ constant.other + +`$a then $b->c or ${d} with {$e} then $f[0] followed by $g[$h] or $i[k] and finally {$l . $m->n . o}` + // <- variable.other punctuation.definition.variable +//^ variable.other +// ^^ variable.other +// ^ punctuation.definition.variable +// ^^ punctuation.accessor +// ^ variable.other.member +// ^^^^ variable.other +// ^^ punctuation.definition.variable +// ^ punctuation.definition.variable +// ^ punctuation.definition.expression +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.definition.expression +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.section.brackets.begin +// ^ constant.numeric +// ^ punctuation.section.brackets.end +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.section.brackets.begin +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.section.brackets.end +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ punctuation.section.brackets.begin +// ^ constant.other +// ^ punctuation.section.brackets.end +// ^ punctuation.definition.expression +// ^^ variable.other +// ^ punctuation.definition.variable +// ^ keyword.operator +// ^^ variable.other +// ^ punctuation.definition.variable +// ^^ punctuation.accessor +// ^ variable.other.member +// ^ keyword.operator +// ^ constant.other + +trait A +// ^ storage.type.trait +// ^ entity.name.trait +{ + +} + +class B +// ^ entity.name.class +{ + use MyNamespace\Xyz, +// ^^^^^^^^^^^^^^^^^^^^ meta.use +// ^^^^^^^^^^^^^^^ meta.path +// ^^^^^^^^^^^^^^^ entity.other.inherited-class +// ^ punctuation.separator.namespace + Y, +// ^ meta.use meta.path entity.other.inherited-class + Z { +// ^^^ meta.use +// ^ meta.path +// ^ meta.block punctuation.section.block + X::method1 as another1; +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.use meta.block +// ^^ punctuation.accessor +// ^ keyword.other.use-as + Y::method2 insteadof X; +// ^ keyword.other.insteadof + X::method2 as another2; +// ^ keyword.other.use-as + } protected $pro1; +// ^ meta.use meta.block punctuation.section.block +// ^ - meta.use +// ^ storage.modifier + + public static ?Foo $str = ''; +// ^^^^^^ storage.modifier +// ^^^^^^ storage.modifier +// ^ storage.type.nullable +// ^^^ support.class +// ^ punctuation.definition.variable +// ^^^ variable.other +// ^ keyword.operator.assignment + + public const STR_1 = ''; +// ^^^^^^ storage.modifier +// ^^^^^ storage.modifier +// ^^^^^ constant +// ^ keyword.operator.assignment + + const STR_2 = ''; +// ^^^^^ storage.modifier +// ^^^^^ constant +// ^ keyword.operator.assignment + + public function abc(callable $var, int $var2, string $var3) +// ^^^ entity.name.function +// ^ storage.type +// ^ storage.type +// ^ storage.type + { + echo B::class; +// ^ constant.class + + echo $this->pro1::FOO; +// ^^^^^ variable.language +// ^^ punctuation.accessor +// ^^^^ variable.other.member +// ^^ punctuation.accessor +// ^^^ constant.other.class + + echo $this->pro1::bar(); +// ^^^^^ variable.language +// ^^ punctuation.accessor +// ^^^^ variable.other.member +// ^^ punctuation.accessor +// ^^^ variable.function + + parent::abc($var, $var2, $var3); +// ^^^^^^ variable.language +// ^^ punctuation.accessor + + $this->undo(); +// ^^^^^ variable.language +// ^ punctuation.definition.variable + + $var2 = 'test'; +// ^^^^^ variable.other +// ^ punctuation.definition.variable + + foreach (A::B() as $c => $d) {} + // ^^ punctuation.accessor + // ^ variable.function + // ^^ keyword.operator.logical.php + // ^^ keyword.operator.key.php + + return new self(); +// ^^^^ variable.language + } +} + + +try { +// <- keyword.control.exception + echo inverse(5) . "\n"; + throw new \Exception('Error!'); +// ^ keyword.control.exception +// ^^^^^^^^^^ meta.path.php +// ^ punctuation.separator.namespace.php - support.class +// ^^^^^^^^^ support.class + throw new \Custom\Exception('Error!'); +// ^ keyword.control.exception +// ^^^^^^^^^^^^^^^^^ meta.path.php +// ^ punctuation.separator.namespace.php +// ^^^^^^ support.other.namespace.php +// ^ punctuation.separator.namespace.php +// ^^^^^^^^^ support.class +} catch (/* comment */ ExceptionExample $e) { +// ^^^^^^^^^^^^^ comment.block + echo 'Caught exception: ', $e->getMessage(), "\n"; +} catch (Exception $e) { +//^ keyword.control.exception +// ^^^^^^^^^ meta.path.php +// ^^^^^^^^^ support.class.exception.php +// ^^ variable.other.php + echo 'Caught exception: ', $e->getMessage(), "\n"; +} catch (\Exception $e) { +//^ keyword.control.exception +// ^^^^^^^^^^ meta.path.php +// ^ punctuation.separator.namespace.php +// ^^^^^^^^^ support.class.exception.php +// ^^ variable.other.php + echo 'Caught exception: ', $e->getMessage(), "\n"; +} catch (\Custom\Exception $e) { +//^ keyword.control.exception +// ^^^^^^^^^^^^^^^^^ meta.path.php +// ^ punctuation.separator.namespace.php +// ^^^^^^ support.other.namespace.php +// ^ punctuation.separator.namespace.php +// ^^^^^^^^^ support.class.exception.php +// ^^ variable.other.php + echo 'Caught exception: ', $e->getMessage(), "\n"; +} catch (\Custom\Exception1 | \Custom\Exception2 $e) { +//^ keyword.control.exception +// ^^^^^^^^^^^^^^^^^ meta.path.php +// ^ punctuation.separator.namespace.php +// ^^^^^^ support.other.namespace.php +// ^ punctuation.separator.namespace.php +// ^^^^^^^^^^ support.class.exception.php +// ^ punctuation.separator.catch.php +// ^^^^^^^^^^^^^^^^^ meta.path.php +// ^ punctuation.separator.namespace.php +// ^^^^^^ support.other.namespace.php +// ^ punctuation.separator.namespace.php +// ^^^^^^^^^^ support.class.exception.php +// ^^ variable.other.php + echo 'Caught exception: ', $e->getMessage(), "\n"; +} finally { +//^ keyword.control.exception + echo "First finally.\n"; +} + +function generate() +{ + yield 1; +// ^ keyword.control +} + +function generate2() +{ + yield from generate(); +// ^ keyword.control +// ^ keyword.control +} + +$var = 0; +// ^ constant.numeric.integer.decimal + +$var2 = -123.456e10; +// ^^^^^^^^^^ constant.numeric.float.decimal + +$var2 = -12_3.45_6e1_0; +// ^^^^^^^^^^^^^ constant.numeric.float.decimal + +$var2 = -123.e10; +// ^^^^^^^ constant.numeric.float.decimal + +$var2 = -12_3.e1_0; +// ^^^^^^^^^ constant.numeric.float.decimal + +$var2 = -.123e10; +// ^^^^^^^ constant.numeric.float.decimal + +$var2 = -.12_3e1_0; +// ^^^^^^^^^ constant.numeric.float.decimal + +$var2 = -123e10; +// ^^^^^^ constant.numeric.float.decimal + +$var2 = -12_3e1_0; +// ^^^^^^^^ constant.numeric.float.decimal + +$var3 = 0x0f; +// ^^^^ constant.numeric.integer.hexadecimal +// ^^ punctuation.definition.numeric.hexadecimal + +$var3 = 0x0_f; +// ^^^^ constant.numeric.integer.hexadecimal +// ^^ punctuation.definition.numeric.hexadecimal + +$var4 = 0b0111; +// ^^^^^^ constant.numeric.integer.binary +// ^^ punctuation.definition.numeric.binary + +$var4 = 0b0_1_1_1; +// ^^^^^^^^^ constant.numeric.integer.binary +// ^^ punctuation.definition.numeric.binary + +// class name should be case-insensitive +$object = new ArRaYoBjEcT(); +// ^^^^^^^^^^^ support.class.builtin + +// constant name should be case-sensitive +$const = E_aLL; +// ^^^^^ - support.constant.core + +// function name should be case-sensitive +$random = ArRaY_RaNd($array); +// ^^^^^^^^^^ support.function.array + +// test for constants for each group in the syntax definition +$const = E_ALL; +// ^^^^^ support.constant.core +$const = CASE_LOWER; +// ^^^^^^^^^^ support.constant.std +$const = CURLAUTH_BASIC; +// ^^^^^^^^^^^^^^ support.constant.ext +$const = T_ABSTRACT; +// ^^^^^^^^^^ support.constant.parser-token + + foo_bar: +//^^^^^^^ entity.name.label.php - keyword.control.php + +if ((include 'vars.php') == TRUE) { +// ^^^^^^^ keyword.control.import.include.php +// ^^^^^^^^^^^^^^^^^^ meta.include.php +// ^ - meta.include.php +} + +// evaluated as include(('vars.php') == TRUE), i.e. include('') +if (include('vars.php') == TRUE) { +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.include.php +// ^ - meta.include.php +} + +$a += .5; +// ^^ keyword.operator.assignment.augmented.php +// ^^ constant.numeric + +$a .= 1; +// ^^ keyword.operator.assignment.augmented.php + +$a ??= 1; +// ^^^ keyword.operator.assignment.augmented.php + +if ($a && $b || !$c); +// ^^ keyword.operator.logical +// ^^ keyword.operator.logical +// ^ keyword.operator.logical + +if ($a !== $b || $a == $b); +// ^^^ keyword.operator.comparison +// ^^ keyword.operator.comparison + +if (): +else: +// <- keyword.control - entity.name.label +endif; + +switch (1) { +//^ keyword.control + case 1: + //^^^^ keyword.control.php - entity.name.label.php + default: + //^^^^^^^ keyword.control.php - entity.name.label.php +} + +$non_sql = "NO SELECT HIGHLIGHTING!"; +// ^ string.quoted.double punctuation.definition.string.begin - meta.string-contents +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.string-contents +// ^ - source.sql +// ^ string.quoted.double punctuation.definition.string.end - meta.string-contents + +$sql = "CREATE TABLE version"; +// ^^^^^^ keyword.other.create.sql + +$sql = " + CREATE TABLE `version`... +// ^^^^^^ keyword.other.create.sql +"; + +$sql = "SELECT * FROM users WHERE first_name = 'Eric'"; +// ^ string.quoted.double punctuation.definition.string.begin - meta.string-contents +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string-contents source.sql +// ^ keyword.other.DML +// ^^^^^^ string.quoted.single.sql +// ^ string.quoted.double punctuation.definition.string.end - meta.string-contents + +// Ensure we properly exist from SQL when hitting PHP end-of-string +$sql = "SELECT * FROM users WHERE first_name = 'Eric"; +// ^ string.quoted.double punctuation.definition.string.begin - meta.string-contents +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string-contents source.sql +// ^ keyword.other.DML +// ^^^^^ string.quoted.single.sql +// ^ string.quoted.double punctuation.definition.string.end - meta.string-contents + +$sql = " + SELECT * FROM users WHERE first_name = 'Eric' +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string-contents source.sql +// ^ keyword.other.DML +// ^^^^^^ string.quoted.single.sql +"; +// <- string.quoted.double punctuation.definition.string.end - meta.string-contents + +$non_sql = 'NO SELECT HIGHLIGHTING!'; +// ^ string.quoted.single punctuation.definition.string.begin - meta.string-contents +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.string-contents +// ^ - source.sql +// ^ string.quoted.single punctuation.definition.string.end - meta.string-contents + +$sql = 'SELECT * FROM users WHERE first_name = \'Eric\''; +// ^ string.quoted.single punctuation.definition.string.begin - meta.string-contents +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string-contents source.sql +// ^ keyword.other.DML +// ^^ constant.character.escape.php +// ^ string.quoted.single punctuation.definition.string.end - meta.string-contents + +$sql = ' + SELECT * FROM users WHERE first_name = \'Eric\' +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string-contents source.sql +// ^ keyword.other.DML +// ^^ constant.character.escape.php +'; +// <- string.quoted.single punctuation.definition.string.end - meta.string-contents + +preg_replace('/[a-zSOME_CHAR]*+\'\n $justTxt \1 \\1/m'); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single +// ^ punctuation.definition.string.regex-delimiter.begin +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.regexp +// ^ punctuation.definition.character-class.begin.regexp +// ^^^ constant.other.character-class.range.regexp +// ^^^^^^^^^ constant.other.character-class.set.regexp +// ^ punctuation.definition.character-class.end.regexp +// ^^ keyword.operator.quantifier +// ^^^^ constant.character.escape +// ^ keyword.control.anchor.regexp +// ^^ keyword.other.back-reference.regexp +// ^^^ keyword.other.back-reference.regexp +// ^ punctuation.definition.string.regex-delimiter.end +// ^ meta.regex.modifier +// ^ string.quoted.single + +preg_replace("/[a-zSOME_CHAR]*+\'\n $vairble \1 \\1/m"); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +// ^ punctuation.definition.string.regex-delimiter.begin +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.regexp +// ^ punctuation.definition.character-class.begin.regexp +// ^^^ constant.other.character-class.range.regexp +// ^^^^^^^^^ constant.other.character-class.set.regexp +// ^ punctuation.definition.character-class.end.regexp +// ^^ keyword.operator.quantifier +// ^^^^ constant.character.escape +// ^ punctuation.definition.variable +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^ punctuation.definition.string.regex-delimiter.end +// ^ meta.regex.modifier +// ^ string.quoted.double + +preg_replace("/^(?=foo)|(?>a|b|\s*)|(?im:toggle)(?#comment)$/uxS"); +// ^ punctuation.definition.string.regex-delimiter.begin +// ^ keyword.control.anchor.regexp +// ^^ constant.other.assertion.regexp meta.assertion.look-ahead.regexp +// ^ keyword.operator.or.regexp +// ^^ constant.other.assertion.regexp meta.assertion.atomic-group.regexp +// ^ keyword.operator.or.regexp +// ^ keyword.operator.or.regexp +// ^^ constant.character.character-class.regexp +// ^ keyword.operator.quantifier.regexp +// ^^^^ keyword.other.option-toggle.regexp +// ^^^^^^^^^^^ comment.block +// ^ punctuation.definition.comment.begin.regexp +// ^ punctuation.definition.comment.end.regexp +// ^ keyword.control.anchor.regexp +// ^ punctuation.definition.string.regex-delimiter.end +// ^^^ meta.regex.modifier + +preg_replace('/(?Pfoo|bar)\g{name}\k/'); +// ^ punctuation.definition.group.begin.regexp +// ^^ constant.other.assertion.regexp +// ^ punctuation.definition.group.capture.begin.regexp +// ^^^^ entity.name.other.group.regexp +// ^ keyword.operator.or.regexp +// ^ punctuation.definition.group.end.regexp +// ^^^ keyword.other.back-reference.named.regexp +// ^^^^ entity.name.other.group.regexp +// ^ keyword.other.back-reference.named.regexp +// ^^^ keyword.other.back-reference.named.regexp +// ^^^^ entity.name.other.group.regexp + +preg_replace("/a{,6}b{3,}c{3,6}/"); +// ^^^^ keyword.operator.quantifier.regexp +// ^^^^ keyword.operator.quantifier.regexp +// ^^^^^ keyword.operator.quantifier.regexp + +echo <<
+//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.html text.html +// <- punctuation.definition.tag.begin +//^^ entity.name.tag.block +// ^^^^^ entity.other.attribute-name +// ^^^^^^^^^ string.quoted.double +HTML; +// <- punctuation.section.embedded.end keyword.operator.heredoc +// ^ punctuation.terminator.expression +// ^ meta.heredoc-end + +echo <<< JAVASCRIPT +// ^^^^^^^^^^^^^^ punctuation.section.embedded.begin punctuation.definition.string +// ^^^^^^^^^^ keyword.operator.heredoc +var foo = 1; +//^^^^^^^^^^ meta.embedded.js source.js +// <- storage.type +// ^^^ variable.other.readwrite +// ^ constant.numeric +$var +// <- variable.other.php +//^^ variable.other.php + ($var) +// ^^^^ variable.other.php +JAVASCRIPT; +// <- punctuation.section.embedded.end keyword.operator.heredoc + +echo << +// ^^ meta.embedded.block punctuation.section.embedded.end - source.php +// ^ meta.embedded.block meta.html-newline-after-php - punctuation.section.embedded - source.php + +// ^^^^^^ meta.tag - source.php + +// ^^ meta.embedded.block punctuation.section.embedded.end - source.php +// ^ meta.embedded.block meta.html-newline-after-php - punctuation.section.embedded - source.php + + +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - source.php +// ^^^^^ meta.attribute-with-value +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.line.nested.php +// ^^^^^^^^^^^^^^^^^^ - source.php +// ^^^^^ punctuation.section.embedded.begin - source.php +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.php +// ^^ punctuation.section.embedded.end - source.php +// ^^^^^^^^^ meta.attribute-with-value +// ^ punctuation.definition.string.begin.html +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.html +// ^ punctuation.definition.string.end.html + +// ^^ meta.embedded.line.nested punctuation.section.embedded.end - source.php +// ^ meta.embedded.line.nested meta.html-newline-after-php - punctuation.section.embedded - source.php + + +// ^^ meta.embedded.block.php punctuation.section.embedded.end - source.php +// ^ meta.embedded.block.php meta.html-newline-after-php - punctuation.section.embedded.end + +// ^^^^^^ meta.tag - source.php + +// ^^ meta.embedded.block.php punctuation.section.embedded.end - source.php +// ^ meta.embedded.block.php meta.html-newline-after-php - punctuation.section.embedded.end +
+// ^^^^^^^^^^^ meta.tag - source.php + +
+// ^^^^^^^^^^^ meta.tag - source.php + +// ^^ punctuation.section.embedded.end - source.php + + +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - source.php +// ^^^^^ meta.attribute-with-value +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.line.nested.php +// ^^^^^^^^^^^^^^^^^^ - source.php +// ^^^^^ punctuation.section.embedded.begin +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.php +// ^^ punctuation.section.embedded.end +// ^^^^^^^^^ meta.attribute-with-value +// ^ punctuation.definition.string.begin.html +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.html +// ^ punctuation.definition.string.end.html + +// ^^ punctuation.section.embedded.end +
+// ^^^^^ meta.tag - source.php +
+ prop = $val; + } + + public function __debugInfo() { +// ^^^^^^^^^^^ entity.name.function.php support.function.magic.php + return [ + 'propSquared' => $this->prop ** 2, + ]; + } + + public function __toString() +// ^^^^^^^^^^ entity.name.function.php support.function.magic.php +// ^^ meta.function.parameters.php punctuation.section.group + { + return $this->prop; + } + + public function __toStringTest() +// ^^^^^^^^^^^^^^ entity.name.function.php - support.function.magic.php +// ^^ - entity.name.function.php - support.function.magic.php + { + return $this->prop; + } + + public function __test() +// ^^^^^^ entity.name.function.php - support.function.magic.php + { + } +} + +var_dump(new C(42)); +// ^ meta.path support.class + +?> + +
+// ^^ punctuation.section.embedded.end.php + +
-true=val?ue>
+// ^^^^^^^^^^^^^^^^^^^^^ entity.other.attribute-name +// ^^^ punctuation.section.embedded.begin +// ^^ punctuation.section.embedded.end +// ^^^^^^^^^^^^^^^^ string.unquoted +// ^^ punctuation.section.embedded.begin.php +// ^^ punctuation.section.embedded.end.php + + selected> +// ^^^^^ punctuation.section.embedded.begin +// ^^ punctuation.section.embedded.end +// ^^^^^ punctuation.section.embedded.begin +// ^^ punctuation.section.embedded.end + + name attrib=false /> +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.custom.html +//^ punctuation.definition.tag.begin.html +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.custom.html +// ^^^^^ punctuation.section.embedded.begin.php +// ^^^^^^^^^^^^^ meta.embedded.line.php +// ^^ punctuation.section.embedded.end +// ^^^^^ punctuation.section.embedded.begin.php +// ^^^^^^^^^^^^^ meta.embedded.line.php +// ^^ punctuation.section.embedded.end +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html +// ^^^^^^^^^^^^^^^^^^^ entity.other.attribute-name.html +// ^^^^^ punctuation.section.embedded.begin.php +// ^^^^^^^^^^^^^ meta.embedded.line.php +// ^^ punctuation.section.embedded.end +// ^^ punctuation.definition.tag.end.html + + name attrib=false /> +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.other.html +//^ punctuation.definition.tag.begin.html +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.other.html +// ^^^^^ punctuation.section.embedded.begin.php +// ^^^^^^^^^^^^^ meta.embedded.line.php +// ^^ punctuation.section.embedded.end +// ^^^^^ punctuation.section.embedded.begin.php +// ^^^^^^^^^^^^^ meta.embedded.line.php +// ^^ punctuation.section.embedded.end +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.html +// ^^^^^^^^^^^^^^^^^^^ entity.other.attribute-name.html +// ^^^^^ punctuation.section.embedded.begin.php +// ^^^^^^^^^^^^^ meta.embedded.line.php +// ^^ punctuation.section.embedded.end +// ^^ punctuation.definition.tag.end.html + + +
+// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.class.html +// ^ punctuation.definition.string.begin.html +// ^^^^^^^^^^^^^^^^^^ string.quoted.double.html +// ^ punctuation.definition.string.end.html +// ^^^^^^^^^^^ meta.embedded.line +// ^^^ punctuation.section.embedded.begin - source.php +// ^^^^^^ source.php +// ^^^^ variable.other +// ^^ punctuation.section.embedded.end - source.php +// ^ punctuation.definition.tag.end.html + + + diff --git a/assets/syntaxes/Packages/Pascal/Miscellaneous.tmPreferences b/assets/syntaxes/Packages/Pascal/Miscellaneous.tmPreferences new file mode 100644 index 000000000..7e2e7bedf --- /dev/null +++ b/assets/syntaxes/Packages/Pascal/Miscellaneous.tmPreferences @@ -0,0 +1,35 @@ + + + + name + Miscellaneous + scope + source.pascal + settings + + increaseIndentPattern + \b(?i:(begin|declare|else|except|exception|finally|for|if|loop|package|procedure|task|try|type|when))\b + shellVariables + + + name + TM_COMMENT_START + value + // + + + name + TM_COMMENT_START_2 + value + { + + + name + TM_COMMENT_END_2 + value + } + + + + + diff --git a/assets/syntaxes/Packages/Pascal/Pascal.sublime-syntax b/assets/syntaxes/Packages/Pascal/Pascal.sublime-syntax new file mode 100644 index 000000000..72a3fac45 --- /dev/null +++ b/assets/syntaxes/Packages/Pascal/Pascal.sublime-syntax @@ -0,0 +1,82 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Pascal +file_extensions: + - pas + - p + - dpr +scope: source.pascal +contexts: + main: + - match: \b(?i:(absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor))\b + scope: keyword.control.pascal + - match: \b(?i:(function|procedure))\b\s+(\w+(\.\w+)?)(\(.*?\))?;\s*(?=(?i:attribute|forward|external)) + scope: meta.function.prototype.pascal + captures: + 1: storage.type.prototype.pascal + 2: entity.name.function.prototype.pascal + - match: \b(?i:(function|procedure))\b\s+(\w+(\.\w+)?) + scope: meta.function.pascal + captures: + 1: storage.type.function.pascal + 2: entity.name.function.pascal + - match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b' + scope: constant.numeric.pascal + - match: '(^[ \t]+)?(--)' + captures: + 1: punctuation.whitespace.comment.leading.pascal + 2: punctuation.definition.comment.pascal + push: + - meta_scope: comment.line.double-dash.pascal.one + - match: \n + pop: true + - match: '(^[ \t]+)?(//)' + captures: + 1: punctuation.whitespace.comment.leading.pascal + 2: punctuation.definition.comment.pascal + push: + - meta_scope: comment.line.double-slash.pascal.two + - match: \n + pop: true + - match: \(\* + captures: + 0: punctuation.definition.comment.pascal + push: + - meta_scope: comment.block.pascal.one + - match: \*\) + captures: + 0: punctuation.definition.comment.pascal + pop: true + - match: '\{' + captures: + 0: punctuation.definition.comment.pascal + push: + - meta_scope: comment.block.pascal.two + - match: '\}' + captures: + 0: punctuation.definition.comment.pascal + pop: true + - match: '"' + comment: Double quoted strings are an extension and (generally) support C-style escape sequences. + captures: + 0: punctuation.definition.string.begin.pascal + push: + - meta_scope: string.quoted.double.pascal + - match: '"' + captures: + 0: punctuation.definition.string.end.pascal + pop: true + - match: \\. + scope: constant.character.escape.pascal + - match: "'" + captures: + 0: punctuation.definition.string.begin.pascal + push: + - meta_scope: string.quoted.single.pascal + - match: "''" + scope: constant.character.escape.apostrophe.pascal + - match: "'" + captures: + 0: punctuation.definition.string.end.pascal + pop: true diff --git a/assets/syntaxes/Packages/Pascal/syntax_test.pas b/assets/syntaxes/Packages/Pascal/syntax_test.pas new file mode 100644 index 000000000..8bc2012af --- /dev/null +++ b/assets/syntaxes/Packages/Pascal/syntax_test.pas @@ -0,0 +1,27 @@ +// SYNTAX TEST "Packages/Pascal/Pascal.sublime-syntax" + + // double slash comment +// <- punctuation.whitespace.comment.leading.pascal + // <- punctuation.definition.comment.pascal + // ^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.pascal.two + + -- double dash comment +// <- punctuation.whitespace.comment.leading.pascal + // <- punctuation.definition.comment.pascal + // ^^^^^^^^^^^^^^^^^^^ comment.line.double-dash.pascal.one + +// comment +procedure foo; +// ^ meta.function.pascal +begin + // comment +end; +// <- keyword.control.pascal + +-- comment +procedure bar; +// ^ meta.function.pascal +begin + -- comment +end; +// <- keyword.control.pascal diff --git a/assets/syntaxes/Packages/Perl/Comments.tmPreferences b/assets/syntaxes/Packages/Perl/Comments.tmPreferences new file mode 100644 index 000000000..77e370eb9 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Comments.tmPreferences @@ -0,0 +1,21 @@ + + + + name + Comments + scope + source.perl + settings + + shellVariables + + + name + TM_COMMENT_START + value + # + + + + + diff --git a/assets/syntaxes/Packages/Perl/Perl.sublime-build b/assets/syntaxes/Packages/Perl/Perl.sublime-build new file mode 100644 index 000000000..c4beab080 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Perl.sublime-build @@ -0,0 +1,12 @@ +{ + "shell_cmd": "perl \"${file}\"", + "selector": "source.perl", + "variants": + [ + { + "name": "Syntax Check", + "shell_cmd": "perl -c \"${file}\"", + "file_regex": "^.*? at (.*?) line ([0-9]+)", + } + ] +} diff --git a/assets/syntaxes/Packages/Perl/Perl.sublime-syntax b/assets/syntaxes/Packages/Perl/Perl.sublime-syntax new file mode 100644 index 000000000..25ce3f07c --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Perl.sublime-syntax @@ -0,0 +1,1851 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Perl +file_extensions: + - pl + - pc + - pm + - pmc + - pod + - t +first_line_match: |- + (?xi: + ^\#! .* \bperl\b | # shebang + ^\# \s* -\*- [^*]* perl [^*]* -\*- # editorconfig + ) +scope: source.perl + +variables: + break: \b(?!::) + identifier: '\b[_[:alpha:]]\w*\b' + pod: '={{identifier}}' + regexp_delim: '[^\w\s\)\]\}\>]' + regexp_flags: '[msixpodualngcer]+\b' + # no odd number of backslashes behind (`\` or `\\\`) + # note: + # 1. For use in `escape` commands only !! + # 2. ST's Regex Compatibility Check marks it as incompatible + # as the real usage of the variable is not checked. + # It's a false positive as long as (1.) is respected. + no_escape_behind: '(? + - match: (B)(<) + captures: + 1: entity.name.tag.bold.perl + 2: punctuation.definition.tag.begin.perl + push: + - meta_content_scope: markup.bold.perl + - include: comment-pod-format-body + # inline code : C + - match: (C)(<) + captures: + 1: entity.name.tag.code.perl + 2: punctuation.definition.tag.begin.perl + push: + - meta_content_scope: markup.quote.perl + - include: comment-pod-format-body + # escaped character : E + - match: (E)(<) + captures: + 1: entity.name.tag.escaped.perl + 2: punctuation.definition.tag.begin.perl + push: + - meta_content_scope: constant.character.escape.perl + - include: comment-pod-format-body + # italic text : I + - match: (I)(<) + captures: + 1: entity.name.tag.italic.perl + 2: punctuation.definition.tag.begin.perl + push: + - meta_content_scope: markup.italic.perl + - include: comment-pod-format-body + # filename : F + - match: (F)(<) + captures: + 1: entity.name.tag.filename.perl + 2: punctuation.definition.tag.begin.perl + push: + - meta_content_scope: meta.string.perl string.unquoted.perl + - include: comment-pod-format-body + # hyperlink : L + - match: (L)(<) + captures: + 1: entity.name.tag.link.perl + 2: punctuation.definition.tag.begin.perl + push: + - meta_content_scope: markup.underline.link.perl + - include: comment-pod-format-body + # non-breaking spaces : S + - match: (S)(<) + captures: + 1: entity.name.tag.none-braeking.perl + 2: punctuation.definition.tag.begin.perl + push: + - include: comment-pod-format-body + # index entry : X + - match: (X)(<) + captures: + 1: entity.name.tag.index.perl + 2: punctuation.definition.tag.begin.perl + push: + - meta_content_scope: entity.name.label.perl + - include: comment-pod-format-body + + comment-pod-format-body: + - match: \> + scope: punctuation.definition.tag.end.perl + pop: true + - include: comment-pod-formatting + - include: literal-angle-nested + +###[ PACKAGE DEFINITION ]##################################################### + + package: + # https://perldoc.perl.org/functions/package.html + # package NAMESPACE + # package NAMESPACE VERSION + # package NAMESPACE BLOCK + # package NAMESPACE VERSION BLOCK + - match: \bpackage{{break}} + scope: storage.type.namespace.perl keyword.declaration.namespace.perl + push: [package-end, package-version, package-namespace] + + package-namespace: + - include: qualified-namespace + - include: unqualified-namespace + - include: comment-line + - include: else-pop + + package-version: + - match: (")((v?)[\d_](\.)[\d_]+(?:(\.)[\d_]+)?)(") + scope: meta.string.perl string.quoted.double.perl + captures: + 1: punctuation.definition.string.begin.perl + 2: constant.numeric.version.perl + 3: punctuation.definition.version.perl + 4: punctuation.separator.decimal.perl + 5: punctuation.separator.decimal.perl + 6: punctuation.definition.string.end.perl + pop: true + - match: (')((v?)[\d_](\.)[\d_]+(?:(\.)[\d_]+)?)(') + scope: meta.string.perl string.quoted.single.perl + captures: + 1: punctuation.definition.string.begin.perl + 2: constant.numeric.version.perl + 3: punctuation.definition.version.perl + 4: punctuation.separator.decimal.perl + 5: punctuation.separator.decimal.perl + 6: punctuation.definition.string.end.perl + pop: true + - match: (v?)[\d_](\.)[\d_]+(?:(\.)[\d_]+)?\b + scope: constant.numeric.version.perl + captures: + 1: punctuation.definition.version.perl + 2: punctuation.separator.decimal.perl + 3: punctuation.separator.decimal.perl + pop: true + - include: comment-line + - include: else-pop + + package-end: + - meta_scope: meta.namespace.perl + - include: comment-line + - include: else-pop + + qualified-namespace: + - match: ({{identifier}})?(::) + captures: + 1: entity.name.namespace.perl + 2: punctuation.accessor.double-colon.perl + set: + - meta_scope: meta.path.perl + - match: ({{identifier}})(::) + captures: + 1: entity.name.namespace.perl + 2: punctuation.accessor.double-colon.perl + - include: unqualified-namespace + - include: immediately-pop + + unqualified-namespace: + - match: '{{identifier}}' + scope: entity.name.namespace.perl + pop: true + +###[ IMPORT STATEMENTS ]###################################################### + + imports: + # https://perldoc.perl.org/functions/require.html + # require MODULE + # require EXPR + - match: \brequire{{break}} + scope: keyword.control.import.require.perl + push: [require-end, require-body] + # https://perldoc.perl.org/functions/use.html + # use MODULE VERSION LIST + # use MODULE VERSION + # use MODULE LIST + # use MODULE + # use VERSION + - match: \buse{{break}} + scope: keyword.control.import.use.perl + push: + - - meta_scope: meta.preprocessor.use.perl + - include: require-expression + - expressions-begin + - package-version + - package-namespace + # https://perldoc.perl.org/functions/no.html + # no MODULE VERSION LIST + # no MODULE VERSION + # no MODULE LIST + # no MODULE + # no VERSION + - match: \bno{{break}} + scope: keyword.control.import.no.perl + push: + - - meta_scope: meta.preprocessor.no.perl + - include: require-expression + - expressions-begin + - package-version + - package-namespace + + require-body: + - include: require-namespace + - include: comment-line + - match: (?=\S) + set: [require-expression, expressions-begin] + + require-namespace: + - include: qualified-namespace + - match: '{{identifier}}(?=\s*(?:[;)}#]|$))' + scope: entity.name.namespace.perl + pop: true + + require-expression: + - match: (?=[;)}]) + pop: true + - include: expressions + - match: \S + scope: meta.string.perl string.unquoted.perl + + require-end: + - meta_scope: meta.preprocessor.require.perl + - include: comment-line + - include: else-pop + +###[ SUB STATEMENTS ]######################################################### + + sub: + - match: \bsub{{break}} + scope: storage.type.function.perl keyword.declaration.function.perl + push: [sub-end, sub-parameters, sub-path] + # special functions which are executed at compile time + # SEE: https://perldoc.perl.org/perlmod.html#BEGIN%2c-UNITCHECK%2c-CHECK%2c-INIT-and-END + # NOTE: may not start with double colon when used without `sub` keyword + - match: (::)?(BEGIN|CHECK|END|INIT|UNITCHECK)(?=\s*(?:[;#{]|$)) + captures: + 1: invalid.illegal.accessor.perl + 2: entity.name.function.prepocessor.perl + push: [sub-end, sub-parameters] + + sub-path: + - match: ({{identifier}})?(::) + captures: + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl + set: + - meta_scope: meta.path.perl + - include: qualifier + - include: sub-name + - include: immediately-pop + - include: sub-name + - include: sub-common + + sub-name: + # callback hook to auto load or destroy objects/functions + - match: \b(AUTOLOAD|DESTROY){{break}} + scope: entity.name.function.callback.perl + pop: true + # special functions which are executed at compile time + - match: \b(BEGIN|CHECK|END|INIT|UNITCHECK){{break}} + scope: entity.name.function.prepocessor.perl + pop: true + # ordinary function identifier + - match: (?!{{reserved_words}}){{identifier}} + scope: entity.name.function.perl + pop: true + + sub-parameters: + - match: (?=\() + set: + - - clear_scopes: 1 + - meta_scope: meta.function.parameters.perl + - include: parameters-end + - match: '[$@%*&\\]+' + scope: variable.parameter.perl + - match: ; + scope: punctuation.separator.sequence.perl + - match: \S + scope: invalid.illegal.parameter.perl + - parameters-begin + - include: sub-attributes + - include: sub-common + + sub-attributes: + - match: '::' + scope: invalid.illegal.identifier.perl + - match: ':' + scope: punctuation.definition.annotation.perl + push: sub-attributes-name + + sub-attributes-name: + - meta_scope: meta.annotation.perl + - match: '{{identifier}}' + scope: variable.annotation.attribute.perl + set: + - meta_content_scope: meta.annotation.perl + - include: sub-attributes-parameters + - include: sub-attributes-parameters + + sub-attributes-parameters: + # NOTE: doesn't look like prototype parameters + - match: (?=\((?!\s*[$@%*&]+\s*[;)])) + set: + - - meta_scope: meta.annotation.parameters.perl + - include: parameters-end + - include: expressions-nested + - expressions-begin + - parameters-begin + - include: sub-common + + sub-common: + - match: (?=[:;({]|{{qualified_reserved_words}}) + pop: true + - include: comment-line + - match: \S + scope: invalid.illegal.identifier.perl + + sub-end: + - meta_scope: meta.function.perl + - include: sub-attributes + - include: sub-common + + parameters-begin: + - match: \( + scope: punctuation.section.parameters.begin.perl + pop: true + + parameters-end: + - match: \) + scope: punctuation.section.parameters.end.perl + pop: true + +###[ BLOCKS AND GROUPS ]###################################################### + + blocks: + # can't push into scope due to HEREDOCs! + - match: \{ + scope: punctuation.section.block.begin.perl + push: expressions-begin + - match: \} + scope: punctuation.section.block.end.perl + + blocks-nested: + - match: \{ + scope: punctuation.section.block.begin.perl + push: [blocks-nested-body, expressions-begin] + + blocks-nested-body: + - match: \} + scope: punctuation.section.block.end.perl + pop: true + - include: main + + brackets: + # can't push into scope due to HEREDOCs! + - match: \[ + scope: punctuation.section.brackets.begin.perl + push: expressions-begin + - match: \] + scope: punctuation.section.brackets.end.perl + + brackets-nested: + - match: \[ + scope: punctuation.section.brackets.begin.perl + push: [brackets-nested-body, expressions-begin] + + brackets-nested-body: + - match: \] + scope: punctuation.section.brackets.end.perl + pop: true + - include: blocks-nested + - include: brackets-nested + - include: expressions + + groups: + # can't push into scope due to HEREDOCs! + - match: \( + scope: punctuation.section.group.begin.perl + push: expressions-begin + - match: \) + scope: punctuation.section.group.end.perl + + groups-nested: + - match: \( + scope: punctuation.section.group.begin.perl + push: [groups-nested-body, expressions-begin] + + groups-nested-body: + - match: \) + scope: punctuation.section.group.end.perl + pop: true + - include: expressions-nested + +###[ CONSTANTS ]############################################################## + + constants: + - include: constants-version + - include: constants-numbers + - include: constants-language + - include: constants-other + - include: string + + constants-numbers: + # SEE: https://perldoc.perl.org/perlnumber.html + # decimal floats + - match: |- + (?ix: + (") ( [-+]? (?: + (\.)[\d_]+ (?: e[-+]?[\d_]+ )? | # .1 .1e1 .1e-1 .1e+1 + [\d_]+ (?: (\.) (?: + [\d_]+ (?: e[-+]?[\d_]+ )? | # 1.1 1.1e1 1.1e-1 1.1e+1 + e[-+]?[\d_]+ )? | # 1. 1.e1 1.e-1 1.e+1 + e[-+]?[\d_]+ ) # 1e1 1e-1 1e+1 + ) ) (") + ) + scope: meta.string.perl string.quoted.double.perl + captures: + 1: punctuation.definition.string.begin.perl + 2: constant.numeric.float.decimal.perl + 3: punctuation.separator.decimal.perl + 4: punctuation.separator.decimal.perl + 5: punctuation.definition.string.end.perl + - match: |- + (?ix: + (') ( [-+]? (?: + (\.)[\d_]+ (?: e[-+]?[\d_]+ )? | # .1 .1e1 .1e-1 .1e+1 + [\d_]+ (?: (\.) (?: + [\d_]+ (?: e[-+]?[\d_]+ )? | # 1.1 1.1e1 1.1e-1 1.1e+1 + e[-+]?[\d_]+ )? | # 1. 1.e1 1.e-1 1.e+1 + e[-+]?[\d_]+ ) # 1e1 1e-1 1e+1 + ) ) (') + ) + scope: meta.string.perl string.quoted.single.perl + captures: + 1: punctuation.definition.string.begin.perl + 2: constant.numeric.float.decimal.perl + 3: punctuation.separator.decimal.perl + 4: punctuation.separator.decimal.perl + 5: punctuation.definition.string.end.perl + - match: |- + (?ix: + (\.)[\d_]+ (?: e[-+]?[\d_]+ )? \b | # .1 .1e1 .1e-1 .1e+1 + \b[\d_]+ (?: (\.) (?: (?: + [\d_]+ (?: e[-+]?[\d_]+ )? \b | # 1.1 1.1e1 1.1e-1 1.1e+1 + e[-+]?[\d_]+\b ) | # 1.e1 1.e-1 1.e+1 + (?=[^.])) | # 1. (protect the .. operator) + e[-+]?[\d_]+\b ) # 1e1 1e-1 1e+1 + ) + scope: constant.numeric.float.decimal.perl + captures: + 1: punctuation.separator.decimal.perl + 2: punctuation.separator.decimal.perl + # decimal integers + - match: (")([-+]?[\d_]+)(") + scope: meta.string.perl string.quoted.double.perl + captures: + 1: punctuation.definition.string.begin.perl + 2: constant.numeric.integer.decimal.perl + 3: punctuation.definition.string.end.perl + - match: (')([-+]?[\d_]+)(') + scope: meta.string.perl string.quoted.single.perl + captures: + 1: punctuation.definition.string.begin.perl + 2: constant.numeric.integer.decimal.perl + 3: punctuation.definition.string.end.perl + # binary integers + - match: \b(0[bB])[01_]+\b + scope: constant.numeric.integer.binary.perl + captures: + 1: punctuation.definition.numeric.binary.perl + # hexadecimal integers + - match: \b(0[xX])[\h_]+\b + scope: constant.numeric.integer.hexadecimal.perl + captures: + 1: punctuation.definition.numeric.hexadecimal.perl + # octal integers + - match: \b(0)[0-7_]+\b + scope: constant.numeric.integer.octal.perl + captures: + 1: punctuation.definition.numeric.octal.perl + # decimal integers + - match: \b[\d_]+\b + scope: constant.numeric.integer.decimal.perl + + constants-language: + - match: \b__(?:END|DATA|FILE|LINE|PACKAGE|SUB)__\b + scope: constant.language.perl + - match: \b(?:ARGV|ARGVOUT|STDERR|STDIN|STDOUT|DATA|IN|OUT)\b + scope: constant.language.filehandle.perl + + constants-other: + - match: '{{identifier}}(?=\s*=>)' + scope: constant.other.key.perl + # Not looking like a namespace, class, object or function? + - match: \b[A-Z_][A-Z0-9_]+\b(?!::|\s*(?:\(|->)) + scope: constant.other.perl + + constants-identifier: + - match: '{{identifier}}' + scope: constant.other.perl + + constants-version: + # SEE: https://perldoc.perl.org/functions/require.html + - match: (v?)[\d_](\.)[\d_]+(\.)[\d_]+\b + scope: constant.numeric.version.perl + captures: + 1: punctuation.definition.version.perl + 2: punctuation.separator.decimal.perl + 3: punctuation.separator.decimal.perl + +###[ STRINGS ]################################################################ + + string: + - include: string-quoted-backtick + - include: string-quoted-double + - include: string-quoted-single + - include: string-format + - include: string-heredoc + + string-quoted-angle-pop: + # NOTE: match only if... + # - doesn't look like an operator (`<=>`, `<<`) + # - closing punctuation `>` found on the same line + - match: \<(?!<|=>)(?=.*?>) + scope: punctuation.definition.string.begin.perl + set: + - meta_scope: meta.string.perl string.quoted.angle.perl + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?(\>) + captures: + 1: punctuation.definition.string.end.perl + pop: true + - include: interpolated-angle-nested + - include: interpolated-common + + string-quoted-backtick: + - match: \` + scope: punctuation.definition.string.begin.perl + push: + - meta_scope: meta.string.perl string.quoted.backtick.perl + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?(\`) + captures: + 1: punctuation.definition.string.end.perl + pop: true + - include: interpolated-common + + string-quoted-double: + - match: \" + scope: punctuation.definition.string.begin.perl + push: + - meta_scope: meta.string.perl string.quoted.double.perl + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?(\") + captures: + 1: punctuation.definition.string.end.perl + pop: true + - include: interpolated-common + + string-quoted-single: + - match: \' + scope: punctuation.definition.string.begin.perl + push: + - meta_scope: meta.string.perl string.quoted.single.perl + - match: \' + scope: punctuation.definition.string.end.perl + pop: true + - include: literal-common + + string-format: + # SEE: https://perldoc.perl.org/perlform.html + - match: \bformat{{break}} + scope: storage.type.format.perl + push: [string-format-meta, string-format-body, string-format-variable] + + string-format-meta: + - meta_scope: meta.format.perl + - include: immediately-pop + + string-format-variable: + - match: ({{identifier}})?(::) + captures: + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl + push: + - meta_scope: meta.path.perl + - include: qualifier + - include: variable-identifier + - include: immediately-pop + - include: variable-identifier + - include: comment-line + - include: else-pop + + string-format-body: + - match: '=(?!=)' + scope: keyword.operator.assignment.perl + set: + - meta_content_scope: meta.string.perl string.unquoted.perl + - match: ^\.(?=\s*$) + scope: punctuation.terminator.format.perl + pop: true + - match: \.{4,} # consume any dot sequence longer than 3 chars + - match: \.{3} + scope: constant.other.placeholder.text.perl + - match: ~{3,} # consume any tild sequence longer than 2 chars + - match: ~{1,2} + scope: constant.other.placeholder.text.perl + - match: ([@^])[<|>*]+ + scope: constant.other.placeholder.text.perl + captures: + 1: punctuation.definition.placeholder.begin.perl + - match: ([@^])0?[.#]+(?![_\d]) + scope: constant.other.placeholder.numeric.perl + captures: + 1: punctuation.definition.placeholder.begin.perl + - include: variables-interpolation + - include: comment-line + - match: \S+ + scope: invalid.illegal.identifier.perl + pop: true + + string-heredoc: + # SEE: http://www.perlmeme.org/howtos/syntax/here_document.html + - match: <<(?=(\s*['"]\s*)?{{identifier}}) + scope: keyword.operator.heredoc.perl + push: [string-heredoc-meta, string-heredoc-body] + + string-heredoc-meta: + - meta_scope: meta.string.heredoc.perl + - include: immediately-pop + + string-heredoc-body: + # embedded css + - match: \s*((['"]?)(\s*CSS)(\2)) + captures: + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.css.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-css, string-heredoc-expr] + # embedded html + - match: \s*((['"]?)(\s*HTML)(\2)) + captures: + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.html.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-html, string-heredoc-expr] + # embedded javascript + - match: \s*((['"]?)(\s*JAVASCRIPT)(\2)) + captures: + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.js.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-javascript, string-heredoc-expr] + # embedded json + - match: \s*((['"]?)(\s*JSON)(\2)) + captures: + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.json.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-json, string-heredoc-expr] + # embedded sql + - match: \s*((['"]?)(\s*SQL)(\2)) + captures: + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.sql.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-sql, string-heredoc-expr] + # embedded xml + - match: \s*((['"]?)(\s*XML)(\2)) + captures: + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.xml.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-xml, string-heredoc-expr] + # single quoted heredoc string without interpolation + - match: \s*((')(\s*{{identifier}})(')) + captures: + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.plain.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-plain, string-heredoc-expr] + # unquoted or double quoted heredoc string with interpolation + - match: \s*(("?)(\s*{{identifier}})(\2)) + captures: + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.plain.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-interpolated, string-heredoc-expr] + - include: immediately-pop + + string-heredoc-expr: + # The rest of the line right after the heredoc tag needs to be handled + # as ordinary perl. The embedded syntax starts at the next line. + - clear_scopes: 1 # remove 'source' + - match: ^ + pop: true + - include: expressions + + string-heredoc-css: + - meta_content_scope: source.css.embedded.perl + # pop off only, if keyword is indented correctly + - match: ^\3$ + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.css.perl + pop: true + - match: '' + embed: scope:source.css + escape: (?=^ *CSS$) + + string-heredoc-html: + - meta_content_scope: text.html.embedded.perl + - match: ^\3$ + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.html.perl + pop: true + - match: '' + embed: scope:text.html.basic + escape: (?=^ *HTML$) + + string-heredoc-javascript: + - meta_content_scope: source.js.embedded.perl + - match: ^\3$ + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.js.perl + pop: true + - match: '' + embed: scope:source.js + escape: (?=^ *JAVASCRIPT$) + + string-heredoc-json: + - meta_content_scope: source.json.embedded.perl + - match: ^\3$ + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.json.perl + pop: true + - match: '' + embed: scope:source.json + escape: (?=^ *JSON$) + + string-heredoc-sql: + - meta_content_scope: source.sql.embedded.perl + - match: ^\3$ + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.sql.perl + pop: true + - match: '' + embed: scope:source.sql + escape: (?=^ *SQL$) + + string-heredoc-xml: + - meta_content_scope: text.xml.embedded.perl + - match: ^\3$ + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.xml.perl + pop: true + - match: '' + embed: scope:text.xml + escape: (?=^ *XML$) + + string-heredoc-plain: + - meta_content_scope: string.unquoted.heredoc.perl + - match: ^\3$ + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.plain.perl + pop: true + + string-heredoc-interpolated: + - meta_content_scope: string.unquoted.heredoc.perl + - match: ^\3$ + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.plain.perl + pop: true + - include: interpolated-common + +###[ KEYWORDS ]############################################################### + + keywords: + # All keywords can be prefixed with the case sensitive `CORE` namespace. + # This context makes sure not to highlight the keywords as functions. + # The `meta.path` is not applied for simplicity reasons. + - match: \b(CORE)(::)(?={{reserved_words}}) + captures: + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl + # declaration + - match: \b(?:{{storage_keywords}}){{break}} + scope: storage.type.variable.perl + # conditional + - match: \bdefault{{break}} + scope: keyword.control.conditional.default.perl + push: expressions-begin + - match: \belse{{break}} + scope: keyword.control.conditional.else.perl + push: expressions-begin + - match: \belsif{{break}} + scope: keyword.control.conditional.elseif.perl + push: expressions-begin + - match: \bgiven{{break}} + scope: keyword.control.conditional.given.perl + push: expressions-begin + - match: \bif{{break}} + scope: keyword.control.conditional.if.perl + push: expressions-begin + - match: \bunless{{break}} + scope: keyword.control.conditional.unless.perl + push: expressions-begin + - match: \bwhen{{break}} + scope: keyword.control.conditional.when.perl + push: expressions-begin + # flow + - match: \bbreak{{break}} + scope: keyword.control.flow.break.perl + push: expressions-begin + - match: \bcaller{{break}} + scope: keyword.control.flow.caller.perl + push: expressions-begin + - match: \bcontinue{{break}} + scope: keyword.control.flow.continue.perl + push: expressions-begin + - match: \bdie{{break}} + scope: keyword.control.flow.die.perl + push: expressions-begin + - match: \bdo{{break}} + scope: keyword.control.flow.do.perl + push: expressions-begin + - match: \bdump{{break}} + scope: keyword.control.flow.dump.perl + push: expressions-begin + - match: \bexit{{break}} + scope: keyword.control.flow.exit.perl + push: expressions-begin + - match: \bgoto{{break}} + scope: keyword.control.flow.goto.perl + push: expressions-begin + - match: \blast{{break}} + scope: keyword.control.flow.last.perl + push: label-usage + - match: \bnext{{break}} + scope: keyword.control.flow.next.perl + push: label-usage + - match: \bredo{{break}} + scope: keyword.control.flow.redo.perl + push: label-usage + - match: \breturn{{break}} + scope: keyword.control.flow.return.perl + push: expressions-begin + - match: \bwait{{break}} + scope: keyword.control.flow.wait.perl + push: expressions-begin + # loop + - match: \bfor{{break}} + scope: keyword.control.loop.for.perl + push: expressions-begin + - match: \bforeach{{break}} + scope: keyword.control.loop.foreach.perl + push: expressions-begin + - match: \buntil{{break}} + scope: keyword.control.loop.until.perl + push: expressions-begin + - match: \bwhile{{break}} + scope: keyword.control.loop.while.perl + push: expressions-begin + + label-usage: + # reserved words indicate an expression like label + - match: (?={{reserved_words}}|{{builtin_functions}}) + pop: true + - match: '{{identifier}}' + scope: variable.label.perl + pop: true + - include: expressions-begin + + label: + - match: ({{identifier}})(:)(?!:) + captures: + 1: entity.name.label.perl + 2: punctuation.separator.perl + push: expressions-begin + +###[ OPERATORS ]############################################################## + + operators: + # SEE: https://www.tutorialspoint.com/perl/perl_operators.htm + - match: => + scope: punctuation.separator.key-value.perl + push: expressions-begin + - match: ',' + scope: punctuation.separator.sequence.perl + push: expressions-begin + - match: ; + scope: punctuation.terminator.statement.perl + push: expressions-begin + - match: -[rwx0RWXOezsfdlpSbctugkTBMAC]\b + scope: keyword.operator.filetest.perl + push: expressions-begin + - match: '[!~=]~' + scope: keyword.operator.binary.perl + push: expressions-begin + - match: <<|>> + scope: keyword.operator.bitwise.perl + push: expressions-begin + - match: <=>|==|!=|>=|<=|[<>] + scope: keyword.operator.comparison.perl + push: expressions-begin + - match: \&\&|\|\||//|[:!?] + scope: keyword.operator.logical.perl + push: expressions-begin + - match: \*\*=|[-+*/%]=|= + scope: keyword.operator.assignment.perl + push: expressions-begin + - match: --|\+\+ + scope: keyword.operator.arithmetic.perl + push: maybe-regexp-match + - match: \*{1,2}|[-+/%] + scope: keyword.operator.arithmetic.perl + push: expressions-begin + - match: '[&|^~]' + scope: keyword.operator.bitwise.perl + push: expressions-begin + - match: \.\. + scope: keyword.operator.range.perl + push: expressions-begin + # SEE: https://perldoc.perl.org/perlref.html#Making-References + - match: \\+ + scope: keyword.operator.reference.perl + push: expressions-begin + # string concat + - match: \.=? + scope: keyword.operator.concat.perl + push: expressions-begin + # string concation + # "string" x 10 + - match: \bx{{break}} + scope: keyword.operator.arithmetic.perl + push: expressions-begin + - match: \b(?:{{operator_keywords}}){{break}} + scope: keyword.operator.logical.perl + push: expressions-begin + +###[ QUOTED LIKE ]############################################################ + + quoted-like: + # SEE: https://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators + - include: quoted-like-match + - include: quoted-like-substitution + # fallback + - match: \b(?:{{quoted_like_keywords}}){{break}} + scope: support.function.perl + + quoted-like-match: + # qq// and qx// with interpolation + - match: \bq[qx]{{break}} + scope: support.function.perl + push: + - quoted-like-meta + - quoted-like-args-interpolated + # q// and qw// without interpolation + - match: \bqw?{{break}} + scope: support.function.perl + push: + - quoted-like-meta + - quoted-like-args-literal + - match: \b(m|qr)(?=\s*[\(\[\{<]) + scope: support.function.perl + push: + - quoted-like-meta + - quoted-like-args-flags + - quoted-like-args-pattern + - match: \b(m|qr)({{regexp_delim}}) + captures: + 0: meta.function-call.perl + 1: support.function.perl + 2: punctuation.section.generic.begin.perl + embed_scope: meta.function-call.perl meta.string.perl string.regexp.perl + embed: scope:source.regexp + escape: '{{no_escape_behind}}(\2)({{regexp_flags}})?' + escape_captures: + 0: meta.function-call.perl + 1: punctuation.section.generic.end.perl + 2: constant.language.flags.regexp.perl + + quoted-like-substitution: + - match: \b(s|tr|y)(?=\s*[\(\[\{<]) + scope: support.function.perl + push: + - quoted-like-meta + - quoted-like-args-flags + - quoted-like-args-interpolated + - quoted-like-args-pattern + - match: (?=\b(s|tr|y){{regexp_delim}}) + push: + - quoted-like-meta + - quoted-like-args-flags + - quoted-like-args-substitution + + quoted-like-meta: + - meta_scope: meta.function-call.perl + - include: immediately-pop + + quoted-like-args-flags: + - match: '{{regexp_flags}}' + scope: constant.language.flags.regexp.perl + pop: true + - include: immediately-pop + + quoted-like-args-substitution: + # the search pattern + - match: (s|tr|y)({{regexp_delim}}) + captures: + 1: support.function.perl + 2: punctuation.section.generic.begin.perl + embed_scope: meta.string.perl string.regexp.perl + embed: scope:source.regexp + escape: (?={{no_escape_behind}}\2) + # the replacement with variable interpolation + - match: ({{regexp_delim}}) + scope: punctuation.separator.sequence.perl + set: + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\1) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.generic.end.perl + pop: true + - include: interpolated-common + - include: immediately-pop + + quoted-like-args-pattern: + - match: \{ + scope: punctuation.section.braces.begin.perl + set: + - meta_scope: meta.braces.perl + - meta_content_scope: meta.string.perl string.regexp.perl + - match: \} + scope: punctuation.section.braces.end.perl + pop: true + - include: scope:source.regexp#base-literal-extended + - match: \[ + scope: punctuation.section.brackets.begin.perl + set: + - meta_scope: meta.brackets.perl + - meta_content_scope: meta.string.perl string.regexp.perl + - match: \] + scope: punctuation.section.brackets.end.perl + pop: true + - include: scope:source.regexp#base-literal-extended + - match: \< + scope: punctuation.section.generic.begin.perl + set: + - meta_scope: meta.generic.perl + - meta_content_scope: meta.string.perl string.regexp.perl + - match: \> + scope: punctuation.section.generic.end.perl + pop: true + - include: scope:source.regexp#base-literal-extended + - match: \( + scope: punctuation.section.parens.begin.perl + set: + - meta_scope: meta.parens.perl + - meta_content_scope: meta.string.perl string.regexp.perl + - match: \) + scope: punctuation.section.parens.end.perl + pop: true + - include: scope:source.regexp#base-literal-extended + - include: else-pop + + quoted-like-args-interpolated: + - include: interpolated-braces-pop + - include: interpolated-brackets-pop + - include: interpolated-angle-pop + - include: interpolated-parens-pop + - include: interpolated-generic-pop + - include: else-pop + + quoted-like-args-literal: + - include: literal-braces-pop + - include: literal-brackets-pop + - include: literal-angle-pop + - include: literal-parens-pop + - include: literal-generic-pop + - include: else-pop + + interpolated-braces-pop: + - match: \{ + scope: punctuation.section.braces.begin.perl + set: + - meta_scope: meta.braces.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\}) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.braces.end.perl + pop: true + - include: interpolated-braces-nested + - include: interpolated-common + + interpolated-braces-nested: + - match: \{ + push: + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?\} + pop: true + - include: interpolated-braces-nested + - include: interpolated-common + + interpolated-brackets-pop: + - match: \[ + scope: punctuation.section.brackets.begin.perl + set: + - meta_scope: meta.brackets.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\]) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.brackets.end.perl + pop: true + - include: interpolated-brackets-nested + - include: interpolated-common + + interpolated-brackets-nested: + - match: \[ + push: + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?\] + pop: true + - include: interpolated-brackets-nested + - include: interpolated-common + + interpolated-angle-pop: + - match: \< + scope: punctuation.section.generic.begin.perl + set: + - meta_scope: meta.generic.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\>) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.generic.end.perl + pop: true + - include: interpolated-angle-nested + - include: interpolated-common + + interpolated-angle-nested: + - match: \< + push: + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?\> + pop: true + - include: interpolated-angle-nested + - include: interpolated-common + + interpolated-parens-pop: + - match: \( + scope: punctuation.section.parens.begin.perl + set: + - meta_scope: meta.parens.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\)) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.parens.end.perl + pop: true + - include: interpolated-parens-nested + - include: interpolated-common + + interpolated-parens-nested: + - match: \( + push: + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?\) + pop: true + - include: interpolated-parens-nested + - include: interpolated-common + + interpolated-generic-pop: + - match: ({{regexp_delim}}) + scope: punctuation.section.generic.begin.perl + set: + - meta_scope: meta.generic.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\1) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.generic.end.perl + pop: true + - include: interpolated-common + + interpolated-common: + - include: literal-common + - include: variables-interpolation + + literal-braces-pop: + - match: \{ + scope: punctuation.section.braces.begin.perl + set: + - meta_scope: meta.braces.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + - match: \} + scope: punctuation.section.braces.end.perl + pop: true + - include: literal-braces-nested + - include: literal-common + + literal-braces-nested: + - match: \{ + push: + - match: \} + pop: true + - include: literal-braces-nested + - include: literal-common + + literal-brackets-pop: + - match: \[ + scope: punctuation.section.brackets.begin.perl + set: + - meta_scope: meta.brackets.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + - match: \] + scope: punctuation.section.brackets.end.perl + pop: true + - include: literal-brackets-nested + - include: literal-common + + literal-brackets-nested: + - match: \[ + push: + - match: \] + pop: true + - include: literal-brackets-nested + - include: literal-common + + literal-angle-pop: + - match: \< + scope: punctuation.section.generic.begin.perl + set: + - meta_scope: meta.generic.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + - match: \> + scope: punctuation.section.generic.end.perl + pop: true + - include: literal-angle-nested + - include: literal-common + + literal-angle-nested: + - match: \< + push: + - match: \> + pop: true + - include: literal-angle-nested + - include: literal-common + + literal-parens-pop: + - match: \( + scope: punctuation.section.parens.begin.perl + set: + - meta_scope: meta.parens.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + - match: \) + scope: punctuation.section.parens.end.perl + pop: true + - include: literal-parens-nested + - include: literal-common + + literal-parens-nested: + - match: \( + push: + - match: \) + pop: true + - include: literal-parens-nested + - include: literal-common + + literal-generic-pop: + - match: ({{regexp_delim}}) + scope: punctuation.section.generic.begin.perl + set: + - meta_scope: meta.generic.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + - match: \1 + scope: punctuation.section.generic.end.perl + pop: true + - include: literal-common + + literal-common: + # SEE: https://perldoc.perl.org/functions/sprintf.html + - match: '%%|\\.' + scope: constant.character.escape.perl + - match: |- + (?x: + (%) # punctuation + (?: \d+\$ )? # index + (?: \s*[-+]\s* | [ #0] )? # flags + (?: \* (?: \d+\$ )? | \d+ )? # width + (?: + v\d* | # vector flag + (\.) (?: \* (?: \d+\$ )? | \d+ )? # precision + )? + (?: hh|ll|[hjlLqtz])? # size + [aAbBcdDeEfFgGinoOpsuUxX] # control sequence + ) + scope: constant.other.placeholder.perl + captures: + 1: punctuation.definition.placeholder.perl + 2: punctuation.separator.decimal.perl + +###[ REGEXP ]################################################################# + + maybe-regexp-match: + # /<pattern>/<flags> + - match: / + scope: punctuation.section.generic.begin.perl + embed_scope: meta.string.perl string.regexp.perl + embed: scope:source.regexp + escape: '{{no_escape_behind}}(/)({{regexp_flags}})?' + escape_captures: + 1: punctuation.section.generic.end.perl + 2: constant.language.flags.regexp.perl + - include: else-pop + - include: eol-pop + +###[ FUNCTION CALL ]########################################################## + + qualified-function-call: + - match: -> + scope: punctuation.accessor.arrow.perl + push: + # member function + - match: '{{identifier}}(?!::)' + scope: meta.function-call.perl variable.function.member.perl + pop: true + # item access like $array->[0] + - match: (?=[{\[]) + set: maybe-item-access + - include: comment-line + - include: else-pop + # Class->member + - match: '{{identifier}}(?=\s*->)' + scope: variable.namespace.perl + # Module::SubModule::function + # ::SubModule::function + - match: ({{identifier}})?(::) + captures: + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl + push: + - meta_scope: meta.path.perl + - match: '{{identifier}}(?=\s*->)' + scope: variable.namespace.perl + pop: true + - include: qualifier + - include: unqualified-variables + - include: function-identifier + + function-identifier: + # builtin function calls + - match: '{{builtin_functions}}' + scope: meta.function-call.perl support.function.perl + set: expressions-begin + # user defined function calls + - match: '{{identifier}}{{break}}' + scope: meta.function-call.perl variable.function.perl + set: expressions-begin + - include: immediately-pop + + unqualified-function-call: + # builtin function calls + - match: '{{builtin_functions}}' + scope: meta.function-call.perl support.function.perl + push: expressions-begin + # user defined function calls + - match: '{{identifier}}(?=\s*(?:$|[;#/(''"`$@%]|<<|(?!(?:{{operator_keywords}}){{break}})\w))' + scope: meta.function-call.perl variable.function.perl + push: expressions-begin + +###[ VARIABLES INTERPOLATION ]################################################ + + variables-interpolation: + # note: coderefs `&` are not interpolated + - match: (?=[@$%]) + push: + - - clear_scopes: 1 # remove 'string' + - meta_scope: meta.interpolation.perl + - include: maybe-item-access + - variables-interpolation-body + + variables-interpolation-body: + ########################################################################### + # 1) This context is a merge of + # `qualified-variables` and `unqualified-variables` + # + # a) The `push: maybe-item-access` is replaced by `pop: true` as the + # item access is matched globally. + # b) The `&` coderef parts are removed as they are not supported within + # string interpolations. + # + # 2) The interpolation needs to be poped off from after each variable + # to ensure to correctly pop off from the owning context if needed. + # Otherwise the variable `$/` could break the statement `s//$repl$/g`. + ########################################################################### + + # qualified variable + - match: ([$@%*]#?)({{identifier}})?(::) + captures: + 1: punctuation.definition.variable.perl + 2: variable.namespace.perl + 3: punctuation.accessor.double-colon.perl + set: qualified-variables-path + + # regexp match + - match: ([$@%*]#?)[`&'] + scope: variable.language.regexp.match.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # note: `*` may look like an operator + - match: ([$@%]#?)(?:[-+]|[1-9]+) + scope: variable.language.regexp.match-group.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # builtin + - match: ([$@%*]#?){{builtin_variables}} + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + - match: |- + (?x: + ([$@%*]\#?) + (?: + \^[A-Z]? | + [".:,;\]~?!/\\|()<>] | + [$@%](?![-+]) # no regexp match + )(?![$@%\w]) + ) + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # builtin variable, which may look like an operator + - match: ([$@]\#?)= + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # user defined variables + - match: ([$@%*]#?){{identifier}} + scope: variable.other.readwrite.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # deprecated/legacy variables + # - $# and $* were variables up to Perl v5.10.0 + - match: (\$)[#*\[](?=[^\w{$@%*]) + scope: variable.language.deprecated.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # dereferenced variables (without `&`) + - match: ([$@%*]#?)(\{)\s*({{identifier}})\s*(\}) + scope: meta.variable.perl + captures: + 1: keyword.operator.dereference.perl + 2: punctuation.definition.variable.begin.perl + 3: meta.string.perl string.unquoted.perl + 4: punctuation.definition.variable.end.perl + pop: true + - match: ([$@%*]#?)(\{) + captures: + 1: keyword.operator.dereference.perl + 2: punctuation.definition.variable.begin.perl + set: [variable-body, expressions-begin] + # nothing matches, give up + - include: immediately-pop + +###[ VARIABLES ]############################################################## + + qualified-variables: + - match: ([$@%*]#?)({{identifier}})?(::) + captures: + 1: punctuation.definition.variable.perl + 2: variable.namespace.perl + 3: punctuation.accessor.double-colon.perl + push: [maybe-item-access, qualified-variables-path] + + qualified-variables-path: + - meta_scope: meta.path.perl + - include: qualifier + - include: variable-identifier + - include: unqualified-variables + - include: immediately-pop + + qualifier: + - match: ({{identifier}})?(::) + captures: + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl + + variable-identifier: + - match: '{{identifier}}' + scope: variable.other.readwrite.perl + pop: true + + unqualified-variables: + # SEE: https://perldoc.perl.org/perlvar.html + # regexp match + - match: ([$@%*]#?)[`&'] + scope: variable.language.regexp.match.perl + captures: + 1: punctuation.definition.variable.perl + push: maybe-item-access + # note: `*` may look like an operator + - match: ([$@%]#?)(?:[-+]|[1-9]+) + scope: variable.language.regexp.match-group.perl + captures: + 1: punctuation.definition.variable.perl + push: maybe-item-access + # builtin + - match: ([$@%*]#?){{builtin_variables}} + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + push: maybe-item-access + - match: |- + (?x: + ([$@%*]\#?) + (?: + \^[A-Z]? | + [".:,;\]~?!/\\|()<>] | + [$@%](?![-+]) # no regexp match + )(?![$@%\w]) + ) + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + push: maybe-item-access + # builtin variable, which may look like an operator + - match: ([$@]\#?)= + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + push: maybe-item-access + # user defined variables + - match: ([$@%*]#?){{identifier}} + scope: variable.other.readwrite.perl + captures: + 1: punctuation.definition.variable.perl + push: maybe-item-access + # deprecated/legacy variables + # - $# and $* were variables up to Perl v5.10.0 + - match: (\$)[#*\[](?=[^\w{$@%*]) + scope: variable.language.deprecated.perl + captures: + 1: punctuation.definition.variable.perl + push: maybe-item-access + # dereferenced variables + - match: ([$@%*&]#?)(\{)\s*({{identifier}})\s*(\}) + scope: meta.variable.perl + captures: + 1: keyword.operator.dereference.perl + 2: punctuation.definition.variable.begin.perl + 3: meta.string.perl string.unquoted.perl + 4: punctuation.definition.variable.end.perl + push: maybe-item-access + - match: ([$@%*&]#?)(\{) + captures: + 1: keyword.operator.dereference.perl + 2: punctuation.definition.variable.begin.perl + push: [maybe-item-access, variable-body, expressions-begin] + - match: '[$@%&]#?(?=[\w$@%*]|::)' + scope: keyword.operator.dereference.perl + push: function-identifier + + variable-not-operator: + # variables that look like operators need special treatment + - match: (\*#?)(?:[-+]|[1-9]+) + scope: variable.language.regexp.match-group.perl + captures: + 1: punctuation.definition.variable.perl + set: maybe-item-access + - match: ([%*])= + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + set: maybe-item-access + + variable-body: + - meta_scope: meta.variable.perl + - match: \} + scope: punctuation.definition.variable.end.perl + pop: true + - include: expressions-nested + + maybe-item-access: + # SEE: https://perldoc.perl.org/perllol.html + - match: \[ + scope: punctuation.section.item-access.begin.perl + push: + - - meta_scope: meta.item-access.perl + - match: \] + scope: punctuation.section.item-access.end.perl + pop: true + - include: expressions-nested + - expressions-begin + - match: (\{)\s*({{identifier}})\s*(\}) + scope: meta.item-access.perl + captures: + 1: punctuation.section.item-access.begin.perl + 2: constant.other.key.perl + 3: punctuation.section.item-access.end.perl + - match: \{ + scope: punctuation.section.item-access.begin.perl + push: + - - meta_scope: meta.item-access.perl + - match: \} + scope: punctuation.section.item-access.end.perl + pop: true + - include: expressions-nested + - expressions-begin + - include: immediately-pop diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-if-(if).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-if-(if).sublime-snippet new file mode 100644 index 000000000..f3df755a5 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-if-(if).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[if ($1) { + ${2:# body...} +} +]]></content> + <tabTrigger>if</tabTrigger> + <scope>source.perl</scope> + <description>if.. Conditional</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-if..else-(ife).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-if..else-(ife).sublime-snippet new file mode 100644 index 000000000..58f4f9fac --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-if..else-(ife).sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <content><![CDATA[if ($1) { + ${2:# body...} +} else { + ${3:# else...} +} +]]></content> + <tabTrigger>ife</tabTrigger> + <scope>source.perl</scope> + <description>if..else.. Conditional</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-if..elsif..else-(ifee).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-if..elsif..else-(ifee).sublime-snippet new file mode 100644 index 000000000..4f3da11c7 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-if..elsif..else-(ifee).sublime-snippet @@ -0,0 +1,13 @@ +<snippet> + <content><![CDATA[if ($1) { + ${2:# body...} +} elsif ($3) { + ${4:# elsif...} +} else { + ${5:# else...} +} +]]></content> + <tabTrigger>ifee</tabTrigger> + <scope>source.perl</scope> + <description>if..elsif..else.. Conditional</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-one-line-(xif).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-one-line-(xif).sublime-snippet new file mode 100644 index 000000000..f699ffa58 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-one-line-(xif).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[${1:expression} if ${2:condition}; +]]></content> + <tabTrigger>xif</tabTrigger> + <scope>source.perl</scope> + <description>if.. Conditional One-line</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-one-line-(xunless).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-one-line-(xunless).sublime-snippet new file mode 100644 index 000000000..ab0e8c5e8 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-one-line-(xunless).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[${1:expression} unless ${2:condition}; +]]></content> + <tabTrigger>xunless</tabTrigger> + <scope>source.perl</scope> + <description>unless. Conditional One-line</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-one-line-(xwhen).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-one-line-(xwhen).sublime-snippet new file mode 100644 index 000000000..4c0fc5b59 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-one-line-(xwhen).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[${1:expression} when ${2:condition}; +]]></content> + <tabTrigger>xwhen</tabTrigger> + <scope>source.perl</scope> + <description>when.. Conditional One-line</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-unless-(unless).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-unless-(unless).sublime-snippet new file mode 100644 index 000000000..d3581de51 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-unless-(unless).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[unless ($1) { + ${2:# body...} +} +]]></content> + <tabTrigger>unless</tabTrigger> + <scope>source.perl</scope> + <description>unless.. Conditional</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-unless..else-(unlesse).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-unless..else-(unlesse).sublime-snippet new file mode 100644 index 000000000..8e3788c9b --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-unless..else-(unlesse).sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <content><![CDATA[unless ($1) { + ${2:# body...} +} else { + ${3:# else...} +} +]]></content> + <tabTrigger>unlesse</tabTrigger> + <scope>source.perl</scope> + <description>unless..else.. Conditional</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-unless..elsif..else-(unlessee).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-unless..elsif..else-(unlessee).sublime-snippet new file mode 100644 index 000000000..0099a6bf7 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-unless..elsif..else-(unlessee).sublime-snippet @@ -0,0 +1,13 @@ +<snippet> + <content><![CDATA[unless ($1) { + ${2:# body...} +} elsif ($3) { + ${4:# elsif...} +} else { + ${5:# else...} +} +]]></content> + <tabTrigger>unlessee</tabTrigger> + <scope>source.perl</scope> + <description>unless..elsif..else.. Conditional</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Conditional-when-(when).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Conditional-when-(when).sublime-snippet new file mode 100644 index 000000000..cc1cce264 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Conditional-when-(when).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[when ($1) { + ${2:# body...} +} +]]></content> + <tabTrigger>when</tabTrigger> + <scope>source.perl</scope> + <description>when.. Conditional</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Function-(sub).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Function-(sub).sublime-snippet new file mode 100644 index 000000000..c9485a943 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Function-(sub).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[sub ${1:function_name} { + ${2:# body...} +} +]]></content> + <tabTrigger>sub</tabTrigger> + <scope>source.perl</scope> + <description>Function</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Loop-for-(for).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Loop-for-(for).sublime-snippet new file mode 100644 index 000000000..be880eba6 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Loop-for-(for).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[for (my \$${1:var} = 0; \$$1 < ${2:expression}; \$$1++) { + ${3:# body...} +} +]]></content> + <tabTrigger>for</tabTrigger> + <scope>source.perl</scope> + <description>for.. Loop</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Loop-foreach-(fore).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Loop-foreach-(fore).sublime-snippet new file mode 100644 index 000000000..73912757b --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Loop-foreach-(fore).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[foreach ${1:my \$${2:x}} (@${3:array}) { + ${4:# body...} +} +]]></content> + <tabTrigger>fore</tabTrigger> + <scope>source.perl</scope> + <description>foreach.. Loop</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xfor).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xfor).sublime-snippet new file mode 100644 index 000000000..60ff5ea29 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xfor).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[${1:expression} for @${2:array}; +]]></content> + <tabTrigger>xfor</tabTrigger> + <scope>source.perl</scope> + <description>for.. Loop One-line</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xfore).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xfore).sublime-snippet new file mode 100644 index 000000000..010a48a05 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xfore).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[${1:expression} foreach @${2:array}; +]]></content> + <tabTrigger>xfore</tabTrigger> + <scope>source.perl</scope> + <description>foreach.. Loop One-line</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xuntil).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xuntil).sublime-snippet new file mode 100644 index 000000000..52f5e04a5 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xuntil).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[${1:expression} until ${2:condition}; +]]></content> + <tabTrigger>xuntil</tabTrigger> + <scope>source.perl</scope> + <description>until.. Loop One-line</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xwhile).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xwhile).sublime-snippet new file mode 100644 index 000000000..d54c44a72 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Loop-one-line-(xwhile).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[${1:expression} while ${2:condition}; +]]></content> + <tabTrigger>xwhile</tabTrigger> + <scope>source.perl</scope> + <description>while.. Loop One-line</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Loop-while-(while).sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Loop-while-(while).sublime-snippet new file mode 100644 index 000000000..853a97d53 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Loop-while-(while).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[while ($1) { + ${2:# body...} +} +]]></content> + <tabTrigger>while</tabTrigger> + <scope>source.perl</scope> + <description>while.. Loop</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/Test.sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/Test.sublime-snippet new file mode 100644 index 000000000..eb69f5b2c --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/Test.sublime-snippet @@ -0,0 +1,13 @@ +<snippet> + <content><![CDATA[#!/usr/bin/perl -w + +use strict; +use Test::More tests => ${1:1}; +use ${2:ModuleName}; + +ok(${3:assertion}); +]]></content> + <tabTrigger>test</tabTrigger> + <scope>source.perl</scope> + <description>Test</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/class.sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/class.sublime-snippet new file mode 100644 index 000000000..a17784067 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/class.sublime-snippet @@ -0,0 +1,18 @@ +<snippet> + <content><![CDATA[package ${1:ClassName}; + +${2:use base qw(${3:ParentClass}); + +}sub new { + my \$class = shift; + \$class = ref \$class if ref \$class; + my \$self = bless {}, \$class; + \$self; +} + +1; +]]></content> + <tabTrigger>class</tabTrigger> + <scope>source.perl</scope> + <description>Package</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/eval.sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/eval.sublime-snippet new file mode 100644 index 000000000..6d01fc3b0 --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/eval.sublime-snippet @@ -0,0 +1,12 @@ +<snippet> + <content><![CDATA[eval { + ${1:# do something risky...} +}; +if (\$@) { + ${2:# handle failure...} +} +]]></content> + <tabTrigger>eval</tabTrigger> + <scope>source.perl</scope> + <description>Try/Except</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/Snippets/slurp.sublime-snippet b/assets/syntaxes/Packages/Perl/Snippets/slurp.sublime-snippet new file mode 100644 index 000000000..d65ba973c --- /dev/null +++ b/assets/syntaxes/Packages/Perl/Snippets/slurp.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[my \$${1:var}; +{ local \$/ = undef; local *FILE; open FILE, "<${2:file}"; \$$1 = <FILE>; close FILE } +]]></content> + <tabTrigger>slurp</tabTrigger> + <scope>source.perl</scope> + <description>Read File</description> +</snippet> diff --git a/assets/syntaxes/Packages/Perl/syntax_test_perl.pl b/assets/syntaxes/Packages/Perl/syntax_test_perl.pl new file mode 100644 index 000000000..d35e2107c --- /dev/null +++ b/assets/syntaxes/Packages/Perl/syntax_test_perl.pl @@ -0,0 +1,5346 @@ +# SYNTAX TEST "Perl.sublime-syntax" + +# comment ; still in here +# ^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.perl +# ^ - punctuation + +###[ POD TESTS ] ############################################################# + +=pod +# <- meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl +=encoding utf8 +# <- meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl +#^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl +#^^^^^^^^ entity.name.tag.pod.perl +# ^^^^ markup.heading.perl +=head1 B<--param> +# <- meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl +#^^^^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl +#^^^^^ entity.name.tag.pod.perl +# ^^^^^^^^^^ markup.heading.perl +# ^ entity.name.tag.bold.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^^ markup.bold.perl +# ^ punctuation.definition.tag.end.perl + B<bold> +# ^^^^^^^ meta.comment.perl comment.block.documentation.perl +# ^ entity.name.tag.bold.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^ markup.bold.perl +# ^ punctuation.definition.tag.end.perl + C<code> +# ^^^^^^^ meta.comment.perl comment.block.documentation.perl +# ^ entity.name.tag.code.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^ markup.quote.perl +# ^ punctuation.definition.tag.end.perl + E<lt> +# ^^^^^ meta.comment.perl comment.block.documentation.perl +# ^ entity.name.tag.escaped.perl +# ^ punctuation.definition.tag.begin.perl +# ^^ constant.character.escape.perl +# ^ punctuation.definition.tag.end.perl + F<file.ext> +# ^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl +# ^ entity.name.tag.filename.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^^^ meta.string.perl string.unquoted.perl +# ^ punctuation.definition.tag.end.perl + I<italic> +# ^^^^^^^^^ meta.comment.perl comment.block.documentation.perl +# ^ entity.name.tag.italic.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^ markup.italic.perl +# ^ punctuation.definition.tag.end.perl + + L<http://www.perl.org/> +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl +# ^ entity.name.tag.link.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^^^^^^^^^^^^^^^ markup.underline.link.perl +# ^ punctuation.definition.tag.end.perl + L<The Perl Home Page|http://www.perl.org/> +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl +# ^ entity.name.tag.link.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.perl +# ^ punctuation.definition.tag.end.perl + S<[ B<-A> ]> +# ^ entity.name.tag.none-braeking.perl +# ^ punctuation.definition.tag.begin.perl +# ^ entity.name.tag.bold.perl +# ^ punctuation.definition.tag.begin.perl +# ^^ markup.bold.perl +# ^ punctuation.definition.tag.end.perl +# ^ punctuation.definition.tag.end.perl + X<index entry> +# ^^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl +# ^ entity.name.tag.index.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^^^^^^ entity.name.label.perl +# ^ punctuation.definition.tag.end.perl + Copyright 2018 E<lt>email@provider.comE<gt> +# ^ entity.name.tag.escaped.perl +# ^ entity.name.tag.escaped.perl + +=begin css +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^^^^^^^^ meta.comment.perl meta.interpolation.perl +#^^^^^ entity.name.tag.pod.perl +# ^ - constant - entity +# ^^^ constant.other.language-name.css.perl + a { }; +# ^^^^^^^ meta.comment.perl meta.interpolation.perl source.css.embedded.perl source.css +=end +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl + +=begin html +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^^^^^^^^ meta.comment.perl meta.interpolation.perl +#^^^^^ entity.name.tag.pod.perl +# ^ - constant - entity +# ^^^^ constant.other.language-name.html.perl + <html> +# <- meta.comment.perl meta.interpolation.perl text.html.embedded.perl +#^^^^^^^^^ meta.comment.perl meta.interpolation.perl text.html.embedded.perl + </html> +# <- meta.comment.perl meta.interpolation.perl text.html.embedded.perl +#^^^^^^^^^ meta.comment.perl meta.interpolation.perl text.html.embedded.perl +=end +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl + +=begin json +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^^^^^^^^ meta.comment.perl meta.interpolation.perl +#^^^^^ entity.name.tag.pod.perl +# ^ - constant - entity +# ^^^^ constant.other.language-name.json.perl + { +# ^ meta.comment.perl meta.interpolation.perl source.json.embedded.perl source.json + "key": "value", +# ^^^^^^^^^^^^^^^ meta.comment.perl meta.interpolation.perl source.json.embedded.perl source.json + } +# ^ meta.comment.perl meta.interpolation.perl source.json.embedded.perl source.json +=end +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl + +=begin sql +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^^^^^^^^ meta.comment.perl meta.interpolation.perl +#^^^^^ entity.name.tag.pod.perl +# ^ - constant - entity +# ^^^ constant.other.language-name.sql.perl + SELECT * FROM `table` +# ^^^^^^^^^^^^^^^^^^^^^ meta.comment.perl meta.interpolation.perl source.sql.embedded.perl source.sql +=end +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl + +=cut +# <- meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl + +###[ FORMAT ]################################################################# + +format. +#^^^^^ meta.format.perl storage.type.format.perl +# ^ meta.format.perl invalid.illegal.identifier.perl + +format = +#^^^^^ meta.format.perl storage.type.format.perl +# ^ meta.format.perl keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +format +#^^^^^ meta.format.perl storage.type.format.perl + = +# ^ meta.format.perl keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +format format +#^^^^^ meta.format.perl storage.type.format.perl +# ^^^^^^ meta.format.perl variable.other.readwrite.perl +illegal +#^^^^^^ meta.format.perl invalid.illegal.identifier.perl + +format format = +#^^^^^ meta.format.perl storage.type.format.perl +# ^^^^^^ meta.format.perl variable.other.readwrite.perl +# ^ meta.format.perl keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +format +#^^^^^ meta.format.perl storage.type.format.perl + format +# ^^^^^^ meta.format.perl variable.other.readwrite.perl + = +# ^ meta.format.perl keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +format if::format = +#^^^^^^^^^^^^^^^^^^^ meta.format.perl +#^^^^^ storage.type.format.perl +# ^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^^^^^ meta.path.perl variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +CORE::format if::format = +#^^^ variable.namespace.perl - meta.format +# ^^^^^^^^^^^^^^^^^^^^ meta.format.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^ storage.type.format.perl +# ^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^^^^^ meta.path.perl variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +core::format +# ^^^^^^ - storage.type.format.perl +format::func +#^^^^^ - storage.type.format.perl +format $var = +#^^^^^^^^^^ meta.format.perl +# ^^ - meta.format.perl +# ^^^^ invalid.illegal.identifier.perl +# ^ keyword.operator.assignment.perl +format var[0] = +#^^^^^^^^^^^^ meta.format.perl +# ^^ - meta.format.perl +# ^^^ variable.other.readwrite.perl +# ^^^ invalid.illegal.identifier.perl +# ^ keyword.operator.assignment.perl +format ns::$ns::var = +#^^^^^^^^^^^^^^^^^^ meta.format.perl +# ^^ - meta.format.perl +# ^^ variable.namespace.perl +# ^^^^^^^^ invalid.illegal.identifier.perl +# ^ keyword.operator.assignment.perl +format var = +# <- storage.type.format.perl +#^^^^^ meta.format.perl storage.type.format.perl +# ^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl + ... terminate a text field, show "..." as truncation evidence +#^ meta.string.perl string.unquoted.perl - constant +# ^^^ meta.string.perl string.unquoted.perl constant.other.placeholder.text.perl +# ^ meta.string.perl string.unquoted.perl - constant + .... +#^^^^^^ meta.string.perl string.unquoted.perl - constant + ~ suppress line with all fields empty +#^ meta.string.perl string.unquoted.perl - constant +# ^ meta.string.perl string.unquoted.perl constant.other.placeholder.text.perl +# ^ meta.string.perl string.unquoted.perl - constant + ~~ repeat line until all fields are exhausted +#^ meta.string.perl string.unquoted.perl - constant +# ^^ meta.string.perl string.unquoted.perl constant.other.placeholder.text.perl +# ^ meta.string.perl string.unquoted.perl - constant + ~~~~ +#^^^^^^ meta.string.perl string.unquoted.perl - constant + ^0.### +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + ^0##.# +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + ^#.### +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + ^<<<<< ^||||| ^>>>>> +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + @#.### @0.### @0##.# +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + @<<<<< @||||| @>>>>> +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + ^* variable width field for next line of a multi-line value +#^ meta.string.perl string.unquoted.perl - constant +# ^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + @* variable width field for a multi-line value +# ^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + @variable as test @array[0] @noarray [0] +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string.unquoted +# ^^^^^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^ meta.string.perl meta.interpolation.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^ meta.string.perl meta.interpolation.perl - string.unquoted +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^ punctuation.definition.variable.perl + $& $&[0] $&{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $` $`[0] $`{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $' $'[0] $'{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $+ $+[0] $+{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $" $"[0] $"{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $0 $0[0] $0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + @0 @0[0] @0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + %0 %0[0] %0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $1 $1[0] $1{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $_ $_[0] $_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + @_ @_[0] @_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + %_ %_[0] %_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $#0 $#0[0] $#0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + @#0 @#0[0] @#0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + %#0 %#0[0] %#0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $#_ $#_[0] $#_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + @#_ @#_[0] @#_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + %#_ %#_[0] %#_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $Foo::Bar::baz $Foo::Bar::baz[0] $Foo::Bar::baz{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^^^^^^ meta.string.perl meta.path.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^^^^^^ meta.string.perl meta.path.perl +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^^^^^^ meta.string.perl meta.path.perl +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + ${ $foo[4] + $bar{baz} }[0]{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl meta.variable.perl +# ^^^^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +. +# <- meta.format.perl punctuation.terminator.format.perl + +###[ SPRINTF FORMAT ]######################################################### + + "%<index>?<flag>?<width>?[<vector>|<precicion>]<size>?<sequence> + + # sequences + + %% a percent sign +# ^^ constant.character.escape.perl + + %c %s %d %u %o %x %e %f %g %i +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + + %X %E %G %b %B %p %n %a %A %F +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + + %D = %ld %U = %lu %O = %lo %F = %f +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^^^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^^^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^^^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^^^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl + + # flags + + % d %+d %+ d % +d +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %*s %6s %-6s %06s %*2$s %10.5s +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder + %#o %#O +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %#x %#X +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %#b %#B +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + + # vector flag + + v%vd +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %0*v8b +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %*4$vX +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + + # precicion + + %#.5o +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder + + %f %.1f %.0f %e %0.1e +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder + + %-10.6d %#.6x %010.6x %6.*2$x +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder + + # placeholder with interpolation (good luck!) +" + +###[ HEREDOC ]################################################################ + +$var = <<CSS; +# <- variable.other.readwrite.perl +#^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.css.perl +# ^ punctuation.terminator.statement.perl +# ^ - source.css.embedded.perl + a { }; +# ^^^^^^^ meta.string.heredoc.perl source.css.embedded.perl source.css +CSS +# <- meta.string.heredoc.perl entity.name.tag.heredoc.css.perl +#^^ meta.string.heredoc.perl entity.name.tag.heredoc.css.perl + +$var = <<HTML; +# <- variable.other.readwrite.perl +#^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.html.perl +# ^ punctuation.terminator.statement.perl +# ^ - source.html.embedded.perl + <div /> +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl +HTML +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl + +$var = <<'HTML'; +# <- variable.other.readwrite.perl +#^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^ meta.tag.heredoc.perl +# ^^^^ entity.name.tag.heredoc.html.perl +# ^ punctuation.definition.tag.end.perl +# ^ punctuation.terminator.statement.perl +# ^ - source.html.embedded.perl + <div /> +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl +HTML +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl + +$var = <<"HTML"; +# <- variable.other.readwrite.perl +#^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^ meta.tag.heredoc.perl +# ^^^^ entity.name.tag.heredoc.html.perl +# ^ punctuation.definition.tag.end.perl +# ^ punctuation.terminator.statement.perl +# ^ - source.html.embedded.perl + <div /> +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl +HTML +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl + +$var ? <<HTML : <<HTML; +# <- variable.other.readwrite.perl +#^^^ variable.other.readwrite.perl +# ^ keyword.operator.logical.perl +# ^^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.html.perl +# ^ keyword.operator.logical.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.html.perl +# ^ punctuation.terminator.statement.perl +# ^ - source.html.embedded.perl + <div /> +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl +HTML +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +# ^ - source.html.embedded.perl + <div /> +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl + HTML +# ^^^^ meta.string.heredoc.perl text.html.embedded.perl - constant.other.language-name.html.perl +HTML +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +# ^ - meta.string.heredoc.perl +HTML +# <- constant.other.perl +#^^^ constant.other.perl + +$var = <<JAVASCRIPT; +# <- variable.other.readwrite.perl punctuation.definition.variable.perl +#^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^^^^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.js.perl +# ^ - source.js.embedded.perl + var basic; +# <- meta.string.heredoc.perl source.js.embedded.perl source.js +# ^^^ meta.string.heredoc.perl source.js.embedded.perl source.js storage.type.js +JAVASCRIPT +# <- meta.string.heredoc.perl entity.name.tag.heredoc.js.perl +#^^^^^^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.js.perl + +$var = <<JSON; +# ^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.json.perl +# ^ punctuation.terminator.statement.perl +# ^ - source.json.embedded.perl +JSON +# <- meta.string.heredoc.perl entity.name.tag.heredoc.json.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.json.perl + +$var = <<SQL; +# ^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.sql.perl +# ^ punctuation.terminator.statement.perl +# ^ - source.sql.embedded.perl + SELECT * FROM `table` +# ^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl source.sql.embedded.perl +SQL +# <- meta.string.heredoc.perl entity.name.tag.heredoc.sql.perl +#^^ meta.string.heredoc.perl entity.name.tag.heredoc.sql.perl + +$var = <<XML; +# ^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.xml.perl +# ^ punctuation.terminator.statement.perl +# ^ - source.xml.embedded.perl + <t:tag></t:tag> +# ^^^^^^^^^^^^^^^ meta.string.heredoc.perl text.xml.embedded.perl +XML +# <- meta.string.heredoc.perl entity.name.tag.heredoc.xml.perl +#^^ meta.string.heredoc.perl entity.name.tag.heredoc.xml.perl + +$var = <<_EOD_; +# ^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.plain.perl +# ^ punctuation.terminator.statement.perl +# ^ - string.unquoted.heredoc.perl +HEREDOC \$with _&a_$var interpolation. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl +#^^^^^^^^^^^^^^^^^^ string.unquoted.heredoc.perl - meta.interpolation +# ^^ constant.character.escape.perl +# ^^^^ meta.interpolation.perl - string +# ^^^^^^^^^^^^^^^ string.unquoted.heredoc.perl - meta.interpolation +_EOD_ +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + +$var = << _EOD_ +# ^^^^^^^^^ - meta.string.heredoc +# ^^ keyword.operator.bitwise.perl +# ^^^^^ constant.other.perl + +$var = << ' _EOD_'; +# ^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^^^^^^ meta.tag.heredoc.perl +# ^^^^^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.definition.tag.end.perl +# ^ punctuation.terminator.statement.perl +# ^ - string.unquoted.heredoc.perl +HEREDOC \$without $var interpolation. +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl + _EOD_ +# ^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl + _EOD_ +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + +$var = << " _EOD_"; +# ^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^^^^^^ meta.tag.heredoc.perl +# ^^^^^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.definition.tag.end.perl +# ^ punctuation.terminator.statement.perl +# ^ - string.unquoted.heredoc.perl +HEREDOC \$with $var interpolation. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl +#^^^^^^^^^^^^^^ string.unquoted.heredoc - meta.interpolation +# ^^ constant.character.escape.perl +# ^^^^ meta.interpolation.perl - string +# ^^^^^^^^^^^^^^^ string.unquoted.heredoc - meta.interpolation + _EOD_ +# ^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl + _EOD_ +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + +$var = <<EOF # comment +# no comment +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl - comment +#^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl - comment +EOF + +$var = <<'EOF' # comment +# no comment +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl - comment +#^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl - comment +EOF + +$var = <<"EOF" # comment +# no comment +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl - comment +#^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl - comment +EOF + +chomp (my $common_end = <<"EOF") =~ s/(.*)/$1/g if $opt_o; +# <- support.function.perl +#^^^^ support.function.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^ keyword.operator.binary.perl + foo bar baz +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +# ^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl +EOF +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + +$var ? <<'EOT' : <<'EOT'; +# <- variable.other.readwrite.perl +#^^^ variable.other.readwrite.perl +# ^ keyword.operator.logical.perl +# ^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^ entity.name.tag.heredoc.plain.perl +# ^ keyword.operator.logical.perl +# ^^ keyword.operator.heredoc.perl +# ^^^ entity.name.tag.heredoc.plain.perl +# ^punctuation.terminator.statement.perl + foo bar baz +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +# ^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl +EOT +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + foo bar baz +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +# ^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl +EOT +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + +# MUST NOT BE HEREDOC + (1 << 0) ; +# ^^^^^^^ - meta.string.heredoc.perl +# ^^ - keyword.operator.heredoc.perl + (1 << $var) ; +# ^^^^^^^^^^ - meta.string.heredoc.perl +# ^^ - keyword.operator.heredoc.perl + +###[ OPERATORS ]############################################################## + , +# ^ punctuation.separator.sequence.perl + ; +# ^ punctuation.terminator.statement.perl + :: +# ^^ punctuation.accessor.double-colon.perl + -> +# ^^ punctuation.accessor.arrow.perl + **= +# ^^^ keyword.operator.assignment.perl + -= +# ^^ keyword.operator.assignment.perl + += +# ^^ keyword.operator.assignment.perl + *= +# ^^ keyword.operator.assignment.perl + /= +# ^^ keyword.operator.assignment.perl + %= +# ^^ keyword.operator.assignment.perl + -- +# ^^ keyword.operator.arithmetic.perl + ++ +# ^^ keyword.operator.arithmetic.perl + ** +# ^^ keyword.operator.arithmetic.perl + / +# ^ keyword.operator.arithmetic.perl + % +# ^ keyword.operator.arithmetic.perl + !~ +# ^^ keyword.operator.binary.perl + =~ +# ^^ keyword.operator.binary.perl + ~~ +# ^^ keyword.operator.binary.perl + <=> +# ^^^ keyword.operator.comparison.perl + // +# ^^ keyword.operator.logical.perl + && +# ^^ keyword.operator.logical.perl + || +# ^^ keyword.operator.logical.perl + == +# ^^ keyword.operator.comparison.perl + != +# ^^ keyword.operator.comparison.perl + >= +# ^^ keyword.operator.comparison.perl + <= +# ^^ keyword.operator.comparison.perl + > +# ^ keyword.operator.comparison.perl + < +# ^ keyword.operator.comparison.perl + ! +# ^ keyword.operator.logical.perl + ? +# ^ keyword.operator.logical.perl + : +# ^ keyword.operator.logical.perl + & +# ^ keyword.operator.bitwise.perl + | +# ^ keyword.operator.bitwise.perl + ^ +# ^ keyword.operator.bitwise.perl + ~ +# ^ keyword.operator.bitwise.perl + . +# ^ keyword.operator.concat.perl + .= +# ^^ keyword.operator.concat.perl + .. +# ^^ keyword.operator.range.perl + \ \\ \\\ +# ^ keyword.operator.reference.perl +# ^^ keyword.operator.reference.perl +# ^^^ keyword.operator.reference.perl + + and or xor as cmp eq gt ge lt le ne not +#^ - keyword +# ^^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^^ keyword.operator.logical.perl +# ^ - keyword + + -f +# ^^ keyword.operator.filetest.perl + -foo +# ^^ - keyword.operator.filetest.perl + +###[ CONSTANTS ] ############################################################# + + 1234 # decimal integer +# ^^^^ constant.numeric.integer.decimal.perl + 12_4 # decimal integer +# ^^^^ constant.numeric.integer.decimal.perl + +1234 # decimal integer +# ^ keyword.operator.arithmetic.perl +# ^^^^ constant.numeric.integer.decimal.perl + + 1234 # decimal integer +# ^ keyword.operator.arithmetic.perl +# ^^^^ constant.numeric.integer.decimal.perl + 1234+ # decimal integer +# ^^^^ constant.numeric.integer.decimal.perl +# ^ keyword.operator.arithmetic.perl + -1234 # decimal integer +# ^ keyword.operator.arithmetic.perl +# ^^^^ constant.numeric.integer.decimal.perl + - 1234 # decimal integer +# ^ keyword.operator.arithmetic.perl +# ^^^^ constant.numeric.integer.decimal.perl + 1234- # decimal integer +# ^^^^ constant.numeric.integer.decimal.perl +# ^ keyword.operator.arithmetic.perl + 0B0 # binary integer +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation + 0b0 # binary integer +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation + -0b0 # binary integer +# ^ keyword.operator.arithmetic.perl +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation + 0b0- # binary integer +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation +# ^ keyword.operator.arithmetic.perl + 0b1.0b1 +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation +# ^ keyword.operator.concat.perl +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation + 0b11__011 # binary integer +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^^^^^^^ constant.numeric.integer.binary.perl - punctuation + 01_34 # octal integer +# ^ constant.numeric.integer.octal.perl punctuation.definition.numeric.octal.perl +# ^^^^ constant.numeric.integer.octal.perl - punctuation + -01234 # octal integer +# ^ keyword.operator.arithmetic.perl +# ^ constant.numeric.integer.octal.perl punctuation.definition.numeric.octal.perl +# ^^^^ constant.numeric.integer.octal.perl - punctuation + 012_4- # octal integer +# ^ constant.numeric.integer.octal.perl punctuation.definition.numeric.octal.perl +# ^^^^ constant.numeric.integer.octal.perl - punctuation +# ^ keyword.operator.arithmetic.perl + 0x_234 # hexadecimal integer +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^^^^ constant.numeric.integer.hexadecimal.perl - punctuation + 0X123_ # hexadecimal integer +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^^^^ constant.numeric.integer.hexadecimal.perl - punctuation + 0x9 # hexadecimal integer +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation + +0x9 # hexadecimal integer +# ^ keyword.operator.arithmetic.perl +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation + 0x9- # hexadecimal integer +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation +# ^ keyword.operator.arithmetic.perl + 0x9.0x10 # hexadecimal integer +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation +# ^ keyword.operator.concat.perl +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation + 01.1 # normal float +# ^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 1.1 # normal float +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + -1.1 # normal float +# ^ keyword.operator.arithmetic.perl +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 1.1- # normal float +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ keyword.operator.arithmetic.perl + .1 # normal float +# ^ punctuation.separator.decimal.perl +# ^^ constant.numeric.float.decimal.perl + -.1 # normal float +# ^ keyword.operator.arithmetic.perl +# ^ punctuation.separator.decimal.perl +# ^^ constant.numeric.float.decimal.perl + .1- # normal float +# ^ punctuation.separator.decimal.perl +# ^^ constant.numeric.float.decimal.perl +# ^ keyword.operator.arithmetic.perl + 1. # normal float +# ^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + -1. # normal float +# ^ keyword.operator.arithmetic.perl +# ^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 1.- # normal float +# ^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ keyword.operator.arithmetic.perl + 1e5 1E5 # exponential notation +# ^^^ constant.numeric.float.decimal.perl +# ^^^ constant.numeric.float.decimal.perl +# ^^^ constant.numeric.float.decimal.perl + -1e5 # exponential notation +# ^ keyword.operator.arithmetic.perl +# ^^^ constant.numeric.float.decimal.perl + 1e5- # exponential notation +# ^^^ constant.numeric.float.decimal.perl +# ^ keyword.operator.arithmetic.perl + 1.e5 # exponential notation +# ^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 12.34e56 # exponential notation +# ^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + _2._4E_6 # exponential notation +# ^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + -12.34e-56 # exponential notation +# ^ keyword.operator.arithmetic.perl +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + - 12.34e-56 # exponential notation +# ^ keyword.operator.arithmetic.perl +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 12.34e+56 # exponential notation +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 12.34e+56- # exponential notation +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ keyword.operator.arithmetic.perl + "12_4" # number specified as a string +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.numeric.integer.decimal.perl + "-1234" # number specified as a string +# ^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^ constant.numeric.integer.decimal.perl + "01234" # number specified as a string +# ^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^ constant.numeric.integer.decimal.perl - punctuation + "-01234" # number specified as a string +# ^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^^ constant.numeric.integer.decimal.perl - punctuation + "1.1" # normal float +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "-1.1" # normal float +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + ".1" # normal float +# ^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.separator.decimal.perl +# ^^ constant.numeric.float.decimal.perl + "-.1" # normal float +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "1." # normal float +# ^^^^ meta.string.perl string.quoted.double.perl +# ^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "-1." # normal float +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "1e5" # exponential notation +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^^ constant.numeric.float.decimal.perl + "-1e5" # exponential notation +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.numeric.float.decimal.perl + "1.e5" # exponential notation +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "12.34e56" # exponential notation +# ^^^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "-12.34e-56" # exponential notation +# ^^^^^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + '0.00_01' +# ^^^^^^^ constant.numeric.float.decimal.perl + '01bau' +# ^^^^^ - constant.numeric + __PACKAGE__ +# ^^^^^^^^^^^ constant.language.perl + __FILE__ +# ^^^^^^^^ constant.language.perl + __LINE__ +# ^^^^^^^^ constant.language.perl + __END__ +# ^^^^^^^ constant.language.perl + + # note: language constants keep their scope + ARGV +# ^^^^ constant.language.filehandle.perl + ARGV:: +# ^^^^ constant.language.filehandle.perl + ARGV->func +# ^^^^ constant.language.filehandle.perl + ARGV() +# ^^^^ constant.language.filehandle.perl + + # note: user constants adapt their scope + URI +# ^^^ constant.other.perl + URI:: +# ^^^ variable.namespace.perl + URI->func +# ^^^ variable.namespace.perl + URI() +# ^^^ variable.function.perl + +###[ STRINGS ]################################################################ + + "$" "@" "%" "*" "$repl$" "%repl%" +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.double.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.double.perl +# ^ meta.string.perl string.quoted.double.perl punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.double.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.double.perl +# ^ meta.string.perl string.quoted.double.perl punctuation.definition.string.end.perl +# ^ - meta.string - string + `$` `@` `%` `*` `$repl$` `%repl%` +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.backtick.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.backtick.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.backtick.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.backtick.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.backtick.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.backtick.perl +# ^ meta.string.perl string.quoted.backtick.perl punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.backtick.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.backtick.perl +# ^ meta.string.perl string.quoted.backtick.perl punctuation.definition.string.end.perl +# ^ - meta.string - string + <$>.<@>.<%>.<*>.<$repl$>.<%repl%> +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.angle.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.angle.perl +# ^ meta.string.perl string.quoted.angle.perl punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.angle.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.angle.perl +# ^ meta.string.perl string.quoted.angle.perl punctuation.definition.string.end.perl +# ^ - meta.string - string + "quoted \"interpolated\" foo 'bar' $baz $" +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.quoted.double.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl - string +# ^^^ meta.string.perl string.quoted.double.perl - meta.interpolation +# ^^ constant.character.escape.perl +# ^^ constant.character.escape.perl +# ^^^^ variable.other.readwrite.perl +# ^ - variable +# ^ punctuation.definition.string.end.perl + 'quoted "interpolated" foo \'bar\' $baz $' +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.quoted.single.perl +# ^^ constant.character.escape.perl +# ^^ constant.character.escape.perl +# ^^^^ - variable +# ^ - variable +# ^ punctuation.definition.string.end.perl + `quoted "interpolated" foo \`bar\` $baz $` +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.quoted.backtick.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl - string +# ^^^ meta.string.perl string.quoted.backtick.perl - meta.interpolation +# ^^ constant.character.escape.perl +# ^^ constant.character.escape.perl +# ^^^^ variable.other.readwrite.perl +# ^ - variable +# ^ punctuation.definition.string.end.perl + <=quoted < ${"interpolated" . @foo{bar}}> $baz\> $> > +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^ meta.string.perl string.quoted.angle.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl meta.variable.perl - string +# ^^^^^^^^^^^^^^ meta.string.perl meta.interpolation.perl meta.variable.perl meta.string.perl +# ^^^^^^^^ meta.string.perl meta.interpolation.perl meta.variable.perl - string +# ^^^^^ meta.item-access.perl +# ^^^ meta.string.perl meta.interpolation.perl meta.variable.perl meta.item-access.perl +# ^^ meta.string.perl meta.interpolation.perl meta.variable.perl - string +# ^^ meta.string.perl string.quoted.angle.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl - string +# ^^^^^ meta.string.perl string.quoted.angle.perl - meta.interpolation +# ^^^ - meta.string - string +# ^^ - keyword.operator +# ^ - punctuation +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^^ string.quoted.double.perl +# ^ keyword.operator.concat.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ - punctuation +# ^^^^ variable.other.readwrite.perl +# ^^ constant.character.escape.perl +# ^ - variable +# ^ punctuation.definition.string.end.perl +# ^ keyword.operator.comparison.perl + q/quoted "interpolated" foo 'bar' \/ $baz/ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ constant.character.escape.perl +# ^^^^ - variable +# ^ punctuation.section.generic.end.perl - string + q\quoted "interpolated" foo 'bar' / $baz\ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.perl +# ^^^^ - variable +# ^ punctuation.section.generic.end.perl - string + q{quoted "interpolated" {foo} 'bar' \/ $baz} +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.braces.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.braces.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl +# ^^ constant.character.escape.perl +# ^^^^ - variable +# ^ punctuation.section.braces.end.perl - string + q[quoted "interpolated" [foo] 'bar' \] $baz] +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.brackets.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.brackets.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl +# ^^ constant.character.escape.perl +# ^^^^ - variable +# ^ punctuation.section.brackets.end.perl - string + q<quoted "interpolated" <foo> 'bar' \> $baz> +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl +# ^^ constant.character.escape.perl +# ^^^^ - variable +# ^ punctuation.section.generic.end.perl - string + q(quoted "interpolated" [foo] 'bar' \] $baz) +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.parens.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.parens.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl +# ^^ constant.character.escape.perl +# ^^^^ - variable +# ^ punctuation.section.parens.end.perl - string + q[' +# ^ support.function.perl +# ^ punctuation.section.brackets.begin.perl - string +# ^^ string + string $novar +# ^^^^^^^^^^^^^ string + '] +# ^ string +# ^ punctuation.section.brackets.end.perl - string + q<' +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl - string +# ^^ string + string $novar +# ^^^^^^^^^^^^^ string + '> +# ^ string +# ^ punctuation.section.generic.end.perl - string + + qq/foo $bar $/; +# ^^^^^^^^^^^^^^ meta.function-call.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^ meta.string.perl string.unquoted.perl - variable +# ^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string +# ^^ meta.string.perl string.unquoted.perl - variable +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl + qx:foo $bar $:; +# ^^^^^^^^^^^^^^ meta.function-call.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^ meta.string.perl string.unquoted.perl - bariable +# ^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string +# ^^ meta.string.perl string.unquoted.perl - variable +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl + qw/foo $bar/; +# ^^^^^^^^^^ meta.function-call.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^ meta.string.perl string.unquoted.perl +# ^^^^ - variable +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl + + CORE::q// +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl + CORE::qq// +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl + CORE::qx// +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl + CORE::qw// +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl + +###[ REGEX ]################################################################## + + /[a-z]test\d{3}/g; +# ^ punctuation.section.generic.begin.perl - string.regexp - source.regexp +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl - string.regexp - source.regexp +# ^ constant.language.flags.regexp.perl + /[a-z]test\d{3}/g; +#^ punctuation.section.generic.begin.perl + ( /[a-z]test\d{3}/g ); +# ^ punctuation.section.generic.begin.perl - string.regexp - source.regexp +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl - string.regexp - source.regexp +# ^ constant.language.flags.regexp.perl + $@ = /[a-z]test\d{3}/g; +# ^ punctuation.section.generic.begin.perl - string.regexp - source.regexp +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl - string.regexp - source.regexp +# ^ constant.language.flags.regexp.perl + m{^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})/(\d+))}; # comment +# ^ support.function.perl - meta.braces +# ^ punctuation.section.braces.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.braces.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.braces.end.perl - string +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl + m(^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})/(\d+))); # comment +# ^ support.function.perl - meta.parens +# ^ punctuation.section.parens.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.parens.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.parens.end.perl - string +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl + m[^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})/(\d+))]; # comment +# ^ support.function.perl - meta.brackets +# ^ punctuation.section.brackets.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.brackets.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.brackets.end.perl - string +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl + m<^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})/(\d+))>; # comment +# ^ support.function.perl - meta.generic +# ^ punctuation.section.generic.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl - string +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl + m/^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})\/(\d+))/g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl + m\@pattern\g; # comment +# ^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl + CORE::m +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl + CORE::m//g +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + core::m +# ^^^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^ meta.path.perl variable.function.perl + m::core +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl +# ^^^^ constant.language.flags.regexp.perl + + s { +# ^^^^ meta.function-call.perl +# ^^ meta.braces.perl +# ^ support.function.perl +# ^ punctuation.section.braces.begin.perl + bar[a-z]{1,3} \/ .+ +# <- meta.function-call.perl meta.braces.perl meta.string.perl string.regexp.perl + } [repl $var]gx; # comment +# <- meta.function-call.perl meta.braces.perl meta.string.perl string.regexp.perl +#^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ meta.braces.perl punctuation.section.braces.end.perl +# ^^^^^^^^^^^ meta.brackets.perl +# ^ punctuation.section.brackets.begin.perl +# ^^^^^ meta.string.perl string.unquoted.perl +# ^^^^ meta.interpolation.perl variable.other.readwrite.perl +# ^ punctuation.section.brackets.end.perl +# ^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl + s {} + [repl @var]gx; # comment +# <- meta.function-call.perl +#^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^^^^^^^^ meta.brackets.perl +# ^ punctuation.section.brackets.begin.perl +# ^^^^^ meta.string.perl string.unquoted.perl +# ^^^^ meta.interpolation.perl variable.other.readwrite.perl +# ^ punctuation.section.brackets.end.perl +# ^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl + + # Even though the replacement looks like a valid script + # only variables are evaluated at this point. + s/L<(.*?)>/ +# ^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl + my($text,$page,$sect) = _split_pod_link($1); + defined $text + ? $text + : defined $sect + ? italic($sect) . ' in ' . italic($page) + : italic($page) +#^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^^ meta.string.perl string.unquoted.perl + /ges; +#^^^^^^ meta.function-call.perl +# ^ punctuation.section.generic.end.perl +# ^^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + + s/foo[a-z]{1,3} \/ .+/ bar $1 \/ %/g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl + s\foo[a-z]{1,3} / .+\ bar $1 / $\g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^^^^^ string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.unquoted.perl +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl +# ^^^ meta.function-call.perl meta.string.perl string.unquoted.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl + s#foo[a-z]{1,3} \# .+# bar $1 \# $#g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl + s;foo[a-z]{1,3} \; .+; bar $1 \; %;g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl + s!foo[a-z]{1,3} \! .+! bar $1 \! @!g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl + s:\\:/:; +# ^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^ meta.string.perl string.regexp.perl source.regexp constant.character.escape.regexp +# ^ punctuation.separator.sequence.perl +# ^ meta.string.perl string.unquoted.perl +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl + s:\\\\:/\\\\:; +# ^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^ meta.string.perl string.regexp.perl source.regexp constant.character.escape.regexp +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.unquoted.perl +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl + s/^\s+//; +# ^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl + $opt{s} +# ^ - support.function.perl + s///msixpodualngcer; +# ^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl +# ^^^^^^^^^^^^^^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + s@/\*.*?\*/@@g; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl - variable +# ^ punctuation.section.generic.end.perl - variable +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + s@/\*.*?\*/@\@@g; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl - variable +# ^^ meta.string.perl string.unquoted.perl constant.character.escape.perl +# ^ punctuation.section.generic.end.perl - variable +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + CORE::s +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl + CORE::s///g +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + core::s +# ^^^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^ meta.path.perl variable.function.perl + s::core:s +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ meta.string.perl string.unquoted.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + + tr/h-k/foo $bar baz/cdsr; +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string +# ^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^ punctuation.section.generic.end.perl +# ^^^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + CORE::tr +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl + CORE::tr///g +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + core::tr +# ^^^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^ meta.path.perl variable.function.perl + tr::core:s +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ meta.string.perl string.unquoted.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + + y/\x68-k/\foo $bar baz/cdsr; +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string +# ^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^ punctuation.section.generic.end.perl +# ^^^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + CORE::y +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl + CORE::y///g +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + core::y +# ^^^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^ meta.path.perl variable.function.perl + y::core:s +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ meta.string.perl string.unquoted.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + +###[ REGEXP PATTERN ESCAPES ]################################################# + + /c:\\folder/i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + /c:\\folder\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + /c:\\folder\\/i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + /c:\\folder\\\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + m/c:\\folder/i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + m/c:\\folder\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + m/c:\\folder\\/i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + m/c:\\folder\\\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + s/c:\\folder//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl + s/c:\\folder\///i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl + s/c:\\folder\\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl + s/c:\\folder\\\///i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl + +###[ REGEXP FLAGS ]########################################################### + + /^<pattern>$/g; +# ^ constant.language.flags.regexp.perl + /^<pattern>$/ g; +# ^ - constant.language.flags.regexp.perl + m/^<pattern>$/g; +# ^ constant.language.flags.regexp.perl + m/^<pattern>$/ g; +# ^ - constant.language.flags.regexp.perl + m{^<pattern>$}g; +# ^ constant.language.flags.regexp.perl + m{^<pattern>$} g; +# ^ - constant.language.flags.regexp.perl + m<^[pattern]$>g; +# ^ constant.language.flags.regexp.perl + m<^[pattern]$> g; +# ^ - constant.language.flags.regexp.perl + s/<pattern>/<repl>/g; +# ^ constant.language.flags.regexp.perl + s/<pattern>/<repl>/ g; +# ^ - constant.language.flags.regexp.perl + s[<pattern>] [<repl>]g; +# ^ constant.language.flags.regexp.perl + s[<pattern>] [<repl>] g; +# ^ - constant.language.flags.regexp.perl + +###[ LANGUAGE VARIABLES ]##################################################### + +# Special Variables + + $_ $#_ $ARG $_[0] $_{'key'} $#_[0] $#_{'key'} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl + @_ @#_ @ARG @_[0] @_{'key'} @#_[0] @#_{'key'} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl + %_ %#_ %ARG %_[0] %_{'key'} %#_[0] %#_{'key'} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl + *_ *ARG *_[0] *_{'key'} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl + $" $LIST_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^ variable.language.perl + $$ $PID $PROCESS_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^ variable.language.perl + $0 $PROGRAM_NAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $( $GID $REAL_GROUP_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $) $EGID $EFFECTIVE_GROUP_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $< $UID $REAL_USER_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $> $EUID $EFFECTIVE_USER_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $; $SUBSEP $SUBSCRIPT_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $@; +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $a +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $b +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + %ENV $ENV{'bar'} +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl + $] $OLD_PERL_VERSION +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $^F $SYSTEM_FD_MAX +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + @F # array of fields of each line with autosplit mode on +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + %INC +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl + $^I $INPLACE_EDIT +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + @ISA # list of that class's parent classes +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl + $^O $OSNAME +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl + %SIG $SIG{"PIPE"} # hash of signal handlers for signals +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl + $^O $OSNAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $^V $PERL_VERSION +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $^X $EXECUTABLE_NAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + +# Variables related to regular expressions + + $& $MATCH $&[0] +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match.perl +# ^^^ meta.item-access.perl + $` $PREMATCH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match.perl + $' $POSTMATCH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match.perl + $+ $LAST_PAREN_MATCH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + @+ @LAST_MATCH_END +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + %+ %LAST_PAREN_MATCH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + $- $LAST_MATCH_START +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + @- @LAST_MATCH_START +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + %- %LAST_MATCH_START +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + $1 $#1 $1[0] $#1[0] $1{key} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.regexp.match-group.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^^^ meta.item-access.perl + 1*2*3*4*5*6 +# ^^^^^^^^^^^ - variable + $+[0]-$+[$#-] +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl +# ^ keyword.operator.arithmetic.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.regexp.match-group.perl + $-[0]*$-[$-[2]] +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl +# ^ keyword.operator.arithmetic.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl - meta.item-access meta.item-access +# ^^^ meta.item-access.perl meta.item-access.perl +# ^ meta.item-access.perl - meta.item-access meta.item-access +# ^ punctuation.section.item-access.begin.perl +# ^^ variable.language.regexp.match-group.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^^ punctuation.section.item-access.end.perl + +# Variables related to input/output formating + + $, @, %, *, $OFS $OUTPUT_FIELD_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $. @. %. *. $NR $INPUT_LINE_NUMBER +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $/ @/ %/ */ $RS $INPUT_RECORD_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $\ @\ %\ *\ $ORS $OUTPUT_RECORD_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $| @| %| *| $OUTPUT_AUTOFLUSH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $: @: %: *: $FORMAT_LINE_BREAK_CHARACTERS +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $= @=,%=,*= $FORMAT_LINES_PER_PAGE +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^^^^^^^ variable.language.perl + $^ @^ %^ *^ $FORMAT_TOP_NAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^ variable.language.perl + $~ @~ %~ *~ $FORMAT_NAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^ variable.language.perl + +# Error Variables + + $^E @^E %^E *^E $EXTENDED_OS_ERROR +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^^^ variable.language.perl + $^S @^S %^S *^S $EXCEPTIONS_BEING_CAUGHT +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^ variable.language.perl + $^W @^W %^W *^W $WARNING +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.language.perl + $! @! %! *! $ERRNO $OS_ERROR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^ variable.language.perl + $@ @@ %@ *@ $EVAL_ERROR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^ variable.language.perl + $? @? %? *? $CHILD_ERROR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^ variable.language.perl + +# Deprecated and removed variables + + $# # format printed numbers +# ^^ variable.language.deprecated.perl +# ^ punctuation.definition.variable.perl + $* # enable multiline matching +# ^^ variable.language.deprecated.perl +# ^ punctuation.definition.variable.perl + $[ # index of the first element in an array +# ^^ variable.language.deprecated.perl +# ^ punctuation.definition.variable.perl + +###[ UNQUALIFIED VARIABLES ]################################################## + + $_foo = "bar"; +# ^ punctuation.definition.variable.perl +# ^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.terminator.statement.perl + $_foo = "bar"; +# ^ punctuation.definition.variable.perl +# ^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.terminator.statement.perl + $foo{bar} +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.item-access.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl + $foo{bar()} +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.item-access.perl +# ^^^ variable.function.perl +# ^ punctuation.section.item-access.end.perl + $foo{10 + $bar} +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^^^^^^^ meta.item-access.perl +# ^^ constant.numeric.integer.decimal.perl +# ^ keyword.operator.arithmetic.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.end.perl + +###[ QUALIFIED VARIABLES ]#################################################### + + $::foo # scalar in the 'main' namespace +# ^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $::Foo[$bar] # array in the 'main' namespace +# ^^^^^^ meta.path.perl - meta.item-access +# ^^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.end.perl + $::FOO{'bar'} # hash in the 'main' namespace +# ^^^^^^ meta.path.perl - meta.item-access +# ^^^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.item-access.end.perl + $::foo->[$bar] # reference in the 'main' namespace +# ^^^^^^ meta.path.perl - meta.item-access +# ^^ - meta.path - meta.item-access +# ^^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.end.perl + $::foo->{'bar'} # reference in the 'main' namespace +# ^^^^^^ meta.path.perl - meta.item-access +# ^^ - meta.path - meta.item-access +# ^^^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.item-access.end.perl + $Foo::bar # 'bar' is a scalar +# ^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $Foo::bar->[0] # 'bar' is a reference of an array +# ^^^^^^^^^ meta.path.perl - meta.item-access +# ^^ - meta.path - meta.item-access +# ^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ meta.item-access.perl + $FOO::bar->{key} # 'bar' is a reference of a hash +# ^^^^^^^^^ meta.path.perl - meta.item-access +# ^^ - meta.path - meta.item-access +# ^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl + $Foo::bar->baz # 'Bar' is a reference to a class or namespace +# ^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + $Foo::bar::baz +# ^^^^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $Foo::$bar::baz # a part of the qualifier is a variable +# ^^^^^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $Foo::${bar}::baz # a part of the qualifier is a variable +# ^^^^^^^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^ meta.variable.perl +# ^^^ string.unquoted.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $Foo::Bar::baz() # baz is not a function +# ^^^^^^^^^^^^^^ meta.path.perl +# ^^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + $foo::Bar::baz[4] # 'baz' is an array +# ^^^^^^^^^^^^^^ meta.path.perl - meta.item-access +# ^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer +# ^ punctuation.section.item-access.end.perl + $FOO::BAR::baz{key} # baz is a hash +# ^^^^^^^^^^^^^^ meta.path.perl - meta.item-access +# ^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl + $Foo::Bar->$baz->[-1] +# ^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl - variable +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^ meta.item-access.perl +# ^ punctuation.section.item-access.end.perl + +###[ VARIABLE DEREFERENCING ]################################################# + + $$ref $$$refref $$$$refrefref +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.other.readwrite.perl +# ^^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl + $@ref $$@refref $%$@refrefref +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.other.readwrite.perl +# ^^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl + $%ref $$%refref $@$%refrefref +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.other.readwrite.perl +# ^^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl + $#$ref #=> 2 ## Last element index, -1 if empty +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl + $#{$ref} #=> 2 ## Last element index, alternate syntax +# ^^^^^^^^ meta.variable.perl +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.end.perl + @{$ref}[2,1,0] #=> (3, 2, 1) # Also: @$aref[2,1,0] +# ^^^^^^^ meta.variable.perl +# ^^^^^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.item-access.end.perl + ${ &$coderef() }; # Call by function reference +# ^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.definition.variable.end.perl + ${get_var_name()} +# ^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^ variable.function.perl +# ^ punctuation.definition.variable.end.perl + ${the_var_name}[0] +# ^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.unquoted.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.item-access.end.perl + ${/\w+$/g = $var} +# ^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.definition.variable.end.perl + %{$foo{bar}{baz}} = 'excl'; +# ^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^^^^^^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ keyword.operator.assignment.perl +# ^^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.terminator.statement.perl + %{$foo{'bar'}{'bar'}} = 'excl'; +# ^^^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^^^^^^^^^^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ keyword.operator.assignment.perl +# ^^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.terminator.statement.perl + ${Foo::Bar::baz} +# ^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.function.perl +# ^ punctuation.definition.variable.end.perl + ${Foo::Bar::baz}[$var] +# ^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^^^^ meta.item-access.perl + ${ +#^ - variable +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^ meta.variable.perl + Foo::bar->baz() +# <- meta.variable.perl +#^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + } +# <- meta.variable.perl +#^^ meta.variable.perl +# ^ punctuation.definition.variable.end.perl +# ^ - variable + ${ &$coderef() }; # Call by function reference +# ^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.definition.variable.end.perl + &$coderef; +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + &$coderef(); +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + &$::coderef(); +#^^ - meta.path.perl +# ^^^^^^^^^^ meta.path.perl +# ^^^ - meta.path.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + &$ns::coderef(); +#^^ - meta.path.perl +# ^^^^^^^^^^^^ meta.path.perl +# ^^^ - meta.path.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + &{$coderef}(); +#^ - meta.variable +# ^^^^^^^^^^^ meta.variable.perl +# ^^^ - meta.variable +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + &{*coderef{NAME}}(); +#^ - meta.variable +# ^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^^^^ meta.item-access.perl +# ^^^ - meta.variable +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + &{$Module::coderef}(); +# ^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^ - meta.variable +# ^^ - meta.path.perl +# ^^^^^^^^^^^^^^^^ meta.path.perl +# ^^^ - meta.path.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + &{ get_sub_reference() }(); #=> Calls returned subroutine reference +#^ - meta.variable +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^ - meta.variable +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^^^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + # addin items to an array + $AoA[$i] = [ somefunc($i) ]; +# ^^^^ variable.other.readwrite.perl - meta.item-access +# ^^^^ meta.item-access.perl +# ^ punctuation.section.item-access.begin.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.end.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.section.brackets.begin.perl +# ^ punctuation.section.brackets.end.perl +# ^ punctuation.terminator.statement.perl + # add new columns to an existing row + push @{ $AoA[0] }, "wilma", "betty"; # explicit deref +# ^^^^ support.function.perl +# ^^^^^^^^^^^^ meta.variable.perl +# ^^^^ variable.other.readwrite.perl - meta.item-access +# ^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.terminator.statement.perl + +###[ REFERENCES DEFINITIONS ]################################################# + + *_ = \my $a; +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^^ storage.type.variable.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $strref = \"foo"; +# ^ punctuation.definition.variable.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^^^^^ meta.string.perl string.quoted.double.perl + $refrefref = \\\"foo"; +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^ keyword.operator.reference.perl +# ^^^^^ meta.string.perl string.quoted.double.perl + $globref = \*foo; +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + $scalarref = \$foo; +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + $scalarrefref = \\$foo; +# ^ keyword.operator.assignment.perl +# ^^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + $arrayref = \@ARGV; +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $arrayrefref = \\@ARGV; +# ^ keyword.operator.assignment.perl +# ^^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $hashref = \%ENV; +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $hashrefref = \\%ENV; +# ^ keyword.operator.assignment.perl +# ^^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + @list = (\$a, \@b, \%c); +# ^ punctuation.section.group.begin.perl +# ^ keyword.operator.reference.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^ keyword.operator.reference.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^ keyword.operator.reference.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + @list = \($a, @b, %c); # same thing! +# ^ keyword.operator.reference.perl +# ^ punctuation.section.group.begin.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + @list = \\($a, @b, %c); +# ^^ keyword.operator.reference.perl +# ^ punctuation.section.group.begin.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + $coderef = \&func; # Reference to function +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + $coderef = \&if::func; +# ^^^^ - meta.path +# ^^^^^^^^ meta.path.perl +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ keyword.operator.dereference.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + $coderef = \&{ get_sub_reference() } +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^^^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.definition.variable.end.perl + +###[ PACKAGE DEFINITION ]##################################################### + + package; +# ^^^^^^^ meta.namespace.perl storage.type.namespace.perl keyword.declaration.namespace.perl +# ^ punctuation.terminator.statement.perl - meta.namespace + package; # comment +# ^^^^^^^ meta.namespace.perl storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^^^^^ - meta.namespace +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl + package package; +# ^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package Package; +# ^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package PACKAGE; +# ^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package # comment +# ^^^^^^^ meta.namespace.perl storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^^^ meta.namespace.perl comment.line.number-sign.perl + if; # Perl allows namespaces looking like keywords +# ^^ meta.namespace.perl entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package name 5.023_234; +# ^^^^^^^^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^ entity.name.namespace.perl +# ^^^^^^^^^ constant.numeric.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl + package name 5.023_234 { print "block" }; +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^^^^^^^^^^^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^ entity.name.namespace.perl +# ^^^^^^^^^ constant.numeric.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.terminator.statement.perl + package ::name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package +# ^^^^^^^^ meta.namespace.perl +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + ::name; +# ^^ meta.namespace.perl - meta.path +# ^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package ns::name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package Ns::Name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package NS::NAME; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package if::else::name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + NS::NAME +# ^^ meta.namespace.perl - meta.path +# ^^^^^^^^ meta.namespace.perl meta.path.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl + v5.24.1; +#^^^^^^^^^^ meta.namespace.perl +# ^ - meta.namespace +# ^^^^^^^ constant.numeric.version.perl +# ^ punctuation.definition.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl + package 5.0; +# ^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^ constant.numeric.version.perl + package "5.0"; +# ^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^ meta.string.perl string.quoted.double.perl + package $name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + package-name; +# ^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + package.name; +# ^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + CORE::package; +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + core::package; +# ^^^^^^^^^^^^^^ - meta.namespace.perl +# ^^^^^^^ - storage + package::name; +# ^^^^^^^^^^^^^^ - meta.namespace.perl +# ^^^^^^^ - storage + +###[ PACKAGE IMPORTS ]######################################################## + + require +# ^^^^^^^^ meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl + require; +# ^^^^^^^ meta.preprocessor.require.perl entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + require # comment +# ^^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl +# ^ comment.line.number-sign.perl + if ; # Perl allows namespaces looking like keywords +# ^^^ meta.preprocessor.require.perl +# ^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require 5.024; +# ^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl + require v5.24.1; # run time version check +# ^^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^ punctuation.definition.version.perl +# ^^^^^^^ constant.numeric.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require 5.24.1; # ditto +# ^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^^ constant.numeric.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require 5.024_001; # ditto; older syntax compatible +# ^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require +# ^^^^^^^^ meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl + 5.024_001; # ditto; older syntax compatible +# ^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require English; +# ^^^^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^^^ entity.name.namespace.perl + require utf8; +# ^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^ entity.name.namespace.perl + require ::utf8; +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl + require Foo::bar; +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + require +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^ keyword.control.import.require.perl + Foo::Bar; +# ^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ - meta.preprocessor +# ^^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + require "foo/bar.pm"; +# ^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.terminator.statement.perl + require $name; +# ^^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + require foo.$bar.pm; +# ^^^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^ keyword.control.import.require.perl +# ^^^ meta.string.perl string.unquoted.perl +# ^ keyword.operator.concat.perl +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.concat.perl +# ^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + require-name; +# ^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^ - meta.preprocessor.require +# ^^^^^^^ keyword.control.import.require.perl +# ^ keyword.operator.arithmetic.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + require.name; +# ^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^ - meta.preprocessor.require +# ^^^^^^^ keyword.control.import.require.perl +# ^ keyword.operator.concat.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + CORE::require; +# ^^^^^^ - meta.preprocessor +# ^^^^^^^ meta.preprocessor.require.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ keyword.control.import.require.perl +# ^ punctuation.terminator.statement.perl + core::require; +# ^^^^^^^^^^ - meta.preprocessor.require.perl +# ^^^^^^^ - keyword +# ^ punctuation.terminator.statement.perl + require::name; +# ^^^^^^^^^^^^^^ - meta.preprocessor.require.perl +# ^^^^^^^ - keyword +# ^ punctuation.terminator.statement.perl + +eval { require Mail::Send }; +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ meta.preprocessor.require.perl - meta.path +# ^^ - meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl +eval { require Mail.'::'.Send }; +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^^ - meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl +eval { require B::Flags and $var++ }; +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^^^^^^ - meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl +# ^ meta.path.perl entity.name.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^^^^ meta.path.perl entity.name.namespace.perl +# ^^^ keyword.operator.logical.perl +use strict; +# <- meta.preprocessor.use.perl keyword.control.import.use.perl +#^^^^^^^^^ meta.preprocessor.use.perl +#^^ keyword.control.import.use.perl +# ^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl +use strict "vars"; +# <- meta.preprocessor.use.perl keyword.control.import.use.perl +#^^^^^^^^^^^^^^^^ meta.preprocessor.use.perl +#^^ keyword.control.import.use.perl +# ^^^^^^ entity.name.namespace.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.terminator.statement.perl + use attributes __PACKAGE__, \&foo, 'method'; +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.use.perl +# ^^^ keyword.control.import.use.perl +# ^^^^^^^^^^ entity.name.namespace.perl +# ^^^^^^^^^^^ constant.language.perl +# ^ punctuation.separator.sequence.perl + use if; +# ^^^^^^ meta.preprocessor.use.perl - meta.path +# ^ - meta.preprocessor - meta.path +# ^^^ keyword.control.import.use.perl +# ^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + use if::else; +# ^^^^ meta.preprocessor.use.perl - meta.path +# ^^^^^^^^ meta.preprocessor.use.perl meta.path.perl +# ^ - meta.preprocessor - meta.path +# ^^^ keyword.control.import.use.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + use warnings::register Foo::func; +# ^^^^ meta.preprocessor.use.perl - meta.path +# ^^^^^^^^^^^^^^^^^^ meta.preprocessor.use.perl meta.path.perl +# ^ meta.preprocessor.use.perl - meta.path +# ^^^^^^^^^ meta.preprocessor.use.perl meta.path.perl +# ^ - meta.preprocessor - meta.path +# ^^^ keyword.control.import.use.perl +# ^^^^^^^^ entity.name.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^^^^^^^ entity.name.namespace.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + CORE::use; +# ^^^^^^ - meta.preprocessor +# ^^^ meta.preprocessor.use.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ keyword.control.import.use.perl +# ^ punctuation.terminator.statement.perl + core::use; +# ^^^^^^^^^^ - meta.preprocessor.use.perl +# ^^^ - keyword +# ^ punctuation.terminator.statement.perl + use::name; +# ^^^^^^^^^^ - meta.preprocessor.use.perl +# ^^^ - keyword +# ^ punctuation.terminator.statement.perl + + no strict; +# ^^^^^^^^^ meta.preprocessor.no.perl +# ^ - meta.preprocessor - meta.path +# ^^ keyword.control.import.no.perl +# ^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + CORE::no; +# ^^^^^^ - meta.preprocessor +# ^^ meta.preprocessor.no.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ keyword.control.import.no.perl +# ^ punctuation.terminator.statement.perl + core::no; +# ^^^^^^^^^ - meta.preprocessor.no.perl +# ^^ - keyword +# ^ punctuation.terminator.statement.perl + no::name; +# ^^^^^^^^^^ - meta.preprocessor.no.perl +# ^^ - keyword +# ^ punctuation.terminator.statement.perl + +###[ DECLARATIONS ]########################################################### + +my +# <- storage.type.variable.perl +#^ storage.type.variable.perl + my $foo +#^ - storage +# ^^ storage.type.variable.perl +# ^ - storage.type.variable - variable.other.readwrite +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ - variable.other.readwrite +my $foo; +# <- storage.type.variable.perl +#^ storage.type.variable.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl +my $foo = "bar"; +# <- storage.type.variable.perl +#^ storage.type.variable.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.terminator.statement.perl +my ( +# <- storage.type.variable.perl +#^ storage.type.variable.perl + $foo, $bar, +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl + $baz +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl + ); +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + eval { my $foo = /pattern/; } +# ^^^^ support.function.perl +# ^ punctuation.section.block.begin.perl +# ^^ storage.type.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp meta.literal.regexp +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl +# ^ punctuation.section.block.end.perl + CORE::my +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ storage.type.variable.perl + core::my +# ^^^^^^^^ meta.path.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.function.perl + my::core +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + +our +# <- storage.type.variable.perl +#^^ storage.type.variable.perl + our $foo +# <- +#^ - storage +# ^^^ storage.type.variable.perl +# ^ - storage.type.variable - variable.other.readwrite +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ - variable.other.readwrite +our $foo; +# <- storage.type.variable.perl +#^^ storage.type.variable.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl +our $foo = "bar"; +# <- storage.type.variable.perl +#^^ storage.type.variable.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.terminator.statement.perl +our ( +# <- storage.type.variable.perl +#^^ storage.type.variable.perl + $foo, $bar, +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl + $baz +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl + ); +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl +our $VERSION = do { +# <- storage.type.variable.perl +#^^ storage.type.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^ keyword.control.flow.do.perl +# ^ punctuation.section.block.begin.perl + my @r = (q$Revision: 2.20 $ =~ /\d+/g); +# ^^ storage.type.variable.perl +# ^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.section.group.begin.perl +# ^ meta.function-call.perl support.function.perl +# ^^^^^^^^^^^^^^^^^ meta.function-call.perl meta.generic.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl +# ^^^^ - constant.numeric +# ^ punctuation.section.generic.end.perl +# ^^ keyword.operator.binary.perl +# ^ punctuation.section.generic.begin.perl +# ^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + sprintf "%d."."%02d" x $#r, @r +# ^^^^^^^ support.function.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^ constant.other.placeholder +# ^ keyword.operator.concat.perl +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.other.placeholder +# ^ keyword.operator.arithmetic.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.other.readwrite.perl +}; +# <- punctuation.section.block.end.perl +state +# <- storage.type.variable.perl +#^^^^ storage.type.variable.perl + state $foo +# <- +#^ - storage +# ^^^^^ storage.type.variable.perl +# ^ - storage.type.variable - variable.other.readwrite +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ - variable.other.readwrite + +###[ PREPROCESSOR ]########################################################### + + BEGIN { +# ^^^^^^ meta.function.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + ::BEGIN { +# ^^^^^^^^ meta.function.perl +# ^^ invalid.illegal.accessor.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub BEGIN { +# ^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub ::BEGIN { +# ^^^^ meta.function.perl - meta.path.perl - meta.block +# ^^^^^^^ meta.function.perl meta.path.perl - meta.block +# ^ meta.function.perl - meta.path.perl - meta.block +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + CHECK { +# ^^^^^^ meta.function.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub CHECK { +# ^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + END { +# ^^^^ meta.function.perl +# ^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub END { +# ^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + INIT { +# ^^^^^ meta.function.perl +# ^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub INIT { +# ^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + UNITCHECK { +# ^^^^^^^^^^ meta.function.perl +# ^^^^^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub UNITCHECK { +# ^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub AUTOLOAD () {} +# ^^^^^^^^^^^^^ meta.function.perl +# ^^ meta.function.parameters.perl +# ^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^^^^^ entity.name.function.callback.perl + sub ::AUTOLOAD () {} +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^ meta.function.perl meta.path.perl - meta.function.parameters.perl +# ^ meta.function.perl - meta.function.parameters.perl - meta.path +# ^^ meta.function.parameters.perl - meta.function.perl - meta.path +# ^ meta.function.perl - meta.function.parameters.perl - meta.path +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^^ entity.name.function.callback.perl + +###[ UNQUALIFIED SUBROUTINE DEFINITIONS ]###################################### + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl +# ^ - invalid + sub # comment +# ^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ - comment - entity - keyword - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub func +# ^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid + sub func # comment +# ^^^^^^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ - comment - entity - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub func invalid +# ^^^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid +# ^^^^^^^ invalid.illegal.identifier.perl + sub func invalid # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ - comment - entity - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub func; +# ^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.terminator.statement.perl + sub func invalid; +# ^^^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub :attr ; +# ^^^^ meta.function.perl - meta.annotation +# ^^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl + sub func : Attr ; +# ^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl + sub func : Attr :attr2 ; +# ^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.definition.annotation.perl +# ^^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl + sub func : attr invalid; +# ^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub func invalid :attr; +# ^^^^^^^^^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl + + sub # comment +# ^^^^^^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ - comment - entity - keyword - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + func +# ^^^^ meta.function.perl entity.name.function.perl - meta.annotation + : +#^ meta.function.perl - meta.annotation +# ^^ meta.function.perl meta.annotation.perl +# ^ punctuation.definition.annotation.perl + attr +#^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^ variable.annotation.attribute.perl + : +#^^^ meta.function.perl meta.annotation.perl +# ^ punctuation.definition.annotation.perl + attr +#^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^ variable.annotation.attribute.perl + ; +#^ meta.function.perl meta.annotation.perl +# ^ punctuation.terminator.statement.perl - meta.function + +## subroutine with code block + + sub { say "Hello"; } +# ^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub func { say "Hello"; } +# ^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub func invalid { say "Hello"; } +# ^^^^^^^^^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub :attr { say "Hello"; } +# ^^^^ meta.function.perl - meta.annotation +# ^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub :attr invalid { say "Hello"; } +# ^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub func:attr { say "Hello"; } +# ^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub func:attr invalid { say "Hello"; } +# ^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + func +# ^^^^ meta.function.perl entity.name.function.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + func +# ^^^^ meta.function.perl entity.name.function.perl + invalid +# ^^^^^^^ meta.function.perl invalid.illegal.identifier.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + invalid +# ^^^^^^^ meta.function.perl meta.annotation.perl invalid.illegal.identifier.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + func +# ^^^^ meta.function.perl entity.name.function.perl + invalid +# ^^^^^^^ meta.function.perl invalid.illegal.identifier.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + func +# ^^^^ meta.function.perl entity.name.function.perl + invalid +# ^^^^^^^ meta.function.perl invalid.illegal.identifier.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + invalid +# ^^^^^^^ meta.function.perl meta.annotation.perl invalid.illegal.identifier.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + ## prototypes + + sub ($) ; +# ^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.terminator.statement.perl + sub ($) {} +# ^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub ($;$) {} +# ^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.separator.sequence.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func($;$;$) {} +# ^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.separator.sequence.perl +# ^ variable.parameter.perl +# ^ punctuation.separator.sequence.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func:attr($) {} +# ^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func : attr ( $ ) { } +# ^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters +# ^^^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func($) :attr {} +# ^^^^^^^^ meta.function.perl - meta.function.parameters- meta.annotation +# ^^^ meta.function.parameters.perl - meta.function.perl- meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^ meta.function.perl meta.annotation.perl - meta.block +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func :attr($) :attr {} +# ^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func : ($var, 5) ($) : ([0, 10]) {} +# ^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^ punctuation.section.parameters.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.definition.annotation.perl +# ^ punctuation.section.parameters.begin.perl +# ^ punctuation.section.brackets.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.brackets.end.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func : attr ($var, 5) ($) : attr ([0, 10]) {} +# ^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^ punctuation.section.brackets.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.brackets.end.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub func inv : attr inv ($var, 5) inv ($inv;%@$) inv : attr inv ([0, 10]) inv {} +# ^^^^^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^^^^^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^^^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^^^^^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^^^^^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.parameters.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.parameters.end.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^^^ invalid.illegal.parameter.perl +# ^ punctuation.separator.sequence.perl +# ^^^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.parameters.begin.perl +# ^ punctuation.section.brackets.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.brackets.end.perl +# ^ punctuation.section.parameters.end.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + +###[ QUALIFIED SUBROUTINE DEFINITIONS ]######################################## + + sub ::func +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid + sub ::func # comment +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ - comment - entity - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub ::func invalid +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid +# ^^^^^^^ invalid.illegal.identifier.perl + sub ::func invalid # comment +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^^^^^^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ - comment - entity - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub ::func; +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^ - meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.terminator.statement.perl + sub ::func invalid; +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub ::func:attr:attr2 invalid; +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl - meta.path +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.definition.annotation.perl +# ^^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub ::func:attr:attr2 invalid :attr3; +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl - meta.path +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.definition.annotation.perl +# ^^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.definition.annotation.perl +# ^^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl + sub +# ^^^^ meta.function.perl - meta.path + if::func +# ^^^^^^^^ meta.function.perl meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + sub NS::func +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^ meta.function.perl meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + sub ::NS::func +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^ meta.function.perl meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + sub B::NS::func +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + sub B::NS::func invalid +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^^^^^^^^ meta.function.perl - meta.path +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl + sub B::NS ::invalid; +# ^^^^ meta.function.perl - meta.path +# ^^^^^ meta.function.perl meta.path.perl +# ^^^^^^^^^^ meta.function.perl - meta.path +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ entity.name.function.perl +# ^^^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub B::NS:: invalid {}; +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^ meta.function.perl meta.path.perl +# ^^^^^^^^^ meta.function.perl - meta.path +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl +# ^ punctuation.terminator.statement.perl + sub B::NS::func # comment +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^^^ comment.line.number-sign.perl + sub B::NS::func() # comment +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^^ meta.function.parameters.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ punctuation.section.parameters.end.perl +# ^^^^^^^^^ comment.line.number-sign.perl + sub B::NS::func { +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^ meta.function.perl - meta.path - meta.block +# ^ +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.block.begin.perl +} +# <- punctuation.section.block.end.perl + sub +# ^^^^ meta.function.perl - meta.path + B::NS::func +#^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^^ meta.function.perl - meta.path +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + ( +# ^ meta.function.parameters.perl punctuation.section.parameters.begin.perl + $arg,; +# ^ meta.function.parameters.perl variable.parameter.perl +# ^^^^ meta.function.parameters.perl invalid.illegal.parameter.perl +# ^ meta.function.parameters.perl punctuation.separator.sequence.perl + ) +# ^ meta.function.parameters.perl punctuation.section.parameters.end.perl + { +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + CORE::sub ; +# ^^^^^^ - meta.function.perl +# ^^^^ meta.function.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.terminator.statement.perl + core::sub; +# ^^^^^^^^^ - meta.function.perl +# ^^^ - keyword +# ^ punctuation.terminator.statement.perl + sub::name; +# ^^^^^^^^^ - meta.function.perl +# ^^^ - keyword +# ^ punctuation.terminator.statement.perl + +###[ CONTROL KEYWORDS ]####################################################### + + # conditional + + default -> word +# ^^^^^^^ keyword.control.conditional.default.perl + default->word +# ^^^^^^^ keyword.control.conditional.default.perl + default - word +# ^^^^^^^ keyword.control.conditional.default.perl + default-word +# ^^^^^^^ keyword.control.conditional.default.perl + default_word +# ^^^^^^^ - keyword.control + default:word +# ^^^^^^^ - keyword.control + default :: word +# ^^^^^^^ keyword.control.conditional.default.perl + CORE::default +# ^^^^^^^ keyword.control.conditional.default.perl + core::default +# ^^^^^^^ - keyword.control + default::word +# ^^^^^^^ - keyword.control + else -> word +# ^^^^ keyword.control.conditional.else.perl + else->word +# ^^^^ keyword.control.conditional.else.perl + else - word +# ^^^^ keyword.control.conditional.else.perl + else-word +# ^^^^ keyword.control.conditional.else.perl + else_word +# ^^^^ - keyword.control + else:word +# ^^^^ - keyword.control + else :: word +# ^^^^ keyword.control.conditional.else.perl + CORE::else +# ^^^^ keyword.control.conditional.else.perl + core::else +# ^^^^ - keyword.control + else::word +# ^^^^ - keyword.control + elsif +# ^^^^^ keyword.control.conditional.elseif.perl + elif +# ^^^^ - keyword.control + elseif +# ^^^^^^ - keyword.control + given +# ^^^^^ keyword.control.conditional.given.perl + if +# ^^ keyword.control.conditional.if.perl + unless +# ^^^^^^ keyword.control.conditional.unless.perl + when +# ^^^^ keyword.control.conditional.when.perl + + # flow + + break +# ^^^^^ keyword.control.flow.break.perl + caller +# ^^^^^^ keyword.control.flow.caller.perl + continue +# ^^^^^^^^ keyword.control.flow.continue.perl + die +# ^^^ keyword.control.flow.die.perl + do +# ^^ keyword.control.flow.do.perl + dump +# ^^^^ keyword.control.flow.dump.perl + exit +# ^^^^ keyword.control.flow.exit.perl + goto +# ^^^^ keyword.control.flow.goto.perl + last +# ^^^^ keyword.control.flow.last.perl + next retry +# ^^^^ keyword.control.flow.next.perl +# ^^^^^ variable.label.perl + next eval {if $retry} +# ^^^^ keyword.control.flow.next.perl +# ^^^^ support.function.perl + next retry if $retry +# ^^^^ keyword.control.flow.next.perl +# ^^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^^^ variable.other.readwrite.perl + next if $retry +# ^^^^ keyword.control.flow.next.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^^^ variable.other.readwrite.perl + redo LINE +# ^^^^ keyword.control.flow.redo.perl +# ^^^^ variable.label.perl + redo LINE if $retry +# ^^^^ keyword.control.flow.redo.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^^^ variable.other.readwrite.perl + redo unless $retry +# ^^^^ keyword.control.flow.redo.perl +# ^^^^^^ keyword.control.conditional.unless.perl +# ^^^^^^ variable.other.readwrite.perl + return +# ^^^^^^ keyword.control.flow.return.perl + wait +# ^^^^ keyword.control.flow.wait.perl + +###[ LABELS ]################################################################# + + retry: +# ^^^^^ entity.name.label.perl +# ^ punctuation.separator.perl + retry:die "bye!"; +# ^^^^^ entity.name.label.perl +# ^ punctuation.separator.perl +# ^^^ keyword.control.flow.die.perl +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.terminator.statement.perl + retry:: +# ^^^^^^^ - entity.name.label.perl + + LINE: +# ^^^^ entity.name.label.perl +# ^ punctuation.separator.perl + + LINE:exit -1 +# ^^^^ entity.name.label.perl +# ^ punctuation.separator.perl +# ^^^^ keyword.control.flow.exit.perl +# ^ keyword.operator.arithmetic.perl +# ^ constant.numeric.integer.decimal.perl + +###[ UNQUALIFIED FUNCTION CALLS ]############################################# + + ## Encapsulating arguments into parentheses is optional, + ## if the expression is clearly identified as function-call. + + print +# ^^^^^ support.function.perl + print # comment +# ^^^^^ support.function.perl +# ^ - comment - support +# ^ comment.line.number-sign.perl + print; +# ^^^^^ support.function.perl +# ^ punctuation.terminator.statement.perl + &print +# ^ keyword.operator.dereference.perl +# ^^^^^ support.function.perl + print /pattern/g; +# ^^^^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + print "string"; +# ^^^^^ support.function.perl +# ^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.terminator.statement.perl + print STDOUT; +# ^^^^^ support.function.perl +# ^^^^^^ constant.language.filehandle.perl +# ^ punctuation.terminator.statement.perl + print func; +# ^^^^^ support.function.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + print x::func; +# ^^^^^ support.function.perl +# ^^^^^^^ meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + print $$$$refrefref; +# ^^^^^ support.function.perl +# ^^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl + print + 1 +# ^^^^^ support.function.perl +# ^ keyword.operator.arithmetic.perl + print x 1 +# ^^^^^ support.function.perl +# ^ keyword.operator.arithmetic.perl + print and 1 +# ^^^^^ support.function.perl +# ^^^ keyword.operator.logical.perl + func +# ^^^^ variable.function.perl +# ^ - variable + func; +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + func # comment +# ^^^^ variable.function.perl +# ^^ - comment - variable +# ^ comment.line.number-sign.perl + func "string"; +# ^^^^ variable.function.perl +# ^^^^^^^^ meta.string.perl string.quoted.double.perl + func /pattern/g; +# ^^^^ variable.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + Func x::path +# ^^^^ variable.function.perl +# ^^^^^^^ meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + _func $var; +# ^^^^^ variable.function.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + _Func STDOUT, $var; +# ^^^^^ variable.function.perl +# ^^^^^^ constant.language.filehandle.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + func join('foo', $bar), $baz; +# ^^^^ variable.function.perl +# ^^^^ support.function.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + func <<_EOD_, $var; +# ^^^^ variable.function.perl +# ^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + foo bar baz +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +#^^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl +_EOD_ +#<- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + &func + 1 +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^ keyword.operator.arithmetic.perl + &func x 1 +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^ keyword.operator.arithmetic.perl + &func and 1 +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^^^ keyword.operator.logical.perl + no_func + 1 +# ^^^^^^^ - variable.function +# ^ keyword.operator.arithmetic.perl + no_func x 1 +# ^^^^^^^ - variable.function +# ^ keyword.operator.arithmetic.perl + no_func and 1 +# ^^^^^^^ - variable.function +# ^^^ keyword.operator.logical.perl + + ## To ensure the interpreter identifies a function correctly, + ## the arguments need to be encapsulated in parentheses. + + print(/pattern/g); +# ^^^^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + func(/pattern/g); +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + _func($var); +# ^^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + + ## The function call argument list can contain arbitary arguments + ## after the content of the `_EOD_` HEREDOC. + + Func(<<_EOD_; +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.terminator.statement.perl + foo bar baz +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +#^^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl +_EOD_ +#<- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +# ^ - meta.string.heredoc + , $var +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +) +# <- punctuation.section.group.end.perl + + ## The function call argument list can end at the same line + ## while the content of the `_EOD_` HEREDOC starts at the next one. + + func(<<_EOD_, $var); +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + foo bar baz +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +#^^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl +_EOD_ +#<- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + + func() + 1 +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ keyword.operator.arithmetic.perl + &func() + 1 +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ keyword.operator.arithmetic.perl + +###[ QUALIFIED FUNCTION CALL ]################################################ + + ::print +# ^^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl + &::print +# ^ - meta.path +# ^^^^^^^ meta.path.perl +# ^ keyword.operator.dereference.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl + ::print(/pattern/g); +# ^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + ::func +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + &::func +# ^^^^^^ meta.path.perl +# ^ keyword.operator.dereference.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + ::func "string"; +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^^^^^^^^ meta.string.perl string.quoted.double.perl + ::func /pattern/g; +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + ::Func x::path +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^^^^^^^ meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + ::_func $var; +# ^^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ variable.function.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + ::_Func STDOUT, $var; +# ^^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ variable.function.perl +# ^^^^^^ constant.language.filehandle.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + ::func + 1 +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ keyword.operator.arithmetic.perl + ::func x 1 +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ keyword.operator.arithmetic.perl + ::func and 1 +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^^^ keyword.operator.logical.perl + main::print +# ^^^^^^^^^^^ meta.path.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl + &main::print +# ^^^^^^^^^^^ meta.path.perl +# ^ keyword.operator.dereference.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl + If::func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + If::_Func +# ^^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + If::Func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + IF::func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + IF::_Func +# ^^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + IF::Func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + if::func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + if::_Func +# ^^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + if::Func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + ::if::func +# ^^^^^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + i::f::func +# ^^^^^^^^^^ meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + &i::f::func +# ^^^^^^^^^^ meta.path.perl +# ^ keyword.operator.dereference.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + +###[ METHOD CALLS ]########################################################### + + $obj = URI->new +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^ variable.namespace.perl - constant - meta.path +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + $obj = Class->new +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ variable.namespace.perl - meta.path +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + $obj = Class::Scan->new +# ^ - meta.path +# ^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + $obj = Class::Scan->new # comment +# ^ - meta.path +# ^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl +# ^^^^^^^^^ comment.line.number-sign.perl + $obj = Class::Scan->new(KEY => 'value') +# ^ - meta.path +# ^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl +# ^ punctuation.section.group.begin.perl +# ^^^ constant.other.key.perl +# ^ - constant +# ^^ punctuation.separator.key-value.perl +# ^^^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.group.end.perl + $obj->method +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl + $obj->method # comment +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^^^^^^^^ comment.line.number-sign.perl + $obj->method() # comment +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^^^^^^^^^ comment.line.number-sign.perl + $obj +# ^^^^ variable.other.readwrite.perl + -> +# ^^ punctuation.accessor.arrow.perl + method() # comment +# ^^^^^^ variable.function.member.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^^^^^^^^^ comment.line.number-sign.perl + $obj->method(1, "str", $var) +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^ punctuation.section.group.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl + # call method and access first item of the returned array reference + $obj->method->[0] +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ meta.item-access.perl + # call method and access item 'key' of the returned hash reference + $obj->method->{key} +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^ meta.item-access.perl + # call method and execute the returned function + $obj->method->($arg1, "val") +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.section.group.end.perl + # call method and add 1 to the returned number + $obj->method + 1 +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^ keyword.operator.arithmetic.perl +# ^ constant.numeric.integer.decimal.perl + # call method and multiply 1 to the returned matrice + $obj->method x 1 +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^ keyword.operator.arithmetic.perl +# ^ constant.numeric.integer.decimal.perl + # call method and associate returned bool with TRUE + $obj->method and 1 +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^^ keyword.operator.logical.perl +# ^ constant.numeric.integer.decimal.perl + # call method of an nested object + $obj->{bar}->method +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^ meta.item-access.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl + $obj->if::func +# ^^^^^^ - meta.path +# ^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + +###[ CONDITIONAL EXPRESSIONS ]################################################ + + if ($flags & (SVf_POK|SVf_IOkK)) +# ^^ keyword.control.conditional.if.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.bitwise.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^^ constant.other.perl +# ^ keyword.operator.bitwise.perl +# ^^^^^^^^ constant.other.perl +# ^^ punctuation.section.group.end.perl + if(exists($curargs{$index})) +# ^^ keyword.control.conditional.if.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^ support.function.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl + if(exists $curargs{$index}) +# ^^ keyword.control.conditional.if.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^ support.function.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl + if(func $curargs{$index}) +# ^^ keyword.control.conditional.if.perl +# ^ punctuation.section.group.begin.perl +# ^^^^ variable.function.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl + if (&$coderef()) {&$coderef()} +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + if ($self->value <= $self->other); +# ^^^^^ variable.function.member.perl +# ^^ keyword.operator.comparison.perl +# ^^^^^^^^^^ - string +# ^^ punctuation.accessor.arrow.perl + if ($value <= $self->other); +# ^^ keyword.operator.comparison.perl +# ^^^^^^^^^^ - string +# ^^ punctuation.accessor.arrow.perl +# ^^^^^ variable.function.member.perl + + # HEREDOC can start within a normal code block + if ($var) { $text = <<_EOT_; } else { $text = "foo"} +# ^^^^^^^^^^^^^^^^^^^^ - meta.string.heredoc.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.terminator.statement.perl +# ^ punctuation.section.block.end.perl +# ^^^^ keyword.control.conditional.else.perl +# ^ punctuation.section.block.begin.perl +# ^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.section.block.end.perl +_EOT_ +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + +# <- - meta.string.heredoc.perl + +###[ LOOP EXPRESSIONS ]####################################################### + + for ($i = 1; $i < 10; $i++) { +# ^^^ keyword.control.loop.for.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.section.block.begin.perl + break; +# ^^^^^ keyword.control.flow.break.perl + } +# ^ punctuation.section.block.end.perl + + for my $i (0..9) { +# ^^^ keyword.control.loop.for.perl +# ^^ storage.type.variable.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^^ keyword.operator.range.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.section.block.begin.perl + CORE::break; +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ keyword.control.flow.break.perl + } +# ^ punctuation.section.block.end.perl + + foreach my $vsn_mk (<lib/*/vsn.mk>, <erts/vsn.mk>) { +# ^^^^^^^ keyword.control.loop.foreach.perl +# ^^ storage.type.variable.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + + LINE: until (STDIN) { next LINE if /^#/; } continue { while ($foo) { redo LINE if /@#/; } } +# ^^^^ entity.name.label.perl +# ^^^^^ keyword.control.loop.until.perl +# ^^^^^ constant.language.filehandle.perl +# ^^^^ keyword.control.flow.next.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^^^^^ keyword.control.flow.continue.perl +# ^^^^^ keyword.control.loop.while.perl +# ^^^^ keyword.control.flow.redo.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl + + LINE: while ($foo++ < 10 && $bar > 5) { next LINE if /^#/; redo LINE if $bar } +# ^^^^ entity.name.label.perl +# ^^^^^ keyword.control.loop.while.perl +# ^ punctuation.section.group.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^^ keyword.operator.arithmetic.perl +# ^ keyword.operator.comparison.perl +# ^^^^^^^^^^^^^^ - string +# ^^ constant.numeric.integer.decimal.perl +# ^^ keyword.operator.logical.perl +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.comparison.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.group.end.perl +# ^^^^ keyword.control.flow.next.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^ keyword.control.flow.redo.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl diff --git a/assets/syntaxes/Packages/Python/Completion Rules.tmPreferences b/assets/syntaxes/Packages/Python/Completion Rules.tmPreferences new file mode 100644 index 000000000..c3091ca62 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Completion Rules.tmPreferences @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>scope</key> + <string>source.python</string> + <key>settings</key> + <dict> + <key>cancelCompletion</key> + <string>^(.*\b(and|or)$)|(\s*(pass|return|and|or|(class|def|import)\s*[a-zA-Z_0-9]+)$)</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Python/Default.sublime-keymap b/assets/syntaxes/Packages/Python/Default.sublime-keymap new file mode 100644 index 000000000..d1c46df12 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Default.sublime-keymap @@ -0,0 +1,25 @@ +[ + // Auto-pair quotes even after string modifiers. + // Copied over from the default bindings with modifications to `preceding_text` + // and an added selector condition. + { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "(?i)\\b[bfru]+$", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.python" }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true } + ] + }, + { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "(?i)\\b[bfru]+$", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.python" }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true } + ] + }, +] diff --git a/assets/syntaxes/Packages/Python/Miscellaneous.tmPreferences b/assets/syntaxes/Packages/Python/Miscellaneous.tmPreferences new file mode 100644 index 000000000..77e2c3825 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Miscellaneous.tmPreferences @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Miscellaneous</string> + <key>scope</key> + <string>source.python</string> + <key>settings</key> + <dict> + <key>decreaseIndentPattern</key> + <string>^\s*(elif|else|except|finally)\b.*:</string> + <key>increaseIndentPattern</key> + <string>^\s*(class|(\basync\s+)?(def|for|with)|elif|else|except|finally|if|try|while)\b.*:\s*$</string> + <key>disableIndentNextLinePattern</key> + <string></string> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string># </string> + </dict> + <dict> + <key>name</key> + <string>TM_LINE_TERMINATOR</string> + <key>value</key> + <string>:</string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Python/Python.sublime-build b/assets/syntaxes/Packages/Python/Python.sublime-build new file mode 100644 index 000000000..6a49b1273 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Python.sublime-build @@ -0,0 +1,15 @@ +{ + "shell_cmd": "python -u \"$file\"", + "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", + "selector": "source.python", + + "env": {"PYTHONIOENCODING": "utf-8"}, + + "variants": + [ + { + "name": "Syntax Check", + "shell_cmd": "python -m py_compile \"${file}\"", + } + ] +} diff --git a/assets/syntaxes/Packages/Python/Python.sublime-syntax b/assets/syntaxes/Packages/Python/Python.sublime-syntax new file mode 100644 index 000000000..2acd86d83 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Python.sublime-syntax @@ -0,0 +1,2210 @@ +%YAML 1.2 +--- +name: Python +file_extensions: + - py + - py3 + - pyw + - pyi + - pyx + - pyx.in + - pxd + - pxd.in + - pxi + - pxi.in + - rpy + - cpy + - SConstruct + - Sconstruct + - sconstruct + - SConscript + - gyp + - gypi + - Snakefile + - vpy + - wscript + - bazel + - bzl +first_line_match: ^#!\s*/.*\bpython(\d(\.\d)?)?\b +scope: source.python + +variables: + # We support unicode here because Python 3 is the future + identifier_continue: '[[:alnum:]_]' + identifier: '\b[[:alpha:]_]{{identifier_continue}}*\b' + identifier_constant: '\b(?:[\p{Lu}_][\p{Lu}_\d]*)?[\p{Lu}]{2,}[\p{Lu}_\d]*\b' # require 2 consecutive upper-case letters + digits: (?:\d+(?:_\d+)*) + exponent: (?:[eE][-+]?{{digits}}) + path: '({{identifier}}[ ]*\.[ ]*)*{{identifier}}' + sql_indicator: \s*(?:SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|WITH)\b + illegal_names: (?:and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|not|or|pass|raise|return|try|while|with|yield) + format_spec: |- + (?x: + (?:.? [<>=^])? # fill align + [ +-]? # sign + \#? # alternate form + # technically, octal and hexadecimal integers are also supported as 'width', but rarely used + \d* # width + ,? # thousands separator + (?:\.\d+)? # precision + [bcdeEfFgGnosxX%]? # type + ) + strftime_spec: '(?:%(?:[aAwdbBGmyYHIpMSfzZjuUVWcxX%]|-[dmHIMSj]))' + # This can be used in look-aheads to parse simple expressions. + # Can't be recursive, because sregex doesn't support that, + # so we're skipping parentheses. + # Can't parse multiple lines as well, for obvious reasons + simple_expression: |- + (?x: + \s+ # whitespace + | [urfb]*"(?:\\.|[^"])*" # strings + | [urfb]*'(?:\\.|[^'])*' # ^ + | [\d.ej]+ # numerics + | [+*/%@-] | // | and | or # operators + | {{path}} # a path + )* + + +contexts: + main: + - include: statements + + statements: + - include: docstrings + - include: line-statements + - include: block-statements + - include: classes + - include: functions + - include: modifiers + - include: assignments + - match: ; + scope: punctuation.terminator.statement.python + - include: expression-as-a-statement + + line-statements: + - include: imports + - include: decorators + - match: \b(raise)\b + scope: keyword.control.flow.raise.python + push: + - meta_scope: meta.statement.raise.python + - include: line-continuation-or-pop + - match: \b(from)\b + scope: keyword.control.flow.raise.from.python + set: + - meta_scope: meta.statement.raise.python + - include: line-continuation-or-pop + - include: expression-in-a-statement + - include: expression-in-a-statement + - match: \b(assert)\b + scope: keyword.control.flow.assert.python + - match: \b(del)\b + scope: keyword.other.del.python + - match: \b(print)\b(?! *([,.()\]}])) + scope: keyword.other.print.python + - match: \b(exec)\b(?! *($|[,.()\]}])) + scope: keyword.other.exec.python + - match: \b(return)\b + scope: keyword.control.flow.return.python + - match: \b(break)\b + scope: keyword.control.flow.break.python + - match: \b(continue)\b + scope: keyword.control.flow.continue.python + - match: \b(pass)\b + scope: keyword.control.flow.pass.python + + imports: + - match: \b(import)\b + scope: keyword.control.import.python + push: + - meta_scope: meta.statement.import.python + - include: line-continuation-or-pop + - match: ',' + scope: punctuation.separator.import-list.python + - match: \. + scope: invalid.illegal.unexpected-relative-import.python + - include: import-alias + - include: qualified-name + - match: (?=\S) + pop: true + - match: \b(from)\b + scope: keyword.control.import.from.python + push: + - meta_scope: meta.statement.import.python + - meta_content_scope: meta.import-source.python + - include: line-continuation-or-pop + - match: \b(import)\b + scope: keyword.control.import.python + set: + - meta_scope: meta.statement.import.python + - include: line-continuation-or-pop + - match: ' *(\()' + captures: + 1: punctuation.section.import-list.begin.python + set: + - meta_scope: meta.statement.import.python + - include: comments + - match: \) + scope: punctuation.section.import-list.end.python + pop: true + - include: import-name-list + - match: (?=\S) + pop: true + - match: '' + set: + - meta_scope: meta.statement.import.python + - include: line-continuation-or-pop + - include: import-name-list + - match: (?=\S) + pop: true + - match: (?=\S) + pop: true + - include: import-from-name + - match: (?=\S) + pop: true + + import-name-list: + - match: ',' + scope: punctuation.separator.import-list.python + - include: import-alias + - include: name + - match: \* + scope: constant.language.import-all.python + - match: \S+ + scope: invalid.illegal.name.import.python + + import-alias: + - match: \b(as)\b + scope: keyword.control.import.as.python + + import-from-name: + - match: \.+ + scope: meta.import-path.python keyword.control.import.relative.python + - match: (?={{path}}) + push: + - meta_scope: meta.import-path.python + - match: '{{illegal_names}}\b' + scope: invalid.illegal.name.python + - match: '{{identifier}}' + scope: meta.import-name.python + - match: \s*(\.) *(?:({{illegal_names}}\b)|({{identifier}})) + captures: + 1: punctuation.accessor.dot.python + 2: invalid.illegal.name.python + 3: meta.import-name.python + - match: \ *(\. *\S+) # matches and consumes the remainder of "abc.123" or "abc.+" + captures: + 1: invalid.illegal.name.python + pop: true + - match: '' + pop: true + + block-statements: + # async for ... in ...: + - match: \b(async +)?(for)\b + captures: + 1: storage.modifier.async.python + 2: keyword.control.loop.for.python + push: + - meta_scope: meta.statement.loop.for.python + - include: line-continuation-or-pop + - match: \bin\b + scope: keyword.control.loop.for.in.python + set: + - meta_content_scope: meta.statement.loop.for.python + - include: line-continuation-or-pop + - match: ':(?!=)' + scope: meta.statement.loop.for.python punctuation.section.block.loop.for.python + pop: true + - include: expression-in-a-statement + - match: ':(?!=)' + scope: invalid.illegal.missing-in.python + pop: true + - include: target-list + # async with ... as ...: + - match: \b(async +)?(with)\b + captures: + 1: storage.modifier.async.python + 2: keyword.control.flow.with.python + push: with-body + # except ... as ...: + - match: \bexcept\b + scope: keyword.control.exception.catch.python + push: + - meta_scope: meta.statement.exception.catch.python + - include: line-continuation-or-pop + - match: ':(?!=)' + scope: punctuation.section.block.exception.catch.python + pop: true + - match: '\bas\b' + scope: keyword.control.exception.catch.as.python + set: + - meta_content_scope: meta.statement.exception.catch.python + - include: line-continuation-or-pop + - match: ':' + scope: meta.statement.exception.catch.python punctuation.section.block.exception.catch.python + pop: true + - include: name + - include: target-list + - match: \bif\b + scope: keyword.control.conditional.if.python + push: + - meta_scope: meta.statement.conditional.if.python + - include: line-continuation-or-pop + - match: ':(?!=)' + scope: punctuation.section.block.conditional.if.python + pop: true + - include: expression-in-a-statement + - match: \bwhile\b + scope: keyword.control.loop.while.python + push: + - meta_scope: meta.statement.loop.while.python + - include: line-continuation-or-pop + - match: ':(?!=)' + scope: punctuation.section.block.loop.while.python + pop: true + - include: expression-in-a-statement + - match: \b(else)\b(?:\s*(:))? + scope: meta.statement.conditional.else.python + captures: + 1: keyword.control.conditional.else.python + 2: punctuation.section.block.conditional.else.python + - match: \b(try)\b(?:\s*(:))? + scope: meta.statement.exception.try.python + captures: + 1: keyword.control.exception.try.python + 2: punctuation.section.block.exception.try.python + - match: \b(finally)\b(?:\s*(:))? + scope: meta.statement.exception.finally.python + captures: + 1: keyword.control.exception.finally.python + 2: punctuation.section.block.exception.finally.python + - match: \belif\b + scope: keyword.control.conditional.elseif.python + push: + - meta_scope: meta.statement.conditional.elseif.python + - match: ':(?!=)' + scope: punctuation.section.block.conditional.elseif.python + pop: true + - match: $\n? + pop: true + - include: expression-in-a-statement + + with-body: + - meta_scope: meta.statement.with.python + - include: line-continuation-or-pop + - match: \b(as)\b + scope: keyword.control.flow.with.as.python + set: with-as + - match: ':(?!=)' + scope: punctuation.section.block.with.python + pop: true + - match: ',' + scope: punctuation.separator.with-resources.python + - include: expression-in-a-statement + + with-as: + - meta_scope: meta.statement.with.python + - include: line-continuation-or-pop + - match: ':' + scope: punctuation.section.block.with.python + pop: true + - match: ',' + scope: punctuation.separator.with-resources.python + set: with-body + - include: name + - include: groups + - include: lists + + expressions-common: + - include: comments + - include: constants + - include: numbers + - include: yields + - include: operators + - include: lambda + - match: \b(await)\b + scope: keyword.other.await.python + - include: inline-if + - include: strings + - include: function-calls + - include: item-access + - include: lists + - include: dictionaries-and-sets + - include: tuples + - include: groups + - match: \) + scope: invalid.illegal.stray.brace.round.python + - match: \] + scope: invalid.illegal.stray.brace.square.python + - match: \} + scope: invalid.illegal.stray.brace.curly.python + - include: line-continuation + + # Always include these last and only one at a time! + expression-as-a-statement: + - include: expressions-common + - include: qualified-name + + expression-in-a-statement: + # Differs from expression-as-a-statement in that: + # - invalid-name matches will pop the current context + # - assignment expressions + - include: expressions-common + - include: illegal-names-pop + - include: qualified-name + - include: assignment-expression + + expression-in-a-group: # Always include this last! + # Differs from expression-in-a-statement in that: + # - accessor matching continues into the next line + - include: expression-in-a-statement + - match: '(\.) *(?={{identifier}})' + captures: + 1: punctuation.accessor.dot.python + push: + - include: magic-function-names + - include: magic-variable-names + - include: illegal-names + - include: generic-names + - match: '' + pop: true + + after-expression: + # direct function call + - match: '\s*(\()' + captures: + 1: punctuation.section.arguments.begin.python + push: + - meta_scope: meta.function-call.arguments.python + - match: \) + scope: punctuation.section.arguments.end.python + pop: true + - include: arguments + # item access + - match: '\s*(\[)' + captures: + 1: meta.item-access.python punctuation.section.brackets.begin.python + push: + - meta_content_scope: meta.item-access.arguments.python + - match: \] + scope: meta.item-access.python punctuation.section.brackets.end.python + pop: true + - include: illegal-assignment-expression + - match: ':' + scope: punctuation.separator.slice.python + - include: expression-in-a-group + # indirect function call following attribute access + - include: function-calls + # arbitrary attribute access + - match: '\s*(\.)' + captures: + 1: punctuation.accessor.dot.python + push: + - include: magic-function-names + - include: magic-variable-names + - include: illegal-names + - include: generic-names + - match: '' + pop: true + - match: '' + pop: true + + comments: + - match: "#" + scope: punctuation.definition.comment.python + push: + - meta_scope: comment.line.number-sign.python + - match: \n + pop: true + + constants: + - match: \b(None|True|False|Ellipsis|NotImplemented|__debug__)\b + scope: constant.language.python + - match: \.{3}(?!\w) + scope: constant.language.python + + numbers: + # https://docs.python.org/3/reference/lexical_analysis.html#numeric-literals + # hexadecimal + - match: \b(?i)(0x)\h*(L) # py2 + scope: constant.numeric.integer.hexadecimal.python + captures: + 1: punctuation.definition.numeric.base.python + 2: storage.type.numeric.python + - match: \b(?i)(0x)(_?\h)+ + scope: constant.numeric.integer.hexadecimal.python + captures: + 1: punctuation.definition.numeric.base.python + # octal + - match: \b(?i)(0o?)(?=o|[0-7])[0-7]*(L) # py2 + scope: constant.numeric.integer.octal.python + captures: + 1: punctuation.definition.numeric.base.python + 2: storage.type.numeric.python + - match: \b(?i)(0)[0-7]+ # py2 + scope: constant.numeric.integer.octal.python + captures: + 1: punctuation.definition.numeric.base.python + - match: \b(?i)(0o)(_?[0-7])+ + scope: constant.numeric.integer.octal.python + captures: + 1: punctuation.definition.numeric.base.python + # binary + - match: \b(?i)(0b)[01]*(L) # py2 + scope: constant.numeric.integer.binary.python + captures: + 1: punctuation.definition.numeric.base.python + 2: storage.type.numeric.python + - match: \b(?i)(0b)(_?[01])* + scope: constant.numeric.integer.binary.python + captures: + 1: punctuation.definition.numeric.base.python + # complex + - match: |- + (?x: + # 1.j, 1.1j, 1.1e1j, 1.1e-1j, 1.e1j, 1.e-1 | 1e1j, 1e-1j + \b{{digits}} (\.)? {{digits}}? {{exponent}}? + # .1j, .1e1j, .1e-1j + | (\.) {{digits}} {{exponent}}? + )([jJ]) + scope: constant.numeric.imaginary.decimal.python + captures: + 1: punctuation.separator.decimal.python + 2: punctuation.separator.decimal.python + 3: storage.type.numeric.python + # floating point + - match: |- + (?x: + # 1., 1.1, 1.1e1, 1.1e-1, 1.e1, 1.e-1 | 1e1, 1e-1 + \b{{digits}} (?: (\.) {{digits}}? {{exponent}}? | {{exponent}} ) + # .1, .1e1, .1e-1 + | (\.) {{digits}} {{exponent}}? + ) + scope: constant.numeric.float.decimal.python + captures: + 1: punctuation.separator.decimal.python + 2: punctuation.separator.decimal.python + # integer + - match: \b(?i)(?:[1-9]\d*|0)(L)\b # py2 + scope: constant.numeric.integer.decimal.python + captures: + 1: storage.type.numeric.python + - match: \b(?i)([1-9][\d_]*|0)\b + scope: constant.numeric.integer.decimal.python + + modifiers: + - match: \b(?:(global)|(nonlocal))\b + captures: + 1: storage.modifier.global.python + 2: storage.modifier.nonlocal.python + push: + - include: line-continuation-or-pop + - match: ',' + scope: punctuation.separator.storage-list.python + - include: name + - match: \S+ + scope: invalid.illegal.name.storage.python + + yields: + - match: \b(yield)(?:\s+(from))?\b + captures: + 1: keyword.control.flow.yield.python + 2: keyword.control.flow.yield-from.python + + assignment-expression: + - match: := + scope: keyword.operator.assignment.inline.python + + illegal-assignment-expression: + - match: := + scope: invalid.illegal.not-allowed-here.python + + assignments: + - include: illegal-assignment-expression + - match: ':' + scope: punctuation.separator.annotation.variable.python + - match: \+=|-=|\*=|/=|//=|%=|@=|&=|\|=|\^=|>>=|<<=|\*\*= + scope: keyword.operator.assignment.augmented.python + - match: '=(?!=)' + scope: keyword.operator.assignment.python + + operators: + - match: <> + scope: invalid.deprecated.operator.python + - match: <\=|>\=|\=\=|<|>|\!\= + scope: keyword.operator.comparison.python + - match: \+|\-|\*|\*\*|/|//|%|<<|>>|&|\||\^|~ + scope: keyword.operator.arithmetic.python + - match: \b(and|in|is|not|or)\b + comment: keyword operators that evaluate to True or False + scope: keyword.operator.logical.python + - match: '@' + scope: keyword.operator.matrix.python + + allow-unpack-operators: + # Match unpacking operators, if present + - include: comments + - match: \*{3,} + scope: invalid.illegal.syntax.python + pop: true + - match: \*\* + scope: keyword.operator.unpacking.mapping.python + pop: true + - match: \* + scope: keyword.operator.unpacking.sequence.python + pop: true + - match: (?=\S) + pop: true + + classes: + - match: '^\s*(class)\b' + captures: + 1: storage.type.class.python keyword.declaration.class.python + push: + - meta_scope: meta.class.python + - include: line-continuation-or-pop + - match: ':' + scope: punctuation.section.class.begin.python + pop: true + - match: "(?={{identifier}})" + push: + - meta_content_scope: entity.name.class.python + - include: entity-name-class + - match: '' + pop: true + - match: \( + scope: punctuation.section.inheritance.begin.python + set: + - meta_scope: meta.class.inheritance.python + - match: \) + scope: punctuation.section.inheritance.end.python + set: + - include: line-continuation-or-pop + - match: ':' + scope: meta.class.python punctuation.section.class.begin.python + pop: true + - match: (?=\S) + pop: true + - match: ':' + scope: invalid.illegal.no-closing-parens.python + pop: true + - match: ',' + scope: punctuation.separator.inheritance.python + - include: illegal-names-pop + - match: ({{identifier}}) *(=) + captures: + 1: variable.parameter.class-inheritance.python + 2: keyword.operator.assignment.python + - match: (?={{path}}) + push: + - meta_scope: entity.other.inherited-class.python + - match: '{{identifier}}(?: *(\.) *)?' + captures: + 1: punctuation.accessor.dot.python + - match: '' + pop: true + - include: expression-in-a-group + + functions: + - match: '^\s*(?:(async)\s+)?(def)\b' + captures: + 1: storage.modifier.async.python + 2: storage.type.function.python keyword.declaration.function.python + push: + - meta_scope: meta.function.python + - include: line-continuation-or-pop + - match: ':' + scope: punctuation.section.function.begin.python + pop: true + - match: "(?={{identifier}})" + push: + - meta_content_scope: entity.name.function.python + - include: entity-name-function + - match: '' + pop: true + - match: '(?=\()' + set: + - match: \( + scope: meta.function.parameters.python punctuation.section.parameters.begin.python + set: [function-parameters, allow-unpack-operators] + + function-parameters: + - meta_content_scope: meta.function.parameters.python + - match: \) + scope: punctuation.section.parameters.end.python + set: function-after-parameters + - include: comments + - match: ',' + scope: punctuation.separator.parameters.python + push: allow-unpack-operators + - match: / + scope: storage.modifier.positional-args-only.python + push: + - match: (?=[,)]) + pop: true + - match: \S + scope: invalid.illegal.expected-comma.python + - match: '(?==)' + set: + - match: '=' + scope: keyword.operator.assignment.python + set: + - meta_scope: meta.function.parameters.default-value.python + - match: '(?=[,)])' + set: [function-parameters, allow-unpack-operators] + - include: illegal-assignment-expression + - include: expression-in-a-group + - match: '(?=:)' + set: + - match: ':' + scope: punctuation.separator.annotation.parameter.python + set: + - meta_scope: meta.function.parameters.annotation.python + - match: '(?=[,)=])' + set: function-parameters + - include: illegal-assignment-expression + - include: expression-in-a-group + - include: function-parameters-tuple + - include: illegal-names + - match: '{{identifier}}' + scope: variable.parameter.python + - include: line-continuation + + function-parameters-tuple: + # python 2 style tuple arguments + # removed from python 3 since PEP-3113 + - match: \( + scope: punctuation.section.group.begin.python + push: + - meta_scope: meta.group.python + - match: \) + scope: punctuation.section.group.end.python + set: after-expression + - include: comments + - match: ',' + scope: punctuation.separator.parameters.python + push: allow-unpack-operators + # default values should follow the argument + - match: '=' + push: + - meta_scope: invalid.illegal.default-value.python + - match: '(?=[,)=])' + pop: true + # python 2 does not support type annotations + - match: '(?=:)' + push: + - meta_scope: invalid.illegal.annotation.python + - match: '(?=[,)=])' + pop: true + - include: illegal-names + - match: '{{identifier}}' + scope: variable.parameter.python + - include: line-continuation + + function-after-parameters: + - meta_content_scope: meta.function.python + - match: '(?=->)' + set: + - meta_content_scope: meta.function.annotation.return.python + - match: -> + scope: punctuation.separator.annotation.return.python + - include: illegal-assignment-expression + - match: '(?=:)' + set: function-after-parameters + - include: line-continuation-or-pop + - include: expression-in-a-statement + - match: ':' + scope: meta.function.python punctuation.section.function.begin.python + pop: true + - include: comments + - match: (?=\S) + pop: true + + decorators: + - match: ^\s*(?=@) + push: + # Due to line continuations, we don't know whether this is a "function call" yet + - meta_content_scope: meta.annotation.python + - match: '@' + scope: punctuation.definition.annotation.python + - match: $ + pop: true + - include: line-continuation-or-pop + - match: (?=\.?\s*{{path}}\s*\() # now we do + set: [decorator-function-call-wrapper, qualified-name-until-leaf] + - match: (?=\.?\s*{{path}}) + push: [decorator-wrapper, qualified-name-until-leaf] + - match: \S + scope: invalid.illegal.character.python + pop: true + + decorator-wrapper: + - match: (\.)\s* + captures: + 1: punctuation.accessor.dot.python + set: + - meta_scope: meta.qualified-name.python + - meta_content_scope: variable.annotation.python + - include: dotted-name-specials + - include: generic-names + - match: '' + pop: true + - match: '' + set: + - meta_scope: meta.qualified-name.python variable.annotation.python + - include: name-specials + - include: generic-names + - match: '' + pop: true + + decorator-function-call-wrapper: + - meta_scope: meta.annotation.function.python + - match: \) + scope: punctuation.section.arguments.end.python + set: after-expression + - match: \( + scope: meta.annotation.function.python punctuation.section.arguments.begin.python + push: + - clear_scopes: 1 + - meta_content_scope: meta.annotation.arguments.python + - match: (?=\)) + pop: true + - include: arguments + - match: (\.)\s* + captures: + 1: punctuation.accessor.dot.python + push: + - meta_scope: meta.qualified-name.python + - meta_content_scope: variable.annotation.function.python + - include: dotted-name-specials + - include: generic-names + - match: '' + pop: true + - match: '' + push: + - meta_scope: meta.qualified-name.python variable.annotation.function.python + - include: name-specials + - include: generic-names + - match: '' + pop: true + + item-access: + - match: '(?={{path}}\s*\[)' + push: + - match: \] + scope: meta.item-access.python punctuation.section.brackets.end.python + set: after-expression + - match: '(?={{path}}\s*\[)' + push: + - meta_content_scope: meta.item-access.python + - match: '(?=\s*\[)' + pop: true + - include: qualified-name + - match: \[ + scope: meta.item-access.python punctuation.section.brackets.begin.python + push: + - meta_content_scope: meta.item-access.arguments.python + - match: '(?=\])' + pop: true + - match: ':' + scope: punctuation.separator.slice.python + - include: expression-in-a-group + + function-calls: + - match: '(?=(\.\s*)?{{path}}\s*\()' + push: [function-call-wrapper, qualified-name-until-leaf] + + function-call-wrapper: + - meta_scope: meta.function-call.python + - match: (?=\() # need to remove meta.function-call.python from opening parens + set: + - match: \( + scope: punctuation.section.arguments.begin.python + set: + - meta_scope: meta.function-call.arguments.python + - match: \) + scope: punctuation.section.arguments.end.python + set: after-expression + - include: arguments + - match: (\.)\s*(?={{identifier}}) + captures: + 1: punctuation.accessor.dot.python + push: + - meta_scope: meta.qualified-name.python + - meta_content_scope: variable.function.python + - include: dotted-name-specials + - include: generic-names + - match: '' + pop: true + - match: (?={{identifier}}) + push: + - meta_scope: meta.qualified-name.python variable.function.python + - include: name-specials + - include: generic-names + - match: '' + pop: true + + arguments: + - include: keyword-arguments + - match: ',' + scope: punctuation.separator.arguments.python + push: allow-unpack-operators + - include: inline-for + - include: expression-in-a-group + + keyword-arguments: + - match: '(?={{identifier}}\s*=(?!=))' + push: + - include: line-continuation-or-pop + - match: '=' + scope: keyword.operator.assignment.python + set: + - include: illegal-assignment-expression + - match: (?=[,):]) + pop: true + - include: expression-in-a-group + - include: illegal-names + - match: '{{identifier}}' + scope: variable.parameter.python + + lambda: + - match: \b(lambda)(?=\s|:|$) + scope: storage.type.function.inline.python keyword.declaration.function.inline.python + push: [lambda-parameters, allow-unpack-operators] + + lambda-parameters: + - meta_scope: meta.function.inline.python + - meta_content_scope: meta.function.inline.parameters.python + - include: line-continuation-or-pop + - match: '\:' + scope: punctuation.section.function.begin.python + set: + # clear meta_scope + - match: '' + set: + - meta_scope: meta.function.inline.body.python + - include: illegal-assignment-expression + # We don't know whether we are within a grouped + # or line-statement context at this point. + # If we're in a group, the underlying context will take over + # at the end of the line. + - match: (?=[,):])|$ + pop: true + - include: expression-in-a-statement + - match: ',' + scope: punctuation.separator.parameters.python + push: allow-unpack-operators + - include: keyword-arguments + - include: function-parameters-tuple + - include: illegal-names + - match: '{{identifier}}' + scope: variable.parameter.python + - match: '\S' + scope: invalid.illegal.expected-parameter.python + + groups: + - match: \( + scope: punctuation.section.group.begin.python + push: + - meta_scope: meta.group.python + - match: \) + scope: punctuation.section.group.end.python + set: after-expression + - match: ',' + scope: punctuation.separator.tuple.python + - include: inline-for + - include: expression-in-a-group + + tuples: + # We don't know for certain, whether a parenthesized expression is a tuple, + # so try looking ahead. + - match: (\()\s*(\)) + scope: meta.sequence.tuple.empty.python + captures: + 1: punctuation.section.sequence.begin.python + 2: punctuation.section.sequence.end.python + push: after-expression + - match: \((?={{simple_expression}},|\s*\*{{path}}) + scope: punctuation.section.sequence.begin.python + push: inside-tuple + # TODO generator + # - match: \((?:{{simple_expression}}for) + + inside-tuple: + - meta_scope: meta.sequence.tuple.python + - match: \) + scope: punctuation.section.sequence.end.python + set: after-expression + - match: ',' + scope: punctuation.separator.sequence.python + push: allow-unpack-operators + - include: inline-for + - include: expression-in-a-group + + lists: + - match: (\[)\s*(\]) + scope: meta.sequence.list.empty.python + captures: + 1: punctuation.section.sequence.begin.python + 2: punctuation.section.sequence.end.python + push: after-expression + - match: \[ + scope: punctuation.section.sequence.begin.python + push: [inside-list, allow-unpack-operators] + + inside-list: + - meta_scope: meta.sequence.list.python + - match: \] + scope: punctuation.section.sequence.end.python + set: after-expression + - match: ',' + scope: punctuation.separator.sequence.python + push: allow-unpack-operators + - include: inline-for + - include: expression-in-a-group + + dictionaries-and-sets: + # Dictionaries and set literals use the same punctuation, + # so we try looking ahead to determine whether we have a dict or a set. + - match: '(\{)\s*(\})' + scope: meta.mapping.empty.python + captures: + 1: punctuation.section.mapping.begin.python + 2: punctuation.section.mapping.end.python + push: after-expression + - match: \{(?={{simple_expression}}:|\s*\*\*) + scope: punctuation.section.mapping.begin.python + push: inside-dictionary + - match: \{(?={{simple_expression}}[,}]|\s*\*) + scope: punctuation.section.set.begin.python + push: inside-set + # If the expression is "more complex" or on the next line, + # fall back to default and determine later. + - match: \{ + scope: punctuation.section.mapping-or-set.begin.python + push: + - meta_scope: meta.mapping-or-set.python + - match: \} + scope: punctuation.section.mapping-or-set.end.python + set: after-expression + - match: (?={{simple_expression}}:|\s*\*\*) + set: inside-dictionary + - match: (?={{simple_expression}}[,}]|\s*\*) + set: inside-set + - match: ',' + scope: punctuation.separator.set.python + set: inside-set + - include: illegal-assignment-expression + - match: ':' + scope: punctuation.separator.mapping.key-value.python + set: inside-directory-value + - include: inline-for + - include: expression-in-a-group + + inside-dictionary: + - meta_scope: meta.mapping.python + - match: \} + scope: punctuation.section.mapping.end.python + set: after-expression + - include: illegal-assignment-expression + - match: ':' + scope: punctuation.separator.mapping.key-value.python + set: inside-directory-value + - match: ',' + scope: invalid.illegal.expected-colon.python + - match: \*\* + scope: keyword.operator.unpacking.mapping.python + push: + - match: (?=\}) + pop: true + - match: ',' + scope: punctuation.separator.mapping.python + pop: true + - include: expression-in-a-group + - include: comments + - match: (?=\S) + push: + - clear_scopes: 1 + - meta_scope: meta.mapping.key.python + - match: \s*(?=\}|,|:) + pop: true + - include: expression-in-a-group + + inside-directory-value: + - meta_content_scope: meta.mapping.python + - match: \} + scope: punctuation.section.mapping.end.python + set: after-expression + - match: (?=,) + set: + # clear meta scope from this match, because 'inside-directory' has it in meta_scope + - match: ',' + scope: punctuation.separator.mapping.python + set: inside-dictionary + - match: (?=for\b) + push: + - match: (?=\}) + pop: true + - match: ',' + scope: invalid.illegal.unexpected-comma.python + - include: inline-for + - include: expression-in-a-group + - include: comments + - match: (?=\S) + push: + - clear_scopes: 1 + - meta_content_scope: meta.mapping.value.python + - match: (?=\s*(\}|,|for\b)) + pop: true + - include: expression-in-a-group + + inside-set: + - meta_scope: meta.set.python + - match: \} + scope: punctuation.section.set.end.python + set: after-expression + - include: illegal-assignment-expression + - match: ':' + scope: invalid.illegal.colon-inside-set.python + - match: ',' + scope: punctuation.separator.set.python + - match: \* + scope: keyword.operator.unpacking.sequence.python + push: + - match: (?=\}) + pop: true + - match: ',' + scope: punctuation.separator.set.python + pop: true + - include: expression-in-a-group + - include: inline-for + - include: expression-in-a-group + + builtin-exceptions: + - match: |- + (?x)\b( + ( + Arithmetic|Assertion|Attribute|BlockingIO|BrokenPipe|Buffer|ChildProcess| + Connection(Aborted|Refused|Reset)?|EOF|Environment|FileExists| + FileNotFound|FloatingPoint|Interrupted|IO|IsADirectoryError| + Import|Indentation|Index|Key|Lookup|Memory|Name|NotADirectory| + NotImplemented|OS|Overflow|Permission|ProcessLookup|Reference| + Runtime|Standard|Syntax|System|Tab|Timeout|Type|UnboundLocal| + Unicode(Encode|Decode|Translate)?|Value|VMS|Windows|ZeroDivision + )Error| + ((Pending)?Deprecation|Runtime|Syntax|User|Future|Import|Unicode|Bytes)?Warning| + (Base)?Exception| + SystemExit|StopIteration|NotImplemented|KeyboardInterrupt|GeneratorExit + )\b + scope: support.type.exception.python + + builtin-functions: + - match: |- + (?x)\b( + __import__|all|abs|any|apply|ascii|bin|breakpoint|callable|chr|classmethod|cmp|coerce| + compile|delattr|dir|divmod|enumerate|eval|exec|execfile|filter|format|getattr| + globals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|iter| + len|locals|map|max|min|next|oct|open|ord|pow|print|property|range| + raw_input|reduce|reload|repr|reversed|round|setattr|sorted|staticmethod| + sum|super|type|unichr|vars|zip + )\b + scope: support.function.builtin.python + + builtin-types: + - match: |- + (?x)\b( + basestring|bool|buffer|bytearray|bytes|complex|dict|float|frozenset|int| + list|long|memoryview|object|range|set|slice|str|tuple|unicode|xrange + )\b + scope: support.type.python + + name: + - match: '(?={{identifier}})' + push: + - include: name-specials + - match: '{{identifier_constant}}' + scope: variable.other.constant.python + - include: generic-names + - match: '' + pop: true + + dotted-name: + - match: '\s*(\.)\s*(?={{identifier}})' + captures: + 1: punctuation.accessor.dot.python + push: + - include: dotted-name-specials + - match: '{{identifier_constant}}' + scope: variable.other.constant.python + - include: generic-names + - match: '' + pop: true + + qualified-name: + - match: '(?={{path}})' + push: + - meta_scope: meta.qualified-name.python + - include: name + - include: dotted-name + - match: '' + pop: true + + qualified-name-until-leaf: + # Push this together with another context to match a qualified name + # until the last non-special identifier (if any). + # This allows the leaf to be scoped individually. + - meta_scope: meta.qualified-name.python + # If a line continuation follows, this may or may not be the last leaf (most likley not though) + - match: (?={{identifier}}\s*(\.|\\)) + push: + - include: name-specials + - include: generic-names + - match: '' + pop: true + - match: (\.)\s*(?={{identifier}}\s*(\.|\\)) + captures: + 1: punctuation.accessor.dot.python + push: + - include: dotted-name-specials + - include: generic-names + - match: '' + pop: true + - match: \.(?!\s*{{identifier}}) # don't match last dot + scope: punctuation.accessor.dot.python + - match: (?=\S|$) + pop: true + + name-specials: + - include: builtin-functions + - include: builtin-types + - include: builtin-exceptions + - include: illegal-names + - include: magic-function-names + - include: magic-variable-names + - include: language-variables + + dotted-name-specials: + - include: magic-function-names + - include: magic-variable-names + - include: illegal-names + + entity-name-class: + - include: illegal-names + - include: generic-names + + entity-name-function: + - include: magic-function-names + - include: illegal-names + - include: generic-names + + generic-names: + - match: '{{identifier}}' + scope: meta.generic-name.python + + illegal-names: + - match: \b{{illegal_names}}\b + scope: invalid.illegal.name.python + + illegal-names-pop: + - match: \b{{illegal_names}}\b + scope: invalid.illegal.name.python + pop: true + + language-variables: + - match: \b(self|cls)\b + scope: variable.language.python + - match: _(?!{{identifier_continue}}) + scope: variable.language.python + + line-continuation: + - match: (\\)(.*)$\n? + captures: + 1: punctuation.separator.continuation.line.python + 2: invalid.illegal.unexpected-text.python + # make sure to resume parsing at next line + push: + # This prevents strings after a continuation from being a docstring + - include: strings + - match: (?=\S|^\s*$|\n) # '\n' for when we matched a string earlier + pop: true + + line-continuation-or-pop: + - include: line-continuation + - match: (?=\s*($|;|#)) + pop: true + + magic-function-names: + # https://docs.python.org/2/reference/datamodel.html + # https://docs.python.org/3/reference/datamodel.html + - match: |- + (?x)\b__(?: + # unary operators + invert|neg|pos|abs| + # binary operators + add|and|div|divmod|floordiv|lshift|mod|mul|or|pow|rshift|sub|truediv|xor| + contains| + # right-hand binary operators + radd|rand|rdiv|rdivmod|rfloordiv|rlshift|rmod|rmul|ror|rpow|rrshift|rsub|rtruediv|rxor| + # in-place operator assignments + iadd|iand|idiv|ifloordiv|ilshift|imod|imul|ior|ipow|irshift|isub|itruediv|ixor| + # comparisons + eq|ge|gt|le|lt|ne| + cmp|rcmp| # py2 + # primary coercion + bool|str| + nonzero|unicode| # py2 + # number coercion (converts something to a number) + bytes|complex|float|index|int|round| + long| # py2 + # other "coercion" + format|len|length_hint|hash|repr|reversed| + coerce|hex|oct| # py2 + fspath| + # iterator (and 'await') + iter|next| + aiter|anext| + await| + # attribute and item access + delattr|delitem|delslice| + getattr|getattribute|getitem|getslice| + setattr|setitem|setslice| + dir|missing| + # context manager + enter|exit| + aenter|aexit| + # other class magic + call|del|init|new|init_subclass| + instancecheck|subclasscheck| + # pickling + getnewargs|getnewargs_ex|getstate|setstate|reduce|reduce_ex| + # descriptors + delete|get|set|set_name| + # class-specific + subclasses| + # dataclasses (PEP 557) + post_init| + # for typing core support (PEP 560) + class_getitem|mro_entries + )__\b + comment: these methods have magic interpretation by python and are generally called indirectly through syntactic constructs + scope: support.function.magic.python + + magic-variable-names: + # magic variables which a class/module/object may have. + # https://docs.python.org/3/library/inspect.html#types-and-members + # https://docs.python.org/3/reference/datamodel.html#object.__slots__ + # https://docs.python.org/3/reference/datamodel.html#preparing-the-class-namespace + - match: |- + (?x)\b__(?: + # generic object + class|dict|doc|module|name| + # module-specific / global + all|file|package| + # functions & methods + annotations|closure|code|defaults|func|globals|kwdefaults|self|qualname| + # classes (attributes) + bases|prepare|slots|metaclass|mro| + # Python 2 + members|methods + )__\b + scope: support.variable.magic.python + + docstrings: + - match: ^\s*(?=(?i)(ur|ru|u|r)?("""|''')) + push: + - match: (?i)(u)?("""|''') + captures: + 1: storage.type.string.python + 2: punctuation.definition.comment.begin.python + set: + - meta_scope: comment.block.documentation.python + - include: escaped-unicode-char + - include: escaped-char + - match: '\2' + scope: punctuation.definition.comment.end.python + pop: true + - match: (?i)(u?ru?)("""|''') + captures: + 1: storage.type.string.python + 2: punctuation.definition.comment.begin.python + set: + - meta_scope: comment.block.documentation.python + - match: '\2' + scope: punctuation.definition.comment.end.python + pop: true + + escaped-char: + - match: '(\\x\h{2})|(\\[0-7]{1,3})|(\\[\\"''abfnrtv])' + captures: + 1: constant.character.escape.hex.python + 2: constant.character.escape.octal.python + 3: constant.character.escape.python + - match: \\. # deprecated in 3.6 and will eventually be a syntax error + scope: invalid.deprecated.character.escape.python + + escaped-unicode-char: + - match: '(\\U\h{8})|(\\u\h{4})|(\\N\{[a-zA-Z ]+\})' + captures: + 1: constant.character.escape.unicode.16-bit-hex.python + 2: constant.character.escape.unicode.32-bit-hex.python + 3: constant.character.escape.unicode.name.python + + escaped-fstring-escape: + # special-case the '\{{' sequence because it has higher priority than the deprecated '\{' + - match: (\\)(\{\{|\}\}) + scope: constant.character.escape.backslash.regexp + captures: + 1: invalid.deprecated.character.escape.python + 2: constant.character.escape.python + + line-continuation-inside-string: + - match: (\\)$\n? + captures: + 1: punctuation.separator.continuation.line.python + - match: \n + scope: invalid.illegal.unclosed-string.python + set: after-expression + + line-continuation-inside-block-string: + - match: \\$ + scope: punctuation.separator.continuation.line.python + + constant-placeholder: + - match: |- # printf style + (?x) + % + ( \( ({{identifier}}) \) )? # mapping key + \#? # alternate form + 0? # pad with zeros + \-? # left-adjust + \ ? # implicit sign + [+-]? # sign + (\d*|\*) # width + (\. (\d*|\*))? # precision + [hlL]? # length modifier (but ignored) + [acdeEfFgGiorsuxX%] + scope: constant.other.placeholder.python + captures: + 2: variable.other.placeholder.python + - match: '{{strftime_spec}}' + scope: constant.other.placeholder.python + - match: '\{\{|\}\}' + scope: constant.character.escape.python + - include: formatting-syntax + + formatting-syntax: + # https://docs.python.org/3.6/library/string.html#formatstrings + - match: |- # simple form + (?x) + (\{) + (?: [\w.\[\]]+)? # field_name + ( ! [ars])? # conversion + ( : (?:{{format_spec}}| # format_spec OR + [^}%]*%.[^}]*) # any format-like string + )? + (\}) + scope: constant.other.placeholder.python + captures: + 1: punctuation.definition.placeholder.begin.python + 2: storage.modifier.conversion.python + 3: constant.other.format-spec.python + 4: punctuation.definition.placeholder.end.python + - match: \{(?=[^\}"']+\{[^"']*\}) # complex (nested) form + scope: punctuation.definition.placeholder.begin.python + push: + - meta_scope: constant.other.placeholder.python + - match: \} + scope: punctuation.definition.placeholder.end.python + pop: true + - match: '[\w.\[\]]+' + - match: '![ars]' + scope: storage.modifier.conversion.python + - match: ':' + push: + - meta_scope: meta.format-spec.python constant.other.format-spec.python + - match: (?=\}) + pop: true + - include: formatting-syntax + + f-string-content: + # https://www.python.org/dev/peps/pep-0498/ + # https://docs.python.org/3.6/reference/lexical_analysis.html#f-strings + - match: \{\{|\}\} + scope: constant.character.escape.python + - match: \{\s*\} + scope: invalid.illegal.empty-expression.python + - match: (?=\{) + push: f-string-replacement + - match: \} + scope: invalid.illegal.stray-brace.python + + f-string-content-with-regex: + # Same as f-string-content, but will reset the entire scope stack + # and has an additional match. + - match: \\(\{\{|\}\}) + scope: constant.character.escape.backslash.regexp + captures: + 1: constant.character.escape.python + - match: \{\{|\}\} + scope: constant.character.escape.python + - match: \{\s*\} + scope: invalid.illegal.empty-expression.python + - match: (?=\{) + push: f-string-replacement-reset + - match: \} + scope: invalid.illegal.stray-brace.python + + f-string-replacement: + - clear_scopes: 1 + - match: \} + scope: meta.interpolation.python punctuation.section.interpolation.end.python + pop: true + - match: \{ + scope: punctuation.section.interpolation.begin.python + push: + - meta_scope: meta.interpolation.python + - match: (?=\}) + pop: true + - match: '![ars]' + scope: storage.modifier.conversion.python + - match: = + scope: storage.modifier.debug.python + - match: ':' + push: + - meta_scope: meta.format-spec.python constant.other.format-spec.python + # Because replacements can also be used *within* the format-spec, + # basically any character is valid and matching {{format_spec}} is useless. + # - match: '{{format_spec}}' + - match: (?=\}) + pop: true + - include: f-string-content + - match: '' + push: + - meta_content_scope: source.python.embedded + - match: (?==?(![^=]|:|\})) + pop: true + - match: \\ + scope: invalid.illegal.backslash-in-fstring.python + - include: inline-for + - include: expression-in-a-group + + f-string-replacement-reset: + # Same as f-string-replacement, but with clear_scopes: true + - clear_scopes: true + - meta_scope: source.python meta.string.interpolated.python + - match: \} + scope: meta.interpolation.python punctuation.section.interpolation.end.python + pop: true + - match: \{ + scope: punctuation.section.interpolation.begin.python + push: + - meta_scope: meta.interpolation.python + - match: (?=\}) + pop: true + - match: '![ars]' + scope: storage.modifier.conversion.python + - match: ':' + push: + - meta_scope: meta.format-spec.python constant.other.format-spec.python + - match: (?=\}) + pop: true + - include: f-string-content + - match: '' + push: + - meta_content_scope: source.python.embedded + - match: (?=![^=]|:|\}) + pop: true + - match: \\ + scope: invalid.illegal.backslash-in-fstring.python + - include: inline-for + - include: expression-in-a-group + + string-quoted-double-block: + # Triple-quoted capital R raw string, unicode or not, no syntax embedding + - match: '([uU]?R)(""")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.end.python + set: after-expression + - include: escaped-unicode-char + # Triple-quoted capital R raw string, bytes, no syntax embedding + - match: '([bB]R|R[bB])(""")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.end.python + set: after-expression + # Triple-quoted raw string, unicode or not, will detect SQL, otherwise regex + - match: '([uU]?r)(""")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.block.python + - match: '(?={{sql_indicator}})' + set: + - meta_scope: meta.string.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.end.python + set: after-expression + - match: '' + push: scope:source.sql + with_prototype: + - match: '(?=""")' + pop: true + - include: escaped-unicode-char + - include: constant-placeholder + - match: '(?=\S)' + set: + - meta_scope: meta.string.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.end.python + set: after-expression + - match: '' + push: scope:source.regexp.python + with_prototype: + - match: '(?=""")' + pop: true + - include: escaped-unicode-char + # Triple-quoted raw string, bytes, will use regex + - match: '([bB]r|r[bB])(""")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.end.python + set: after-expression + - match: '' + embed: scope:source.regexp.python + escape: (?=""") + # Triple-quoted raw f-string + - match: ([fF]R|R[fF])(""") + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.double.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.begin.python + set: after-expression + - include: f-string-content + # Triple-quoted raw f-string, treated as regex + - match: ([fF]r|r[fF])(""") + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.double.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.begin.python + set: after-expression + - match: '' + push: scope:source.regexp.python + with_prototype: + - match: '(?=""")' + pop: true + - include: f-string-content-with-regex + # Triple-quoted f-string + - match: ([fF])(""") + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.double.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.begin.python + set: after-expression + - include: line-continuation-inside-block-string + - include: escaped-fstring-escape + - include: escaped-unicode-char + - include: escaped-char + - include: f-string-content + # Triple-quoted string, unicode or not, will detect SQL + - match: '([uU]?)(""")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.block.python + - match: '(?={{sql_indicator}})' + set: + - meta_scope: meta.string.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.end.python + set: after-expression + - match: '' + push: scope:source.sql + with_prototype: + - match: '(?=""")' + pop: true + - include: line-continuation-inside-block-string + - include: escaped-unicode-char + - include: escaped-char + - include: constant-placeholder + - match: '(?=\S)' + set: + - meta_scope: meta.string.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-block-string + - include: escaped-unicode-char + - include: escaped-char + - include: constant-placeholder + # Triple-quoted string, bytes, no syntax embedding + - match: '([bB])(""")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.block.python + - match: '"""' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-block-string + - include: escaped-char + - include: constant-placeholder + + string-quoted-double: + # Single-line capital R raw string, unicode or not, no syntax embedding + - match: '([uU]?R)(")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + # Single-line capital R raw string, bytes, no syntax embedding + - match: '([bB]R|R[bB])(")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + # Single-line raw string, unicode or not, starting with a SQL keyword + - match: '([uU]?r)(")(?={{sql_indicator}})' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + push: scope:source.sql + with_prototype: + - match: '(?="|\n)' + pop: true + - include: constant-placeholder + - include: line-continuation-inside-string + # Single-line raw string, unicode or not, treated as regex + - match: '([uU]?r)(")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + push: scope:source.regexp.python + with_prototype: + - match: '(?="|\n)' + pop: true + - include: line-continuation-inside-string + # Single-line raw string, bytes, treated as regex + - match: '([bB]r|r[bB])(")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + embed: scope:source.regexp.python + escape: (?="|\n) + # Single-line raw f-string + - match: (R[fF]|[fF]R)(") + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - include: f-string-content + # Single-line raw f-string, treated as regex + - match: (r[fF]|[fF]r)(") + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + push: scope:source.regexp.python + with_prototype: + - match: '(?="|\n)' + pop: true + - include: line-continuation-inside-string + - include: f-string-content-with-regex + # Single-line f-string + - match: ([fF])(") + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: escaped-fstring-escape + - include: escaped-unicode-char + - include: escaped-char + - include: line-continuation-inside-string + - include: f-string-content + # Single-line string, unicode or not, starting with a SQL keyword + - match: '([uU]?)(")(?={{sql_indicator}})' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + push: scope:source.sql + with_prototype: + - match: '(?="|\n)' + pop: true + - include: escaped-unicode-char + - include: escaped-char + - include: line-continuation-inside-string + - include: constant-placeholder + # Single-line string, unicode or not + - match: '([uU]?)(")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: escaped-unicode-char + - include: escaped-char + - include: line-continuation-inside-string + - include: constant-placeholder + # Single-line string, bytes + - match: '([bB])(")' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.double.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.double.python + - match: '"' + scope: punctuation.definition.string.end.python + set: after-expression + - include: escaped-char + - include: line-continuation-inside-string + - include: constant-placeholder + + string-quoted-single-block: + # Triple-quoted capital R raw string, unicode or not, no syntax embedding + - match: ([uU]?R)(''') + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.end.python + set: after-expression + # Triple-quoted capital R raw string, bytes, no syntax embedding + - match: ([bB]R|R[bB])(''') + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.end.python + set: after-expression + # Triple-quoted raw string, unicode or not, will detect SQL, otherwise regex + - match: ([uU]?r)(''') + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.block.python + - match: '(?={{sql_indicator}})' + set: + - meta_scope: meta.string.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.end.python + set: after-expression + - match: '' + push: scope:source.sql + with_prototype: + - match: (?=''') + pop: true + - include: escaped-unicode-char + - include: escaped-char + - include: constant-placeholder + - match: '(?=\S)' + set: + - meta_scope: meta.string.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.end.python + set: after-expression + - match: '' + push: scope:source.regexp.python + with_prototype: + - match: (?=''') + pop: true + - include: escaped-unicode-char + # Triple-quoted raw string, bytes, will use regex + - match: ([bB]r|r[bB])(''') + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.end.python + set: after-expression + - match: '' + embed: scope:source.regexp.python + escape: (?=''') + # Triple-quoted raw f-string + - match: ([fF]R|R[fF])(''') + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.single.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.begin.python + set: after-expression + - include: f-string-content + # Triple-quoted raw f-string, treated as regex + - match: ([fF]r|r[fF])(''') + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.single.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.begin.python + set: after-expression + - match: '' + push: scope:source.regexp.python + with_prototype: + - match: (?=''') + pop: true + - include: f-string-content-with-regex + # Triple-quoted f-string + - match: ([fF])(''') + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.single.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.begin.python + set: after-expression + - include: line-continuation-inside-block-string + - include: escaped-fstring-escape + - include: escaped-unicode-char + - include: escaped-char + - include: f-string-content + # Triple-quoted string, unicode or not, will detect SQL + - match: ([uU]?)(''') + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.block.python + - match: '(?={{sql_indicator}})' + set: + - meta_scope: meta.string.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.end.python + set: after-expression + - match: '' + push: scope:source.sql + with_prototype: + - match: (?=''') + pop: true + - include: line-continuation-inside-block-string + - include: escaped-unicode-char + - include: escaped-char + - include: constant-placeholder + - match: '(?=\S)' + set: + - meta_scope: meta.string.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-block-string + - include: escaped-unicode-char + - include: escaped-char + - include: constant-placeholder + # Triple-quoted string, bytes, no syntax embedding + - match: ([bB])(''') + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.block.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.block.python + - match: "'''" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-block-string + - include: escaped-char + - include: constant-placeholder + + string-quoted-single: + # Single-line capital R raw string, unicode or not, no syntax embedding + - match: '([uU]?R)('')' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + # Single-line capital R raw string, bytes, no syntax embedding + - match: '([bB]R|R[bB])('')' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + # Single-line raw string, unicode or not, starting with a SQL keyword + - match: '([uU]?r)('')(?={{sql_indicator}})' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + push: scope:source.sql + with_prototype: + - match: '(?=''|\n)' + pop: true + - include: line-continuation-inside-string + - include: constant-placeholder + # Single-line raw string, unicode or not, treated as regex + - match: '([uU]?r)('')' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + push: scope:source.regexp.python + with_prototype: + - match: '(?=''|\n)' + pop: true + - include: line-continuation-inside-string + # Single-line raw string, bytes, treated as regex + - match: '([bB]r|r[bB])('')' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + push: scope:source.regexp.python + with_prototype: + - match: '(?=''|\n)' + pop: true + - include: line-continuation-inside-string + # Single-line raw f-string + - match: ([fF]R|R[fF])(') + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - include: f-string-content + # Single-line raw f-string, treated as regex + - match: ([fF]r|r[fF])(') + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + push: scope:source.regexp.python + with_prototype: + - match: (?='|\n) + pop: true + - include: line-continuation-inside-string + - include: f-string-content-with-regex + # Single-line f-string + - match: ([fF])(') + captures: + 1: storage.type.string.python + 2: meta.string.interpolated.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.interpolated.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: escaped-fstring-escape + - include: escaped-unicode-char + - include: escaped-char + - include: line-continuation-inside-string + - include: f-string-content + # Single-line string, unicode or not, starting with a SQL keyword + - match: '([uU]?)('')(?={{sql_indicator}})' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: line-continuation-inside-string + - match: '' + push: scope:source.sql + with_prototype: + - match: '(?=''|\n)' + pop: true + - include: escaped-unicode-char + - include: escaped-char + - include: line-continuation-inside-string + - include: constant-placeholder + # Single-line string, unicode or not + - match: '([uU]?)('')' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: escaped-unicode-char + - include: escaped-char + - include: line-continuation-inside-string + - include: constant-placeholder + # Single-line string, bytes + - match: '([bB])('')' + captures: + 1: storage.type.string.python + 2: meta.string.python string.quoted.single.python punctuation.definition.string.begin.python + push: + - meta_content_scope: meta.string.python string.quoted.single.python + - match: "'" + scope: punctuation.definition.string.end.python + set: after-expression + - include: escaped-char + - include: line-continuation-inside-string + - include: constant-placeholder + + strings: + # block versions must be matched first + - include: string-quoted-double-block + - include: string-quoted-double + - include: string-quoted-single-block + - include: string-quoted-single + + inline-for: + - match: \b(?:(async)\s+)?(for)\b + captures: + 1: storage.modifier.async.python + 2: keyword.control.loop.for.generator.python + push: + - include: comments + - meta_scope: meta.expression.generator.python + - match: \bin\b + scope: keyword.control.loop.for.in.python + pop: true + - match: '(?=[)\]}])' + scope: invalid.illegal.missing-in.python + pop: true + - include: illegal-names-pop + - include: target-list + + inline-if: + - match: \bif\b + scope: keyword.control.conditional.if.python + - match: \belse\b + scope: keyword.control.conditional.else.python + + target-list: + - match: ',' + scope: punctuation.separator.target-list.python + - match: \( + scope: punctuation.section.target-list.begin.python + push: + - include: comments + - match: ',' + scope: punctuation.separator.target-list.python + - match: \) + scope: punctuation.section.target-list.end.python + pop: true + - include: target-list + - include: name + - include: name diff --git a/assets/syntaxes/Packages/Python/Regular Expressions (Python).sublime-syntax b/assets/syntaxes/Packages/Python/Regular Expressions (Python).sublime-syntax new file mode 100644 index 000000000..883466177 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Regular Expressions (Python).sublime-syntax @@ -0,0 +1,96 @@ +%YAML 1.2 +--- +name: Regular Expressions (Python) +comment: Matches Python's regular expression syntax. +scope: source.regexp.python +hidden: true +contexts: + main: + - match: (#)[^]\[(){}^$+*?\\|"']*$ + comment: + We are restrictive in what we allow to go after the comment character to avoid + false positives, since the availability of comments depend on regexp flags. + scope: comment.line.number-sign.regexp + captures: + 1: punctuation.definition.comment.regexp + - match: '\\[bBAZzG]|\^|\$' + scope: keyword.control.anchor.regexp + - match: '\\[1-9][0-9]?' + scope: keyword.other.back-reference.regexp + - match: '[?+*][?+]?|\{(\d+,\d+|\d+,|,\d+|\d+)\}\??' + scope: keyword.operator.quantifier.regexp + - match: \| + scope: keyword.operator.or.regexp + - match: '\(\?\#' + scope: punctuation.definition.comment.begin.regexp + push: + - meta_scope: comment.block.regexp + - match: \) + scope: punctuation.definition.comment.end.regexp + pop: true + - match: '\(\?[iLmsux]+\)' + scope: keyword.other.option-toggle.regexp + - match: '(\()(\?P=([a-zA-Z_][a-zA-Z_0-9]*\w*))(\))' + scope: keyword.other.back-reference.named.regexp + - match: (\()((\?=)|(\?!)|(\?<=)|(\?<!)) + captures: + 1: punctuation.definition.group.begin.regexp + 2: constant.other.assertion.regexp + 3: meta.assertion.look-ahead.regexp + 4: meta.assertion.negative-look-ahead.regexp + 5: meta.assertion.look-behind.regexp + 6: meta.assertion.negative-look-behind.regexp + push: + - meta_scope: meta.group.assertion.regexp + - match: \) + scope: punctuation.definition.group.end.regexp + pop: true + - include: main + - match: '(\()(\?\(([1-9][0-9]?|[a-zA-Z_][a-zA-Z_0-9]*)\))' + comment: + We can make this more sophisticated to match the | character that separates + yes-pattern from no-pattern, but it's not really necessary. + captures: + 1: punctuation.definition.group.begin.regexp + 2: punctuation.definition.group.assertion.conditional.regexp + 3: variable.other.back-reference.regexp + push: + - meta_scope: meta.group.assertion.conditional.regexp + - match: \) + scope: punctuation.definition.group.end.regexp + pop: true + - include: main + - match: '(\()((\?P<)([a-z]\w*)(>)|(\?:))?' + captures: + 1: punctuation.definition.group.begin.regexp + 3: punctuation.definition.group.capture.regexp + 4: entity.name.other.group.regexp + 5: punctuation.definition.group.capture.regexp + 6: punctuation.definition.group.no-capture.regexp + push: + - meta_scope: meta.group.regexp + - match: \) + scope: punctuation.definition.group.end.regexp + pop: true + - include: main + - include: character-class + character-class: + - match: '\\[wWsSdDhH]|\.' + scope: constant.character.character-class.regexp + - match: \\. + scope: constant.character.escape.backslash.regexp + - match: '(\[)(\^)?' + captures: + 1: punctuation.definition.character-class.begin.regexp + 2: keyword.operator.negation.regexp + push: + - meta_scope: constant.other.character-class.set.regexp + - match: \] + scope: punctuation.definition.character-class.end.regexp + pop: true + - include: character-class + - match: '((\\.)|.)\-((\\.)|[^\]])' + scope: constant.other.character-class.range.regexp + captures: + 2: constant.character.escape.backslash.regexp + 4: constant.character.escape.backslash.regexp diff --git a/assets/syntaxes/Packages/Python/Snippets/New-Class.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/New-Class.sublime-snippet new file mode 100644 index 000000000..eb16bc684 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/New-Class.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[class ${1:ClassName}(${2:object}): + ${3/.+/"""/}${3:docstring for $1}${3/.+/"""\n/}${3/.+/\t/}def __init__(self${4/([^,])?(.*)/(?1:, )/}${4:arg}): + ${5:super($1, self).__init__()} +${4/(\A\s*,\s*\Z)|,?\s*([A-Za-z_][a-zA-Z0-9_]*)\s*(=[^,]*)?(,\s*|$)/(?2:\t\tself.$2 = $2\n)/g} $0]]></content> + <tabTrigger>class</tabTrigger> + <scope>source.python</scope> + <description>New Class</description> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/New-Property.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/New-Property.sublime-snippet new file mode 100644 index 000000000..f7df99c82 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/New-Property.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[property +def ${1:foo}(self): + return self.${2:_$1} +$0]]></content> + <tabTrigger>property</tabTrigger> + <scope>source.python meta.annotation</scope> + <description>New Property</description> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/Try-Except-Else-Finally.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/Try-Except-Else-Finally.sublime-snippet new file mode 100644 index 000000000..c01d5bca0 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/Try-Except-Else-Finally.sublime-snippet @@ -0,0 +1,13 @@ +<snippet> + <content><![CDATA[try: + ${1:pass} +except${2: ${3:Exception} as ${4:e}}: + ${5:raise} +else: + ${6:pass} +finally: + ${7:pass}]]></content> + <tabTrigger>try</tabTrigger> + <scope>source.python</scope> + <description>Try/Except/Else/Finally</description> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/Try-Except-Else.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/Try-Except-Else.sublime-snippet new file mode 100644 index 000000000..a6330b974 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/Try-Except-Else.sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <content><![CDATA[try: + ${1:pass} +except ${2:Exception} as ${3:e}: + ${4:raise $3} +else: + ${5:pass}]]></content> + <tabTrigger>try</tabTrigger> + <scope>source.python</scope> + <description>Try/Except/Else</description> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/Try-Except-Finally.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/Try-Except-Finally.sublime-snippet new file mode 100644 index 000000000..94e4d0dd5 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/Try-Except-Finally.sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <content><![CDATA[try: + ${1:pass} +except ${2:Exception} as ${3:e}: + ${4:raise $3} +finally: + ${5:pass}]]></content> + <tabTrigger>try</tabTrigger> + <scope>source.python</scope> + <description>Try/Except/Finally</description> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/Try-Except.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/Try-Except.sublime-snippet new file mode 100644 index 000000000..2db3955cb --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/Try-Except.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[try: + ${1:pass} +except ${2:Exception} as ${3:e}: + ${4:raise $3}]]></content> + <tabTrigger>try</tabTrigger> + <scope>source.python</scope> + <description>Try/Except</description> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/__magic__.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/__magic__.sublime-snippet new file mode 100644 index 000000000..b9d76623a --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/__magic__.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[__${1:init}__]]></content> + <tabTrigger>__</tabTrigger> + <scope>source.python</scope> + <description>__magic__</description> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/for.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/for.sublime-snippet new file mode 100644 index 000000000..107b65e75 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/for.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <tabTrigger>for</tabTrigger> + <scope>source.python</scope> + <description>For Loop</description> + <content><![CDATA[ +for ${1:x} in ${2:xrange(1,10)}: + ${0:pass} +]]></content> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/function.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/function.sublime-snippet new file mode 100644 index 000000000..efadd7a0c --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/function.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <tabTrigger>def</tabTrigger> + <scope>source.python</scope> + <description>Function</description> + <content><![CDATA[def ${1:function}($2): + ${0:pass}]]></content> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/if-__name__-==-'__main__'.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/if-__name__-==-'__main__'.sublime-snippet new file mode 100644 index 000000000..460893462 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/if-__name__-==-'__main__'.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[if __name__ == '__main__': + ${1:main()}$0]]></content> + <tabTrigger>ifmain</tabTrigger> + <scope>source.python</scope> + <description>if __name__ == '__main__'</description> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/if.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/if.sublime-snippet new file mode 100644 index 000000000..b56d9067a --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/if.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <tabTrigger>if</tabTrigger> + <scope>source.python</scope> + <description>If Condition</description> + <content><![CDATA[ +if ${1:$SELECTION}: + ${0:pass} +]]></content> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/method.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/method.sublime-snippet new file mode 100644 index 000000000..027775d9e --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/method.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <tabTrigger>defs</tabTrigger> + <scope>source.python</scope> + <description>Method</description> + <content><![CDATA[def ${1:function}(self${2}): + ${0:pass}]]></content> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Snippets/while.sublime-snippet b/assets/syntaxes/Packages/Python/Snippets/while.sublime-snippet new file mode 100644 index 000000000..e0642837b --- /dev/null +++ b/assets/syntaxes/Packages/Python/Snippets/while.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <tabTrigger>while</tabTrigger> + <scope>source.python</scope> + <description>While Loop</description> + <content><![CDATA[ +while ${1:$SELECTION}: + ${0:pass} +]]></content> +</snippet> diff --git a/assets/syntaxes/Packages/Python/Symbol Index.tmPreferences b/assets/syntaxes/Packages/Python/Symbol Index.tmPreferences new file mode 100644 index 000000000..774478d6c --- /dev/null +++ b/assets/syntaxes/Packages/Python/Symbol Index.tmPreferences @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol Index</string> + <key>scope</key> + <string>source.python entity.name.function, source.python entity.name.class</string> + <key>settings</key> + <dict> + <key>showInIndexedSymbolList</key> + <integer>1</integer> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Python/Symbol List.tmPreferences b/assets/syntaxes/Packages/Python/Symbol List.tmPreferences new file mode 100644 index 000000000..58b6c8dc9 --- /dev/null +++ b/assets/syntaxes/Packages/Python/Symbol List.tmPreferences @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List</string> + <key>scope</key> + <string>source.python meta.function - meta.function.inline, source.python meta.class</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string> + s/class\s+([[:alpha:]_][[:alnum:]_]*.+?\)?)(\:|$)/$1/g; + s/(?:async\s+)?def\s+([[:alpha:]_][[:alnum:]_]*).*/$1\(…\))/g; + </string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Python/syntax_test_python.py b/assets/syntaxes/Packages/Python/syntax_test_python.py new file mode 100644 index 000000000..23309479e --- /dev/null +++ b/assets/syntaxes/Packages/Python/syntax_test_python.py @@ -0,0 +1,1459 @@ +# SYNTAX TEST "Packages/Python/Python.sublime-syntax" +# <- source.python comment.line.number-sign punctuation.definition.comment + +r"""This is a syntax test file. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation +#^^^ punctuation.definition.comment.begin +# <- storage.type.string + +And this right here, where we're writing in, is a docstring. +""" + +ur"""Raw docstring \""" +# <- storage.type.string.python +# ^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.python +# ^^^ punctuation.definition.comment.end.python + +"""Normal docstring \"""" +# ^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.python +# ^^ constant.character.escape.python +# ^^^ punctuation.definition.comment.end.python + +debug = False +""" +This is a variable docstring, as supported by sphinx and epydoc +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation +""" + + +################## +# Imports +################## + +import sys # comment +#^^^^^ keyword.control.import +# ^ comment +from os import path, chdir # comment +#^^^ keyword.control.import.from +# ^^^^^^ keyword.control.import +# ^ punctuation.separator.import-list +# ^ comment +from . import module +# ^ keyword.control.import.relative.python +# ^^^^^^ keyword.control.import +from .import module # yes, this is actually legit +# ^ keyword.control.import.relative.python +# ^^^^^^ keyword.control.import.python +from collections.abc import Iterable +# ^^^^^^ keyword.control.import +from a.b.c.else import module +# ^^^^ invalid.illegal.name.python +# ^^^^^^ keyword.control.import +from .while import module +# ^^^^^ invalid.illegal.name.python +# ^^^^^^ keyword.control.import +from .index import module +# ^^^^^ - invalid +from \ + os \ + import \ + path +# ^^^^ meta.statement.import +from sys import (version, # comment +#^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.import +# ^ punctuation.section.import-list.begin +# ^ comment + version_info, . ) # comment +# ^^^^^^^^^^^^^ meta.statement.import +# ^ invalid.illegal.name.import +# ^ punctuation.section.import-list.end +# ^ comment +import path from os +# ^^^^ invalid.illegal.name +from .sub import * +# ^ constant.language.import-all.python +import a as b +# ^^ keyword.control.import.as.python +from a import b as c, d as e +# ^^ keyword.control.import.as.python +# ^^ keyword.control.import.as.python +from a import (b as c) +# ^^ keyword.control.import.as.python + +import re; re.compile(r'') +# ^^^^^^^^^^^^^^^^^ - meta.statement.import +# ^ punctuation.terminator.statement + +from unicode.__init__ . 123 import unicode as unicode +# ^^^^^^^^^^^^^^^^^^^^^^ meta.import-source.python meta.import-path.python +# ^^^^^^^ meta.import-name.python - support +# ^ punctuation.accessor.dot.python +# ^^^^^^^^ meta.import-name.python - support +# ^^^^^ invalid.illegal.name.python +# ^^^^^^^ support.type.python +# ^^^^^^^ support.type.python + +import .str +# ^ invalid.illegal.unexpected-relative-import.python +# ^^^ support.type.python + +import str +# ^^^ support.type.python + + +################## +# Identifiers +################## + +identifier +#^^^^^^^^^ meta.qualified-name meta.generic-name + +class +#^^^^ storage.type.class keyword.declaration.class.python +def +#^^ storage.type.function keyword.declaration.function.python + +# async and await are still recognized as valid identifiers unless in an "async" block +async +#^^^^ - invalid.illegal.name + +__all__ +#^^^^^^ meta.qualified-name support.variable.magic - meta.generic-name +__file__ +#^^^^^^^ support.variable.magic +__missing__ +#^^^^^^^^^^ support.function.magic +__bool__ abc.__nonzero__ +#^^^^^^^ support.function.magic +# ^^^^^^^^^^^ support.function.magic + +TypeError module.TypeError +#^^^^^^^^ support.type.exception +# ^^^^^^^^^ - support + +open.open.open +# ^^^^^^^^^ - support + +... Ellipsis __debug__ +#^^ constant.language.python +# ^^^^^^^^ constant.language.python +# ^^^^^^^^^ constant.language.python + +CONSTANT._13_ +#^^^^^^^ meta.qualified-name.python variable.other.constant.python +# ^^^^ - variable.other.constant + + _A_B A1 +#^^^^ - variable.other.constant +# ^^ - variable.other.constant + +some.NO +# ^^ meta.qualified-name.python variable.other.constant.python + +NO_SWEAT NO AA1 +# <- meta.qualified-name.python variable.other.constant.python +# ^^ variable.other.constant +# ^^^ variable.other.constant + +_ self +# <- variable.language.python +# ^^^^ variable.language.python + + +################## +# Function Calls +################## + +identifier() +#^^^^^^^^^^^ meta.function-call +#^^^^^^^^^ meta.qualified-name variable.function +# ^ punctuation.section.arguments.begin +# ^ punctuation.section.arguments.end + +IDENTIFIER() +#^^^^^^^^^ meta.qualified-name variable.function - variable.other.constant + +dotted . identifier(12, True) +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call - meta.function-call meta.function-call +# ^^^^^^^^^^ meta.function-call.arguments +#^^^^^^^^^^^^^^^^^^ meta.qualified-name +#^^^^^^ - variable.function +# ^ punctuation.accessor.dot +# ^^^^^^^^^^ variable.function + +open.__new__(12, \ +#^^^^^^^^^^^^^^^^^^^^^ meta.function-call +#^^^ support.function.builtin +# ^ punctuation.accessor.dot +# ^^^^^^^ variable.function support.function.magic +# ^ punctuation.separator.continuation.line.python + True) + +TypeError() +#^^^^^^^^ support.type.exception +# +module.TypeError() +#^^^^^^^^^^^^^^^ meta.function-call +# ^^^^^^^^^ variable.function - support + +open.open.open() +#^^^ support.function.builtin +# ^ punctuation.accessor.dot +# ^^^^^^^^^ - support +# ^^^^ variable.function + +call(2**10, *range(10), **dict(), * *{}, ***a) +# ^^ keyword.operator.arithmetic +# ^ keyword.operator.unpacking.sequence.python +# ^^ keyword.operator.unpacking.mapping.python +# ^ keyword.operator.unpacking.sequence.python +# ^ - keyword.operator.unpacking +# ^^^ invalid.illegal.syntax.python + +if p.type not in ('NUMBER', 'INTEGER'): +# ^^ keyword.operator - meta.function-call invalid + +call(from='no', from_='yes') +#^^^^^^^^^^^^^^ meta.function-call +# ^^^^ invalid.illegal.name +# ^ keyword.operator.assignment +# ^^^^ string + +################## +# Expressions +################## + +def _(): + yield from +# ^^^^^ keyword.control.flow.yield +# ^^^^ keyword.control.flow.yield-from + + yield fromsomething +# ^^^^ - keyword + + a if b else c +# ^^ keyword.control.conditional.if +# ^^^^ keyword.control.conditional.else + + c = lambda: pass +# ^^^^^^^^^^^^ meta.function.inline +# ^^^^^^ storage.type.function.inline keyword.declaration.function.inline.python +# ^ punctuation.section.function.begin +# ^^^^ invalid.illegal.name.python + + _(lambda x, y: 10) +# ^^^^^^^^^^^^^^^ meta.function.inline +# ^^^^^^ keyword.declaration.function.inline.python +# ^^^^^ meta.function.inline.parameters +# ^ variable.parameter +# ^ punctuation.separator.parameters +# ^ variable.parameter +# ^^ constant.numeric + + lambda \ + a, \ + b=2: True +# ^^^^^^^^^ meta.function.inline +# ^ keyword.operator.assignment +# ^ punctuation.section.function.begin +# ^^^^^ meta.function.inline.body +# ^^^^ constant.language.python + + lambda as, in=2: 0 +# ^^ invalid.illegal.name +# ^^ invalid.illegal.name + + lambda *a, **kwa, ab*, * *: (a, kwa) +# ^ keyword.operator.unpacking.sequence.python +# ^ variable.parameter.python +# ^^^ variable.parameter.python +# ^^ keyword.operator.unpacking.mapping.python +# ^ invalid.illegal.expected-parameter.python +# ^ invalid.illegal.expected-parameter.python + + lambda x +# ^^^^^^ storage.type.function.inline keyword.declaration.function.inline.python + + lambda (x, y): 0 +# ^^^^^^^^^^^^^^^^ meta.function.inline +# ^^^^^^^^ meta.function.inline.parameters.python +# ^^ meta.function.inline.body.python +# ^^^^^^ meta.group.python +# ^ punctuation.section.group.begin.python +# ^ variable.parameter.python +# ^ punctuation.separator.parameters.python +# ^ variable.parameter.python +# ^ punctuation.section.group.end.python +# ^ punctuation.section.function.begin.python + lambda ( +# ^^^^^^^^^ meta.function.inline.python +# ^^^ meta.function.inline.parameters.python +# ^^ meta.group.python +# ^ punctuation.section.group.begin.python + x, +# ^^^^ meta.function.inline.parameters.python meta.group.python +# ^ variable.parameter.python +# ^ punctuation.separator.parameters.python + y +# ^^^^ meta.function.inline.parameters.python meta.group.python +# ^ variable.parameter.python + ): +#^^^^ meta.function.inline.parameters.python meta.group.python +# ^ punctuation.section.group.end.python +# ^ punctuation.section.function.begin.python + pass +# ^^^^ keyword.control.flow.pass.python + + ( 3 - 6 \ +# ^^^^^^^^^ meta.group.python +# ^ punctuation.section.group.begin.python +# ^ constant.numeric.integer.decimal.python +# ^ keyword.operator.arithmetic.python +# ^ constant.numeric.integer.decimal.python +# ^ punctuation.separator.continuation.line.python + ) +#^^^^^ meta.group.python + +################## +# Compound expressions +################## + +myobj.method().attribute +#^^^^^^^^^^^^^ meta.function-call +# ^ punctuation.accessor.dot +# ^^^^^^ variable.function +# ^ punctuation.accessor.dot + +'foo'. upper() +# ^^^^^^^^^ meta.function-call +# ^ punctuation.accessor.dot +# ^^^^^ variable.function + +func()(1, 2) +# <- meta.function-call +#^^^^^^^^^^^ meta.function-call +#^^^^^^^^^^^ - meta.function-call meta.function-call + +myobj[1](True) +#^^^^^^^ meta.item-access +# ^ punctuation.section.brackets.begin - meta.item-access.arguments +# ^ meta.item-access.arguments +# ^ punctuation.section.brackets.end - meta.item-access.arguments +# ^^^^^^ meta.function-call + +myobj[1][2](0) +#^^^^^^^^^^ meta.item-access +# ^ punctuation.section.brackets.begin - meta.item-access.arguments +# ^ meta.item-access.arguments +# ^ punctuation.section.brackets.end - meta.item-access.arguments +# ^ punctuation.section.brackets.begin - meta.item-access.arguments +# ^ meta.item-access.arguments +# ^ punctuation.section.brackets.end - meta.item-access.arguments +# ^^^ meta.function-call + +range(20)[10:2:-2] +# ^ punctuation.separator.slice +# ^ punctuation.separator.slice + +"string"[12] +# ^^^^ meta.item-access - meta.structure + +"string".upper() +# ^^^^^^^^ meta.function-call + +(i for i in range(10))[5] +# ^^^ meta.item-access - meta.structure + +[1, 2, 3][2] +#^^^^^^^^ meta.sequence +# ^^^ meta.item-access - meta.structure + +{True: False}.get(True) +# ^^^^^^^^^^ meta.function-call + +1[12] +#^^^^ - meta.item-access + + +################## +# print & exec +################## + +def _(): + print (file=None) +# ^^^^^ support.function.builtin - keyword + print . __class__ +# ^^^^^ support.function.builtin - keyword + print "keyword" +# ^^^^^ keyword.other.print + print __init__ +# ^^^^^ keyword.other.print +# + exec 123 +# ^^^^ keyword + exec ("print('ok')") +# ^^^^ support.function.builtin - keyword + callback(print , print +# ^^^^^ - keyword +# ^ punctuation.separator.arguments +# ^^^^^ - keyword + , print) +# ^^^^^ - keyword + + some \ + print \ +# ^^^^^ keyword.other.print + + func( + print +# ^^^^^ support.function.builtin - keyword + ) + + print +# ^^^^^ keyword.other.print + + +################## +# Block statements +################## +def _(): + for +# ^^^ keyword.control.loop.for + b = c in d +# ^^ keyword.operator.logical - keyword.control.loop.for.in + + for \ + a \ + in \ + b: +# ^^ meta.statement.loop.for +# ^ punctuation.section.block.loop.for.python + + async for i in myfunc(): +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for +# ^^^^^ storage.modifier.async +# ^^^ keyword.control.loop.for +# ^^ keyword.control.loop.for.in +# ^ punctuation.section.block.loop.for + pass + + for i: +# ^ invalid.illegal.missing-in + + a for b in c: # TODO make this invalid (for not at beginning of line) + + + something as nothing: +# ^^ invalid.illegal.name + + with \ + open() \ + as \ + x: +# ^^ meta.statement.with + + with open(), open() as x, open() as y: +# ^^^^ keyword.control.flow.with +# ^^^^ support.function +# ^ punctuation.separator.with-resources +# ^^ keyword.control.flow.with.as +# ^ punctuation.separator.with-resources +# ^^^^ support.function +# ^^ keyword.control.flow.with.as + + with captured() as (out, err): +# ^^^^ keyword.control.flow.with +# ^^^^^^^^ variable.function +# ^ punctuation.section.arguments.begin +# ^ punctuation.section.arguments.end +# ^^ keyword.control.flow.with.as +# ^ punctuation.section.group.begin +# ^^^ meta.generic-name +# ^ punctuation.separator.tuple +# ^^^ meta.generic-name +# ^ punctuation.section.group.end +# ^ punctuation.section.block.with + + with captured() \ + as ( +# ^ punctuation.section.group.begin + out, +# ^^^ meta.generic-name +# ^ punctuation.separator.tuple + err +# ^^^ meta.generic-name + ): +# ^ punctuation.section.group.end +# ^ punctuation.section.block.with + + with captured() as [out, err]: +# ^^^^ keyword.control.flow.with +# ^^^^^^^^ variable.function +# ^ punctuation.section.arguments.begin +# ^ punctuation.section.arguments.end +# ^^ keyword.control.flow.with.as +# ^ punctuation.section.sequence.begin +# ^^^ meta.generic-name +# ^ punctuation.separator.sequence +# ^^^ meta.generic-name +# ^ punctuation.section.sequence.end +# ^ punctuation.section.block.with + + with captured() \ + as [ +# ^ punctuation.section.sequence.begin + out, +# ^^^ meta.generic-name +# ^ punctuation.separator.sequence + err +# ^^^ meta.generic-name + ]: +# ^ punctuation.section.sequence.end +# ^ punctuation.section.block.with + + async with context_manager() as c: +# ^^^^^ storage.modifier.async +# ^^^^ keyword.control.flow.with +# ^^ keyword.control.flow.with.as +# ^ punctuation.section.block.with + await something() +# ^^^^^ keyword.other.await + + assert foo == bar +# ^^^^^^ keyword.control.flow.assert.python + + try: +# ^^^^ meta.statement.exception.try.python +# ^^^ keyword.control.exception.try.python +# ^ punctuation.section.block.exception.try.python + raise +# ^^^^^ meta.statement.raise.python keyword.control.flow.raise.python + except Exception as x: +# ^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.catch.python - meta.statement.exception.catch.python meta.statement.exception.catch.python +# ^^^^^^ keyword.control.exception.catch.python +# ^^^^^^^^^ support.type.exception.python +# ^^ keyword.control.exception.catch.as.python +# ^ meta.generic-name.python +# ^ punctuation.section.block.exception.catch.python + pass + finally : +# ^^^^^^^^^ meta.statement.exception.finally.python +# ^^^^^^^ keyword.control.exception.finally.python +# ^ punctuation.section.block.exception.finally.python + try_except_raise: +# ^^^ - keyword + + while ( +# ^^^^^^^^ meta.statement.loop.while.python +# ^^^^^ keyword.control.loop.while.python +# ^ meta.statement.loop.while.python meta.group.python punctuation.section.group.begin.python + a is b +# ^^^^^^ meta.statement.loop.while.python +# ^^ keyword.operator.logical.python + ): +# ^ meta.statement.loop.while.python punctuation.section.block.loop.while.python + sleep() + if a: + break +# ^^^^^ keyword.control.flow.break.python + elif b: + continue +# ^^^^^^^^ keyword.control.flow.continue.python + + if 213 is 231: +# ^^^^^^^^^^^^^^ meta.statement.conditional.if.python +# ^^ keyword.control.conditional.if.python +# ^^^ constant.numeric.integer.decimal.python +# ^^ keyword.operator.logical.python +# ^ punctuation.section.block.conditional.if.python + pass + elif: +# ^^^^^ meta.statement.conditional.elseif.python +# ^ punctuation.section.block.conditional.elseif.python + pass + elif False : +# ^^^^^^^^^^^^ meta.statement.conditional.elseif.python +# ^^^^^ constant.language +# ^ punctuation.section.block.conditional.elseif.python + pass + else : +# ^^^^^^^ meta.statement.conditional.else.python +# ^ punctuation.section.block.conditional.else.python + pass + + if \ + True: +# ^^^^^ meta.statement.conditional.if.python +# ^^^^ constant.language.python +# ^ punctuation.section.block.conditional.if.python +# + + # verify that keywords also work when they are bare (useful when typing) + for +# ^^^ keyword.control.loop.for.python + with +# ^^^^ keyword.control.flow.with.python + if +# ^^ keyword.control.conditional.if.python + finally +# ^^^^^^^ keyword.control.exception.finally.python + else +# ^^^^ keyword.control.conditional.else.python + while +# ^^^^^ keyword.control.loop.while.python + return +# ^^^^^^ keyword.control.flow.return.python + raise +# ^^^^^ keyword.control.flow.raise.python + + +################## +# Function definitions +################## + +def abc(): + global from, for, variable, . +# ^^^^^^ storage.modifier.global +# ^^^^ invalid.illegal.name +# ^^^ invalid.illegal.name +# ^ invalid.illegal.name.storage + + +def my_func(param1, # Multi-line function definition +# ^ punctuation.separator.parameters +# ^ comment.line.number-sign + # This is defaulted +# ^ comment.line.number-sign + param2='#1' \ +# ^ punctuation.separator.continuation.line.python +): +# <- punctuation.section.parameters.end + print('Hi!') + + +def func(from='me'): +# ^^^^ invalid.illegal.name + pass + +def type_annotations(param1: int, param2: MyType, param3: max(2, 3), param4: "string" = "default") -> int: +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters +# ^^^^^^ meta.function.annotation.return +# ^ - meta.function meta.function.parameters +# ^^^^^^ variable.parameter +# ^^^^^ meta.function.parameters.annotation +# ^ punctuation.separator.annotation +# ^^^ support.type +# ^ punctuation.separator.parameters +# ^^^^^^ variable.parameter +# ^ punctuation.separator.annotation +# ^ punctuation.separator.parameters +# ^^^^^^ variable.parameter +# ^ punctuation.separator.annotation +# ^^^^^^^^^ meta.function-call +# ^ punctuation.section.arguments.begin +# ^ constant.numeric +# ^ constant.numeric +# ^ punctuation.section.arguments.end +# ^ punctuation.separator.parameters +# ^^^^^^ variable.parameter +# ^ punctuation.separator.annotation +# ^^^^^^^^ string.quoted.double +# ^^^^^^^^^^^ meta.function.parameters.default-value +# ^ keyword.operator.assignment +# ^^^^^^^^^ string.quoted.double +# ^ punctuation.section.parameters.end +# ^^ punctuation.separator.annotation +# ^^^ support.type +# ^ punctuation.section.function.begin + pass + + +async def coroutine(param1): +#^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^^^^^ meta.function.parameters - meta.function meta.function +# <- storage.modifier.async +# ^ storage.type +# ^ entity.name.function + pass + +def func(*args, other_arg=2**10, **kwargs): +# ^ keyword.operator.unpacking.sequence.python +# ^^ keyword.operator.arithmetic.python +# ^^ keyword.operator.unpacking.mapping.python + pass + +def func( + *args, +# ^ keyword.operator.unpacking.sequence + other_arg=2**10, +# ^^ keyword.operator.arithmetic + **kwargs +# ^^ keyword.operator.unpacking.mapping +): + pass + +def func(args, (x, y)=(0,0)): +# ^^^^^^^^^^^^^ meta.function.parameters.python +# ^^^^^^ meta.function.parameters.default-value.python +# ^ meta.function.parameters.python +# ^^^^^^ meta.group.python +# ^ - meta.group.python +# ^^^^^ meta.sequence.tuple.python +# ^ - meta.group.python +# ^ punctuation.section.parameters.begin.python +# ^ punctuation.separator.parameters.python +# ^ punctuation.section.group.begin.python +# ^ variable.parameter.python +# ^ punctuation.separator.parameters.python +# ^ variable.parameter.python +# ^ punctuation.section.group.end.python +# ^ keyword.operator.assignment.python +# ^ punctuation.section.sequence.begin.python +# ^ constant.numeric.integer.decimal.python +# ^ punctuation.separator.sequence.python +# ^ constant.numeric.integer.decimal.python +# ^ punctuation.section.sequence.end.python +# ^ punctuation.section.parameters.end.python + pass + +def foo(arg: int = 0, (x: float, y=20) = (0.0, "default")): +# ^^^^^^^^^^^^^^^^ meta.group.python +# ^^^ - meta.group.python +# ^^^^^^^^^^^^^^^^ meta.sequence.tuple.python +# ^ punctuation.section.group.begin.python +# ^ variable.parameter.python +# ^^^^^^^ invalid.illegal.annotation.python +# ^ punctuation.separator.parameters.python +# ^ variable.parameter.python +# ^^^ invalid.illegal.default-value.python +# ^ punctuation.section.group.end.python +# ^ keyword.operator.assignment.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.end.python + pass + +def name(p1, p2=None, /, p_or_kw=None, *, kw): pass +# ^ storage.modifier.positional-args-only.python +# ^ punctuation.separator.parameters.python +# ^ keyword.operator.unpacking.sequence.python +def name(p1, p2, /): pass +# ^ storage.modifier.positional-args-only.python +# ^ punctuation.section.parameters.end.python + + +################## +# Class definitions +################## + +class MyClass(): +#^^^^^^^^^^^^^^^ meta.class +# ^^ meta.class.inheritance +# ^ punctuation.section.class.begin + def my_func(self, param1, # Multi-line function definition +# ^ comment.line.number-sign + # This is defaulted +# ^ comment.line.number-sign + param2='#1'): +# ^ punctuation.section.parameters.end + print('Hi!') + + +class UnicødeIdentifier(): +# ^^^^^^^^^^^^^^^^^ entity.name.class + def résumé(): +# ^^^^^^ entity.name.function + """ +# ^^^ punctuation.definition.comment.begin + A function-level docstring +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.python + """ +# ^^^ punctuation.definition.comment.end + + yield from range(100) +# ^^^^^ keyword.control.flow +# ^ - keyword +# ^^^^ keyword.control.flow + + +class MyClass(Inherited, \ +# ^^^^^^^ entity.name.class +# ^^^^^^^^^ entity.other.inherited-class +# ^ punctuation.separator.inheritance +# ^ punctuation.separator.continuation.line.python + module . Inherited2, metaclass=ABCMeta): +# ^^^^^^^^^^^^^^^^^^^ entity.other.inherited-class +# ^ punctuation.accessor.dot +# ^ punctuation.separator.inheritance +# ^^^^^^^^^ variable.parameter.class-inheritance +# ^ keyword.operator.assignment + ur''' +# ^^ storage.type.string + This is a test of docstrings + ''' +# ^^^ comment.block.documentation.python + pass + + +class Unterminated(Inherited: +# ^ invalid.illegal + + +################## +# Decorators +################## + +@ normal . decorator +# <- meta.annotation punctuation.definition.annotation +#^^^^^^^^^^^^^^^^^^^ meta.annotation +# ^^^^^^^^^^^^^^^^^^ meta.qualified-name +# ^^^^^^ meta.generic-name - variable.annotation +# ^^^^^^^^^ variable.annotation +# ^ punctuation.accessor.dot - variable +# ^ - meta.annotation +class Class(): + + @functools.wraps(method, 12, kwarg=None)# comment +#^^^ - meta.annotation +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation - meta.annotation meta.annotation +# ^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.arguments +# ^ punctuation.definition.annotation +# ^^^^^^^^^^^^^^^^ meta.annotation.function +# ^^^^^^^^^^^^^^^ meta.qualified-name +# ^^^^^^^^^ meta.generic-name - variable.annotation +# ^ punctuation.accessor.dot +# ^^^^^ variable.annotation.function meta.generic-name +# ^ punctuation.section.arguments.begin +# ^ punctuation.separator.arguments +# ^^ constant.numeric +# ^^^^^ variable.parameter +# ^ keyword.operator +# ^^^^ constant.language +# ^ punctuation.separator.arguments +# ^ meta.annotation.function punctuation.section.arguments.end +# ^^^^^^^^^ comment - meta.annotation + def wrapper(self): + return self.__class__(method) + + @deco #comment +#^^^ - meta.annotation +# ^^^^^ meta.annotation +# ^^^^ meta.qualified-name variable.annotation +# ^^ - meta.annotation +# ^^^^^^^^ comment + + @staticmethod +# ^^^^^^^^^^^^^ meta.annotation +# ^^^^^^^^^^^^ variable.annotation support.function.builtin +# ^ - meta.annotation + + @not_a.staticmethod +# ^^^^^^^^^^^^^^^^^^^ meta.annotation +# ^^^^^^^^^^^^ variable.annotation - support +# ^ punctuation.accessor.dot + + @not_a.__init__() +# ^^^^^^^^^^^^^^^ meta.annotation +# ^^^^^^^^ variable.annotation support.function.magic +# ^ punctuation.accessor.dot + + @deco[4] +# ^ invalid.illegal.character + + @deco \ + . rator +# ^^^^^^^ meta.annotation +# ^ punctuation.accessor.dot + + @ deco \ + . rator() +# ^^^^^^^^^ meta.annotation.function +# ^^^^^ variable.annotation.function + + @ deco \ +# ^^^^ meta.qualified-name meta.generic-name - variable.annotation +# ^ punctuation.separator.continuation.line + + @deco \ + + def f(): pass +# ^^^ storage.type.function keyword.declaration.function.python - meta.decorator + + +class AClass: + # `def` immediately after a line-continued string within a class + x = "Type help() for interactive help, " \ + "or help(object) for help about object." + def __call__(self, *args, **kwds): +# ^^^ - invalid.illegal + pass + + +################## +# Collection literals and generators +################## + +mytuple = ("this", 'is', 4, tuple) +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.tuple.python +# ^ punctuation.section.sequence.begin +# ^^^^^^ string.quoted.double +# ^ punctuation.separator.sequence +# ^^^^ string.quoted.single +# ^ punctuation.separator.sequence +# ^ constant.numeric +# ^ punctuation.separator.sequence +# ^^^^^ support.type +# ^ punctuation.section.sequence.end + +also_a_tuple = ()[-1] +# ^^ meta.sequence.tuple.empty.python +# ^^^^ meta.item-access + +not_a_tuple = (a = 2, b += 3) +# ^^^^^^^^^^^^^^^ - meta.sequence +# ^ - keyword +# ^ - keyword + +just_a_group = (1) +# ^^^ meta.group.python + +mylist = [] +# ^^ meta.sequence.list.empty.python +# ^ punctuation.section.sequence.begin +# ^ punctuation.section.sequence.end + +mylist = [1, "testing", ["sublist", True]] +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence +# ^ punctuation.section.sequence.begin +# ^ constant.numeric +# ^ punctuation.separator.sequence +# ^^^^^^^^^ string.quoted.double +# ^ punctuation.separator +# ^^^^^^^^^^^^^^^^^ meta.sequence meta.sequence +# ^ punctuation.section.sequence.begin +# ^^^^^^^^^ string.quoted.double +# ^ punctuation.separator.sequence +# ^^^^ constant.language +# ^ punctuation.section.sequence.end +# ^ punctuation.section.sequence.end + +mydict = {} +# ^^ meta.mapping.empty.python +# ^ punctuation.section.mapping.begin +# ^ punctuation.section.mapping.end + +key2 = "my_key" +mydict = {"key": True, key2: (1, 2, [-1, -2]), ,} +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping - meta.mapping meta.mapping +# ^ punctuation.section.mapping.begin +# ^^^^^ meta.mapping.key.python string.quoted.double +# ^ punctuation.separator.mapping.key-value +# ^^^^ meta.mapping.value.python constant.language +# ^ punctuation.separator.mapping +# ^^^^ meta.mapping.key.python meta.qualified-name +# ^ punctuation.separator.mapping +# ^^^^^^^^^^^^^^^^ meta.sequence.tuple +# ^ punctuation.section.sequence.begin +# ^ constant.numeric +# ^ constant.numeric +# ^^^^^^^^ meta.sequence.list +# ^ punctuation.separator.sequence +# ^ punctuation.section.sequence.end +# ^ punctuation.separator.mapping.python +# ^ invalid.illegal.expected-colon.python +# ^ punctuation.section.mapping.end - meta.mapping.key + +mydict = { 'a' : xform, 'b' : form, 'c' : frm } +# ^ meta.mapping.python punctuation.separator.mapping.python +# ^ punctuation.separator.mapping.key-value.python + +myset = {"key", True, key2, [-1], {}:1} +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.set +# ^ punctuation.section.set.begin.python +# ^^^^^ string.quoted.double +# ^ punctuation.separator.set +# ^^^^ constant.language +# ^ punctuation.separator.set +# ^ punctuation.separator.set +# ^^^^ meta.sequence +# ^ constant.numeric +# ^ punctuation.separator.set +# ^^ meta.mapping.empty.python +# ^ invalid.illegal.colon-inside-set.python +# ^ punctuation.section.set.end.python + +mapping_or_set = { +# ^ meta.mapping-or-set.python punctuation.section.mapping-or-set.begin.python + 1: True +# ^ meta.mapping.key.python constant.numeric.integer.decimal.python +# ^ punctuation.separator.mapping.key-value.python +} +# <- meta.mapping.python punctuation.section.mapping.end.python + +complex_mapping = {(): "value"} +# ^^^ meta.mapping-or-set.python +# ^^^^^^^^^^ meta.mapping - meta.mapping-or-set + +more_complex_mapping = {**{1: 1}, 2: 2} +# ^ meta.mapping.python +# ^ meta.mapping.python punctuation.separator.mapping.python +# ^ meta.mapping.python punctuation.separator.mapping.key-value.python + +more_complex_set = { +# ^ meta.mapping-or-set.python + *{1}, 2: 2} +# ^ meta.set.python +# ^ meta.set.python punctuation.separator.set.python +# ^ meta.set.python invalid.illegal.colon-inside-set.python + +generator = (i for i in range(100)) +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.group +# ^^^^^^^^ meta.expression.generator +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in +list_ = [i for i in range(100)] +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence +# ^^^^^^^^ meta.expression.generator +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in +set_ = {i for i in range(100)} +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping-or-set +# ^^^^^^^^ meta.expression.generator +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in +dict_ = {i: i for i in range(100)} +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping - meta.mapping meta.mapping +# ^ meta.mapping.key.python +# ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.mapping.key.python +# ^ meta.mapping.value.python +# ^^^^^^^^^^^^^^^^^^^^^ - meta.mapping.value +# ^^^^^^^^ meta.expression.generator +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in +list_ = [i for i in range(100) if i > 0 else -1] +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence +# ^^^^^^^^ meta.expression.generator +# ^^ keyword.control.conditional.if +# ^^^^ keyword.control.conditional.else + +list2_ = [i in range(10) for i in range(100) if i in range(5, 15)] +# ^^ keyword.operator.logical +# ^^ keyword.control.loop.for.in +# ^^ keyword.operator.logical + +generator = ((k1, k2, v) for ((k1, k2), v) in xs) +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.python +# ^^^^^^^^^^^ meta.sequence.tuple.python +# ^ punctuation.section.group.begin.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.end.python +# ^^ punctuation.section.target-list.begin.python +# ^ punctuation.section.target-list.end.python +# ^ punctuation.section.target-list.end.python +# ^ punctuation.section.group.end.python + +list_ = [(k1, k2, v) for ((k1, k2), v) in xs] +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.python +# ^^^^^^^^^^^ meta.sequence.tuple.python +# ^ - meta.sequence.tuple.python - meta.expression.generator.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.end.python +# ^^ punctuation.section.target-list.begin.python +# ^ punctuation.section.target-list.end.python +# ^ punctuation.section.target-list.end.python +# ^ punctuation.section.sequence.end.python + +dict_ = {k1: (k2, v) for ((k1, k2), v) in xs} +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping - meta.mapping meta.mapping +# ^ punctuation.section.mapping.begin.python +# ^^^^^^^ meta.sequence.tuple.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.end.python +# ^^ punctuation.section.target-list.begin.python +# ^ punctuation.section.target-list.end.python +# ^ punctuation.section.target-list.end.python +# ^ punctuation.section.mapping.end.python + +list(i for i in generator) +# ^^^^^^^^ meta.expression.generator +list((i for i in generator), 123) +# ^^^^^^^^ meta.expression.generator +# ^^^^^^^ - meta.expression.generator +# ^ punctuation.separator.arguments + +_ = [m + for cls in self.__class__.mro() +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in + for m in cls.__dict__] +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in + +result = [i async for i in aiter() if i % 2] +# ^^^^^ storage.modifier.async +result = [await fun() for fun in funcs] +# ^^^^^ keyword.other.await.python + + +t = (*tuple(), *[1, 2], 3*1) +# ^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.tuple.python +# ^ keyword.operator.arithmetic.python +# ^^^^^ support.type.python +# ^ keyword.operator.unpacking.sequence.python +# ^ keyword.operator.arithmetic.python + +l = [1 * 2, 2**10, *result] +# ^ keyword.operator.arithmetic.python +# ^^ keyword.operator.arithmetic.python +# ^ keyword.operator.unpacking.sequence.python + +l = [*l] +# ^ keyword.operator.unpacking.sequence.python + +d = {1: 3**4, **dict_} +# ^^ keyword.operator.arithmetic.python +# ^^ keyword.operator.unpacking.mapping.python + +d = {**d, **dict()} +# ^^^^^^^^^^^^^^^ meta.mapping.python +# ^^^ - meta.mapping.key +# ^^ keyword.operator.unpacking.mapping.python +# ^ meta.qualified-name.python +# ^ punctuation.separator.mapping.python +# ^^^^^^^^ - meta.mapping.key +# ^^ keyword.operator.unpacking.mapping.python +# ^^^^ support.type.python + +s = {*d, *set()} +# ^^^^^^^^^^^^ meta.set.python +# ^ keyword.operator.unpacking.sequence.python +# ^ meta.qualified-name.python +# ^ punctuation.separator.set.python +# ^ keyword.operator.unpacking.sequence.python +# ^^^ support.type.python + +generator = ( + i + for +# ^^^ keyword.control.loop.for.generator + i + in +# ^^ keyword.control.loop.for.in + range(100) +) + + +################## +# Exception handling +################## + +except Exception: +#^^^^^^^^^^^^^^^^ meta.statement.exception.catch +#^^^^^ keyword.control.exception.catch +# ^^^^^^^^^ support.type.exception +# ^ punctuation.section.block +except (KeyError, NameError) as e: +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.catch +#^^^^^ keyword.control.exception.catch +# ^^^^^^^^ support.type.exception +# ^ punctuation.separator.target-list +# ^^^^^^^^^ support.type.exception +# ^^ keyword.control.exception.catch.as +# ^ punctuation.section.block +except \ + StopIteration \ + as \ + err: +# ^^^^ meta.statement.exception.catch + +except StopIteration + as +# ^^ invalid.illegal.name - meta.statement.exception.catch + +except +#^^^^^ keyword.control.exception.catch + +raise +#^^^^ meta.statement.raise keyword.control.flow.raise +raise Ellipsis +#^^^^^^^^^^^^^ meta.statement.raise +#^^^^ keyword.control.flow.raise +# ^^^^^^^^ constant.language +raise KeyError() from z +#^^^^^^^^^^^^^^^^^^^^^^ meta.statement.raise +#^^^^ keyword.control.flow.raise +# ^^^^^^^^ support.type.exception +# ^^^^ keyword.control.flow.raise.from + + + +################## +# Stray braces +################## + +) +# <- invalid.illegal.stray.brace.round +] +# <- invalid.illegal.stray.brace.square +} +# <- invalid.illegal.stray.brace.curly + + + +################## +# Integral numbers +################## + +decimal = 1234567890 + 9876543210L + -1 + -42L * 0000 +# ^^^^^^^^^^ constant.numeric.integer.decimal.python +# ^^^^^^^^^^^ constant.numeric.integer.decimal.python +# ^ storage.type.numeric.python +# ^ keyword.operator.arithmetic.python - constant.numeric +# ^ keyword.operator.arithmetic.python - constant.numeric +# ^ storage.type.numeric.python +# ^^^^ constant.numeric.integer + +floating = 0.1 - .1 * 10e-20 - 0.0e2 % 2. +# ^^^ constant.numeric.float.decimal.python +# ^ punctuation.separator.decimal.python +# ^^ constant.numeric.float.decimal.python +# ^^^^^^ constant.numeric.float.decimal.python +# ^ punctuation.separator.decimal.python +# ^^^^^ constant.numeric.float.decimal.python +# ^^ constant.numeric.float.decimal.python +# ^ punctuation.separator.decimal.python + +binary = 0b1010011 | 0b0110110L +# ^^^^^^^^^ constant.numeric.integer.binary.python +# ^^ punctuation.definition.numeric.base.python +# ^^^^^^^^^^ constant.numeric.integer.binary.python +# ^^ punctuation.definition.numeric.base.python +# ^ storage.type.numeric.python + +octal = 0o755 ^ 0o644L +# ^^^^^ constant.numeric.integer.octal.python +# ^^ punctuation.definition.numeric.base.python +# ^ storage.type.numeric.python +# ^^^^^^ constant.numeric.integer.octal.python +# ^^ punctuation.definition.numeric.base.python + +old_style_octal = 010 + 007 - 012345670L +# ^^^ constant.numeric.integer.octal.python +# ^ punctuation.definition.numeric.base.python +# ^^^ constant.numeric.integer.octal.python +# ^ punctuation.definition.numeric.base.python +# ^^^^^^^^^^ constant.numeric.integer.octal.python +# ^ punctuation.definition.numeric.base.python +# ^ storage.type.numeric.python + +hexadecimal = 0x100af - 0XDEADF00L +# ^^^^^^^ constant.numeric.integer.hexadecimal.python +# ^^ punctuation.definition.numeric.base.python +# ^^^^^^^^^^ constant.numeric.integer.hexadecimal.python +# ^^ punctuation.definition.numeric.base.python +# ^ storage.type.numeric.python + +unintuitive = 0B101 + 0O101 + 10l +# ^^^^^ constant.numeric.integer.binary.python +# ^^ punctuation.definition.numeric.base.python +# ^^^^^ constant.numeric.integer.octal.python +# ^^ punctuation.definition.numeric.base.python +# ^^^ constant.numeric.integer.decimal.python +# ^ storage.type.numeric.python + +illegal = 1LL << 08 | 0b010203 | 0xAbraCadabra +# ^ - constant.numeric +# ^ - constant.numeric +# ^^^ - constant.numeric +# ^^^^^^^^^ - constant.numeric + +amount = 10_000_000.0_2e2_0 + .e2 + 2_2._2 +# ^^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal.python +# ^ punctuation.separator.decimal.python +# ^^^ - constant +# ^^ - constant + +very_complex = 23_2.2e2_0J + 2_1j +# ^^^^^^^^^^^ constant.numeric.imaginary.decimal.python +# ^ punctuation.separator.decimal.python +# ^^^^ constant.numeric.imaginary.decimal.python +# ^ storage.type.numeric.python +# ^ storage.type.numeric.python + +addr = 0xCAFE_F00D +# ^^^^^^^^^^^ constant.numeric +# ^^ punctuation.definition.numeric.base.python + +flags = 0b_0011_1111_0100_1110 | 0b_1 & 0b_0_ +# ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric +# ^^ punctuation.definition.numeric.base.python +# ^^^^ constant.numeric.integer.binary.python +# ^ - constant + +octoct = 0o_2 ^ 0o_ +# ^^^^ constant.numeric.integer.octal.python +# ^^^ - constant + +################## +# Operators +################## + +# This is to test the difference between the assignment operator (=) and +# the comparison operator (==) +foo = bar() +# ^ keyword.operator.assignment.python +foo == bar() +# ^^ keyword.operator.comparison.python +# +foo <<= bar +# ^^^ keyword.operator.assignment.augmented.python + +matrix @ multiplication +# ^ keyword.operator.matrix.python + +a @= b +# ^^ keyword.operator.assignment.augmented.python + + +################## +# Context "Fail Early" +################## + +# Pop contexts gracefully +def func(unclosed, parameters: if else + pass +# ^^^^ invalid.illegal.name + +# The following function should be matched as normal +# despite the above definition not being closed correctly +def another_func(): +#^^ -invalid + pass + + +x = [ +for x in y: + break +# ^^^^^ invalid.illegal.name +# ^ - meta.sequence + + +with open(x) as y: +#^^^ -invalid +# ^^ - invalid + +] +#<- invalid.illegal.stray.brace.square + +class Class(object + def __init__(self): +# ^^^ invalid.illegal.name +# ^ - meta.class + +# "Hang on, I'm still typing" + +foo.'bar' +# ^^^^^^^ - invalid + +foo.bar(baz., True) +# ^^^^^ - invalid + +################## +# Variable annotations +################## + +primes: List[int] = [] +# ^ punctuation.separator.annotation.variable.python +# ^ keyword.operator.assignment + +captain: str # Note: no initial value! +# ^ punctuation.separator.annotation.variable.python + +class Starship: + stats: ClassVar[Dict[str, int]] = {} +# ^ punctuation.separator.annotation.variable.python +# ^ keyword.operator.assignment + + +################## +# Assignment Expressions +################## + +# Examples from https://www.python.org/dev/peps/pep-0572/ + +y := f(x) +# ^^ invalid.illegal.not-allowed-here.python + +(y := f(x)) +# ^^ keyword.operator.assignment.inline.python + +y0 = y1 := f(x) +# ^^ invalid.illegal.not-allowed-here.python + +y0 = (y1 := f(x)) +# ^^ keyword.operator.assignment.inline.python + +foo(x=(y := f(x))) +# ^^ keyword.operator.assignment.inline.python + +if (match := pattern.search(data)) is not None: +# ^^ keyword.operator.assignment.inline.python + pass + +if tz := self._tzstr(): +# ^^ keyword.operator.assignment.inline.python + s += tz + +while chunk := file.read(8192): +# ^^ keyword.operator.assignment.inline.python + process(chunk) + +[y := f(x), y**2, y**3] +# ^^ keyword.operator.assignment.inline.python + +filtered_data = [y for x in data if (y := f(x)) is not None] +# ^^ keyword.operator.assignment.inline.python + +def foo(answer=(p := 42)): +# ^^ keyword.operator.assignment.inline.python + +lambda: (x := 1) +# ^^ keyword.operator.assignment.inline.python + +lambda line: (m := re.match(pattern, line)) and m.group(1) # Valid +# ^^ keyword.operator.assignment.inline.python + +f'{(x:=10)}' +# ^^ keyword.operator.assignment.inline.python + +f'{x:=10}' +# ^^ - keyword.operator.assignment.inline.python + + +if any(len(longline := line) >= 100 for line in lines): +# ^^ keyword.operator.assignment.inline.python + print("Extremely long line:", longline) + +# These are all invalid. We could let linters handle them, +# but these weren't hard to implement. +def foo(x: y:=f(x)) -> a:=None: pass +# ^^ invalid.illegal.not-allowed-here.python +# ^^ invalid.illegal.not-allowed-here.python +foo(x = y := f(x), y=x:=2) +# ^^ invalid.illegal.not-allowed-here.python +# ^^ invalid.illegal.not-allowed-here.python +{a := 1: 2} +# ^^ invalid.illegal.not-allowed-here.python +{1, b := 2} +# ^^ invalid.illegal.not-allowed-here.python +[1][x:=0] +# ^^ invalid.illegal.not-allowed-here.python +def foo(answer = p := 42): pass +# ^^ invalid.illegal.not-allowed-here.python +(lambda: x := 1) +# ^^ invalid.illegal.not-allowed-here.python + + +# <- - meta +# ensure we're not leaking a context diff --git a/assets/syntaxes/Packages/Python/syntax_test_python_strings.py b/assets/syntaxes/Packages/Python/syntax_test_python_strings.py new file mode 100644 index 000000000..f517b1216 --- /dev/null +++ b/assets/syntaxes/Packages/Python/syntax_test_python_strings.py @@ -0,0 +1,702 @@ +# SYNTAX TEST "Packages/Python/Python.sublime-syntax" + +############################### +# Strings and embedded syntaxes +############################### + +var = "\x00 \xaa \xAF \070 \0 \r \n \t \\ \a \b \' \v \f \u0aF1 \UFe0a182f \N{SPACE}" +# ^ meta.string.python +# ^^^^ constant.character.escape.hex +# ^^^^ constant.character.escape.hex +# ^^^^ constant.character.escape.hex +# ^^^^ constant.character.escape.octal +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^^^^^ constant.character.escape.unicode +# ^^^^^^^^^^ constant.character.escape.unicode +# ^^^^^^^^^ constant.character.escape.unicode + +invalid_escapes = "\. \-" +# ^^ invalid.deprecated.character.escape.python +# ^^ invalid.deprecated.character.escape.python + +conn.execute("SELECT * FROM foobar") +# ^ meta.string.python keyword.other.DML.sql + +conn.execute('SELECT * FROM foobar') +# ^ keyword.other.DML.sql + +conn.execute(U"SELECT * FROM foobar") +# ^ keyword.other.DML.sql + +conn.execute(U'SELECT * FROM foobar') +# ^ keyword.other.DML.sql + +# In this example, the Python string is not raw, so \t is a python escape +conn.execute(u"SELECT * FROM foobar WHERE foo = '\t'") +# ^ keyword.other.DML.sql +# ^ constant.character.escape.python + +conn.execute(u'SELECT * FROM foobar') +# ^ keyword.other.DML.sql + +# In this example, the Python string is raw, so the \b should be a SQL escape +conn.execute(r"SELECT * FROM foobar WHERE baz = '\b") +# ^ meta.string.python keyword.other.DML.sql +# ^ constant.character.escape.sql + +# This tests to ensure the Python placeholder will be highlighted even in a raw SQL string +conn.execute(r'SELECT * FROM foobar WHERE %s') +# ^ keyword.other.DML.sql +# ^ constant.other.placeholder.python + +conn.execute(r"SELECT * FROM foobar") +# ^ keyword.other.DML.sql + +conn.execute(r'SELECT * FROM foobar') +# ^ keyword.other.DML.sql + +conn.execute(r"""SELECT * FROM foobar WHERE %s and foo = '\t'""") +# ^ keyword.other.DML.sql +# ^ constant.other.placeholder.python +# ^ constant.character.escape.sql + +# Capital R prevents all syntax embedding +conn.execute(R'SELECT * FROM foobar') +# ^ meta.string.python - keyword.other.DML.sql + +conn.execute(R"SELECT * FROM foobar") +# ^ - keyword.other.DML.sql + +conn.execute(R"""SELECT * FROM foobar""") +# ^ - keyword.other.DML.sql + +conn.execute(r'''SELECT * FROM foobar''') +# ^ keyword.other.DML.sql + +conn.execute(u"""SELECT * FROM foobar WHERE %s and foo = '\t'""") +# ^ keyword.other.DML.sql +# ^ constant.other.placeholder.python +# ^ constant.character.escape.python + +regex = r'\b ([fobar]*){1}(?:a|b)?' +# ^ meta.string.python keyword.control.anchor.regexp +# ^ keyword.operator.quantifier.regexp + +regex = r'.* # Not a comment (yet)' +# ^^^^^^^^^^^^^^^^^^^^^ - comment +# ^ punctuation.definition.string.end.python - comment +# ^ - invalid + +regex = r".* # Not a comment (yet)" +# ^^^^^^^^^^^^^^^^^^^^^ - comment +# ^ punctuation.definition.string.end.python - comment +# ^ - invalid + +regex = r'''\b ([fobar]*){1}(?:a|b)?''' +# ^ keyword.control.anchor.regexp +# ^ keyword.operator.quantifier.regexp + +regex = r"""\b ([fobar]*){1}(?:a|b)?""" +# ^ keyword.control.anchor.regexp +# ^ keyword.operator.quantifier.regexp + +# Capital R prevents all syntax embedding +regex = R'\b ([fobar]*){1}(?:a|b)?' +# ^ - keyword.control.anchor.regexp +# ^ - keyword.operator.quantifier.regexp + +regex = R"\b ([fobar]*){1}(?:a|b)?" +# ^ - keyword.control.anchor.regexp +# ^ - keyword.operator.quantifier.regexp + +bad_string = 'SELECT * FROM users +# ^ invalid.illegal.unclosed-string + +more_bad_string = r" +# ^ invalid.illegal.unclosed-string.python + +string = ''' + +# <- string.quoted.single.block +''' + +string = """ + +# <- string.quoted.double.block +""" + +string = """ +# ^^^ string.quoted.double.block - string string +\ +# <- punctuation.separator.continuation.line.python +""" + +string = r""" +# ^^^ meta.string.python string.quoted.double.block +\ +# <- - punctuation +""" + +string = r""" + # An indented comment. +# ^ - comment +# ^ comment.line.number-sign.regexp +### <<This comment>> @includes some &punctutation. +# <- comment.line.number-sign.regexp +""" + +string = ''' +# ^^^ string.quoted.single.block +''' + +string = r''' +# ^^^ string.quoted.single.block +''' + +string = r''' + # An indented comment. +# ^ - comment +# ^ comment.line.number-sign.regexp +### <<This comment>> @includes some &punctutation. +# <- comment.line.number-sign.regexp +''' + +string = r''' + [set] +# ^^^^^ constant.other.character-class.set.regexp +# ^ punctuation.definition.character-class.begin.regexp +# ^ punctuation.definition.character-class.end.regexp + (group) +# ^^^^^^^ meta.group.regexp +# ^ punctuation.definition.group.begin.regexp +# ^ punctuation.definition.group.end.regexp + (?<!group) +# ^^^^^^^^^^ meta.group.assertion.regexp +# ^ punctuation.definition.group.begin.regexp +# ^^^ constant.other.assertion.regexp +# ^ punctuation.definition.group.end.regexp +''' + +query = \ + """ + SELECT + ( + SELECT CASE field + WHEN 1 + THEN -- comment's say that +# ^ source.sql comment.line.double-dash + EXISTS( + select 1) + ELSE NULL + ) as result + """ + +query = \ + r""" + + SELECT + ( + SELECT CASE field + WHEN 1 + THEN -- comment's say that +# ^ source.sql comment.line.double-dash + EXISTS( + select 1) + ELSE NULL + ) as result + """ + +query = \ +''' +SELECT + ( + SELECT CASE field + WHEN 1 + THEN -- comment's say that +# ^ source.sql comment.line.double-dash + EXISTS( + select 1) + ELSE NULL + ) as result +''' + +sql = 'SELECT * FROM foo -- bar baz' +# ^ source.sql +# ^ source.sql comment.line.double-dash +# ^ punctuation.definition.string.end.python - source.sql + + +# There are many variations of making a byte string +(b'', B'', br'', bR'', BR'', Br'', rb'', Rb'', RB'', rB'') +#^ storage.type.string +# ^ storage.type.string +# ^^ storage.type.string +# ^^ storage.type.string +# ^^ storage.type.string +# ^^ storage.type.string +# ^^ storage.type.string +# ^^ storage.type.string +# ^^ storage.type.string +# ^^ storage.type.string + +# Bytes by defaut support placeholders and character escapes, but not unicode +b'This is a \n test, %s no unicode \uDEAD' +# <- storage.type.string +#^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape +# ^^ constant.other.placeholder +# ^^^^^^ - constant +B'This is a \n test, %s no unicode \uDEAD' +# <- storage.type.string +#^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape +# ^^ constant.other.placeholder +# ^^^^^^ - constant +b'''This is a \n test, %s no unicode \uDEAD''' +# <- storage.type.string +#^^^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape +# ^^ constant.other.placeholder +# ^^^^^^ - constant +B'''This is a \n test, %s no unicode \uDEAD''' +# <- storage.type.string +#^^^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape +# ^^ constant.other.placeholder +# ^^^^^^ - constant + +# Uppercase R raw bytes don't allow anything +bR'This is a \n test, %s no unicode \uDEAD' +# <- storage.type.string +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ - constant.character.escape +# ^^ - constant.other.placeholder +# ^^^^^^ - constant +BR'This is a \n test, %s no unicode \uDEAD' +# <- storage.type.string +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ - constant.character.escape +# ^^ - constant.other.placeholder +# ^^^^^^ - constant +Rb'This is a \n test, %s no unicode \uDEAD' +# <- storage.type.string +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ - constant.character.escape +# ^^ - constant.other.placeholder +# ^^^^^^ - constant +RB'This is a \n test, %s no unicode \uDEAD' +# <- storage.type.string +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ - constant.character.escape +# ^^ - constant.other.placeholder +# ^^^^^^ - constant +bR'''This is a \n test, %s no unicode \uDEAD''' +# <- storage.type.string +# ^^^ string.quoted.single punctuation.definition.string.begin +# ^^ - constant.character.escape +# ^^ - constant.other.placeholder +# ^^^^^^ - constant +BR'''This is a \n test, %s no unicode \uDEAD''' +# <- storage.type.string +# ^^^ string.quoted.single punctuation.definition.string.begin +# ^^ - constant.character.escape +# ^^ - constant.other.placeholder +# ^^^^^^ - constant +Rb'''This is a \n test, %s no unicode \uDEAD''' +# <- storage.type.string +# ^^^ string.quoted.single punctuation.definition.string.begin +# ^^ - constant.character.escape +# ^^ - constant.other.placeholder +# ^^^^^^ - constant +RB'''This is a \n test, %s no unicode \uDEAD''' +# <- storage.type.string +# ^^^ string.quoted.single punctuation.definition.string.begin +# ^^ - constant.character.escape +# ^^ - constant.other.placeholder +# ^^^^^^ - constant + +# Lowercase r raw bytes are interpreted as regex +br'This is a \n (test|with), %s no unicode \uDEAD' +# <- storage.type.string +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape.backslash.regexp +# ^ keyword.operator.or.regexp +# ^^ - constant +# ^^ constant.character.escape.backslash.regexp +# ^^^^ - constant +Br'This is a \n (test|with), %s no unicode \uDEAD' +# <- storage.type.string +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape.backslash.regexp +# ^ keyword.operator.or.regexp +# ^^ - constant +# ^^ constant.character.escape.backslash.regexp +# ^^^^ - constant +rb'This is a \n (test|with), %s no unicode \uDEAD' +# <- storage.type.string +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape.backslash.regexp +# ^ keyword.operator.or.regexp +# ^^ - constant +# ^^ constant.character.escape.backslash.regexp +# ^^^^ - constant +rB'This is a \n (test|with), %s no unicode \uDEAD' +# <- storage.type.string +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape.backslash.regexp +# ^ keyword.operator.or.regexp +# ^^ - constant +# ^^ constant.character.escape.backslash.regexp +# ^^^^ - constant +br'''This is a \n (test|with), %s no unicode \uDEAD''' +# <- storage.type.string +# ^^^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape.backslash.regexp +# ^ keyword.operator.or.regexp +# ^^ - constant +# ^^ constant.character.escape.backslash.regexp +# ^^^^ - constant +Br'''This is a \n (test|with), %s no unicode \uDEAD''' +# <- storage.type.string +# ^^^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape.backslash.regexp +# ^ keyword.operator.or.regexp +# ^^ - constant +# ^^ constant.character.escape.backslash.regexp +# ^^^^ - constant +rb'''This is a \n (test|with), %s no unicode \uDEAD''' +# <- storage.type.string +# ^^^ string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape.backslash.regexp +# ^ keyword.operator.or.regexp +# ^^ - constant +# ^^ constant.character.escape.backslash.regexp +# ^^^^ - constant +rB'''This is a \n (test|with), %s no unicode \uDEAD''' +# <- storage.type.string +# ^^^ meta.string.python string.quoted.single punctuation.definition.string.begin +# ^^ constant.character.escape.backslash.regexp +# ^ keyword.operator.or.regexp +# ^^ - constant +# ^^ constant.character.escape.backslash.regexp +# ^^^^ - constant + +datetime.strptime('2011227', '%Y%V%u') +# ^^^^^^^^ string.quoted.single.python +# ^^^^^^ constant.other.placeholder.python +datetime.strftime(datetime.now(), '%Y%V%uT') +# ^^^^^^^^^ string.quoted.single.python +# ^^^^^^ constant.other.placeholder.python +# ^ - constant.other.placeholder.python + +'{0:%Y%m%d}'.format(datetime.date.today()) +# ^^^^^^^^^^ string.quoted.single.python +# ^^^^^^^^ constant.other.placeholder.python +# ^^^^^^ constant.other.format-spec.python +'{0:%Y-%m-%d}'.format(datetime.date.today()) +# ^^^^^^^^^^^^ string.quoted.single.python +# ^^^^^^^^^^ constant.other.placeholder.python +# ^^^^^^^^ constant.other.format-spec.python +'{0:%Y-%m-%dT}'.format(datetime.date.today()) +# ^^^^^^^^^^^^ string.quoted.single.python +# ^^^^^^^^^^^ constant.other.placeholder.python +# ^^^^^^^^^ constant.other.format-spec.python +'{0:T}'.format(datetime.date.today()) # This is legal but uninteresting +# ^^^^^ string.quoted.single.python +'{0:%Y}-{0:%m}-{0:%d}'.format(datetime.date.today()) +# ^^^^^^^^^^^^^^^^^^^ string.quoted.single.python +# ^^^^^ constant.other.placeholder.python +# ^^^ constant.other.format-spec.python +# ^ - constant.other.placeholder.python +# ^^^^^^ constant.other.placeholder.python +# ^^ constant.other.format-spec.python +# ^ - constant.other.placeholder.python +# ^^^^^^ constant.other.placeholder.python +# ^^ constant.other.format-spec.python +'{0:%Y}-{0:%m +# ^^^^^^^^^^^ string.quoted.single.python +# ^^^^^ constant.other.placeholder.python +# ^^^ constant.other.format-spec.python +# ^^^^ - constant.other.placeholder.python +# ^ invalid.illegal.unclosed-string.python +'{0:%Y}-{0:% +# ^^^^^^^^^^^ string.quoted.single.python +# ^^^^^ constant.other.placeholder.python +# ^^^ constant.other.format-spec.python +# ^^^^^ - constant.other.placeholder.python +# ^ invalid.illegal.unclosed-string.python + +x = "hello \ +# ^^^^^^^^^ string.quoted.double.python - invalid.illegal.unclosed-string.python, \ +# ^ punctuation.separator.continuation.line.python, \ +world" +#^^^^^ string.quoted.double.python +# ^ - string.quoted.double.python +# ^ punctuation.definition.string.end.python + +x = 'hello \ +# ^^^^^^^^^ string.quoted.single.python - invalid.illegal.unclosed-string.python, \ +# ^ punctuation.separator.continuation.line.python, \ +world' +#^^^^^ string.quoted.single.python +# ^ - string.quoted.single.python +# ^ punctuation.definition.string.end.python + +x = 'hello\s world' +# ^^ - punctuation.separator.continuation.line.python +# ^^^^^^^^ - invalid.illegal.unexpected-text.python + +sql = "SELECT `name` FROM `users` \ + WHERE `password` LIKE 'abc'" +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double source.sql +# ^ punctuation.definition.string.end.python + +sql = Ur"SELECT `name` FROM `users` \ + WHERE `password` LIKE 'abc'" +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double source.sql +# ^ punctuation.definition.string.end.python + +sql = b'just some \ +# ^^^^^^^^^^^^^ string.quoted.single.python - invalid.illegal.unclosed-string.python, \ +# ^ punctuation.separator.continuation.line.python, \ + string' +#^^^^^^^^^^ string.quoted.single +# ^ punctuation.definition.string.end.python + +# https://docs.python.org/3/library/string.html#formatspec +"First, thou shalt count to {0}" # References first positional argument +# ^^^ constant.other.placeholder.python +"Bring me a {}" # Implicitly references the first positional argument +# ^^ constant.other.placeholder.python +"From {} to {}" # Same as "From {0} to {1}" +# ^^ constant.other.placeholder.python +# ^^^^ - constant.other.placeholder.python +# ^^ constant.other.placeholder.python +"My quest is {name}" # References keyword argument 'name' +# ^^^^^^ constant.other.placeholder.python +"Weight in tons {0.weight}" # 'weight' attribute of first positional arg +# ^^^^^^^^^^ constant.other.placeholder.python +"Units destroyed: {players[0]}" # First element of keyword argument 'players'. +# ^^^^^^^^^^^^ constant.other.placeholder.python +"Harold's a clever {0!s}" # Calls str() on the argument first +# ^^^^^ constant.other.placeholder.python +# ^^ storage.modifier.conversion.python +"Bring out the holy {name!r}" # Calls repr() on the argument first +# ^^^^^^^^ constant.other.placeholder.python +"More {!a}" # Calls ascii() on the argument first +# ^^^^ constant.other.placeholder.python +"More {!a: <10s}" # Calls ascii() on the argument first, then formats +# ^^^^^^^^^^ constant.other.placeholder.python +"Escaped {{0}}" # outputs: "Escaped {0}" +# ^^^^^ - constant.other.placeholder.python +# ^^ constant.character.escape.python +# ^^ constant.character.escape.python +"Escaped {{}} {} {}" # outputs: "Escaped {} arg1 arg2" +# ^^^^ constant.character.escape.python - constant.other.placeholder.python +# ^^ constant.other.placeholder.python +# ^ - constant.other.placeholder.python +# ^^ constant.other.placeholder.python + +datetime.datetime.utcnow().strftime("%Y%m%d%H%M") +# ^^^^^^^^^^ constant.other.placeholder + +"My String %% %s" +# ^^ constant.other.placeholder +# ^^ constant.other.placeholder + +"My String %(s)s %s" +# ^^^^^ constant.other.placeholder +# ^ variable.other.placeholder +# ^^ constant.other.placeholder + +"Testing {:,.2f}".format(1000) +# ^^^^^^^ constant.other.placeholder +# ^ punctuation.definition.placeholder.begin +# ^ punctuation.definition.placeholder.end + +"Testing {0:>9,}".format(1000) +# ^^^^^^^ constant.other.placeholder + +"Testing {:j^9,}".format(1000) +# ^^^^^^^ constant.other.placeholder +# ^^^^^ constant.other.format-spec + +"result: {value:{width}.{precision}}" +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.placeholder +# ^^^^^^^^^^^^^^^^^^^^ meta.format-spec.python +# ^ punctuation.definition.placeholder.begin +# ^^^^^^^ constant.other.placeholder constant.other.placeholder +# ^ punctuation.definition.placeholder.begin +# ^^^^^^^^^^^ constant.other.placeholder constant.other.placeholder +# ^^ punctuation.definition.placeholder.end + +a=["aaaa{", "bbbb{"] +# ^ - constant.other.placeholder +# ^ punctuation.definition.string.end.python + +foo = "{text{" # Comment +# ^^^^^^ - constant.other.placeholder +# ^ punctuation.definition.string.end +bar = "}}" # Comment +# ^^ constant.character.escape + +f"string" +# <- storage.type.string +#^^^^^^^^ string.quoted.double + + RF"""string""" +#^^ storage.type.string - string +# ^^^^^^^^^^^^ meta.string.interpolated string.quoted.double.block + +F'''string''' +# <- storage.type.string +#^^^^^^^^^^^^ meta.string.interpolated string.quoted.single.block + + rf'string' +#^^ storage.type.string - string +# ^^^^^^^^ meta.string.interpolated string.quoted.single + +rf'\r\n' f'\r\n' Rf'\r\n' +# ^^^^ source.regexp constant.character.escape.backslash.regexp +# ^^^^ constant.character.escape.python +# ^^^^ - constant + +rf"\r\n" f"\r\n" Rf'\r\n' +# ^^^^ source.regexp constant.character.escape.backslash.regexp +# ^^^^ constant.character.escape.python +# ^^^^ - constant + +expr = fr"^\s*({label}|{notlabel})" +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.python +# ^ meta.string.interpolated.python string.quoted.double.python source.regexp.python keyword.control.anchor.regexp +# ^ source.regexp.python meta.group.regexp punctuation.definition.group.begin.regexp +# ^^^^^^^ source.python meta.string.interpolated.python meta.interpolation.python +# ^^^^^ source.python.embedded meta.qualified-name.python meta.generic-name.python +# ^ source.regexp.python meta.group.regexp punctuation.definition.group.end.regexp + +line = re.sub(rf" ?\{{\\i.?\}}({x})\{{\\i.?\}}", r"\1", line) +# ^^^^^ constant.character.escape.backslash.regexp +# ^^ constant.character.escape.python +# ^^^ constant.character.escape.backslash.regexp +# ^^ constant.character.escape.python +# ^ punctuation.section.interpolation.begin.python + +f"\{{{x}\}} test" +# ^ invalid.deprecated.character.escape.python +# ^^ constant.character.escape.python +# ^ punctuation.section.interpolation.begin.python + +f"{something}" +#^^^^^^^^^^^^ meta.string.interpolated +# <- storage.type.string +#^ punctuation.definition.string.begin +# ^ punctuation.section.interpolation.begin +# ^ punctuation.section.interpolation.end +# ^ punctuation.definition.string.end +# ^^^^^^^^^ source source.python.embedded +# ^ source - meta, string, source source + +f"{True!a:02f}" +#^^^^^^^^^^^^^^ meta.string.interpolated +# ^ - source source.python.embedded +# ^^^^ source source.python.embedded constant.language +# ^^^^^^^ - source source.python.embedded +# ^^ storage.modifier.conversion - constant.other.format-spec +# ^^^^ constant.other.format-spec +# ^ punctuation.section.interpolation.end +# ^ punctuation.definition.string.end +# ^ source - meta, string, source source + +f"result: {value:{width}.{precision}}\n" +# ^ punctuation.section.interpolation.begin.python - source source +# ^^^^^ source source.python.embedded +# ^^ - source source +# ^ punctuation.section.interpolation.begin.python +# ^^^^^ source source.python.embedded +# ^ punctuation.section.interpolation.end.python +# ^ - source source +# ^ punctuation.section.interpolation.begin.python +# ^^^^^^^^^ source source.python.embedded +# ^^ punctuation.section.interpolation.end.python - source source +# ^^ constant.character.escape +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interpolation.python +# ^^^^^^^^^^^^^^^^^^^^ meta.format-spec.python +# ^^^^^^ - meta.interpolation.python meta.interpolation.python +# ^^^^^^^ meta.interpolation.python meta.interpolation.python +# ^ - meta.interpolation.python meta.interpolation.python +# ^^^^^^^^^^^ meta.interpolation.python meta.interpolation.python +# ^^^ - meta.interpolation.python meta.interpolation.python +rf"{value:{width!s:d}}" +# <- storage.type.string.python - string +# ^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated +# ^^^^^ source source.python.embedded +# ^^ storage.modifier.conversion +# ^^ constant.other.format-spec + +F""" {} {\} } +#^^^^^^^^^^^ meta.string.interpolated +#^^^ punctuation.definition.string.begin +# ^^ invalid.illegal.empty-expression +# ^ invalid.illegal.backslash-in-fstring +# ^ invalid.illegal.stray-brace +""" + +fr''' +# ^ - invalid +''' + +# Most of these were inspired by +# https://github.com/python/cpython/commit/9a4135e939bc223f592045a38e0f927ba170da32 +f'{x=:}' +# ^ storage.modifier.debug.python +f'{x=:.2f}' +# ^ storage.modifier.debug.python +f'{x=!r}' +# ^ storage.modifier.debug.python +f'{x=!a}' +# ^ storage.modifier.debug.python +f'{x=!s:*^20}' +# ^ storage.modifier.debug.python +# ^^ storage.modifier.conversion.python +# ^^^^^ meta.format-spec.python +f'{"Σ"=}' +# ^ storage.modifier.debug.python +f'{0==1}' +# ^^ -storage.modifier.debug.python +f'{0!=1}' +# ^ -storage.modifier.debug.python +f'{0<=1}' +# ^ -storage.modifier.debug.python +f'{0>=1}' +# ^ -storage.modifier.debug.python +f'{f(a="3=")}' +# ^^^^ -storage.modifier.debug.python + +f" { +% ^ invalid.illegal.unclosed-string + # TODO make this test pass + }" + +f' \ + {1 + 2!a:02f}' +#^^^^^^^^^^^^^^ meta.string.interpolated +# ^^^^^ source source.python.embedded + +f"{d for d in range(10)}" # yes, this doesn't make sense +# ^^^ keyword.control.loop.for.generator.python + +f' +# ^ invalid.illegal.unclosed-string + + +# <- - meta +# this test is to ensure we're not matching anything here anymore diff --git a/assets/syntaxes/Packages/R/Comments.tmPreferences b/assets/syntaxes/Packages/R/Comments.tmPreferences new file mode 100644 index 000000000..4758e8b78 --- /dev/null +++ b/assets/syntaxes/Packages/R/Comments.tmPreferences @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>source.r</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string># </string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/R/R Console.sublime-syntax b/assets/syntaxes/Packages/R/R Console.sublime-syntax new file mode 100644 index 000000000..59502b01d --- /dev/null +++ b/assets/syntaxes/Packages/R/R Console.sublime-syntax @@ -0,0 +1,15 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: R Console +file_extensions: [] +scope: source.r-console +contexts: + main: + - match: "^> " + scope: punctuation.section.embedded.r-console + push: + - meta_scope: source.r.embedded.r-console + - match: \n|\z + pop: true + - include: scope:source.r diff --git a/assets/syntaxes/Packages/R/R.sublime-build b/assets/syntaxes/Packages/R/R.sublime-build new file mode 100644 index 000000000..fa202e1b4 --- /dev/null +++ b/assets/syntaxes/Packages/R/R.sublime-build @@ -0,0 +1,4 @@ +{ + "shell_cmd": "Rscript \"$file\"", + "selector": "source.r", +} diff --git a/assets/syntaxes/Packages/R/R.sublime-settings b/assets/syntaxes/Packages/R/R.sublime-settings new file mode 100644 index 000000000..e93d331be --- /dev/null +++ b/assets/syntaxes/Packages/R/R.sublime-settings @@ -0,0 +1,3 @@ +{ + "word_separators": "/\\()\"'-:,;<>~!@#$%^&*|+=[]{}`~?" +} diff --git a/assets/syntaxes/Packages/R/R.sublime-syntax b/assets/syntaxes/Packages/R/R.sublime-syntax new file mode 100644 index 000000000..a48a8158c --- /dev/null +++ b/assets/syntaxes/Packages/R/R.sublime-syntax @@ -0,0 +1,343 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: R +file_extensions: + - R + - r + - Rprofile +scope: source.r + +variables: + exponent: (?:[eE][-+]?\d+) + var: '(?:[a-zA-Z._][a-zA-Z0-9._]*|`[^`]+`)' + +contexts: + main: + - include: roxygen + - include: codesection + - include: comments + - include: constants + - include: accessor + - include: operators + - include: keywords + - include: storage-types + - include: strings + - include: brackets + - include: function-declarations + - include: lambda-functions + - include: builtin-functions + - include: function-calls + - include: general-variables + + codesection: + - match: ^\s*((\#+)\s*(.+?)\s*(?:-{4,}|={4,}|#{4,})[ \t]*$\n?) + captures: + 1: comment.line.number-sign.r + 2: punctuation.definition.comment.r + 3: entity.name.section.r + + comments: + - match: \#+ + scope: punctuation.definition.comment.r + push: + - meta_scope: comment.line.number-sign.r + - match: \n + pop: true + + constants: + - match: \b(pi|letters|LETTERS|month\.abb|month\.name)\b + scope: support.constant.misc.r + - match: \b(TRUE|FALSE|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_|Inf|NaN)\b + scope: constant.language.r + # complex imaginary + - match: \b(0[xX])\h+(?:(i)|(I))\b + scope: constant.numeric.imaginary.hexadecimal.r + captures: + 1: punctuation.definition.numeric.hexadecimal.r + 2: storage.type.numeric.r + 3: invalid.illegal.numeric.r + - match: (?:(\.)\d+|\b\d+(\.)?\d*){{exponent}}?(?:(i)|(I))\b + scope: constant.numeric.imaginary.decimal.r + captures: + 1: punctuation.separator.decimal.r + 2: punctuation.separator.decimal.r + 3: storage.type.numeric.r + 4: invalid.illegal.numeric.r + # integers + - match: \b(0[xX])\h+(?:(L)|(l))\b + scope: constant.numeric.integer.hexadecimal.r + captures: + 1: punctuation.definition.numeric.hexadecimal.r + 2: storage.type.numeric.r + 3: invalid.illegal.numeric.r + - match: \b\d+(\.)?\d*(?:(L)|(l))\b + scope: constant.numeric.integer.decimal.r + captures: + 1: punctuation.separator.decimal.r + 2: storage.type.numeric.r + 3: invalid.illegal.numeric.r + # floats + - match: \b(0[xX])\h+\b + scope: constant.numeric.float.hexadecimal.r + captures: + 1: punctuation.definition.numeric.hexadecimal.r + - match: |- + (?x: + # 1., 1.1, 1.1e1, 1.1e-1, 1.e1, 1.e-1 | 1, 1e1, 1e-1 + \b\d+ (?: (\.) (?: \d* {{exponent}}? \b )? | {{exponent}}? \b ) + # .1, .1e1, .1e-1 + | (\.) \d+ {{exponent}}? \b + ) + scope: constant.numeric.float.decimal.r + captures: + 1: punctuation.separator.decimal.r + 2: punctuation.separator.decimal.r + + general-variables: + - match: '{{var}}' + + keywords: + - match: \bif\b(?=\s*\() + scope: keyword.control.conditional.if.r + - match: \belse\b + scope: keyword.control.conditional.else.r + - match: \bbreak\b + scope: keyword.control.flow.break.r + - match: \bnext\b + scope: keyword.control.flow.continue.r + - match: \breturn(?=\s*\() + scope: keyword.control.flow.return.r + - match: \brepeat\b + scope: keyword.control.loop.repeat.r + - match: \bfor\b(?=\s*\() + scope: keyword.control.loop.for.r + - match: \bwhile\b(?=\s*\() + scope: keyword.control.loop.while.r + - match: \bin\b + scope: keyword.operator.word.r + + accessor: + - match: '\$' + scope: keyword.accessor.dollar.r + push: + - include: function-calls + - include: general-variables + - match: '' + pop: true + + operators: + # NOTE: sorted by length to ensure not to break ligatures + + # operators with 3+ characters + - match: '%[*/ox]%' + scope: keyword.operator.arithmetic.r + - match: (<<-|->>) + scope: keyword.operator.assignment.r + - match: '%(between|chin|do|dopar|in|like|\+replace|\+|:|T>|<>|>|\$)%' + scope: keyword.operator.other.r + - match: \.\.\. + scope: keyword.other.r + - match: :::? + scope: punctuation.accessor.colons.r + # operators with 2 characters + - match: (%%|\*\*) + scope: keyword.operator.arithmetic.r + - match: (<-|->) + scope: keyword.operator.assignment.r + - match: (==|!=|<=|>=|<>|&&|\|\|) + scope: keyword.operator.logical.r + - match: := + scope: keyword.operator.other.r + # operators with 1 characters + - match: '[-+*/^]' + scope: keyword.operator.arithmetic.r + - match: = + scope: keyword.operator.assignment.r + - match: '[!&|<>]' + scope: keyword.operator.logical.r + - match: '[:~@]' + scope: keyword.other.r + - match: ; + scope: punctuation.terminator.semicolon.r + + storage-types: + - match: \b(character|complex|double|expression|integer|list|logical|numeric|single|raw)\s*(?=\() + scope: meta.function-call.name.r + captures: + 1: storage.type.r + push: function-call-arguments + + strings: + - match: '"' + scope: punctuation.definition.string.begin.r + push: + - meta_scope: string.quoted.double.r + - match: \\. + scope: constant.character.escape.r + - match: '"' + scope: punctuation.definition.string.end.r + pop: true + - match: "'" + scope: punctuation.definition.string.begin.r + push: + - meta_scope: string.quoted.single.r + - match: \\. + scope: constant.character.escape.r + - match: "'" + scope: punctuation.definition.string.end.r + pop: true + + brackets: + - match: \( + scope: punctuation.section.parens.begin.r + push: + - match: \) + scope: punctuation.section.parens.end.r + pop: true + - include: main + - match: \[(?!\[) + scope: meta.item-access.r punctuation.section.brackets.single.begin.r + push: + - meta_content_scope: meta.item-access.r meta.item-access.arguments.r + - match: \] + scope: meta.item-access.r punctuation.section.brackets.single.end.r + pop: true + - match: ',' + scope: punctuation.separator.parameters.r + - include: main + - match: \[\[ + scope: meta.item-access.r punctuation.section.brackets.double.begin.r + push: + - meta_content_scope: meta.item-access.r meta.item-access.arguments.r + - match: \]\] + scope: meta.item-access.r punctuation.section.brackets.double.end.r + pop: true + - match: ',' + scope: punctuation.separator.parameters.r + - include: main + - match: \{ + scope: punctuation.section.braces.begin.r + push: + - match: \} + scope: punctuation.section.braces.end.r + pop: true + - include: main + + function-declarations: + - match: (({{var}})\s*)((<<?-|=)\s*)(?=function\s*\() + captures: + 1: meta.function.name.r + 2: entity.name.function.r + 3: meta.function.r + 4: keyword.operator.assignment.r + push: + - include: lambda-functions + - match: '' + pop: true + + lambda-functions: + - match: \b(function)\s*(?=\() + scope: meta.function.r + captures: + 1: storage.type.function.r + push: + - match: \( + scope: punctuation.section.parameters.begin.r + set: + - meta_scope: meta.function.parameters.r + - match: \) + scope: punctuation.section.parameters.end.r + pop: true + - include: comments + - match: '{{var}}' + scope: variable.parameter.r + - match: '(?==)' + push: + - include: main + - match: (?=[,)]) + pop: true + - match: ',' + scope: punctuation.separator.parameters.r + + function-calls: + - match: (?:\b|(?=\.))({{var}})\s*(?=\() + scope: meta.function-call.name.r + captures: + 1: variable.function.r + push: function-call-arguments + + function-call-arguments: + - match: \( + scope: punctuation.section.arguments.begin.r + set: + - meta_scope: meta.function-call.arguments.r + - match: \) + scope: punctuation.section.arguments.end.r + pop: true + - match: '{{var}}(?=\s*=[^=])' + scope: variable.parameter.r + - match: '(?==)' + push: + - include: main + - match: (?=[,)]) + pop: true + - match: ',' + scope: punctuation.separator.arguments.r + - include: main + + roxygen: + - match: ^(#')\s* + captures: + 1: punctuation.definition.comment.r + push: + - meta_scope: comment.line.roxygen.r + - match: (@param)\s*({{var}}) + captures: + 1: keyword.other.r + 2: variable.parameter.r + - match: '@[a-zA-Z0-9]+' + scope: keyword.other.r + - match: $\n? + pop: true + + # the builtin-functions are generated by using this + # paste(sub("\\.", "\\\\\\\\.", Filter(function(x) grepl("^[a-zA-Z\\._][0-9a-zA-Z\\._]*$", x), unclass(lsf.str(envir = asNamespace(pkg))))), collapse = "|") + + builtin-functions: + # base + - match: \b(abbreviate|abs|acos|acosh|addNA|addTaskCallback|agrep|agrepl|alist|all|all\.equal|all\.equal.character|all\.equal.default|all\.equal.environment|all\.equal.envRefClass|all\.equal.factor|all\.equal.formula|all\.equal.language|all\.equal.list|all\.equal.numeric|all\.equal.POSIXt|all\.equal.raw|all\.names|all\.vars|any|anyDuplicated|anyDuplicated\.array|anyDuplicated\.data.frame|anyDuplicated\.default|anyDuplicated\.matrix|anyNA|anyNA\.numeric_version|anyNA\.POSIXlt|aperm|aperm\.default|aperm\.table|append|apply|Arg|args|array|arrayInd|as\.array|as\.array.default|as\.call|as\.character|as\.character.condition|as\.character.Date|as\.character.default|as\.character.error|as\.character.factor|as\.character.hexmode|as\.character.numeric_version|as\.character.octmode|as\.character.POSIXt|as\.character.srcref|as\.complex|as\.data.frame|as\.data.frame.array|as\.data.frame.AsIs|as\.data.frame.character|as\.data.frame.complex|as\.data.frame.data.frame|as\.data.frame.Date|as\.data.frame.default|as\.data.frame.difftime|as\.data.frame.factor|as\.data.frame.integer|as\.data.frame.list|as\.data.frame.logical|as\.data.frame.matrix|as\.data.frame.model.matrix|as\.data.frame.noquote|as\.data.frame.numeric|as\.data.frame.numeric_version|as\.data.frame.ordered|as\.data.frame.POSIXct|as\.data.frame.POSIXlt|as\.data.frame.raw|as\.data.frame.table|as\.data.frame.ts|as\.data.frame.vector|as\.Date|as\.Date.character|as\.Date.date|as\.Date.dates|as\.Date.default|as\.Date.factor|as\.Date.numeric|as\.Date.POSIXct|as\.Date.POSIXlt|as\.difftime|as\.double|as\.double.difftime|as\.double.POSIXlt|as\.environment|as\.expression|as\.expression.default|as\.factor|as\.function|as\.function.default|as\.hexmode|as\.integer|as\.list|as\.list.data.frame|as\.list.Date|as\.list.default|as\.list.environment|as\.list.factor|as\.list.function|as\.list.numeric_version|as\.list.POSIXct|as\.logical|as\.logical.factor|as\.matrix|as\.matrix.data.frame|as\.matrix.default|as\.matrix.noquote|as\.matrix.POSIXlt|as\.name|as\.null|as\.null.default|as\.numeric|as\.numeric_version|as\.octmode|as\.ordered|as\.package_version|as\.pairlist|as\.POSIXct|as\.POSIXct.date|as\.POSIXct.Date|as\.POSIXct.dates|as\.POSIXct.default|as\.POSIXct.numeric|as\.POSIXct.POSIXlt|as\.POSIXlt|as\.POSIXlt.character|as\.POSIXlt.date|as\.POSIXlt.Date|as\.POSIXlt.dates|as\.POSIXlt.default|as\.POSIXlt.factor|as\.POSIXlt.numeric|as\.POSIXlt.POSIXct|as\.qr|as\.raw|as\.single|as\.single.default|as\.symbol|as\.table|as\.table.default|as\.vector|as\.vector.factor|asin|asinh|asNamespace|asS3|asS4|assign|atan|atan2|atanh|attach|attachNamespace|attr|attr\.all.equal|attributes|autoload|autoloader|backsolve|baseenv|basename|besselI|besselJ|besselK|besselY|beta|bindingIsActive|bindingIsLocked|bindtextdomain|bitwAnd|bitwNot|bitwOr|bitwShiftL|bitwShiftR|bitwXor|body|bquote|break|browser|browserCondition|browserSetDebug|browserText|builtins|by|by\.data.frame|by\.default|bzfile|c|c\.Date|c\.difftime|c\.noquote|c\.numeric_version|c\.POSIXct|c\.POSIXlt|c\.warnings|call|callCC|capabilities|casefold|cat|cbind|cbind\.data.frame|ceiling|char\.expand|character|charmatch|charToRaw|chartr|check_tzones|chkDots|chol|chol\.default|chol2inv|choose|class|clearPushBack|close|close\.connection|close\.srcfile|close\.srcfilealias|closeAllConnections|col|colMeans|colnames|colSums|commandArgs|comment|complex|computeRestarts|conditionCall|conditionCall\.condition|conditionMessage|conditionMessage\.condition|conflicts|Conj|contributors|cos|cosh|cospi|crossprod|Cstack_info|cummax|cummin|cumprod|cumsum|curlGetHeaders|cut|cut\.Date|cut\.default|cut\.POSIXt|data\.class|data\.frame|data\.matrix|date|debug|debuggingState|debugonce|default\.stringsAsFactors|delayedAssign|deparse|det|detach|determinant|determinant\.matrix|dget|diag|diff|diff\.Date|diff\.default|diff\.difftime|diff\.POSIXt|difftime|digamma|dim|dim\.data.frame|dimnames|dimnames\.data.frame|dir|dir\.create|dir\.exists|dirname|do\.call|dontCheck|double|dput|dQuote|drop|droplevels|droplevels\.data.frame|droplevels\.factor|dump|duplicated|duplicated\.array|duplicated\.data.frame|duplicated\.default|duplicated\.matrix|duplicated\.numeric_version|duplicated\.POSIXlt|duplicated\.warnings|dyn\.load|dyn\.unload|dynGet|eapply|eigen|emptyenv|enc2native|enc2utf8|encodeString|Encoding|endsWith|enquote|env\.profile|environment|environmentIsLocked|environmentName|eval|eval\.parent|evalq|exists|exp|expand\.grid|expm1|expression|extSoftVersion|factor|factorial|fifo|file|file\.access|file\.append|file\.choose|file\.copy|file\.create|file\.exists|file\.info|file\.link|file\.mode|file\.mtime|file\.path|file\.remove|file\.rename|file\.show|file\.size|file\.symlink|Filter|Find|find\.package|findInterval|findPackageEnv|findRestart|floor|flush|flush\.connection|for|force|forceAndCall|formals|format|format\.AsIs|format\.data.frame|format\.Date|format\.default|format\.difftime|format\.factor|format\.hexmode|format\.info|format\.libraryIQR|format\.numeric_version|format\.octmode|format\.packageInfo|format\.POSIXct|format\.POSIXlt|format\.pval|format\.summaryDefault|formatC|formatDL|forwardsolve|function|gamma|gc|gc\.time|gcinfo|gctorture|gctorture2|get|get0|getAllConnections|getCallingDLL|getCallingDLLe|getConnection|getDLLRegisteredRoutines|getDLLRegisteredRoutines\.character|getDLLRegisteredRoutines\.DLLInfo|getElement|geterrmessage|getExportedValue|getHook|getLoadedDLLs|getNamespace|getNamespaceExports|getNamespaceImports|getNamespaceInfo|getNamespaceName|getNamespaceUsers|getNamespaceVersion|getNativeSymbolInfo|getOption|getRversion|getSrcLines|getTaskCallbackNames|gettext|gettextf|getwd|gl|globalenv|gregexpr|grep|grepl|grepRaw|grouping|gsub|gzcon|gzfile|I|iconv|iconvlist|icuGetCollate|icuSetCollate|identical|identity|if|ifelse|Im|importIntoEnv|inherits|integer|interaction|interactive|intersect|intToBits|intToUtf8|inverse\.rle|invisible|invokeRestart|invokeRestartInteractively|is\.array|is\.atomic|is\.call|is\.character|is\.complex|is\.data.frame|is\.double|is\.element|is\.environment|is\.expression|is\.factor|is\.finite|is\.function|is\.infinite|is\.integer|is\.language|is\.list|is\.loaded|is\.logical|is\.matrix|is\.na|is\.na.data.frame|is\.na.numeric_version|is\.na.POSIXlt|is\.name|is\.nan|is\.null|is\.numeric|is\.numeric_version|is\.numeric.Date|is\.numeric.difftime|is\.numeric.POSIXt|is\.object|is\.ordered|is\.package_version|is\.pairlist|is\.primitive|is\.qr|is\.R|is\.raw|is\.recursive|is\.single|is\.symbol|is\.table|is\.unsorted|is\.vector|isatty|isBaseNamespace|isdebugged|isIncomplete|isNamespace|isNamespaceLoaded|ISOdate|ISOdatetime|isOpen|isRestart|isS4|isSeekable|isSymmetric|isSymmetric\.matrix|isTRUE|jitter|julian|julian\.Date|julian\.POSIXt|kappa|kappa\.default|kappa\.lm|kappa\.qr|kronecker|l10n_info|La_library|La_version|La\.svd|labels|labels\.default|lapply|lazyLoad|lazyLoadDBexec|lazyLoadDBfetch|lbeta|lchoose|length|length\.POSIXlt|lengths|levels|levels\.default|lfactorial|lgamma|libcurlVersion|library|library\.dynam|library\.dynam.unload|licence|license|list|list\.dirs|list\.files|list2env|load|loadedNamespaces|loadingNamespaceInfo|loadNamespace|local|lockBinding|lockEnvironment|log|log10|log1p|log2|logb|logical|lower\.tri|ls|make\.names|make\.unique|makeActiveBinding|Map|mapply|margin\.table|mat\.or.vec|match|match\.arg|match\.call|match\.fun|Math\.data.frame|Math\.Date|Math\.difftime|Math\.factor|Math\.POSIXt|matrix|max|max\.col|mean|mean\.Date|mean\.default|mean\.difftime|mean\.POSIXct|mean\.POSIXlt|mem\.limits|memCompress|memDecompress|memory\.profile|merge|merge\.data.frame|merge\.default|message|mget|min|missing|Mod|mode|months|months\.Date|months\.POSIXt|names|names\.POSIXlt|namespaceExport|namespaceImport|namespaceImportClasses|namespaceImportFrom|namespaceImportMethods|nargs|nchar|ncol|NCOL|Negate|new\.env|next|NextMethod|ngettext|nlevels|noquote|norm|normalizePath|nrow|NROW|numeric|numeric_version|nzchar|objects|oldClass|OlsonNames|on\.exit|open|open\.connection|open\.srcfile|open\.srcfilealias|open\.srcfilecopy|Ops\.data.frame|Ops\.Date|Ops\.difftime|Ops\.factor|Ops\.numeric_version|Ops\.ordered|Ops\.POSIXt|options|order|ordered|outer|package_version|packageEvent|packageHasNamespace|packageStartupMessage|packBits|pairlist|parent\.env|parent\.frame|parse|parseNamespaceFile|paste|paste0|path\.expand|path\.package|pcre_config|pipe|pmatch|pmax|pmax\.int|pmin|pmin\.int|polyroot|pos\.to.env|Position|pretty|pretty\.default|prettyNum|print|print\.AsIs|print\.by|print\.condition|print\.connection|print\.data.frame|print\.Date|print\.default|print\.difftime|print\.Dlist|print\.DLLInfo|print\.DLLInfoList|print\.DLLRegisteredRoutines|print\.eigen|print\.factor|print\.function|print\.hexmode|print\.libraryIQR|print\.listof|print\.NativeRoutineList|print\.noquote|print\.numeric_version|print\.octmode|print\.packageInfo|print\.POSIXct|print\.POSIXlt|print\.proc_time|print\.restart|print\.rle|print\.simple.list|print\.srcfile|print\.srcref|print\.summary.table|print\.summaryDefault|print\.table|print\.warnings|prmatrix|proc\.time|prod|prop\.table|provideDimnames|psigamma|pushBack|pushBackLength|q|qr|qr\.coef|qr\.default|qr\.fitted|qr\.Q|qr\.qty|qr\.qy|qr\.R|qr\.resid|qr\.solve|qr\.X|quarters|quarters\.Date|quarters\.POSIXt|quit|quote|R_system_version|R\.home|R\.Version|range|range\.default|rank|rapply|raw|rawConnection|rawConnectionValue|rawShift|rawToBits|rawToChar|rbind|rbind\.data.frame|rcond|Re|read\.dcf|readBin|readChar|readline|readLines|readRDS|readRenviron|Recall|Reduce|reg\.finalizer|regexec|regexpr|registerS3method|registerS3methods|regmatches|remove|removeTaskCallback|rep|rep_len|rep\.Date|rep\.factor|rep\.int|rep\.numeric_version|rep\.POSIXct|rep\.POSIXlt|repeat|replace|replicate|require|requireNamespace|restartDescription|restartFormals|retracemem|return|returnValue|rev|rev\.default|rle|rm|RNGkind|RNGversion|round|round\.Date|round\.POSIXt|row|row\.names|row\.names.data.frame|row\.names.default|rowMeans|rownames|rowsum|rowsum\.data.frame|rowsum\.default|rowSums|sample|sample\.int|sapply|save|save\.image|saveRDS|scale|scale\.default|scan|search|searchpaths|seek|seek\.connection|seq|seq_along|seq_len|seq\.Date|seq\.default|seq\.int|seq\.POSIXt|sequence|serialize|set\.seed|setdiff|setequal|setHook|setNamespaceInfo|setSessionTimeLimit|setTimeLimit|setwd|showConnections|shQuote|sign|signalCondition|signif|simpleCondition|simpleError|simpleMessage|simpleWarning|simplify2array|sin|single|sinh|sink|sink\.number|sinpi|slice\.index|socketConnection|socketSelect|solve|solve\.default|solve\.qr|sort|sort\.default|sort\.int|sort\.list|sort\.POSIXlt|source|split|split\.data.frame|split\.Date|split\.default|split\.POSIXct|sprintf|sqrt|sQuote|srcfile|srcfilealias|srcfilecopy|srcref|standardGeneric|startsWith|stderr|stdin|stdout|stop|stopifnot|storage\.mode|strftime|strptime|strrep|strsplit|strtoi|strtrim|structure|strwrap|sub|subset|subset\.data.frame|subset\.default|subset\.matrix|substitute|substr|substring|sum|summary|summary\.connection|summary\.data.frame|Summary\.data.frame|summary\.Date|Summary\.Date|summary\.default|Summary\.difftime|summary\.factor|Summary\.factor|summary\.matrix|Summary\.numeric_version|Summary\.ordered|summary\.POSIXct|Summary\.POSIXct|summary\.POSIXlt|Summary\.POSIXlt|summary\.proc_time|summary\.srcfile|summary\.srcref|summary\.table|suppressMessages|suppressPackageStartupMessages|suppressWarnings|svd|sweep|switch|sys\.call|sys\.calls|Sys\.chmod|Sys\.Date|sys\.frame|sys\.frames|sys\.function|Sys\.getenv|Sys\.getlocale|Sys\.getpid|Sys\.glob|Sys\.info|sys\.load.image|Sys\.localeconv|sys\.nframe|sys\.on.exit|sys\.parent|sys\.parents|Sys\.readlink|sys\.save.image|Sys\.setenv|Sys\.setFileTime|Sys\.setlocale|Sys\.sleep|sys\.source|sys\.status|Sys\.time|Sys\.timezone|Sys\.umask|Sys\.unsetenv|Sys\.which|system|system\.file|system\.time|system2|t|t\.data.frame|t\.default|table|tabulate|tan|tanh|tanpi|tapply|taskCallbackManager|tcrossprod|tempdir|tempfile|testPlatformEquivalence|textConnection|textConnectionValue|tolower|topenv|toString|toString\.default|toupper|trace|traceback|tracemem|tracingState|transform|transform\.data.frame|transform\.default|trigamma|trimws|trunc|trunc\.Date|trunc\.POSIXt|truncate|truncate\.connection|try|tryCatch|typeof|unclass|undebug|union|unique|unique\.array|unique\.data.frame|unique\.default|unique\.matrix|unique\.numeric_version|unique\.POSIXlt|unique\.warnings|units|units\.difftime|unix\.time|unlink|unlist|unloadNamespace|unlockBinding|unname|unserialize|unsplit|untrace|untracemem|unz|upper\.tri|url|UseMethod|utf8ToInt|validEnc|validUTF8|vapply|vector|Vectorize|warning|warnings|weekdays|weekdays\.Date|weekdays\.POSIXt|which|which\.max|which\.min|while|with|with\.default|withAutoprint|withCallingHandlers|within|within\.data.frame|within\.list|withRestarts|withVisible|write|write\.dcf|writeBin|writeChar|writeLines|xor|xor\.hexmode|xor\.octmode|xpdrows\.data.frame|xtfrm|xtfrm\.AsIs|xtfrm\.Date|xtfrm\.default|xtfrm\.difftime|xtfrm\.factor|xtfrm\.numeric_version|xtfrm\.POSIXct|xtfrm\.POSIXlt|xtfrm\.Surv|xzfile|zapsmall)\s*(?=\() + scope: meta.function-call.name.r + captures: + 1: support.function.r + push: function-call-arguments + # graphics + - match: \b(abline|arrows|assocplot|axis|Axis|axis\.Date|Axis\.Date|Axis\.default|axis\.POSIXct|Axis\.POSIXt|Axis\.table|axTicks|barplot|barplot\.default|box|boxplot|boxplot\.default|boxplot\.formula|boxplot\.matrix|bxp|cdplot|cdplot\.default|cdplot\.formula|clip|close\.screen|co\.intervals|contour|contour\.default|coplot|curve|dotchart|erase\.screen|filled\.contour|fourfoldplot|frame|grconvertX|grconvertY|grid|hist|hist\.Date|hist\.default|hist\.POSIXt|identify|identify\.default|image|image\.default|layout|layout\.show|lcm|legend|lines|lines\.default|lines\.formula|lines\.histogram|lines\.table|locator|matlines|matplot|matpoints|mosaicplot|mosaicplot\.default|mosaicplot\.formula|mtext|pairs|pairs\.default|pairs\.formula|panel\.smooth|par|persp|persp\.default|pie|piechart|plot|plot\.data.frame|plot\.default|plot\.design|plot\.factor|plot\.formula|plot\.function|plot\.histogram|plot\.new|plot\.raster|plot\.table|plot\.window|plot\.xy|plotHclust|points|points\.default|points\.formula|points\.table|polygon|polypath|rasterImage|rect|rug|screen|segments|smoothScatter|spineplot|spineplot\.default|spineplot\.formula|split\.screen|stars|stem|strheight|stripchart|stripchart\.default|stripchart\.formula|strwidth|sunflowerplot|sunflowerplot\.default|sunflowerplot\.formula|symbols|text|text\.default|text\.formula|title|xinch|xspline|xyinch|yinch)\s*(?=\() + scope: meta.function-call.name.r + captures: + 1: support.function.r + push: function-call-arguments + # grDevices + - match: \b(adjustcolor|anyNA\.raster|as\.graphicsAnnot|as\.matrix.raster|as\.raster|as\.raster.array|as\.raster.character|as\.raster.logical|as\.raster.matrix|as\.raster.numeric|as\.raster.raster|as\.raster.raw|axisTicks|bitmap|bmp|boxplot\.stats|c2to3|cairo_pdf|cairo_ps|cairoVersion|check_for_XQuartz|check_gs_type|check\.options|checkFont|checkFont\.CIDFont|checkFont\.default|checkFont\.Type1Font|checkFontInUse|checkIntFormat|checkQuartzFont|checkX11Font|chromaticAdaptation|chull|CIDFont|cm|cm\.colors|col2rgb|colorConverter|colorRamp|colorRampPalette|colors|colours|contourLines|convertColor|densCols|dev\.capabilities|dev\.capture|dev\.control|dev\.copy|dev\.copy2eps|dev\.copy2pdf|dev\.cur|dev\.displaylist|dev\.flush|dev\.hold|dev\.interactive|dev\.list|dev\.new|dev\.next|dev\.off|dev\.prev|dev\.print|dev\.set|dev\.size|dev2bitmap|devAskNewPage|deviceIsInteractive|embedFonts|extendrange|getGraphicsEvent|getGraphicsEventEnv|graphics\.off|gray|gray\.colors|grey|grey\.colors|grSoftVersion|guessEncoding|hcl|heat\.colors|hsv|initPSandPDFfonts|is\.na.raster|is\.raster|isPDF|jpeg|make\.rgb|matchEncoding|matchEncoding\.CIDFont|matchEncoding\.Type1Font|matchFont|n2mfrow|nclass\.FD|nclass\.scott|nclass\.Sturges|Ops\.raster|palette|pdf|pdf\.options|pdfFonts|pictex|png|postscript|postscriptFonts|prettyDate|print\.colorConverter|print\.raster|print\.recordedplot|print\.RGBcolorConverter|printFont|printFont\.CIDFont|printFont\.Type1Font|printFonts|ps\.options|quartz|quartz\.options|quartz\.save|quartzFont|quartzFonts|rainbow|recordGraphics|recordPalette|recordPlot|replayPlot|restoreRecordedPlot|rgb|rgb2hsv|savePlot|seqDtime|setEPS|setFonts|setGraphicsEventEnv|setGraphicsEventHandlers|setPS|setQuartzFonts|setX11Fonts|svg|terrain\.colors|tiff|topo\.colors|trans3d|trunc_POSIXt|Type1Font|x11|X11|X11\.options|X11Font|X11FontError|X11Fonts|xfig|xy\.coords|xyTable|xyz\.coords)\s*(?=\() + scope: meta.function-call.name.r + captures: + 1: support.function.r + push: function-call-arguments + # methods + - match: \b(addNextMethod|allGenerics|allNames|Arith|as|asMethodDefinition|assignClassDef|assignMethodsMetaData|balanceMethodsList|bind_activation|cacheGenericsMetaData|cacheMetaData|cacheMethod|cacheOnAssign|callGeneric|callNextMethod|canCoerce|cbind|cbind2|checkAtAssignment|checkSlotAssignment|classesToAM|classGeneratorFunction|classLabel|classMetaName|className|coerce|Compare|completeClassDefinition|completeExtends|completeSubclasses|Complex|conformMethod|defaultDumpName|defaultPrototype|dispatchIsInternal|doPrimitiveMethod|dumpMethod|dumpMethods|el|elNamed|empty\.dump|emptyMethodsList|envRefInferField|envRefSetField|evalOnLoad|evalqOnLoad|evalSource|existsFunction|existsMethod|extends|externalRefMethod|finalDefaultMethod|findClass|findFunction|findMethod|findMethods|findMethodSignatures|findUnique|fixPre1\.8|formalArgs|fromNextMethod|functionBody|generic\.skeleton|genericForBasic|getAccess|getAllMethods|getAllSuperClasses|getClass|getClassDef|getClasses|getClassName|getClassPackage|getDataPart|getExtends|getFunction|getGeneric|getGenericFromCall|getGenerics|getGroup|getGroupMembers|getLoadActions|getMethod|getMethods|getMethodsAndAccessors|getMethodsForDispatch|getMethodsMetaData|getPackageName|getProperties|getPrototype|getRefClass|getRefSuperClasses|getSlots|getSubclasses|getValidity|getVirtual|hasArg|hasLoadAction|hasMethod|hasMethods|implicitGeneric|inBasicFuns|inferProperties|inheritedSlotNames|inheritedSubMethodLists|initFieldArgs|initialize|initMethodDispatch|initRefFields|insertClassMethods|insertMethod|insertMethodInEmptyList|insertSource|installClassMethod|is|isBaseFun|isClass|isClassDef|isClassUnion|isGeneric|isGrammarSymbol|isGroup|isMixin|isRematched|isS3Generic|isSealedClass|isSealedMethod|isVirtualClass|isXS3Class|kronecker|languageEl|linearizeMlist|listFromMethods|listFromMlist|loadMethod|Logic|makeClassMethod|makeClassRepresentation|makeEnvRefMethods|makeExtends|makeGeneric|makeMethodsList|makePrototypeFromClassDef|makeStandardGeneric|matchDefaults|matchSignature|Math|Math2|mergeMethods|metaNameUndo|method\.skeleton|MethodAddCoerce|methodSignatureMatrix|MethodsList|MethodsListSelect|methodsPackageMetaName|missingArg|mlistMetaName|multipleClasses|new|newBasic|newClassRepresentation|newEmptyObject|Ops|outerLabels|packageSlot|possibleExtends|print\.MethodsList|printClassRepresentation|printPropertiesList|prohibitGeneric|promptClass|promptMethods|prototype|Quote|rbind|rbind2|reconcilePropertiesAndPrototype|refClassFields|refClassInformation|refClassMethods|refClassPrompt|refObjectClass|registerImplicitGenerics|rematchDefinition|removeClass|removeGeneric|removeMethod|removeMethods|removeMethodsObject|representation|requireMethods|resetClass|resetGeneric|S3Class|S3forS4Methods|S3Part|sealClass|seemsS4Object|selectMethod|selectSuperClasses|setAs|setCacheOnAssign|setClass|setClassUnion|setDataPart|setGeneric|setGenericImplicit|setGroupGeneric|setIs|setLoadAction|setLoadActions|setMethod|setNames|setOldClass|setPackageName|setPrimitiveMethods|setRefClass|setReplaceMethod|setValidity|show|showClass|showClassMethod|showDefault|showExtends|showExtraSlots|showMethods|showMlist|showRefClassDef|signature|SignatureMethod|sigToEnv|slot|slotNames|slotsFromS3|substituteDirect|substituteFunctionArgs|Summary|superClassDepth|superClassMethodName|tableNames|testInheritedMethods|testVirtual|traceOff|traceOn|tryNew|unRematchDefinition|useMTable|validObject|validSlotNames)\s*(?=\() + scope: meta.function-call.name.r + captures: + 1: support.function.r + push: function-call-arguments + # stats + - match: \b(acf|acf2AR|add\.scope|add1|add1\.default|add1\.glm|add1\.lm|add1\.mlm|addmargins|aggregate|aggregate\.data.frame|aggregate\.default|aggregate\.formula|aggregate\.ts|AIC|AIC\.default|AIC\.logLik|alias|alias\.formula|alias\.lm|anova|anova\.glm|anova\.glmlist|anova\.lm|anova\.lmlist|anova\.loess|anova\.mlm|anova\.mlmlist|anova\.nls|anovalist\.nls|ansari\.test|ansari\.test.default|ansari\.test.formula|aov|approx|approxfun|ar|ar\.burg|ar\.burg.default|ar\.burg.mts|ar\.mle|ar\.ols|ar\.yw|ar\.yw.default|ar\.yw.mts|arima|arima\.sim|arima0|arima0\.diag|ARMAacf|ARMAtoMA|as\.data.frame.aovproj|as\.data.frame.ftable|as\.data.frame.logLik|as\.dendrogram|as\.dendrogram.dendrogram|as\.dendrogram.hclust|as\.dist|as\.dist.default|as\.formula|as\.hclust|as\.hclust.default|as\.hclust.dendrogram|as\.hclust.twins|as\.matrix.dist|as\.matrix.ftable|as\.stepfun|as\.stepfun.default|as\.stepfun.isoreg|as\.table.ftable|as\.ts|as\.ts.default|asOneSidedFormula|ave|bandwidth\.kernel|bartlett\.test|bartlett\.test.default|bartlett\.test.formula|BIC|BIC\.default|BIC\.logLik|binom\.test|binomial|biplot|biplot\.default|biplot\.prcomp|biplot\.princomp|Box\.test|bw_pair_cnts|bw\.bcv|bw\.nrd|bw\.nrd0|bw\.SJ|bw\.ucv|C|cancor|case\.names|case\.names.default|case\.names.lm|cbind\.ts|ccf|check_exact|chisq\.test|cmdscale|coef|coef\.aov|coef\.Arima|coef\.default|coef\.listof|coef\.maov|coef\.nls|coefficients|complete\.cases|confint|confint\.default|confint\.glm|confint\.lm|confint\.nls|constrOptim|contr\.helmert|contr\.poly|contr\.SAS|contr\.sum|contr\.treatment|contrasts|convolve|cooks\.distance|cooks\.distance.glm|cooks\.distance.lm|cophenetic|cophenetic\.default|cophenetic\.dendrogram|cor|cor\.test|cor\.test.default|cor\.test.formula|cov|cov\.wt|cov2cor|covratio|cpgram|cut\.dendrogram|cutree|cycle|cycle\.default|cycle\.ts|D|dbeta|dbinom|dcauchy|dchisq|decompose|delete\.response|deltat|deltat\.default|dendrapply|density|density\.default|deriv|deriv\.default|deriv\.formula|deriv3|deriv3\.default|deriv3\.formula|deviance|deviance\.default|deviance\.glm|deviance\.lm|deviance\.mlm|deviance\.nls|dexp|df|df\.kernel|df\.residual|df\.residual.default|df\.residual.nls|dfbeta|dfbeta\.lm|dfbetas|dfbetas\.lm|dffits|dgamma|dgeom|dhyper|diff\.ts|diffinv|diffinv\.default|diffinv\.ts|diffinv\.vector|dist|dlnorm|dlogis|dmultinom|dnbinom|dnorm|dpois|drop\.scope|drop\.terms|drop1|drop1\.default|drop1\.glm|drop1\.lm|drop1\.mlm|dsignrank|dt|dummy\.coef|dummy\.coef.aovlist|dummy\.coef.lm|dunif|dweibull|dwilcox|ecdf|eff\.aovlist|effects|effects\.glm|effects\.lm|embed|end|end\.default|estVar|estVar\.mlm|estVar\.SSD|expand\.model.frame|extractAIC|extractAIC\.aov|extractAIC\.coxph|extractAIC\.glm|extractAIC\.lm|extractAIC\.negbin|extractAIC\.survreg|factanal|factanal\.fit.mle|factor\.scope|family|family\.glm|family\.lm|fft|filter|fisher\.test|fitted|fitted\.default|fitted\.isoreg|fitted\.kmeans|fitted\.nls|fitted\.smooth.spline|fitted\.values|fivenum|fligner\.test|fligner\.test.default|fligner\.test.formula|format_perc|format\.dist|format\.ftable|format\.perc|formula|formula\.character|formula\.data.frame|formula\.default|formula\.formula|formula\.glm|formula\.lm|formula\.nls|formula\.terms|frequency|frequency\.default|friedman\.test|friedman\.test.default|friedman\.test.formula|ftable|ftable\.default|ftable\.formula|Gamma|gaussian|get_all_vars|getCall|getCall\.default|getInitial|getInitial\.default|getInitial\.formula|getInitial\.selfStart|glm|glm\.control|glm\.fit|hasTsp|hat|hatvalues|hatvalues\.lm|hatvalues\.smooth.spline|hclust|heatmap|HL|HoltWinters|hyman_filter|identify\.hclust|influence|influence\.glm|influence\.lm|influence\.measures|integrate|interaction\.plot|inverse\.gaussian|IQR|is\.empty.model|is\.leaf|is\.mts|is\.stepfun|is\.ts|is\.tskernel|isoreg|KalmanForecast|KalmanLike|KalmanRun|KalmanSmooth|kernapply|kernapply\.default|kernapply\.ts|kernapply\.tskernel|kernapply\.vector|kernel|kmeans|knots|knots\.stepfun|kruskal\.test|kruskal\.test.default|kruskal\.test.formula|ks\.test|ksmooth|labels\.dendrogram|labels\.dist|labels\.lm|labels\.terms|lag|lag\.default|lag\.plot|line|lines\.isoreg|lines\.stepfun|lines\.ts|lm|lm\.fit|lm\.influence|lm\.wfit|loadings|loess|loess\.control|loess\.smooth|logLik|logLik\.Arima|logLik\.glm|logLik\.lm|logLik\.logLik|logLik\.nls|loglin|lowess|ls\.diag|ls\.print|lsfit|mad|mahalanobis|make\.link|make\.tables.aovproj|make\.tables.aovprojlist|makeARIMA|makepredictcall|makepredictcall\.default|makepredictcall\.poly|manova|mantelhaen\.test|mauchly\.test|mauchly\.test.mlm|mauchly\.test.SSD|mcnemar\.test|median|median\.default|medpolish|merge\.dendrogram|midcache\.dendrogram|model\.extract|model\.frame|model\.frame.aovlist|model\.frame.default|model\.frame.glm|model\.frame.lm|model\.matrix|model\.matrix.default|model\.matrix.lm|model\.offset|model\.response|model\.tables|model\.tables.aov|model\.tables.aovlist|model\.weights|monthplot|monthplot\.default|monthplot\.stl|monthplot\.StructTS|monthplot\.ts|mood\.test|mood\.test.default|mood\.test.formula|mvfft|n\.knots|na\.action|na\.action.default|na\.contiguous|na\.contiguous.default|na\.exclude|na\.exclude.data.frame|na\.exclude.default|na\.fail|na\.fail.default|na\.omit|na\.omit.data.frame|na\.omit.default|na\.omit.ts|na\.pass|napredict|napredict\.default|napredict\.exclude|naprint|naprint\.default|naprint\.exclude|naprint\.omit|naresid|naresid\.default|naresid\.exclude|nextn|nleaves|nlm|nlminb|nls|nls_port_fit|nls\.control|nlsModel|nlsModel\.plinear|NLSstAsymptotic|NLSstAsymptotic\.sortedXyData|NLSstClosestX|NLSstClosestX\.sortedXyData|NLSstLfAsymptote|NLSstLfAsymptote\.sortedXyData|NLSstRtAsymptote|NLSstRtAsymptote\.sortedXyData|nobs|nobs\.default|nobs\.dendrogram|nobs\.glm|nobs\.lm|nobs\.logLik|nobs\.nls|numericDeriv|offset|oneway\.test|Ops\.ts|optim|optimHess|optimise|optimize|order\.dendrogram|p\.adjust|pacf|pacf\.default|pairwise\.prop.test|pairwise\.t.test|pairwise\.table|pairwise\.wilcox.test|pbeta|pbinom|pbirthday|pcauchy|pchisq|pexp|pf|pgamma|pgeom|phyper|Pillai|plclust|plnorm|plogis|plot\.acf|plot\.decomposed.ts|plot\.dendrogram|plot\.density|plot\.ecdf|plot\.hclust|plot\.HoltWinters|plot\.isoreg|plot\.lm|plot\.medpolish|plot\.mlm|plot\.ppr|plot\.prcomp|plot\.princomp|plot\.profile.nls|plot\.spec|plot\.spec.coherency|plot\.spec.phase|plot\.stepfun|plot\.stl|plot\.ts|plot\.tskernel|plot\.TukeyHSD|plotNode|plotNodeLimit|pnbinom|pnorm|pointwise|poisson|poisson\.test|poly|polym|port_get_named_v|port_msg|power|power\.anova.test|power\.prop.test|power\.t.test|PP\.test|ppoints|ppois|ppr|ppr\.default|ppr\.formula|prcomp|prcomp\.default|prcomp\.formula|predict|predict\.ar|predict\.Arima|predict\.arima0|predict\.glm|predict\.HoltWinters|predict\.lm|predict\.loess|predict\.mlm|predict\.nls|predict\.poly|predict\.ppr|predict\.prcomp|predict\.princomp|predict\.smooth.spline|predict\.smooth.spline.fit|predict\.StructTS|predLoess|preplot|princomp|princomp\.default|princomp\.formula|print\.acf|print\.anova|print\.aov|print\.aovlist|print\.ar|print\.Arima|print\.arima0|print\.dendrogram|print\.density|print\.dist|print\.dummy_coef|print\.dummy_coef_list|print\.ecdf|print\.factanal|print\.family|print\.formula|print\.ftable|print\.glm|print\.hclust|print\.HoltWinters|print\.htest|print\.infl|print\.integrate|print\.isoreg|print\.kmeans|print\.lm|print\.loadings|print\.loess|print\.logLik|print\.medpolish|print\.mtable|print\.nls|print\.pairwise.htest|print\.power.htest|print\.ppr|print\.prcomp|print\.princomp|print\.smooth.spline|print\.stepfun|print\.stl|print\.StructTS|print\.summary.aov|print\.summary.aovlist|print\.summary.ecdf|print\.summary.glm|print\.summary.lm|print\.summary.loess|print\.summary.manova|print\.summary.nls|print\.summary.ppr|print\.summary.prcomp|print\.summary.princomp|print\.tables_aov|print\.terms|print\.ts|print\.tskernel|print\.TukeyHSD|print\.tukeyline|print\.tukeysmooth|print\.xtabs|printCoefmat|profile|profile\.nls|profiler|profiler\.nls|proj|proj\.aov|proj\.aovlist|proj\.default|proj\.lm|proj\.matrix|promax|prop\.test|prop\.trend.test|psignrank|pt|ptukey|punif|pweibull|pwilcox|qbeta|qbinom|qbirthday|qcauchy|qchisq|qexp|qf|qgamma|qgeom|qhyper|qlnorm|qlogis|qnbinom|qnorm|qpois|qqline|qqnorm|qqnorm\.default|qqplot|qr\.lm|qsignrank|qt|qtukey|quade\.test|quade\.test.default|quade\.test.formula|quantile|quantile\.default|quantile\.ecdf|quantile\.POSIXt|quasi|quasibinomial|quasipoisson|qunif|qweibull|qwilcox|r2dtable|Rank|rbeta|rbinom|rcauchy|rchisq|read\.ftable|rect\.hclust|reformulate|regularize\.values|relevel|relevel\.default|relevel\.factor|relevel\.ordered|reorder|reorder\.default|reorder\.dendrogram|replications|reshape|resid|residuals|residuals\.default|residuals\.glm|residuals\.HoltWinters|residuals\.isoreg|residuals\.lm|residuals\.nls|residuals\.smooth.spline|residuals\.tukeyline|rev\.dendrogram|rexp|rf|rgamma|rgeom|rhyper|rlnorm|rlogis|rmultinom|rnbinom|rnorm|Roy|rpois|rsignrank|rstandard|rstandard\.glm|rstandard\.lm|rstudent|rstudent\.glm|rstudent\.lm|rt|runif|runmed|rweibull|rwilcox|rWishart|safe_pchisq|safe_pf|scatter\.smooth|screeplot|screeplot\.default|sd|se\.aov|se\.aovlist|se\.contrast|se\.contrast.aov|se\.contrast.aovlist|selfStart|selfStart\.default|selfStart\.formula|setNames|shapiro\.test|sigma|sigma\.default|sigma\.mlm|simpleLoess|simulate|simulate\.lm|smooth|smooth\.spline|smoothEnds|sortedXyData|sortedXyData\.default|spec\.ar|spec\.pgram|spec\.taper|spectrum|sphericity|spl_coef_conv|spline|splinefun|splinefunH|splinefunH0|SSasymp|SSasympOff|SSasympOrig|SSbiexp|SSD|SSD\.mlm|SSfol|SSfpl|SSgompertz|SSlogis|SSmicmen|SSweibull|start|start\.default|stat\.anova|step|stepfun|stl|str\.dendrogram|str\.logLik|StructTS|summary\.aov|summary\.aovlist|summary\.ecdf|summary\.glm|summary\.infl|summary\.lm|summary\.loess|summary\.manova|summary\.mlm|summary\.nls|summary\.ppr|summary\.prcomp|summary\.princomp|summary\.stepfun|summary\.stl|summary\.tukeysmooth|supsmu|symnum|t\.test|t\.test.default|t\.test.formula|t\.ts|termplot|terms|terms\.aovlist|terms\.default|terms\.formula|terms\.terms|Thin\.col|Thin\.row|time|time\.default|time\.ts|toeplitz|Tr|ts|ts\.intersect|ts\.plot|ts\.union|tsdiag|tsdiag\.Arima|tsdiag\.arima0|tsdiag\.StructTS|tsp|tsSmooth|tsSmooth\.StructTS|TukeyHSD|TukeyHSD\.aov|uniroot|update|update\.default|update\.formula|var|var\.test|var\.test.default|var\.test.formula|variable\.names|variable\.names.default|variable\.names.lm|varimax|vcov|vcov\.Arima|vcov\.glm|vcov\.lm|vcov\.mlm|vcov\.nls|vcov\.summary.glm|vcov\.summary.lm|weighted\.mean|weighted\.mean.Date|weighted\.mean.default|weighted\.mean.difftime|weighted\.mean.POSIXct|weighted\.mean.POSIXlt|weighted\.residuals|weights|weights\.default|weights\.glm|weights\.nls|wilcox\.test|wilcox\.test.default|wilcox\.test.formula|Wilks|window|window\.default|window\.ts|write\.ftable|xtabs)\s*(?=\() + scope: meta.function-call.name.r + captures: + 1: support.function.r + push: function-call-arguments + # utils + - match: \b(adist|alarm|apropos|aregexec|argNames|argsAnywhere|as\.bibentry|as\.bibentry.bibentry|as\.bibentry.citation|as\.character.person|as\.character.roman|as\.person|as\.person.default|as\.personList|as\.personList.default|as\.personList.person|as\.relistable|as\.roman|aspell|aspell_find_dictionaries|aspell_find_program|aspell_inspect_context|aspell_package|aspell_package_C_files|aspell_package_description|aspell_package_pot_files|aspell_package_R_files|aspell_package_Rd_files|aspell_package_vignettes|aspell_R_C_files|aspell_R_manuals|aspell_R_R_files|aspell_R_Rd_files|aspell_R_vignettes|aspell_write_personal_dictionary_file|assignInMyNamespace|assignInNamespace|attachedPackageCompletions|available\.packages|bibentry|blank_out_ignores_in_lines|blank_out_regexp_matches|browseEnv|browseURL|browseVignettes|bug\.report|bug\.report.info|c\.bibentry|c\.person|capture\.output|changedFiles|check_for_XQuartz|checkCRAN|chooseBioCmirror|chooseCRANmirror|citation|cite|citeNatbib|citEntry|citFooter|citHeader|close\.socket|close\.txtProgressBar|combn|compareVersion|contrib\.url|correctFilenameToken|count\.fields|CRAN\.packages|create\.post|data|data\.entry|dataentry|de|de\.ncols|de\.restore|de\.setup|debugcall|debugger|defaultUserAgent|demo|download\.file|download\.packages|dump\.frames|edit|edit\.data.frame|edit\.default|edit\.matrix|edit\.vignette|emacs|example|expr2token|file_test|file\.edit|fileCompletionPreferred|fileCompletions|fileSnapshot|filter_packages_by_depends_predicates|find|find_files_in_directories|findExactMatches|findFuzzyMatches|findGeneric|findLineNum|findMatches|fix|fixInNamespace|flush\.console|fnLineNum|format\.aspell|format\.bibentry|format\.citation|format\.news_db|format\.object_size|format\.person|format\.roman|formatOL|formatUL|functionArgs|fuzzyApropos|get_parse_data_for_message_strings|getAnywhere|getCRANmirrors|getDependencies|getFromNamespace|getIsFirstArg|getKnownS3generics|getParseData|getParseText|getRcode|getRcode\.vignette|getS3method|getSrcDirectory|getSrcfile|getSrcFilename|getSrcLocation|getSrcref|getTxtProgressBar|glob2rx|globalVariables|hasName|head|head\.data.frame|head\.default|head\.ftable|head\.function|head\.matrix|head\.table|help|help\.request|help\.search|help\.start|helpCompletions|history|hsearch_db|hsearch_db_concepts|hsearch_db_keywords|index\.search|inFunction|install\.packages|installed\.packages|is\.relistable|isBasePkg|isInsideQuotes|isS3method|isS3stdGeneric|keywordCompletions|limitedLabels|loadedPackageCompletions|loadhistory|localeToCharset|ls\.str|lsf\.str|maintainer|make_sysdata_rda|make\.packages.html|make\.socket|makeRegexpSafe|makeRweaveLatexCodeRunner|makeUserAgent|matchAvailableTopics|memory\.limit|memory\.size|menu|merge_demo_index|merge_vignette_index|methods|mirror2html|modifyList|new\.packages|news|normalCompletions|nsl|object\.size|offline_help_helper|old\.packages|Ops\.roman|package\.skeleton|packageDescription|packageName|packageStatus|packageVersion|page|person|personList|pico|print\.aspell|print\.aspell_inspect_context|print\.bibentry|print\.Bibtex|print\.browseVignettes|print\.changedFiles|print\.citation|print\.fileSnapshot|print\.findLineNumResult|print\.getAnywhere|print\.help_files_with_topic|print\.hsearch|print\.hsearch_db|print\.Latex|print\.ls_str|print\.MethodsFunction|print\.news_db|print\.object_size|print\.packageDescription|print\.packageIQR|print\.packageStatus|print\.person|print\.roman|print\.sessionInfo|print\.socket|print\.summary.packageStatus|print\.vignette|printhsearchInternal|process\.events|prompt|prompt\.data.frame|prompt\.default|promptData|promptImport|promptPackage|rc\.getOption|rc\.options|rc\.settings|rc\.status|read\.csv|read\.csv2|read\.delim|read\.delim2|read\.DIF|read\.fortran|read\.fwf|read\.socket|read\.table|readCitationFile|recover|registerNames|regquote|relist|relist\.default|relist\.factor|relist\.list|relist\.matrix|remove\.packages|removeSource|rep\.bibentry|rep\.roman|resolvePkgType|Rprof|Rprof_memory_summary|Rprofmem|RShowDoc|RSiteSearch|rtags|rtags\.file|Rtangle|RtangleFinish|RtangleRuncode|RtangleSetup|RtangleWritedoc|RweaveChunkPrefix|RweaveEvalWithOpt|RweaveLatex|RweaveLatexFinish|RweaveLatexOptions|RweaveLatexRuncode|RweaveLatexSetup|RweaveLatexWritedoc|RweaveTryStop|savehistory|select\.list|sessionInfo|setBreakpoint|setIsFirstArg|setRepositories|setTxtProgressBar|shorten\.to.string|simplifyRepos|sort\.bibentry|specialCompletions|specialFunctionArgs|specialOpCompletionsHelper|specialOpLocs|stack|stack\.data.frame|stack\.default|Stangle|str|str\.data.frame|str\.Date|str\.default|str\.POSIXt|strcapture|strextract|strOptions|substr_with_tabs|summary\.aspell|summary\.packageStatus|summaryRprof|suppressForeignCheck|Sweave|SweaveGetSyntax|SweaveHooks|SweaveParseOptions|SweaveReadFile|SweaveSyntConv|tail|tail\.data.frame|tail\.default|tail\.ftable|tail\.function|tail\.matrix|tail\.table|tar|timestamp|toBibtex|toBibtex\.bibentry|toBibtex\.person|toLatex|toLatex\.sessionInfo|topicName|txtProgressBar|type\.convert|undebugcall|unique\.bibentry|unlist\.relistable|unstack|unstack\.data.frame|unstack\.default|untar|untar2|unzip|update\.packages|update\.packageStatus|upgrade|upgrade\.packageStatus|url\.show|URLdecode|URLencode|vi|View|vignette|write\.csv|write\.csv2|write\.etags|write\.socket|write\.table|wsbrowser|xedit|xemacs|zip)\s*(?=\() + scope: meta.function-call.name.r + captures: + 1: support.function.r + push: function-call-arguments diff --git a/assets/syntaxes/Packages/R/Rd (R Documentation).sublime-syntax b/assets/syntaxes/Packages/R/Rd (R Documentation).sublime-syntax new file mode 100644 index 000000000..804364bc9 --- /dev/null +++ b/assets/syntaxes/Packages/R/Rd (R Documentation).sublime-syntax @@ -0,0 +1,145 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Rd (R Documentation) +file_extensions: + - rd +scope: text.tex.latex.rd +contexts: + prototype: + - include: scope:text.tex.latex#comments + + main: + - include: rd-stucture + - include: r-code + - 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 + - include: global-braces + + global-braces: + - match: '\{' + scope: punctuation.definition.group.brace.begin.latex + push: + - meta_scope: meta.group.brace.latex + - match: '\}' + scope: punctuation.definition.group.brace.end.latex + pop: true + - include: main + + latex-equations: + - include: deqn + - include: eqn + + deqn: + - match: '((\\)(?:deqn))(\{)' + captures: + 1: support.function.deqn.rd + 2: punctuation.definition.backslash.rd + 3: punctuation.definition.group.brace.begin.rd + push: + - meta_scope: meta.function.deqn.rd + - meta_content_scope: meta.environment.math + - include: scope:text.tex.latex#math-content + - match: '\}' + scope: punctuation.definition.group.brace.end.rd + pop: true + + eqn: + - match: '((\\)(?:eqn))(\{)' + captures: + 1: support.function.eqn.rd + 2: punctuation.definition.backslash.rd + 3: punctuation.definition.group.brace.begin.rd + push: + - meta_scope: meta.function.eqn.rd + - meta_content_scope: meta.environment.math + - include: scope:text.tex.latex#math-content + - match: '\}' + scope: punctuation.definition.group.brace.end.rd + pop: true + + r-code: + - match: '((\\)(?:code))(\{)' + captures: + 1: support.function.code.rd + 2: punctuation.definition.backslash.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.group.brace.end.rd + pop: true + - match: \\% + - include: scope:source.r + - match: '((\\)(?:Sexpr))(?:(\[)(?:[^\]]*)(\]))?(\{)' + captures: + 1: support.function.sexpr.rd + 2: punctuation.definition.backslash.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.group.brace.end.rd + pop: true + - match: \\% + - include: scope:source.r + - match: '((\\)(?:usage))(\{)(?:\n)?' + captures: + 1: support.function.usage.rd + 2: punctuation.definition.backslash.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.group.brace.end.rd + pop: true + - match: \\% + - include: scope:source.r + - match: '((\\)(?:examples))(\{)(?:\n)?' + captures: + 1: support.function.examples.rd + 2: punctuation.definition.backslash.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.group.brace.end.rd + pop: true + - match: \\% + - include: scope:source.r + + rd-stucture: + - match: '((\\)name)(\{)' + captures: + 1: keyword.other.section.rd + 2: punctuation.definition.function.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.group.brace.end.rd + pop: true + - include: main + + - match: '((\\)(?:alias|docType|keyword|title))(\{)' + captures: + 1: keyword.other.section.rd + 2: punctuation.definition.function.rd + 3: punctuation.definition.group.brace.begin.rd + push: + - meta_scope: meta.section.rd + - match: '(\})' + captures: + 1: punctuation.definition.group.brace.end.rd + pop: true + - include: main diff --git a/assets/syntaxes/Packages/R/Snippets/Add-Tick-Marks.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Add-Tick-Marks.sublime-snippet new file mode 100644 index 000000000..90063eb64 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Add-Tick-Marks.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[rug(${1:jitter(${2:x})})]]></content> + <tabTrigger>rug</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Add Tick Marks</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Attach.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Attach.sublime-snippet new file mode 100644 index 000000000..2334b1925 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Attach.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[attach(${1:frame})]]></content> + <tabTrigger>att</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Attach</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Cummulative.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Cummulative.sublime-snippet new file mode 100644 index 000000000..4918508f8 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Cummulative.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[cum${1:max}(${2:x})]]></content> + <tabTrigger>cum</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Cummulative</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Density.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Density.sublime-snippet new file mode 100644 index 000000000..3697b94b3 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Density.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[density(${1:x}${2:, bw = ${3:bandwidth}})]]></content> + <tabTrigger>den</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Density</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Detach.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Detach.sublime-snippet new file mode 100644 index 000000000..5510b926b --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Detach.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[detach(${0:})]]></content> + <tabTrigger>det</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Detach</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Divide-Into-Intervals.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Divide-Into-Intervals.sublime-snippet new file mode 100644 index 000000000..94fcbcdc8 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Divide-Into-Intervals.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[cut(${1:x}, breaks = c(${2:${3:}, ${4:max(${1:x})}}))]]></content> + <tabTrigger>cut</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Divide Into Intervals</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Factor.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Factor.sublime-snippet new file mode 100644 index 000000000..8c0cb890f --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Factor.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[factor(${1:x})]]></content> + <tabTrigger>fac</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Factor</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/For-Loop.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/For-Loop.sublime-snippet new file mode 100644 index 000000000..2a8f695dc --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/For-Loop.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[for (${1:i} in ${2:seq}) ${3:{$0\}}]]></content> + <tabTrigger>for</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>For Loop</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Function.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Function.sublime-snippet new file mode 100644 index 000000000..3bebbfe79 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Function.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[function(${1:x}) ${3:{$0\}}]]></content> + <tabTrigger>fun</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Function</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Ifelse.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Ifelse.sublime-snippet new file mode 100644 index 000000000..4a290dc80 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Ifelse.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[ifelse(${1:test}, ${2:yes}, ${3:no})]]></content> + <tabTrigger>ife</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Ifelse</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Length.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Length.sublime-snippet new file mode 100644 index 000000000..48eefa163 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Length.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[length(${1:x})]]></content> + <tabTrigger>len</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Length</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Load-Dataset.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Load-Dataset.sublime-snippet new file mode 100644 index 000000000..cb7472978 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Load-Dataset.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[data(${1:name})]]></content> + <tabTrigger>dat</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Load Dataset</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Polygonal-Line.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Polygonal-Line.sublime-snippet new file mode 100644 index 000000000..b421214e6 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Polygonal-Line.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[lines(${1:x}${2:, color=${3:red}})]]></content> + <tabTrigger>lin</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Polygonal Line</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Read-From-File.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Read-From-File.sublime-snippet new file mode 100644 index 000000000..c9fd282a7 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Read-From-File.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[read.table("${1:filename}"${2:, header = ${3:TRUE}, sep = "${4:\t}", stringsAsFactors = ${5:FALSE}})]]></content> + <tabTrigger>rea</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Read From File</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Sequence-(from-to-by).sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Sequence-(from-to-by).sublime-snippet new file mode 100644 index 000000000..d04ff17b8 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Sequence-(from-to-by).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[seq(${1:from}, ${2:to}, ${3:by})]]></content> + <tabTrigger>seq</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Sequence (from,to,by)</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Sort.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Sort.sublime-snippet new file mode 100644 index 000000000..1b211ad47 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Sort.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[sort(${1:x})]]></content> + <tabTrigger>sor</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Sort</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/Source.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/Source.sublime-snippet new file mode 100644 index 000000000..74a6dbbd4 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/Source.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[source(${1:"${2:}"}${3:, chdir = ${4:TRUE}})]]></content> + <tabTrigger>sou</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>Source</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Snippets/na_omit.sublime-snippet b/assets/syntaxes/Packages/R/Snippets/na_omit.sublime-snippet new file mode 100644 index 000000000..3409b7547 --- /dev/null +++ b/assets/syntaxes/Packages/R/Snippets/na_omit.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[na.omit(${0:})]]></content> + <tabTrigger>nao</tabTrigger> + <scope>source.r, source.rd.console</scope> + <description>na.omit</description> +</snippet> diff --git a/assets/syntaxes/Packages/R/Symbol List - Methods.tmPreferences b/assets/syntaxes/Packages/R/Symbol List - Methods.tmPreferences new file mode 100644 index 000000000..784eac468 --- /dev/null +++ b/assets/syntaxes/Packages/R/Symbol List - Methods.tmPreferences @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List: Method</string> + <key>scope</key> + <string>meta.method.declaration.r</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string>s/\s*(.+?)\s*\(\s*("|\x27)(.*?)\s*\2/$1 "$3"/;</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/R/Symbol List - Sections (Rd Documentation).tmPreferences b/assets/syntaxes/Packages/R/Symbol List - Sections (Rd Documentation).tmPreferences new file mode 100644 index 000000000..245d8e13e --- /dev/null +++ b/assets/syntaxes/Packages/R/Symbol List - Sections (Rd Documentation).tmPreferences @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List (Rd Documentation)</string> + <key>scope</key> + <string>keyword.other.section.rd</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string>s/\\(.*)/$1/;</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/R/Symbol List - Sections.tmPreferences b/assets/syntaxes/Packages/R/Symbol List - Sections.tmPreferences new file mode 100644 index 000000000..93a8d1417 --- /dev/null +++ b/assets/syntaxes/Packages/R/Symbol List - Sections.tmPreferences @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List: Sections</string> + <key>scope</key> + <string>entity.name.section.r</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/R/syntax_test_r.R b/assets/syntaxes/Packages/R/syntax_test_r.R new file mode 100644 index 000000000..51d35aed6 --- /dev/null +++ b/assets/syntaxes/Packages/R/syntax_test_r.R @@ -0,0 +1,456 @@ +# SYNTAX TEST "Packages/R/R.sublime-syntax" + +# comment +# ^^^^^^^^ comment.line.number-sign.r + +# no section --- +# ^^^^^^^^^^^^^^^ comment.line.number-sign.r - entity + +# section 1 ---- +#^ comment.line.number-sign.r - entity +# ^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +## section 1.1 ---- +#^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + + #### section 1.1.1 ---- +#^ - comment +# ^^^^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +# no section === +# ^^^^^^^^^^^^^^ comment.line.number-sign.r - entity + +# section 2 ==== +#^ comment.line.number-sign.r - entity +# ^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +## section 2.1 ==== +#^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +#### section 2.1.1 ==== +#^^^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +# no section ### +# ^^^^^^^^^^^^^^^ comment.line.number-sign.r - entity + +# no section -=#=- +# ^^^^^^^^^^^^^^^^^ comment.line.number-sign.r - entity + +# section 3 #### +#^ comment.line.number-sign.r - entity +# ^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +## section 3.1 #### +#^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +#### section 3.1.1 #### +#^^^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +# constants +pi +# <- support.constant.misc.r +letters +# <- support.constant.misc.r +LETTERS +# <- support.constant.misc.r +month.name +# <- support.constant.misc.r +month.abb +# <- support.constant.misc.r +TRUE +# <- constant.language.r +FALSE +# <- constant.language.r +NULL +# <- constant.language.r +NA +# <- constant.language.r +NA_integer_ +# <- constant.language.r +NA_real_ +# <- constant.language.r +NA_complex_ +# <- constant.language.r +NA_character_ +# <- constant.language.r +Inf +# <- constant.language.r +NaN +# <- constant.language.r + +# complex imaginary + + 0x1afi +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.imaginary.hexadecimal.r +# ^ storage.type.numeric.r + + 0X1afi 0X1afI +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.imaginary.hexadecimal.r +# ^ storage.type.numeric.r +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.imaginary.hexadecimal.r +# ^ invalid.illegal.numeric.r + + 12i 12I +# ^^^ constant.numeric.imaginary.decimal.r +# ^ storage.type.numeric.r +# ^^^ constant.numeric.imaginary.decimal.r +# ^ invalid.illegal.numeric.r + + 12.i 12.I +# ^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r +# ^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ invalid.illegal.numeric.r + + .345i +# ^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.34e-12i +# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.34E-12i +# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.34e+12i +# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.34E+12i +# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.3456i 12.3456I +# ^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r +# ^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ invalid.illegal.numeric.r + +# integers + + 0x1afL 0x1afl 0x1afx +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.integer.hexadecimal.r +# ^ storage.type.numeric.r +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.integer.hexadecimal.r +# ^ invalid.illegal.numeric.r +# ^^^^^^ - constant + + 0X1afL +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.integer.hexadecimal.r +# ^ storage.type.numeric.r + + 12L 12l +# ^^^ constant.numeric.integer.decimal.r +# ^ storage.type.numeric.r +# ^^^ constant.numeric.integer.decimal.r +# ^ invalid.illegal.numeric.r + + 12.L +# ^^^^ constant.numeric.integer.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.000L +# ^^^^^^^ constant.numeric.integer.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + +# floats + + 0x1af +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^ constant.numeric.float.hexadecimal.r + + 0X1af +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^ constant.numeric.float.hexadecimal.r + + 12 +# ^^ constant.numeric.float.decimal.r + + 12. +# ^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r + + .3456 +# ^ punctuation.separator.decimal.r +# ^^^^^ constant.numeric.float.decimal.r + + 12.3456 +# ^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r + + 12.34e-12 +# ^^^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r + + 12.34E-12 +# ^^^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r + + 12.34e+12 +# ^^^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r + + 12.34E+12 +# ^^^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r + + 12e34 +# ^^^^^ constant.numeric.float.decimal.r + + 12e-34 +# ^^^^^^ constant.numeric.float.decimal.r + + %*% %/% %% %o% %x% %:% %+% +# ^^^ keyword.operator.arithmetic.r +# ^^^ keyword.operator.arithmetic.r +# ^^ keyword.operator.arithmetic.r +# ^^^ keyword.operator.arithmetic.r +# ^^^ keyword.operator.arithmetic.r +# ^^^ keyword.operator.other.r +# ^^^ keyword.operator.other.r + + ** * - + / ^ +# ^^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r + + <<- <- = -> ->> +# ^^^ keyword.operator.assignment.r +# ^^ keyword.operator.assignment.r +# ^ keyword.operator.assignment.r +# ^^ keyword.operator.assignment.r +# ^^^ keyword.operator.assignment.r + + == != <= >= <> < > && & || | ! +# ^^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^ keyword.operator.logical.r +# ^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^ keyword.operator.logical.r +# ^ keyword.operator.logical.r + + %:% := ::: :: +# ^^^ keyword.operator.other.r +# ^^ keyword.operator.other.r +# ^^^ punctuation.accessor.colons.r +# ^^ punctuation.accessor.colons.r + + ... : ~ @ +# ^^^ keyword.other.r +# ^ keyword.other.r +# ^ keyword.other.r +# ^ keyword.other.r + + foo.99 <- 1 +# ^^^ - constant.numeric +# ^^ keyword.operator.assignment.r + +x <- "abc" +# ^^ keyword.operator.assignment.r +# ^ punctuation.definition.string.begin.r +# ^^^^^ string.quoted.double.r +# ^ punctuation.definition.string.end.r + +x <- 'abc' +# ^^ keyword.operator.assignment.r +# ^ punctuation.definition.string.begin.r +# ^^^^^ string.quoted.single.r +# ^ punctuation.definition.string.end.r + +"\n\r" +#^^^^ constant.character.escape.r + + +if (1) {} else {return()} +#<- keyword.control.conditional.if.r +# ^^^^ keyword.control.conditional.else.r +# ^^^^^^ keyword.control.flow.return.r + + +for (i in 1:10) { +# <- keyword.control.loop.for.r +# ^ punctuation.section.parens.begin.r +# ^^ keyword.operator.word.r +# ^ punctuation.section.parens.end.r +# ^ punctuation.section.braces.begin.r +} +# <- punctuation.section.braces.end.r + + +repeat {next} +#^^^^^ keyword.control.loop.repeat.r +# ^^^^ keyword.control.flow.continue.r + + +while (1) {break} +#^^^^ keyword.control.loop.while.r +# ^^^^^ keyword.control.flow.break.r + + +foo[bar] +# ^ punctuation.section.brackets.single.begin.r +# ^^^^^ meta.item-access.r +# ^^^ meta.item-access.r meta.item-access.arguments.r +# ^ punctuation.section.brackets.single.end.r + + +foo[[bar]] +# ^^ punctuation.section.brackets.double.begin.r +# ^^^^^^^ meta.item-access.r +# ^^^ meta.item-access.r meta.item-access.arguments.r +# ^^ punctuation.section.brackets.double.end.r + + +foo[1:10] +# ^ meta.item-access.r meta.item-access.arguments.r keyword.other.r + + +f = function(x, y){ } +# <- meta.function.name.r +#^ meta.function.name.r - meta.function.r +# ^^^^^^^^^^ meta.function.r - meta.function.parameters.r +# <- entity.name.function.r +# ^ keyword.operator.assignment.r +# ^^^^^^^^ storage.type.function.r +# ^ punctuation.section.parameters.begin.r +# ^^^^ meta.function.parameters.r - meta.function.r +# ^ variable.parameter.r +# ^ punctuation.separator.parameters.r +# ^ punctuation.section.parameters.end.r +# ^ punctuation.section.braces.begin.r +# ^ punctuation.section.braces.end.r + +function(x = "string", y = 2) {} +# ^ variable.parameter.r +# ^^^^^^^^ meta.function.parameters.r string.quoted.double.r +# ^ variable.parameter.r +# ^ meta.function.parameters.r constant.numeric.float.decimal.r + +foo(200, x = function(x) {x + y}) +#^^ meta.function-call.name.r - meta.function-call.arguments.r +# <- variable.function.r +# ^ punctuation.section.arguments.begin.r +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.r - meta.function-call.name.r +# ^^^ constant.numeric.float.decimal.r +# ^ variable.parameter.r +# ^ keyword.operator.assignment.r +# ^^^^^^^^ meta.function.r storage.type.function.r - meta.function.parameters.r +# ^^^ meta.function.parameters.r +# ^ punctuation.section.arguments.end.r + +.foo(200, x = function(x) {x + y}) +# <- meta.function-call.name.r +#^^^ meta.function-call.name.r - meta.function-call.arguments.r +# <- variable.function.r +# ^ punctuation.section.arguments.begin.r +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.r - meta.function-call.name.r +# ^^^ constant.numeric.float.decimal.r +# ^ variable.parameter.r +# ^ keyword.operator.assignment.r +# ^^^^^^^^ meta.function.r - meta.function.parameters.r +# ^^^ meta.function.parameters.r +# ^ punctuation.section.arguments.end.r + + +print.foo() +#^^^^^^^^ variable.function.r + + plot() +# ^^^^ meta.function-call.name.r - meta.function-call.arguments.r +# ^^ meta.function-call.arguments.r - meta.function-call.name.r +# ^^^^ support.function.r + +#' @param xyz abcde +#^^^^^^^^^^^^^^^^^^ comment.line.roxygen.r +# ^^^^^^ keyword.other.r +# ^^^ variable.parameter.r + + +# issue #1019 +foo[[bar[1]]] # +# ^ source.r meta.item-access.r meta.item-access.arguments.r meta.item-access.r +# ^ - meta.item-access.r + + +`1+1` = 2 +# ^ - keyword.operator.arithmetic.r + +# issue #1120 +sum(x == 1) +# ^^^^^^ - variable.parameter.r +# ^^ keyword.operator.logical.r + +function( + x = 1, # this should be comment +# ^ punctuation.definition.comment +# ^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign + y = 2 +) + +foo(abc = function() {}) +# ^^^ variable.parameter + +foo( + NULL, + bar = function() {} +# ^^^ variable.parameter +) + +a[, "weight"]; +# ^ meta.item-access.r meta.item-access.arguments.r punctuation.separator.parameters.r +# ^ punctuation.terminator.semicolon.r + +a[[1, 2]] +# ^ meta.item-access.r meta.item-access.arguments.r punctuation.separator.parameters.r + +foo:::bar +# ^^^ punctuation.accessor.colons.r + + +foo$update() +# ^ keyword.accessor.dollar.r +# ^^^^^^ meta.function-call.name.r variable.function.r +# ^^^^^^ - support.function.r diff --git a/assets/syntaxes/Packages/README.md b/assets/syntaxes/Packages/README.md new file mode 100644 index 000000000..3e18243d0 --- /dev/null +++ b/assets/syntaxes/Packages/README.md @@ -0,0 +1,58 @@ +# Sublime Packages + +> **These packages are developed against the latest [Sublime Text 3 Dev Build](http://sublimetext.com/3dev). Bugs may exist on older builds, and the format used is not compatible with builds older than 3092.** + +## Installation + +If you want to make changes to these packages and test them locally, fork this repository and then symlink the changed packages into your *Packages* folder. + +*Replace `Python` in the following commands with the name of the syntax to install.* + +### OS X + +```bash +$ git clone https://github.com/sublimehq/Packages.git +$ ln -s `pwd`/Packages/Python ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/ +``` + +### Linux + +```bash +$ git clone https://github.com/sublimehq/Packages.git +$ ln -s `pwd`/Packages/Python ~/.config/sublime-text-3/Packages/ +``` + +### Windows + +On Windows, you can use directory junctions instead of symlinks (symlinks require administrative rights; directory junctions don't): + +```powershell +# Using PowerShell +PS> git clone https://github.com/sublimehq/Packages.git +PS> cmd /c mklink /J "$env:APPDATA/Sublime Text 3/Packages/Python" (convert-path ./Packages/Python) +``` + +Alternatively, download the portable version, and clone this repository directly as a subdirectory of the *Data* folder. + +--- + +After you've finished, keep in mind that you're now overriding a default package. When Sublime Text updates to a new version, you'll run the risk of having an out-of-date package unless you pull the latest changes from this repository. + +## Pull Requests + +Pull requests should: + + 1. Start with the name of the package in square brackets, e.g. `[XML]`. + 2. Be as small and self-contained as is reasonable. *Smaller changes are quicker to review.* + 3. Include a new, or enhanced, [syntax test](http://www.sublimetext.com/docs/3/syntax.html) when changing a `.sublime-syntax` file. + 4. Have multiple syntax tests and a set of performance measurements (old vs. new) when making significant changes. + +### New Packages + +Pull requests for new packages won't be accepted at this stage, as new packages can cause issues for users who have a package with the same name installed via Package Control. There are some planned changes that will address this in the future. + +Complex plugins such as auto complete systems and linters should generally be in a stand-alone package, rather than included in the default set of packages. + +## Missing Packages + +This repository only contains syntax-definition-focused packages. Notably, packages such as *Default* and *Theme - Default* are not included. diff --git a/assets/syntaxes/Packages/Rails/HTML (Rails).sublime-syntax b/assets/syntaxes/Packages/Rails/HTML (Rails).sublime-syntax new file mode 100644 index 000000000..65568ca36 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/HTML (Rails).sublime-syntax @@ -0,0 +1,32 @@ +%YAML 1.2 +--- +name: HTML (Rails) +file_extensions: + - rails + - rhtml + - erb + - html.erb +scope: text.html.ruby +contexts: + main: + - match: '' + push: 'scope:text.html.basic' + with_prototype: + - match: "<%+#" + scope: punctuation.definition.comment.erb + push: + - meta_scope: comment.block.erb + - match: "%>" + pop: true + - match: "<%+(?!>)[-=]?" + scope: punctuation.section.embedded.ruby + push: + - meta_scope: source.ruby.rails.embedded.html + - match: "-?%>" + scope: punctuation.section.embedded.ruby + pop: true + - match: (#).*?(?=-?%>) + scope: comment.line.number-sign.ruby + captures: + 1: punctuation.definition.comment.ruby + - include: "Ruby on Rails.sublime-syntax" diff --git a/assets/syntaxes/Packages/Rails/JavaScript (Rails).sublime-syntax b/assets/syntaxes/Packages/Rails/JavaScript (Rails).sublime-syntax new file mode 100644 index 000000000..443176b50 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/JavaScript (Rails).sublime-syntax @@ -0,0 +1,26 @@ +%YAML 1.2 +--- +name: JavaScript (Rails) +file_extensions: + - js.erb +scope: source.js.rails +contexts: + main: + - match: "<%+#" + scope: punctuation.definition.comment.erb + push: + - meta_scope: comment.block.erb + - match: "%>" + pop: true + - match: "<%+(?!>)[-=]?" + scope: punctuation.section.embedded.ruby + push: + - meta_scope: source.ruby.rails.erb + - match: "-?%>" + pop: true + - match: (#).*?(?=-?%>) + scope: comment.line.number-sign.ruby + captures: + 1: punctuation.definition.comment.ruby + - include: "Ruby on Rails.sublime-syntax" + - include: 'scope:source.js' diff --git a/assets/syntaxes/Packages/Rails/Ruby Haml Comments.tmPreferences b/assets/syntaxes/Packages/Rails/Ruby Haml Comments.tmPreferences new file mode 100644 index 000000000..cf235c65d --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Ruby Haml Comments.tmPreferences @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>text.haml</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string>/ </string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Rails/Ruby Haml.sublime-syntax b/assets/syntaxes/Packages/Rails/Ruby Haml.sublime-syntax new file mode 100644 index 000000000..7dad9cebd --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Ruby Haml.sublime-syntax @@ -0,0 +1,81 @@ +%YAML 1.2 +--- +name: Ruby Haml +file_extensions: + - haml + - sass +scope: text.haml +contexts: + main: + - match: ^(!!!)($|\s.*) + scope: meta.prolog.haml + captures: + 1: punctuation.definition.prolog.haml + - match: ^ *(/)\s*\S.*$\n? + scope: comment.line.slash.haml + captures: + 1: punctuation.section.comment.haml + - match: ^( *)(/)\s*$ + captures: + 2: punctuation.section.comment.haml + push: + - meta_scope: comment.block.haml + - match: ^(?!\1 ) + pop: true + - include: "Ruby Haml.sublime-syntax" + - match: '^\s*(?:((%)([\w:]+))|(?=\.|#))' + captures: + 1: meta.tag.haml + 2: punctuation.definition.tag.haml + 3: entity.name.tag.haml + push: + - match: '$|(?!\.|#|\{|\[|=|-|~|/)' + pop: true + - match: '\.[\w-]+' + scope: entity.name.tag.class.haml + - match: '#[\w-]+' + scope: entity.name.tag.id.haml + - match: '\{(?=.*\}|.*\|\s*$)' + push: + - meta_scope: meta.section.attributes.haml + - match: '\}|$|^(?!.*\|\s*$)' + pop: true + - include: "Ruby on Rails.sublime-syntax" + - include: continuation + - match: '\[(?=.*\]|.*\|\s*$)' + push: + - meta_scope: meta.section.object.haml + - match: '\]|$|^(?!.*\|\s*$)' + pop: true + - include: "Ruby on Rails.sublime-syntax" + - include: continuation + - include: rubyline + - match: / + scope: punctuation.terminator.tag.haml + - match: ^\s*(\\.) + captures: + 1: meta.escape.haml + - match: ^\s*(?==|-|~) + push: + - match: $ + pop: true + - include: rubyline + continuation: + - match: (\|)\s*\n + captures: + 1: punctuation.separator.continuation.haml + rubyline: + - match: "=|-|~" + push: + - meta_scope: meta.line.ruby.haml + - meta_content_scope: source.ruby.embedded.haml + - match: '((do|\{)( \|[^|]+\|)?)$|$|^(?!.*\|\s*$)' + captures: + 1: source.ruby.embedded.html + 2: keyword.control.start-block.ruby + pop: true + - match: "#.*$" + comment: Hack to let ruby comments work in this context properly + scope: comment.line.number-sign.ruby + - include: Packages/Rails/Ruby on Rails.sublime-syntax + - include: continuation diff --git a/assets/syntaxes/Packages/Rails/Ruby on Rails.sublime-syntax b/assets/syntaxes/Packages/Rails/Ruby on Rails.sublime-syntax new file mode 100644 index 000000000..d5e5b11e7 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Ruby on Rails.sublime-syntax @@ -0,0 +1,200 @@ +%YAML 1.2 +--- +name: Ruby on Rails +file_extensions: + - rxml + - builder +scope: source.ruby.rails +contexts: + main: + - include: early-expressions + - include: late-expressions + - include: 'scope:source.ruby#expressions' + + embedded-expressions: + - include: early-expressions + # This is placed here to prevent the lookaheads from causing infinite recursion + - include: scope:source.ruby + - include: late-expressions + + early-expressions: + # Uses negative lookahead to filter out symbols + - match: | + (?x) + \b + ( + before_(filter|action) + | skip_before_(filter|action) + | skip_after_(filter|action) + | after_(filter|action) + | around_(filter|action) + | filter + | filter_parameter_logging + | layout + | require_dependency + | render + | render_action + | render_text + | render_file + | render_template + | render_nothing + | render_component + | render_without_layout + | rescue_from + | url_for + | redirect_to + | redirect_to_path + | redirect_to_url + | respond_to + | helper + | helper_method + | model + | observer + | serialize + | scaffold + | verify + | hide_action + | append_view_path + | prepend_view_path + | view_paths + ) + (?![?!:]) + \b + scope: support.function.actionpack.rails + # Uses negative lookahead to filter out symbols + - match: | + (?x) + \b + ( + named_scope + | default_scope + | scope + | after_create + | after_destroy + | after_save + | after_update + | after_validation + | after_validation_on_create + | after_validation_on_update + | after_rollback + | after_(create_|destroy_|update_)?commit + | before_create + | before_destroy + | before_save + | before_update + | before_validation + | before_validation_on_create + | before_validation_on_update + | composed_of + | belongs_to + | has_one + | has_many + | has_and_belongs_to_many + | validate + | validate_on_create + | validates_numericality_of + | validate_on_update + | validates_acceptance_of + | validates_associated + | validates_confirmation_of + | validates_each + | validates_format_of + | validates_inclusion_of + | validates_exclusion_of + | validates_length_of + | validates_presence_of + | validates_size_of + | validates_uniqueness_of + | validates + | attr_protected + | attr_accessible + | attr_readonly + ) + (?![?!:]) + \b + scope: support.function.activerecord.rails + - match: | + (?x) + \b + ( + alias_method_chain + | alias_attribute + | delegate + | cattr_accessor + | mattr_accessor + | class_attribute + | returning + ) + \b + scope: support.function.activesupport.rails + + # These expressions match the leading whitespace to properly match the correct + # "end", but it also means they'll match before the main Ruby syntax will + late-expressions: + # Uses lookahead to match classes with the ControllerTest suffix + - match: '(^\s*)(?=class\s+(([.[:alnum:]_:]+ControllerTest(\s*<\s*[.[:alnum:]_:]+)?)))' + push: + - meta_scope: meta.functional_test.rails + - match: ^\1(?=end)\b + pop: true + - include: embedded-expressions + # Uses lookahead to match classes with the Controller suffix + - match: '(^\s*)(?=class\s+(([.[:alnum:]_:]+Controller\b(\s*<\s*[.[:alnum:]_:]+)?)|(<<\s*[.[:alnum:]_:]+)))(?!.+\bend\b)' + push: + - meta_scope: meta.controller.rails + - match: ^\1(?=end)\b + pop: true + - include: embedded-expressions + # Uses lookahead to match modules with the Helper suffix + - match: '(^\s*)(?=module\s+((([[:upper:]]\w*::)*)[[:upper:]]\w*)Helper\b)' + push: + - meta_scope: meta.helper.rails + - match: ^\1(?=end)\b + pop: true + - include: embedded-expressions + # Uses lookahead to match classes that inherit from ActionMailer::Base + - match: '(^\s*)(?=class\s+(([.[:alnum:]_:]+(\s*<\s*ActionMailer::Base\b))))' + push: + - meta_scope: meta.mailer.rails + - match: ^\1(?=end)\b + pop: true + - include: embedded-expressions + # Uses lookahead to match classes that (may) inherit from ActiveRecord::Base + - match: (^\s*)(?=class\s+.+ActiveRecord::Base\b) + push: + - meta_scope: meta.model.rails + - match: ^\1(?=end)\b + pop: true + - include: embedded-expressions + # Uses lookahead to match classes that (may) inherit from ActiveRecord::Migration + - match: (^\s*)(?=class\s+.+ActiveRecord::Migration\b) + push: + - meta_scope: meta.migration.rails + - match: ^\1(?=end)\b + pop: true + - match: (^\s*)(?=change_table)\b + push: + - meta_content_scope: meta.migration.change_table.rails + - match: ^\1(?=end)\b + pop: true + - include: embedded-expressions + - match: (^\s*)(?=create_table)\b + push: + - meta_content_scope: meta.migration.create_table.rails + - match: ^\1(?=end)\b + pop: true + - include: embedded-expressions + - include: embedded-expressions + # Uses lookahead to match classes with the Test suffix + - match: '(^\s*)(?=class\s+(?![.[:alnum:]_:]+ControllerTest)(([.[:alnum:]_:]+Test(\s*<\s*[.[:alnum:]_:]+)?)|(<<\s*[.[:alnum:]_:]+)))' + push: + - meta_scope: meta.unit_test.rails + - match: ^\1(?=end)\b + pop: true + - include: embedded-expressions + - match: (^\s*)ActionController::Routing::Routes + push: + - meta_scope: meta.routes.rails + - match: ^\1(?=end)\b + pop: true + - include: embedded-expressions diff --git a/assets/syntaxes/Packages/Rails/SQL (Rails).sublime-syntax b/assets/syntaxes/Packages/Rails/SQL (Rails).sublime-syntax new file mode 100644 index 000000000..4e3abf820 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/SQL (Rails).sublime-syntax @@ -0,0 +1,18 @@ +%YAML 1.2 +--- +name: SQL (Rails) +file_extensions: + - erbsql + - sql.erb +scope: source.sql.ruby +contexts: + main: + - match: <%+(?!>)=? + push: + - meta_scope: source.ruby.rails.embedded.sql + - match: "%>" + pop: true + - match: "#.*?(?=%>)" + scope: comment.line.number-sign.ruby + - include: "Ruby on Rails.sublime-syntax" + - include: 'scope:source.sql' diff --git a/assets/syntaxes/Packages/Rails/Snippets/$LABEL.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/$LABEL.sublime-snippet new file mode 100644 index 000000000..039803136 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/$LABEL.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[\$LABEL]]></content> + <tabTrigger>$L</tabTrigger> + <scope>source.yaml</scope> + <description>$LABEL</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/%3C%=-Fixtures_identify(%3Asymbol)-%%3E.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/%3C%=-Fixtures_identify(%3Asymbol)-%%3E.sublime-snippet new file mode 100644 index 000000000..638568008 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/%3C%=-Fixtures_identify(%3Asymbol)-%%3E.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}Fixtures.identify(:${1:name})${TM_RAILS_TEMPLATE_END_RUBY_EXPR}$0]]></content> + <tabTrigger>fi</tabTrigger> + <scope>source.yaml</scope> + <description><%= Fixtures.identify(:symbol) %></description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/180-rails-form_tag.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/180-rails-form_tag.sublime-snippet new file mode 100644 index 000000000..3fea938d7 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/180-rails-form_tag.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_INLINE}form_tag(${1::action => "${5:update}"}${6:, {:${8:class} => "${9:form}"\}}) do${TM_RAILS_TEMPLATE_END_RUBY_EXPR} + $0 +${TM_RAILS_TEMPLATE_END_RUBY_BLOCK}]]></content> + <tabTrigger>ft</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_tag</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-binary-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-binary-column.sublime-snippet new file mode 100644 index 000000000..9672a33d9 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-binary-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.binary :${1:title}${2:, :limit => ${3:2}.megabytes} +$0]]></content> + <tabTrigger>tcbi</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column binary</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-boolean-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-boolean-column.sublime-snippet new file mode 100644 index 000000000..79edba480 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-boolean-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.boolean :${1:title} +$0]]></content> + <tabTrigger>tcb</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column boolean</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-controller-class.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-controller-class.sublime-snippet new file mode 100644 index 000000000..1165e4fc2 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-controller-class.sublime-snippet @@ -0,0 +1,15 @@ +<snippet> + <content><![CDATA[class ${1:Model}Controller < ApplicationController + before_action :find_${2:model} + + $0 + + private + def find_${2} + @$2 = ${3:$1}.find(params[:id]) if params[:id] + end +end]]></content> + <tabTrigger>cla</tabTrigger> + <scope>source.ruby</scope> + <description>Create controller class</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-date-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-date-column.sublime-snippet new file mode 100644 index 000000000..16658fab6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-date-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.date :${1:title} +$0]]></content> + <tabTrigger>tcda</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column date</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-datetime-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-datetime-column.sublime-snippet new file mode 100644 index 000000000..4ecce31cc --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-datetime-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.datetime :${1:title} +$0]]></content> + <tabTrigger>tcdt</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column datetime</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-decimal-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-decimal-column.sublime-snippet new file mode 100644 index 000000000..bb7f47123 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-decimal-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.decimal :${1:title}${2:${3:, :precision => ${4:10}}${5:, :scale => ${6:2}}} +$0]]></content> + <tabTrigger>tcd</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column decimal</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-float-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-float-column.sublime-snippet new file mode 100644 index 000000000..8a25d16f6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-float-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.float :${1:title} +$0]]></content> + <tabTrigger>tcf</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column float</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-functional-test-class.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-functional-test-class.sublime-snippet new file mode 100644 index 000000000..ea8841679 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-functional-test-class.sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <content><![CDATA[require File.dirname(__FILE__) + '/../test_helper' + +class ${1:Model}ControllerTest < ActionController::TestCase + deft$0 +end +]]></content> + <tabTrigger>cla</tabTrigger> + <scope>source.ruby</scope> + <description>Create functional test class</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-integer-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-integer-column.sublime-snippet new file mode 100644 index 000000000..3ca8c3c8e --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-integer-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.integer :${1:title} +$0]]></content> + <tabTrigger>tci</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column integer</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-lock_version-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-lock_version-column.sublime-snippet new file mode 100644 index 000000000..e58946a90 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-lock_version-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.integer :lock_version, :null => false, :default => 0 +$0]]></content> + <tabTrigger>tcl</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column lock_version</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-references-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-references-column.sublime-snippet new file mode 100644 index 000000000..a7a6712d4 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-references-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.references :${1:taggable}${2:, :polymorphic => ${3:{ :default => '${4:Photo}' \}}} +$0]]></content> + <tabTrigger>tcr</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column(s) references</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-string-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-string-column.sublime-snippet new file mode 100644 index 000000000..9ab243951 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-string-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.string :${1:title} +$0]]></content> + <tabTrigger>tcs</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column string</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-text-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-text-column.sublime-snippet new file mode 100644 index 000000000..c9bb6d038 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-text-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.text :${1:title} +$0]]></content> + <tabTrigger>tct</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column text</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-time-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-time-column.sublime-snippet new file mode 100644 index 000000000..8d049d7f3 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-time-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.time :${1:title} +$0]]></content> + <tabTrigger>tcti</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column time</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-timestamp-column.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-timestamp-column.sublime-snippet new file mode 100644 index 000000000..4d7453a63 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-timestamp-column.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.timestamp :${1:title} +$0]]></content> + <tabTrigger>tcts</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column timestamp</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Create-timestamps-columns.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Create-timestamps-columns.sublime-snippet new file mode 100644 index 000000000..c5d91b024 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Create-timestamps-columns.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.timestamps +$0]]></content> + <tabTrigger>tctss</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column timestamps</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Migration-Create-Column-(mcc).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Migration-Create-Column-(mcc).sublime-snippet new file mode 100644 index 000000000..3714e738f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Migration-Create-Column-(mcc).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.column ${1:title}, :${2:string} +$0]]></content> + <tabTrigger>mcol</tabTrigger> + <scope>meta.migration.create_table.rails</scope> + <description>Create Column in Table</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Migration-Create-Column-Continue-(mccc).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Migration-Create-Column-Continue-(mccc).sublime-snippet new file mode 100644 index 000000000..b55591f66 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Migration-Create-Column-Continue-(mccc).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.column ${1:title}, :${2:string} +mccc$0]]></content> + <tabTrigger>mccc</tabTrigger> + <scope>meta.migration.create_table.rails</scope> + <description>Create Several Columns in Table</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Migration-Drop-Create-Table-(mdct).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Migration-Drop-Create-Table-(mdct).sublime-snippet new file mode 100644 index 000000000..eeab82132 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Migration-Drop-Create-Table-(mdct).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[drop_table :${1:table}${2: [press tab twice to generate create_table]}]]></content> + <tabTrigger>mtab</tabTrigger> + <scope>meta.migration.rails - meta.migration.create_table.rails - meta.migration.change_table.rails</scope> + <description>Drop / Create Table</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Migration-Remove-and-Add-Column-(mrac).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Migration-Remove-and-Add-Column-(mrac).sublime-snippet new file mode 100644 index 000000000..e4cdd1050 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Migration-Remove-and-Add-Column-(mrac).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[remove_column :${1:table}, :${2:column}${3: [press tab twice to generate add_column]}]]></content> + <tabTrigger>mcol</tabTrigger> + <scope>meta.migration.rails - meta.migration.create_table.rails - meta.migration.change_table.rails</scope> + <description>Remove / Add Column</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/RAILS_DEFAULT_LOGGER.debug-(rdb).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/RAILS_DEFAULT_LOGGER.debug-(rdb).sublime-snippet new file mode 100644 index 000000000..3d41e91af --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/RAILS_DEFAULT_LOGGER.debug-(rdb).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[RAILS_DEFAULT_LOGGER.debug "${1:message}"$0]]></content> + <tabTrigger>rdb</tabTrigger> + <scope>source.ruby.rails</scope> + <description>RAILS_DEFAULT_LOGGER.debug</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Table-column(s)-rename.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Table-column(s)-rename.sublime-snippet new file mode 100644 index 000000000..ca32208e4 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Table-column(s)-rename.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.rename(:${1:old_column_name}, :${2:new_column_name}) +$0]]></content> + <tabTrigger>tre</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>Table column(s) rename</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Test-Assert-Redirected-To-(art).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Test-Assert-Redirected-To-(art).sublime-snippet new file mode 100644 index 000000000..497162266 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Test-Assert-Redirected-To-(art).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_redirected_to ${2::action => "${1:index}"}]]></content> + <tabTrigger>art</tabTrigger> + <scope>source.ruby.rails</scope> + <description>assert_redirected_to</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/Test-Assert-Response-(are).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/Test-Assert-Response-(are).sublime-snippet new file mode 100644 index 000000000..05aedfa9a --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/Test-Assert-Response-(are).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_response :${1:success}, @response.body$0]]></content> + <tabTrigger>asre</tabTrigger> + <scope>source.ruby.rails</scope> + <description>assert_response</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/after_create.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/after_create.sublime-snippet new file mode 100644 index 000000000..ec5bfa781 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/after_create.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[after_create ]]></content> + <tabTrigger>aftc</tabTrigger> + <scope>source.ruby.rails</scope> + <description>after_create</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/after_destroy.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/after_destroy.sublime-snippet new file mode 100644 index 000000000..11fc3bbd2 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/after_destroy.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[after_destroy ]]></content> + <tabTrigger>aftd</tabTrigger> + <scope>source.ruby.rails</scope> + <description>after_destroy</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/after_save.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/after_save.sublime-snippet new file mode 100644 index 000000000..ff5a8bce6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/after_save.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[after_save ]]></content> + <tabTrigger>afts</tabTrigger> + <scope>source.ruby.rails</scope> + <description>after_save</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/after_update.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/after_update.sublime-snippet new file mode 100644 index 000000000..af3e9a9cf --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/after_update.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[after_update ]]></content> + <tabTrigger>aftu</tabTrigger> + <scope>source.ruby.rails</scope> + <description>after_update</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/after_validation.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/after_validation.sublime-snippet new file mode 100644 index 000000000..e672d0bb1 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/after_validation.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[after_validation ]]></content> + <tabTrigger>aftv</tabTrigger> + <scope>source.ruby.rails</scope> + <description>after_validation</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/after_validation_on_create.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/after_validation_on_create.sublime-snippet new file mode 100644 index 000000000..53818f1db --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/after_validation_on_create.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[after_validation :${1:attr}, :on => :create]]></content> + <tabTrigger>aftvoc</tabTrigger> + <scope>source.ruby.rails</scope> + <description>after_validation on create</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/after_validation_on_update.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/after_validation_on_update.sublime-snippet new file mode 100644 index 000000000..5a5b767ce --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/after_validation_on_update.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[after_validation :${1:attr}, :on => :update]]></content> + <tabTrigger>aftvou</tabTrigger> + <scope>source.ruby.rails</scope> + <description>after_validation_on_update</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/assert(var-=-assigns(%3Avar)).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/assert(var-=-assigns(%3Avar)).sublime-snippet new file mode 100644 index 000000000..f2496eed6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/assert(var-=-assigns(%3Avar)).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[assert(${1:var} = assigns(:${1}), "Cannot find @${1}") +$0]]></content> + <tabTrigger>asg</tabTrigger> + <scope>source.ruby</scope> + <description>assert(var = assigns(:var))</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/assert_difference.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/assert_difference.sublime-snippet new file mode 100644 index 000000000..5a0d386db --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/assert_difference.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[assert_difference "${1:Model}.${2:count}", ${3:1} do + $0 +end]]></content> + <tabTrigger>asd</tabTrigger> + <scope>source.ruby</scope> + <description>assert_difference</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/assert_no_difference.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/assert_no_difference.sublime-snippet new file mode 100644 index 000000000..c87a08163 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/assert_no_difference.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[assert_no_difference "${1:Model}.${2:count}" do + $0 +end]]></content> + <tabTrigger>asnd</tabTrigger> + <scope>source.ruby</scope> + <description>assert_no_difference</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(nested-path).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(nested-path).sublime-snippet new file mode 100644 index 000000000..1d2838e00 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(nested-path).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_redirected_to ${2:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})}]]></content> + <tabTrigger>artnp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>assert_redirected_to (nested path)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(nested-path-plural).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(nested-path-plural).sublime-snippet new file mode 100644 index 000000000..60fcae645 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(nested-path-plural).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_redirected_to ${10:${2:parent}_${3:child}_path(${4:@}${5:${2}})}]]></content> + <tabTrigger>artnpp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>assert_redirected_to (nested path plural)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(path).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(path).sublime-snippet new file mode 100644 index 000000000..9d4d1ba25 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(path).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_redirected_to ${2:${12:model}_path(${13:@}${14:${12}})}]]></content> + <tabTrigger>artp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>assert_redirected_to (path)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(path-plural).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(path-plural).sublime-snippet new file mode 100644 index 000000000..70cdf9972 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/assert_redirected_to-(path-plural).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_redirected_to ${10:${2:model}s_path}]]></content> + <tabTrigger>artpp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>assert_redirected_to (path plural)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/assert_select.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/assert_select.sublime-snippet new file mode 100644 index 000000000..3166f25fd --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/assert_select.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[assert_select '${1:path}'${2:, :${3:text} => ${4:'${5:inner_html}'}}${6: do + $0 +end}]]></content> + <tabTrigger>ass</tabTrigger> + <scope>source.ruby.rails</scope> + <description>assert_select</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/before_create.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/before_create.sublime-snippet new file mode 100644 index 000000000..4b0e816f8 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/before_create.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[before_create ]]></content> + <tabTrigger>befc</tabTrigger> + <scope>source.ruby.rails</scope> + <description>before_create</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/before_destroy.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/before_destroy.sublime-snippet new file mode 100644 index 000000000..8481e52e4 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/before_destroy.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[before_destroy ]]></content> + <tabTrigger>befd</tabTrigger> + <scope>source.ruby.rails</scope> + <description>before_destroy</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/before_save.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/before_save.sublime-snippet new file mode 100644 index 000000000..43fe1410a --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/before_save.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[before_save ]]></content> + <tabTrigger>befs</tabTrigger> + <scope>source.ruby.rails</scope> + <description>before_save</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/before_update.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/before_update.sublime-snippet new file mode 100644 index 000000000..89483ef48 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/before_update.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[before_update ]]></content> + <tabTrigger>befu</tabTrigger> + <scope>source.ruby.rails</scope> + <description>before_update</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/before_validation.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/before_validation.sublime-snippet new file mode 100644 index 000000000..69e4de5ca --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/before_validation.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[before_validation ]]></content> + <tabTrigger>befv</tabTrigger> + <scope>source.ruby.rails</scope> + <description>before_validation</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/before_validation_on_create.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/before_validation_on_create.sublime-snippet new file mode 100644 index 000000000..182dd930e --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/before_validation_on_create.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[before_validation :${1:attr}, :on => :create]]></content> + <tabTrigger>befvoc</tabTrigger> + <scope>source.ruby.rails</scope> + <description>before_validation on create</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/before_validation_on_update.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/before_validation_on_update.sublime-snippet new file mode 100644 index 000000000..009774669 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/before_validation_on_update.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[before_validation :${1:attr}, :on => :update]]></content> + <tabTrigger>befvou</tabTrigger> + <scope>source.ruby.rails</scope> + <description>before_validation on update</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/belongs_to-(bt).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/belongs_to-(bt).sublime-snippet new file mode 100644 index 000000000..695b787fb --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/belongs_to-(bt).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[belongs_to :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:${1}_id}"}]]></content> + <tabTrigger>bt</tabTrigger> + <scope>source.ruby.rails</scope> + <description>belongs_to</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/cattr_accessor.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/cattr_accessor.sublime-snippet new file mode 100644 index 000000000..5b9e36903 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/cattr_accessor.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[cattr_accessor :${0:attr_names}]]></content> + <tabTrigger>crw</tabTrigger> + <scope>source.ruby.rails</scope> + <description>cattr_accessor</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/def-create-resource.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/def-create-resource.sublime-snippet new file mode 100644 index 000000000..7be53e6ac --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/def-create-resource.sublime-snippet @@ -0,0 +1,20 @@ +<snippet> + <content><![CDATA[def create + @${1:model} = ${2:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}.new(params[:$1]) + $0 + respond_to do |wants| + if @$1.save + flash[:notice] = '$2 was successfully created.' + wants.html { redirect_to(@$1) } + wants.xml { render :xml => @$1, :status => :created, :location => @$1 } + else + wants.html { render :action => "new" } + wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } + end + end +end +]]></content> + <tabTrigger>defcreate</tabTrigger> + <scope>meta.controller.rails</scope> + <description>def create - resource</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/def-get-request.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/def-get-request.sublime-snippet new file mode 100644 index 000000000..80d6cd6f8 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/def-get-request.sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <content><![CDATA[def test_should_get_${1:action} + ${2:@${3:model} = ${4:$3s}(:${5:fixture_name}) + }get :${1}${6:, :id => @$3.to_param} + assert_response :success + $0 +end]]></content> + <tabTrigger>deftg</tabTrigger> + <scope>meta.functional_test.rails</scope> + <description>def test_should_get_action</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/def-post-request.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/def-post-request.sublime-snippet new file mode 100644 index 000000000..2691053df --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/def-post-request.sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <content><![CDATA[def test_should_post_${1:action} + ${3:@$2 = ${4:$2s}(:${5:fixture_name}) + }post :${1}${6:, :id => @$2.to_param}, :${2:model} => { $0 } + assert_response :redirect + +end]]></content> + <tabTrigger>deftp</tabTrigger> + <scope>meta.functional_test.rails</scope> + <description>def test_should_post_action</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/end.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/end.sublime-snippet new file mode 100644 index 000000000..4d2220057 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/end.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[<% end -%>]]></content> + <tabTrigger>end</tabTrigger> + <scope>text.html.ruby</scope> + <description>end (ERB)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/find(id).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/find(id).sublime-snippet new file mode 100644 index 000000000..e7dc8dac5 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/find(id).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[find(${1:id})]]></content> + <tabTrigger>fini</tabTrigger> + <scope>source.ruby.rails</scope> + <description>find(id)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/for-loop-erb.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/for-loop-erb.sublime-snippet new file mode 100644 index 000000000..3ba325c4e --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/for-loop-erb.sublime-snippet @@ -0,0 +1,13 @@ +<snippet> + <content><![CDATA[<% if !${1:list}.blank? %> + <% for ${2:item} in ${1} %> + $3 + <% end %> +<% else %> + $4 +<% end %> +]]></content> + <tabTrigger>for</tabTrigger> + <scope>text.html.ruby</scope> + <description>for loop in rhtml</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-check_box.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-check_box.sublime-snippet new file mode 100644 index 000000000..1d55bf45d --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-check_box.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.check_box :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>ffcb</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for check_box</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-checkbox.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-checkbox.sublime-snippet new file mode 100644 index 000000000..235070dea --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-checkbox.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.check_box :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>f.</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>f.check_box (ffcb)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-file_field-2.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-file_field-2.sublime-snippet new file mode 100644 index 000000000..062905f36 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-file_field-2.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.file_field :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>ffff</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for file_field</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-file_field.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-file_field.sublime-snippet new file mode 100644 index 000000000..109ca482b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-file_field.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.file_field :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>f.</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>f.file_field (ffff)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-hidden_field-2.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-hidden_field-2.sublime-snippet new file mode 100644 index 000000000..ee1b8171e --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-hidden_field-2.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.hidden_field :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>ffhf</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for hidden_field</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-hidden_field.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-hidden_field.sublime-snippet new file mode 100644 index 000000000..241d63548 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-hidden_field.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.hidden_field :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>f.</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>f.hidden_field (ffhf)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-label-2.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-label-2.sublime-snippet new file mode 100644 index 000000000..d4ce09c90 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-label-2.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>ffl</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for label</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-label.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-label.sublime-snippet new file mode 100644 index 000000000..8043d9a5d --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-label.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>f.</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>f.label (ffl)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-password_field-2.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-password_field-2.sublime-snippet new file mode 100644 index 000000000..20b60d607 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-password_field-2.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.password_field :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>ffpf</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for password_field</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-password_field.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-password_field.sublime-snippet new file mode 100644 index 000000000..1155ca19c --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-password_field.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.password_field :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>f.</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>f.password_field (ffpf)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-radio_box-2.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-radio_box-2.sublime-snippet new file mode 100644 index 000000000..feb7e2e8c --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-radio_box-2.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.radio_box :${1:attribute}, :${2:tag_value}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>ffrb</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for radio_box</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-radio_box.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-radio_box.sublime-snippet new file mode 100644 index 000000000..82c490bfe --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-radio_box.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.radio_box :${1:attribute}, :${2:tag_value}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>f.</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>f.radio_box (ffrb)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-submit-2.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-submit-2.sublime-snippet new file mode 100644 index 000000000..0d068a7ef --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-submit-2.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>ffs</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for submit</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-submit.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-submit.sublime-snippet new file mode 100644 index 000000000..e6bcb13d9 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-submit.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>f.</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>f.submit (ffs)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-text_area-2.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-text_area-2.sublime-snippet new file mode 100644 index 000000000..c7b2c7d92 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-text_area-2.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.text_area :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>ffta</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for text_area</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-text_area.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-text_area.sublime-snippet new file mode 100644 index 000000000..3f7dbead7 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-text_area.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.text_area :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>f.</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>f.text_area (ffta)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-text_field-2.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-text_field-2.sublime-snippet new file mode 100644 index 000000000..0913a20c2 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-text_field-2.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.text_field :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>fftf</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for text_field</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-text_field.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-text_field.sublime-snippet new file mode 100644 index 000000000..5daa41274 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-text_field.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.text_field :${1:attribute}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>f.</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>f.text_field (fftf)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for-with-errors.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for-with-errors.sublime-snippet new file mode 100644 index 000000000..09dfbff05 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for-with-errors.sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}error_messages_for :${1:model}${TM_RAILS_TEMPLATE_END_RUBY_EXPR} + +${TM_RAILS_TEMPLATE_START_RUBY_INLINE}form_for @${2:$1} do |f|${TM_RAILS_TEMPLATE_END_RUBY_INLINE} + $0 +${TM_RAILS_TEMPLATE_END_RUBY_BLOCK}]]></content> + <tabTrigger>ffe</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for with errors</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/form_for.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/form_for.sublime-snippet new file mode 100644 index 000000000..ce4534840 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/form_for.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_INLINE}form_for @${1:model} do |f|${TM_RAILS_TEMPLATE_END_RUBY_INLINE} + $0 +${TM_RAILS_TEMPLATE_END_RUBY_BLOCK}]]></content> + <tabTrigger>ff</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>form_for</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/has_and_belongs_to_many-(habtm).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/has_and_belongs_to_many-(habtm).sublime-snippet new file mode 100644 index 000000000..a2d3442e5 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/has_and_belongs_to_many-(habtm).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[has_and_belongs_to_many :${1:object}${2:, :join_table => "${3:table_name}", :foreign_key => "${4:${1}_id}"}]]></content> + <tabTrigger>habtm</tabTrigger> + <scope>source.ruby.rails</scope> + <description>has_and_belongs_to_many</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/has_many-(hm).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/has_many-(hm).sublime-snippet new file mode 100644 index 000000000..be1433f04 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/has_many-(hm).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[has_many :${1:object}s${2:, :class_name => "${1}", :foreign_key => "${4:reference}_id"}]]></content> + <tabTrigger>hm</tabTrigger> + <scope>source.ruby.rails</scope> + <description>has_many</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/has_many-(through).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/has_many-(through).sublime-snippet new file mode 100644 index 000000000..a92e51ba9 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/has_many-(through).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[has_many :${1:objects}, :through => :${2:join_association}${3:, :source => :${4:${2}_table_foreign_key_to_${1}_table}}]]></content> + <tabTrigger>hmt</tabTrigger> + <scope>source.ruby.rails</scope> + <description>has_many (through)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/has_many-dependent-=-destroy.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/has_many-dependent-=-destroy.sublime-snippet new file mode 100644 index 000000000..9d52d6294 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/has_many-dependent-=-destroy.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[has_many :${1:object}s${2:, :class_name => "${1}", :foreign_key => "${4:reference}_id"}, :dependent => :destroy$0]]></content> + <tabTrigger>hmd</tabTrigger> + <scope>source.ruby.rails</scope> + <description>has_many :dependent => :destroy</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/has_one-(ho).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/has_one-(ho).sublime-snippet new file mode 100644 index 000000000..d34db6c67 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/has_one-(ho).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[has_one :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:${1}_id}"}]]></content> + <tabTrigger>ho</tabTrigger> + <scope>source.ruby.rails</scope> + <description>has_one</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/image_submit_tag.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/image_submit_tag.sublime-snippet new file mode 100644 index 000000000..95b920dcc --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/image_submit_tag.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}image_submit_tag("${1:agree.png}"${2:${3:, :id => "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, :name => "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, :class => "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, :disabled => ${10:false}}})${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>ist</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>image_submit_tag</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/javascript_include_tag.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/javascript_include_tag.sublime-snippet new file mode 100644 index 000000000..d7b48b337 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/javascript_include_tag.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}javascript_include_tag ${1::all}${2:, :cache => ${3:true}}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>jit</tabTrigger> + <scope>text.html.ruby</scope> + <description>javascript_include_tag</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/lia.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/lia.sublime-snippet new file mode 100644 index 000000000..7824f14dc --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/lia.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to "${1:link text...}", :action => "${2:index}"${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>lia</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to (action)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/liai.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/liai.sublime-snippet new file mode 100644 index 000000000..9ab490d5c --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/liai.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to "${1:link text...}", :action => "${2:edit}", :id => ${3:@item}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>liai</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to (action, id)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/lic.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/lic.sublime-snippet new file mode 100644 index 000000000..16c46d0c3 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/lic.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to "${1:link text...}", :controller => "${2:items}"${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>lic</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to (controller)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/lica.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/lica.sublime-snippet new file mode 100644 index 000000000..db74755fd --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/lica.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:index}"${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>lica</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to (controller, action)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/licai.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/licai.sublime-snippet new file mode 100644 index 000000000..54e5f3d71 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/licai.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:edit}", :id => ${4:@item}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>licai</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to (controller, action, id)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/link_to-(nested-path).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/link_to-(nested-path).sublime-snippet new file mode 100644 index 000000000..ec660ff9c --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/link_to-(nested-path).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to ${1:"${2:link text...}"}, ${3:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>linp</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to (nested path)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/link_to-(nested-path-plural).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/link_to-(nested-path-plural).sublime-snippet new file mode 100644 index 000000000..1e3c79b82 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/link_to-(nested-path-plural).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to ${1:"${2:link text...}"}, ${3:${10:parent}_${11:child}_path(${12:@}${13:${10}})}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>linpp</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to (nested path plural)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/link_to-(path).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/link_to-(path).sublime-snippet new file mode 100644 index 000000000..f39152833 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/link_to-(path).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to ${1:"${2:link text...}"}, ${3:${12:model}_path(${13:@}${14:${12}})}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>lip</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to (path)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/link_to-(path-plural).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/link_to-(path-plural).sublime-snippet new file mode 100644 index 000000000..9751a00a0 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/link_to-(path-plural).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to ${1:"${2:link text...}"}, ${3:${4:model}s_path}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>lipp</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to (path plural)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/link_to-model.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/link_to-model.sublime-snippet new file mode 100644 index 000000000..cb5a4c63e --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/link_to-model.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}link_to ${1:model}.${2:name}, ${3:${4:$1}_path(${14:$1})}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>lim</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>link_to model</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/logger_debug.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/logger_debug.sublime-snippet new file mode 100644 index 000000000..39d2f561e --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/logger_debug.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[logger.debug { "${1:message}" }$0]]></content> + <tabTrigger>logd</tabTrigger> + <scope>source.ruby.rails</scope> + <description>logger.debug</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/logger_error.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/logger_error.sublime-snippet new file mode 100644 index 000000000..dc03d9c54 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/logger_error.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[logger.error { "${1:message}" }$0]]></content> + <tabTrigger>loge</tabTrigger> + <scope>source.ruby.rails</scope> + <description>logger.error</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/logger_fatal.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/logger_fatal.sublime-snippet new file mode 100644 index 000000000..d7eacb6e9 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/logger_fatal.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[logger.fatal { "${1:message}" }$0]]></content> + <tabTrigger>logf</tabTrigger> + <scope>source.ruby.rails</scope> + <description>logger.fatal</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/logger_info.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/logger_info.sublime-snippet new file mode 100644 index 000000000..6d2c6f789 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/logger_info.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[logger.info { "${1:message}" }$0]]></content> + <tabTrigger>logi</tabTrigger> + <scope>source.ruby.rails</scope> + <description>logger.info</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/logger_warn.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/logger_warn.sublime-snippet new file mode 100644 index 000000000..24755716c --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/logger_warn.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[logger.warn { "${1:message}" }$0]]></content> + <tabTrigger>logw</tabTrigger> + <scope>source.ruby.rails</scope> + <description>logger.warn</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/map(-%3Asym_proc).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/map(-%3Asym_proc).sublime-snippet new file mode 100644 index 000000000..549a5d166 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/map(-%3Asym_proc).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[map(&:${1:id})]]></content> + <tabTrigger>mp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>map(&:sym_proc)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/map_catch_all.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/map_catch_all.sublime-snippet new file mode 100644 index 000000000..d3b098c63 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/map_catch_all.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}" +]]></content> + <tabTrigger>mapca</tabTrigger> + <scope>meta.routes.rails</scope> + <description>map.catch_all</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/map_named_route.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/map_named_route.sublime-snippet new file mode 100644 index 000000000..a03864a14 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/map_named_route.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${1:map}.${2:connect} '${3::controller/:action/:id}']]></content> + <tabTrigger>map</tabTrigger> + <scope>meta.routes.rails</scope> + <description>map.named_route</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/map_resource.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/map_resource.sublime-snippet new file mode 100644 index 000000000..209dc0047 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/map_resource.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[${1:map}.resource :${2:resource}${10: do |${11:$2}| + $0 +end}]]></content> + <tabTrigger>mapr</tabTrigger> + <scope>meta.routes.rails</scope> + <description>map.resource</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/map_resources.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/map_resources.sublime-snippet new file mode 100644 index 000000000..e6e7fb8c8 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/map_resources.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[${1:map}.resources :${2:resource}${10: do |${11:$2}| + $0 +end}]]></content> + <tabTrigger>maprs</tabTrigger> + <scope>meta.routes.rails</scope> + <description>map.resources</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/map_with_options.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/map_with_options.sublime-snippet new file mode 100644 index 000000000..3f7cf52e9 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/map_with_options.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[${1:map}.with_options :${2:controller} => '${3:thing}' do |${4:$3}| + $0 +end +]]></content> + <tabTrigger>mapwo</tabTrigger> + <scope>meta.routes.rails</scope> + <description>map.with_options</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/mattr_accessor.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/mattr_accessor.sublime-snippet new file mode 100644 index 000000000..b2674cfc3 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/mattr_accessor.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[mattr_accessor :${0:attr_names}]]></content> + <tabTrigger>mrw</tabTrigger> + <scope>source.ruby.rails</scope> + <description>mattr_accessor</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/named_scope-lambda.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/named_scope-lambda.sublime-snippet new file mode 100644 index 000000000..a82b7cbf6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/named_scope-lambda.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[named_scope :name, lambda { |${1:param}| { :conditions => ${3:['${4:${5:field} = ?}', ${6:$1}]} } } +]]></content> + <tabTrigger>ncl</tabTrigger> + <scope>source.ruby.rails</scope> + <description>named_scope lambda</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/named_scope.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/named_scope.sublime-snippet new file mode 100644 index 000000000..feaa0a485 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/named_scope.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[named_scope :name${1:, :joins => :${2:table}}, :conditions => ${3:['${4:${5:field} = ?}', ${6:true}]} +]]></content> + <tabTrigger>nc</tabTrigger> + <scope>source.ruby.rails</scope> + <description>named_scope</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/rails-flash.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/rails-flash.sublime-snippet new file mode 100644 index 000000000..b2029e93d --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/rails-flash.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[flash[:${1:notice}] = "${2:Successfully created...}"$0]]></content> + <tabTrigger>flash</tabTrigger> + <scope>source.ruby.rails</scope> + <description>flash[…]</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/rea.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/rea.sublime-snippet new file mode 100644 index 000000000..b4a7a3ded --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/rea.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[redirect_to :action => "${1:index}"]]></content> + <tabTrigger>rea</tabTrigger> + <scope>source.ruby.rails</scope> + <description>redirect_to (action)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/reai.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/reai.sublime-snippet new file mode 100644 index 000000000..96c2c0cca --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/reai.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[redirect_to :action => "${1:show}", :id => ${0:@item}]]></content> + <tabTrigger>reai</tabTrigger> + <scope>source.ruby.rails</scope> + <description>redirect_to (action, id)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/rec.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/rec.sublime-snippet new file mode 100644 index 000000000..4db2b5219 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/rec.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[redirect_to :controller => "${1:items}"]]></content> + <tabTrigger>rec</tabTrigger> + <scope>source.ruby.rails</scope> + <description>redirect_to (controller)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/reca.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/reca.sublime-snippet new file mode 100644 index 000000000..f3a46ec80 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/reca.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[redirect_to :controller => "${1:items}", :action => "${2:list}"]]></content> + <tabTrigger>reca</tabTrigger> + <scope>source.ruby.rails</scope> + <description>redirect_to (controller, action)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/recai.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/recai.sublime-snippet new file mode 100644 index 000000000..972cb1b3f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/recai.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[redirect_to :controller => "${1:items}", :action => "${2:show}", :id => ${0:@item}]]></content> + <tabTrigger>recai</tabTrigger> + <scope>source.ruby.rails</scope> + <description>redirect_to (controller, action, id)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(nested-path).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(nested-path).sublime-snippet new file mode 100644 index 000000000..b612e4aa3 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(nested-path).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[redirect_to(${2:${12:parent}_${13:child}_path(${14:@}${15:${12}}, ${16:@}${17:${13}})})]]></content> + <tabTrigger>renp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>redirect_to (nested path)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(nested-path-plural).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(nested-path-plural).sublime-snippet new file mode 100644 index 000000000..9e660ca9f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(nested-path-plural).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[redirect_to(${2:${10:parent}_${11:child}_path(${12:@}${13:${10}})})]]></content> + <tabTrigger>renpp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>redirect_to (nested path plural)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(path).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(path).sublime-snippet new file mode 100644 index 000000000..baf24395e --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(path).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[redirect_to(${2:${12:model}_path(${13:@}${14:${12}})})]]></content> + <tabTrigger>rep</tabTrigger> + <scope>source.ruby.rails</scope> + <description>redirect_to (path)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(path-plural).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(path-plural).sublime-snippet new file mode 100644 index 000000000..f3554d2e5 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/redirect_to-(path-plural).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[redirect_to(${2:${10:model}s_path})]]></content> + <tabTrigger>repp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>redirect_to (path plural)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(action)...-(ra).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(action)...-(ra).sublime-snippet new file mode 100644 index 000000000..3510818dd --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(action)...-(ra).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :action => "${1:action}"]]></content> + <tabTrigger>ra</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (action)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(action-layout)-(ral).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(action-layout)-(ral).sublime-snippet new file mode 100644 index 000000000..f5174a5bb --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(action-layout)-(ral).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :action => "${1:action}", :layout => "${2:layoutname}"]]></content> + <tabTrigger>ral</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (action, layout)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(file)-(rf).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(file)-(rf).sublime-snippet new file mode 100644 index 000000000..10d331b5f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(file)-(rf).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :file => "${1:filepath}"]]></content> + <tabTrigger>rf</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (file)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(file-use_full_path)-(rfu).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(file-use_full_path)-(rfu).sublime-snippet new file mode 100644 index 000000000..170d3a775 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(file-use_full_path)-(rfu).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :file => "${1:filepath}", :use_full_path => ${2:false}]]></content> + <tabTrigger>rfu</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (file, use_full_path)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(inline)-(ri).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(inline)-(ri).sublime-snippet new file mode 100644 index 000000000..ab1045352 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(inline)-(ri).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :inline => "${1:<%= 'hello' %>}"]]></content> + <tabTrigger>ri</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (inline)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(inline-locals)-(ril).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(inline-locals)-(ril).sublime-snippet new file mode 100644 index 000000000..68545af3a --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(inline-locals)-(ril).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"$4 }]]></content> + <tabTrigger>ril</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (inline, locals)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(inline-type)-(rit).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(inline-type)-(rit).sublime-snippet new file mode 100644 index 000000000..38d5f22e5 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(inline-type)-(rit).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml}]]></content> + <tabTrigger>rit</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (inline, type)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(layout)-(rl).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(layout)-(rl).sublime-snippet new file mode 100644 index 000000000..f3623dccf --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(layout)-(rl).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :layout => "${1:layoutname}"]]></content> + <tabTrigger>rl</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (layout)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(nothing)-(rn).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(nothing)-(rn).sublime-snippet new file mode 100644 index 000000000..419beeb69 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(nothing)-(rn).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :nothing => ${1:true}]]></content> + <tabTrigger>rn</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (nothing)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(nothing-status)-(rns).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(nothing-status)-(rns).sublime-snippet new file mode 100644 index 000000000..33e43cdbb --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(nothing-status)-(rns).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :nothing => ${1:true}, :status => ${2:401}]]></content> + <tabTrigger>rns</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (nothing, status)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(partial)-(rp).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(partial)-(rp).sublime-snippet new file mode 100644 index 000000000..e58fcccb2 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(partial)-(rp).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render partial: '${1:item}']]></content> + <tabTrigger>rp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (partial)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(partial-collection)-(rpc).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(partial-collection)-(rpc).sublime-snippet new file mode 100644 index 000000000..edbb0acc4 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(partial-collection)-(rpc).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render partial: '${1:item}', collection: ${2:@$1s}]]></content> + <tabTrigger>rpc</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (partial, collection)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(partial-locals)-(rpl).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(partial-locals)-(rpl).sublime-snippet new file mode 100644 index 000000000..ccb0dc2e9 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(partial-locals)-(rpl).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render partial: '${1:item}', locals: { ${2:$1}: ${3:@$1}$0 }]]></content> + <tabTrigger>rpl</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (partial, locals)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(partial-object)-(rpo).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(partial-object)-(rpo).sublime-snippet new file mode 100644 index 000000000..d021462ac --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(partial-object)-(rpo).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render partial: '${1:item}', object: ${2:@$1}]]></content> + <tabTrigger>rpo</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (partial, object)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(partial-status)-(rps).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(partial-status)-(rps).sublime-snippet new file mode 100644 index 000000000..022e1502b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(partial-status)-(rps).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render partial: '${1:item}', status: ${2:500}]]></content> + <tabTrigger>rps</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (partial, status)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(text)-(rt).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(text)-(rt).sublime-snippet new file mode 100644 index 000000000..77ecbb971 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(text)-(rt).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :text => "${1:text to render...}"]]></content> + <tabTrigger>rt</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (text)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(text-layout)-(rtl).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(text-layout)-(rtl).sublime-snippet new file mode 100644 index 000000000..bc1265318 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(text-layout)-(rtl).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :text => "${1:text to render...}", :layout => "${2:layoutname}"]]></content> + <tabTrigger>rtl</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (text, layout)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(text-layout=%3Etrue)-(rtlt).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(text-layout=%3Etrue)-(rtlt).sublime-snippet new file mode 100644 index 000000000..555119d9b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(text-layout=%3Etrue)-(rtlt).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :text => "${1:text to render...}", :layout => ${2:true}]]></content> + <tabTrigger>rtlt</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (text, layout => true)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(text-status)-(rts).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(text-status)-(rts).sublime-snippet new file mode 100644 index 000000000..81c8d3b18 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(text-status)-(rts).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[render :text => "${1:text to render...}", :status => ${2:401}]]></content> + <tabTrigger>rts</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (text, status)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/render-(update).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/render-(update).sublime-snippet new file mode 100644 index 000000000..41ee7f0c8 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/render-(update).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[render :update do |${2:page}| + $2.$0 +end]]></content> + <tabTrigger>ru</tabTrigger> + <scope>source.ruby.rails</scope> + <description>render (update)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/respond_to.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/respond_to.sublime-snippet new file mode 100644 index 000000000..f97f16c33 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/respond_to.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[respond_to do |wants| + wants.${1:html}${2: { $0 \}} +end]]></content> + <tabTrigger>rest</tabTrigger> + <scope>meta.controller.rails</scope> + <description>respond_to</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/returning-do-%7Cvariable%7C-%E2%80%A6-end.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/returning-do-%7Cvariable%7C-%E2%80%A6-end.sublime-snippet new file mode 100644 index 000000000..8bd1be0d6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/returning-do-%7Cvariable%7C-%E2%80%A6-end.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[returning ${1:variable} do${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1: |)/}${2:v}${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/} + $0 +end]]></content> + <tabTrigger>returning</tabTrigger> + <scope>source.ruby.rails</scope> + <description>returning do |variable| … end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/stylesheet_link_tag.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/stylesheet_link_tag.sublime-snippet new file mode 100644 index 000000000..2f558492a --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/stylesheet_link_tag.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}stylesheet_link_tag {1::all}${2:, :cache => ${3:true}}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>slt</tabTrigger> + <scope>text.html.ruby</scope> + <description>stylesheet_link_tag</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/submit_tag.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/submit_tag.sublime-snippet new file mode 100644 index 000000000..c3c2f386b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/submit_tag.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${TM_RAILS_TEMPLATE_START_RUBY_EXPR}submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}]]></content> + <tabTrigger>st</tabTrigger> + <scope>text.html.ruby, text.haml</scope> + <description>submit_tag</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_binary-(tcbi).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_binary-(tcbi).sublime-snippet new file mode 100644 index 000000000..41b1eea4b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_binary-(tcbi).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.binary :${1:title}${2:, :limit => ${3:2}.megabytes} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.binary (tcbi)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_boolean-(tcb).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_boolean-(tcb).sublime-snippet new file mode 100644 index 000000000..13e0029a6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_boolean-(tcb).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.boolean :${1:title} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.boolean (tcb)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_date-(tcda).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_date-(tcda).sublime-snippet new file mode 100644 index 000000000..7842b53f0 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_date-(tcda).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.date :${1:title} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.date (tcda)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_datetime-(tcdt).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_datetime-(tcdt).sublime-snippet new file mode 100644 index 000000000..74ab9e73b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_datetime-(tcdt).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.datetime :${1:title} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.datetime (tcdt)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_decimal-(tcd).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_decimal-(tcd).sublime-snippet new file mode 100644 index 000000000..8d8b1e75f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_decimal-(tcd).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.decimal :${1:title}${2:${3:, :precision => ${4:10}}${5:, :scale => ${6:2}}} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.decimal (tcd)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_float-(tcf).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_float-(tcf).sublime-snippet new file mode 100644 index 000000000..5a7e9ceac --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_float-(tcf).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.float :${1:title} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.float (tcf)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_integer-(tci).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_integer-(tci).sublime-snippet new file mode 100644 index 000000000..85052631a --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_integer-(tci).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.integer :${1:title} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.integer (tci)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_lock_version-(tcl).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_lock_version-(tcl).sublime-snippet new file mode 100644 index 000000000..9953379df --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_lock_version-(tcl).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.integer :lock_version, :null => false, :default => 0 +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.lock_version (tcl)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_references-(tcr).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_references-(tcr).sublime-snippet new file mode 100644 index 000000000..a3d158b12 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_references-(tcr).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.references :${1:taggable}${2:, :polymorphic => ${3:{ :default => '${4:Photo}' \}}} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.references (tcr)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_rename-(tre).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_rename-(tre).sublime-snippet new file mode 100644 index 000000000..bd65db48f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_rename-(tre).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.rename(:${1:old_column_name}, :${2:new_column_name}) +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.rename (tre)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_string-(tcs).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_string-(tcs).sublime-snippet new file mode 100644 index 000000000..19f77f3e6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_string-(tcs).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.string :${1:title} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.string (tcs)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_text-(tct).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_text-(tct).sublime-snippet new file mode 100644 index 000000000..b5040d3c1 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_text-(tct).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.text :${1:title} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.text (tct)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_time-(tcti).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_time-(tcti).sublime-snippet new file mode 100644 index 000000000..f62952ba6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_time-(tcti).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.time :${1:title} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.time (tcti)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_timestamp-(tcts).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_timestamp-(tcts).sublime-snippet new file mode 100644 index 000000000..c91710a0e --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_timestamp-(tcts).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.timestamp :${1:title} +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.timestamp (tcts)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/t_timestamps-(tctss).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/t_timestamps-(tctss).sublime-snippet new file mode 100644 index 000000000..b140053a2 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/t_timestamps-(tctss).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[t.timestamps +t.$0]]></content> + <tabTrigger>t.</tabTrigger> + <scope>meta.migration.create_table.rails, meta.migration.change_table.rails</scope> + <description>t.timestamps (tctss)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_acceptance_of-if.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_acceptance_of-if.sublime-snippet new file mode 100644 index 000000000..aecfe434b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_acceptance_of-if.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_acceptance_of :${1:terms}${2:${3:, :accept => "${4:1}"}${5:, :message => "${6:You must accept the terms of service}"}}, :if => proc { |obj| ${7:obj.condition?} }}]]></content> + <tabTrigger>vaoif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_acceptance_of if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_acceptance_of.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_acceptance_of.sublime-snippet new file mode 100644 index 000000000..cd316614f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_acceptance_of.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_acceptance_of :${1:terms}${2:${3:, :accept => "${4:1}"}${5:, :message => "${6:You must accept the terms of service}"}}]]></content> + <tabTrigger>vao</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_acceptance_of</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_associated-(va).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_associated-(va).sublime-snippet new file mode 100644 index 000000000..a74c0a85f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_associated-(va).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_associated :${1:attribute}${2:, :on => :${3:create}}]]></content> + <tabTrigger>va</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_associated</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_associated-if-(vaif).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_associated-if-(vaif).sublime-snippet new file mode 100644 index 000000000..186bece54 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_associated-if-(vaif).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_associated :${1:attribute}${2:, :on => :${3:create}, :if => proc { |obj| ${5:obj.condition?} }}]]></content> + <tabTrigger>vaif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_associated if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_confirmation_of-(vc).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_confirmation_of-(vc).sublime-snippet new file mode 100644 index 000000000..3e0036901 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_confirmation_of-(vc).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_confirmation_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:should match confirmation}"}]]></content> + <tabTrigger>vc</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_confirmation_of</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_confirmation_of-if-(vcif).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_confirmation_of-if-(vcif).sublime-snippet new file mode 100644 index 000000000..df377a18a --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_confirmation_of-if-(vcif).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_confirmation_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:should match confirmation}", :if => proc { |obj| ${5:obj.condition?} }}]]></content> + <tabTrigger>vcif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_confirmation_of if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_exclusion_of-(ve).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_exclusion_of-(ve).sublime-snippet new file mode 100644 index 000000000..40f94815f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_exclusion_of-(ve).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_exclusion_of :${1:attribute}${2:, :in => ${3:%w( ${4:mov avi} )}, :on => :${5:create}, :message => "${6:extension %s is not allowed}"}]]></content> + <tabTrigger>ve</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_exclusion_of</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_exclusion_of-if-(veif).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_exclusion_of-if-(veif).sublime-snippet new file mode 100644 index 000000000..6b6f05d75 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_exclusion_of-if-(veif).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_exclusion_of :${1:attribute}${2:, :in => ${3:%w( ${4:mov avi} )}, :on => :${5:create}, :message => "${6:extension %s is not allowed}"}, :if => proc { |obj| ${7:obj.condition?} }}]]></content> + <tabTrigger>veif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_exclusion_of if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_format_of-if.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_format_of-if.sublime-snippet new file mode 100644 index 000000000..e5b4d3ded --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_format_of-if.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_format_of :${1:attribute}, :with => /${2:^[${3:\w\d}]+\$}/${4:, :on => :${5:create}, :message => "${6:is invalid}"}, :if => proc { |obj| ${7:obj.condition?} }}]]></content> + <tabTrigger>vfif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_format_of if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_format_of.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_format_of.sublime-snippet new file mode 100644 index 000000000..4b129f2bb --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_format_of.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_format_of :${1:attribute}, :with => /${2:^[${3:\w\d}]+\$}/${4:, :on => :${5:create}, :message => "${6:is invalid}"}]]></content> + <tabTrigger>vf</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_format_of</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_inclusion_of-if.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_inclusion_of-if.sublime-snippet new file mode 100644 index 000000000..38dc67789 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_inclusion_of-if.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_inclusion_of :${1:attribute}${2:, :in => ${3:%w( ${4:mov avi} )}, :on => :${5:create}, :message => "${6:extension %s is not included in the list}"}, :if => proc { |obj| ${7:obj.condition?} }}]]></content> + <tabTrigger>viif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_inclusion_of if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_inclusion_of.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_inclusion_of.sublime-snippet new file mode 100644 index 000000000..744716a2b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_inclusion_of.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_inclusion_of :${1:attribute}${2:, :in => ${3:%w( ${4:mov avi} )}, :on => :${5:create}, :message => "${6:extension %s is not included in the list}"}]]></content> + <tabTrigger>vi</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_inclusion_of</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_length_of-(vl).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_length_of-(vl).sublime-snippet new file mode 100644 index 000000000..ee094a526 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_length_of-(vl).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_length_of :${1:attribute}, :within => ${2:3..20}${3:, :on => :${4:create}, :message => "${5:must be present}"}]]></content> + <tabTrigger>vl</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_length_of</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_length_of-if.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_length_of-if.sublime-snippet new file mode 100644 index 000000000..e421f2eb6 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_length_of-if.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_length_of :${1:attribute}, :within => ${2:3..20}${3:, :on => :${4:create}, :message => "${5:must be present}"}, :if => proc { |obj| ${6:obj.condition?} }}]]></content> + <tabTrigger>vlif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_length_of if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_numericality_of-if.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_numericality_of-if.sublime-snippet new file mode 100644 index 000000000..44c80dd1b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_numericality_of-if.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_numericality_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:is not a number}"}, :if => proc { |obj| ${5:obj.condition?} }}]]></content> + <tabTrigger>vnif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_numericality_of if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_numericality_of.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_numericality_of.sublime-snippet new file mode 100644 index 000000000..7cefeee4f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_numericality_of.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_numericality_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:is not a number}"}]]></content> + <tabTrigger>vn</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_numericality_of</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_presence_of-(vp).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_presence_of-(vp).sublime-snippet new file mode 100644 index 000000000..58171da54 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_presence_of-(vp).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_presence_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:can't be blank}"}]]></content> + <tabTrigger>vp</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_presence_of</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_presence_of-if-(vpif)-2.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_presence_of-if-(vpif)-2.sublime-snippet new file mode 100644 index 000000000..50f382822 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_presence_of-if-(vpif)-2.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_presence_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:can't be blank}"}, :if => proc { |obj| ${5:obj.condition?} }}]]></content> + <tabTrigger>vpif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_presence_of if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_uniqueness_of-(vu).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_uniqueness_of-(vu).sublime-snippet new file mode 100644 index 000000000..531e7f822 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_uniqueness_of-(vu).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_uniqueness_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:must be unique}"}]]></content> + <tabTrigger>vu</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_uniqueness_of</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/validates_uniqueness_of-if-(vuif).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/validates_uniqueness_of-if-(vuif).sublime-snippet new file mode 100644 index 000000000..f95e71017 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/validates_uniqueness_of-if-(vuif).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[validates_uniqueness_of :${1:attribute}${2:, :on => :${3:create}, :message => "${4:must be unique}", :if => proc { |obj| ${6:obj.condition?} }}]]></content> + <tabTrigger>vuif</tabTrigger> + <scope>source.ruby.rails</scope> + <description>validates_uniqueness_of if</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/verify-(verify).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/verify-(verify).sublime-snippet new file mode 100644 index 000000000..33e1c3b23 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/verify-(verify).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[verify :only => [:$1], :method => :post, :render => {:status => 500, :text => "use HTTP-POST"} +]]></content> + <tabTrigger>verify</tabTrigger> + <scope>source.ruby.rails</scope> + <description>verify — render</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/verify-redirect-(verify).sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/verify-redirect-(verify).sublime-snippet new file mode 100644 index 000000000..fc3e22208 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/verify-redirect-(verify).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[verify :only => [:$1], :session => :user, :params => :id, :redirect_to => {:action => '${2:index}'} +]]></content> + <tabTrigger>verify</tabTrigger> + <scope>source.ruby.rails</scope> + <description>verify — redirect</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/wants_format.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/wants_format.sublime-snippet new file mode 100644 index 000000000..c0a4db84f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/wants_format.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[wants.${1:js|xml|html}${2: { $0 \}}]]></content> + <tabTrigger>wants</tabTrigger> + <scope>meta.controller.rails</scope> + <description>wants.format</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/xhr-delete.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/xhr-delete.sublime-snippet new file mode 100644 index 000000000..96ee3094b --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/xhr-delete.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[xhr :delete, :${1:destroy}, :id => ${2:1}$0]]></content> + <tabTrigger>xdelete</tabTrigger> + <scope>source.ruby.rails</scope> + <description>xhr delete</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/xhr-get.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/xhr-get.sublime-snippet new file mode 100644 index 000000000..a3e2ec5e2 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/xhr-get.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[xhr :get, :${1:show}${2:, :id => ${3:1}}$0]]></content> + <tabTrigger>xget</tabTrigger> + <scope>source.ruby.rails</scope> + <description>xhr get</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/xhr-post.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/xhr-post.sublime-snippet new file mode 100644 index 000000000..4e9929fac --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/xhr-post.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[xhr :post, :${1:create}, :${2:object} => { $3 }]]></content> + <tabTrigger>xpost</tabTrigger> + <scope>source.ruby.rails</scope> + <description>xhr post</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Snippets/xhr-put.sublime-snippet b/assets/syntaxes/Packages/Rails/Snippets/xhr-put.sublime-snippet new file mode 100644 index 000000000..357f52444 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Snippets/xhr-put.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { $4 }$0]]></content> + <tabTrigger>xput</tabTrigger> + <scope>source.ruby.rails</scope> + <description>xhr put</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rails/Template (ERB).tmPreferences b/assets/syntaxes/Packages/Rails/Template (ERB).tmPreferences new file mode 100644 index 000000000..49e7152bf --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Template (ERB).tmPreferences @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Template (ERB)</string> + <key>scope</key> + <string>text.html.ruby</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_START_RUBY_EXPR</string> + <key>value</key> + <string><![CDATA[<%= ]]></string> + </dict> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_END_RUBY_EXPR</string> + <key>value</key> + <string><![CDATA[ %>]]></string> + </dict> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_START_RUBY_INLINE</string> + <key>value</key> + <string><![CDATA[<% ]]></string> + </dict> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_END_RUBY_INLINE</string> + <key>value</key> + <string><![CDATA[ -%>]]></string> + </dict> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_END_RUBY_BLOCK</string> + <key>value</key> + <string><![CDATA[<% end -%>]]></string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Rails/Template (Haml).tmPreferences b/assets/syntaxes/Packages/Rails/Template (Haml).tmPreferences new file mode 100644 index 000000000..7ace1bc5f --- /dev/null +++ b/assets/syntaxes/Packages/Rails/Template (Haml).tmPreferences @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Template (Haml)</string> + <key>scope</key> + <string>text.haml</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_START_RUBY_EXPR</string> + <key>value</key> + <string>= </string> + </dict> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_END_RUBY_EXPR</string> + <key>value</key> + <string></string> + </dict> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_START_RUBY_INLINE</string> + <key>value</key> + <string>- </string> + </dict> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_END_RUBY_INLINE</string> + <key>value</key> + <string></string> + </dict> + <dict> + <key>name</key> + <string>TM_RAILS_TEMPLATE_END_RUBY_BLOCK</string> + <key>value</key> + <string></string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Rails/syntax_test_html_rails.html.erb b/assets/syntaxes/Packages/Rails/syntax_test_html_rails.html.erb new file mode 100644 index 000000000..7bac112b8 --- /dev/null +++ b/assets/syntaxes/Packages/Rails/syntax_test_html_rails.html.erb @@ -0,0 +1,30 @@ +# SYNTAX TEST "Packages/Rails/HTML (Rails).sublime-syntax" + +<p>Normal HTML</p> +# ^ text.html.ruby + +<%# ruby comment %> +# ^ comment.block punctuation.definition.comment + +<% if true # comment inside embedded %> +# <- punctuation.section.embedded +# ^ source.ruby.rails.embedded.html +# ^ punctuation.definition.comment + + <p>Normal HTML</p> +# ^ text.html.ruby +<% end %> +# ^ keyword.control + +<% if false -%><p>inline erb</p><% end -%> +# <- punctuation.section.embedded +# ^ constant.language +# ^^^ punctuation.section.embedded + +<p style="font-weight: <% if show_bold %>bold<% else %>normal<% end %>"> +# ^^^^^^^^^^^ support.type.property-name +# ^^ punctuation.section.embedded +# ^ keyword.control +# ^ keyword.control +# ^ keyword.control +</p> diff --git a/assets/syntaxes/Packages/Rails/syntax_test_rails.rb b/assets/syntaxes/Packages/Rails/syntax_test_rails.rb new file mode 100644 index 000000000..f601a0afd --- /dev/null +++ b/assets/syntaxes/Packages/Rails/syntax_test_rails.rb @@ -0,0 +1,35 @@ +# SYNTAX TEST "Packages/Rails/Ruby on Rails.sublime-syntax" + +class ApplicationController < ApplicationController +# <- keyword.control.class +# ^ entity.name.class +# ^ punctuation.separator +# ^ entity.other.inherited-class + before_filter :find_model +# ^ support.function.actionpack.rails + + before_action :require_login +# ^ support.function.actionpack.rails + + class_attribute :subject +# ^ support.function.activesupport.rails + + self.config = { after_filter: 1, after_filter?: 2, after_filter!: 3 } + # ^^^^^^^^^^^^^ constant.other.symbol.ruby + # ^^^^^^^^^^^^^^ constant.other.symbol.ruby + # ^^^^^^^^^^^^^^ constant.other.symbol.ruby + + def find_model + @model = User.find(params[:id]) if params[:id] + end +end + +class PictureFile < ApplicationRecord + after_commit :delete_picture_file_from_disk, on: :destroy +# ^ support.function.activerecord.rails + + after_destroy_commit :delete_picture_file_from_disk +# ^ support.function.activerecord.rails +end + +# <- source.ruby.rails diff --git a/assets/syntaxes/Packages/Regular Expressions/Comments.tmPreferences b/assets/syntaxes/Packages/Regular Expressions/Comments.tmPreferences new file mode 100644 index 000000000..2891c8824 --- /dev/null +++ b/assets/syntaxes/Packages/Regular Expressions/Comments.tmPreferences @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>source.regexp</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string>(?# </string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_END</string> + <key>value</key> + <string>)</string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Regular Expressions/RegExp.sublime-syntax b/assets/syntaxes/Packages/Regular Expressions/RegExp.sublime-syntax new file mode 100644 index 000000000..32afcf0bf --- /dev/null +++ b/assets/syntaxes/Packages/Regular Expressions/RegExp.sublime-syntax @@ -0,0 +1,349 @@ +%YAML 1.2 +--- +name: Regular Expression +comment: Matches PCRE's regexp syntax, used in various languages and in + Sublime Text for the Find panels +file_extensions: + - re +scope: source.regexp +variables: + known_char_escape: '\\(?:[tnrfae]|[0-7]{3}|x\{\h{1,7}\}|x\h\h|c\d+)' + invalid_char_escape: '\\[xcCM]' + char_escape: '\\.' + ranged_quantifier: '\{\d+(,\d*)?\}' + lazy_or_possessive: '[?+]?' + character_quantifier: '[?*+]' + char_class: '\\(?:[wWsSdDhHvVXR]|[pP](?:\{[a-zA-Z_]+\}|(L&|[A-Z][a-z]?)))' + +contexts: + main: + - include: unexpected-quantifier + - match: '' + push: base-literal + + # This is the default context + base-literal: + - include: base + - include: literal + + # This is the extended context + # + # The "-extended" prefixed contexts are necessary + # to keep the extended mode enabled in subgroups + # and disable it properly when it is unset (and in sets). + # Switching happens in the "group-start*" contexts. + base-literal-extended: + - include: base-extended + - include: literal + + base: + - include: group + - include: base-common + + base-extended: + - include: group-extended + - include: extended-patterns # <- this is where the contexts differ + - include: base-common + + base-common: + - include: character-class + - include: special-escaped-char + - include: backslashes + - include: escaped-char + - include: charset + - include: operators + + base-group: + - match: '(?=\))' + pop: true + - include: base-literal + + base-group-extended: + - match: '(?=\))' + pop: true + - include: base-literal-extended + + extended-patterns: + - match: '#' + scope: punctuation.definition.comment.regexp + push: + - meta_scope: comment.line.number-sign.regexp + - match: \n # does not close on `)`! + pop: true + - match: \s+ + scope: meta.ignored-whitespace.regexp + + group-comment: + - match: \(\?# + scope: punctuation.definition.comment.begin.regexp + push: + - meta_scope: meta.group.regexp comment.block.group.regexp + - match: \) + scope: punctuation.definition.comment.end.regexp + pop: true + + backtracking-control-verb: + - match: '\(\*(PRUNE|SKIP|THEN|COMMIT|FAIL|F|ACCEPT)\)' + scope: keyword.control.verb.regexp + + group: + - include: group-comment + - include: backtracking-control-verb + - match: \( + scope: keyword.control.group.regexp + push: group-start + + group-extended: + - include: group-comment + - include: backtracking-control-verb + - match: \( + scope: keyword.control.group.regexp + push: group-start-extended + + group-start-common: + # Other modifiers (must come after other modifier matches) + - match: '(\?(?:[ixms]*-)?[ixms]+)(\))' + captures: + 1: storage.modifier.mode.regexp + 2: keyword.control.group.regexp + pop: true + - match: '(\?([+-]?\d+))(\))' + captures: + 1: keyword.other.backref-and-recursion.regexp + 2: variable.other.backref-and-recursion.regexp + 3: keyword.control.group.regexp + pop: true + - match: '(\?&([\w-]+))(\))' + captures: + 1: keyword.other.backref-and-recursion.regexp + 2: variable.other.backref-and-recursion.regexp + 3: keyword.control.group.regexp + pop: true + + group-start: + - meta_scope: meta.group.regexp + - match: '\?(<[=!]|>|=|:|!)' + scope: constant.other.assertion.regexp + set: [group-body, unexpected-quantifier-pop] + # Activates 'x' mode + - match: '(\?[ims]*x[ixms]*(?:-[ims]+)?)(\))' + captures: + 1: storage.modifier.mode.regexp + 2: keyword.control.group.regexp + set: [base-group-extended, unexpected-quantifier-pop] + # Groups with 'x' mode + - match: '\?[ims]*x[ixms]*(?:-[ims]+)?:' + scope: storage.modifier.mode.regexp + set: [group-body-extended, unexpected-quantifier-pop] + # Other modifiers + - match: '\?(?:[ixms]*-)?[ixms]+:' + scope: storage.modifier.mode.regexp + set: [group-body, unexpected-quantifier-pop] + - match: \?(?:(<)([^>]+)(>)|(')([^']+)(')) + scope: keyword.other.named-capture-group.regexp + captures: + 1: punctuation.definition.capture-group-name.begin.regexp + 2: entity.name.capture-group.regexp + 3: punctuation.definition.capture-group-name.end.regexp + 4: punctuation.definition.capture-group-name.begin.regexp + 5: entity.name.capture-group.regexp + 6: punctuation.definition.capture-group-name.end.regexp + set: [group-body, unexpected-quantifier-pop] + - match: \?\((?:(<)([^>]+)(>)|(')([^']+)(')|(\d+)|R(\d*)|R&(\w+))\) + scope: keyword.other.backref-and-recursion.conditional.regexp + captures: + 1: punctuation.definition.capture-group-name.begin.regexp + 2: variable.other.backref-and-recursion.regexp + 3: punctuation.definition.capture-group-name.end.regexp + 4: punctuation.definition.capture-group-name.begin.regexp + 5: variable.other.backref-and-recursion.regexp + 6: punctuation.definition.capture-group-name.end.regexp + 7: variable.other.backref-and-recursion.regexp + 8: variable.other.backref-and-recursion.regexp + 9: variable.other.backref-and-recursion.regexp + set: [group-body, unexpected-quantifier-pop] + - match: '\?\(DEFINE\)' + scope: keyword.other.conditional.definition.regexp + set: [group-body, unexpected-quantifier-pop] + - match: '\?(?=\(\?)' + scope: keyword.other.conditional.regexp + set: [group-body, base-group] + - include: group-start-common + - match: '' + set: [group-body, unexpected-quantifier-pop] + + group-start-extended: + - meta_scope: meta.group.extended.regexp + - match: '\?(<[=!]|>|=|:|!)' + scope: constant.other.assertion.regexp + set: [group-body-extended, unexpected-quantifier-pop] + # Deactivates 'x' mode + - match: '(\?[ims]*-[ims]*x[imxs]*)(\))' + captures: + 1: storage.modifier.mode.regexp + 2: keyword.control.group.regexp + set: [base-group, unexpected-quantifier-pop] + # Groups without 'x' mode + - match: '\?[ims]*-[ims]*x[imxs]*:' + scope: storage.modifier.mode.regexp + set: [group-body, unexpected-quantifier-pop] + # Other modifiers + - match: '\?(?:[ixms]*-)?[ims]+:' + scope: storage.modifier.mode.regexp + set: [group-body-extended, unexpected-quantifier-pop] + - match: \?(?:(<)([^>]+)(>)|(')([^']+)(')) + scope: keyword.other.named-capture-group.regexp + captures: + 1: punctuation.definition.capture-group-name.begin.regexp + 2: entity.name.capture-group.regexp + 3: punctuation.definition.capture-group-name.end.regexp + 4: punctuation.definition.capture-group-name.begin.regexp + 5: entity.name.capture-group.regexp + 6: punctuation.definition.capture-group-name.end.regexp + set: [group-body-extended, unexpected-quantifier-pop] + - match: \?\((?:(<)([^>]+)(>)|(')([^']+)(')|(\d+)|R(\d*)|R&(\w+))\) + scope: keyword.other.backref-and-recursion.conditional.regexp + captures: + 1: punctuation.definition.capture-group-name.begin.regexp + 2: variable.other.backref-and-recursion.regexp + 3: punctuation.definition.capture-group-name.end.regexp + 4: punctuation.definition.capture-group-name.begin.regexp + 5: variable.other.backref-and-recursion.regexp + 6: punctuation.definition.capture-group-name.end.regexp + 7: variable.other.backref-and-recursion.regexp + 8: variable.other.backref-and-recursion.regexp + 9: variable.other.backref-and-recursion.regexp + set: [group-body-extended, unexpected-quantifier-pop] + - match: '\?\(DEFINE\)' + scope: keyword.other.conditional.definition.regexp + set: [group-body-extended, unexpected-quantifier-pop] + - match: '\?(?=\(\?)' + scope: keyword.other.conditional.regexp + set: [group-body-extended, base-group-extended] + - include: group-start-common + - match: '' + set: [group-body-extended, unexpected-quantifier-pop] + + group-body: + - meta_content_scope: meta.group.regexp + - match: \) + scope: meta.group.regexp keyword.control.group.regexp + pop: true + - include: base-group + + group-body-extended: + - meta_content_scope: meta.group.extended.regexp + - match: \) + scope: meta.group.extended.regexp keyword.control.group.regexp + pop: true + - include: base-group-extended + + charset: + - match: '(\[\^?)]?' + captures: + 1: keyword.control.set.regexp + push: + - meta_scope: meta.set.regexp + - match: ':(ascii|alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit):' + scope: constant.other.posix-class.regexp + - match: '\]' + scope: keyword.control.set.regexp + pop: true + - match: '(?=({{known_char_escape}}|{{char_escape}}|(?!\\-)[^\]])-({{known_char_escape}}|{{char_escape}}|[^\]]))' + push: + - meta_content_scope: constant.other.range.regexp + - include: special-escaped-char + - include: escaped-char + - match: '(?=-)' + set: + - meta_scope: constant.other.range.regexp + - match: '-' + - match: '{{known_char_escape}}' + scope: constant.character.escape.regexp + pop: true + - match: '{{invalid_char_escape}}' + scope: invalid.illegal.character.escape.regexp + pop: true + - match: '{{char_escape}}' + scope: constant.character.escape.regexp + pop: true + - match: '.' + pop: true + - include: character-class + - include: special-escaped-char + - include: escaped-char + - include: charset + - match: '&&' + scope: keyword.operator.intersection.regexp + + character-class: + - match: '{{char_class}}' + scope: keyword.control.character-class.regexp + + special-escaped-char: + - match: '{{known_char_escape}}' + scope: constant.character.escape.regexp + - match: '{{invalid_char_escape}}' + scope: invalid.illegal.character.escape.regexp + + escaped-char: + - match: '{{char_escape}}' + scope: constant.character.escape.regexp + + backslashes: + - match: '\\[bBAZzG><]|[\^$]' + scope: keyword.control.anchors.regexp + push: unexpected-quantifier-pop + - match: '\\[QEK]' + scope: keyword.control.regexp + push: unexpected-quantifier-pop + - match: \\[kg](?:(<)([^>]+)(>)|(')([^']+)(')|(\{)([^}]+)(\})|(-?\d+)) + scope: keyword.other.backref-and-recursion.regexp + captures: + 1: punctuation.definition.capture-group-name.begin.regexp + 2: variable.other.backref-and-recursion.regexp + 3: punctuation.definition.capture-group-name.end.regexp + 4: punctuation.definition.capture-group-name.begin.regexp + 5: variable.other.backref-and-recursion.regexp + 6: punctuation.definition.capture-group-name.end.regexp + 7: punctuation.definition.capture-group-name.begin.regexp + 8: variable.other.backref-and-recursion.regexp + 9: punctuation.definition.capture-group-name.end.regexp + 10: variable.other.backref-and-recursion.regexp + - match: \\([1-9]\d*) + scope: keyword.other.backref-and-recursion.regexp + captures: + 1: variable.other.backref-and-recursion.regexp + + quantifiers: + - match: '{{ranged_quantifier}}{{lazy_or_possessive}}' + scope: keyword.operator.quantifier.regexp + push: unexpected-quantifier-pop + - match: '{{character_quantifier}}{{lazy_or_possessive}}' + scope: keyword.operator.quantifier.regexp + push: unexpected-quantifier-pop + + unexpected-quantifier: + - match: '{{ranged_quantifier}}{{lazy_or_possessive}}' + scope: invalid.illegal.unexpected-quantifier.regexp + - match: '{{character_quantifier}}{{lazy_or_possessive}}' + scope: invalid.illegal.unexpected-quantifier.regexp + + unexpected-quantifier-pop: + - include: unexpected-quantifier + - match: '' + pop: true + + operators: + - match: \| + scope: keyword.operator.alternation.regexp + push: unexpected-quantifier-pop + + literal: + - include: quantifiers + - match: '\.' + scope: keyword.other.any.regexp # https://github.com/sublimehq/Packages/issues/314 + - match: \) + scope: invalid.illegal.unmatched-brace.regexp + - match: . + scope: meta.literal.regexp diff --git a/assets/syntaxes/Packages/Regular Expressions/syntax_test_regexp.re b/assets/syntaxes/Packages/Regular Expressions/syntax_test_regexp.re new file mode 100644 index 000000000..39e3d1b8e --- /dev/null +++ b/assets/syntaxes/Packages/Regular Expressions/syntax_test_regexp.re @@ -0,0 +1,602 @@ +# SYNTAX TEST "Packages/Regular Expressions/RegExp.sublime-syntax" + + +################### +## Anchors and escapes +################### + +^foo \bbar$ \<test\> +# <- keyword.control.anchors +# ^^ keyword.control.anchors +# ^ keyword.control.anchors +# ^^ keyword.control.anchors +# ^^ keyword.control.anchors + +\^foo \\bbar\$ + # <- constant.character.escape +# ^^ constant.character.escape +# ^ constant.character.escape + +\xg +# <- invalid.illegal.character.escape + +\010 +# <- constant.character.escape + +\1 +# <- keyword.other.backref-and-recursion +#^ variable.other.backref-and-recursion.regexp + +\x{0ab} +# <- constant.character.escape +#^^^^^^ constant.character.escape + +\W +# <- keyword.control.character-class + + +################### +## Quantifiers +################### + +\x00* +# <- constant.character.escape +#^^^ constant.character.escape +# ^ keyword.operator.quantifier + +(ab)+ +# ^ keyword.operator.quantifier + +(ab)? +# ^ keyword.operator.quantifier + +(ab)*? +# ^^ keyword.operator.quantifier + +(ab)*+ +# ^^ keyword.operator.quantifier + +(ab)+? +# ^^ keyword.operator.quantifier + +(ab)++ +# ^^ keyword.operator.quantifier + +(?abc) +#^ invalid.illegal.unexpected-quantifier.regexp - storage.modifier.mode.regexp +# ^^^ meta.literal.regexp - storage.modifier.mode.regexp + + .*? +#^ keyword.other.any.regexp - meta.literal.regexp +# ^^ keyword.operator.quantifier.regexp + +(?=.++\.??\|{2,3}|{2}) +#^^ constant.other.assertion.regexp +# ^ keyword.other.any.regexp - meta.literal.regexp +# ^^ keyword.operator.quantifier.regexp +# ^^ constant.character.escape.regexp +# ^^ keyword.operator.quantifier.regexp +# ^^ constant.character.escape.regexp +# ^^^^^ keyword.operator.quantifier.regexp +# ^^^ invalid.illegal.unexpected-quantifier.regexp - keyword.operator.quantifier.regexp + +\G{2} +# ^^^ invalid.illegal.unexpected-quantifier.regexp - keyword.operator.quantifier.regexp + +(?={2}) +# ^^^ invalid.illegal.unexpected-quantifier.regexp - keyword.operator.quantifier.regexp + +a{9} +#^^^ keyword.operator.quantifier.regexp + +a{1,9} +#^^^^^ keyword.operator.quantifier.regexp + +a{9,} +#^^^^ keyword.operator.quantifier.regexp + +a{,9} +#^^^^ - keyword.operator.quantifier.regexp + +a{,} +#^^^ - keyword.operator.quantifier.regexp + +a{} +#^^ - keyword.operator.quantifier.regexp + +|{1,2} +#^^^^^ invalid.illegal.unexpected-quantifier.regexp + +hello** +# ^ invalid.illegal.unexpected-quantifier.regexp +#<- meta.literal.regexp +#^^^^ meta.literal.regexp + +) +# <- invalid.illegal.unmatched-brace.regexp + +hello++ +# ^^ keyword.operator.quantifier.regexp - invalid.illegal.unexpected-quantifier.regexp + +(\w{2}?) +# ^^^^ keyword.operator.quantifier.regexp - invalid.illegal.unexpected-quantifier.regexp + +(\w{2}+) +# ^^^^ keyword.operator.quantifier.regexp - invalid.illegal.unexpected-quantifier.regexp + +(\w{2}?+) +# ^ invalid.illegal.unexpected-quantifier.regexp + +[\w{1}+] +# ^^^^ - invalid.illegal.unexpected-quantifier.regexp - keyword.operator.quantifier.regexp + + +################### +## Sets +################### + + [b-c] +#^^^^^ meta.set +#^ keyword.control.set +# ^ keyword.control.set +# ^^^ constant.other.range + +[\x00-\x{A}] +# <- keyword.control.set +# ^ keyword.control.set +#^^^^^^^^^^ constant.other.range +#^^^^ constant.character.escape +# ^^^^^ constant.character.escape + +[[a-z]&&[:ascii:]] +#^^^^^ meta.set meta.set +# ^^ keyword.operator.intersection +# ^^^ constant.other.range +# ^^^^^^^ constant.other.posix-class + +[^abc\w0-9] +# <- keyword.control.set +#^ keyword.control.set +# ^^ keyword.control.character-class + +[a-c-x] +#^^^ constant.other.range +# ^^ - constant.other.range + +[]-] +# ^ keyword.control.set +# ^ - constant.other.range + +[-a-n] +# ^ keyword.control.set +#^ - constant.other.range +# ^^^ constant.other.range + +[\-a] +#^^^ - constant.other.range +# ^ keyword.control.set + +[a-z\-9] +# ^^^ - constant.other.range +# ^ keyword.control.set + +[\--z] +#^^^^ constant.other.range +# ^ keyword.control.set + +[a-\z] +#^^^^ constant.other.range +# ^ keyword.control.set + +[a-\-] +#^^^^ constant.other.range +# ^ keyword.control.set + +(?:a|b|c) +#^^^^^^^^ meta.group +# <- keyword.control.group +#^^ constant.other.assertion +# ^ keyword.operator +# ^ keyword.control.group + + +################### +## Block comments +################### + +(?#foobar) +#^^^^^^^^^ meta.group comment.block.group +# <- comment.block.group punctuation.definition.comment.begin +#^^ punctuation.definition.comment.begin +# ^ punctuation.definition.comment.end + +( abc (?#foobar) ) +# ^^^^^^^^^^ meta.group meta.group comment.block.group + +(?# + +this is a multi line comment +where escape characters are ignored.\). +#<- comment.block.group +# ^^ - constant.character.escape +# ^ punctuation.definition.comment.end.regexp +# ^ - comment.block.group.regexp + + +################### +## Group Modifiers & Extended Mode +################### + +(?x) +#^^ storage.modifier.mode.regexp +# ^ meta.ignored-whitespace + +# this is a comment +#^^^^^^^^^^^^^^^^^^^ comment.line.number-sign +# <- comment punctuation.definition.comment + (?-ix) +# <- meta.ignored-whitespace +# ^^^^ storage.modifier.mode.regexp + +# not a comment +# <- - comment + +( + (?x) + # comment +# ^^^^^^^^^ comment + (?-x) +) # no comment +# <- keyword.control.group +# ^ - comment + +(?sm-ixxs) +#^^^^^^^^ storage.modifier.mode.regexp + + (?i:hello) +#^^^^^^^^^^ meta.group.regexp +#^ keyword.control.group.regexp +# ^^^ storage.modifier.mode.regexp +# ^ - storage.modifier.mode.regexp +# ^ keyword.control.group.regexp + + (?i-s:hello) +#^^^^^^^^^^^^ meta.group.regexp +#^ keyword.control.group.regexp +# ^^^^^ storage.modifier.mode.regexp +# ^ - storage.modifier.mode.regexp +# ^ keyword.control.group.regexp + +# not a comment +^ - comment + +(?ix: +#^^^^ +# comment +#^^^^^^^^ comment.line.number-sign + + (# also a comment) +# ^^^^^^^^^^^^^^^^^ comment + ) + + (?s-x: # not a comment) +# ^ - comment + +) +# not a comment +^ - comment + +(?x:[ ] ) +# ^ - meta.ignored-whitespace.regexp +# ^ meta.ignored-whitespace.regexp + + +################### +## References +################### + +(?<named_group>test) +#^^^^^^^^^^^^^^ keyword.other.named-capture-group.regexp +# ^^^^^^^^^^^ entity.name.capture-group.regexp +# ^^^^ meta.literal.regexp - keyword.other.named-capture-group.regexp + + \g{1} +#^^^^^ keyword.other.backref-and-recursion.regexp - keyword.operator.quantifier.regexp +# ^ variable.other.backref-and-recursion.regexp + + \g1 +#^^^ keyword.other.backref-and-recursion.regexp +# ^ variable.other.backref-and-recursion.regexp + + \g{named_group} +#^^^^^^^^^^^^^^^ keyword.other.backref-and-recursion.regexp +# ^^^^^^^^^^^ variable.other.backref-and-recursion.regexp + + \g'named_group' +#^^^^^^^^^^^^^^^ keyword.other.backref-and-recursion.regexp +# ^^^^^^^^^^^ variable.other.backref-and-recursion.regexp + + \g<named_group> +#^^^^^^^^^^^^^^^ keyword.other.backref-and-recursion.regexp +# ^^^^^^^^^^^ variable.other.backref-and-recursion.regexp + +(?1) +#^^ keyword.other.backref-and-recursion.regexp +# ^ variable.other.backref-and-recursion.regexp + +(1) +#^ meta.literal.regexp - keyword - variable + +(?&named_group) +#^^^^^^^^^^^^^ keyword.other.backref-and-recursion.regexp +# ^^^^^^^^^^^ variable.other.backref-and-recursion.regexp + +(hello)(?-1)(?+1)(wow) relative capture groups are supported +# ^^^ keyword.other.backref-and-recursion.regexp +# ^^ variable.other.backref-and-recursion.regexp +# ^^^ keyword.other.backref-and-recursion.regexp +# ^^ variable.other.backref-and-recursion.regexp + +(hello)\g-1(wow) +# ^^^^ keyword.other.backref-and-recursion.regexp + +(?x)(hello)(?-1)(?+1)(wow) relative capture groups are supported(?-x) +# ^^^ keyword.other.backref-and-recursion.regexp +# ^^^ keyword.other.backref-and-recursion.regexp +# ^^ variable.other.backref-and-recursion.regexp +# ^^ variable.other.backref-and-recursion.regexp + +(?x)(?<named_group>test)(?&named_group)(?-x) +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.extended +# ^^^^^^^^^^^^^^ keyword.other.named-capture-group.regexp +# ^^^^^^^^^^^ entity.name.capture-group.regexp +# ^ punctuation.definition.capture-group-name.begin.regexp +# ^ punctuation.definition.capture-group-name.end.regexp +# ^^^^ meta.literal.regexp - keyword.other.named-capture-group.regexp +# ^^^^^^^^^^^^^ keyword.other.backref-and-recursion.regexp +# ^^^^^^^^^^^ variable.other.backref-and-recursion.regexp + +(?x)(?<named-group>test)(?&named-group)(?-x) +# ^ punctuation.definition.capture-group-name.begin.regexp +# ^ punctuation.definition.capture-group-name.end.regexp +# ^^^^^^^^^^^^^ keyword.other.backref-and-recursion.regexp + +(?'foo-t'a+)(b+)\g<foo-t> +#^^^^^^^^ keyword.other.named-capture-group.regexp +# ^ punctuation.definition.capture-group-name.begin.regexp +# ^ punctuation.definition.capture-group-name.end.regexp +# ^^^^^^^^^ keyword.other.backref-and-recursion.regexp +# ^ punctuation.definition.capture-group-name.begin.regexp +# ^ punctuation.definition.capture-group-name.end.regexp +# ^^^^^ variable.other.backref-and-recursion.regexp + +(?'&a+\'a)b\g'&a+\'(?x)(?'a- -'a)b\g{a- -}(?-x) +# ^^^^ entity.name.capture-group.regexp +# ^ punctuation.definition.capture-group-name.begin.regexp +# ^ punctuation.definition.capture-group-name.end.regexp +# ^ punctuation.definition.capture-group-name.begin.regexp +# ^^^^ variable.other.backref-and-recursion.regexp +# ^ punctuation.definition.capture-group-name.end.regexp +# ^^^^ entity.name.capture-group.regexp +# ^ meta.literal.regexp +# ^ punctuation.definition.capture-group-name.begin.regexp +# ^^^^ variable.other.backref-and-recursion.regexp +# ^ punctuation.definition.capture-group-name.end.regexp +# ^ keyword.control.group.regexp + +################### +## Assertions +################### + +(?![a-z]+?) +#^^ meta.group.regexp constant.other.assertion.regexp - meta.group.regexp meta.group.regexp +# ^^^^^ meta.set.regexp +# ^ keyword.control.set.regexp +# ^ keyword.control.set.regexp +# ^^^ constant.other.range.regexp +# ^^ keyword.operator.quantifier.regexp + +(?![abc].\g1(?m)$)[\g1] +#^^ constant.other.assertion.regexp +# ^ keyword.control.set.regexp +# ^ keyword.control.set.regexp +# ^^^ - meta.literal.regexp +# ^ keyword.other.any.regexp +# ^^^ keyword.other.backref-and-recursion.regexp +# ^ keyword.control.anchors.regexp +# ^^ meta.group.regexp meta.group.regexp storage.modifier.mode.regexp +# ^^ constant.character.escape.regexp +# ^^^ - keyword.other.backref-and-recursion.regexp + +(?<=blah) +#^^^ constant.other.assertion.regexp +(?<!\w+\(\)) +#^^^ constant.other.assertion.regexp +(?>\[\d+\]) +#^^ constant.other.assertion.regexp +# ^^ constant.character.escape.regexp - keyword.control.set.regexp +# ^^ keyword.control.character-class.regexp +# ^ keyword.operator.quantifier.regexp +# ^^ constant.character.escape.regexp - keyword.control.set.regexp + + +################### +## Conditionals +################### + +(?<test>a)?b(?('test')c|d) +# ^^^^^^^^^ keyword.other.backref-and-recursion.conditional.regexp +(?<test>a)?b(?(<test->)c|d) +# ^^^^^^^^^^ keyword.other.backref-and-recursion.conditional.regexp +# ^ punctuation.definition.capture-group-name.begin.regexp +# ^ punctuation.definition.capture-group-name.end.regexp +(a)?b(?(1)c|d) +# ^^^^ keyword.other.backref-and-recursion.conditional.regexp +(?(?!\d)a|b) +#^ keyword.other.conditional.regexp +# ^ keyword.control.group.regexp +# ^^ constant.other.assertion.regexp +# ^^ keyword.control.character-class.regexp +# ^ keyword.control.group.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(?=\d)\da|b) +#^ keyword.other.conditional.regexp +# ^ keyword.control.group.regexp +# ^^ constant.other.assertion.regexp +# ^^ keyword.control.character-class.regexp +# ^ keyword.control.group.regexp +# ^^ keyword.control.character-class.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(?<=\dc)a|b) +#^ keyword.other.conditional.regexp +# ^ keyword.control.group.regexp +# ^^^ constant.other.assertion.regexp +# ^^ keyword.control.character-class.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(R)a|b) +#^^^^ keyword.other.backref-and-recursion.conditional.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(R1)a|b) +#^^^^^ keyword.other.backref-and-recursion.conditional.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(R1)a|b) +#^^^^^ keyword.other.backref-and-recursion.conditional.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?<a>a)?b(?(R&a)c|d)(?1) +# ^^^^^^ keyword.other.backref-and-recursion.conditional.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(DEFINE)(?<a>abcd))(?&a) +#^^^^^^^^^ keyword.other.conditional.definition.regexp +# ^^^ keyword.other.backref-and-recursion.regexp + + + + +################### +## Conditionals in Extended Mode +################### + +(?x) +(?<test>a)?b(?('test')c|d) +# ^^^^^^^^^ keyword.other.backref-and-recursion.conditional.regexp +(?<test>a)?b(?(<test>)c|d) +# ^^^^^^^^^ keyword.other.backref-and-recursion.conditional.regexp +(a)?b(?(1)c|d) +# ^^^^ keyword.other.backref-and-recursion.conditional.regexp +(?(?!\d)a|b) +#^ keyword.other.conditional.regexp +# ^ keyword.control.group.regexp +# ^^ constant.other.assertion.regexp +# ^^ keyword.control.character-class.regexp +# ^ keyword.control.group.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(?=\d)\da|b) +#^ keyword.other.conditional.regexp +# ^ keyword.control.group.regexp +# ^^ constant.other.assertion.regexp +# ^^ keyword.control.character-class.regexp +# ^ keyword.control.group.regexp +# ^^ keyword.control.character-class.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(?<=\dc)a|b) +#^ keyword.other.conditional.regexp +# ^ keyword.control.group.regexp +# ^^^ constant.other.assertion.regexp +# ^^ keyword.control.character-class.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(R)a|b) +#^^^^ keyword.other.backref-and-recursion.conditional.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(R1)a|b) +#^^^^^ keyword.other.backref-and-recursion.conditional.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?<a>a)?b(?(R&a)c|d)(?1) +# ^^^^^^ keyword.other.backref-and-recursion.conditional.regexp +# ^ meta.literal.regexp +# ^ keyword.operator.alternation.regexp +# ^ meta.literal.regexp +# ^ keyword.control.group.regexp +(?(DEFINE)(?<a>abcd))(?&a) +#^^^^^^^^^ keyword.other.conditional.definition.regexp +# ^^^ keyword.other.backref-and-recursion.regexp +(?-x) + + +(?#http://www.boost.org/doc/libs/1_61_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html#boost_regex.syntax.perl_syntax.backtracking_control_verbs) + +'[^']*'(*SKIP)(*F)|" (?#http://stackoverflow.com/a/38638595/4473405) +# ^^^^^^^^^^^ keyword.control.verb.regexp + (*PRUNE) (*SKIP) (*THEN) (*COMMIT) (*FAIL) (*F) (*ACCEPT) +#^^^^^^^^ keyword.control.verb.regexp +# ^ meta.literal.regexp - keyword.control.verb.regexp +# ^^^^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^^^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^^^^^^ keyword.control.verb.regexp +(*FA) +#^ invalid.illegal.unexpected-quantifier.regexp +(?x) + (*PRUNE) (*SKIP) (*THEN) (*COMMIT) (*FAIL) (*F) (*ACCEPT) +#^^^^^^^^ keyword.control.verb.regexp +# ^ - meta.literal.regexp - keyword.control.verb.regexp +# ^^^^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^^^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^ keyword.control.verb.regexp +# ^ - keyword.control.verb.regexp +# ^^^^^^^^^ keyword.control.verb.regexp +(*FA) +#^ invalid.illegal.unexpected-quantifier.regexp +(?-x) diff --git a/assets/syntaxes/Packages/RestructuredText/Comments.tmPreferences b/assets/syntaxes/Packages/RestructuredText/Comments.tmPreferences new file mode 100644 index 000000000..5bd28d4e3 --- /dev/null +++ b/assets/syntaxes/Packages/RestructuredText/Comments.tmPreferences @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Miscellaneous</string> + <key>scope</key> + <string>text.restructuredtext</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string>.. </string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/RestructuredText/reStructuredText.sublime-syntax b/assets/syntaxes/Packages/RestructuredText/reStructuredText.sublime-syntax new file mode 100644 index 000000000..eed343134 --- /dev/null +++ b/assets/syntaxes/Packages/RestructuredText/reStructuredText.sublime-syntax @@ -0,0 +1,198 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: reStructuredText +comment: syntax highlighting for reStructuredText http://docutils.sourceforge.net, based on rst mode from jEdit +file_extensions: + - rst + - rest +scope: text.restructuredtext +contexts: + main: + - match: '^(?=(\s*)\S)' + push: + - meta_content_scope: meta.paragraph.restructuredtext + - match: ^(?!\1(?=\S)) + pop: true + - include: inline + inline: + - match: '^(\s*)((\.\.)\s+raw(::)) html' + comment: directives.html + captures: + 2: meta.directive.restructuredtext + 3: punctuation.definition.directive.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + push: + - match: '^(?!\1\s+)(?=\s*\S+)' + pop: true + - meta_content_scope: text.html.basic + - include: scope:text.html.basic + - match: '^(\s*)((\.\.)\s+[A-z][A-z0-9\-_]+(::))\s*' + comment: directives + captures: + 2: meta.other.directive.restructuredtext + 3: punctuation.definition.directive.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + push: + - match: '^(?!\1\s+)(?=\s*\S+)' + pop: true + - include: inline + - match: '^(\s*).*?((::))' + comment: verbatim blocks + captures: + 2: markup.raw.restructuredtext + 3: punctuation.definition.raw.restructuredtext + push: + - meta_scope: meta.raw.block.restructuredtext + - match: '^(?!\1\s+)(?=\s*\S+)' + pop: true + - match: .+ + scope: markup.raw.restructuredtext + - match: "::" + comment: directives + scope: meta.startraw.restructuredtext + - match: '(\*\*)[^*]+(\*\*)' + comment: strong emphasis + scope: markup.bold.restructuredtext + captures: + 1: punctuation.definition.italic.restructuredtext + 2: punctuation.definition.italic.restructuredtext + - match: '(\*)\w[^*]+\w(\*)' + comment: emphasis + scope: markup.italic.restructuredtext + captures: + 1: punctuation.definition.italic.restructuredtext + 2: punctuation.definition.italic.restructuredtext + - match: '(\.\.)\s+(_)([\w\s]+)(:)\s+(.*)' + comment: replacement + scope: meta.link.reference.def.restructuredtext + captures: + 1: punctuation.definition.link.restructuredtext + 2: punctuation.definition.string.restructuredtext + 3: string.other.link.title.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + 5: markup.underline.link.restructuredtext + - match: '(\|)[^|]+(\|_{0,2})' + comment: substitution + scope: markup.underline.substitution.restructuredtext + captures: + 1: punctuation.definition.substitution.restructuredtext + - match: \b(\w+)(_)\b + comment: links `...`_ or `...`__ + scope: meta.link.reference + captures: + 1: string.other.link.title.restructuredtext + 2: punctuation.definition.link.restructuredtext + - match: '(`)([\w\s]+)(`_)' + comment: links `...`_ or `...`__ + scope: meta.link.reference + captures: + 1: punctuation.definition.link.restructuredtext + 2: string.other.link.title.restructuredtext + 3: punctuation.definition.link.restructuredtext + - match: '(`)([\w\s]+)\s+(<)(.*?)(>)(`_)' + comment: links `...`_ + scope: meta.link.inline.restructuredtext + captures: + 1: punctuation.definition.link.restructuredtext + 2: string.other.link.title.restructuredtext + 3: punctuation.definition.location.restructuredtext + 4: markup.underline.link.restructuredtext + 5: punctuation.definition.location.restructuredtext + 6: punctuation.definition.link.restructuredtext + - match: '^(\.\.)\s+((\[)(((#?)[^]]*?)|\*)(\]))\s+(.*)' + comment: replacement + scope: meta.link.footnote.def.restructuredtext + captures: + 1: punctuation.definition.link.restructuredtext + 2: constant.other.footnote.link.restructuredtext + 3: punctuation.definition.constant.restructuredtext + 6: punctuation.definition.constant.restructuredtext + 7: punctuation.definition.constant.restructuredtext + 8: string.other.footnote.restructuredtext + - match: '((\[)[0-9]+(\]))(_)' + comment: "footnote reference: [0]_" + scope: meta.link.footnote.numeric.restructuredtext + captures: + 1: constant.other.footnote.link + 2: punctuation.definition.constant.restructuredtext + 3: punctuation.definition.constant.restructuredtext + 4: punctuation.definition.constant.restructuredtext + - match: '((\[#)[A-z0-9_]*(\]))(_)' + comment: "footnote reference [#]_ or [#foo]_" + scope: meta.link.footnote.auto.restructuredtext + captures: + 1: constant.other.footnote.link + 2: punctuation.definition.constant.restructuredtext + 3: punctuation.definition.constant.restructuredtext + 4: punctuation.definition.constant.restructuredtext + - match: '((\[)\*(\]))(_)' + comment: "footnote reference [*]_" + scope: meta.link.footnote.symbol.auto.restructuredtext + captures: + 1: constant.other.footnote.link.restructuredtext + 2: punctuation.definition.constant.restructuredtext + 3: punctuation.definition.constant.restructuredtext + 4: punctuation.definition.constant.restructuredtext + - match: '^(\.\.)\s+((\[)[A-z][A-z0-9]*(\]))(_)\s+(.*)' + comment: replacement + scope: meta.link.citation.def.restructuredtext + captures: + 1: punctuation.definition.link.restructuredtext + 2: constant.other.citation.link.restructuredtext + 3: punctuation.definition.constant.restructuredtext + 4: punctuation.definition.constant.restructuredtext + 5: punctuation.definition.constant.restructuredtext + 6: string.other.citation.restructuredtext + - match: '((\[)[A-z][A-z0-9_-]*(\]))(_)' + comment: citation reference + scope: meta.link.citation.restructuredtext + captures: + 1: constant.other.citation.link.restructuredtext + 2: punctuation.definition.constant.restructuredtext + 3: punctuation.definition.constant.restructuredtext + 4: punctuation.definition.constant.restructuredtext + - match: "``" + comment: inline literal + captures: + 0: punctuation.definition.raw.restructuredtext + push: + - meta_scope: markup.raw.restructuredtext + - match: "``" + captures: + 0: punctuation.definition.raw.restructuredtext + pop: true + - match: "(`)[^`]+(`)(?!_)" + comment: interpreted text + scope: markup.other.command.restructuredtext + captures: + 1: punctuation.definition.interpreted.restructuredtext + 2: punctuation.definition.interpreted.restructuredtext + - match: '(:)[A-z][A-z0-9 =\s\t_]*(:)' + comment: field list + scope: entity.name.tag.restructuredtext + captures: + 1: punctuation.definition.field.restructuredtext + 2: punctuation.definition.field.restructuredtext + - match: '\+-[+-]+' + comment: table + scope: markup.other.table.restructuredtext + captures: + 0: punctuation.definition.table.restructuredtext + - match: '\+=[+=]+' + comment: table + scope: markup.other.table.restructuredtext + captures: + 0: punctuation.definition.table.restructuredtext + - match: '(^(=|-|~|`|#|"|\^|\+|\*){3,}$){1,1}?' + scope: markup.heading.restructuredtext + captures: + 1: punctuation.definition.heading.restructuredtext + - match: ^(\s*)(\.\.) + comment: comment + captures: + 2: punctuation.definition.comment.restructuredtext + push: + - meta_scope: comment.line.double-dot.restructuredtext + - match: '^(?!\1\s+)(?=\s*\S+)' + pop: true diff --git a/assets/syntaxes/Packages/RestructuredText/syntax_test_restructuredtext.rst b/assets/syntaxes/Packages/RestructuredText/syntax_test_restructuredtext.rst new file mode 100644 index 000000000..2fbdf32d5 --- /dev/null +++ b/assets/syntaxes/Packages/RestructuredText/syntax_test_restructuredtext.rst @@ -0,0 +1,137 @@ +.. SYNTAX TEST "Packages/RestructuredText/reStructuredText.sublime-syntax" + +.. a comment +.. <- punctuation.definition.comment.restructuredtext +.. ^^^^^^^^^ comment.line.double-dot.restructuredtext + + +.. + a multi-line comment is indented after initial .. +..^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-dot.restructuredtext + + +.. + a multi-line comment ends at the first character in the + first column +This is not a comment +.. <- meta.paragraph.restructuredtext + +.. multi line comments can contain blank lines. + + These are still part of the comment if they're indented. +.. <- comment.line.double-dot.restructuredtext + +Some text +.. <- meta.paragraph.restructuredtext + + +Paragraph of text +.. <- meta.paragraph.restructuredtext + +A heading +========= +.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext + +A heading +--------- +.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext + +A heading +~~~~~~~~~ +.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext + +A heading +######### +.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext + +A heading +""""""""" +.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext + +A heading +^^^^^^^^^ +.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext + +A heading ++++++++++ +.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext + +A heading +********* +.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext + + +This is *italic*. +.. ^^^^^^^^ markup.italic.restructuredtext +.. ^ punctuation.definition.italic.restructuredtext + +this is **bold**. +.. ^^^^^^^^ markup.bold.restructuredtext + + +Directive tests +-------------- + +.. note that comments within multiline directives must be indented, else they + convert the contents of that directive into a comment + +.. note:: Single line note +.. <- punctuation.definition.directive.restructuredtext +.. ^^^^ meta.other.directive.restructuredtext +.. ^^ punctuation.separator.key-value.restructuredtext + +.. note:: + .. ^^^^ meta.other.directive.restructuredtext + .. ^^ punctuation.separator.key-value.restructuredtext + + Outer note + + .. note:: Inner single line note + .. <- punctuation.definition.directive.restructuredtext + .. ^^^^ meta.other.directive.restructuredtext + .. ^^ punctuation.separator.key-value.restructuredtext + + +Verbatim tests +-------------- + +:: + + Verbatim +.. ^^^^^^^^ meta.raw.block.restructuredtext + +Can start with other text:: + + Verbatim +.. ^^^^^^^^ meta.raw.block.restructuredtext + +.. blank lines should not cause scopes to be left + +:: + + Verbatim + + Also Verbatim +.. ^^^^^^^^^^^^^ meta.raw.block.restructuredtext + +:: + + Verbatim + + Also Verbatim +.. ^^^^^^^^^^^^^ meta.raw.block.restructuredtext + + +:: + + Verbatim + +Not verbatim +.. <- meta.paragraph.restructuredtext + +.. raw:: html + <b> + Blank lines are fine + + </b> +.. ^^^^ text.html.basic \ No newline at end of file diff --git a/assets/syntaxes/Packages/Ruby/Comments.tmPreferences b/assets/syntaxes/Packages/Ruby/Comments.tmPreferences new file mode 100644 index 000000000..f2c19ac4e --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Comments.tmPreferences @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>source.ruby</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string># </string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_START_2</string> + <key>value</key> + <string>=begin</string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_END_2</string> + <key>value</key> + <string>=end</string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Ruby/Completion Rules.tmPreferences b/assets/syntaxes/Packages/Ruby/Completion Rules.tmPreferences new file mode 100644 index 000000000..ceaeaf985 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Completion Rules.tmPreferences @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>scope</key> + <string>source.ruby</string> + <key>settings</key> + <dict> + <key>cancelCompletion</key> + <string>^\s*(else|end|do|begin|rescue|(class|def|module|include)\s*[a-zA-Z_0-9]+)$</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Ruby/Default.sublime-keymap b/assets/syntaxes/Packages/Ruby/Default.sublime-keymap new file mode 100644 index 000000000..2594e5dec --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Default.sublime-keymap @@ -0,0 +1,13 @@ +[ + { "keys": ["#"], "command": "insert_snippet", "args": {"contents": "#{${0:$SELECTION}}"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { + "operand": "(string.quoted.double.ruby | string.interpolated.ruby) - string source", + "operator": "equal", + "match_all": true, + "key": "selector" + } + ] + } +] diff --git a/assets/syntaxes/Packages/Ruby/Miscellaneous.tmPreferences b/assets/syntaxes/Packages/Ruby/Miscellaneous.tmPreferences new file mode 100644 index 000000000..4c935c053 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Miscellaneous.tmPreferences @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Indent</string> + <key>scope</key> + <string>source.ruby</string> + <key>settings</key> + <dict> + <key>decreaseIndentPattern</key> + <string>^\s*([}\]]|(end|rescue|ensure|else|elsif|when)\b)</string> + <key>increaseIndentPattern</key> + <string><![CDATA[(?x)^ + (\s* + ( + module|class|(?:(?:private|protected|public)\s+)?def + |unless|if|else|elsif + |case|when + |begin|rescue|ensure + |for|while|until + | + (?=.*? \b(do|begin|case|if|unless)\b ) + # the look-ahead above is to quickly discard non-candidates + ( + "(\\.|[^\\"])*+" # eat a double quoted string + | '(\\.|[^\\'])*+' # eat a single quoted string + | [^#"'] # eat all but comments and strings + )* + ( + \s (do|begin|case) + | [-+=&|*/~%^<>~](?<!\$.) \s*+ (if|unless) + ) + )\b + (?! [^;]*+ ; .*? \bend\b ) + | + ( + "(\\.|[^\\"])*+" # eat a double quoted string + | '(\\.|[^\\'])*+' # eat a single quoted string + | [^#"'] # eat all but comments and strings + )* + ( + \{ (?! [^}]*+ \} ) + | \[ (?! [^\]]*+ \] ) + ) + ).*$ + ]]></string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Ruby/Ruby.sublime-build b/assets/syntaxes/Packages/Ruby/Ruby.sublime-build new file mode 100644 index 000000000..70c002a8d --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Ruby.sublime-build @@ -0,0 +1,5 @@ +{ + "shell_cmd": "ruby \"$file\"", + "file_regex": "^(...*?):([0-9]*):?([0-9]*)", + "selector": "source.ruby" +} diff --git a/assets/syntaxes/Packages/Ruby/Ruby.sublime-syntax b/assets/syntaxes/Packages/Ruby/Ruby.sublime-syntax new file mode 100644 index 000000000..a9c763bc5 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Ruby.sublime-syntax @@ -0,0 +1,1866 @@ +%YAML 1.2 +--- +name: Ruby +# TODO: unresolved issues +# +# text: +# "p << end +# print me! +# end" +# symptoms: +# not recognized as a heredoc +# solution: +# there is no way to distinguish perfectly between the << operator and the start +# of a heredoc. Currently, we require assignment to recognize a heredoc. More +# refinement is possible. +# • Heredocs with indented terminators (<<-) are always distinguishable, however. +# • Nested heredocs are not really supportable at present +# +# text: +# val?(a):p(b) +# val?'a':'b' +# symptoms: +# ':p' is recognized as a symbol.. its 2 things ':' and 'p'. +# :'b' has same problem. +# solution: +# ternary operator rule, precedence stuff, symbol rule. +# but also consider 'a.b?(:c)' ?? +file_extensions: + - rb + - Appfile + - Appraisals + - Berksfile + - Brewfile + - capfile + - cgi + - Cheffile + - config.ru + - Deliverfile + - Fastfile + - fcgi + - Gemfile + - gemspec + - Guardfile + - irbrc + - jbuilder + - Podfile + - podspec + - prawn + - rabl + - rake + - Rakefile + - Rantfile + - rbx + - rjs + - ruby.rail + - Scanfile + - simplecov + - Snapfile + - thor + - Thorfile + - Vagrantfile +first_line_match: |- + (?xi: + ^\#! .* \bj?ruby\b | # shebang + ^\# \s* -\*- [^*]* ruby [^*]* -\*- # editorconfig + ) +scope: source.ruby +variables: + bdigits: (?:[01]+(?:_[01]+)*) + ddigits: (?:\d+(?:_\d+)*) + hdigits: (?:\h+(?:_\h+)*) + odigits: (?:[0-7]+(?:_[0-7]+)*) + exponent: (?:[Ee][-+]?{{ddigits}}) + heredoc_type_css: (?:[[:upper:]_]_)?CSS + heredoc_type_html: (?:[[:upper:]_]_)?HTML + heredoc_type_js: (?:[[:upper:]_]_)?(?:JS|JAVASCRIPT) + heredoc_type_ruby: (?:[[:upper:]_]_)?RUBY + heredoc_type_shell: (?:[[:upper:]_]_)?(?:SH|SHELL) + heredoc_type_sql: (?:[[:upper:]_]_)?SQL + identifier: '\b[[:alpha:]_][[:alnum:]_]*\b' + method_punctuation: '(?:[?!]|=(?![>=]))?' + method_name: '{{identifier}}{{method_punctuation}}' + path_lookahead: '(::)?({{identifier}}(\.|::))*{{identifier}}' + +contexts: + main: + - include: expressions + + expressions: + - include: constants + - include: class + - include: module + - include: invalid + - include: blocks + - include: keywords + - include: well-known-methods + - include: variables + - include: method + - include: strings + - include: comments + - include: data-section + - include: heredocs + - include: punctuation + - include: operators + - include: identifiers-accessors + + comments: + # multiline comments + - match: ^=begin + scope: punctuation.definition.comment.begin.ruby + push: + - meta_scope: comment.block.documentation.ruby + - match: ^=end + scope: punctuation.definition.comment.end.ruby + pop: true + - match: \#+ + scope: punctuation.definition.comment.ruby + push: + - meta_scope: comment.line.number-sign.ruby + - match: \n + pop: true + + class: + # Defining a class method + - match: \b(class)\b(?=\s*<) + scope: keyword.control.class.ruby + - match: '\b(class)\b' + scope: meta.class.ruby keyword.control.class.ruby + push: class-declaration + + class-declaration: + - meta_content_scope: meta.class.ruby + - match: '(?={{path_lookahead}})' + set: class-name + # Escape if no valid match + - match: (?=\S) + pop: true + + class-name: + - meta_content_scope: meta.class.ruby entity.name.class.ruby + - include: name-parts + - match: '' + set: class-inheritance + + class-inheritance: + - meta_content_scope: meta.class.ruby + - match: '<' + scope: punctuation.separator.inheritance.ruby + set: + - meta_content_scope: meta.class.ruby + - match: '(?={{path_lookahead}})' + set: + - meta_content_scope: meta.class.ruby entity.other.inherited-class.ruby + - include: name-parts + - match: '' + pop: true + # Escape if no valid match + - match: '(?=\S)' + pop: true + # Escape if no valid match + - match: '(?=\S)' + pop: true + + module: + - match: \b(module)\b + scope: meta.module.ruby keyword.control.module.ruby + push: module-declaration + + module-declaration: + - meta_content_scope: meta.module.ruby + - match: '(?=(::)?({{identifier}}::)*{{identifier}})' + set: + - meta_content_scope: meta.module.ruby entity.name.module.ruby + - include: name-parts + - match: '' + pop: true + # Escape if no valid match + - match: (?=\S) + pop: true + + name-parts: + - match: ({{identifier}})?(?:(::)|(\.)) + captures: + 1: support.other.namespace.ruby + 2: punctuation.accessor.double-colon.ruby + 3: punctuation.accessor.dot.ruby + - match: '{{identifier}}' + + invalid: + # else if is a common mistake carried over from other languages. it works if you put in a second end, but it’s never what you want. + - match: \belse\s+if\b + scope: invalid.deprecated.ruby + + constants: + # constant definition, handles multiple definitions on a single line 'APPLE, ORANGE= 1, 2' + - match: '\b([[:upper:]]\w*)(?=(\s*,\s*[[:upper:]]\w*)*\s*=(?![=\>]))' + scope: meta.constant.ruby entity.name.constant.ruby + # Ruby 1.9 symbols + - match: '{{identifier}}[?!]?(:)(?!:)' + scope: constant.other.symbol.ruby + captures: + 1: punctuation.definition.constant.ruby + push: try-regex + - match: '\b(nil|true|false)\b(?![?!])' + scope: constant.language.ruby + - match: '\b(__(FILE|LINE|ENCODING)__|self)\b(?![?!])' + scope: variable.language.ruby + # hexadecimal imaginary numbers: 0xAi, 0xAri + - match: '\b(0[xX]){{hdigits}}(r?i)(r)?\b' + scope: constant.numeric.imaginary.hexadecimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + 3: invalid.illegal.numeric.ruby + # octal imaginary numbers: 0o1i, 0o1ri, 01i, 01ri + - match: '\b(0[oO]?){{odigits}}(r?i)(r)?\b' + scope: constant.numeric.imaginary.octal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + 3: invalid.illegal.numeric.ruby + # binary imaginary numbers: 0b1i, 0b1ri + - match: '\b(0[bB]){{bdigits}}(r?i)(r)?\b' + scope: constant.numeric.imaginary.binary.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + 3: invalid.illegal.numeric.ruby + # decimal imaginary numbers: 0d1i, 0d1ri, 1i, 1ri, 1.1i, 1.1ri, 1e1i, 1.1e1i + - match: |- + \b(?x: + (?: + # 0d1i, 0d1ri, 1i, 1ri | 1.1i, 1.1ri + (?: (0[dD])? {{ddigits}} | {{ddigits}} (\.) {{ddigits}} ) (r?i) + # 1e1i, 1.1e1i + | {{ddigits}} (?: (\.) {{ddigits}} )? {{exponent}} (r)? (i) + ) (r)? + )\b + scope: constant.numeric.imaginary.decimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: punctuation.separator.decimal.ruby + 3: storage.type.numeric.ruby + 4: punctuation.separator.decimal.ruby + 5: invalid.illegal.numeric.ruby + 6: storage.type.numeric.ruby + 7: invalid.illegal.numeric.ruby + # hexadecimal rational numbers: 0xAr + - match: '\b(0[xX]){{hdigits}}(r)\b' + scope: constant.numeric.rational.hexadecimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + # octal rational numbers: 0o1r, 01r + - match: '\b(0[oO]?){{odigits}}(r)\b' + scope: constant.numeric.rational.octal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + # binary rational numbers: 0b1r + - match: '\b(0[bB]){{bdigits}}(r)\b' + scope: constant.numeric.rational.binary.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + # decimal rational numbers: 0d1r, 1r, 1.1r + - match: '\b(?:(0[dD])?{{ddigits}}|{{ddigits}}(\.){{ddigits}})(r)\b' + scope: constant.numeric.rational.decimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: punctuation.separator.decimal.ruby + 3: storage.type.numeric.ruby + # decimal floating point numbers: 1.1, 1e1, 1.1e1 + - match: '\b{{ddigits}}(?:(\.){{ddigits}}|(?:(\.){{ddigits}})?{{exponent}}(r)?)\b' + scope: constant.numeric.float.decimal.ruby + captures: + 1: punctuation.separator.decimal.ruby + 2: punctuation.separator.decimal.ruby + 3: invalid.illegal.numeric.rational.ruby + # hexadecimal integer numbers: 0xA + - match: '\b(0[xX]){{hdigits}}\b' + scope: constant.numeric.integer.hexadecimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + # octal integer numbers: 0o1, 01 + - match: '\b(0[oO]?){{odigits}}\b' + scope: constant.numeric.integer.octal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + # binary integer numbers: 0b1 + - match: '\b(0[bB]){{bdigits}}\b' + scope: constant.numeric.integer.binary.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + # decimal integer numbers: 0d1, 1 + - match: '\b(0[dD])?{{ddigits}}\b' + scope: constant.numeric.integer.decimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + # Quoted symbols + - match: ":'" + scope: punctuation.definition.constant.ruby + push: + - meta_scope: meta.constant.ruby constant.other.symbol.single-quoted.ruby + - match: "'" + scope: punctuation.definition.constant.ruby + pop: true + - match: '\\[''\\]' + scope: constant.character.escape.ruby + - match: ':"' + scope: punctuation.definition.constant.ruby + push: + - meta_scope: meta.constant.ruby constant.other.symbol.double-quoted.ruby + - match: '"' + scope: punctuation.definition.constant.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + # Unquoted symbols + - match: |- + (?x: + (:) + ( + {{identifier}}{{method_punctuation}}| + ===?| + >[>=]?| + <[<=]?| + <=>| + [%&`/\|]| + \*\*?| + =?~| + [-+]@?| + \[\]=?| + @@?{{identifier}} + ) + ) + scope: constant.other.symbol.ruby + captures: + 1: punctuation.definition.constant.ruby + # questionmark literals + - match: ((\?)\\u)(\{) + captures: + 1: constant.character.ruby + 2: punctuation.definition.constant.ruby + 3: meta.braces.ruby punctuation.section.braces.begin.ruby + push: + - meta_scope: meta.constant.ruby + - meta_content_scope: meta.braces.ruby + - match: \} + scope: meta.braces.ruby punctuation.section.braces.end.ruby + pop: true + - match: \h{0,6} + scope: constant.numeric.integer.hexadecimal.ruby + - match: \S + scope: invalid.illegal.escape.ruby + - match: |- + (?x: (\?)(?: + # examples (meta control sequences): + # ?\C-a ?\M-a ?\M-\C-a ?\ca ?\M-ca + (?:\\(?:[MC]-|c)){1,2}[[:ascii:]] | + \\(?: + # examples (hex): + # ?\x1 ?\x61 + x\h{1,2}\b | + # examples (octal): + # ?\0 ?\07 ?\017 + 0[0-7]{0,2}\b | + # examples (escaped): + # ?\n ?\b ?\\ + .(?!\w) + ) | + # examples (illegal): + # ?abc ?\xAG ?\\n + # ?_a0 + ([[:alpha:]_\\]\S+)\b(?!\s*:) | + # examples (normal): + # ?a ?A ?0 + # ?* ?" ?( + # ?. ?# ?\ + [[:alnum:]_]\b(?!\s*:) | [^[:alnum:]_\s] + ) ) + scope: constant.character.ruby + captures: + 1: punctuation.definition.constant.ruby + 2: invalid.illegal.character.ruby + + blocks: + - match: \b(do)\b\s* + captures: + 1: keyword.control.start-block.ruby + push: maybe-block-parameters + - match: \{ + scope: punctuation.section.scope.ruby + push: maybe-block-parameters + + maybe-block-parameters: + - match: \| + scope: meta.block.parameters.ruby punctuation.definition.parameters.begin.ruby + set: block-parameters + - match: (?=\s*[^\s\|]) + pop: true + + block-parameters: + - meta_content_scope: meta.block.parameters.ruby + - match: \| + scope: meta.block.parameters.ruby punctuation.definition.parameters.end.ruby + set: try-regex + - match: '{{identifier}}' + scope: variable.parameter.ruby + - match: ',' + scope: punctuation.separator.ruby + - match: \* + scope: keyword.operator.splat.ruby + - match: '&' + scope: keyword.operator.ruby + - match: '(?==)' + set: + - meta_content_scope: meta.block.parameters.default-value.ruby + - match: '=' + scope: keyword.operator.assignment.ruby + set: + - meta_content_scope: meta.block.parameters.default-value.ruby + - match: '(?=[,\|])' + set: block-parameters + - include: nest-all + - include: expressions + + keywords: + - match: '\b(BEGIN|END)\b(?![?!])' + scope: keyword.control.ruby + - match: '\b(class|module)\b(?![?!])' + scope: keyword.control.ruby + - match: '\b(begin|end|ensure|rescue)\b(?![?!])' + scope: keyword.control.ruby + - match: '\b(case|else|ensure|for|in|then)\b(?![?!])' + scope: keyword.control.ruby + - match: '\b(elsif|if|unless|when|while|until)\b(?![?!])' + scope: keyword.control.ruby + push: after-keyword + - match: \b(and|not|or)\b + scope: keyword.operator.logical.ruby + push: after-keyword + - match: '\b(alias|alias_method|break|next|redo|retry|return|super|undef|yield)\b(?![?!])|\bdefined\?|\bblock_given\?' + scope: keyword.control.pseudo-method.ruby + + operators: + - match: '>>' + scope: keyword.operator.other.ruby + push: after-operator + # note: `/=` is matched in the `regexes` context + - match: <<=|&&=|\|\|=|\*\*=|[-+*&|^]=|<< + scope: keyword.operator.assignment.augmented.ruby + push: after-operator + - match: <=>|===|<=|>=|==|=~|!=|!~|<|> + scope: keyword.operator.comparison.ruby + push: after-operator + - match: \*\*|[-+*/%] + scope: keyword.operator.arithmetic.ruby + push: after-operator + - match: = + scope: keyword.operator.assignment.ruby + push: after-operator + - match: '!+|&&|\|\|' + scope: keyword.operator.logical.ruby + push: after-operator + - match: '[~&|^]' + scope: keyword.operator.bitwise.ruby + push: after-operator + - match: \? + scope: keyword.operator.conditional.ruby + push: + # Handle hash-key-lookalike of identifier: in ternary + - match: \s*{{identifier}}(:)(?!:) + captures: + 1: keyword.operator.conditional.ruby + set: after-operator + - include: after-operator + - match: :(?!:) + scope: keyword.operator.conditional.ruby + push: after-operator + - match: \.\.\.? + scope: keyword.operator.range.ruby + push: after-operator + + punctuation: + - match: => + scope: punctuation.separator.key-value.ruby + push: after-operator + - match: ',' + scope: punctuation.separator.sequence.ruby + push: after-operator + - match: ; + scope: punctuation.terminator.statement.ruby + push: after-operator + - match: \[ + scope: punctuation.section.array.ruby + push: after-operator + - match: \( + scope: punctuation.definition.group.begin.ruby + push: after-operator + # Opening { is handled by "block" context to try and detect parameters + - match: \} + scope: punctuation.section.scope.ruby + - match: \] + scope: punctuation.section.array.ruby + - match: \) + scope: punctuation.definition.group.end.ruby + + identifiers-accessors: + # This consumes class/module access to prevent issues parsing : as part + # of a ternary operator + - match: ::(?={{identifier}}{{method_punctuation}}) + scope: punctuation.accessor.double-colon.ruby + push: + - include: well-known-methods + - match: '{{identifier}}{{method_punctuation}}' + - match: '' + set: after-identifier + # This consumes attribute access so we don't need a lookbehind for . + - match: \.(?={{identifier}}{{method_punctuation}}) + scope: punctuation.accessor.dot.ruby + push: + - include: well-known-methods + - match: '{{identifier}}{{method_punctuation}}' + - match: '' + set: after-identifier + # This consumes method names ending in punctuation so we don't need a lookbehind for ?, ! or = + - match: '{{identifier}}{{method_punctuation}}' + # This consumes module/class accessor so we don't need a lookbehind for :: + push: after-identifier + - match: \. + scope: punctuation.accessor.dot.ruby + - match: '::' + scope: punctuation.accessor.double-colon.ruby + + after-identifier: + # Handles a : right after an identifier. In this case it can't be the + # beginning of a symbol, so it must be part of a ternary operator + - match: ':(?!:)' + scope: keyword.operator.conditional.ruby + pop: true + - match: '' + pop: true + + variables: + - match: '(@)[a-zA-Z_]\w*' + scope: variable.other.readwrite.instance.ruby + captures: + 1: punctuation.definition.variable.ruby + - match: '(@@)[a-zA-Z_]\w*' + scope: variable.other.readwrite.class.ruby + captures: + 1: punctuation.definition.variable.ruby + - match: '(\$)[a-zA-Z_]\w*' + scope: variable.other.readwrite.global.ruby + captures: + 1: punctuation.definition.variable.ruby + - match: '(\$)(!|@|&|`|''|\+|\d+|~|=|/|\\|,|;|\.|<|>|_|\*|\$|\?|:|"|-[0adFiIlpv])' + scope: variable.other.readwrite.global.pre-defined.ruby + captures: + 1: punctuation.definition.variable.ruby + - match: '\b(ENV)\[' + captures: + 1: variable.other.constant.ruby + push: + - meta_scope: meta.environment-variable.ruby + - match: '\]' + pop: true + - include: expressions + - match: '(::)?(\b[[:upper:]]\w*)(?=((\.|::)[[:alpha:]_]|\[))' + captures: + 1: punctuation.accessor.double-colon.ruby + 2: support.class.ruby + - match: '\b[[:upper:]]\w*\b' + scope: variable.other.constant.ruby + + well-known-methods: + - match: '\b(initialize|new|loop|include|extend|prepend|raise|fail|attr_reader|attr_writer|attr_accessor|attr|catch|throw|module_function|public|protected|private)\b(?![?!])' + scope: keyword.other.special-method.ruby + push: function-call-arguments + - match: \b(require|require_relative|gem)\b + scope: keyword.other.special-method.ruby + push: + - meta_scope: meta.require.ruby + - match: $|(?=[#}]) + pop: true + - include: expressions + # Conversion methods + - match: |- + (?x: + \b( + to_ary| + to_a| + to_c| + to_enum| + to_f| + to_hash| + to_h| + to_int| + to_io| + to_i| + to_proc| + to_r| + to_str| + to_sym| + to_s + )\b + (?![!?=]) + ) + scope: support.function.builtin.ruby + push: function-call-arguments + # Methods that may be followed by a regex + - match: |- + (?x: + \b( + gsub| + sub + )(!|\b) + | + \b( + match + )(\?|\b) + | + \b( + assert_match| + assert_no_match| + index| + rindex| + scan + )\b(?![!?=]) + ) + scope: support.function.builtin.ruby + push: function-call-arguments + # Methods from the Object class not handled elsewhere, ending in punctuation + - match: |- + (?x: + \b( + eql\?| + instance_of\?| + instance_variable_defined\?| + is_a\?| + kind_of\?| + nil\?| + respond_to\?| + respond_to_missing\?| + tainted\?| + untrusted\? + ) + ) + scope: support.function.builtin.ruby + push: function-call-arguments + # Methods from the Object class not handled elsewhere + - match: |- + (?x: + \b( + class| + clone| + define_singleton_method| + display| + dup| + enum_for| + extend| + freeze| + frozen?| + hash| + inspect| + instance_variable_get| + instance_variable_set| + instance_variables| + itself| + method| + methods| + object_id| + private_methods| + protected_methods| + public_method| + public_methods| + public_send| + remove_instance_variable| + send| + singleton_class| + singleton_method| + singleton_methods| + taint| + tap| + trust| + untaint| + untrust + )\b + (?![!?=]) + ) + scope: support.function.builtin.ruby + push: function-call-arguments + # Methods from the Kernel class not handled elsewhere, ending in punctuation + - match: |- + (?x: + \b( + autoload\?| + iterator\?| + exit! + ) + ) + scope: support.function.builtin.ruby + push: function-call-arguments + # Methods from the Kernel class not handled elsewhere + - match: |- + (?x: + \b( + Array| + Complex| + Float| + Hash| + Integer| + Rational| + String| + __callee__| + __dir__| + __method__| + abort| + at_exit| + autoload| + binding| + callcc| + caller| + caller_locations| + chomp| + chop| + eval| + exec| + exit| + fork| + format| + gets| + global_variables| + gsub| + lambda| + load| + local_variables| + open| + p| + print| + printf| + proc| + putc| + puts| + rand| + readline| + readlines| + require| + require_relative| + select| + set_trace_func| + sleep| + spawn| + sprintf| + srand| + sub| + syscall| + system| + test| + trace_var| + trap| + untrace_var| + warn + )\b + (?![!?=]) + ) + scope: support.function.builtin.ruby + push: function-call-arguments + # Methods from the Kernel class not handled elsewhere, ending in punctuation + - match: |- + (?x: + \b( + class_variable_defined\?| + const_defined\?| + include\?| + instance_methods\?| + method_defined\?| + private_method_defined\?| + protected_method_defined\?| + public_method_defined\?| + singleton_class\? + ) + ) + scope: support.function.builtin.ruby + push: function-call-arguments + # Methods from the Module class not handled elsewhere + - match: |- + (?x: + \b( + ancestors| + append_features| + class_eval| + class_exec| + class_variable_get| + class_variable_set| + class_variables| + const_get| + const_missing| + const_set| + constants| + define_method| + extend_object| + extended| + freeze| + included| + included_modules| + inspect| + method_added| + method_removed| + method_undefined| + module_eval| + module_exec| + name| + prepend_features| + prepended| + private_class_method| + private_constant| + private_instance_methods| + protected_instance_methods| + public_class_method| + public_constant| + public_instance_method| + public_instance_methods| + refine| + remove_class_variable| + remove_const| + remove_method| + undef_method| + using + )\b + (?![!?=]) + ) + scope: support.function.builtin.ruby + push: function-call-arguments + + function-call-arguments: + - include: try-regex + + method: + - match: \b(def)\b + scope: meta.function.ruby keyword.control.def.ruby + push: + - meta_content_scope: meta.function.ruby + - match: '(self)(\.)({{identifier}}{{method_punctuation}}|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?)' + captures: + 1: variable.language.ruby + 2: punctuation.accessor.dot.ruby + 3: entity.name.function.ruby + set: method-parameters-start + - match: '===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?' + scope: entity.name.function.ruby + set: method-parameters-start + - match: '(?:({{identifier}})(?:(::)|(\.)))?{{identifier}}{{method_punctuation}}' + scope: entity.name.function.ruby + captures: + 1: support.other.namespace.ruby + 2: punctuation.accessor.double-colon.ruby + 3: punctuation.accessor.dot.ruby + set: method-parameters-start + - match: '$' + pop: true + - match: '(?=\S)' + pop: true + + method-parameters-start: + - meta_content_scope: meta.function.ruby + - match: '(?=\()' + set: + - meta_content_scope: meta.function.parameters.ruby + - match: '\(' + scope: punctuation.definition.group.begin.ruby + set: method-parameters + # No parameters + - match: '(?=$|;|#)' + pop: true + # No parentheses around parameters + - match: '(?=[[:alpha:]_*])' + set: method-bare-parameters + + method-parameters: + - meta_content_scope: meta.function.parameters.ruby + - match: '\)' + scope: meta.function.parameters.ruby punctuation.definition.group.end.ruby + pop: true + - match: '{{identifier}}' + scope: variable.parameter.ruby + - include: comments + - match: ',' + scope: punctuation.separator.ruby + - match: '\*' + scope: keyword.operator.splat.ruby + - match: '&' + scope: keyword.operator.ruby + # De-structuring + - match: \( + scope: punctuation.definition.group.begin.ruby + push: + - match: \) + scope: punctuation.definition.group.end.ruby + pop: true + - match: '{{identifier}}' + scope: variable.parameter.ruby + - match: ',' + scope: punctuation.separator.ruby + - match: '\*' + scope: keyword.operator.splat.ruby + # Default values + - match: (?==) + set: + - meta_content_scope: meta.function.parameters.default-value.ruby + - match: '=' + scope: keyword.operator.assignment.ruby + set: + - meta_content_scope: meta.function.parameters.default-value.ruby + - match: '(?=[,\)])' + set: method-parameters + - include: nest-all + - include: expressions + # Keyword parameter (with default value support) + - match: (?=:) + set: + - meta_content_scope: meta.function.parameters.default-value.ruby + - match: ':' + scope: punctuation.separator.ruby + set: + - meta_content_scope: meta.function.parameters.default-value.ruby + - match: '(?=[,\)])' + set: method-parameters + - include: nest-all + - include: expressions + + # When no parentheses are placed around the parameters + method-bare-parameters: + - meta_content_scope: meta.function.parameters.ruby + - match: '(?=$|;|#)' + pop: true + - match: '{{identifier}}' + scope: variable.parameter.ruby + - match: ',' + scope: punctuation.separator.ruby + - match: '\*' + scope: keyword.operator.splat.ruby + - match: '&' + scope: keyword.operator.ruby + # Default values + - match: (?==) + set: + - meta_content_scope: meta.function.parameters.default-value.ruby + - match: '=' + scope: punctuation.operator.assignment.ruby + set: + - meta_content_scope: meta.function.parameters.default-value.ruby + - match: '(?=$|[,;])' + set: method-bare-parameters + - include: nest-all + - include: expressions + # Keyword parameter (with default value support) + - match: (?=:) + set: + - meta_content_scope: meta.function.parameters.default-value.ruby + - match: ':' + scope: punctuation.separator.ruby + set: + - meta_content_scope: meta.function.parameters.default-value.ruby + - match: '(?=$|[,;])' + set: method-bare-parameters + - include: nest-all + - include: expressions + + strings: + - include: early-strings + - include: regexes + - include: late-strings + + early-strings: + # single quoted string (does not allow interpolation) + - match: "'" + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.single.ruby + - match: "'" + scope: punctuation.definition.string.end.ruby + pop: true + - match: \\'|\\\\ + scope: constant.character.escape.ruby + - include: string-placeholder + # double quoted string (allows for interpolation) + - match: '"' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.double.ruby + - match: '"' + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: string-placeholder + # execute string (allows for interpolation) + - match: "`" + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.interpolated.ruby + - match: "`" + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + # execute string (allow for interpolation) + - match: '%x\{' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.interpolated.ruby + - match: '\}' + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-curly-i + # execute string (allow for interpolation) + - match: '%x\[' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.interpolated.ruby + - match: '\]' + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-brackets-i + # execute string (allow for interpolation) + - match: '%x\<' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.interpolated.ruby + - match: \> + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-ltgt-i + # execute string (allow for interpolation) + - match: '%x\(' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.interpolated.ruby + - match: \) + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-parens-i + # execute string (allow for interpolation) + - match: '%x([^\w])' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.interpolated.ruby + - match: \1 + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + + late-strings: + # literal capable of interpolation () + - match: '%[QWI]?\(' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.upper.ruby + - match: \) + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-parens-i + # "literal capable of interpolation []" + - match: '%[QWI]?\[' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.upper.ruby + - match: '\]' + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-brackets-i + # literal capable of interpolation <> + - match: '%[QWI]?\<' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.upper.ruby + - match: \> + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-ltgt-i + # literal capable of interpolation -- {} + - match: '%[QWI]?\{' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.double.ruby.mod + - match: '\}' + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-curly-i + # literal capable of interpolation -- wildcard + - match: '%[QWI]([^\w])' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.upper.ruby + - match: \1 + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + # literal capable of interpolation -- wildcard + - match: '%([^\w\s=])' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.other.ruby + - match: \1 + scope: punctuation.definition.string.end.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + # literal incapable of interpolation -- () + - match: '%[qwsi]\(' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby + - match: \) + scope: punctuation.definition.string.end.ruby + pop: true + - match: \\\)|\\\\ + scope: constant.character.escape.ruby + - include: nest-parens + # literal incapable of interpolation -- <> + - match: '%[qwsi]\<' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby + - match: \> + scope: punctuation.definition.string.end.ruby + pop: true + - match: \\\>|\\\\ + scope: constant.character.escape.ruby + - include: nest-ltgt + # literal incapable of interpolation -- [] + - match: '%[qwsi]\[' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby + - match: '\]' + scope: punctuation.definition.string.end.ruby + pop: true + - match: '\\\]|\\\\' + scope: constant.character.escape.ruby + - include: nest-brackets + # literal incapable of interpolation -- {} + - match: '%[qwsi]\{' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby + - match: '\}' + scope: punctuation.definition.string.end.ruby + pop: true + - match: '\\\}|\\\\' + scope: constant.character.escape.ruby + - include: nest-curly + # literal incapable of interpolation -- wildcard + - match: '%[qwsi]([^\w])' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby + - match: \1 + scope: punctuation.definition.string.end.ruby + pop: true + # Cant be named because its not necessarily an escape + - match: \\. + + after-keyword: + - include: try-regex + + after-operator: + - include: try-regex + + try-regex: + # Generally for multiline regexes, one of the %r forms below will be used, + # so we bail out if we can't find a second / on the current line + - match: \s*(/)(?=(?!=).*/) + captures: + 1: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.regexp.ruby string.regexp.classic.ruby + - match: (/)([eimnosux]*) + captures: + 1: punctuation.definition.string.end.ruby + 2: keyword.other.ruby + pop: true + - include: regex-sub + - match: '' + pop: true + + regexes: + # Needs higher precedence than regular expressions. + - match: /= + scope: keyword.operator.assignment.augmented.ruby + - match: '(?=^\s*/)' + push: try-regex + - match: (?=/\s*[^\w\(\s@"']) + push: try-regex + # regular expressions (literal) + - match: '%r\{' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby + - match: '\}[eimnosux]*' + scope: punctuation.definition.string.end.ruby + pop: true + - include: regex-sub + - include: nest-curly-r + # regular expressions (literal) + - match: '%r\[' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby + - match: '\][eimnosux]*' + scope: punctuation.definition.string.end.ruby + pop: true + - include: regex-sub + - include: nest-brackets-r + # regular expressions (literal) + - match: '%r\(' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby + - match: '\)[eimnosux]*' + scope: punctuation.definition.string.end.ruby + pop: true + - include: regex-sub + - include: nest-parens-r + # regular expressions (literal) + - match: '%r\<' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby + - match: '\>[eimnosux]*' + scope: punctuation.definition.string.end.ruby + pop: true + - include: regex-sub + - include: nest-ltgt-r + # regular expressions (literal) + - match: '%r([^\w])' + scope: punctuation.definition.string.begin.ruby + push: + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby + - match: '\1[eimnosux]*' + scope: punctuation.definition.string.end.ruby + pop: true + - include: regex-sub + + regex-sub: + - include: interpolated-ruby + - include: escaped-char + - match: '(\{)\d+(,\d+)?(\})' + scope: meta.string.ruby string.regexp.arbitrary-repetition.ruby + captures: + 1: punctuation.definition.arbitrary-repetition.ruby + 3: punctuation.definition.arbitrary-repetition.ruby + - match: '\[(?:\^?\])?' + scope: punctuation.definition.character-class.ruby + push: + - meta_scope: meta.string.ruby string.regexp.character-class.ruby + - match: '\]' + scope: punctuation.definition.character-class.ruby + pop: true + - include: escaped-char + - match: \( + scope: punctuation.definition.group.ruby + push: + - meta_scope: meta.string.ruby string.regexp.group.ruby + - match: \) + scope: punctuation.definition.group.ruby + pop: true + - include: regex-sub + # We are restrictive in what we allow to go after the comment character to + # avoid false positives, since the availability of comments depend on regexp + # flags. + - match: '(?:^|\s)(#)\s[[a-zA-Z0-9,. \t?!-][^\x{00}-\x{7F}]]*$' + scope: comment.line.number-sign.ruby + captures: + 1: punctuation.definition.comment.ruby + + nest-brackets-r: + - match: '\[' + scope: punctuation.section.scope.ruby + push: + - match: '\]' + scope: punctuation.section.scope.ruby + pop: true + - include: regex-sub + - include: nest-brackets-r + nest-curly-r: + - match: '\{' + scope: punctuation.section.scope.ruby + push: + - match: '\}' + scope: punctuation.section.scope.ruby + pop: true + - include: regex-sub + - include: nest-curly-r + nest-ltgt-r: + - match: \< + scope: punctuation.section.scope.ruby + push: + - match: \> + scope: punctuation.section.scope.ruby + pop: true + - include: regex-sub + - include: nest-ltgt-r + nest-parens-r: + - match: \( + scope: punctuation.section.scope.ruby + push: + - match: \) + scope: punctuation.section.scope.ruby + pop: true + - include: regex-sub + - include: nest-parens-r + + nest-brackets: + - match: '\[' + scope: punctuation.section.scope.ruby + push: + - match: '\]' + scope: punctuation.section.scope.ruby + pop: true + - include: nest-brackets + nest-curly: + - match: '\{' + scope: punctuation.section.scope.ruby + push: [nest-curly-inner, maybe-block-parameters] + nest-curly-inner: + - match: '\}' + scope: punctuation.section.scope.ruby + pop: true + - include: nest-curly + nest-ltgt: + - match: \< + scope: punctuation.section.scope.ruby + push: + - match: \> + scope: punctuation.section.scope.ruby + pop: true + - include: nest-ltgt + nest-parens: + - match: \( + scope: punctuation.section.scope.ruby + push: + - match: \) + scope: punctuation.section.scope.ruby + pop: true + - include: nest-parens + + string-placeholder: + # %[flags][width][.precision]type + # + # A format sequence consists of a percent sign, followed by optional + # flags, width, and precision indicators, then terminated with a field + # type character. + # + # Also this is used for time format in strftime. + - match: |- + (?x)% + ([#0\- +\*]|(\d+\$))* # flags + (-?\d+)? # minimum field width + (\.(\d+)?)? # precision + [diouxXDOUeEfFgGaAcCsSpnvtTbByYhHmMzZ%] # conversion type + scope: constant.other.placeholder.ruby + + escaped-char: + # SEE: https://ruby-doc.org/core-2.6.3/doc/syntax/literals_rdoc.html + # meta control sequence + - match: (?:\\(?:[MC]-|c)){1,2}[[:ascii:]] + scope: constant.character.escape.ruby + # extended unicode character + - match: \\u\{ + push: + - meta_scope: constant.character.escape.ruby + - match: \} + pop: true + - match: \h{0,6} + - match: \S + scope: invalid.illegal.escape.ruby + # octal, hex, unicode, normal escaped character + - match: \\(?:[0-7]{1,3}|x\h{1,2}|u\h{4}|.) + scope: constant.character.escape.ruby + + interpolated-ruby: + - match: '#\{' + scope: punctuation.section.interpolation.begin.ruby + push: + - clear_scopes: 1 # remove `string`/`constant` + - meta_scope: meta.interpolation.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: interpolated-ruby-expressions + - match: '(?=#[@$])' + push: + - clear_scopes: 1 # remove `string`/`constant` + - meta_scope: meta.interpolation.ruby + - include: interpolated-ruby-variables + + interpolated-heredoc-ruby: + - match: '#\{' + scope: punctuation.section.interpolation.begin.ruby + push: + - meta_scope: meta.interpolation.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: interpolated-ruby-expressions + - match: '(?=#[@$])' + push: + - meta_scope: meta.interpolation.ruby + - include: interpolated-ruby-variables + + interpolated-ruby-expressions: + - match: '\}' + scope: punctuation.section.interpolation.end.ruby + pop: true + - include: nest-curly-expressions + - include: expressions + + interpolated-ruby-variables: + - match: '(#@)[[:alpha:]_]\w*' + scope: variable.other.readwrite.instance.ruby + captures: + 1: punctuation.definition.variable.ruby + pop: true + - match: '(#@@)[[:alpha:]_]\w*' + scope: variable.other.readwrite.class.ruby + captures: + 1: punctuation.definition.variable.ruby + pop: true + - match: '(#\$)[[:alpha:]_]\w*' + scope: variable.other.readwrite.global.ruby + captures: + 1: punctuation.definition.variable.ruby + pop: true + - match: '' + pop: true + + nest-curly-expressions: + - match: '\{' + scope: punctuation.section.scope.ruby + push: [nest-curly-expressions-inner, maybe-block-parameters] + nest-curly-expressions-inner: + - match: '\}' + scope: punctuation.section.scope.ruby + pop: true + - include: nest-curly-expressions + - include: expressions + + nest-all: + - match: '\(' + scope: punctuation.definition.group.begin.ruby + push: + - match: '\)' + scope: punctuation.definition.group.end.ruby + pop: true + - include: nest-all + - include: expressions + - match: '\{' + scope: punctuation.section.scope.ruby + push: [nest-all-inner, maybe-block-parameters] + - match: '\[' + scope: punctuation.section.array.ruby + push: + - match: '\]' + scope: punctuation.section.array.ruby + pop: true + - include: nest-all + - include: expressions + nest-all-inner: + - match: '\}' + scope: punctuation.section.scope.ruby + pop: true + - include: nest-all + - include: expressions + + nest-brackets-i: + - match: '\[' + scope: punctuation.section.scope.ruby + push: + - match: '\]' + scope: punctuation.section.scope.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-brackets-i + nest-curly-i: + - match: '\{' + scope: punctuation.section.scope.ruby + push: [nest-curly-i-inner, maybe-block-parameters] + nest-curly-i-inner: + - match: '\}' + scope: punctuation.section.scope.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-curly-i + nest-ltgt-i: + - match: \< + scope: punctuation.section.scope.ruby + push: + - match: \> + scope: punctuation.section.scope.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-ltgt-i + nest-parens-i: + - match: \( + scope: punctuation.section.scope.ruby + push: + - match: \) + scope: punctuation.section.scope.ruby + pop: true + - include: interpolated-ruby + - include: escaped-char + - include: nest-parens-i + +###[ HEREDOCS ]################################################################ + + heredocs: + # SEE: https://ruby-doc.org/core-2.5.0/doc/syntax/literals_rdoc.html + - include: heredoc-css + - include: heredoc-js + - include: heredoc-html + - include: heredoc-ruby + - include: heredoc-shell + - include: heredoc-sql + - include: heredoc-plain + + heredoc-css: + - match: <<[-~]["`]?({{heredoc_type_css}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-css-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_css}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-css-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_css}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-css-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_css}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-css-unindented-literal, trailing-heredoc-start] + + heredoc-css-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.css.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: scope:source.css + - include: escaped-char + + heredoc-css-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.css.embedded.ruby + - include: indented-heredoc-end + - include: scope:source.css + + heredoc-css-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.css.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.css + - include: escaped-char + + heredoc-css-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.css.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.css + + heredoc-js: + - match: <<[-~]["`]?({{heredoc_type_js}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-js-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_js}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-js-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_js}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-js-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_js}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-js-unindented-literal, trailing-heredoc-start] + + heredoc-js-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.js.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: scope:source.js + - include: escaped-char + + heredoc-js-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.js.embedded.ruby + - include: indented-heredoc-end + - include: scope:source.js + + heredoc-js-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.js.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.js + - include: escaped-char + + heredoc-js-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.js.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.js + + heredoc-html: + - match: <<[-~]["`]?({{heredoc_type_html}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-html-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_html}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-html-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_html}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-html-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_html}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-html-unindented-literal, trailing-heredoc-start] + + heredoc-html-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: text.html.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: scope:text.html.basic + - include: escaped-char + + heredoc-html-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: text.html.embedded.ruby + - include: indented-heredoc-end + - include: scope:text.html.basic + + heredoc-html-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: text.html.embedded.ruby + - include: unindented-heredoc-end + - include: scope:text.html.basic + - include: escaped-char + + heredoc-html-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: text.html.embedded.ruby + - include: unindented-heredoc-end + - include: scope:text.html.basic + + heredoc-ruby: + - match: <<[-~]["`]?({{heredoc_type_ruby}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-ruby-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_ruby}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-ruby-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_ruby}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-ruby-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_ruby}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-ruby-unindented-literal, trailing-heredoc-start] + + heredoc-ruby-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: escaped-char + - include: expressions + + heredoc-ruby-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: indented-heredoc-end + - include: expressions + + heredoc-ruby-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: unindented-heredoc-end + - include: interpolated-heredoc-ruby + - include: escaped-char + - include: expressions + + heredoc-ruby-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: unindented-heredoc-end + - include: expressions + + heredoc-plain: + - match: <<[-~]["`]?(\w+)["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-plain-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'(\w+)' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-plain-indented-literal, trailing-heredoc-start] + - match: <<["`]?(\w+)["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-plain-unindented-interpolated, trailing-heredoc-start] + - match: <<'(\w+)' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-plain-unindented-literal, trailing-heredoc-start] + + heredoc-plain-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: string.unquoted.heredoc.ruby + - include: indented-heredoc-end + - include: interpolated-ruby + - include: escaped-char + + heredoc-plain-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: string.unquoted.heredoc.ruby + - include: indented-heredoc-end + + heredoc-plain-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: string.unquoted.heredoc.ruby + - include: unindented-heredoc-end + - include: interpolated-ruby + - include: escaped-char + + heredoc-plain-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: string.unquoted.heredoc.ruby + - include: unindented-heredoc-end + + heredoc-shell: + - match: <<[-~]["`]?({{heredoc_type_shell}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-shell-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_shell}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-shell-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_shell}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-shell-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_shell}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-shell-unindented-literal, trailing-heredoc-start] + + heredoc-shell-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.shell.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: scope:source.shell + - include: escaped-char + + heredoc-shell-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.shell.embedded.ruby + - include: indented-heredoc-end + - include: scope:source.shell + + heredoc-shell-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.shell.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.shell + - include: escaped-char + + heredoc-shell-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.shell.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.shell + + heredoc-sql: + - match: <<[-~]["`]?({{heredoc_type_sql}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-sql-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_sql}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-sql-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_sql}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-sql-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_sql}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-sql-unindented-literal, trailing-heredoc-start] + + heredoc-sql-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.sql.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: scope:source.sql + - include: escaped-char + + heredoc-sql-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.sql.embedded.ruby + - include: indented-heredoc-end + - include: scope:source.sql + + heredoc-sql-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.sql.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.sql + - include: escaped-char + + heredoc-sql-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.sql.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.sql + + indented-heredoc-end: + - match: ^\s*(\1)$ # HEREDOC delimiter + scope: string.unquoted.heredoc.ruby + captures: + 1: punctuation.definition.string.end.ruby + pop: true + + unindented-heredoc-end: + - match: ^\1$ # HEREDOC delimiter + scope: string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby + pop: true + + trailing-heredoc-start: + # This prevents clear_scopes from applying to the push token + - match: '' + set: trailing-heredoc + + trailing-heredoc: + # The rest of the line right after the heredoc tag needs to be handled + # as ordinary ruby source. The embedded syntax starts at the next line. + - clear_scopes: 2 + - match: ^ + pop: true + - include: expressions + +###[ DATA SECTION ]############################################################ + + data-section: + - match: ^__END__\n + scope: meta.string.ruby string.unquoted.program-block.ruby + push: + - meta_content_scope: text.plain + - match: (?=<?xml|<(?i:html\b)|!DOCTYPE (?i:html\b)) + push: + - meta_scope: text.html.embedded.ruby + - include: scope:text.html.basic diff --git a/assets/syntaxes/Packages/Ruby/Snippets/#!;usr;local;bin;ruby-w.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/#!;usr;local;bin;ruby-w.sublime-snippet new file mode 100644 index 000000000..27a7b8d75 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/#!;usr;local;bin;ruby-w.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[#!/usr/bin/env ruby${TM_RUBY_SWITCHES: -wKU} +]]></content> + <tabTrigger>rb</tabTrigger> + <scope>source.ruby</scope> + <description>#!/usr/bin/env ruby -wKU</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/060-ruby-if-else.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/060-ruby-if-else.sublime-snippet new file mode 100644 index 000000000..a2fe6c132 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/060-ruby-if-else.sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[if ${1:condition} + $2 +else + $3 +end]]></content> + <tabTrigger>ife</tabTrigger> + <scope>source.ruby</scope> + <description>if … else … end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/070-ruby-if.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/070-ruby-if.sublime-snippet new file mode 100644 index 000000000..06b688c20 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/070-ruby-if.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[if ${1:condition} + $0 +end]]></content> + <tabTrigger>if</tabTrigger> + <scope>source.ruby</scope> + <description>if … end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/080-ruby-case.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/080-ruby-case.sublime-snippet new file mode 100644 index 000000000..c30eb38ae --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/080-ruby-case.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[case ${1:object} +when ${2:condition} + $0 +end]]></content> + <tabTrigger>case</tabTrigger> + <scope>source.ruby</scope> + <description>case … end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/Add-'#-=-'-Marker.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/Add-'#-=-'-Marker.sublime-snippet new file mode 100644 index 000000000..3bfa8cbea --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/Add-'#-=-'-Marker.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[# => ]]></content> + <tabTrigger>#</tabTrigger> + <scope>source.ruby</scope> + <description>Add ‘# =>’ Marker</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/Array.new(10)-{-i-..-}-(Arr).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/Array.new(10)-{-i-..-}-(Arr).sublime-snippet new file mode 100644 index 000000000..8dc321da2 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/Array.new(10)-{-i-..-}-(Arr).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[Array.new(${1:10}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:i}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>Array</tabTrigger> + <scope>source.ruby</scope> + <description>Array.new(10) { |i| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/Benchmark_bmbm(__)-do-__-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/Benchmark_bmbm(__)-do-__-end.sublime-snippet new file mode 100644 index 000000000..bf40a89d1 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/Benchmark_bmbm(__)-do-__-end.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[TESTS = ${1:10_000} +Benchmark.bmbm do |results| + $0 +end]]></content> + <tabTrigger>bm-</tabTrigger> + <scope>source.ruby</scope> + <description>Benchmark.bmbm do .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/Dir.glob(-..-)-do-file-..-end-(Dir).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/Dir.glob(-..-)-do-file-..-end-(Dir).sublime-snippet new file mode 100644 index 000000000..8b8c7562b --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/Dir.glob(-..-)-do-file-..-end-(Dir).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[Dir.glob(${1:"${2:dir/glob/*}"}) { |${3:file}| $0 }]]></content> + <tabTrigger>Dir</tabTrigger> + <scope>source.ruby</scope> + <description>Dir.glob("..") { |file| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/Dir[-__-].sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/Dir[-__-].sublime-snippet new file mode 100644 index 000000000..876016a03 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/Dir[-__-].sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[Dir[${1:"${2:glob/**/*.rb}"}]]]></content> + <tabTrigger>Dir</tabTrigger> + <scope>source.ruby</scope> + <description>Dir[".."]</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/File.foreach-(-..-)-do-line-..-end-(File).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/File.foreach-(-..-)-do-line-..-end-(File).sublime-snippet new file mode 100644 index 000000000..55f5a2711 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/File.foreach-(-..-)-do-line-..-end-(File).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[File.foreach(${1:"${2:path/to/file}"}) { |${3:line}| $0 }]]></content> + <tabTrigger>File</tabTrigger> + <scope>source.ruby</scope> + <description>File.foreach ("..") { |line| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/File_open(-__-)-{-file-__-}.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/File_open(-__-)-{-file-__-}.sublime-snippet new file mode 100644 index 000000000..6a8204b28 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/File_open(-__-)-{-file-__-}.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[File.open(${1:"${2:path/to/file}"}${3/(^[rwab+]+$)|.*/(?1:, ")/}${3:w}${3/(^[rwab+]+$)|.*/(?1:")/}) { |${4:file}| $0 }]]></content> + <tabTrigger>File</tabTrigger> + <scope>source.ruby</scope> + <description>File.open("..") { |file| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/File_read(-__-).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/File_read(-__-).sublime-snippet new file mode 100644 index 000000000..603311e4c --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/File_read(-__-).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[File.read(${1:"${2:path/to/file}"})]]></content> + <tabTrigger>File</tabTrigger> + <scope>source.ruby</scope> + <description>File.read("..")</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/Hash.new-{-hash-key-hash[key]-=-..-}-(Has).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/Hash.new-{-hash-key-hash[key]-=-..-}-(Has).sublime-snippet new file mode 100644 index 000000000..ddc842c55 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/Hash.new-{-hash-key-hash[key]-=-..-}-(Has).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[Hash.new { |${1:hash}, ${2:key}| ${1:hash}[${2:key}] = $0 }]]></content> + <tabTrigger>Hash</tabTrigger> + <scope>source.ruby</scope> + <description>Hash.new { |hash, key| hash[key] = .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/Marshal.dump(obj-file)-(Md).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/Marshal.dump(obj-file)-(Md).sublime-snippet new file mode 100644 index 000000000..0cf039863 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/Marshal.dump(obj-file)-(Md).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[File.open(${1:"${2:path/to/file}.dump"}, "wb") { |${3:file}| Marshal.dump(${4:obj}, ${3:file}) }]]></content> + <tabTrigger>Md</tabTrigger> + <scope>source.ruby</scope> + <description>Marshal.dump(.., file)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/Marshal.load(obj)-(Ml).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/Marshal.load(obj)-(Ml).sublime-snippet new file mode 100644 index 000000000..6a8e0aaa6 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/Marshal.load(obj)-(Ml).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[File.open(${1:"${2:path/to/file}.dump"}, "rb") { |${3:file}| Marshal.load(${3:file}) }]]></content> + <tabTrigger>Ml</tabTrigger> + <scope>source.ruby</scope> + <description>Marshal.load(obj)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/PStore_new(-__-).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/PStore_new(-__-).sublime-snippet new file mode 100644 index 000000000..04f4cb295 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/PStore_new(-__-).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[PStore.new(${1:"${2:file_name.pstore}"})]]></content> + <tabTrigger>Pn-</tabTrigger> + <scope>source.ruby</scope> + <description>PStore.new( .. )</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/RDoc-documentation-block.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/RDoc-documentation-block.sublime-snippet new file mode 100644 index 000000000..91d11933d --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/RDoc-documentation-block.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[`[[ $TM_LINE_INDEX != 0 ]] && echo; echo`=begin rdoc + $0 +=end]]></content> + <tabTrigger>=b</tabTrigger> + <scope>source.ruby</scope> + <description>New Block</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/Wrap-in-Begin-Rescue-End.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/Wrap-in-Begin-Rescue-End.sublime-snippet new file mode 100644 index 000000000..d6f16b386 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/Wrap-in-Begin-Rescue-End.sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <content><![CDATA[${TM_SELECTED_TEXT/([\t ]*).*/$1/m}begin + ${3:${TM_SELECTED_TEXT/(\A.*)|(.+)|\n\z/(?1:$0:(?2:\t$0))/g}} +${TM_SELECTED_TEXT/([\t ]*).*/$1/m}rescue ${1:StandardError}${2/.+/ => /}${2:e} +${TM_SELECTED_TEXT/([\t ]*).*/$1/m} $0 +${TM_SELECTED_TEXT/([\t ]*).*/$1/m}end +]]></content> + <tabTrigger>begin</tabTrigger> + <scope>source.ruby - comment</scope> + <description>begin … rescue … end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/YAML.dump(..-file)-(Yd-).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/YAML.dump(..-file)-(Yd-).sublime-snippet new file mode 100644 index 000000000..a24a9fce6 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/YAML.dump(..-file)-(Yd-).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[File.open(${1:"${2:path/to/file}.yaml"}, "w") { |${3:file}| YAML.dump(${4:obj}, ${3:file}) }]]></content> + <tabTrigger>Yd-</tabTrigger> + <scope>source.ruby</scope> + <description>YAML.dump(.., file)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/YAML.load(file)-(Yl-).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/YAML.load(file)-(Yl-).sublime-snippet new file mode 100644 index 000000000..fd8aa9ff1 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/YAML.load(file)-(Yl-).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[File.open(${1:"${2:path/to/file}.yaml"}) { |${3:file}| YAML.load(${3:file}) }]]></content> + <tabTrigger>Yl-</tabTrigger> + <scope>source.ruby</scope> + <description>YAML.load(file)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/alias_method-..-(am).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/alias_method-..-(am).sublime-snippet new file mode 100644 index 000000000..4a0880f0c --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/alias_method-..-(am).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[alias_method :${1:new_name}, :${0:old_name}]]></content> + <tabTrigger>am</tabTrigger> + <scope>source.ruby</scope> + <description>alias_method ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/all-{-e-..-}-(all).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/all-{-e-..-}-(all).sublime-snippet new file mode 100644 index 000000000..91349803a --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/all-{-e-..-}-(all).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[all? { |${1:e}| $0 }]]></content> + <tabTrigger>all</tabTrigger> + <scope>source.ruby</scope> + <description>all? { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/any-{-e-..-}-(any).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/any-{-e-..-}-(any).sublime-snippet new file mode 100644 index 000000000..74febdad2 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/any-{-e-..-}-(any).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[any? { |${1:e}| $0 }]]></content> + <tabTrigger>any</tabTrigger> + <scope>source.ruby</scope> + <description>any? { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/application_code-..-(app).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/application_code-..-(app).sublime-snippet new file mode 100644 index 000000000..9cf4d03c6 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/application_code-..-(app).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[if __FILE__ == \$PROGRAM_NAME + $0 +end]]></content> + <tabTrigger>app</tabTrigger> + <scope>source.ruby</scope> + <description>application { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert(..)-(as).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert(..)-(as).sublime-snippet new file mode 100644 index 000000000..7bc99d6a5 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert(..)-(as).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert(${1:test}, "${0:Failure message.}")]]></content> + <tabTrigger>as</tabTrigger> + <scope>source.ruby</scope> + <description>assert(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_equal.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_equal.sublime-snippet new file mode 100644 index 000000000..9684581b5 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_equal.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_equal(${1:expected}, ${0:actual})]]></content> + <tabTrigger>ase</tabTrigger> + <scope>source.ruby</scope> + <description>assert_equal(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_in_delta(..)-(asid).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_in_delta(..)-(asid).sublime-snippet new file mode 100644 index 000000000..1e1930da0 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_in_delta(..)-(asid).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_in_delta(${1:expected_float}, ${2:actual_float}, ${0:2 ** -20})]]></content> + <tabTrigger>asid</tabTrigger> + <scope>source.ruby</scope> + <description>assert_in_delta(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_instance_of(..)-(asio).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_instance_of(..)-(asio).sublime-snippet new file mode 100644 index 000000000..b7aa7d8b1 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_instance_of(..)-(asio).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_instance_of(${1:ExpectedClass}, ${0:actual_instance})]]></content> + <tabTrigger>asio</tabTrigger> + <scope>source.ruby</scope> + <description>assert_instance_of(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_kind_of(..)-(asko).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_kind_of(..)-(asko).sublime-snippet new file mode 100644 index 000000000..ce32c810a --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_kind_of(..)-(asko).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_kind_of(${1:ExpectedKind}, ${0:actual_instance})]]></content> + <tabTrigger>asko</tabTrigger> + <scope>source.ruby</scope> + <description>assert_kind_of(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_match(..)-(asm).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_match(..)-(asm).sublime-snippet new file mode 100644 index 000000000..c60a53e6a --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_match(..)-(asm).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_match(/${1:expected_pattern}/, ${0:actual_string})]]></content> + <tabTrigger>asm</tabTrigger> + <scope>source.ruby</scope> + <description>assert_match(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_nil(..)-(asn).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_nil(..)-(asn).sublime-snippet new file mode 100644 index 000000000..6f7ff36a7 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_nil(..)-(asn).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_nil(${0:instance})]]></content> + <tabTrigger>asn</tabTrigger> + <scope>source.ruby</scope> + <description>assert_nil(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_no_match(..)-(asnm).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_no_match(..)-(asnm).sublime-snippet new file mode 100644 index 000000000..04ae873f6 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_no_match(..)-(asnm).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_no_match(/${1:unexpected_pattern}/, ${0:actual_string})]]></content> + <tabTrigger>asnm</tabTrigger> + <scope>source.ruby</scope> + <description>assert_no_match(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_not_equal(..)-(asne).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_not_equal(..)-(asne).sublime-snippet new file mode 100644 index 000000000..e3214f8dc --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_not_equal(..)-(asne).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_not_equal(${1:unexpected}, ${0:actual})]]></content> + <tabTrigger>asne</tabTrigger> + <scope>source.ruby</scope> + <description>assert_not_equal(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_not_nil(..)-(asnn).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_not_nil(..)-(asnn).sublime-snippet new file mode 100644 index 000000000..6e7bcd593 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_not_nil(..)-(asnn).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_not_nil(${0:instance})]]></content> + <tabTrigger>asnn</tabTrigger> + <scope>source.ruby</scope> + <description>assert_not_nil(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_not_same(..)-(asns).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_not_same(..)-(asns).sublime-snippet new file mode 100644 index 000000000..b5c80949e --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_not_same(..)-(asns).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_not_same(${1:unexpected}, ${0:actual})]]></content> + <tabTrigger>asns</tabTrigger> + <scope>source.ruby</scope> + <description>assert_not_same(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_nothing_raised(..)-{-..-}-(asnr).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_nothing_raised(..)-{-..-}-(asnr).sublime-snippet new file mode 100644 index 000000000..369700c90 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_nothing_raised(..)-{-..-}-(asnr).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_nothing_raised(${1:Exception}) { $0 }]]></content> + <tabTrigger>asnr</tabTrigger> + <scope>source.ruby</scope> + <description>assert_nothing_raised(..) { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_nothing_thrown-{-..-}-(asnt).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_nothing_thrown-{-..-}-(asnt).sublime-snippet new file mode 100644 index 000000000..7bd0ef7ac --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_nothing_thrown-{-..-}-(asnt).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_nothing_thrown { $0 }]]></content> + <tabTrigger>asnt</tabTrigger> + <scope>source.ruby</scope> + <description>assert_nothing_thrown { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_operator(..)-(aso).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_operator(..)-(aso).sublime-snippet new file mode 100644 index 000000000..8bcf95228 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_operator(..)-(aso).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_operator(${1:left}, :${2:operator}, ${0:right})]]></content> + <tabTrigger>aso</tabTrigger> + <scope>source.ruby</scope> + <description>assert_operator(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_raise(..)-{-..-}-(asr).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_raise(..)-{-..-}-(asr).sublime-snippet new file mode 100644 index 000000000..a04705d1a --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_raise(..)-{-..-}-(asr).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_raise(${1:Exception}) { $0 }]]></content> + <tabTrigger>asr</tabTrigger> + <scope>source.ruby</scope> + <description>assert_raise(..) { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_respond_to(..)-(asrt).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_respond_to(..)-(asrt).sublime-snippet new file mode 100644 index 000000000..4ff7efb0f --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_respond_to(..)-(asrt).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_respond_to(${1:object}, :${0:method})]]></content> + <tabTrigger>asrt</tabTrigger> + <scope>source.ruby</scope> + <description>assert_respond_to(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_same(..)-(ass).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_same(..)-(ass).sublime-snippet new file mode 100644 index 000000000..3f6e3ab7c --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_same(..)-(ass).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_same(${1:expected}, ${0:actual})]]></content> + <tabTrigger>ass</tabTrigger> + <scope>source.ruby</scope> + <description>assert_same(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_send(..)-(ass).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_send(..)-(ass).sublime-snippet new file mode 100644 index 000000000..cdcb9456d --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_send(..)-(ass).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_send([${1:object}, :${2:message}, ${0:args}])]]></content> + <tabTrigger>ass</tabTrigger> + <scope>source.ruby</scope> + <description>assert_send(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/assert_throws(..)-{-..-}-(ast).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/assert_throws(..)-{-..-}-(ast).sublime-snippet new file mode 100644 index 000000000..a7d9a0217 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/assert_throws(..)-{-..-}-(ast).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[assert_throws(:${1:expected}) { $0 }]]></content> + <tabTrigger>ast</tabTrigger> + <scope>source.ruby</scope> + <description>assert_throws(..) { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/attr_accessor-..-(rw).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/attr_accessor-..-(rw).sublime-snippet new file mode 100644 index 000000000..50d66ebb2 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/attr_accessor-..-(rw).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[attr_accessor :${0:attr_names}]]></content> + <tabTrigger>rw</tabTrigger> + <scope>source.ruby</scope> + <description>attr_accessor ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/attr_reader-..-(r).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/attr_reader-..-(r).sublime-snippet new file mode 100644 index 000000000..cd982fa7a --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/attr_reader-..-(r).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[attr_reader :${0:attr_names}]]></content> + <tabTrigger>r</tabTrigger> + <scope>source.ruby</scope> + <description>attr_reader ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/attr_writer-..-(w).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/attr_writer-..-(w).sublime-snippet new file mode 100644 index 000000000..e5db86800 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/attr_writer-..-(w).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[attr_writer :${0:attr_names}]]></content> + <tabTrigger>w</tabTrigger> + <scope>source.ruby</scope> + <description>attr_writer ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/class-..-DelegateClass-..-initialize-..-end-(class).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/class-..-DelegateClass-..-initialize-..-end-(class).sublime-snippet new file mode 100644 index 000000000..148470076 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/class-..-DelegateClass-..-initialize-..-end-(class).sublime-snippet @@ -0,0 +1,14 @@ +<snippet> + <content><![CDATA[class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} < DelegateClass(${2:ParentClass}) + def initialize${3/(^.*?\S.*)|.*/(?1:\()/}${3:args}${3/(^.*?\S.*)|.*/(?1:\))/} + super(${4:del_obj}) + + $0 + end + + +end]]></content> + <tabTrigger>cla-</tabTrigger> + <scope>source.ruby</scope> + <description>class .. < DelegateClass .. initialize .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/class-..-ParentClass-..-initialize-..-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/class-..-ParentClass-..-initialize-..-end.sublime-snippet new file mode 100644 index 000000000..f06a910fb --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/class-..-ParentClass-..-initialize-..-end.sublime-snippet @@ -0,0 +1,12 @@ +<snippet> + <content><![CDATA[class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} < ${2:ParentClass} + def initialize${3/(^.*?\S.*)|.*/(?1:\()/}${3:args}${3/(^.*?\S.*)|.*/(?1:\))/} + $0 + end + + +end]]></content> + <tabTrigger>cla</tabTrigger> + <scope>source.ruby</scope> + <description>class .. < ParentClass .. initialize .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/class-..-Struct-..-initialize-..-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/class-..-Struct-..-initialize-..-end.sublime-snippet new file mode 100644 index 000000000..486c498a4 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/class-..-Struct-..-initialize-..-end.sublime-snippet @@ -0,0 +1,12 @@ +<snippet> + <content><![CDATA[${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} = Struct.new(:${2:attr_names}) do + def ${3:method_name} + $0 + end + + +end]]></content> + <tabTrigger>cla</tabTrigger> + <scope>source.ruby</scope> + <description>ClassName = Struct .. do .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/class-..-Test;;Unit;;TestCase-..-end-(tc).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/class-..-Test;;Unit;;TestCase-..-end-(tc).sublime-snippet new file mode 100644 index 000000000..f8040815d --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/class-..-Test;;Unit;;TestCase-..-end-(tc).sublime-snippet @@ -0,0 +1,14 @@ +<snippet> + <content><![CDATA[require "test/unit" + +require "${1:library_file_name}" + +class Test${2:${1/([\w&&[^_]]+)|./\u$1/g}} < Test::Unit::TestCase + def test_${3:case_name} + $0 + end +end]]></content> + <tabTrigger>tc</tabTrigger> + <scope>source.ruby</scope> + <description>class .. < Test::Unit::TestCase .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/class-..-end-(cla).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/class-..-end-(cla).sublime-snippet new file mode 100644 index 000000000..301c74193 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/class-..-end-(cla).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} + $0 +end]]></content> + <tabTrigger>cla</tabTrigger> + <scope>source.ruby</scope> + <description>class .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/class-..-initialize-..-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/class-..-initialize-..-end.sublime-snippet new file mode 100644 index 000000000..5479df103 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/class-..-initialize-..-end.sublime-snippet @@ -0,0 +1,12 @@ +<snippet> + <content><![CDATA[class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} + def initialize${2/(^.*?\S.*)|.*/(?1:\()/}${2:args}${2/(^.*?\S.*)|.*/(?1:\))/} + $0 + end + + +end]]></content> + <tabTrigger>cla</tabTrigger> + <scope>source.ruby</scope> + <description>class .. initialize .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/class-..-instance_methods-..-undef-..-initialize-..-end-(class).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/class-..-instance_methods-..-undef-..-initialize-..-end-(class).sublime-snippet new file mode 100644 index 000000000..d230d0540 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/class-..-instance_methods-..-undef-..-initialize-..-end-(class).sublime-snippet @@ -0,0 +1,20 @@ +<snippet> + <content><![CDATA[class ${1:BlankSlate} + instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ } + + def initialize${2/(^.*?\S.*)|.*/(?1:\()/}${2:args}${2/(^.*?\S.*)|.*/(?1:\))/} + @${3:delegate} = ${4:delegate_object} + + $0 + end + + def method_missing(meth, *args, &block) + @${3:delegate}.send(meth, *args, &block) + end + + +end]]></content> + <tabTrigger>cla</tabTrigger> + <scope>source.ruby</scope> + <description>class BlankSlate .. initialize .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/class-self-__-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/class-self-__-end.sublime-snippet new file mode 100644 index 000000000..cd7d84684 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/class-self-__-end.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[class << ${1:self} + $0 +end]]></content> + <tabTrigger>cla</tabTrigger> + <scope>source.ruby</scope> + <description>class << self .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/class_from_name()-(clafn).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/class_from_name()-(clafn).sublime-snippet new file mode 100644 index 000000000..5dd2826cd --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/class_from_name()-(clafn).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[split("::").inject(Object) { |par, const| par.const_get(const) }]]></content> + <tabTrigger>clafn</tabTrigger> + <scope>source.ruby</scope> + <description>class_from_name()</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/classify-{-e-..-}-(clas).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/classify-{-e-..-}-(clas).sublime-snippet new file mode 100644 index 000000000..635d80a45 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/classify-{-e-..-}-(clas).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[classify { |${1:e}| $0 }]]></content> + <tabTrigger>cl</tabTrigger> + <scope>source.ruby</scope> + <description>classify { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/collect-{-e-..-}-(col).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/collect-{-e-..-}-(col).sublime-snippet new file mode 100644 index 000000000..c020dbcb9 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/collect-{-e-..-}-(col).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[collect { |${1:e}| $0 }]]></content> + <tabTrigger>col</tabTrigger> + <scope>source.ruby</scope> + <description>collect { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/deep_copy(..)-(dee).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/deep_copy(..)-(dee).sublime-snippet new file mode 100644 index 000000000..79d45738e --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/deep_copy(..)-(dee).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[Marshal.load(Marshal.dump(${0:obj_to_copy}))]]></content> + <tabTrigger>deec</tabTrigger> + <scope>source.ruby</scope> + <description>deep_copy(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/def-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/def-end.sublime-snippet new file mode 100644 index 000000000..cef21b680 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/def-end.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[def ${1:method_name} + $0 +end]]></content> + <tabTrigger>def</tabTrigger> + <scope>source.ruby</scope> + <description>def … end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/def-method_missing-..-end-(mm).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/def-method_missing-..-end-(mm).sublime-snippet new file mode 100644 index 000000000..6a8a07fbc --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/def-method_missing-..-end-(mm).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[def method_missing(meth, *args, &blk) + $0 +end]]></content> + <tabTrigger>defmm</tabTrigger> + <scope>source.ruby</scope> + <description>def method_missing .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/def-self-..-end-(defs).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/def-self-..-end-(defs).sublime-snippet new file mode 100644 index 000000000..6b8a20798 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/def-self-..-end-(defs).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[def self.${1:class_method_name} + $0 +end]]></content> + <tabTrigger>defs</tabTrigger> + <scope>source.ruby</scope> + <description>def self .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/def-test_-..-end-(t).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/def-test_-..-end-(t).sublime-snippet new file mode 100644 index 000000000..d105f739e --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/def-test_-..-end-(t).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[def test_${1:case_name} + $0 +end]]></content> + <tabTrigger>deft</tabTrigger> + <scope>source.ruby</scope> + <description>def test_ .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/def_delegator-..-(defd).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/def_delegator-..-(defd).sublime-snippet new file mode 100644 index 000000000..c61eb052b --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/def_delegator-..-(defd).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[def_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name}]]></content> + <tabTrigger>defd</tabTrigger> + <scope>source.ruby</scope> + <description>def_delegator ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/def_delegators-..-(defds).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/def_delegators-..-(defds).sublime-snippet new file mode 100644 index 000000000..265b2ad17 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/def_delegators-..-(defds).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[def_delegators :${1:@del_obj}, :${0:del_methods}]]></content> + <tabTrigger>defds</tabTrigger> + <scope>source.ruby</scope> + <description>def_delegators ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/def_initialize.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/def_initialize.sublime-snippet new file mode 100644 index 000000000..e56e50bb2 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/def_initialize.sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <content><![CDATA[ +def initialize(${1:options}) + @${1/,\s*/, @/g} = $1 +end +]]> + </content> + <tabTrigger>defi</tabTrigger> + <scope>source.ruby</scope> + <description>def initialize ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/delete_if-{-e-..-}-(deli).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/delete_if-{-e-..-}-(deli).sublime-snippet new file mode 100644 index 000000000..5b93969e7 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/delete_if-{-e-..-}-(deli).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[delete_if { |${1:e}| $0 }]]></content> + <tabTrigger>deli</tabTrigger> + <scope>source.ruby</scope> + <description>delete_if { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/detect-{-e-..-}-(det).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/detect-{-e-..-}-(det).sublime-snippet new file mode 100644 index 000000000..a4596d23f --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/detect-{-e-..-}-(det).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[detect { |${1:e}| $0 }]]></content> + <tabTrigger>det</tabTrigger> + <scope>source.ruby</scope> + <description>detect { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/directory().sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/directory().sublime-snippet new file mode 100644 index 000000000..de6db85b4 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/directory().sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[File.dirname(__FILE__)]]></content> + <tabTrigger>dir</tabTrigger> + <scope>source.ruby</scope> + <description>directory()</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/do-obj-..-end-(doo).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/do-obj-..-end-(doo).sublime-snippet new file mode 100644 index 000000000..c01041dd6 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/do-obj-..-end-(doo).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[do${1/(^.+$)|^$/(?1: |)/}${1:variable}${1/(^.+$)|^$/(?1:|)/} + $0 +end]]></content> + <tabTrigger>dob</tabTrigger> + <scope>source.ruby</scope> + <description>Insert do |variable| … end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/downto(0)-{-n-..-}-(dow).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/downto(0)-{-n-..-}-(dow).sublime-snippet new file mode 100644 index 000000000..5bca0b7c1 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/downto(0)-{-n-..-}-(dow).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[downto(${1:0}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:n}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>dow</tabTrigger> + <scope>source.ruby</scope> + <description>downto(0) { |n| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each-{-e-..-}-(ea).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each-{-e-..-}-(ea).sublime-snippet new file mode 100644 index 000000000..a084ccec0 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each-{-e-..-}-(ea).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each { |${1:e}| $0 }]]></content> + <tabTrigger>ea</tabTrigger> + <scope>source.ruby</scope> + <description>each { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_byte-{-byte-..-}-(eab).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_byte-{-byte-..-}-(eab).sublime-snippet new file mode 100644 index 000000000..3feadcc02 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_byte-{-byte-..-}-(eab).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_byte { |${1:byte}| $0 }]]></content> + <tabTrigger>eab</tabTrigger> + <scope>source.ruby</scope> + <description>each_byte { |byte| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_char-{-chr-..-}-(eac-).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_char-{-chr-..-}-(eac-).sublime-snippet new file mode 100644 index 000000000..f0e43bfe9 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_char-{-chr-..-}-(eac-).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_char { |${1:chr}| $0 }]]></content> + <tabTrigger>eac-</tabTrigger> + <scope>source.ruby</scope> + <description>each_char { |chr| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_cons(..)-{-group-..-}-(eac-).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_cons(..)-{-group-..-}-(eac-).sublime-snippet new file mode 100644 index 000000000..0d3ea6ff1 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_cons(..)-{-group-..-}-(eac-).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_cons(${1:2}) { |${2:group}| $0 }]]></content> + <tabTrigger>eac-</tabTrigger> + <scope>source.ruby</scope> + <description>each_cons(..) { |group| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_index-{-i-..-}-(eai).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_index-{-i-..-}-(eai).sublime-snippet new file mode 100644 index 000000000..78a552df5 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_index-{-i-..-}-(eai).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_index { |${1:i}| $0 }]]></content> + <tabTrigger>eai</tabTrigger> + <scope>source.ruby</scope> + <description>each_index { |i| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_key-{-key-..-}-(eak).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_key-{-key-..-}-(eak).sublime-snippet new file mode 100644 index 000000000..ec7114ff3 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_key-{-key-..-}-(eak).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_key { |${1:key}| $0 }]]></content> + <tabTrigger>eak</tabTrigger> + <scope>source.ruby</scope> + <description>each_key { |key| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_line-{-line-..-}-(eal).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_line-{-line-..-}-(eal).sublime-snippet new file mode 100644 index 000000000..e9932409e --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_line-{-line-..-}-(eal).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_line$1 { |${2:line}| $0 }]]></content> + <tabTrigger>eal</tabTrigger> + <scope>source.ruby</scope> + <description>each_line { |line| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_pair-{-name-val-..-}-(eap).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_pair-{-name-val-..-}-(eap).sublime-snippet new file mode 100644 index 000000000..f188943da --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_pair-{-name-val-..-}-(eap).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_pair { |${1:name}, ${2:val}| $0 }]]></content> + <tabTrigger>eap</tabTrigger> + <scope>source.ruby</scope> + <description>each_pair { |name, val| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_slice-{-group-..-}-(eas).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_slice-{-group-..-}-(eas).sublime-snippet new file mode 100644 index 000000000..ae10c629a --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_slice-{-group-..-}-(eas).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_slice(${1:2}) { |${2:group}| $0 }]]></content> + <tabTrigger>eas-</tabTrigger> + <scope>source.ruby</scope> + <description>each_slice(..) { |group| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_value-{-val-..-}-(eav).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_value-{-val-..-}-(eav).sublime-snippet new file mode 100644 index 000000000..ebeea857b --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_value-{-val-..-}-(eav).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_value { |${1:val}| $0 }]]></content> + <tabTrigger>eav</tabTrigger> + <scope>source.ruby</scope> + <description>each_value { |val| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/each_with_index-{-e-i-..-}-(eawi).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/each_with_index-{-e-i-..-}-(eawi).sublime-snippet new file mode 100644 index 000000000..c4fa43391 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/each_with_index-{-e-i-..-}-(eawi).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[each_with_index { |${1:e}, ${2:i}| $0 }]]></content> + <tabTrigger>eawi</tabTrigger> + <scope>source.ruby</scope> + <description>each_with_index { |e, i| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/elsif-___.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/elsif-___.sublime-snippet new file mode 100644 index 000000000..3f6ca4be6 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/elsif-___.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[elsif ${1:condition} + $0]]></content> + <tabTrigger>elsif</tabTrigger> + <scope>source.ruby</scope> + <description>elsif ...</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/extend-Forwardable-(Forw).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/extend-Forwardable-(Forw).sublime-snippet new file mode 100644 index 000000000..79935ddd5 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/extend-Forwardable-(Forw).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[extend Forwardable]]></content> + <tabTrigger>Forw-</tabTrigger> + <scope>source.ruby</scope> + <description>extend Forwardable</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/fetch(name)-{-key-..-}-(fet).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/fetch(name)-{-key-..-}-(fet).sublime-snippet new file mode 100644 index 000000000..5c860f0c0 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/fetch(name)-{-key-..-}-(fet).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[fetch(${1:name}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:key}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>fet</tabTrigger> + <scope>source.ruby</scope> + <description>fetch(name) { |key| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/fill(range)-{-i-..-}-(fil).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/fill(range)-{-i-..-}-(fil).sublime-snippet new file mode 100644 index 000000000..0ddd41f2f --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/fill(range)-{-i-..-}-(fil).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[fill(${1:range}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:i}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>fil</tabTrigger> + <scope>source.ruby</scope> + <description>fill(range) { |i| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/find-{-e-..-}-(fin).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/find-{-e-..-}-(fin).sublime-snippet new file mode 100644 index 000000000..ed7576345 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/find-{-e-..-}-(fin).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[find { |${1:e}| $0 }]]></content> + <tabTrigger>fin</tabTrigger> + <scope>source.ruby</scope> + <description>find { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/find_all-{-e-..-}-(fina).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/find_all-{-e-..-}-(fina).sublime-snippet new file mode 100644 index 000000000..9947ef102 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/find_all-{-e-..-}-(fina).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[find_all { |${1:e}| $0 }]]></content> + <tabTrigger>fina</tabTrigger> + <scope>source.ruby</scope> + <description>find_all { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/flatten_once-(fla).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/flatten_once-(fla).sublime-snippet new file mode 100644 index 000000000..37506c923 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/flatten_once-(fla).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[inject(Array.new) { |${1:arr}, ${2:a}| ${1:arr}.push(*${2:a}) }]]></content> + <tabTrigger>flao</tabTrigger> + <scope>source.ruby</scope> + <description>flatten_once()</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/flunk(..)-(fl).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/flunk(..)-(fl).sublime-snippet new file mode 100644 index 000000000..1d1316640 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/flunk(..)-(fl).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[flunk("${0:Failure message.}")]]></content> + <tabTrigger>fl</tabTrigger> + <scope>source.ruby</scope> + <description>flunk(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/grep(;pattern;)-{-match-..-}-(gre).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/grep(;pattern;)-{-match-..-}-(gre).sublime-snippet new file mode 100644 index 000000000..ecc21ca2d --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/grep(;pattern;)-{-match-..-}-(gre).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[grep(${1:/${2:pattern}/}) { |${3:match}| $0 }]]></content> + <tabTrigger>gre</tabTrigger> + <scope>source.ruby</scope> + <description>grep(/pattern/) { |match| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/gsub(;..;)-{-match-..-}-(gsu).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/gsub(;..;)-{-match-..-}-(gsu).sublime-snippet new file mode 100644 index 000000000..68c2df6d4 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/gsub(;..;)-{-match-..-}-(gsu).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[gsub(/${1:pattern}/) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:match}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>gsu</tabTrigger> + <scope>source.ruby</scope> + <description>gsub(/../) { |match| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/hash-pair-(-).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/hash-pair-(-).sublime-snippet new file mode 100644 index 000000000..b9dc87e74 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/hash-pair-(-).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[:${1:key} => ${2:"${3:value}"}${4:, }]]></content> + <tabTrigger>:</tabTrigger> + <scope>source.ruby</scope> + <description>Hash Pair — :key => "value"</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/include-Comparable-..-(Comp).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/include-Comparable-..-(Comp).sublime-snippet new file mode 100644 index 000000000..aa25db03c --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/include-Comparable-..-(Comp).sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[include Comparable + +def <=>(other) + $0 +end]]></content> + <tabTrigger>Comp</tabTrigger> + <scope>source.ruby</scope> + <description>include Comparable ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/include-Enumerable-..-(Enum).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/include-Enumerable-..-(Enum).sublime-snippet new file mode 100644 index 000000000..0cef29cb8 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/include-Enumerable-..-(Enum).sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[include Enumerable + +def each(&block) + $0 +end]]></content> + <tabTrigger>Enum</tabTrigger> + <scope>source.ruby</scope> + <description>include Enumerable ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/inject(init)-{-mem-var-..-}-(inj).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/inject(init)-{-mem-var-..-}-(inj).sublime-snippet new file mode 100644 index 000000000..c1d22973d --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/inject(init)-{-mem-var-..-}-(inj).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[inject${1/.+/(/}${1:init}${1/.+/)/} { |${2:mem}, ${3:var}| $0 }]]></content> + <tabTrigger>inj</tabTrigger> + <scope>source.ruby</scope> + <description>inject(init) { |mem, var| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/lambda-{-args-..-}-(lam).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/lambda-{-args-..-}-(lam).sublime-snippet new file mode 100644 index 000000000..1f38b36e4 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/lambda-{-args-..-}-(lam).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[lambda { ${1/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${1:args}${1/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>lam</tabTrigger> + <scope>source.ruby</scope> + <description>lambda { |args| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/loop-{-__-}.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/loop-{-__-}.sublime-snippet new file mode 100644 index 000000000..5d5c71743 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/loop-{-__-}.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[loop { $0 }]]></content> + <tabTrigger>loo</tabTrigger> + <scope>source.ruby</scope> + <description>loop { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/map-{-e-..-}-(map).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/map-{-e-..-}-(map).sublime-snippet new file mode 100644 index 000000000..b2a69ae6c --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/map-{-e-..-}-(map).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[map { |${1:e}| $0 }]]></content> + <tabTrigger>map</tabTrigger> + <scope>source.ruby</scope> + <description>map { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/map_with_index-{-e-i-..-}-(mapwi).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/map_with_index-{-e-i-..-}-(mapwi).sublime-snippet new file mode 100644 index 000000000..cdd8a650d --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/map_with_index-{-e-i-..-}-(mapwi).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[enum_with_index.map { |${1:e}, ${2:i}| $0 }]]></content> + <tabTrigger>mapwi-</tabTrigger> + <scope>source.ruby</scope> + <description>map_with_index { |e, i| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/max-{-a-b-..-}-(max).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/max-{-a-b-..-}-(max).sublime-snippet new file mode 100644 index 000000000..ef08b3cb7 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/max-{-a-b-..-}-(max).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[max { |a, b| $0 }]]></content> + <tabTrigger>max</tabTrigger> + <scope>source.ruby</scope> + <description>max { |a, b| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/min-{-a-b-..-}-(min).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/min-{-a-b-..-}-(min).sublime-snippet new file mode 100644 index 000000000..380ad302e --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/min-{-a-b-..-}-(min).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[min { |a, b| $0 }]]></content> + <tabTrigger>min</tabTrigger> + <scope>source.ruby</scope> + <description>min { |a, b| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/module-..-ClassMethods-..-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/module-..-ClassMethods-..-end.sublime-snippet new file mode 100644 index 000000000..3ef867ac9 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/module-..-ClassMethods-..-end.sublime-snippet @@ -0,0 +1,19 @@ +<snippet> + <content><![CDATA[module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} + module ClassMethods + $0 + end + + module InstanceMethods + + end + + def self.included(receiver) + receiver.extend ClassMethods + receiver.send :include, InstanceMethods + end +end]]></content> + <tabTrigger>mod</tabTrigger> + <scope>source.ruby</scope> + <description>module .. ClassMethods .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/module-..-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/module-..-end.sublime-snippet new file mode 100644 index 000000000..16f2f2a9d --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/module-..-end.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} + $0 +end]]></content> + <tabTrigger>mod</tabTrigger> + <scope>source.ruby</scope> + <description>module .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/module-..-module_function-..-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/module-..-module_function-..-end.sublime-snippet new file mode 100644 index 000000000..0e2b02826 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/module-..-module_function-..-end.sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} + module_function + + $0 +end]]></content> + <tabTrigger>mod</tabTrigger> + <scope>source.ruby</scope> + <description>module .. module_function .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/namespace-__-do-__-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/namespace-__-do-__-end.sublime-snippet new file mode 100644 index 000000000..35a81be8d --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/namespace-__-do-__-end.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[namespace :${1:${TM_FILENAME/\.\w+//}} do + $0 +end]]></content> + <tabTrigger>nam</tabTrigger> + <scope>source.ruby</scope> + <description>namespace :.. do .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/open(-path;or;url-w-)-do-doc-..-end-(ope).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/open(-path;or;url-w-)-do-doc-..-end-(ope).sublime-snippet new file mode 100644 index 000000000..11041b186 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/open(-path;or;url-w-)-do-doc-..-end-(ope).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[open(${1:"${2:path/or/url/or/pipe}"}${3/(^[rwab+]+$)|.*/(?1:, ")/}${3:w}${3/(^[rwab+]+$)|.*/(?1:")/}) { |${4:io}| $0 }]]></content> + <tabTrigger>ope</tabTrigger> + <scope>source.ruby</scope> + <description>open("path/or/url", "w") { |io| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/open-yield-block-({).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/open-yield-block-({).sublime-snippet new file mode 100644 index 000000000..155231fde --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/open-yield-block-({).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[{ ${1/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${1:variable}${1/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}${2:$TM_SELECTED_TEXT} ]]></content> + <tabTrigger>{</tabTrigger> + <scope>source.ruby - string - comment</scope> + <description>Insert { |variable| … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/option_parse-{-..-}-(optp).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/option_parse-{-..-}-(optp).sublime-snippet new file mode 100644 index 000000000..a8d0488ab --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/option_parse-{-..-}-(optp).sublime-snippet @@ -0,0 +1,32 @@ +<snippet> + <content><![CDATA[require "optparse" + +options = {${1::default => "args"}} + +ARGV.options do |opts| + opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)} [OPTIONS]${2/^\s*$|(.*\S.*)/(?1: )/}${2:OTHER_ARGS}" + + opts.separator "" + opts.separator "Specific Options:" + + $0 + + opts.separator "Common Options:" + + opts.on( "-h", "--help", "Show this message." ) do + puts opts + exit + end + + begin + opts.parse! + rescue + puts opts + exit + end +end +]]></content> + <tabTrigger>optp</tabTrigger> + <scope>source.ruby</scope> + <description>option_parse { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/partition-{-e-..-}-(par).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/partition-{-e-..-}-(par).sublime-snippet new file mode 100644 index 000000000..b329117cf --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/partition-{-e-..-}-(par).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[partition { |${1:e}| $0 }]]></content> + <tabTrigger>par</tabTrigger> + <scope>source.ruby</scope> + <description>partition { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/path_from_here(-__-).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/path_from_here(-__-).sublime-snippet new file mode 100644 index 000000000..acb883593 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/path_from_here(-__-).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[File.join(File.dirname(__FILE__), *%w[${1:rel path here}])]]></content> + <tabTrigger>patfh</tabTrigger> + <scope>source.ruby</scope> + <description>path_from_here( .. )</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/randomize-(ran).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/randomize-(ran).sublime-snippet new file mode 100644 index 000000000..d62d644ca --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/randomize-(ran).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[sort_by { rand }]]></content> + <tabTrigger>ran</tabTrigger> + <scope>source.ruby</scope> + <description>randomize()</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/reject-{-e-..-}-(rej).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/reject-{-e-..-}-(rej).sublime-snippet new file mode 100644 index 000000000..2a0a3ba61 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/reject-{-e-..-}-(rej).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[reject { |${1:e}| $0 }]]></content> + <tabTrigger>rej</tabTrigger> + <scope>source.ruby</scope> + <description>reject { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/require-..-(req).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/require-..-(req).sublime-snippet new file mode 100644 index 000000000..0d69ff8ea --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/require-..-(req).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[require "$0"]]></content> + <tabTrigger>req</tabTrigger> + <scope>source.ruby</scope> + <description>require ".."</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/require-tc_..-..-(ts).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/require-tc_..-..-(ts).sublime-snippet new file mode 100644 index 000000000..435ec0f10 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/require-tc_..-..-(ts).sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[require "test/unit" + +require "tc_${1:test_case_file}" +require "tc_${2:test_case_file}" +]]></content> + <tabTrigger>ts</tabTrigger> + <scope>source.ruby</scope> + <description>require "tc_.." ..</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/require_gem-__.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/require_gem-__.sublime-snippet new file mode 100644 index 000000000..10022c63e --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/require_gem-__.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[require "$0"]]></content> + <tabTrigger>reqg-</tabTrigger> + <scope>source.ruby</scope> + <description>require_gem ".."</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/results_report(__)-{-__-}.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/results_report(__)-{-__-}.sublime-snippet new file mode 100644 index 000000000..fb52605b3 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/results_report(__)-{-__-}.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[results.report("${1:name}:") { TESTS.times { $0 } }]]></content> + <tabTrigger>rep</tabTrigger> + <scope>source.ruby</scope> + <description>results.report(..) { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/reverse_each-{-e-..-}-(rea).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/reverse_each-{-e-..-}-(rea).sublime-snippet new file mode 100644 index 000000000..a738d8e94 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/reverse_each-{-e-..-}-(rea).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[reverse_each { |${1:e}| $0 }]]></content> + <tabTrigger>reve</tabTrigger> + <scope>source.ruby</scope> + <description>reverse_each { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/scan(;..;)-{-match-..-}-(sca).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/scan(;..;)-{-match-..-}-(sca).sublime-snippet new file mode 100644 index 000000000..d7be74184 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/scan(;..;)-{-match-..-}-(sca).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[scan(/${1:pattern}/) { |${2:match}| $0 }]]></content> + <tabTrigger>sca</tabTrigger> + <scope>source.ruby</scope> + <description>scan(/../) { |match| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/select-{-e-..-}-(sel).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/select-{-e-..-}-(sel).sublime-snippet new file mode 100644 index 000000000..ad179b04a --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/select-{-e-..-}-(sel).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[select { |${1:e}| $0 }]]></content> + <tabTrigger>sel</tabTrigger> + <scope>source.ruby</scope> + <description>select { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/service_object.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/service_object.sublime-snippet new file mode 100644 index 000000000..86b4cd89f --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/service_object.sublime-snippet @@ -0,0 +1,19 @@ +<snippet> +<content><![CDATA[class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} + def self.call(*args) + new(*args).call + end + + def initialize(${2:options}) + @${2/,\s*/, @/g} = $2 + end + + def call + $0 + end +end]]> +</content> + <tabTrigger>cla</tabTrigger> + <scope>source.ruby</scope> + <description>Service Object skeleton</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/singleton_class().sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/singleton_class().sublime-snippet new file mode 100644 index 000000000..71928c8e3 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/singleton_class().sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[class << self; self end]]></content> + <tabTrigger>sinc</tabTrigger> + <scope>source.ruby</scope> + <description>singleton_class()</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/sort-{-a-b-..-}-(sor).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/sort-{-a-b-..-}-(sor).sublime-snippet new file mode 100644 index 000000000..60654decc --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/sort-{-a-b-..-}-(sor).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[sort { |a, b| $0 }]]></content> + <tabTrigger>sor</tabTrigger> + <scope>source.ruby</scope> + <description>sort { |a, b| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/sort_by-{-e-..-}-(sorb).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/sort_by-{-e-..-}-(sorb).sublime-snippet new file mode 100644 index 000000000..5a3ed0713 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/sort_by-{-e-..-}-(sorb).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[sort_by { |${1:e}| $0 }]]></content> + <tabTrigger>sorb</tabTrigger> + <scope>source.ruby</scope> + <description>sort_by { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/step(2)-{-e-..-}-(ste).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/step(2)-{-e-..-}-(ste).sublime-snippet new file mode 100644 index 000000000..1e601a89f --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/step(2)-{-e-..-}-(ste).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[step(${1:2}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:n}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>ste</tabTrigger> + <scope>source.ruby</scope> + <description>step(2) { |e| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/sub(;..;)-{-match-..-}-(sub).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/sub(;..;)-{-match-..-}-(sub).sublime-snippet new file mode 100644 index 000000000..239e9c443 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/sub(;..;)-{-match-..-}-(sub).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[sub(/${1:pattern}/) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:match}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>sub</tabTrigger> + <scope>source.ruby</scope> + <description>sub(/../) { |match| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/task-task_name-=-[-dependent-tasks]-do-__-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/task-task_name-=-[-dependent-tasks]-do-__-end.sublime-snippet new file mode 100644 index 000000000..8c93286d0 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/task-task_name-=-[-dependent-tasks]-do-__-end.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[desc "${1:Task description}" +task :${2:${3:task_name} => ${4:[:${5:dependent, :tasks}]}} do + $0 +end]]></content> + <tabTrigger>tas</tabTrigger> + <scope>source.ruby</scope> + <description>task :task_name => [:dependent, :tasks] do .. end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/times-{-n-..-}-(tim).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/times-{-n-..-}-(tim).sublime-snippet new file mode 100644 index 000000000..1589cea67 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/times-{-n-..-}-(tim).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[times { ${1/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${1:n}${1/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>tim</tabTrigger> + <scope>source.ruby</scope> + <description>times { |n| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/transaction(-__-)-do-__-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/transaction(-__-)-do-__-end.sublime-snippet new file mode 100644 index 000000000..0d78497bb --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/transaction(-__-)-do-__-end.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[transaction${1/(^.*?\S.*)|.*/(?1:\()/}${1:true}${1/(^.*?\S.*)|.*/(?1:\))/} { $0 }]]></content> + <tabTrigger>tra</tabTrigger> + <scope>source.ruby</scope> + <description>transaction( .. ) { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/unix_filter-..-(uni).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/unix_filter-..-(uni).sublime-snippet new file mode 100644 index 000000000..f726bfb2c --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/unix_filter-..-(uni).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[ARGF.each_line$1 do |${2:line}| + $0 +end]]></content> + <tabTrigger>unif</tabTrigger> + <scope>source.ruby</scope> + <description>unix_filter { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/unless-(unless).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/unless-(unless).sublime-snippet new file mode 100644 index 000000000..f15b2f9f2 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/unless-(unless).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[unless ${1:condition} + $0 +end]]></content> + <tabTrigger>unless</tabTrigger> + <scope>source.ruby</scope> + <description>unless … end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/until-___-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/until-___-end.sublime-snippet new file mode 100644 index 000000000..37acff7f8 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/until-___-end.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[until ${1:condition} + $0 +end]]></content> + <tabTrigger>until</tabTrigger> + <scope>source.ruby</scope> + <description>until ... end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/untitled.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/untitled.sublime-snippet new file mode 100644 index 000000000..39a4116e6 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/untitled.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[opts.on( "-${1:o}", "--${2:long-option-name}"${3/^\s*$|(.*\S.*)/(?1:, )/}${3:String}, + "${4:Option description.}" ) do |${6:opt}| + $0 +end]]></content> + <tabTrigger>opt</tabTrigger> + <scope>source.ruby</scope> + <description>option(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/upto(1.0;0.0)-{-n-..-}-(upt).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/upto(1.0;0.0)-{-n-..-}-(upt).sublime-snippet new file mode 100644 index 000000000..5ca4cb973 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/upto(1.0;0.0)-{-n-..-}-(upt).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[upto(${1:1.0/0.0}) { ${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}${2:n}${2/(^(?<var>\s*(?:\*|\*?[a-z_])[a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:| )/}$0 }]]></content> + <tabTrigger>upt</tabTrigger> + <scope>source.ruby</scope> + <description>upto(1.0/0.0) { |n| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/usage_if()-(usai).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/usage_if()-(usai).sublime-snippet new file mode 100644 index 000000000..6614eaad5 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/usage_if()-(usai).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[if ARGV.$1 + abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}" +end]]></content> + <tabTrigger>usai</tabTrigger> + <scope>source.ruby</scope> + <description>usage_if()</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/usage_unless()-(usau).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/usage_unless()-(usau).sublime-snippet new file mode 100644 index 000000000..8e2492004 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/usage_unless()-(usau).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[unless ARGV.$1 + abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}" +end]]></content> + <tabTrigger>usau</tabTrigger> + <scope>source.ruby</scope> + <description>usage_unless()</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/when.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/when.sublime-snippet new file mode 100644 index 000000000..2d41eb8e9 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/when.sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[when ${1:condition} + $0]]></content> + <tabTrigger>when</tabTrigger> + <scope>source.ruby</scope> + <description>when …</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/while-___-end.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/while-___-end.sublime-snippet new file mode 100644 index 000000000..cc3fa6954 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/while-___-end.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[while ${1:condition} + $0 +end]]></content> + <tabTrigger>while</tabTrigger> + <scope>source.ruby</scope> + <description>while ... end</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/xmlread(__).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/xmlread(__).sublime-snippet new file mode 100644 index 000000000..605b6390f --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/xmlread(__).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[REXML::Document.new(File.read(${1:"${2:path/to/file}"}))]]></content> + <tabTrigger>xml-</tabTrigger> + <scope>source.ruby</scope> + <description>xmlread(..)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/xpath(__)-{-__-}.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/xpath(__)-{-__-}.sublime-snippet new file mode 100644 index 000000000..917b0a501 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/xpath(__)-{-__-}.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[elements.each(${1:"${2://XPath}"}) do |${3:node}| + $0 +end]]></content> + <tabTrigger>xpa</tabTrigger> + <scope>source.ruby</scope> + <description>xpath(..) { .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/yields-RDoc-comment.sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/yields-RDoc-comment.sublime-snippet new file mode 100644 index 000000000..183ec0f6f --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/yields-RDoc-comment.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[ :yields: ${0:arguments}]]></content> + <tabTrigger>y</tabTrigger> + <scope>source.ruby comment</scope> + <description>:yields:</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Snippets/zip(enums)-{-row-..-}-(zip).sublime-snippet b/assets/syntaxes/Packages/Ruby/Snippets/zip(enums)-{-row-..-}-(zip).sublime-snippet new file mode 100644 index 000000000..3b9d54a9a --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Snippets/zip(enums)-{-row-..-}-(zip).sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[zip(${1:enums}) { |${2:row}| $0 }]]></content> + <tabTrigger>zip</tabTrigger> + <scope>source.ruby</scope> + <description>zip(enums) { |row| .. }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Ruby/Symbols - Classes - Modules.tmPreferences b/assets/syntaxes/Packages/Ruby/Symbols - Classes - Modules.tmPreferences new file mode 100644 index 000000000..a224065bb --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Symbols - Classes - Modules.tmPreferences @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>scope</key> + <string>source.ruby entity.name.class, source.ruby entity.name.module</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>showInIndexedSymbolList</key> + <integer>1</integer> + <key>symbolIndexTransformation</key> + <string>/^(::)?([[:alnum:]_]+::)*//;</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Ruby/Symbols - Methods.tmPreferences b/assets/syntaxes/Packages/Ruby/Symbols - Methods.tmPreferences new file mode 100644 index 000000000..3bb7e94aa --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/Symbols - Methods.tmPreferences @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>scope</key> + <string>source.ruby entity.name.function</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>showInIndexedSymbolList</key> + <integer>1</integer> + <key>symbolIndexTransformation</key> + <string>/^([[:alnum:]_]+(::|\.))*//;</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Ruby/syntax_test_ruby.rb b/assets/syntaxes/Packages/Ruby/syntax_test_ruby.rb new file mode 100644 index 000000000..9262e1b45 --- /dev/null +++ b/assets/syntaxes/Packages/Ruby/syntax_test_ruby.rb @@ -0,0 +1,1293 @@ +# SYNTAX TEST "Packages/Ruby/Ruby.sublime-syntax" + +################## +# block comments +################## + +=begin +#<- comment.block.documentation.ruby punctuation.definition.comment.begin.ruby +#^^^^^ comment.block.documentation.ruby punctuation.definition.comment.begin.ruby + =end +# ^^^^^ comment.block.documentation.ruby - punctuation +=end +#<- comment.block.documentation.ruby punctuation.definition.comment.end.ruby +#^^^ comment.block.documentation.ruby punctuation.definition.comment.end.ruby + +################## +# line comments +################## + +## comment +#<- comment.line.number-sign.ruby punctuation.definition.comment.ruby +#^ comment.line.number-sign.ruby punctuation.definition.comment.ruby +# ^^^^^^^^ comment.line.number-sign.ruby - punctuation + + ## comment +#^ - comment - punctuation +# ^^ comment.line.number-sign.ruby punctuation.definition.comment.ruby +# ^^^^^^^^^ comment.line.number-sign.ruby - punctuation + +################## +# Heredocs +################## + +# HEREDOC with indented end tag containing an interpolated string +puts <<~EOF; # comment +#^^^^ - meta.string - string.unquoted +# ^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby +# ^ punctuation.terminator.statement.ruby - meta.string - string +# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby - meta.string - string + Indented string! +# ^^^^^^^^^^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby + #{ sym } #@var +# ^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation +# ^^^^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby +# ^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation +# ^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby variable.other.readwrite.instance.ruby +# ^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation +# ^^ punctuation.section.interpolation.begin.ruby +# ^^^^^ source.ruby.embedded.ruby +# ^ punctuation.section.interpolation.end.ruby +# ^^ punctuation.definition.variable.ruby +# ^^^^^ variable.other.readwrite.instance.ruby + EOF +# ^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +# HEREDOC with indented end tag containing a plain string +puts <<~'EOF'; # comment +#^^^^ - meta.string - string.unquoted +# ^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby +# ^ punctuation.terminator.statement.ruby - meta.string - string +# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby - meta.string - string + Indented string! +# ^^^^^^^^^^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby + #{ sym } #@var +# ^^^^^^^^^^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation + EOF +# ^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +# HEREDOC with unindented end tag containing an interpolated string +puts <<EOF; # comment +#^^^^ - meta.string - string.unquoted +# ^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby +# ^ punctuation.terminator.statement.ruby - meta.string - string +# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby - meta.string - string + Indented string! +# ^^^^^^^^^^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby + #{ sym } #@var +# ^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation +# ^^^^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby +# ^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation +# ^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby variable.other.readwrite.instance.ruby +# ^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation +# ^^ punctuation.section.interpolation.begin.ruby +# ^^^^^ source.ruby.embedded.ruby +# ^ punctuation.section.interpolation.end.ruby +# ^^ punctuation.definition.variable.ruby +# ^^^^^ variable.other.readwrite.instance.ruby + EOF +#^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby +EOF +#^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +# HEREDOC with unindented end tag containing a plain string +puts <<'EOF'; # comment +#^^^^ - meta.string - string.unquoted +# ^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby +# ^ punctuation.terminator.statement.ruby - meta.string - string +# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby - meta.string - string + Indented string! +# ^^^^^^^^^^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby + #{ sym } #@var +# ^^^^^^^^^^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation + EOF +#^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby +EOF +#^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +puts <<-HTML; # comment +#^^^^ - meta.string - string.unquoted +# ^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby +# ^ punctuation.terminator.statement.ruby - meta.string +# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby - meta.string - string + <body> +# ^^^^^^ meta.string.heredoc.ruby text.html.embedded.ruby meta.tag.structure + #{ sym } #@var +# ^ meta.string.heredoc.ruby text.html.embedded.ruby - meta.interpolation +# ^^^^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby +# ^ meta.string.heredoc.ruby text.html.embedded.ruby - meta.interpolation +# ^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby variable.other.readwrite.instance.ruby +# ^ meta.string.heredoc.ruby text.html.embedded.ruby - meta.interpolation +# ^^ punctuation.section.interpolation.begin.ruby +# ^^^^^ source.ruby.embedded.ruby +# ^ punctuation.section.interpolation.end.ruby +# ^^ punctuation.definition.variable.ruby +# ^^^^^ variable.other.readwrite.instance.ruby + </body> +# ^^^^^^^ meta.string.heredoc.ruby text.html.embedded.ruby meta.tag.structure.any.html + HTML +# ^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +class_eval <<-RUBY, __FILE__, __LINE__ + 1 + def #{sym}(*args, &block) +# ^^^^ meta.string.heredoc.ruby - meta.interpolation +# ^^^^^^ meta.string.heredoc.ruby source.ruby.embedded.ruby meta.interpolation.ruby +# ^^^^^^^^^^^^^^^ meta.string.heredoc.ruby source.ruby.embedded.ruby - meta.interpolation +# ^^ punctuation.section.interpolation.begin.ruby +# ^ punctuation.section.interpolation.end.ruby + custom(Mime[:#{sym}], *args, &block) + end +RUBY +#^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +puts <<-SH; # comment +# ^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby +# ^ punctuation.terminator.statement.ruby - meta.string - string +# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby - meta.string - string + git log +# ^^^^^^^ meta.string.heredoc.ruby source.shell.embedded.ruby + SH +# ^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +DB.fetch(<<-SQL, conn).name +#^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ruby +# ^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby +# ^^^^^^^^^^^^ - meta.string - string +# ^ punctuation.separator +# ^ punctuation.definition.group.end +SELECT * FROM #$users; +#^^^^^^^^^^^^^ meta.string.heredoc.ruby source.sql.embedded.ruby - meta.interpolation +# ^^^^^^^ meta.string.heredoc.ruby source.sql.embedded.ruby meta.interpolation.ruby variable.other.readwrite.global +# ^ meta.string.heredoc.ruby source.sql.embedded.ruby - meta.interpolation +SQL +#^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +foo, bar = <<BAR, 2 +#^^^^^^^^^^^^^^^^^^ source.ruby +# ^^^^^ string.unquoted +# ^^^ - string +# ^ punctuation.separator +# ^ constant.numeric +BAR +#^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +################## +# Numbers +################## + + 1234 +#^^^^ constant.numeric.integer.decimal + 1_234 +#^^^^^ constant.numeric.integer.decimal + 0d170 +#^^^^^ constant.numeric.integer.decimal +#^^ punctuation.definition.numeric.base + 0D170 +#^^^^^ constant.numeric.integer.decimal +#^^ punctuation.definition.numeric.base + 0xAa +#^^^^ constant.numeric.integer.hexadecimal +#^^ punctuation.definition.numeric.base + 0XAa +#^^^^ constant.numeric.integer.hexadecimal +#^^ punctuation.definition.numeric.base + 0252 +#^^^^ constant.numeric.integer.octal +#^ punctuation.definition.numeric.base + 0o252 +#^^^^^ constant.numeric.integer.octal +#^^ punctuation.definition.numeric.base + 0O252 +#^^^^^ constant.numeric.integer.octal +#^^ punctuation.definition.numeric.base + 0b10101010 +#^^^^^^^^^^ constant.numeric.integer.binary +#^^ punctuation.definition.numeric.base + 0B10101010 +#^^^^^^^^^^ constant.numeric.integer.binary +#^^ punctuation.definition.numeric.base + 12. +#^^ constant.numeric.integer.decimal +# ^ punctuation.accessor - constant.numeric - invalid.illegal + 12.ir +#^^ constant.numeric.integer.decimal +# ^ punctuation.accessor - constant.numeric - invalid.illegal +# ^^ - constant.numeric - invalid.illegal - storage.type.numeric + + 12.34 +#^^^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal + 1234e-2 +#^^^^^^^ constant.numeric.float.decimal + 1.234E1 +#^^^^^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal + 12e3r +#^^^^^ constant.numeric.float.decimal +# ^ invalid.illegal.numeric + 1.2e3r +#^^^^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal +# ^ invalid.illegal.numeric + + 12r +#^^^ constant.numeric.rational.decimal +# ^ storage.type.numeric + 12.3r +#^^^^^ constant.numeric.rational.decimal +# ^ punctuation.separator.decimal +# ^ storage.type.numeric + 0d170r +#^^^^^^ constant.numeric.rational.decimal +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric + 0xAar +#^^^^^ constant.numeric.rational.hexadecimal +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric + 0o252r +#^^^^^^ constant.numeric.rational.octal +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric + 0b10101010r +#^^^^^^^^^^^ constant.numeric.rational.binary +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric + + 12i +#^^^ constant.numeric.imaginary.decimal +# ^ storage.type.numeric + 12.3i +#^^^^^ constant.numeric.imaginary.decimal +# ^ punctuation.separator.decimal +# ^ storage.type.numeric + 12e3i +#^^^^^ constant.numeric.imaginary.decimal +# ^ storage.type.numeric + 12e-3i +#^^^^^^ constant.numeric.imaginary.decimal +# ^ storage.type.numeric + 1.2e3i +#^^^^^^ constant.numeric.imaginary.decimal +# ^ punctuation.separator.decimal +# ^ storage.type.numeric + 1.2e-3i +#^^^^^^^ constant.numeric.imaginary.decimal +# ^ punctuation.separator.decimal +# ^ storage.type.numeric + 12ri +#^^^^ constant.numeric.imaginary.decimal +# ^^ storage.type.numeric + 12.3ri +#^^^^^^ constant.numeric.imaginary.decimal +# ^ punctuation.separator.decimal +# ^^ storage.type.numeric + 0d170i +#^^^^^^ constant.numeric.imaginary.decimal +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric + 0d170ri +#^^^^^^^ constant.numeric.imaginary.decimal +#^^ punctuation.definition.numeric.base +# ^^ storage.type.numeric + 0xAai +#^^^^^ constant.numeric.imaginary.hexadecimal +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric + 0xAari +#^^^^^^ constant.numeric.imaginary.hexadecimal +#^^ punctuation.definition.numeric.base +# ^^ storage.type.numeric + 0o252i +#^^^^^^ constant.numeric.imaginary.octal +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric + 0o252ri +#^^^^^^^ constant.numeric.imaginary.octal +#^^ punctuation.definition.numeric.base +# ^^ storage.type.numeric + 0b10101010i +#^^^^^^^^^^^ constant.numeric.imaginary.binary +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric + 0b10101010ri +#^^^^^^^^^^^^ constant.numeric.imaginary.binary +#^^ punctuation.definition.numeric.base +# ^^ storage.type.numeric + 12e3ri +#^^^^^^ constant.numeric.imaginary.decimal +# ^ invalid.illegal.numeric +# ^ storage.type.numeric + 1.2e3ri +#^^^^^^^ constant.numeric.imaginary.decimal +# ^ punctuation.separator.decimal +# ^ invalid.illegal.numeric +# ^ storage.type.numeric + 12ir +#^^^^ constant.numeric.imaginary.decimal +# ^ storage.type.numeric +# ^ invalid.illegal.numeric + 12.3ir +#^^^^^^ constant.numeric.imaginary.decimal +# ^ punctuation.separator.decimal +# ^ storage.type.numeric +# ^ invalid.illegal.numeric + 12e3ir +#^^^^^^ constant.numeric.imaginary.decimal +# ^ storage.type.numeric +# ^ invalid.illegal.numeric + 1.2e3ir +#^^^^^^^ constant.numeric.imaginary.decimal +# ^ punctuation.separator.decimal +# ^ storage.type.numeric +# ^ invalid.illegal.numeric + 0d170ir +#^^^^^^^ constant.numeric.imaginary.decimal +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric +# ^ invalid.illegal.numeric + 0xAair +#^^^^^^ constant.numeric.imaginary.hexadecimal +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric +# ^ invalid.illegal.numeric + 0o252ir +#^^^^^^^ constant.numeric.imaginary.octal +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric +# ^ invalid.illegal.numeric + 0b10101010ir +#^^^^^^^^^^^^ constant.numeric.imaginary.binary +#^^ punctuation.definition.numeric.base +# ^ storage.type.numeric +# ^ invalid.illegal.numeric + +################## +# Strings +################## + +puts 'test' + +str = "number %d" % 11 + # ^^ string.quoted.double.ruby constant.other.placeholder.ruby +str = 'number %d' % 11 + # ^^ string.quoted.single.ruby constant.other.placeholder.ruby +str = 'number %08d' % 11 + # ^^^^ string.quoted.single.ruby constant.other.placeholder.ruby +str = 'number %.2f' % 11 + # ^^^^ string.quoted.single.ruby constant.other.placeholder.ruby +str = 'number %-8.2d' % 11 + # ^^^^^^ string.quoted.single.ruby constant.other.placeholder.ruby +str = '%2$02d' % [212.00, 3] + # ^^^^^^ string.quoted.single.ruby constant.other.placeholder.ruby +str = sprintf("%1$*2$s %2$d", "hello", -8) +# ^^^^^^^ string.quoted.double.ruby constant.other.placeholder.ruby +# ^^^^ string.quoted.double.ruby constant.other.placeholder.ruby + +################## +# Escape sequences +################## + + "This string has a quote: \". As you can see, it is escaped" +# ^^ constant.character.escape.ruby + "\a bell, ASCII 07h (BEL)" +# ^^ constant.character.escape.ruby + "\b backspace, ASCII 08h (BS)" +# ^^ constant.character.escape.ruby + "\t horizontal tab, ASCII 09h (TAB)" +# ^^ constant.character.escape.ruby + "\n newline (line feed), ASCII 0Ah (LF)" +# ^^ constant.character.escape.ruby + "\v vertical tab, ASCII 0Bh (VT)" +# ^^ constant.character.escape.ruby + "\f form feed, ASCII 0Ch (FF)" +# ^^ constant.character.escape.ruby + "\r carriage return, ASCII 0Dh (CR)" +# ^^ constant.character.escape.ruby + "\e escape, ASCII 1Bh (ESC)" +# ^^ constant.character.escape.ruby + "\s space, ASCII 20h (SPC)" +# ^^ constant.character.escape.ruby + "\\ backslash" +# ^^ constant.character.escape.ruby + "\0 \7 \07 \007 \0170 octal bit pattern, where nnn is 1-3 octal digits ([0-7])" +# ^^ constant.character.escape.ruby +# ^ - constant +# ^^ constant.character.escape.ruby +# ^ - constant +# ^^^ constant.character.escape.ruby +# ^ - constant +# ^^^^ constant.character.escape.ruby +# ^ - constant +# ^^^^ constant.character.escape.ruby +# ^ - constant + "\x0 \xF \x0F \x0FF hexadecimal bit pattern, where nn is 1-2 hexadecimal digits ([0-9a-fA-F])" +# ^^^ constant.character.escape.ruby +# ^ - constant +# ^^^ constant.character.escape.ruby +# ^ - constant +# ^^^^ constant.character.escape.ruby +# ^ - constant +# ^^^^ constant.character.escape.ruby +# ^ - constant + "\u0B \u0AF4 Unicode character, where nnnn is exactly 4 hexadecimal digits ([0-9a-fA-F])" +# ^^ constant.character.escape.ruby +# ^^ - constant +# ^^^^^^ constant.character.escape.ruby + "\u{nnnn Ab0 09AFaf ...} Unicode character(s), where each nnnn is 1-6 hexadecimal digits ([0-9a-fA-F])" +# ^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape.ruby +# ^^^^ invalid.illegal.escape.ruby +# ^^^ invalid.illegal.escape.ruby +# ^ - constant + "\cx or \C-x control character, where x is an ASCII printable character" +# ^^^ constant.character.escape.ruby +# ^^^^ - constant +# ^^^^ constant.character.escape.ruby +# ^ - constant + "\M-x meta character, where x is an ASCII printable character" +# ^^^^ constant.character.escape.ruby +# ^ - constant + "\M-\C-x meta control character, where x is an ASCII printable character" +# ^^^^^^^ constant.character.escape.ruby +# ^ - constant + "\M-\cx same as above" +# ^^^^^^ constant.character.escape.ruby +# ^ - constant + "\c\M-x same as above" +# ^^^^^^ constant.character.escape.ruby +# ^ - constant + "\c? or \C-? delete, ASCII 7Fh (DEL)" +# ^^^ constant.character.escape.ruby +# ^^^^ - constant +# ^^^^ constant.character.escape.ruby +# ^ - constant + +################## +# Interpolation +################## + + "#{MyParams.new.require(:filename)}" +# ^ meta.string.ruby string.quoted.double.ruby - meta.interpolation +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.ruby meta.interpolation.ruby - string +# ^ meta.string.ruby string.quoted.double.ruby - meta.interpolation +# ^ punctuation.definition.string.begin.ruby +# ^^ punctuation.section.interpolation.begin.ruby +# ^ punctuation.section.interpolation.end.ruby +# ^ punctuation.definition.string.end.ruby + %I[#{ENV['APP_NAME']} apple #@orange#@@juice banana] +# ^^^ meta.string.ruby - meta.interpolation +# ^^^^^^ meta.string.ruby meta.interpolation.ruby - string +# ^^^^^^^^^^^^^^^ meta.environment-variable.ruby +# ^^^^^^^^^^ meta.string.ruby meta.interpolation.ruby meta.string.ruby +# ^^ meta.string.ruby meta.interpolation.ruby - string +# ^^^^^^^ meta.string.ruby - meta.interpolation +# ^^^^^^^^^^^^^^^^ meta.string.ruby meta.interpolation.ruby - string +# ^^^^^^^ meta.string.ruby - meta.interpolation +# ^^^ punctuation.definition.string.begin.ruby +# ^^^ string.quoted.other.literal.upper.ruby +# ^^ punctuation.section.interpolation.begin.ruby +# ^^^ variable.other.constant.ruby +# ^^^^^^^^^^ string.quoted.single.ruby +# ^^^^^^^ string.quoted.other.literal.upper.ruby +# ^^ punctuation.definition.variable.ruby +# ^^^^^^^^ variable.other.readwrite.instance.ruby +# ^^^ punctuation.definition.variable.ruby +# ^^^^^^^^ variable.other.readwrite.class.ruby +# ^ punctuation.definition.string.end.ruby +# ^ string.quoted.other.literal.upper.ruby + %x[ foo #@bar [ foo #@bar [ foo #@bar ] baz ] baz ] +# ^^^^^^^^ meta.string.ruby string.interpolated.ruby - meta.interpolation +# ^^^^^ meta.string.ruby meta.interpolation.ruby - string +# ^^^^^^^ meta.string.ruby string.interpolated.ruby - meta.interpolation +# ^^^^^ meta.string.ruby meta.interpolation.ruby - string +# ^^^^^^^ meta.string.ruby string.interpolated.ruby - meta.interpolation +# ^^^^^ meta.string.ruby meta.interpolation.ruby - string +# ^^^^^^^^^^^^^^ meta.string.ruby string.interpolated.ruby - meta.interpolation +# ^^^ punctuation.definition.string.begin.ruby +# ^^^^^ variable.other.readwrite.instance.ruby +# ^ punctuation.section.scope.ruby +# ^^^^^ variable.other.readwrite.instance.ruby +# ^ punctuation.section.scope.ruby +# ^^^^^ variable.other.readwrite.instance.ruby +# ^ punctuation.section.scope.ruby +# ^ punctuation.section.scope.ruby +# ^ punctuation.definition.string.end.ruby + +################## +# Constants +################## + +lower_snake_case = 1 +# ^^^^^^^^^^^^^^ -meta.constant.ruby -entity.name.constant.ruby +lowerCamelCase = 2 +# ^^^^^^^^^^^^ -meta.constant.ruby -entity.name.constant.ruby +UpperCamelCase = 3 +# ^^^^^^^^^^^^ meta.constant.ruby entity.name.constant.ruby +UPPER_SNAKE_CASE = 4 +# ^^^^^^^^^^^^^^ meta.constant.ruby entity.name.constant.ruby +A, B, C = 0 +# <- entity.name.constant +# ^ entity.name.constant +# ^ entity.name.constant + +Symbol === :foo +# ^^^^ variable.other.constant.ruby -meta.constant.ruby +# ^^^^ + + :'foo #{ } #@bar baz' +# ^^^^^^^^^^^^^^^^^^^^^ meta.constant.ruby - meta.interpolation +# ^^ punctuation.definition.constant.ruby +# ^^^^^^^^^^^^^^^^^^^^^ constant.other.symbol.single-quoted.ruby +# ^ punctuation.definition.constant.ruby + :"foo #{ } #@bar baz" +# ^^^^^^ meta.constant.ruby - meta.interpolation +# ^^^^ meta.constant.ruby meta.interpolation.ruby - constant +# ^ meta.constant.ruby - meta.interpolation +# ^^^^^ meta.constant.ruby meta.interpolation.ruby - constant +# ^^^^^ meta.constant.ruby - meta.interpolation +# ^^ punctuation.definition.constant.ruby +# ^^^^^^ constant.other.symbol.double-quoted.ruby +# ^^ punctuation.section.interpolation.begin.ruby +# ^ punctuation.section.interpolation.end.ruby +# ^^ punctuation.definition.variable.ruby +# ^^^^^ variable.other.readwrite.instance.ruby +# ^^^^ constant.other.symbol.double-quoted.ruby +# ^ punctuation.definition.constant.ruby + +################## +# Character literals +################## + + ## meta control sequences + + ?\C-a ?\ca ?\c-a #=> "\x01" +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant + ?\M-a ?\m-a ?\ma #=> "\xE1" +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^^^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^^^ invalid.illegal.character.ruby +# ^ - constant + ?\M-\C-a ?\M-\ca #=> "\x81" +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^^ constant.character.ruby +# ^ - constant + ?\C-\M-a ?\c\M-a #=> "\x81", same as above +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^^ constant.character.ruby +# ^ - constant + + ## hexadecimal + + ?\x10 ?\xAF ?\xAG ?\x0AF +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^^^^ invalid.illegal.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^ constant.character.ruby +# ^^^^^ invalid.illegal.character.ruby +# ^ - constant + + ## octal + + ?\00 ?\07 ?\000 ?\077 ?\080 ?\0777 +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^^^^ invalid.illegal.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^ constant.character.ruby +# ^^^^^ invalid.illegal.character.ruby +# ^ - constant + + ## escape sequences + + ?\b ?\n ?\s ?\\ ?\\n ?\bn +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant +# ^ constant.character.ruby punctuation.definition.constant.ruby +# ^^^ constant.character.ruby invalid.illegal.character.ruby +# ^ - constant +# ^ constant.character.ruby punctuation.definition.constant.ruby +# ^^^ constant.character.ruby invalid.illegal.character.ruby +# ^ - constant + + ## unicode + + ?\u{41} #=> "A" +# ^^^ meta.constant.ruby - meta.braces.ruby constant.character.ruby +# ^^^^ meta.constant.ruby meta.braces.ruby - constant.character.ruby +# ^ punctuation.definition.constant.ruby +# ^ punctuation.section.braces.begin.ruby +# ^^ constant.numeric.integer.hexadecimal.ruby +# ^ punctuation.section.braces.end.ruby + ?\u{012ACF 0gxs} +# ^^^ meta.constant.ruby - meta.braces.ruby constant.character.ruby +# ^^^^^^^^^^^^^ meta.constant.ruby meta.braces.ruby - constant.character.ruby +# ^ punctuation.definition.constant.ruby +# ^ punctuation.section.braces.begin.ruby +# ^^^^^^ constant.numeric.integer.hexadecimal.ruby +# ^ constant.numeric.integer.hexadecimal.ruby +# ^^^ invalid.illegal.escape.ruby +# ^ punctuation.section.braces.end.ruby + + ## normal character literals + + ?0 ?1 ?9 ?20 +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ keyword.operator.conditional.ruby +# ^^ constant.numeric.integer.decimal.ruby + ?a ?A ?あ ?abc ?a0 +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^^^ invalid.illegal.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^^ invalid.illegal.character.ruby +# ^ - constant + ?* ?" ?( ?[ ?{ ?. ?# ?_ ?\ +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant + +################## +# Constant reserved keyword symbols +################## + +begin: 'begin' +# ^^^^ constant.other.symbol +end: 'end' +# ^^ constant.other.symbol +require: 'require' +# ^^^^^^ constant.other.symbol +class: 'class' +# ^^^^ constant.other.symbol +module: 'module' +# ^^^^^ constant.other.symbol + +################## +# Operators +################## + + , +# ^ punctuation.separator.sequence.ruby + ; +# ^ punctuation.terminator.statement.ruby + . +# ^ punctuation.accessor.dot.ruby + :: +# ^^ punctuation.accessor.double-colon.ruby + <<= +# ^^^ keyword.operator.assignment.augmented.ruby + &&= +# ^^^ keyword.operator.assignment.augmented.ruby + ||= +# ^^^ keyword.operator.assignment.augmented.ruby + **= +# ^^^ keyword.operator.assignment.augmented.ruby + += +# ^^ keyword.operator.assignment.augmented.ruby + -= +# ^^ keyword.operator.assignment.augmented.ruby + *= +# ^^ keyword.operator.assignment.augmented.ruby + /= +# ^^ keyword.operator.assignment.augmented.ruby + &= +# ^^ keyword.operator.assignment.augmented.ruby + |= +# ^^ keyword.operator.assignment.augmented.ruby + ^= +# ^^ keyword.operator.assignment.augmented.ruby + << +# ^^ keyword.operator.assignment.augmented.ruby + >> +# ^^ keyword.operator.other.ruby + + +# ^ keyword.operator.arithmetic.ruby + - +# ^ keyword.operator.arithmetic.ruby + * +# ^ keyword.operator.arithmetic.ruby + ** +# ^^ keyword.operator.arithmetic.ruby + / +# ^ keyword.operator.arithmetic.ruby + % +# ^ keyword.operator.arithmetic.ruby + !~ +# ^^ keyword.operator.comparison.ruby + =~ +# ^^ keyword.operator.comparison.ruby + <=> +# ^^^ keyword.operator.comparison.ruby + == +# ^^ keyword.operator.comparison.ruby + != +# ^^ keyword.operator.comparison.ruby + >= +# ^^ keyword.operator.comparison.ruby + <= +# ^^ keyword.operator.comparison.ruby + > +# ^ keyword.operator.comparison.ruby + < +# ^ keyword.operator.comparison.ruby + && +# ^^ keyword.operator.logical.ruby + || +# ^^ keyword.operator.logical.ruby + ! +# ^ keyword.operator.logical.ruby + ? +# ^ keyword.operator.conditional.ruby + : +# ^ keyword.operator.conditional.ruby + ~ +# ^ keyword.operator.bitwise.ruby + & +# ^ keyword.operator.bitwise.ruby + | +# ^ keyword.operator.bitwise.ruby + ^ +# ^ keyword.operator.bitwise.ruby + .. +# ^^ keyword.operator.range.ruby + ... +# ^^^ keyword.operator.range.ruby + +################## +# Blocks +################## + +[self.class.name, @name].map do |*args| +# ^ variable.language.ruby +# ^ variable.other.readwrite.instance.ruby punctuation.definition.variable.ruby +# ^^^^ variable.other.readwrite.instance.ruby +# ^ keyword.operator.splat.ruby +# ^ variable.parameter.ruby +end + +{ |a, b=2, *c| a + b} +# <- punctuation.section.scope +# ^^^^^^^^^^^^ meta.block.parameters +# ^ punctuation.definition.parameters.begin +# ^ variable.parameter +# ^ punctuation.separator +# ^ variable.parameter +# ^^ meta.block.parameters.default-value +# ^ keyword.operator.assignment +# ^ constant.numeric +# ^ punctuation.separator +# ^ keyword.operator.splat +# ^ variable.parameter +# ^ punctuation.definition.parameters.end +# ^ punctuation.section.scope + +do |&bl| end +# <- keyword.control +# ^^^^^ meta.block.parameters +# ^ punctuation.definition.parameters +# ^ keyword.operator +# ^^ variable.parameter +# ^ punctuation.definition.parameters + +{ |a={|b={a: 1, b: 2}|}| a * 2 } +# ^^^^^^^^^^^^^^^^^^^^^^ meta.block.parameters +# ^ punctuation.definition.parameters.begin +# ^ variable.parameter +# ^^^^^^^^^^^^^^^^^^^ meta.block.parameters.default-value +# ^^^^^^^^^^^^^^^^ meta.block.parameters meta.block.parameters +# ^ variable.parameter +# ^^^^^^^^^^^^^ meta.block.parameters.default-value meta.block.parameters.default-value +# ^ keyword.operator.assignment +# ^^ constant.other.symbol +# ^ constant.numeric +# ^ punctuation.separator +# ^^ constant.other.symbol +# ^ constant.numeric +# ^ punctuation.definition.parameters.end +# ^ punctuation.definition.parameters.end +# ^ keyword.operator.arithmetic + + +################## +# Modules, classes and methods +################## + +module MyModule +# <- keyword.control.module +# ^^^^^^^^ entity.name.module +end + +module MyModule::OtherModule +# <- keyword.control.module +# ^^^^^^^^^^^^^^^^^^^^^ entity.name.module +# ^^^^^^^^ support.other.namespace +# ^^ punctuation.accessor.double-colon +end + +class ::MyModule::MyClass < MyModule::InheritedClass +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class +# ^^ punctuation.accessor.double-colon +# ^^ punctuation.accessor.double-colon +# ^ punctuation.separator.inheritance +# ^^^^^^^^^^^^^^^^^^^^^^^^ entity.other.inherited-class +# ^^ punctuation.accessor.double-colon + + def my_method(param1, param2) +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^^^^^^ entity.name.function +# ^^^^^^^^^^^^^^^^ meta.function.parameters +# ^ punctuation.definition.group.begin +# ^ punctuation.separator - variable.parameter +# ^ punctuation.definition.group.end + end + + def self.my_second_method *arg_without_parens # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^ variable.language +# ^ punctuation.accessor.dot +# ^^^^^^^^^^^^^^^^ entity.name.function +# ^^^^^^^^^^^^^^^^^^^ meta.function.parameters +# ^ keyword.operator.splat +# ^^^^^^^^^^^^^^^^^^ variable.parameter +# ^^^^^^^^^ comment.line.number-sign + end + + def self.my_third_method(a, b="foo", c=[], d=foo(), *args) +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^ variable.language +# ^ punctuation.accessor.dot +# ^^^^^^^^^^^^^^^ entity.name.function +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters +# ^ punctuation.definition.group.begin +# ^ variable.parameter +# ^ punctuation.separator - variable.parameter +# ^ variable.parameter +# ^^^^^^ meta.function.parameters.default-value +# ^ keyword.operator - variable.parameter +# ^^^^^ string.quoted - variable.parameter +# ^ punctuation.separator +# ^ variable.parameter +# ^ keyword.operator.assignment +# ^^ punctuation.section.array +# ^ punctuation.separator +# ^ variable.parameter +# ^ keyword.operator.assignment +# ^^ punctuation.definition.group +# ^ punctuation.separator +# ^ keyword.operator +# ^^^^ variable.parameter +# ^ punctuation.definition.group.end + end + + def nested((a, b), c, (d, *e)) +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^^^ entity.name.function +# ^^^^^^^^^^^^^^^^^^^^ meta.function.parameters +# ^ punctuation.definition.group.begin +# ^ punctuation.definition.group.begin +# ^ variable.parameter +# ^ punctuation.separator +# ^ variable.parameter +# ^ punctuation.definition.group.end +# ^ punctuation.separator +# ^ variable.parameter +# ^ punctuation.separator +# ^ punctuation.definition.group.begin +# ^ variable.parameter +# ^ punctuation.separator +# ^ keyword.operator.splat +# ^ variable.parameter +# ^^ punctuation.definition.group.end + end + + def block_param(&block) +# ^^^^^^^^ meta.function.parameters +# ^ keyword.operator +# ^^^^^ variable.parameter + end + + def keyword_args a: nil, b: true +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^^^^^^^^^^^^ meta.function.parameters +# ^^^^^ meta.function.parameters.default-value +# ^ punctuation.separator +# ^^^ constant.language +# ^ punctuation.separator +# ^ punctuation.separator +# ^^^^ constant.language + end + + def multiline_args(a, # a comment +# ^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^ meta.function.parameters +# ^ punctuation.separator +# ^^^^^^^^^^^ comment.line.number-sign + b) +# ^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters +# ^ punctuation.definition.group.end + end +end + +def MyModule::module_method +#^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^^^^^^^^^^^^^^^^^^^^ entity.name.function +# ^^^^^^^^ support.other.namespace +# ^^ punctuation.accessor.double-colon + +end + +def my_function +#^^^^^^^^^^^^^^ meta.function +# ^^^^^^^^^^^ entity.name.function +end + +f = MyModule::MyClass.new +# ^^ punctuation.accessor.double-colon + +def f.my_instance_method +#^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^^^^^^^^^^^^^^^^^ entity.name.function +# ^ punctuation.accessor.dot +end + +class MyClass +# ^ meta.class.ruby keyword.control.class.ruby +# ^ meta.class.ruby entity.name.class.ruby + + prepend Module.new +# ^ keyword.other.special-method.ruby +# ^ support.class.ruby +# ^ keyword.other.special-method.ruby + + FIELDS = %i[a b c] +# ^ meta.constant.ruby entity.name.constant.ruby +# ^ keyword.operator.assignment.ruby +# ^^^ punctuation.definition.string.begin.ruby +# ^^^^^ string.quoted.other.literal.lower.ruby + + A, B, C = :a, :b, :c +# ^ meta.constant.ruby entity.name.constant.ruby +# ^ punctuation.separator.sequence.ruby +# ^ meta.constant.ruby entity.name.constant.ruby +# ^ punctuation.separator.sequence.ruby +# ^ meta.constant.ruby entity.name.constant.ruby +end + + +################## +# Well-known methods +################## + +puts "Output" +# <- support.function.builtin + +abort "Ending" +# <- support.function.builtin + +exit! 2 +#^^^^ support.function.builtin + + + +################## +# Tokens with Multiple Meanings +################## + +method? 1 +# ^ - keyword.operator + +(methodname)?foobar : baz +# ^ keyword.operator.conditional +# ^ keyword.operator.conditional + +methodname ?foo : baz +# ^ keyword.operator.conditional +# ^ keyword.operator.conditional + +puts 1 ?1 : 2 +# ^ keyword.operator.conditional +# ^ constant.numeric +# ^ keyword.operator.conditional + +puts 1 ?12 : 2 +# ^ keyword.operator.conditional +# ^^ constant.numeric +# ^ keyword.operator.conditional + +puts ?1 +# ^^ constant.character.ruby + +puts 1 ? foo:bar +# ^ keyword.operator.conditional +# ^ keyword.operator.conditional +# ^^^ - constant.other.symbol + +puts 1 ? foo::baz:bar +# ^ keyword.operator.conditional +# ^^ punctuation.accessor.double-colon +# ^^^ - constant.other.symbol +# ^ keyword.operator.conditional + +puts foo: bar +# ^^^^ constant.other.symbol + + +################## +# Regular expressions vs division operator +################## + +"foo".sub /t{1,}/i +# ^^^^^^^^ string.regexp +# ^ keyword.other +"foo".sub! /t{1,}/i +# ^^^^^^^^ string.regexp +# ^ keyword.other +"foo".sub!(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other +"foo".gsub /t{1,}/i +# ^^^^^^^^ string.regexp +# ^ keyword.other +"foo".gsub! /t{1,}/i +# ^^^^^^^^ string.regexp +# ^ keyword.other +"foo".gsub!(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other +"foo".eql? /t{1,}/i +# ^^^^^^^^ string.regexp +# ^ keyword.other +"foo".eql?(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other +'foo'.match? /t{1,}/i +# ^^^^^^^^ string.regexp +# ^ keyword.other +'foo'.match?(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other +'foo'.matches?(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other + +a = /(foo)*baz/m +# ^^^^^^^^^^^^ string.regexp + +a = /{foo}*baz/m +# ^^^^^^^^^^^^ string.regexp + +a = /?foo*baz/m +# ^^^^^^^^^^^ string.regexp + +a = /=foo/m +# ^^ keyword.operator.assignment.augmented.ruby +# ^^^^^^^ - string.regexp + +begin +end while /foo/ =~ bar +# ^^^^^ string.regexp + +if /foo/i =~ baz +# ^^^^^^ string.regexp +# ^^ keyword.operator +end + +if baz =~ /foo/i +# ^^ keyword.operator +# ^^^^^^ string.regexp +end + +['a()', 'b()'].select { |var| /^a\(/ =~ var } +# ^^^^^^ string.regexp + +{foo: /bar/} +# ^^^^^ string.regexp + +str = "#{('A'.ord + index / (26*26) - 1).chr}" +# ^ keyword.operator +# ^^ constant.numeric +# ^ keyword.operator + +if 1 / 2 == 3 +# ^ keyword.operator +# ^^ keyword.operator +end + +a = 1 / 2 +# ^ keyword.operator.arithmetic + +b = testing! / foo +# ^ keyword.operator.arithmetic + +rule /`/ do +# ^^^ string.regexp +# ^ - string.regexp string.regexp +end + +################## +# Crazy Stuff Found Online™ +################## + +( +def huh?(a, b=def huh?(a); "h?"; end) +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters +# ^^^^^^^^^^^ meta.function meta.function +# ^^^ meta.function.parameters meta.function.parameters +# ^ variable.parameter + a +end + +p huh?("H", 1) + huh?("u") + huh?("gs") +) + + +# issue #923 +foo = 2 / @d +# ^^ - string.regexp.classic +# ^ variable.other.readwrite.instance punctuation.definition.variable +# ^ keyword.operator.arithmetic.ruby + +# issue #933 +a = b / "c" +# ^^^ string.quoted.double.ruby - string.regexp.classic.ruby +# ^ keyword.operator.arithmetic.ruby + +foo / "bar/bla" +# ^ keyword.operator.arithmetic.ruby +# ^^^^^^^^^ string.quoted.double.ruby + +{ + /foo/ => :foo +# ^^^^^ string.regexp.classic.ruby +} + + assert_no_match /1/, "2" +# ^^^^^^^^^^^^^^^ support.function.builtin.ruby +# ^ punctuation.definition.string.begin.ruby +# ^^^ meta.string.regexp.ruby string.regexp.classic.ruby +# ^ punctuation.definition.string.end.ruby +# ^ punctuation.separator.sequence.ruby +# ^^^ string.quoted.double.ruby + +# issue #2181 +foo << bar if baz.include?(x) +# ^^ keyword.control.ruby +foo << bar.baz if baz.include?(x) +# ^^ keyword.control.ruby +foo << bar.assert_match if baz.include?(x) +# ^^ keyword.control.ruby +foo << bar.to_s if baz.include?(x) +# ^^ keyword.control.ruby diff --git a/assets/syntaxes/Packages/Rust/Cargo.sublime-build b/assets/syntaxes/Packages/Rust/Cargo.sublime-build new file mode 100644 index 000000000..4af07858f --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Cargo.sublime-build @@ -0,0 +1,27 @@ +{ + "cmd": ["cargo", "build"], + "file_regex": "(?|, ([^,<\n]*\\.[A-z]{2}):([0-9]+)|[ \t]*-->[ \t]*([^<\n]*):([0-9]+):([0-9]+))", + "syntax": "Packages/Rust/Cargo.sublime-syntax", + "keyfiles": ["Cargo.toml"], + "working_dir": "${folder:${project_path:${file_path}}}", + + "variants": + [ + { + "cmd": ["cargo", "run"], + "name": "Run" + }, + { + "cmd": ["cargo", "test"], + "name": "Test" + }, + { + "cmd": ["cargo", "bench"], + "name": "Bench" + }, + { + "cmd": ["cargo", "clean"], + "name": "Clean" + } + ] +} diff --git a/assets/syntaxes/Packages/Rust/Cargo.sublime-syntax b/assets/syntaxes/Packages/Rust/Cargo.sublime-syntax new file mode 100644 index 000000000..da88bf540 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Cargo.sublime-syntax @@ -0,0 +1,14 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Cargo Build Results +scope: source.build_results +hidden: true +contexts: + main: + - match: '^(..[^:\n]*):([0-9]+):?([0-9]+)?:? ' + scope: entity.name.filename + - match: '\berror: ' + scope: message.error + - match: '^\[.+\]$' + scope: comment diff --git a/assets/syntaxes/Packages/Rust/Default.sublime-keymap b/assets/syntaxes/Packages/Rust/Default.sublime-keymap new file mode 100644 index 000000000..20130980d --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Default.sublime-keymap @@ -0,0 +1,6 @@ +[ + // Disable auto-pair for single quote + { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'"}, "context": + [{ "key": "selector", "operator": "equal", "operand": "source.rust" }] + } +] diff --git a/assets/syntaxes/Packages/Rust/LICENSE.txt b/assets/syntaxes/Packages/Rust/LICENSE.txt new file mode 100644 index 000000000..89de35479 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/LICENSE.txt @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/assets/syntaxes/Packages/Rust/Rust.sublime-build b/assets/syntaxes/Packages/Rust/Rust.sublime-build new file mode 100644 index 000000000..0427d75a9 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Rust.sublime-build @@ -0,0 +1,22 @@ +{ + "cmd": ["rustc", "$file"], + "selector": "source.rust", + "file_regex": "^(.*?):([0-9]+):([0-9]+):\\s[0-9]+:[0-9]+\\s(.*)$", + + "variants": [ + { + "selector": "source.rust", + "cmd": ["./$file_base_name"], + "name": "Run", + "windows": + { + "cmd": ["$file_base_name.exe"] + }, + }, + { + "selector": "source.rust", + "shell_cmd": "rustc \"$file\" && \"./$file_base_name\"", + "name": "Build & Run", + }, + ] +} diff --git a/assets/syntaxes/Packages/Rust/Rust.sublime-syntax b/assets/syntaxes/Packages/Rust/Rust.sublime-syntax new file mode 100644 index 000000000..79c3a8877 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Rust.sublime-syntax @@ -0,0 +1,1177 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Rust +file_extensions: + - rs +scope: source.rust +variables: + identifier: '(?:(?:[[:alpha:]][_[:alnum:]]*|_[_[:alnum:]]+)\b)' # include a word boundary at the end to ensure all possible characters are consumed, to prevent catastrophic backtracking + escaped_byte: '\\(x\h{2}|n|r|t|0|"|''|\\)' + escaped_char: '\\(x\h{2}|n|r|t|0|"|''|\\|u\{\h{1,6}\})' + int_suffixes: 'i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize' + support_type: \b(Copy|Send|Sized|Sync|Drop|Fn|FnMut|FnOnce|Box|ToOwned|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator|Option|Some|None|Result|Ok|Err|SliceConcatExt|String|ToString|Vec)\b +contexts: + main: + - include: statements + + prototype: + # Macro metavariables. Ideally we would do this as a with_prototype, + # however then we run into infinite recursion. It needs to be a prototype + # since macro_rules! allows constructing new code, thus the metavariables + # can be inserted in just about any position in the syntax. + - match: '\${{identifier}}' + scope: variable.other.rust + + else-pop: + - match: (?=\S) + pop: true + + pop-immediately: + - match: '' + pop: true + + statements: + + - match: '(''{{identifier}})\s*(:)' + captures: + 1: entity.name.label.rust + 2: punctuation.separator.rust + - match: '''{{identifier}}(?!\'')\b' + scope: storage.modifier.lifetime.rust + + - match: '\b(?:(pub)\s+)?\b(mod)\s+({{identifier}})\b' + captures: + 1: storage.modifier.rust + 2: storage.type.module.rust + 3: entity.name.module.rust + push: + - meta_scope: meta.module.rust + - match: ';' + scope: punctuation.terminator.rust + set: after-operator + - include: statements-block + + - match: '\b({{identifier}})\s*(=)\s*(?=\|)' + captures: + 1: entity.name.function.rust + 2: keyword.operator.rust + push: closure + + - match: '\b(?:(pub)\s+)?\b(fn)\s+(?={{identifier}})' + scope: meta.function.rust + captures: + 1: storage.modifier.rust + 2: storage.type.function.rust + push: fn-definition + + - match: '\b(?:(pub)\s+)?(struct)\s+' + scope: meta.struct.rust + captures: + 1: storage.modifier.rust + 2: storage.type.struct.rust + push: struct-identifier + + - match: '\b(?:(pub)\s+)?(type)\s+({{identifier}})\b' + captures: + 1: storage.modifier.rust + 2: storage.type.type.rust + 3: entity.name.type.rust + + - match: '\b(?:(pub)\s+)?(trait)\s+({{identifier}})\b' + captures: + 1: storage.modifier.rust + 2: storage.type.trait.rust + 3: entity.name.trait.rust + push: + - meta_scope: meta.trait.rust + - include: statements-block + + - match: '\bimpl\b' + scope: storage.type.impl.rust + push: impl-definition + + - match: '\b(?:(pub)\s+)?(enum)\s+({{identifier}})\b' + captures: + 1: storage.modifier.rust + 2: storage.type.enum.rust + 3: entity.name.enum.rust + push: + - meta_scope: meta.enum.rust + - include: statements-block + + - match: \b(let|const|static)\b + scope: storage.type.rust + + - match: \*const\b + scope: storage.type.rust + + - match: \bfn\b + scope: storage.type.function.rust + + - match: \bmod\b + scope: storage.type.module.rust + + - match: \bstruct\b + scope: storage.type.struct.rust + + - match: \bimpl\b + scope: storage.type.impl.rust + + - match: \benum\b + scope: storage.type.enum.rust + + - match: \btype\b + scope: storage.type.type.rust + + - match: \btrait\b + scope: storage.type.trait.rust + + - match: \b(mut|pub|unsafe|move|ref)\b + scope: storage.modifier.rust + + - match: \*mut\b + scope: storage.modifier.rust + + - match: \b(crate|extern|use|where)\b + scope: keyword.other.rust + + - match: \b(break|else|for|if|loop|match|while|continue)\b + scope: keyword.control.rust + + - match: \breturn\b + scope: keyword.control.rust + push: after-operator + + - match: \b(as|in|box)\b + scope: keyword.operator.rust + + - match: \b(virtual|proc|alignof|become|offsetof|priv|pure|sizeof|typeof|unsized|yield|do|abstract|final|override|macro)\b + scope: invalid.illegal.rust + + - match: \b(true|false)\b + scope: constant.language.rust + + - include: type + + - match: '\b(macro_rules!)\s+([[:alpha:]_][[:alnum:]_]*)\b' + captures: + 1: support.function.rust + 2: entity.name.macro.rust + push: macro-block + + - include: comments + - include: strings + - include: chars + + - match: '\b[[:lower:]_][[:lower:][:digit:]_]*(?=\()' + scope: support.function.rust + + - match: '\b((?:format|print|println|eprint|eprintln)!)\s*(\()' + captures: + 1: support.macro.rust + 2: meta.group.rust punctuation.section.group.begin.rust + push: + - meta_content_scope: meta.group.rust + - include: comments + - include: format-string + - include: format-raw-string + - match: '(?=\S)' + set: group-tail + + - match: '\b((?:write|writeln)!)\s*(\()' + captures: + 1: support.macro.rust + 2: meta.group.rust punctuation.section.group.begin.rust + push: + - meta_content_scope: meta.group.rust + - include: comments + - match: ',' + set: + - meta_content_scope: meta.group.rust + - include: format-string + - include: format-raw-string + - match: '(?=\S)' + set: group-tail + + - match: '\b[[:lower:]_][[:lower:][:digit:]_]*!(?=\s*(\(|\{|\[))' + scope: support.macro.rust + + - match: '{{support_type}}' + scope: support.type.rust + + - include: basic-identifiers + + - include: attributes + + - include: numbers + + - match: '(?=\{)' + push: block + + - match: '(?=\()' + push: group + + - match: '\[' + scope: punctuation.section.group.begin.rust + push: + - meta_scope: meta.group.rust + - match: '\]' + scope: punctuation.section.group.end.rust + pop: true + - match: ';' + scope: punctuation.separator.rust + - include: statements + + - include: return-type + + # Making this an operator helps visually break up large + # match blocks containing just enums + - match: '=>' + scope: keyword.operator.rust + push: after-operator + + - include: operators + + - match: ';' + scope: punctuation.terminator.rust + push: after-operator + + - match: '[:,]' + scope: punctuation.separator.rust + push: after-operator + + - match: '\.' + scope: punctuation.accessor.dot.rust + + operators: + - match: \.{2,3} + scope: keyword.operator.range.rust + - match: '[!<>=]=|[<>]' + scope: keyword.operator.comparison.rust + - match: '(?:[-+%/*^&|]|<<|>>)?=' + scope: keyword.operator.assignment.rust + push: after-operator + - match: '&&|\|\||!' + scope: keyword.operator.logical.rust + - match: '[-+%/*]' + scope: keyword.operator.arithmetic.rust + - match: '[&|^]|<<|>>' + scope: keyword.operator.bitwise.rust + - match: '[@~?$#'']' + scope: keyword.operator.rust + - match: '\b_\b' + scope: keyword.operator.rust + + + attributes: + - match: '(#!?)(\[)' + captures: + 1: punctuation.definition.annotation.rust + 2: punctuation.section.group.begin.rust + push: + - meta_scope: meta.annotation.rust + - match: '({{identifier}})(\()' + captures: + 1: variable.annotation.rust + 2: meta.annotation.parameters.rust meta.group.rust punctuation.section.group.begin.rust + push: + - meta_content_scope: meta.annotation.parameters.rust meta.group.rust + - match: \) + scope: meta.annotation.parameters.rust meta.group.rust punctuation.section.group.end.rust + pop: true + - include: attribute-call + - match: '({{identifier}})' + scope: variable.annotation.rust + - match: '=' + scope: keyword.operator.rust + - match: '\]' + scope: punctuation.section.group.end.rust + pop: true + - match: '[ \t]+' + - include: strings + + attribute-call: + - match: \) + scope: meta.function-call.rust meta.group.rust punctuation.section.group.end.rust + pop: true + - match: '({{identifier}})(\()' + scope: meta.function-call.rust + captures: + 1: variable.function.rust + 2: meta.group.rust punctuation.section.group.begin.rust + push: + - meta_content_scope: meta.function-call.rust + - include: attribute-call + - match: ',' + scope: punctuation.separator.rust + - match: '=' + scope: keyword.operator.rust + - include: strings + + block: + - match: '\}' + scope: meta.block.rust punctuation.section.block.end.rust + pop: true + - match: '\{' + scope: punctuation.section.block.begin.rust + push: [block-body, try-closure] + + block-body: + - meta_scope: meta.block.rust + - match: '(?=\})' + pop: true + - include: statements + + group: + - match: '\)' + scope: meta.group.rust punctuation.section.group.end.rust + pop: true + - match: '\(' + scope: punctuation.section.group.begin.rust + push: [group-body, try-closure] + + group-body: + - meta_scope: meta.group.rust + - match: '(?=\))' + pop: true + - include: statements + + group-tail: + - meta_scope: meta.group.rust + - match: '\)' + scope: punctuation.section.group.end.rust + pop: true + - include: statements + + after-operator: + - match: '(?=<)' + set: generic-angles + - include: try-closure + + try-closure: + - match: '\s*(?=\|)' + set: closure + # Exit the context if we didn't find a closure + - match: '(?=\S)' + pop: true + + return-type: + - match: '->' + scope: punctuation.separator.rust + push: + - meta_scope: meta.function.return-type.rust + - match: '(?=\s*\{|\bwhere\b)' + pop: true + - match: '(?=<)' + push: generic-angles + - include: type-any-identifier + - match: '{{identifier}}' + # Escape for incomplete expression + - match: '(?=\S)' + pop: true + + closure: + - meta_content_scope: meta.function.closure.rust + - match: '\|' + scope: punctuation.section.parameters.begin.rust + set: [closure-return, closure-parameters] + + closure-parameters: + - meta_scope: meta.function.parameters.rust + # If the user has just typed a |, exit the params + # scope as soon as we hit something that it not a + # valid part so the whole rest of the document isn't + # highlighted using the params scope + - match: '(?=[};)\]\n])' + pop: true + - match: ',' + scope: punctuation.separator.rust + - match: '\(' + scope: meta.group.rust punctuation.section.group.begin.rust + push: + - meta_content_scope: meta.group.rust + - match: '\)' + scope: meta.group.rust punctuation.section.group.end.rust + pop: true + - match: ',' + scope: punctuation.separator.rust + - match: '({{identifier}})' + scope: variable.parameter.rust + - match: '(:)\s*(\()' + captures: + 1: punctuation.separator.rust + 2: meta.group.rust punctuation.section.group.begin.rust + push: + - meta_content_scope: meta.group.rust + - match: '\)' + scope: meta.group.rust punctuation.section.group.end.rust + pop: true + - match: ',' + scope: punctuation.separator.rust + - include: type-any-identifier + - match: '\|' + scope: punctuation.section.parameters.end.rust + pop: true + - match: \bself\b + scope: variable.parameter.rust + - match: '({{identifier}})\s*(?:(:(?!:))|(?=\||,))' + captures: + 1: variable.parameter.rust + 2: punctuation.separator.rust + push: + - match: (?=,|\|) + pop: true + - include: type-any-identifier + - match: '&' + scope: keyword.operator.rust + - match: \b(mut|ref)\b + scope: storage.modifier.rust + - match: '''{{identifier}}(?!\'')\b' + scope: storage.modifier.lifetime.rust + + closure-return: + - meta_content_scope: meta.function.closure.rust + - include: return-type + - match: (?=\S) + set: closure-body + + closure-body: + - match: '(?=\{)' + set: closure-explicit-body + - match: (?=\S) + set: + - meta_scope: meta.function.closure.rust + - match: '(?=[};)\]\n])' + pop: true + - include: statements + + closure-explicit-body: + - meta_scope: meta.function.closure.rust + - include: block + + type: + - match: (?:{{support_type}}|{{identifier}})(?=<) + captures: + 1: support.type.rust + push: generic-angles + - match: \b(Self|i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize|f32|f64|bool|char|str)\b + scope: storage.type.rust + + generic-angles: + - meta_scope: meta.generic.rust + - include: comments + - match: '->' + scope: punctuation.separator.generic.rust + push: generic-angles-contents + - match: '>' + scope: punctuation.definition.generic.end.rust + pop: true + - match: '<' + scope: punctuation.definition.generic.begin.rust + push: generic-angles-contents + # Alert the user of a broken generic construct + - match: '\S' + scope: invalid.illegal.rust + pop: true + + generic-angles-contents: + - include: comments + - match: \bextern\b + scope: keyword.other.rust + push: + - include: strings + - match: '(?=\S)' + pop: true + - match: '(?=>|[^ \t\n\$=<_+''(),&:\[\]*[:alnum:]])' + pop: true + - match: '<' + scope: punctuation.definition.generic.begin.rust + push: + - match: '>' + scope: punctuation.definition.generic.begin.rust + pop: true + - include: generic-angles-contents + - match: '\[' + scope: punctuation.section.group.begin.rust + push: + - meta_scope: meta.group.rust + - match: '\]' + scope: punctuation.section.group.end.rust + pop: true + - match: ';' + scope: punctuation.separator.rust + set: + - match: '\]' + scope: punctuation.section.group.end.rust + pop: true + - include: constant-integer-expression + - match: '(?=\S)' + pop: true + - include: generic-angles-contents + - include: type-any-identifier + - match: '{{support_type}}' + scope: support.type.rust + - match: ':' + scope: punctuation.separator.rust + - match: '\+' + scope: keyword.operator.rust + - match: '\bas\b' + scope: keyword.operator.rust + + constant-integer-expression: + - include: integers + - match: \( + scope: punctuation.section.group.begin.rust + push: + - meta_scope: meta.group.rust + - match: \) + scope: punctuation.section.group.end.rust + pop: true + - include: constant-integer-expression + - match: '{{identifier}}' + scope: variable.other.constant.rust + - match: '::' + scope: punctuation.accessor.double-colon.rust + - match: '[-+%/*]' + scope: keyword.operator.arithmetic.rust + + type-any-identifier: + - match: '&' + scope: keyword.operator.rust + - match: \bref\b + scope: storage.modifier.rust + - match: (?:\b|\*)(?:mut|const)\b + scope: storage.modifier.rust + - match: \b(fn)\b(\() + captures: + 1: storage.type.function.rust + 2: meta.group.rust punctuation.section.group.begin.rust + push: + - meta_content_scope: meta.group.rust + - match: \) + scope: meta.group.rust punctuation.section.group.end.rust + set: + - include: return-type + - match: '(?=\S)' + pop: true + - include: type-any-identifier + - match: '''{{identifier}}(?!\'')\b' + scope: storage.modifier.lifetime.rust + - match: '\b([[:upper:]]|_*[[:upper:]][[:alnum:]_]*[[:lower:]][[:alnum:]_]*)\b(::)' + scope: meta.path.rust storage.type.rust + captures: + 1: storage.type.rust + 2: punctuation.accessor.rust + - match: '{{identifier}}(::)' + scope: meta.path.rust + captures: + 1: punctuation.accessor.rust + - match: '(::)(?={{identifier}})' + scope: meta.path.rust punctuation.accessor.rust + - match: '(?=<)' + push: generic-angles + - match: '\(' + scope: punctuation.section.group.begin.rust + push: + - match: '\)' + scope: punctuation.section.group.end.rust + pop: true + - include: type-any-identifier + - include: type + - match: '\b_\b' + scope: keyword.operator.rust + + struct-identifier: + - match: '{{identifier}}(?=<)' + scope: entity.name.struct.rust + set: + - meta_scope: meta.struct.rust meta.generic.rust + - match: '(?=<)' + push: generic-angles + - match: '' + set: struct-body + - match: '{{identifier}}' + scope: entity.name.struct.rust + set: struct-body + + struct-body: + - meta_scope: meta.struct.rust + - include: comments + - match: '(?=\()' + set: struct-tuple + - match: '(?=\{)' + set: struct-classic + - match: '(?=;)' + pop: true + + struct-tuple: + - meta_scope: meta.struct.rust + - match: '\)' + scope: punctuation.section.group.end.rust + pop: true + - match: '\(' + scope: punctuation.section.group.begin.rust + # Ensure that we end the tuple at the next ) to + # prevent odd highlighting as the user is typing + with_prototype: + - match: '(?=\))' + pop: true + push: + - meta_scope: meta.group.rust + - include: comments + - include: type-any-identifier + + struct-classic: + - meta_scope: meta.struct.rust + - match: '\}' + scope: meta.block.rust punctuation.section.block.end.rust + pop: true + - match: '\{' + scope: punctuation.section.block.begin.rust + push: + - meta_scope: meta.block.rust + - match: '(?=\})' + pop: true + - include: comments + - include: attributes + - match: \b(pub)\b(?:(\()(crate)(\)))? + captures: + 1: storage.modifier.rust + 2: punctuation.definition.modifier-scope.begin.rust + 3: storage.modifier.rust + 4: punctuation.definition.modifier-scope.end.rust + - match: '{{identifier}}(?=\s*:)' + scope: variable.other.member.rust + push: + - match: ',|(?=\})' + pop: true + - include: comments + - match: ':' + scope: punctuation.separator.type.rust + - include: type-any-identifier + + macro-block: + # This meta scope requires some juggling + - meta_scope: meta.macro.rust + - match: \{ + scope: meta.block.rust punctuation.section.block.begin.rust + set: + - meta_content_scope: meta.macro.rust meta.block.rust + - match: \} + scope: meta.macro.rust meta.block.rust punctuation.section.block.end.rust + pop: true + - include: macro-block-contents + - match: \[ + scope: meta.group.rust punctuation.section.group.begin.rust + set: + - meta_content_scope: meta.macro.rust meta.group.rust + - match: \] + scope: meta.macro.rust meta.group.rust punctuation.section.group.end.rust + pop: true + - include: macro-block-contents + - match: \( + scope: meta.group.rust punctuation.section.group.begin.rust + set: + - meta_content_scope: meta.macro.rust meta.group.rust + - match: \) + scope: meta.macro.rust meta.group.rust punctuation.section.group.end.rust + pop: true + - include: macro-block-contents + - include: else-pop + + macro-block-contents: + - include: comments + - match: (?=\() + push: + - macro-terminator + - macro-body + - macro-match-operator + - macro-matcher + + macro-matcher: + - match: \( + scope: punctuation.section.group.begin.rust + set: + - meta_include_prototype: false + - meta_scope: meta.group.macro-matcher.rust + - match: \) + scope: punctuation.section.group.end.rust + pop: true + - match: ((\$)\() + captures: + 1: punctuation.section.group.begin.rust + 2: keyword.operator.rust + push: + - meta_scope: meta.group.rust + - meta_include_prototype: false + - match: (\))(?:\s*[^*+]?\s*([*+]))? + captures: + 1: punctuation.section.group.end.rust + 2: keyword.operator.rust + pop: true + - include: macro-metavariable + - include: macro-metavariable + + macro-match-operator: + - match: => + scope: keyword.operator.rust + pop: true + - include: else-pop + + macro-body: + - match: \{ + scope: punctuation.section.block.begin.rust + set: + - meta_scope: meta.block.macro-body.rust + - match: \} + scope: punctuation.section.block.end.rust + pop: true + - include: statements + - match: \( + scope: punctuation.section.group.begin.rust + set: + - meta_scope: meta.group.macro-body.rust + - match: \) + scope: punctuation.section.group.end.rust + pop: true + - include: statements + - match: \[ + scope: punctuation.section.group.begin.rust + set: + - meta_scope: meta.group.macro-body.rust + - match: \] + scope: punctuation.section.group.end.rust + pop: true + - include: statements + - include: else-pop + + macro-metavariable: + - match: '(\${{identifier}})(:)(ident|path|expr|ty|pat|stmt|block|item|meta|tt)' + captures: + 1: variable.parameter.macro.rust + 2: punctuation.separator.rust + 3: storage.type.rust + + macro-terminator: + - match: ;|, + scope: punctuation.terminator.macro-matcher.rust + - include: else-pop + + impl-definition: + - meta_scope: meta.impl.rust + - include: comments + - match: '(?=<)' + set: [impl-for, impl-generic] + - match: (?=\S) + set: impl-for + + impl-generic: + - meta_scope: meta.impl.rust + - match: '(?=<)' + push: generic-angles + - match: '' + pop: true + + impl-for: + - match: '(?=\s*(?:::|{{identifier}}|\$|<)+(<.*?>)?\s+for\s+)' + set: + - meta_scope: meta.impl.rust + - include: comments + - match: \bfor\b + scope: keyword.other.rust + set: impl-identifier + - include: type-any-identifier + - match: '' + set: impl-identifier + + impl-identifier: + - meta_content_scope: meta.impl.rust + - include: comments + - match: '(?=\{)' + set: impl-body + - match: '(?=\bwhere\b)' + set: impl-where + - match: '{{identifier}}' + scope: entity.name.impl.rust + - match: '(?=<)' + push: generic-angles + - match: '&' + scope: keyword.operator.rust + - match: \b(mut|ref)\b + scope: storage.modifier.rust + - match: '''{{identifier}}(?!\'')\b' + scope: storage.modifier.lifetime.rust + + impl-where: + - meta_scope: meta.impl.rust + - include: comments + - match: '(?=\{)' + set: impl-body + - match: \bfor\b + scope: keyword.other.rust + - match: \bwhere\b + scope: keyword.other.rust + - include: type-any-identifier + - match: ':' + scope: punctuation.separator.rust + + impl-body: + - meta_scope: meta.impl.rust + - include: statements-block + + fn-definition: + - meta_scope: meta.function.rust + - include: comments + - match: '{{identifier}}' + scope: entity.name.function.rust + set: fn-generic + + fn-generic: + - include: comments + - match: '(?=<)' + push: generic-angles + - match: '(?=\()' + set: fn-parameters + # Escape for incomplete expression + - match: '(?=\S)' + pop: true + + fn-parameters: + - meta_scope: meta.function.rust + - include: comments + - match: '\)' + scope: meta.function.parameters.rust punctuation.section.parameters.end.rust + set: fn-return + - match: '\(' + scope: punctuation.section.parameters.begin.rust + push: + - meta_scope: meta.function.parameters.rust + - include: comments + - match: '(?=\))' + pop: true + - match: '\(' + scope: meta.group.rust punctuation.section.group.begin.rust + push: + - meta_content_scope: meta.group.rust + - match: '\)' + scope: meta.group.rust punctuation.section.group.end.rust + pop: true + - match: ',' + scope: punctuation.separator.rust + - match: '{{identifier}}' + scope: variable.parameter.rust + - match: '(:)\s*(\()' + captures: + 1: punctuation.separator.rust + 2: meta.group.rust punctuation.section.group.begin.rust + push: + - meta_content_scope: meta.group.rust + - match: '\)' + scope: meta.group.rust punctuation.section.group.end.rust + pop: true + - match: ',' + scope: punctuation.separator.rust + - include: type-any-identifier + - match: \bself\b + scope: variable.parameter.rust + - match: '({{identifier}})\s*(:(?!:))' + captures: + 1: variable.parameter.rust + 2: punctuation.separator.rust + - include: type-any-identifier + + fn-return: + - meta_scope: meta.function.rust + - include: comments + - match: '(?=\{)' + set: fn-body + - match: '(?=\bwhere\b)' + set: fn-where + - include: return-type + # Escape for incomplete expression + - match: '(?=\S)' + pop: true + + fn-where: + - meta_scope: meta.function.rust + - include: comments + - match: '(?=\{)' + set: fn-body + - match: \bfor\b + scope: keyword.other.rust + - match: \bwhere\b + scope: keyword.other.rust + - include: type-any-identifier + - match: ':' + scope: punctuation.separator.rust + + fn-body: + - meta_scope: meta.function.rust + - match: '\}' + scope: meta.block.rust punctuation.section.block.end.rust + pop: true + - match: '\{' + scope: punctuation.section.block.begin.rust + push: + - meta_scope: meta.block.rust + - match: '(?=\})' + pop: true + - include: statements + + statements-block: + - include: comments + - match: '\}' + scope: meta.block.rust punctuation.section.block.end.rust + pop: true + - match: '\{' + scope: punctuation.section.block.begin.rust + push: [block-body, try-closure] + + comments: + - include: block-comments + - match: "//[!/]" + scope: punctuation.definition.comment.rust + push: + - meta_scope: comment.line.documentation.rust + - match: $\n? + pop: true + - match: // + scope: punctuation.definition.comment.rust + push: + - meta_scope: comment.line.double-slash.rust + - match: $\n? + pop: true + + block-comments: + - match: '/\*[!\*][^\*/]' + scope: punctuation.definition.comment.rust + push: + - meta_scope: comment.block.documentation.rust + - match: \*/ + scope: punctuation.definition.comment.rust + pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.rust + - include: block-comments + - match: /\* + scope: punctuation.definition.comment.rust + push: + - meta_scope: comment.block.rust + - match: \*/ + scope: punctuation.definition.comment.rust + pop: true + - include: block-comments + + strings: + - include: byte-string + - include: raw-byte-string + - include: string + - include: raw-string + + chars: + - include: char + - include: byte + + escaped-byte: + - match: '{{escaped_byte}}' + scope: constant.character.escape.rust + + byte: + - match: "(b)(')(?=([^'\\\\]|{{escaped_byte}})')" + captures: + 1: storage.type.string.rust + 2: punctuation.definition.string.begin.rust + push: + - meta_include_prototype: false + - meta_scope: string.quoted.single.rust + - match: \' + scope: punctuation.definition.string.end.rust + pop: true + - include: escaped-byte + + byte-string: + - match: '(b)(")' + captures: + 1: storage.type.string.rust + 2: punctuation.definition.string.begin.rust + push: + - meta_include_prototype: false + - meta_scope: string.quoted.double.rust + - match: '"' + scope: punctuation.definition.string.end.rust + pop: true + - include: escaped-byte + + raw-byte-string: + - match: (br)(#*)" + captures: + 1: storage.type.string.rust + 2: punctuation.definition.string.begin.rust + push: + - meta_include_prototype: false + - meta_scope: string.quoted.double.raw.rust + - match: '"\2' + scope: punctuation.definition.string.end.rust + pop: true + + escaped-char: + - match: '{{escaped_char}}' + scope: constant.character.escape.rust + + char: + - match: "'(?=([^'\\\\]|{{escaped_char}})')" + scope: punctuation.definition.string.begin.rust + push: + - meta_scope: string.quoted.single.rust + - match: \' + scope: punctuation.definition.string.end.rust + pop: true + - include: escaped-char + + string: + - match: '"' + scope: punctuation.definition.string.begin.rust + push: + - meta_include_prototype: false + - meta_scope: string.quoted.double.rust + - match: '"' + scope: punctuation.definition.string.end.rust + pop: true + - include: escaped-char + - match: '(\\)$' + scope: punctuation.separator.continuation.line.rust + + raw-string: + - match: (r)((#*)") + captures: + 1: storage.type.string.rust + 2: punctuation.definition.string.begin.rust + push: + - meta_include_prototype: false + - meta_scope: string.quoted.double.raw.rust + - match: '"\3' + scope: punctuation.definition.string.end.rust + pop: true + + format-string: + - match: '"' + scope: punctuation.definition.string.begin.rust + push: + - meta_include_prototype: false + - meta_scope: string.quoted.double.rust + - match: '"' + scope: punctuation.definition.string.end.rust + pop: true + - include: escaped-char + - include: format-escapes + - match: '(\\)$' + scope: punctuation.separator.continuation.line.rust + + format-raw-string: + - match: (r)(#*)" + captures: + 1: storage.type.string.rust + 2: punctuation.definition.string.begin.rust + push: + - meta_include_prototype: false + - meta_scope: string.quoted.double.raw.rust + - match: '"\2' + scope: punctuation.definition.string.end.rust + pop: true + - include: format-escapes + + format-escapes: + - match: '\{\{|\}\}' + scope: constant.character.escape.rust + - match: |- + (?x) # Spec from http://doc.rust-lang.org/std/fmt/ + \{ + (\d+|{{identifier}})? + ( + : # format_spec delimiter + (.?[<>^])? # [[fill]align] + [+-]? # [sign] + \#? # ['#'] + 0? # [0] + (\d\$?)? # [width] + (\.(\d\$?|\*)?)? # ['.' precision] + (\?|{{identifier}})? # [type] + )? + \} + scope: constant.other.placeholder.rust + + numbers: + - include: floats + - include: integers + + floats: + - match: '\b((?:\d[\d_]*)?\d\.)(\d[\d_]*(?:[eE][+-]?[\d_]*\d[\d_]*)?)(f32|f64)?' + captures: + 1: constant.numeric.float.rust + 2: constant.numeric.float.rust + 3: storage.type.numeric.rust + - match: '\b((?:\d[\d_]*)?\d\.)(?!\.)' + scope: constant.numeric.float.rust + - match: '\b(\d[\d_]*)(f32|f64)\b' + captures: + 1: constant.numeric.float.rust + 2: storage.type.numeric.rust + + integers: + - match: '\b(\d[\d_]*)({{int_suffixes}})?\b' + captures: + 1: constant.numeric.integer.decimal.rust + 2: storage.type.numeric.rust + - match: '\b(0x[\h_]*\h[\h_]*)({{int_suffixes}})?\b' + captures: + 1: constant.numeric.integer.hexadecimal.rust + 2: storage.type.numeric.rust + - match: '\b(0o[0-7_]*[0-7][0-7_]*)({{int_suffixes}})?\b' + captures: + 1: constant.numeric.integer.octal.rust + 2: storage.type.numeric.rust + - match: '\b(0b[0-1_]*[0-1][0-1_]*)({{int_suffixes}})?\b' + captures: + 1: constant.numeric.integer.binary.rust + 2: storage.type.numeric.rust + + basic-identifiers: + - match: '\b([[:upper:]_][[:upper:][:digit:]_]+)\b' + scope: constant.other.rust + - match: '\b(c_[[:lower:][:digit:]_]+|[[:lower:]_][[:lower:][:digit:]_]*_t)\b' + scope: storage.type.rust + - match: '(?={{identifier}}::)' + push: + - meta_scope: meta.path.rust + - include: no-path-identifiers + - match: '::' + scope: punctuation.accessor.rust + set: no-type-names + - match: '{{identifier}}(::)' + scope: meta.path.rust + captures: + 1: punctuation.accessor.rust + push: no-type-names + - match: '(::)(?={{identifier}})' + scope: meta.path.rust punctuation.accessor.rust + push: no-type-names + - include: no-path-identifiers + + no-path-identifiers: + - match: \b(self)\b + scope: variable.language.rust + - match: \b(super)\b + scope: keyword.other.rust + + no-type-names: + # This push state prevents highlighting basic types like + # i32, etc when following :: + - include: comments + - include: basic-identifiers + - match: '{{identifier}}' + - match: '(?=<)' + push: generic-angles + - match: '' + pop: true diff --git a/assets/syntaxes/Packages/Rust/RustComment.tmPreferences b/assets/syntaxes/Packages/Rust/RustComment.tmPreferences new file mode 100644 index 000000000..5ea948fd9 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/RustComment.tmPreferences @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Rust Comments</string> + <key>scope</key> + <string>source.rust</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string>// </string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_START_2</string> + <key>value</key> + <string>/*</string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_END_2</string> + <key>value</key> + <string>*/</string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_DISABLE_INDENT</string> + <key>value</key> + <string>no</string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Rust/RustIndent.tmPreferences b/assets/syntaxes/Packages/Rust/RustIndent.tmPreferences new file mode 100644 index 000000000..d3795b322 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/RustIndent.tmPreferences @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Rust Indent</string> + <key>scope</key> + <string>source.rust</string> + <key>settings</key> + <dict> + <key>decreaseIndentPattern</key> + <string>^(.*\*/)?\s*\}.*$</string> + <key>increaseIndentPattern</key> + <string>^.*\{[^}"']*$</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Rust/RustSymbols.tmPreferences b/assets/syntaxes/Packages/Rust/RustSymbols.tmPreferences new file mode 100644 index 000000000..e1382e38c --- /dev/null +++ b/assets/syntaxes/Packages/Rust/RustSymbols.tmPreferences @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Rust Symbols</string> + <key>scope</key> + <string>entity.name.function.rust, entity.name.macro.rust, entity.name.struct.rust, entity.name.enum.rust, entity.name.module.rust, entity.name.type.rust, entity.name.impl.rust, entity.name.trait.rust</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>showInIndexedSymbolList</key> + <integer>1</integer> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Rust/Snippets/Err.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/Err.sublime-snippet new file mode 100644 index 000000000..8fc6fa54b --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/Err.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[Err(${1})]]></content> + <tabTrigger>Err</tabTrigger> + <scope>source.rust</scope> + <description>Err(…)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/Ok.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/Ok.sublime-snippet new file mode 100644 index 000000000..2f74526a8 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/Ok.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[Ok(${1:result})]]></content> + <tabTrigger>Ok</tabTrigger> + <scope>source.rust</scope> + <description>Ok(…)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/Some.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/Some.sublime-snippet new file mode 100644 index 000000000..c929055b1 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/Some.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[Some(${1})]]></content> + <tabTrigger>Some</tabTrigger> + <scope>source.rust</scope> + <description>Some(…)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/assert.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/assert.sublime-snippet new file mode 100644 index 000000000..ce21e1a06 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/assert.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[ +assert!(${1}); +]]></content> + <tabTrigger>assert</tabTrigger> + <scope>source.rust</scope> + <description>assert!(…)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/assert_eq.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/assert_eq.sublime-snippet new file mode 100644 index 000000000..0f2a0482b --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/assert_eq.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[ +assert_eq!(${1}, ${2}); +]]></content> + <tabTrigger>assert_eq</tabTrigger> + <scope>source.rust</scope> + <description>assert_eq!(…, …)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/bench.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/bench.sublime-snippet new file mode 100644 index 000000000..407676e95 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/bench.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[ +#[bench] +fn ${1:name}(b: &mut test::Bencher) { + ${2:b.iter(|| ${3:/* benchmark code */})} +}]]></content> + <tabTrigger>bench</tabTrigger> + <scope>source.rust</scope> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/const.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/const.sublime-snippet new file mode 100644 index 000000000..5a23263dc --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/const.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[const ${1:CONST}: ${2:Type} = ${4:init};]]></content> + <tabTrigger>const</tabTrigger> + <scope>source.rust</scope> + <description>const …: … = …;</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/else.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/else.sublime-snippet new file mode 100644 index 000000000..f62be7807 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/else.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[else { + ${1:unimplemented!();} +}]]></content> + <tabTrigger>else</tabTrigger> + <scope>source.rust</scope> + <description>else { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/enum.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/enum.sublime-snippet new file mode 100644 index 000000000..b0f0d78f2 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/enum.sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[#[derive(Debug)] +enum ${1:Name} { + ${2:Variant1}, + ${3:Variant2}, +}]]></content> + <tabTrigger>enum</tabTrigger> + <scope>source.rust</scope> + <description>enum … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/extern-crate.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/extern-crate.sublime-snippet new file mode 100644 index 000000000..027344125 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/extern-crate.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[extern crate ${1:name};]]></content> + <tabTrigger>extern-crate</tabTrigger> + <scope>source.rust</scope> + <description>extern crate …;</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/extern-fn.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/extern-fn.sublime-snippet new file mode 100644 index 000000000..c65cd7469 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/extern-fn.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[extern "C" fn ${1:name}(${2:arg}: ${3:Type}) -> ${4:RetType} { + ${5:// add code here} +}]]></content> + <tabTrigger>extern-fn</tabTrigger> + <scope>source.rust</scope> + <description>extern "C" fn …(…) { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/extern-mod.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/extern-mod.sublime-snippet new file mode 100644 index 000000000..b5ce8d416 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/extern-mod.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[extern "C" { + ${2:// add code here} +}]]></content> + <tabTrigger>extern-mod</tabTrigger> + <scope>source.rust</scope> + <description>extern "C" { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/fmt.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/fmt.sublime-snippet new file mode 100644 index 000000000..e454c1e1e --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/fmt.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[fmt!("${1:\{${2::?}\}}"${1/([^\{])*(\{.*\})?.*/(?2:, :\);)/}$3${1/([^\{])*(\{.*\})?.*/(?2:\))/}]]></content> + <tabTrigger>fmt</tabTrigger> + <scope>source.rust</scope> + <description>fmt!(…)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/fn.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/fn.sublime-snippet new file mode 100644 index 000000000..52311c551 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/fn.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[fn ${1:name}(${2:arg}: ${3:Type}) -> ${4:RetType} { + ${5:unimplemented!();} +}]]></content> + <tabTrigger>fn</tabTrigger> + <scope>source.rust</scope> + <description>fn …(…) { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/for.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/for.sublime-snippet new file mode 100644 index 000000000..14c890c83 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/for.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[for ${1:pat} in ${2:expr} { + ${3:unimplemented!();} +}]]></content> + <tabTrigger>for</tabTrigger> + <scope>source.rust</scope> + <description>for … in … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/if-let.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/if-let.sublime-snippet new file mode 100644 index 000000000..d9cb95ebd --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/if-let.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[if let ${1:Some(pat)} = ${2:expr} { + ${2:unimplemented!();} +}]]></content> + <tabTrigger>if-let</tabTrigger> + <scope>source.rust</scope> + <description>if let … = … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/if.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/if.sublime-snippet new file mode 100644 index 000000000..86da7d8a4 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/if.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[if ${1:condition} { + ${2:unimplemented!();} +}]]></content> + <tabTrigger>if</tabTrigger> + <scope>source.rust</scope> + <description>if … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/impl-trait.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/impl-trait.sublime-snippet new file mode 100644 index 000000000..4b75955c3 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/impl-trait.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[impl ${1:Trait} for ${2:Type} { + ${3:// add code here} +}]]></content> + <tabTrigger>impl-trait</tabTrigger> + <scope>source.rust</scope> + <description>impl … for … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/impl.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/impl.sublime-snippet new file mode 100644 index 000000000..59c957cdf --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/impl.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[impl ${1:Type} { + ${2:// add code here} +}]]></content> + <tabTrigger>impl</tabTrigger> + <scope>source.rust</scope> + <description>impl … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/let.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/let.sublime-snippet new file mode 100644 index 000000000..217fde8bd --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/let.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[let ${1:pat} = ${2:expr};]]></content> + <tabTrigger>let</tabTrigger> + <scope>source.rust</scope> + <description>let … = …;</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/loop.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/loop.sublime-snippet new file mode 100644 index 000000000..877935efb --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/loop.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[loop { + ${2:unimplemented!();} +}]]></content> + <tabTrigger>loop</tabTrigger> + <scope>source.rust</scope> + <description>loop { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/macro_rules.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/macro_rules.sublime-snippet new file mode 100644 index 000000000..e6d1c1aaf --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/macro_rules.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[macro_rules! ${1:name} { + (${2}) => (${3}) +}]]></content> + <tabTrigger>macro_rules</tabTrigger> + <scope>source.rust</scope> + <description>macro_rules! … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/main.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/main.sublime-snippet new file mode 100644 index 000000000..635dbe6a4 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/main.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[fn main() { + ${1:unimplemented!();} +}]]></content> + <tabTrigger>main</tabTrigger> + <scope>source.rust</scope> + <description>fn main() { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/match.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/match.sublime-snippet new file mode 100644 index 000000000..a531a8b78 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/match.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[match ${1:expr} { + ${2:Some(expr)} => ${3:expr}, + ${4:None} => ${5:expr}, +}]]></content> + <tabTrigger>match</tabTrigger> + <scope>source.rust</scope> + <description>match … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/mod.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/mod.sublime-snippet new file mode 100644 index 000000000..a3f327c3b --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/mod.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[mod ${1:name} { + ${2:// add code here} +}]]></content> + <tabTrigger>mod</tabTrigger> + <scope>source.rust</scope> + <description>mod … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/panic.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/panic.sublime-snippet new file mode 100644 index 000000000..f7e436365 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/panic.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[panic!("${1:\{${2::?}\}}"${1/([^\{])*(\{.*\})?.*/(?2:, :\);)/}$3${1/([^\{])*(\{.*\})?.*/(?2:\);)/}]]></content> + <tabTrigger>panic</tabTrigger> + <scope>source.rust</scope> + <description>panic!(…)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/print.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/print.sublime-snippet new file mode 100644 index 000000000..c9b366f68 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/print.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[print!("${1:\{${2::?}\}}"${1/([^\{])*(\{.*\})?.*/(?2:, :\);)/}$3${1/([^\{])*(\{.*\})?.*/(?2:\);)/}]]></content> + <scope>source.rust</scope> + <tabTrigger>print</tabTrigger> + <description>print!(…)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/println.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/println.sublime-snippet new file mode 100644 index 000000000..8026a8eee --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/println.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[println!("${1:\{${2::?}\}}"${1/([^\{])*(\{.*\})?.*/(?2:, :\);)/}$3${1/([^\{])*(\{.*\})?.*/(?2:\);)/}]]></content> + <scope>source.rust</scope> + <tabTrigger>println</tabTrigger> + <description>println!(…)</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/static.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/static.sublime-snippet new file mode 100644 index 000000000..ddcf6165a --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/static.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[static ${1:STATIC}: ${2:Type} = ${4:init};]]></content> + <tabTrigger>static</tabTrigger> + <scope>source.rust</scope> + <description>static …: … = …;</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/struct-tuple.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/struct-tuple.sublime-snippet new file mode 100644 index 000000000..d3861e4ec --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/struct-tuple.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[struct ${1:Name}(${2:Type});]]></content> + <tabTrigger>struct-tuple</tabTrigger> + <scope>source.rust</scope> + <description>struct …(…);</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/struct-unit.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/struct-unit.sublime-snippet new file mode 100644 index 000000000..8860d33d3 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/struct-unit.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[struct ${1:Name};]]></content> + <tabTrigger>struct-unit</tabTrigger> + <scope>source.rust</scope> + <description>struct …;</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/struct.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/struct.sublime-snippet new file mode 100644 index 000000000..bfa149c7f --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/struct.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[#[derive(Debug)] +struct ${1:Name} { + ${2:field}: ${3:Type} +}]]></content> + <tabTrigger>struct</tabTrigger> + <scope>source.rust</scope> + <description>struct … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/test.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/test.sublime-snippet new file mode 100644 index 000000000..e33119b04 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/test.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[ +#[test] +fn ${1:name}() { + ${2:unimplemented!();} +}]]></content> + <tabTrigger>test</tabTrigger> + <scope>source.rust</scope> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/trait.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/trait.sublime-snippet new file mode 100644 index 000000000..86e580ccf --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/trait.sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[trait ${1:Name} { + ${2:// add code here} +} +]]></content> + <tabTrigger>trait</tabTrigger> + <scope>source.rust</scope> + <description>trait … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/type.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/type.sublime-snippet new file mode 100644 index 000000000..ecc3c5276 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/type.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[type ${1:Alias} = ${2:Type};]]></content> + <tabTrigger>type</tabTrigger> + <scope>source.rust</scope> + <description>type … = …;</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/while-let.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/while-let.sublime-snippet new file mode 100644 index 000000000..94a3506bc --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/while-let.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[while let ${1:Some(pat)} = ${2:expr} { + ${2:unimplemented!();} +}]]></content> + <tabTrigger>while-let</tabTrigger> + <scope>source.rust</scope> + <description>while let … = … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/Snippets/while.sublime-snippet b/assets/syntaxes/Packages/Rust/Snippets/while.sublime-snippet new file mode 100644 index 000000000..976e9a42f --- /dev/null +++ b/assets/syntaxes/Packages/Rust/Snippets/while.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[while ${1:condition} { + ${2:unimplemented!();} +}]]></content> + <tabTrigger>while</tabTrigger> + <scope>source.rust</scope> + <description>while … { … }</description> +</snippet> diff --git a/assets/syntaxes/Packages/Rust/syntax_test_rust.rs b/assets/syntaxes/Packages/Rust/syntax_test_rust.rs new file mode 100644 index 000000000..3ba2ebe02 --- /dev/null +++ b/assets/syntaxes/Packages/Rust/syntax_test_rust.rs @@ -0,0 +1,1150 @@ +// SYNTAX TEST "Packages/Rust/Rust.sublime-syntax" + +// Line comments +// <- comment.line.double-slash punctuation.definition.comment +// ^^^^^^^^^^^^^^ comment.line.double-slash + +// <- - comment +/// Line doc comments +// <- comment.line.documentation +// ^^^^^^^^^^^^^ comment.line.documentation + +/*! +// <- comment.block.documentation punctuation.definition.comment + // <- comment.block.documentation +//^ comment.block.documentation +Block doc comments +// ^^^^^^^^^^^^^^^^ comment.block.documentation +/* Nested comments */ +// ^^^^^^^^^^^^^^^^^^ comment.block.documentation comment.block +*/ + +/** + * +// ^ comment.block.documentation.rust punctuation.definition.comment.rust +*/ + +let c = 'c'; +// <- storage.type +// ^ keyword.operator.assignment +// ^^^ string.quoted.single +let b = b'c'; +// <- storage.type +// ^ keyword.operator.assignment +// ^ storage.type +// ^^^ string.quoted.single + +let s = "This is a string \x01_\u{007F}_\"_\'_\\_\r_\n_\t_\0"; +// <- storage.type +// ^ keyword.operator.assignment +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +// ^^^^ constant.character.escape +// ^^^^^^^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +let r = r##"This is a raw string, no escapes! \x00 \0 \n"###; +// <- storage.type +// ^ keyword.operator.assignment +// ^ storage.type +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.raw - constant.character.escape +// ^^^ punctuation.definition.string.begin.rust +// ^^^ punctuation.definition.string.end.rust +// ^ - string + +let bytes = b"This won't escape unicode \u{0123}, but will do \x01_\"_\'_\\_\r_\n_\t_\0"; +// <- storage.type +// ^ keyword.operator +// ^ storage.type +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +// ^^^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape +// ^^ constant.character.escape + +let raw_bytes = br#"This won't escape anything either \x01 \""#; +// <- storage.type +// ^ keyword.operator +// ^^ storage.type +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double - constant.character.escape + +0; +// <- constant.numeric.integer.decimal +1_000u32; +// <- constant.numeric.integer.decimal + // <- constant.numeric.integer.decimal +//^^^ constant.numeric.integer.decimal +// ^^^ storage.type - constant.numeric.integer.decimal +1i64; +// <- constant.numeric.integer.decimal + // <- storage.type - constant.numeric.integer.decimal +//^^ storage.type - constant.numeric.integer.decimal + +0.2; +// <- constant.numeric.float + // <- constant.numeric.float +//^ constant.numeric.float +1_000.0_; +// <- constant.numeric.float + // <- constant.numeric.float +//^^^^^^ constant.numeric.float +1.0f32; +// <- constant.numeric.float + // <- constant.numeric.float +//^ constant.numeric.float +// ^^^ storage.type - constant.numeric.float +0.; +// <- constant.numeric.float + // <- constant.numeric.float +0f64; +// <- constant.numeric.float + // <- storage.type - constant.numeric.float +//^^ storage.type - constant.numeric.float + +0x0; +// <- constant.numeric.integer.hexadecimal + // <- constant.numeric.integer.hexadecimal +//^ constant.numeric.integer.hexadecimal +0xfa; +// <- constant.numeric.integer.hexadecimal + // <- constant.numeric.integer.hexadecimal +//^^ constant.numeric.integer.hexadecimal +0xFA_01i32; +// <- constant.numeric.integer.hexadecimal + // <- constant.numeric.integer.hexadecimal +//^^^^^ constant.numeric.integer.hexadecimal +// ^^^ storage.type - constant.numeric.integer.hexadecimal + +0b1; +// <- constant.numeric.integer.binary + // <- constant.numeric.integer.binary +//^ constant.numeric.integer.binary +0b0_1u8; +// <- constant.numeric.integer.binary + // <- constant.numeric.integer.binary +//^^^ constant.numeric.integer.binary +// ^^ storage.type - constant.numeric.integer.binary + +0o0; +// <- constant.numeric.integer.octal + // <- constant.numeric.integer.octal +//^ constant.numeric.integer.octal +0o0000_0010u64; +// <- constant.numeric.integer.octal + // <- constant.numeric.integer.octal +//^^^^^^^^^ constant.numeric.integer.octal +// ^^^ storage.type - constant.numeric.integer.octal + +extern crate foo; +// <- keyword.other +//^^^^ keyword.other +// ^ - keyword.other +// ^^^^^ keyword.other + +mod trafile; +// <- storage.type.module +mod comment; +// <- storage.type.module +mod location; + +pub use self::trafile::*; +// <- storage.modifier +// ^ keyword.other +// ^^^^^^^^^^^^^^^ meta.path +// ^^ punctuation.accessor + +use std::fmt; +// <- keyword.other +// ^^^^^ meta.path +// ^^ punctuation.accessor +// ^^^ - meta.path +use foo::i32; +// ^^^^^ meta.path +// ^^ punctuation.accessor +// ^^^ - meta.path storage.type +use foo::Bar; +// ^^^^^ meta.path +// ^^ punctuation.accessor +use foo::{Baz, QUX, quux}; +// ^^^^^ meta.path +// ^^ punctuation.accessor +// ^^^^^^^^^^^^^^^^ meta.block +// ^^^ constant.other + +String my_var = format!("Hello {0}", "World"); +// ^^^ support.type +// ^ keyword.operator.assignment +// ^^^^^^^ support.macro +// ^ punctuation.section.group.begin +// ^^^^^^^^^^^^^^^^^^^^^^ meta.group +// ^^^^^^^^^^^ string.quoted.double +// ^^^ constant.other.placeholder +// ^ punctuation.section.group.end + +my_var = format!("Hello {name}, how are you?", +// ^ keyword.operator.assignment +// ^^^^^^^ support.macro +// ^ punctuation.section.group.begin +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +// ^^^^^^ constant.other.placeholder + name="John"); +// ^^^^^^^^^^^^^ meta.group +// ^ keyword.operator.assignment +// ^^^^^^ string.quoted.double +// ^ punctuation.section.group.end + +struct BasicStruct(i32); +// ^^^^^^^^^^^^^^^^^^^^ meta.struct +// <- storage.type.struct +//^^^^ storage.type.struct +// ^^^^^^^^^^^ entity.name.struct +// ^ punctuation.section.group.begin +// ^^^ storage.type +// ^ punctuation.section.group.end + +#[derive(Debug)] +// <- meta.annotation punctuation.definition.annotation +//^^^^^^^^^^^^^^ meta.annotation +//^^^^^^ variable.annotation +// ^^^^^^^ meta.annotation.parameters +struct PrintableStruct(Box<i32>); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.struct +// <- storage.type.struct +//^^^^ storage.type.struct +// ^^^^^^^^^^^^^^^ entity.name.struct +// ^ punctuation.section.group.begin +// ^^^ support.type +// ^^^^^^^^ meta.generic +// ^ punctuation.definition.generic.begin +// ^^^ storage.type +// ^ punctuation.definition.generic.end +// ^ punctuation.section.group.end + +impl fmt::Display for PrintableStruct { +// <- meta.impl +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.impl +// <- storage.type.impl +//^^ storage.type.impl +// ^^^^^ meta.path +// ^^ punctuation.accessor +// ^^^ keyword.other +// ^^^^^^^^^^^^^^^ entity.name.impl +// ^ meta.block punctuation.section.block.begin + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.impl +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +// ^^ storage.type.function +// ^^^ entity.name.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters +// ^ punctuation.section.parameters.begin +// ^ keyword.operator +// ^^^^ variable.parameter +// ^ variable.parameter +// ^ punctuation.separator +// ^ keyword.operator +// ^^^ storage.modifier +// ^^^^^ meta.path +// ^ punctuation.section.parameters.end +// ^^ punctuation.separator +// ^^^^^ meta.path +// ^^ punctuation.accessor +// ^ meta.block punctuation.section.block.begin + write!(f, "{}", self.0) +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +// ^^^^^^ support.macro +// ^^^^^^^^^^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^^ string.quoted.double +// ^^ constant.other.placeholder +// ^^^^ variable.language +// ^ punctuation.accessor.dot +// ^ punctuation.section.group.end + } +// ^^ meta.function meta.block +// ^ punctuation.section.block.end +} +// <- meta.block punctuation.section.block.end + +let logical: bool = true; +// ^ punctuation.separator +// ^^^^ storage.type +// ^ keyword.operator.assignment +// ^^^^ constant.language +// ^ punctuation.terminator +let mut mutable = 12; +// ^^^ storage.modifier +// ^ punctuation.terminator + +let ch = '∞'; +// ^^^ string.quoted.single +// ^ punctuation.terminator + +let tuple = (1.0, 0i32, "Hello"); +// ^^^^^^^^^^^^^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^ constant.numeric.float +// ^ constant.numeric.integer.decimal +// ^^^ storage.type +// ^^^^^^^ string.quoted.double +// ^ punctuation.section.group.end +// ^ punctuation.terminator + +let xs: [i32; 5] = [1, 2, 3, 4, 5]; +// ^ punctuation.separator +// ^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^ storage.type +// ^ punctuation.separator +// ^ constant.numeric.integer.decimal +// ^ punctuation.section.group.end +// ^^^^^^^^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^ punctuation.separator +// ^ punctuation.separator +// ^ punctuation.separator +// ^ punctuation.separator +// ^ punctuation.section.group.end +// ^ punctuation.terminator + +let xsl = &xs; +// ^ keyword.operator + +type FnPointer = fn(i32) -> i32; +// ^^^^^^^^^ entity.name.type +// ^^ storage.type.function +// ^^^^^ meta.group +// ^^^ storage.type +// ^^ punctuation.separator +// ^^^ storage.type + +type GenFnPointer = Bar<fn(i32) -> i32>; +// ^^^^^^^^^^^^ entity.name.type +// ^^^^^^^^^^^^^^^^^^^ meta.generic +// ^^ storage.type.function +// ^^^^^ meta.group +// ^^^ storage.type +// ^^ punctuation.separator +// ^^^ storage.type +// ^ - meta.generic + +type GenFnPointer2 = Bar<extern "C" fn()>; +// ^^^^^^^^^^^^^ entity.name.type +// ^^^^^^^^^^^^^^^^^^^^ meta.generic +// ^^^^^^ keyword.other +// ^^^ string.quoted.double +// ^^ storage.type.function +// ^ - meta.generic + +struct Nil; +// ^^^^^^^ meta.struct +// ^ - meta.struct +struct Pair(i32, i32); +// ^^^^^^^^^^^^^^^^^^ meta.struct +// ^^^ storage.type +// ^^^ storage.type +// ^ - meta.struct + +enum OperatingSystem +// <- storage.type.enum +// ^^^^^^^^^^^^^^^^^ meta.enum +// ^^^^^^^^^^^^^^^ entity.name.enum +{ +// <- meta.enum meta.block punctuation.section.block.begin + Osx, + Windows, + Linux, + Bsd(String), + // ^^^^^^ support.type + Info { field: i32, value: str } + // ^ meta.block meta.block punctuation.section.block.begin + // ^^^ storage.type + // ^^^ storage.type + // ^ meta.block meta.block punctuation.section.block.end +} +// <- meta.enum meta.block punctuation.section.block.end + +const ZERO: u64 = 0; +// <- storage.type +// ^^^^ constant.other +// ^ punctuation.separator +// ^^^ storage.type +// ^ keyword.operator.assignment +// ^ constant.numeric.integer.decimal +static NAME: &'static str = "John"; +// <- storage.type +// ^ keyword.operator +// ^^^^^^^ storage.modifier.lifetime +// ^^^ storage.type +// ^ keyword.operator.assignment +// ^^^^^^ string.quoted.double + + +let z = { +// ^ meta.block punctuation.section.block.begin + 2 * 5 +// ^ constant.numeric.integer.decimal +// ^ keyword.operator.arithmetic +// ^ constant.numeric.integer.decimal +}; +// <- meta.block punctuation.section.block.end + +fn my_func(x: i32) +// <- storage.type.function +// ^^^^^^^ entity.name.function +// ^^^^^^^^ meta.function.parameters +// ^ punctuation.section.parameters.begin +// ^ variable.parameter +// ^ punctuation.separator +// ^ punctuation.section.parameters.end +{ +// <- meta.function meta.block punctuation.section.block.begin + +} +// <- meta.function meta.block punctuation.section.block.end + +let n = 5; + +if n < 0 { +// ^ keyword.operator.comparison +// ^ meta.block punctuation.section.block.begin +// <- keyword.control + print!("{} is negative", n); +// ^ punctuation.terminator +} else if n > 0 { +// <- meta.block punctuation.section.block.end +// ^^^ keyword.control +// ^ meta.block punctuation.section.block.begin +// ^^ keyword.control + print!("{0} is positive", n); +} else { +// <- meta.block punctuation.section.block.end +// ^^^ keyword.control +// ^ meta.block punctuation.section.block.begin + print!("{} is zero", n); +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block +} +// <- meta.block punctuation.section.block.end + +let big_n = +// ^ keyword.operator.assignment + if n < 10 && n > -10 { +// ^ meta.block punctuation.section.block.begin + 10 * n + } else { +// ^ meta.block punctuation.section.block.end +// ^ meta.block punctuation.section.block.begin + n / 2 + }; +// ^ meta.block punctuation.section.block.end + +'label_name: loop { +// ^^^^^^^^ entity.name.label +// ^ punctuation.separator +// ^^^^ keyword.control +// ^ meta.block punctuation.section.block.begin + n += 1; +// ^^ keyword.operator.assignment + if n / 2 == 5 { +// ^ keyword.operator.arithmetic +// ^^ keyword.operator.comparison + continue; +// ^^^^^^^^ keyword.control + } + if n > 9 { + break; +// ^^^^^ keyword.control + } +} + +while n < 50 { +//^^^ keyword.control + n = n * 2; +} + +for i in 1..10 { +// <- keyword.control +// ^^ keyword.operator +// ^ constant.numeric.integer.decimal +// ^^ keyword.operator.range +// ^^ constant.numeric.integer.decimal + println!("I: {}", i); +// ^^^^^^^^^^^^^^^^^^^^^^ meta.block +} +// <- meta.block punctuation.section.block.end + +let o = match n { +// ^^^^^ keyword.control + 1 => "one", +// ^ constant.numeric.integer.decimal +// ^^ keyword.operator +// ^^^^^ string.quoted.double + 2 => "two", +// ^ constant.numeric.integer.decimal +// ^^ keyword.operator +// ^^^^^ string.quoted.double + 3...5 => "a few", +// ^ constant.numeric.integer.decimal +// ^^^ keyword.operator.range +// ^ constant.numeric.integer.decimal +// ^^ keyword.operator +// ^^^^^^^ string.quoted.double + _ => "lots", +// ^ keyword.operator +// ^^ keyword.operator +}; + +let mut j = BasicStruct(10); +// ^^^ storage.modifier +// ^^ constant.numeric.integer.decimal + +if let BasicStruct(i) = j { +// ^^^ storage.type +// ^ keyword.operator.assignment +// ^ meta.block punctuation.section.block.begin + println!("Basic value: {}", i); +} +// <- meta.block punctuation.section.block.end + +while let BasicStruct(k) = j { +//^^^ keyword.control +// ^^^ storage.type +// ^ keyword.operator.assignment +// ^ meta.block punctuation.section.block.begin + println!("Constructed example: {}", j) + j = BasicStruct(j + 1); + if k > 20 { + break; + //^^^ meta.block meta.block keyword.control + } +} +// <- meta.block punctuation.section.block.end + +fn foo<A>(i: u32, b: i64) -> u32 { +// <- storage.type.function +// ^^^ entity.name.function +// ^ punctuation.definition.generic.begin +// ^ punctuation.definition.generic.end +// ^^^^^^^^^^^^^^^^ meta.function.parameters +// ^^^ storage.type +// ^ meta.block punctuation.section.block.begin + +} +// <- meta.block punctuation.section.block.end + +// Guards +match n { +// <- keyword.control + a if n > 5 => println!("Big: {}", a), +// ^^ keyword.control +// ^ keyword.operator.comparison +// ^^ keyword.operator +// ^^^^^^^^ support.macro + b if n <= 5 => println!("Small: {}", b), +// ^^ keyword.control +// ^^ keyword.operator.comparison +// ^^ keyword.operator +// ^^^^^^^^ support.macro +// ^^ constant.other.placeholder +} + +// Binding +match my_func() { +// ^^ keyword.control +// ^^^^^^^ support.function +// ^ meta.block punctuation.section.block.begin + 0 => println!("None"), +// ^ constant.numeric.integer.decimal +// ^^ keyword.operator +// ^^^^^^^^ support.macro + res @ 1...9 => println!("Digit: {}", res), +// ^ keyword.operator +// ^^^ keyword.operator +// ^^ constant.other.placeholder + _ => println!("Full number"), +// ^ keyword.operator +// ^^ keyword.operator +} +// <- meta.block punctuation.section.block.end + +fn my_other_func(e: OperatingSystem) -> u32 { +// ^^^^^^^^^^^^^ entity.name.function +// ^ variable.parameter +// ^ punctuation.separator +} + +struct Point +// ^^^^^^^^^ meta.struct +{ +// <- meta.struct meta.block punctuation.section.block.begin + x: i32, +// ^ variable.other.member +// ^ punctuation.separator.type +// ^^^ storage.type + #[serde(default)] +// ^ punctuation.definition.annotation +// ^ punctuation.section.group.begin +// ^^^^^ variable.annotation +// ^ punctuation.section.group.end +// ^^^^^^^^^^^^^^^^^ meta.annotation + pub(crate) y: i32 +// ^^^ storage.modifier +// ^ punctuation.definition.modifier-scope.begin +// ^^^^^ storage.modifier +// ^ punctuation.definition.modifier-scope.end +// ^ variable.other.member +// ^ punctuation.separator.type +// ^^^ storage.type +} +// <- meta.block punctuation.section.block.end + +impl Point +//^^^^^^^^ meta.impl +{ +// <- meta.impl meta.block punctuation.section.block.begin + fn new(x: i32, y: i32) -> Point + // <- storage.type.function + // ^^^ entity.name.function + { + // <- meta.function meta.block + Point {x: x, y: y} + } + + fn double(&mut self) { + // ^^^^^^ entity.name.function + self.x *= 2; + // ^^^^ variable.language + // ^ punctuation.accessor.dot + // ^^ keyword.operator.assignment + self.y *= 2; + } + + fn sum((x, y): (i32, i32)) -> i32 { +// ^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^ punctuation.separator +// ^ punctuation.section.group.end +// ^ punctuation.separator +// ^^^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^ storage.type +// ^ punctuation.separator +// ^^^ storage.type +// ^ punctuation.section.group.end +// ^^ punctuation.separator + } +} + +pub fn pub_function() -> bool +// <- storage.modifier +// ^^ storage.type.function +// ^^^^^^^^^^^^ entity.name.function +{ +// <- meta.function + return true +} + +fn factory() -> Box<Fn(i32) -> i32> { +// <- storage.type.function +// ^^^^^^^ entity.name.function +// ^^^^^^^^^^^^^^ meta.generic +// ^^ storage.type +// ^^ storage.type +// ^^ punctuation.separator + Box::new(|x| x + 1) +// ^^ punctuation.accessor +} + +let inferred_closure = |i, j: u32| i + 1; +// ^^^^^^^^^^^^^^^^ entity.name.function +// ^^^^^^^^^^^^^^^^^ meta.function.closure +// ^^^^^^^^^^^ meta.function.parameters +// ^ punctuation.section.parameters.begin +// ^ variable.parameter +// ^ punctuation.separator +// ^ variable.parameter +// ^ punctuation.separator +// ^^^ storage.type +// ^ punctuation.section.parameters.end +let closure = || -> i32 { | | 1 + 2 }; +// ^^^^^^^ entity.name.function +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.closure +// ^^ meta.function.parameters +// ^ punctuation.section.parameters.begin +// ^ punctuation.section.parameters.end +// ^^^ storage.type +// ^^^^^^^^^^^^^ meta.block +// ^ meta.block punctuation.section.block.begin +// ^ constant.numeric.integer.decimal +// ^ constant.numeric.integer.decimal +// ^ meta.block punctuation.section.block.end + +let f = |(x, y): (u32, &mut u32)| { x + y }; +// ^ punctuation.section.parameters.begin +// ^ variable.parameter +// ^ punctuation.separator +// ^ variable.parameter +// ^^^^^^^^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^ storage.type +// ^ punctuation.separator +// ^ keyword.operator +// ^^^ storage.modifier +// ^^^ storage.type +// ^ punctuation.section.group.end +// ^ punctuation.section.parameters.end + + +let c = a | b; +// ^ keyword.operator.bitwise + +call_func(|c| 1 + 2 + c); +// ^^^^^^^^^^^^^ meta.function.closure +// ^^^ meta.function.parameters + +macro_rules! print_result { + ($expr:expr) => ( + println!("{:?} = {:?}", stringify!($expr), $expr) + ) +} + + +pub fn from_buf_reader<T>(s: io::BufReader<T>) -> Result<isize, &'static str> +// ^ keyword.operator + where T: io::Read +// ^ keyword.other +{ + macro_rules! eat_numbers { + ($count:expr, $msg:expr) => {{ + // ^ meta.function meta.block meta.macro meta.block meta.block punctuation.section.block.begin + // ^ meta.function meta.block meta.macro meta.block meta.block meta.block punctuation.section.block.begin + let parse_err = concat!("Err parsing value in ", $msg); + try!{ eat_numbers(&mut lines, $count, parse_err, missing_err, too_many) } + // ^^^^ support.macro + // ^ meta.function meta.block meta.macro meta.block meta.block meta.block meta.block punctuation.section.block.begin + }} + }; + // <- meta.function meta.block - meta.macro + + let mut starts_stops = eat_numbers!(relief_count_total * 2, "starts and stops"); + + let starts = starts_stops.split_off(relief_count_total); +// ^ punctuation.accessor.dot +// ^^^^^^^^^ support.function + let stops = starts_stops; + + unimplemented!(); +} + +pub mod my_mod { +//^^^^^^^^^^^^^^ meta.module +// <- storage.modifier +// ^^^ storage.type.module +// ^^^^^^ entity.name.module +// ^ meta.block punctuation.section.block.begin +} +// <- meta.module meta.block punctuation.section.block.end + +struct Val (f64,); +struct GenVal<T>(T,); +// ^^^^^^^^^ meta.generic +// ^^^^^^ entity.name.struct +// ^ punctuation.definition.generic.begin - entity.name.struct +// ^ punctuation.definition.generic.end + +// impl of Val +impl Val { + fn value(&self) -> &'a f64 { &self.0 } + // ^ keyword.operator + // ^^ storage.modifier.lifetime +} + +// impl of GenVal for a generic type `T` +impl <'a, T> GenVal<T> { +// ^ punctuation.definition.generic.begin +// ^^ storage.modifier.lifetime +// ^ punctuation.definition.generic.end +// ^^^^^^ entity.name.impl +// ^^^ - entity.name.impl +// ^ punctuation.definition.generic.begin +// ^ punctuation.definition.generic.end + fn value(&self) -> &T { &self.0 } + // ^ keyword.operator + // ^ keyword.operator +} + +fn print_debug<T: Debug> (t: &T) { +// ^^^^^^^^^^^ entity.name.function +// ^ punctuation.definition.generic.begin - entity.name.function +// ^ punctuation.separator +// ^ punctuation.definition.generic.end +// ^ variable.parameter +// ^ keyword.operator + println!("{:?}", t); +// ^^^^ constant.other.placeholder +} + +impl<'a, T: MyTrait + OtherTrait> PrintInOption for T where +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.impl +// ^^ storage.modifier.lifetime +// ^ punctuation.separator +// ^ keyword.operator +// ^^^ keyword.other +// ^ entity.name.impl +// ^^^^^ keyword.other + Option<T>: Debug { +//^^^^^^^^^^^^^^^^^^^^ meta.impl + fn print_in_option(self) { +// ^^^^^^^^^^^^^^^ entity.name.function + println!("{:?}", Some(self)); + } +} + +pub trait Animal { +// <- storage.modifier +//^^^^^^^^^^^^^^^^ meta.trait +// ^ meta.block punctuation.section.block.begin + fn noise(quiet: bool) { + // Comment + } +} +// <- meta.trait meta.block punctuation.section.block.end + +fn collect_vec() { + let _: Vec<(usize, usize)> = (0..10).enumerate().collect::<Vec<_>>(); +// ^^^ support.type +// ^^^^^^^^^^^^^^^^^^^ meta.generic +// ^ punctuation.section.group.begin +// ^^^^^ storage.type +// ^^^^^ storage.type +// ^ punctuation.section.group.end +// ^ keyword.operator.assignment +// ^ punctuation.section.group.begin +// ^ constant.numeric.integer.decimal +// ^^ keyword.operator.range +// ^^ constant.numeric.integer.decimal +// ^ punctuation.section.group.end +// ^ punctuation.accessor.dot +// ^^^^^^^^^ support.function +// ^^ punctuation.section.group +// ^ punctuation.accessor.dot +// ^^ punctuation.accessor +// ^^^^^^^^ meta.generic +// ^^^ support.type +// ^^^^^^ meta.generic meta.generic +// ^ keyword.operator + let _: Vec<(usize, usize)> = vec!(); +// ^^^^ support.macro + let _: Vec<(usize, usize)> = vec!{}; +// ^^^^ support.macro + let _: Vec<(usize, usize)> = vec![]; +// ^^^^ support.macro + let _: Vec<String> = vec![]; +// ^^^^^^ meta.generic support.type +} + +macro_rules! forward_ref_binop [ +// ^ meta.macro meta.group punctuation.section.group.begin + (impl $imp:ident, $method:ident for $t:ty, $u:ty) => { +// ^^^^ variable.parameter +// ^^^^^ storage.type +// ^^^^^^^ variable.parameter +// ^^^^^ storage.type +// ^^ variable.parameter +// ^^ storage.type +// ^^ variable.parameter +// ^^ storage.type +// ^^ keyword.operator +// ^ meta.macro meta.group meta.block punctuation.section.block.begin + impl<'a, 'b> $imp<&'a $u> for &'b $t { +// ^^^^ storage.type.impl +// ^^^^^^^^ meta.generic +// ^^ storage.modifier.lifetime +// ^^ storage.modifier.lifetime +// ^^^^ variable.other +// ^^^^^^^^ meta.generic +// ^ keyword.operator +// ^^ storage.modifier.lifetime +// ^^ variable.other +// ^^^ keyword.other +// ^ keyword.operator +// ^^ storage.modifier.lifetime +// ^^ variable.other +// ^ meta.macro meta.group meta.block meta.impl meta.block punctuation.section.block.begin + type Output = <$t as $imp<$u>>::Output; +// ^^^^^^^^^^^^^^^^ meta.generic +// ^^ keyword.operator +// ^^ meta.path punctuation.accessor + + #[inline] +// ^^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^ punctuation.section.group.begin +// ^ punctuation.section.group.end + fn $method(self, other: &'a $u) -> <$t as $imp<$u>>::Output { +// ^^ storage.type.function +// ^^^^^^^ variable.other +// ^^^^ variable.language +// ^ keyword.operator +// ^^ storage.modifier.lifetime +// ^^ variable.other +// ^^ punctuation.separator +// ^^^^^^^^^^^^^^^^ meta.generic +// ^^ keyword.operator +// ^^ meta.path punctuation.accessor +// ^ meta.macro meta.group meta.block meta.impl meta.block meta.block punctuation.section.block.begin + #![cfg(all(unix, target_pointer_width = "32"))] +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation +// ^^^ variable.annotation +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.parameters +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call +// ^^^ variable.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^ punctuation.separator +// ^ keyword.operator +// ^^^^ string.quoted +// ^ punctuation.section.group.end + $imp::$method(*self, *other) +// ^^^^ variable.other +// ^^^^^^^ variable.other +// ^ keyword.operator +// ^^^^ variable.language +// ^ keyword.operator + } + } + } +] + +macro_rules! alternate_group ( +// ^ meta.macro meta.group punctuation.section.group.begin + ($a:expr) => ( +// ^^ variable.parameter +// ^^^^ storage.type + println!("Test {}!", $a) + ) +) + +macro_rules! kleene_star { +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.macro.rust - meta.macro.rust meta.macro.rust +// ^ meta.block.rust punctuation.section.block.begin.rust + ($($arg:tt)+) => ( +// ^^^^^^^^^^^^^^^^^^ meta.macro meta.block +// ^^^^^^^^^^^^^ meta.group.macro-matcher +// ^^^^^^^^^^ meta.group.macro-matcher meta.group +// ^^ punctuation.section.group.begin +// ^ keyword.operator +// ^^^^ variable.parameter.macro.rust +// ^^ storage.type.rust +// ^ keyword.operator.rust +// ^ meta.group punctuation.section.group.end +// ^^ keyword.operator +// ^ meta.group.macro-body.rust punctuation.section.group.begin.rust + println!($($arg)); + ), + ($($arg:tt)*) => ( +// ^^^^^^^^^^^^^ meta.macro meta.block meta.group.macro-matcher +// ^^^^ variable.parameter.macro.rust +// ^^ meta.macro meta.block keyword.operator + println!($($arg)*); +// ^^^^ variable.other.rust +// ^^^^^^^^^ meta.macro.rust meta.block.rust meta.group.macro-body.rust meta.group.rust + ), + ($($arg:tt) ; +) => ( +// ^^^^^^^^^^^^^^^^ meta.macro meta.block meta.group.macro-matcher +// ^^^^ variable.parameter.macro.rust +// ^^ meta.macro meta.block keyword.operator + println!($($arg)); + ), + ($($arg:tt),*) => ( +// ^^^^^^^^^^^^^^ meta.macro meta.block meta.group.macro-matcher +// ^^^^ variable.parameter.macro.rust +// ^^ meta.macro meta.block keyword.operator + println!($($arg)*); + ), + +// incomplete blocks + ($($arg:tt),*) , +// ^ meta.macro.rust meta.block.rust punctuation.terminator.macro-matcher.rust + ($($x:tt),*) => ($x) , + println!($($arg)*); + ) +} + +pub fn next_lex<T:PartialOrd>(/* block */data: &mut [T] // line { +// ^^^^^^^^^^^ source.rust meta.function.rust meta.function.parameters.rust comment.block.rust +// ^^^^^^^^^ source.rust meta.function.rust meta.function.parameters.rust comment.line.double-slash.rust + /* block2 */ data2: &mut [T] // line +// ^^^^^^^^^^^^ source.rust meta.function.rust meta.function.parameters.rust comment.block.rust +// ^^^^^^^ source.rust meta.function.rust meta.function.parameters.rust comment.line.double-slash.rust + ) -> bool { + unimplemented!(); +} + +pub fn next_lex2</* block */T/* comments */:/* everywhere */ +// ^^^^^^^^^^^ comment.block.rust +// ^^^^^^^^^^^^^^ comment.block.rust +// ^^^^^^^^^^^^^^^^ comment.block.rust + // Many comments +// ^^^^^^^^^^^^^^^^ comment.line.double-slash.rust + /* help */ PartialOrd // Possibly too many comments +// ^^^^^^^^^^ comment.block.rust +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.rust +> ( + /* block2 */ data2: &mut [T] // line +// ^^^^^^^^^^^^ source.rust meta.function.rust meta.function.parameters.rust comment.block.rust +// ^^^^^^^ source.rust meta.function.rust meta.function.parameters.rust comment.line.double-slash.rust + ) -> bool { + unimplemented!(); +} + +pub fn new<T>() -> Fibonacci<T> + where T: One + Zero, +// ^^^^^ keyword.other.rust + for <'a> &'a T: Add<Output = T>, +// ^^^ keyword.other.rust +// ^ punctuation.definition.generic.begin.rust +// ^^ storage.modifier.lifetime.rust +// ^ punctuation.definition.generic.end.rust +// ^ keyword.operator.rust +// ^^ storage.modifier.lifetime.rust +{ + unimplemented!(); +} + +pub fn new<T>() -> Fibonacci<T> + where for <'a> &'a T: Add<Output = T>, +// ^^^^^ keyword.other.rust +// ^^^ keyword.other.rust +// ^ punctuation.definition.generic.begin.rust +// ^^ storage.modifier.lifetime.rust +// ^ punctuation.definition.generic.end.rust +// ^ keyword.operator.rust +// ^^ storage.modifier.lifetime.rust +{ + unimplemented!(); +} + +impl<T> Fibonacci<T> + where for <'a> &'a T: Add<Output = T>, +// ^^^^^ keyword.other.rust +// ^^^ keyword.other.rust +// ^ punctuation.definition.generic.begin.rust +// ^^ storage.modifier.lifetime.rust +// ^ punctuation.definition.generic.end.rust +// ^ keyword.operator.rust +// ^^ storage.modifier.lifetime.rust +{ + unimplemented!(); +} + +impl<T> Iterator for Fibonacci<T> + where T: Clone, +// ^^^^^ keyword.other.rust + for <'a> &'a T: Add<Output = T>, +// ^^^ keyword.other.rust +// ^ punctuation.definition.generic.begin.rust +// ^^ storage.modifier.lifetime.rust +// ^ punctuation.definition.generic.end.rust +// ^ keyword.operator.rust +// ^^ storage.modifier.lifetime.rust +{ + unimplemented!(); +} + +pub const FOO: Option<[i32; 1]> = Some([1]); +// ^ punctuation.section.group.begin.rust +// ^ punctuation.separator +// ^ constant.numeric +// ^ punctuation.section.group.end.rust + +fn abc() { + println!("{}hello\ +// ^ punctuation.separator.continuation.line.rust + world, there is no whitespace between hello and world in the output", 0o202u64); +} + +impl ApplicationPreferenceseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee { +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.impl.rust +} + +#[test = "foo ] bar"] +// <- meta.annotation punctuation.definition.annotation +//^^^^^^^^^^^^^^^^^^^ meta.annotation +//^^^^ variable.annotation +// ^ keyword.operator +// ^^^^^^^^^^^ string.quoted.double +pub trait Foo { +} + +const FOO: usize = 5; +let _: Box<[[bool; (FOO + 1) / 2]; FOO * 3 % 12 - 1]>; +// ^ keyword.operator +// ^ punctuation.separator +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic +// ^ punctuation.definition.generic.begin +// ^^ punctuation.section.group.begin +// ^^^^ storage.type +// ^ punctuation.separator +// ^ punctuation.section.group.begin +// ^^^ variable.other.constant +// ^ keyword.operator.arithmetic +// ^ constant.numeric.integer.decimal +// ^ punctuation.section.group.end +// ^ keyword.operator.arithmetic +// ^ constant.numeric.integer.decimal +// ^ punctuation.section.group.end +// ^ punctuation.separator +// ^^^ variable.other.constant +// ^ keyword.operator.arithmetic +// ^ constant.numeric.integer.decimal +// ^ keyword.operator.arithmetic +// ^^ constant.numeric.integer.decimal +// ^ keyword.operator.arithmetic +// ^ constant.numeric.integer.decimal +// ^ punctuation.section.group.end +// ^ punctuation.definition.generic.end +// ^ punctuation.terminator + +let _: Box<[[u8; aa::COUNT - 1]; 5]>; +// ^ punctuation.definition.generic.begin +// ^ punctuation.section.group.begin +// ^ punctuation.section.group.begin +// ^^ storage.type +// ^ punctuation.separator +// ^^ variable.other.constant +// ^^ punctuation.accessor.double-colon +// ^^^^^ variable.other.constant +// ^ keyword.operator.arithmetic +// ^ constant.numeric.integer.decimal +// ^ punctuation.section.group.end +// ^ punctuation.separator +// ^ constant.numeric.integer.decimal +// ^ punctuation.section.group.end +// ^ punctuation.definition.generic.end +// ^ punctuation.terminator + +let x = 5; +let raw = &x as *const i32; +// ^^^^^^ storage.type + +let mut y = 10; +let raw_mut = &mut y as *mut i32; +// ^^^^ storage.modifier + +let i: u32 = 1; +let p_imm: *const u32 = &i as *const u32; +// ^^^^^^ storage.type +// ^^^^^^ storage.type + +type ExampleRawPointer = HashMap<*const i32, Option<i32>, BuildHasherDefault<FnvHasher>>; +// ^^^^^^ storage.modifier - invalid +// ^^^ storage.type diff --git a/assets/syntaxes/Packages/SQL/Comments.tmPreferences b/assets/syntaxes/Packages/SQL/Comments.tmPreferences new file mode 100644 index 000000000..de6e2feaa --- /dev/null +++ b/assets/syntaxes/Packages/SQL/Comments.tmPreferences @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>source.sql</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string>-- </string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_START_2</string> + <key>value</key> + <string>/*</string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_END_2</string> + <key>value</key> + <string>*/</string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/SQL/Miscellaneous.tmPreferences b/assets/syntaxes/Packages/SQL/Miscellaneous.tmPreferences new file mode 100644 index 000000000..bd96bae89 --- /dev/null +++ b/assets/syntaxes/Packages/SQL/Miscellaneous.tmPreferences @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Miscellaneous</string> + <key>scope</key> + <string>source.sql</string> + <key>settings</key> + <dict> + <key>decreaseIndentPattern</key> + <string>\)(?!=.*\()</string> + <key>increaseIndentPattern</key> + <string>^\s*(create|grant|insert|delete|update)\b|\((?!.*\))</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/SQL/SQL.sublime-syntax b/assets/syntaxes/Packages/SQL/SQL.sublime-syntax new file mode 100644 index 000000000..c57ee6550 --- /dev/null +++ b/assets/syntaxes/Packages/SQL/SQL.sublime-syntax @@ -0,0 +1,240 @@ +%YAML 1.2 +--- +name: SQL +file_extensions: + - sql + - ddl + - dml +scope: source.sql + +variables: + end_identifier: (?=[ \t]*(?:[^\w'"`. \t]|$)) + +contexts: + main: + - include: comments + - match: |- + (?xi) + \b(create(?:\s+or\s+replace)?)\s+ + (aggregate|conversion|database|domain|function|group|(?:unique\s+)?index|language|operator class|operator|procedure|rule|schema|sequence|table(?:space)?|trigger|type|user|view) + \b\s* + scope: meta.create.sql + captures: + 1: keyword.other.create.sql + 2: keyword.other.sql + push: identifier_create + - match: (?i:\s*\b(drop)\s+(aggregate|conversion|database|domain|function|group|index|language|operator class|operator|procedure|rule|schema|sequence|table|tablespace|trigger|type|user|view)) + scope: meta.drop.sql + captures: + 1: keyword.other.create.sql + 2: keyword.other.sql + - match: (?i:\s*(drop)\s+(table)\s+(\w+)(\s+cascade)?\b) + scope: meta.drop.sql + captures: + 1: keyword.other.create.sql + 2: keyword.other.table.sql + 3: entity.name.function.sql + 4: keyword.other.cascade.sql + - match: (?i:\s*\b(alter)\s+(aggregate|conversion|database|domain|function|group|index|language|operator class|operator|procedure|rule|schema|sequence|table|tablespace|trigger|type|user|view)\s+) + scope: meta.alter.sql + captures: + 1: keyword.other.create.sql + 2: keyword.other.table.sql + - match: |- + (?xi) + + # normal stuff, capture 1 + \b(bigint|bigserial|bit|boolean|box|bytea|cidr|circle|date|datetime|double\sprecision|inet|int|integer|line|lseg|macaddr|money|ntext|oid|path|point|polygon|real|serial|smallint|sysdate|sysname|text)\b + + # numeric suffix, capture 2 + 3i + |\b(bit\svarying|character\s(?:varying)?|tinyint|var\schar|float|interval)\((\d+)\) + + # optional numeric suffix, capture 4 + 5i + |\b(char|number|nvarchar|varbinary|varchar\d?)\b(?:\((\d+)\))? + + # special case, capture 6 + 7i + 8i + |\b(numeric|decimal)\b(?:\((\d+),(\d+)\))? + + # special case, captures 9, 10i, 11 + |\b(times?)\b(?:\((\d+)\))?(\swith(?:out)?\stime\szone\b)? + + # special case, captures 12, 13, 14i, 15 + |\b(timestamp)(?:(s|tz))?\b(?:\((\d+)\))?(\s(with|without)\stime\szone\b)? + + + captures: + 1: storage.type.sql + 2: storage.type.sql + 3: constant.numeric.sql + 4: storage.type.sql + 5: constant.numeric.sql + 6: storage.type.sql + 7: constant.numeric.sql + 8: constant.numeric.sql + 9: storage.type.sql + 10: constant.numeric.sql + 11: storage.type.sql + 12: storage.type.sql + 13: storage.type.sql + 14: constant.numeric.sql + 15: storage.type.sql + - match: (?i:\b((?:primary|foreign)\s+key|references|on\sdelete(\s+cascade)?|on\supdate(\s+cascade)?|check|constraint|default)\b) + scope: storage.modifier.sql + - match: \b\d+\b + scope: constant.numeric.sql + - match: (?i:\b(true|false)\b) + scope: constant.boolean.sql + - match: (?i:\b(select(\s+(distinct|top))?|insert(\s+(ignore\s+)?into)?|update|delete|truncate|from|set|where|group\s+by|with|case|when|then|else|end|union(\s+all)?|using|order\s+by|limit|(inner|cross)\s+join|join|straight_join|(left|right)(\s+outer)?\s+join|natural(\s+(left|right)(\s+outer)?)?\s+join)\b) + scope: keyword.other.DML.sql + - match: (?i:\b(?:(is)\s+)?(?:(not)\s+)?(null)\b) + captures: + 1: keyword.operator.logical.sql + 2: keyword.operator.logical.sql + 3: constant.language.sql + - match: (?i:\b(and|or|like|having|exists|between|in)\b) + scope: keyword.operator.logical.sql + - match: (?i:\bvalues\b) + scope: keyword.other.DML.II.sql + - match: (?i:\b(begin(\s+work)?|start\s+transaction|commit(\s+work)?|rollback(\s+work)?)\b) + scope: keyword.other.LUW.sql + - match: (?i:\b(grant(\swith\sgrant\soption)?|revoke)\b) + scope: keyword.other.authorization.sql + - match: (?i:\s*\b(comment\s+on\s+(table|column|aggregate|constraint|database|domain|function|index|operator|rule|schema|sequence|trigger|type|view))\s+.*?\s+(is)\s+) + scope: keyword.other.object-comments.sql + - match: (?i)\bas\b + scope: keyword.operator.assignment.alias.sql + - match: (?i)\b(asc|desc)\b + scope: keyword.other.order.sql + - match: \* + scope: variable.language.star.sql + - match: "<=>|[!<>]?=|<>|<|>" + scope: keyword.operator.comparison.sql + - match: '-|\+|/' + scope: keyword.operator.math.sql + - match: \|\| + scope: keyword.operator.concatenator.sql + - match: (?i)\b(CURRENT_(DATE|TIME(STAMP)?|USER)|(SESSION|SYSTEM)_USER)\b + comment: List of SQL99 built-in functions from http://www.oreilly.com/catalog/sqlnut/chapter/ch04.html + scope: support.function.scalar.sql + - match: (?i)\b(AVG|COUNT|MIN|MAX|SUM)(?=\s*\() + comment: List of SQL99 built-in functions from http://www.oreilly.com/catalog/sqlnut/chapter/ch04.html + scope: support.function.aggregate.sql + - match: (?i)\b(CONCATENATE|CONVERT|LOWER|SUBSTRING|TRANSLATE|TRIM|UPPER)\b + scope: support.function.string.sql + - match: \b(\w+?)\.(\w+)\b + captures: + 1: constant.other.database-name.sql + 2: constant.other.table-name.sql + - include: strings + - include: regexps + - match: (\()(\)) + comment: Allow for special ↩ behavior + scope: meta.block.sql + captures: + 1: punctuation.section.scope.begin.sql + 2: punctuation.section.scope.end.sql + comments: + - match: "--" + scope: punctuation.definition.comment.sql + push: + - meta_scope: comment.line.double-dash.sql + - match: \n + pop: true + - match: "#" + scope: punctuation.definition.comment.sql + push: + - meta_scope: comment.line.number-sign.sql + - match: \n + pop: true + - match: /\* + scope: punctuation.definition.comment.sql + push: + - meta_scope: comment.block.c + - match: \*/ + pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.sql + regexps: + - match: /(?=\S.*/) + scope: punctuation.definition.string.begin.sql + push: + - meta_scope: string.regexp.sql + - match: / + scope: punctuation.definition.string.end.sql + pop: true + - include: string_interpolation + - match: \\/ + scope: constant.character.escape.slash.sql + - match: '%r\{' + comment: We should probably handle nested bracket pairs!?! -- Allan + scope: punctuation.definition.string.begin.sql + push: + - meta_scope: string.regexp.modr.sql + - match: '\}' + scope: punctuation.definition.string.end.sql + pop: true + - include: string_interpolation + string_escape: + - match: \\. + scope: constant.character.escape.sql + string_interpolation: + - match: '(#\{)([^\}]*)(\})' + scope: string.interpolated.sql + captures: + 1: punctuation.definition.string.begin.sql + 3: punctuation.definition.string.end.sql + strings: + - match: "'" + scope: punctuation.definition.string.begin.sql + push: + - meta_scope: string.quoted.single.sql + - match: "''" + scope: constant.character.escape.sql + - match: "'" + scope: punctuation.definition.string.end.sql + pop: true + - include: string_escape + - match: "`" + scope: punctuation.definition.string.begin.sql + push: + - meta_scope: string.quoted.other.backtick.sql + - match: "`" + scope: punctuation.definition.string.end.sql + pop: true + - include: string_escape + - match: '"' + scope: punctuation.definition.string.begin.sql + push: + - meta_scope: string.quoted.double.sql + - match: '""' + scope: constant.character.escape.sql + - match: '"' + scope: punctuation.definition.string.end.sql + pop: true + - include: string_interpolation + - match: '%\{' + scope: punctuation.definition.string.begin.sql + push: + - meta_scope: string.other.quoted.brackets.sql + - match: '\}' + scope: punctuation.definition.string.end.sql + pop: true + - include: string_interpolation + identifier_create: + - meta_content_scope: meta.toc-list.full-identifier.sql + - match: '(?:(\w+)|''([^'']+)''|"([^"]+)"|`([^`]+)`){{end_identifier}}' + scope: meta.toc-list.full-identifier.sql + captures: + 1: entity.name.function.sql + 2: entity.name.function.sql + 3: entity.name.function.sql + 4: entity.name.function.sql + pop: true + # Schema identifiers + - match: (?:\w+|'[^']+'|"[^"]+"|`[^`]+`)\s*(\.) + captures: + 1: punctuation.accessor.dot.sql + # Handle situations where the schema and . + - match: '{{end_identifier}}' + pop: true diff --git a/assets/syntaxes/Packages/SQL/syntax_test_sql.sql b/assets/syntaxes/Packages/SQL/syntax_test_sql.sql new file mode 100644 index 000000000..882a8639b --- /dev/null +++ b/assets/syntaxes/Packages/SQL/syntax_test_sql.sql @@ -0,0 +1,98 @@ +-- SYNTAX TEST "Packages/SQL/SQL.sublime-syntax" + +SELECT 'Foo '' Bar'; +-- ^ constant.character.escape.sql + +SELECT "My "" Crazy Column Name" FROM my_table; +-- ^ constant.character.escape.sql + +;CREATE TABLE foo (id INTEGER PRIMARY KEY); + -- <- keyword.other.create +--^^^^^ keyword.other.create +-- ^^^^^ keyword.other +-- ^^^ entity.name.function +-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - entity.name.function + +create table some_schema.test2( id serial ); +--^^^^ meta.create keyword.other.create +-- ^^^^^ meta.create keyword.other +-- ^^^^^^^^^^^^ - entity.name.function +-- ^ punctuation.accessor.dot +-- ^^^^^ entity.name.function +-- ^^^^^^^^^^^^^^ - entity.name.function + +create table some_schema . test2 ( id serial ); +--^^^^ meta.create keyword.other.create +-- ^^^^^ meta.create keyword.other +-- ^^^^^^^^^^^^^^ - entity.name +-- ^ punctuation.accessor.dot +-- ^^^^^ entity.name.function +-- ^^^^^^^^^^^^^^^ - entity.name.function + +create table "testing123" (id integer); +--^^^^ meta.create keyword.other.create +-- ^^^^^ meta.create keyword.other +-- ^ - entity.name.function +-- ^^^^^^^^^^ entity.name.function +-- ^^^^^^^^^^^^^^^^ - entity.name.function + +create table `dbo`."testing123" (id integer); +--^^^^ meta.create keyword.other.create +-- ^^^^^ meta.create keyword.other +-- ^^^^^^^ - entity.name.function +-- ^ punctuation.accessor.dot +-- ^^^^^^^^^^ entity.name.function +-- ^^^^^^^^^^^^^^^^ - entity.name.function + +select * +from some_table +where exists(select * from other_table where id = some_table.id) +-- ^^^^^^ keyword.operator.logical + +SELECT +( +SELECT CASE field +USING a +-- <- keyword.other.DML + WHEN 1 + THEN -- comment's say that +-- ^ comment.line.double-dash + EXISTS( + select 1) + ELSE NULL + END +) as result + + +/* +This is a +multiline comment +-- ^ source.sql comment.block.c +*/ + +/** + * +-- ^ punctuation.definition.comment.sql +*/ + +select + + + <=> +-- ^^^ keyword.operator.comparison.sql + +SELECT *, +-- ^^^ keyword.other.DML.sql +-- ^ variable.language.star.sql + f.id AS database_id +-- ^^ keyword.operator.assignment.alias.sql +FROM foo +WHERE f.a IS NULL +-- ^^ keyword.other.DML.sql +-- ^^ keyword.operator.logical.sql +-- ^^^^ constant.language.sql + AND f.b IS NOT NULL +-- ^^^ keyword.operator.logical.sql +-- ^^ keyword.operator.logical.sql +-- ^^^ keyword.operator.logical.sql +-- ^^^^ constant.language.sql diff --git a/assets/syntaxes/Packages/Scala/Comments.tmPreferences b/assets/syntaxes/Packages/Scala/Comments.tmPreferences new file mode 100644 index 000000000..6e87f2463 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Comments.tmPreferences @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>source.scala</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string>// </string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_START_2</string> + <key>value</key> + <string>/*</string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_END_2</string> + <key>value</key> + <string>*/</string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Dedent-case.tmPreferences b/assets/syntaxes/Packages/Scala/Dedent-case.tmPreferences new file mode 100644 index 000000000..0b6a62c6a --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Dedent-case.tmPreferences @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Dedent (case)</string> + <key>scope</key> + <!-- note the use of the meta.block.case.non-first scope to only apply to subsequent case constructs --> + <string>source.scala meta.block.case.non-first - comment</string> + <key>settings</key> + <dict> + <key>decreaseIndentPattern</key> + <string>(?x) + ^ (.*\*/)? \s* \} .* $ # curly brace dedent (has to be recreated) + | ^ (.*\*/)? \s* \) .* $ # paren dedent (has to be recreated) + | ^ \s* \b(case)\b .* $ # any subsequent case expressions are dedents AND indents + </string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Indent-case.tmPreferences b/assets/syntaxes/Packages/Scala/Indent-case.tmPreferences new file mode 100644 index 000000000..f3fef1356 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Indent-case.tmPreferences @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Indent (case)</string> + <key>scope</key> + <string>source.scala meta.block.case - comment</string> + <key>settings</key> + <dict> + <key>increaseIndentPattern</key> + <string>(?x) + # treat a `case ... =>` line like a curly brace when inside a block + # note that this doesn't make any attempt to detect curly braces, but + # it seems to work out anyway due to sublime's hard-coded behavior w.r.t + # those tokens + ^ \s* \b(case)\b .* => .* $ + </string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Indent.tmPreferences b/assets/syntaxes/Packages/Scala/Indent.tmPreferences new file mode 100644 index 000000000..7cc737251 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Indent.tmPreferences @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Indent</string> + <key>scope</key> + <string>source.scala - comment</string> + <key>settings</key> + <dict> + <key>increaseIndentPattern</key> + <string>(?x) + ^ .* \{ [^}"']* $ # curly brace indent + | ^ .* \( [^)"']* $ # paren indent + </string> + <key>decreaseIndentPattern</key> + <string>(?x) + ^ (.*\*/)? \s* \} .* $ # curly brace dedent + | ^ (.*\*/)? \s* \) .* $ # parent dedent + </string> + <key>bracketIndentNextLinePattern</key> + <string>(?x) + # if a line ends with `=`, then it's a line-wrapped declaration (e.g. val x = \n) + ^ .* = \s* $ + + # attempts to detect a line-wrapped control construct without curly braces (e.g. if (foo) \n) + | ^ .* \b(if|do|while|for)\b .* \) \s* $ + + # simpler line-wrapped control constructs + | ^ .* \b(else)\b \s* $ + | ^ .* \b(yield)\b \s* $ + </string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Scala.sublime-syntax b/assets/syntaxes/Packages/Scala/Scala.sublime-syntax new file mode 100644 index 000000000..08a24b573 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Scala.sublime-syntax @@ -0,0 +1,1857 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Scala +file_extensions: + - scala + - sbt + - sc +scope: source.scala +variables: + # all reserved words (https://www.safaribooksonline.com/library/view/learning-scala/9781449368814/apa.html) + keywords: '\b(?:abstract|case|catch|class|def|do|else|extends|false|final|finally|for|forSome|if|implicit|import|lazy|match|new|null|object|override|package|private|protected|return|sealed|super|this|throw|trait|true|try|type|val|var|while|with|yield)\b' + + # lookaround for operators + nonopchar: '[[[:alpha:]]0-9\s\(\)\[\]\{\}'']' + # From http://www.scala-lang.org/files/archive/spec/2.11/01-lexical-syntax.html + disallowed_as_operator: '[^\w\[\]\(\)\{\}''";,.`_\s]' + operator_character: '[\p{Sm}\p{So}[{{disallowed_as_operator}}&&[\x{20}-\x{7E}]]]' + upper: '[$\p{Lu}]' + # This is "letter", but without _ so we can ensure it is not last + idcont: '[$\p{Lu}\p{Ll}\p{Lt}\p{Lo}\p{Nl}0-9]' + + # note the handling of ' characters in identifiers is somewhat conservative + # TLS doesn't document this feature very well (read: at all), but this is how it's used + # this should have basically no effect on non-TLS source files + + # {{operator_character}}+ \ {:, =, =>, <-, @, ←, ⇒, #} + op: |- + (?x: + [[^:=<@\x{2190}\x{21D2}#]&&{{operator_character}}]{{operator_character}}*| + =[[^>]&&{{operator_character}}]{{operator_character}}*| + =>{{operator_character}}+| + <(?!{{operator_character}}|[[:alpha:]])| + <[[^\-]&&{{operator_character}}]+| + <-{{operator_character}}+| + [:@\x{2190}\x{21D2}#]{{operator_character}}+ + ) + + # {{operator_character}}+ \ {:, =, =>, <-, @, ←, ⇒, #, <%, <:, :<} + typeop: |- + (?x: + [[^:=<@\x{2190}\x{21D2}#]&&{{operator_character}}]{{operator_character}}*| + =[[^>]&&{{operator_character}}]{{operator_character}}*| + =>{{operator_character}}+| + <(?!{{operator_character}}|[[:alpha:]])| + <[[^\-%:]&&{{operator_character}}]+| + <[:%\-]{{operator_character}}+| + :[[^<]&&{{operator_character}}]+| + :<{{operator_character}}+| + [@\x{2190}\x{21D2}#]{{operator_character}}+ + ) + + idrest: '(?:(?:{{idcont}}|_(?=[^{{operator_character}}]))*(?:_{{operator_character}}+)?)' + # an id that starts with lower-case OR underscore + varid: '(?:(?:\p{Ll}|_+(?={{idcont}})){{idrest}})' + boundvarid: '(?:`{{varid}}`|{{varid}})' + alphaplainid: '(?:{{upper}}{{idrest}}|{{varid}})' + plainid: '(?:{{alphaplainid}}|{{op}})' + typeplainid: '(?:{{upper}}{{idrest}}|{{varid}}|{{typeop}})' + id: '(?:{{plainid}}|`[^`\n]+`)' + idorunder: '(?:{{id}}|_)' + typeid: '(?:{{typeplainid}}|`[^`\n]+`)' + alphaid: (?:{{upper}}{{idrest}}|{{varid}}) + # Custom productions + rightarrow: '=>|\x{21D2}' + upperid: '(?:(\b\p{Lu}|\$){{idrest}})' + typeprefix: '(:)\s*' + # hack to cover up to three levels of nested parentheses + withinparens: '(?:\((?:[^\(\)]|\((?:[^\(\)]|\([^\(\)]*\))*\))*\))' + withinbrackets: '(?:\[(?:[^\[\]]|\[(?:[^\[\]]|\[[^\[\]]*\])*\])*\])' + # This is the full XML Name production, but should not be used where namespaces + # are possible. Those locations should use a qualified_name. + xml_name: '[[:alpha:]:_][[:alnum:]:_.-]*' + # This is the form that allows a namespace prefix (ns:) followed by a local + # name. The captures are: + # 1: namespace prefix name + # 2: namespace prefix colon + # 3: local tag name + xml_qualified_name: '(?:([[:alpha:]_][[:alnum:]_.-]*)(:))?([[:alpha:]_][[:alnum:]_.-]*)' + + unicode_char: '\\u[0-9a-fA-F]{4}' + octal_char: '\\[0-7]{1,3}' + escaped_char: '\\[btnfr"''\\]|{{unicode_char}}|{{octal_char}}' + +contexts: + prototype: + - include: comments + - include: block-comments + + main: + - include: main-pre-lambdas + - include: lambdas + - include: main-post-lambdas + + main-no-lambdas: + - include: main-pre-lambdas + - include: main-post-lambdas + + main-pre-lambdas: + - include: storage-modifiers + - include: declarations + - include: for-comprehension + - include: keywords + - include: imports + - include: strings + - include: xml-literal + - include: operators + - include: initialization + - include: ascription + - include: annotation + main-post-lambdas: + - include: late-keywords + - include: constants + - include: scala-symbol + - include: braces + - include: late-operators + + block-comments: + - match: /\*\*/ + scope: comment.block.empty.scala + - match: /\*\* + scope: punctuation.definition.comment.scala + push: + - meta_scope: comment.block.documentation.scala + - match: \*/ + scope: punctuation.definition.comment.scala + pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.scala + - match: (@\w+\s) + scope: keyword.other.documentation.scaladoc.scala + - match: '\{@link\s+[^\}]*\}' + scope: keyword.other.documentation.scaladoc.link.scala + - include: block-comments + - match: /\* + push: + - meta_scope: comment.block.scala + - match: \*/ + pop: true + - include: block-comments + - match: |- + (?x) + (?! /\*) + (?! \*/) + + char-literal: + - match: '''({{escaped_char}}|.)''' + scope: constant.character.literal.scala + + comments: + - match: (//).*$ + scope: comment.line.double-slash.scala + captures: + 1: punctuation.definition.comment.scala + + ascription-no-function: + - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala + push: + - match: '(?={{rightarrow}})' + pop: true + - include: single-type-expression-no-function + + ascription: + - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala + push: single-type-expression + + annotation: + - match: '(@)({{alphaplainid}})(\.)' + captures: + 1: meta.annotation.scala punctuation.definition.annotation.scala + 2: meta.annotation.identifier.scala + 3: meta.annotation.identifier.scala punctuation.accessor.scala + push: + - meta_content_scope: meta.annotation.identifier.scala + - match: '({{alphaplainid}})(\.)' + captures: + 2: punctuation.accessor.scala + - match: '{{alphaplainid}}' + scope: variable.annotation.scala + set: annotation-parameters + - match: '(@)({{alphaplainid}})' + captures: + 1: meta.annotation.scala punctuation.definition.annotation.scala + 2: meta.annotation.identifier.scala variable.annotation.scala + push: annotation-parameters + + annotation-parameters: + - meta_content_scope: meta.annotation.parameters.scala + - match: (?=\(\)) + push: + - match: \( + scope: punctuation.section.arguments.annotation.begin.scala + - match: (?=\)) + scope: punctuation.section.arguments.annotation.end.scala + pop: true + - match: \( + scope: punctuation.section.arguments.annotation.begin.scala + push: + - match: (?=\)) + scope: punctuation.section.arguments.annotation.end.scala + pop: true + - match: ',' + scope: punctuation.separator.arguments.annotation.scala + - include: main + - match: \) + scope: punctuation.section.arguments.annotation.end.scala + pop: true + - match: \[ + scope: punctuation.section.arguments.annotation.begin.scala + push: + - match: \] + scope: punctuation.section.arguments.annotation.end.scala + pop: true + - include: delimited-type-expression + - match: (?!\s*[(\[]) + pop: true + + lambdas: + # lambda lookahead + - match: '(?=({{idorunder}}|{{idorunder}}\s*:(\s*{{id}}\s*{{withinbrackets}}?(\s*[\.#]\s*{{id}}\s*{{withinbrackets}}?)*)+|{{idorunder}}\s*:\s*{{withinparens}}|{{withinparens}})\s*(?:{{rightarrow}})(?:/\*|//|[[[:alpha:]]0-9\s\)\]\}]))' + push: + - match: '{{rightarrow}}' + scope: storage.type.function.arrow.lambda.scala + pop: true + - include: lambda-declaration + lambda-declaration-base: + - match: \( + scope: punctuation.section.group.begin.scala + push: + - match: \) + scope: punctuation.section.group.end.scala + pop: true + - include: lambda-declaration-parens + - match: '{{id}}' + scope: variable.parameter.scala + - match: '_' + scope: variable.language.underscore.scala + lambda-declaration-parens: + - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala + push: + - match: ',' + scope: punctuation.separator.scala + pop: true + - match: '(?=\))' + pop: true + - include: delimited-type-expression + - include: lambda-declaration-base + lambda-declaration: + - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala + push: + - match: '(?={{nonopchar}}({{rightarrow}}){{nonopchar}})' + pop: true + - include: delimited-type-expression + - include: lambda-declaration-base + + base-types: + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double|Any|AnyRef|AnyVal|Nothing)\b + scope: storage.type.primitive.scala + literal-constants: + - match: \b(?:false|null|true)\b + scope: constant.language.scala + # TODO negation + # source: http://www.scala-lang.org/files/archive/spec/2.11/01-lexical-syntax.html#floating-point-literals + - match: |- + (?x: + # 1.1, 1.1e1, 1.1e-1, 1.1d, 1.1e1d, 1.1e-1d, 1.e1d | 1e1 1e1d | 1d + \b\d+ (?: (?: (\.) \d+ (?:[eE][-+]?\d+)? | (?:[eE][-+]?\d+) ) ([dDfF])? | ([dDfF]) ) + # .1, .1e1, .1e-1 + | (\.) \d+ (?:[eE][-+]?\d+)? ([dDfF])? + )\b + scope: constant.numeric.float.decimal.scala + captures: + 1: punctuation.separator.decimal.scala + 2: storage.type.numeric.scala + 3: storage.type.numeric.scala + 4: punctuation.separator.decimal.scala + 5: storage.type.numeric.scala + # source: http://www.scala-lang.org/files/archive/spec/2.11/01-lexical-syntax.html#integer-literals + - match: \b(0[xX])\h+([lL]?)\b + scope: constant.numeric.integer.hexadecimal.scala + captures: + 1: punctuation.definition.numeric.base.scala + 2: storage.type.numeric.scala + - match: \b(?:0|[1-9][0-9]*)([lL]?)\b + scope: constant.numeric.integer.decimal.scala + captures: + 1: storage.type.numeric.scala + - match: \(\) + scope: constant.language.scala + base-constants: + - include: literal-constants + - match: \b(?:this|super)\b + scope: variable.language.scala + # base-types with try-dispatch followup + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + scope: storage.type.primitive.scala + push: try-dispatch + constants: + - include: base-constants + - include: char-literal + # other upper-case stuff highlights as constant + - match: '{{upperid}}' + scope: support.constant.scala + push: try-dispatch + - match: '{{id}}(?=[\(\[])' + push: try-dispatch + try-dispatch: + - match: '\(' + scope: punctuation.section.group.begin.scala + push: + - match: \) + scope: punctuation.section.group.end.scala + pop: true + - include: main + - match: '\[' + scope: punctuation.definition.generic.begin.scala + push: + - meta_scope: meta.generic.scala + - match: \] + scope: punctuation.definition.generic.end.scala + pop: true + - include: delimited-type-expression + - match: '(?=[\S\n;])' + pop: true + + declarations: + - match: '\b(def)\s+({{id}})' + captures: + 1: storage.type.function.scala + 2: entity.name.function.scala + push: function-type-parameter-list + - match: '\b(case\s+)?(class|trait|object)(\s+({{id}}))' + scope: meta.class.identifier.scala + captures: + 1: storage.type.class.scala + 2: storage.type.class.scala + 3: entity.name.class.scala + push: class-type-parameter-list + - match: '\b(type)\s+({{id}})' + captures: + 1: storage.type.scala + 2: entity.name.type.scala + push: + - match: '(?=[\n;\}\)\]])' + pop: true + - match: '\[' + scope: punctuation.definition.generic.begin.scala + push: + - meta_scope: meta.generic.scala + - match: '\]' + scope: punctuation.definition.generic.end.scala + pop: true + - include: type-constraints + - include: delimited-type-expression + - match: '(<:|>:)' + scope: keyword.operator.bound.scala + set: + - match: '(?=[\n\}\)\]])' + pop: true + - include: delimited-type-expression + - match: '=[ \t]*' + scope: keyword.operator.assignment.scala + set: single-type-expression-leading-newline + - match: '\b(var)\s+({{id}})' + captures: + 1: storage.type.volatile.scala + 2: variable.other.readwrite.scala + - match: '\bval\b' + scope: storage.type.stable.scala + push: val-simple-body + - match: '\b(package)\s+(object)\s+({{id}})' + captures: + 1: keyword.control.scala + 2: storage.type.class.scala + 3: entity.name.class.scala + push: class-inheritance-extends + - match: '\b(package)\s+({{id}}(?:\.{{id}})*)\s*(\{)' + captures: + 1: keyword.control.scala + 2: entity.name.namespace.scoped.scala + 3: punctuation.section.block.begin.scala + push: + - meta_scope: meta.namespace.scala + - match: '\}' + scope: punctuation.section.block.end.scala + pop: true + - include: main + - match: '\b(package)\s+({{id}}(?:\.{{id}})*)' + scope: meta.namespace.scala + captures: + 1: keyword.control.scala + 2: entity.name.namespace.header.scala + # what follows is identical to case-pattern, except it goes to case-body-first + - match: '\bcase\b(?!\s+class\b)' + scope: keyword.other.declaration.scala + push: + - meta_content_scope: meta.pattern.scala + - match: '(?=\bclass\b)' + pop: true + - match: '\bif\b' + scope: keyword.control.flow.scala + set: + - match: '{{rightarrow}}' + scope: storage.type.function.arrow.case.scala + set: case-body-first + - include: main-no-lambdas + # eliminates arrow from the pattern meta scope + - match: '(?={{rightarrow}})' + set: + - match: '{{rightarrow}}' + scope: storage.type.function.arrow.case.scala + set: case-body-first + - match: '(?=\}|\bcase\b)' # makes typing more pleasant + pop: true + - include: pattern-match + + case-body-first: + - meta_content_scope: meta.block.case.first.scala + - match: \{ + scope: punctuation.section.block.begin.scala + set: + - meta_scope: meta.block.scala + - match: \} + scope: punctuation.section.block.end.scala + set: case-body-first + - include: main + - include: case-body + + case-body-non-first: + - meta_content_scope: meta.block.case.non-first.scala + - match: \{ + scope: punctuation.section.block.begin.scala + set: + - meta_scope: meta.block.scala + - match: \} + scope: punctuation.section.block.end.scala + set: case-body-non-first + - include: main + - include: case-body + + # this exists to clear the meta_scope from first or non-first + case-pattern: + - match: '\bcase\b' + scope: keyword.other.declaration.scala + set: + - meta_content_scope: meta.pattern.scala + - match: '\bif\b' + scope: keyword.control.flow.scala + set: + - match: '{{rightarrow}}' + scope: storage.type.function.arrow.case.scala + set: case-body-non-first + - include: main-no-lambdas + # eliminates arrow from the pattern meta scope + - match: '(?={{rightarrow}})' + set: + - match: '{{rightarrow}}' + scope: storage.type.function.arrow.case.scala + set: case-body-non-first + - match: '(?=\}|\bcase\b)' # makes typing more pleasant + pop: true + - include: pattern-match + + case-body: + - match: (?=\bcase\b) + set: case-pattern + - match: (?=\}) + pop: true + - include: main + + braces: + - match: \[ + scope: punctuation.definition.generic.begin.scala + push: + - meta_scope: meta.generic.scala + - match: \] + scope: punctuation.definition.generic.end.scala + pop: true + - include: delimited-type-expression + - match: \( + scope: punctuation.section.group.begin.scala + push: + - meta_scope: meta.group.scala + - match: \) + scope: punctuation.section.group.end.scala + set: try-dispatch + - include: main + - match: \{ + scope: punctuation.section.block.begin.scala + push: + - meta_scope: meta.block.scala + - match: \} + scope: punctuation.section.block.end.scala + pop: true + - include: main + + # emulate newline inference + # this is included when a single newline is found in a declaration + # you should never push/set this context, only include + decl-newline-double-check: + - match: '(?=[\{\}\)]|\b(?:case|class|def|val|var|trait|object|private|protected|for|while|if|final|sealed|implicit|type|import|override)\b)' + pop: true + - match: '\n' + pop: true + + function-type-parameter-list: + - match: '(?=\()' + set: function-parameter-list + - match: '\[' + scope: punctuation.definition.generic.begin.scala + push: function-tparams-brackets + - match: ':' + scope: punctuation.ascription.scala + set: function-return-type-definition + - match: '(?=[\{\};]|{{nonopchar}}?={{nonopchar}})' + pop: true + - match: (?=\S) + pop: true + - match: '\n' + set: function-type-parameter-list-newline + + function-type-parameter-list-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: function-type-parameter-list + + function-tparams-brackets: + - meta_scope: meta.generic.scala + - match: '\[' + scope: punctuation.definition.generic.begin.scala + push: function-tparams-brackets + - match: '\]' + scope: punctuation.definition.generic.end.scala + pop: true + - include: type-constraints + - include: delimited-type-expression + + function-return-type-definition: + - match: '\n' + set: function-return-type-definition-newline + - match: '(?=[\{\};]|{{nonopchar}}?={{nonopchar}})' + pop: true + - include: delimited-type-expression + - match: (?=\S) + pop: true + + function-return-type-definition-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: function-return-type-definition + + function-parameter-list: + - match: '\(' + scope: punctuation.section.group.begin.scala + push: + - match: '\)' + scope: punctuation.section.group.end.scala + pop: true + - match: '({{alphaid}})(?=\s*:)' + captures: + 1: variable.parameter.scala + push: + - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala + set: + - match: '(\*)\s*(?=[\),=])' + captures: + 1: keyword.operator.varargs.scala + - match: '(?=\))' + pop: true + - match: ',' + scope: punctuation.separator.scala + pop: true + - include: delimited-type-expression + - match: '(?=[=])' + pop: true + - include: main + - match: ':' + scope: punctuation.ascription.scala + set: function-return-type-definition + - match: '\n' + set: function-parameter-list-newline + - match: '(?=\S)' + pop: true + + function-parameter-list-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: function-parameter-list + + class-type-parameter-list: + - match: '\b(?:private|protected)\b' + scope: storage.modifier.access.scala + - match: (?=@{{plainid}}) + set: + - include: annotation + - match: '(?=\S)' + set: class-type-parameter-list + - match: '(?=\()' + set: class-parameter-list + - match: '\[' + scope: punctuation.definition.generic.begin.scala + push: class-tparams-brackets + - match: '(?=\b(?:extends|with)\b)' + set: class-inheritance-extends + - match: '(?=\{)' + set: class-pre-inheritance-early-initializer + - match: '\n' + set: class-type-parameter-list-newline + - match: (?=\S) + pop: true + + class-type-parameter-list-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: class-type-parameter-list + + class-tparams-brackets: + - meta_scope: meta.generic.scala + - match: '\[' + scope: punctuation.definition.generic.begin.scala + push: class-tparams-brackets + - match: '\]' + scope: punctuation.definition.generic.end.scala + pop: true + - match: '\b(?:this|super)\b' + scope: variable.language.scala + - include: type-constraints + - include: delimited-type-expression + + class-parameter-list: + - match: '\(' + scope: punctuation.section.group.begin.scala + push: + - match: '\)' + scope: punctuation.section.group.end.scala + pop: true + - match: '\bval\b' + scope: storage.type.scala + - match: '\bvar\b' + scope: storage.type.volatile.scala + - match: '({{alphaid}})(?=\s*:)' + captures: + 1: variable.parameter.scala + push: + - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala + set: + - match: '(\*)\s*(?=[\),=])' + captures: + 1: keyword.operator.varargs.scala + - match: '(?=\))' + pop: true + - match: ',' + scope: punctuation.separator.scala + pop: true + - include: delimited-type-expression + - match: '(?=[=])' + pop: true + - include: main + - match: '(?=\b(?:extends|with)\b)' + set: class-inheritance-extends + - match: '(?=\{)' + set: class-pre-inheritance-early-initializer + - match: '\n' + set: class-parameter-list-newline + - match: (?=\S) + pop: true + + class-parameter-list-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: class-parameter-list + + class-pre-inheritance-early-initializer: + - match: \{ + scope: punctuation.section.braces.begin.scala + push: + - meta_scope: meta.class.body.scala + - match: \} + scope: punctuation.section.braces.end.scala + pop: true + - include: main + - match: '(?=\b(?:extends|with)\b)' + set: class-inheritance-extends + - match: '(?=\S)' + pop: true + - match: '\n' + set: class-pre-inheritance-early-initializer-newline + + class-pre-inheritance-early-initializer-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: class-pre-inheritance-early-initializer + + class-inheritance-extends: + - match: \bwith\b + scope: invalid.keyword.with-before-extends.scala + pop: true + - match: \bextends\b + scope: keyword.declaration.scala + set: class-inheritance-extends-token + - match: '(?=\{)' + pop: true + - match: '\n' + set: class-inheritance-extends-newline + - match: (?=\S) + pop: true + + class-inheritance-extends-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: class-inheritance-extends + + class-inheritance-extends-token: + - match: '{{id}}(?=\s*\.)' + scope: entity.other.inherited-class.scala + - match: '(?=\.)' + push: + - meta_scope: entity.other.inherited-class.scala + - match: \. + scope: punctuation.accessor.scala + pop: true + - match: '{{id}}' + scope: entity.other.inherited-class.scala + set: class-inheritance-extends-token-after + - match: \( + scope: punctuation.definition.parens.begin.scala + set: + - match: \) + scope: punctuation.definition.parens.end.scala + set: class-inheritance-with + - include: delimited-type-expression + - match: '\n' + set: class-inheritance-extends-token-newline + - match: (?=\S) + pop: true + + class-inheritance-extends-token-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: class-inheritance-extends-token + + class-inheritance-extends-token-after: + # we don't use punctuation.definition here because it's not part of the type anymore + - match: \( + scope: punctuation.section.parens.begin.scala + push: + - match: \) + scope: punctuation.section.parens.end.scala + pop: true + - include: main + - match: \[ + scope: punctuation.definition.generic.begin.scala + push: + - match: \] + scope: punctuation.definition.generic.end.scala + pop: true + - include: delimited-type-expression + - match: (?=\b(?:with|extends)\b) + set: class-inheritance-with + - match: (?=\{) + set: class-inheritance-early-initializer + - match: '\n' + set: class-inheritance-extends-token-after-newline + - match: (?=\S) + pop: true + + class-inheritance-extends-token-after-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: class-inheritance-extends-token-after + + class-inheritance-early-initializer: + - match: \{ + scope: punctuation.section.braces.begin.scala + push: + - meta_scope: meta.class.body.scala + - match: \} + scope: punctuation.section.braces.end.scala + pop: true + - include: main + - match: '(?=\bwith\b)' + set: class-inheritance-with + - match: '(?=\S)' + pop: true + - match: '\n' + set: class-inheritance-early-initializer-newline + + class-inheritance-early-initializer-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: class-inheritance-early-initializer + + class-inheritance-with: + - match: \bextends\b + scope: invalid.keyword.extends-after-extends.scala + pop: true + - match: \bwith\b + scope: keyword.declaration.scala + set: class-inheritance-extends-token + - match: '\n' + set: class-inheritance-with-newline + - match: '(?=\S)' + pop: true + + class-inheritance-with-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: class-inheritance-with + + imports: + - match: \bimport\b + scope: keyword.other.import.scala + push: + - meta_scope: meta.import.scala + - match: '(,)[ \t]*\n' # TODO real newline inference + captures: + 1: punctuation.separator.scala + - match: ',' + scope: punctuation.separator.scala + - match: '(?=[\n;])' + pop: true + - match: '{{id}}' + - match: \. + scope: punctuation.accessor.dot.scala + - match: '_' + scope: variable.language.underscore.scala + - match: "{" + scope: punctuation.section.group.begin.scala + push: + - meta_scope: meta.import.selector.scala + - match: "}" + scope: punctuation.section.group.end.scala + pop: true + - match: ',' + scope: punctuation.separator.scala + - match: '{{rightarrow}}' + scope: keyword.operator.arrow.scala + - match: '{{id}}' + - match: '_' + scope: variable.language.underscore.scala + + # we need to greedily capture operators to prevent (e.g.) :: being matched as an ascription + # it would be incorrect to scope operators specially, since they are just identifiers + # by pulling them out HERE though and refusing to scope them, we emulate lookbehind + operators: + - match: ; + scope: punctuation.terminator.scala + - match: '{{op}}(?=[\(\[])' # no explicit scope, just pulling it out + push: try-dispatch + - match: '{{op}}' # no explicit scope, just pulling it out + + initialization: + - match: '\bnew\b' + scope: keyword.other.scala + push: initialization-body + + initialization-block: + - match: \{ + scope: punctuation.section.block.begin.scala + set: + - meta_scope: meta.block.scala + - match: \} + scope: punctuation.section.block.end.scala + set: initialization-term-tail + - include: main + + initialization-body-base: + - include: initialization-block + - match: \( + scope: punctuation.section.group.begin.scala + set: + - match: \) + scope: punctuation.section.group.end.scala + set: initialization-term-tail + - include: delimited-type-expression + - match: \[ + scope: punctuation.definition.generic.begin.scala + set: + - meta_scope: meta.generic.scala + - match: \] + scope: punctuation.definition.generic.end.scala + set: initialization-term-tail + - include: delimited-type-expression + - match: '\bwith\b' + scope: keyword.declaration.scala + set: initialization-body-allow-newline + - match: '{{upperid}}' + scope: support.class.scala + set: initialization-term-tail + - match: '{{typeid}}' + scope: support.type.scala + set: initialization-term-tail + + initialization-body-allow-newline: + - include: initialization-body-base + - match: \n + set: initialization-body + + initialization-body: + - include: initialization-body-base + # emergency bail-out for better experience while typing + - match: '(?=[\S\n])' + pop: true + + initialization-term-tail: + - include: initialization-block + - match: '(?=\s+with\b)' + set: initialization-body + - match: \( + scope: punctuation.section.group.begin.scala + set: + - match: \) + scope: punctuation.section.group.end.scala + set: + - match: '(?=\s+with\b)' + set: initialization-body + - match: '(?=.)' + pop: true + - include: main + - match: \[ + scope: punctuation.definition.generic.begin.scala + set: + - meta_scope: meta.generic.scala + - match: \] + scope: punctuation.definition.generic.end.scala + set: + - match: '(?=\s+with\b)' + set: initialization-body + - match: '(?=\s*\()' + set: initialization-term-tail + - match: '(?=.)' + pop: true + - include: delimited-type-expression + - match: '[.#]' + scope: punctuation.accessor.scala + set: initialization-body-allow-newline + - match: '(?=[^ \t])' + pop: true + + for-comprehension: + - match: '\b(for)\s*(\{)' + captures: + 1: keyword.control.flow.scala + 2: punctuation.section.block.begin.scala + push: + - match: '\}' + scope: punctuation.section.block.end.scala + pop: true + - include: for-braces-body + - match: '\b(for)\s*(\()' + captures: + 1: keyword.control.flow.scala + 2: punctuation.section.group.begin.scala + push: + - match: '\)' + scope: punctuation.section.group.end.scala + pop: true + - include: for-parens-body + for-braces-body: + - match: |- + (?x) + ^(?= + ( + [^<\x{2190}=\{\}/"] + |<[^\-] + |/[^/*] + |"([^"\\]|\\\.)*" + |/\*([^*]|\*(?!/))*\*/ + )+ + (?:{{nonopchar}}|_)(<-|\x{2190}|=){{nonopchar}} + ) + push: + - match: '\bval\b' + scope: storage.type.stable.scala + - match: <-|\x{2190}|= + scope: keyword.operator.assignment.scala + pop: true + - include: pattern-match + - include: main + - include: main + for-parens-body: + - match: '\bif\b' + scope: keyword.control.flow.scala + push: for-parens-expr + - match: '<-|\x{2190}|=' + scope: keyword.operator.assignment.scala + push: for-parens-expr + - match: '\bval\b' + scope: storage.type.stable.scala + - include: pattern-match + for-parens-expr: + - match: '(?=\))' + pop: true + - match: ; + pop: true + - include: main + + keywords: + - match: \b(?:return|throw)\b + scope: keyword.control.flow.jump.scala + - match: \b(?:else|if|do|while|for|yield|match)\b + scope: keyword.control.flow.scala + - match: \b(?:catch|finally|try)\b + scope: keyword.control.exception.scala + - match: \bmacro\b + scope: keyword.other.scala + - match: \?\?\? + scope: keyword.other.scala + - match: '[!=]=(?={{nonopchar}})|\b(?:eq|ne)\b' + scope: keyword.operator.comparison.scala + + late-keywords: + - match: \bextends\b + scope: invalid.keyword.dangling-extends.scala + - match: \bwith\b + scope: invalid.keyword.dangling-with.scala + - match: \bforSome\b + scope: keyword.declaration.scala + - match: '\b(?:(?:case\s+)?class|trait|object)\b' + scope: storage.type.class.scala + - match: \bdef\b + scope: storage.type.function.scala + - match: \btype\b + scope: storage.type.scala + - match: \bvar\b + scope: storage.type.volatile.scala + - match: \bpackage\b + scope: keyword.control.scala + + late-operators: + # catch all valid identifiers and let them fall through + # this prevents mixed operator identifiers from being partially highlighted + - match: '{{id}}' + - match: '=' + scope: keyword.operator.assignment.scala + - match: '_' + scope: variable.language.underscore.scala + - match: '\.' + scope: punctuation.accessor.scala + - match: ',' + scope: punctuation.separator.scala + + nest-curly-and-self: + - match: '\{' + scope: punctuation.section.scope.scala + push: + - match: '\}' + scope: punctuation.section.scope.scala + pop: true + - include: nest-curly-and-self + - include: main + + scala-symbol: + - match: '''{{plainid}}' + scope: constant.other.symbol.scala + + storage-modifiers: + - match: '\b(?:private\[\S+\]|protected\[\S+\]|private|protected)\b' + scope: storage.modifier.access.scala + - match: \b(?:abstract|final|lazy|sealed|implicit|override)\b + scope: storage.modifier.other.scala + + # see http://www.scala-lang.org/docu/files/ScalaReference.pdf part 1.3.5-6 (page 18) + strings: + - match: '"""' + scope: punctuation.definition.string.begin.scala + push: + - meta_include_prototype: false + - meta_scope: string.quoted.triple.scala + - match: '{{unicode_char}}' + scope: constant.character.escape.scala + - match: '(""")(?!")' + scope: punctuation.definition.string.end.scala + pop: true + - match: '"' + scope: punctuation.definition.string.begin.scala + push: + - meta_include_prototype: false + - meta_scope: string.quoted.double.scala + - match: '"' + scope: punctuation.definition.string.end.scala + pop: true + - match: \n + scope: invalid.string.newline.scala + - include: escaped + - match: '(f)(""")' + captures: + 1: support.function.scala + 2: punctuation.definition.string.begin.scala + push: + - include: f_string + - meta_include_prototype: false + - meta_scope: string.quoted.interpolated.scala + - match: '"""' + scope: punctuation.definition.string.end.scala + pop: true + - match: '({{alphaid}})(""")' + captures: + 1: support.function.scala + 2: punctuation.definition.string.begin.scala + push: + - meta_include_prototype: false + - meta_scope: string.quoted.triple.interpolated.scala + - match: '{{unicode_char}}' + scope: constant.character.escape.scala + - match: '(""")(?!")' + scope: punctuation.definition.string.end.scala + pop: true + - include: interpolated-vars-expressions + - match: '(f)(")' + captures: + 1: support.function.scala + 2: punctuation.definition.string.begin.scala + push: + - meta_include_prototype: false + - meta_scope: string.quoted.interpolated.scala + - include: f_string + - match: '"' + scope: punctuation.definition.string.end.scala + pop: true + - match: \n + scope: invalid.string.newline.scala + - match: '\b(raw)(")' + captures: + 1: support.function.scala + 2: punctuation.definition.string.begin.scala + push: + - meta_include_prototype: false + - meta_scope: string.quoted.raw.interpolated.scala + - match: '"' + scope: punctuation.definition.string.end.scala + pop: true + - match: \n + scope: invalid.string.newline.scala + - include: interpolated-vars-expressions + - match: '({{alphaid}})(")' + captures: + 1: support.function.scala + 2: punctuation.definition.string.begin.scala + push: + - meta_include_prototype: false + - meta_scope: string.quoted.interpolated.scala + - match: '"' + scope: punctuation.definition.string.end.scala + pop: true + - match: \n + scope: invalid.string.newline.scala + - include: escaped + - include: interpolated-vars-expressions + + escaped: + - match: '{{escaped_char}}' + scope: constant.character.escape.scala + - match: \\ + scope: invalid.illegal.lone-escape.scala + + # f_string, see: + # http://docs.oracle.com/javase/6/docs/api/java/util/Formatter.html#detail + # /!\ this implementation may allow incorrect combinaisons + f_string: + - include: escaped + - include: interpolated-vars-expressions + # constant formatting + - match: '%[%n]' + scope: constant.other.formatting.scala + # general formatting + - match: '%\-?#?[bBhHsS]' + scope: constant.other.formatting.scala + # character formatting + - match: '%\-?[cC]' + scope: constant.other.formatting.scala + # date-time formatting + - match: '%\-?[tT][HIklMSLNpzZsQBbhAaCYyjmdeRTrDFc]?' + scope: constant.other.formatting.scala + # floating point formatting + - match: '%[\+\-# 0\(,]*[\.0-9]*[feEgGaA]' + scope: constant.other.formatting.scala + # integer formatting + - match: '%[\+\-# 0\(,]*[doxX]' + scope: constant.other.formatting.scala + + interpolated-vars-expressions: + # we duplicate this pattern to encode a greedy ? on the ['] + - match: '\$(?={{alphaid}})' + scope: punctuation.definition.variable.scala variable.other.scala + push: + - clear_scopes: 1 + - match: '{{alphaid}}' + scope: variable.other.scala + pop: true + - match: '\$\{' + scope: punctuation.definition.expression.scala + push: + - match: '\}' + scope: punctuation.definition.expression.scala + pop: true + - match: '' + push: + - clear_scopes: 1 + - meta_content_scope: source.scala.embedded + - match: (?=\}) + pop: true + - include: nest-curly-and-self + - include: main + + xml-literal: + - match: '<!\[CDATA\[' + scope: punctuation.definition.string.begin.xml + push: + - meta_scope: string.unquoted.cdata.xml + - match: ']]>' + scope: punctuation.definition.string.end.xml + pop: true + - match: '</{{xml_qualified_name}}>?' + scope: invalid.illegal.bad-closing-tag.xml + - match: '(<)({{xml_qualified_name}})' + captures: + 1: punctuation.definition.tag.begin.xml + 2: entity.name.tag.xml + push: xml-tag-decl + - match: '<\?\s*xml(?:\s.*[>$]|\b)' + scope: invalid.illegal.reserved-proc-instr.xml + - match: '(<\?)\s*({{xml_qualified_name}})' + captures: + 1: punctuation.definition.tag.begin.xml + 2: entity.name.tag.xml + push: xml-tag-decl + + xml-comments: + - meta_include_prototype: false + - match: '<!--' + scope: punctuation.definition.comment.begin.xml + push: + - meta_scope: comment.block.xml + - match: '-->' + scope: punctuation.definition.comment.end.xml + pop: true + + xml-tag-decl: + - meta_scope: text.xml meta.tag.xml + - meta_include_prototype: false + - include: xml-comments + - include: xml-entity + - match: '(?=[\}\)\]])' # emergency bail-out + pop: true + - match: '\?>' + scope: punctuation.definition.tag.end.xml + pop: true + - match: '/>' + scope: punctuation.definition.tag.end.xml + pop: true + - match: '>' + scope: punctuation.definition.tag.end.xml + set: xml-mode + - match: '(?:\s+|^){{xml_qualified_name}}\s*(=)' + captures: + 1: entity.other.attribute-name.namespace.xml + 2: entity.other.attribute-name.xml punctuation.separator.namespace.xml + 3: entity.other.attribute-name.localname.xml + 4: punctuation.separator.key-value.xml + set: xml-attribute-val + - match: '(?:\s+|^)([[:alnum:]:_.-]+)\s*(=)' + captures: + 1: invalid.illegal.bad-attribute-name.xml + 2: punctuation.separator.key-value.xml + - include: xml-should-be-entity + xml-attribute-val: + - meta_include_prototype: false + - include: xml-comments + - include: xml-entity + - include: xml-should-be-entity + - match: '"' + scope: punctuation.definition.string.begin.xml + set: + - meta_scope: text.xml meta.tag.xml string.quoted.double.xml + - include: xml-entity + - include: xml-should-be-entity + - match: '"' + scope: punctuation.definition.string.end.xml + set: xml-tag-decl + # TODO entities + - match: "'" + scope: punctuation.definition.string.begin.xml + set: + - meta_scope: text.xml meta.tag.xml string.quoted.single.xml + - include: xml-entity + - include: xml-should-be-entity + - match: "'" + scope: punctuation.definition.string.end.xml + set: xml-tag-decl + # TODO entities + - match: '\{' + scope: punctuation.definition.inline.begin.xml + set: + - match: '\}' + scope: punctuation.definition.inline.end.xml + set: xml-tag-decl + - include: main + xml-should-be-entity: + - match: '&' + scope: invalid.illegal.bad-ampersand.xml + - match: '<' + scope: invalid.illegal.missing-entity.xml + - match: '>' + scope: invalid.illegal.missing-entity.xml + xml-entity: + - match: '(&)(?:{{xml_name}}|#[0-9]+|#x\h+)(;)' + scope: constant.character.entity.xml + captures: + 1: punctuation.definition.constant.xml + 2: punctuation.definition.constant.xml + xml-mode: + - meta_content_scope: text.xml + - meta_include_prototype: false + - include: xml-comments + - include: xml-entity + - match: '\{' + scope: punctuation.definition.inline.begin.xml + push: + - clear_scopes: 1 + - match: '\}' + scope: punctuation.definition.inline.end.xml + pop: true + - include: main + - match: '(</)({{xml_qualified_name}})(>)' + scope: text.xml meta.tag.xml + captures: + 1: punctuation.definition.tag.begin.xml + 2: entity.name.tag.xml + 6: punctuation.definition.tag.end.xml + pop: true + - include: xml-literal + - include: xml-should-be-entity + + val-pattern-match-main: + - match: '(?={{keywords}})' + pop: true + + - include: base-constants + - include: char-literal + - include: scala-symbol + - include: strings + - include: xml-literal + - include: late-keywords + + - match: '`' + scope: punctuation.definition.identifier.scala + push: + - match: '[`\n]' + scope: punctuation.definition.identifier.scala + pop: true + - match: '{{varid}}(?:(\.){{varid}})+' + captures: + 1: punctuation.accessor.scala + - match: '{{varid}}(\.)' # redundant to catch {{varid}}.{{upperid}} + captures: + 1: punctuation.accessor.scala + - match: '(\.){{varid}}' + captures: + 1: punctuation.accessor.scala + - match: '{{upperid}}|\b{{varid}}(?=\s*\()' + scope: support.constant.scala + push: + - match: '(\()(\))' + captures: + 1: punctuation.section.group.begin.scala + 2: punctuation.section.group.end.scala + pop: true + - match: (?=\S) + pop: true + - match: '\b{{varid}}' + scope: variable.other.constant.scala + - match: \[ + push: + - match: \] + pop: true + - include: main + - match: '{{op}}' # let it fall through + - match: '@' + scope: keyword.operator.at.scala + - match: '_\s*\*' + scope: keyword.operator.varargs.scala + - match: '_' + scope: variable.language.underscore.scala + - match: ',' + scope: punctuation.separator.scala + - include: ascription + + val-bailout: + - match: '(?=[=\n\}\)\]])' + pop: true + + val-simple-ascription: + - match: '\bif\b' + scope: invalid.keyword.if-in-val-match.scala + pop: true + - match: '(?=[\]\}\)])' + pop: true + - match: '(?={{nonopchar}}?={{nonopchar}})' + pop: true + - include: delimited-type-expression + - match: '(?=[\{\n])' + pop: true + + val-simple-body: + - include: val-bailout + + - match: '(?={{keywords}})' + pop: true + + # special form lookahead to prevent invalid operator ascription syntax + - match: '(?:{{op}}|{{id}}_{{operator_character}}*):(?=\s+:|\s*=|\s*$)' + scope: variable.other.constant.scala + set: val-simple-body-tail + - match: '({{op}}|{{id}}_{{operator_character}}*)(:)(?=\s)' + captures: + 1: variable.other.constant.scala + 2: invalid.ascription.following-operator.scala + set: val-simple-ascription + + # an id followed by a type, or an =, or EOL + - match: '{{id}}(?=\s*:{{nonopchar}}|\s*=|\s*$)' + scope: variable.other.constant.scala + set: val-simple-body-tail + - match: (?=\S) + set: + - include: val-bailout + - include: val-pattern-match + + val-simple-body-tail: + - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala + set: val-simple-ascription + - match: (?=\S) + pop: true + + val-pattern-match: + - include: val-pattern-match-main + - match: \( + scope: punctuation.section.group.begin.scala + push: val-pattern-match-inner-paren + + val-pattern-match-inner-paren: + - match: \( + scope: punctuation.section.group.begin.scala + push: val-pattern-match-inner-paren + - match: \) + scope: punctuation.section.group.end.scala + pop: true + - include: val-pattern-match-inner + val-pattern-match-inner: + - include: val-pattern-match-main + - match: '{{upperid}}|\b{{varid}}(?=\s*\()' + scope: support.class.scala + push: + - match: '(\()(\))' + captures: + 1: punctuation.section.group.begin.scala + 2: punctuation.section.group.end.scala + pop: true + - match: (?=\S) + pop: true + + base-pattern-match: + - include: keywords + - include: base-constants + - include: char-literal + - include: scala-symbol + - include: strings + - include: xml-literal + - include: late-keywords + - match: '`' + scope: punctuation.definition.identifier.scala + push: + - match: '[`\n]' + scope: punctuation.definition.identifier.scala + pop: true + - match: '{{varid}}(?:(\.){{varid}})+' + captures: + 1: punctuation.accessor.scala + - match: '{{varid}}(\.)' # redundant to catch {{varid}}.{{upperid}} + captures: + 1: punctuation.accessor.scala + - match: '(\.){{varid}}' + captures: + 1: punctuation.accessor.scala + - match: '{{upperid}}|\b{{varid}}(?=\s*\()' + scope: support.constant.scala + push: + - match: '(\()(\))' + captures: + 1: punctuation.section.group.begin.scala + 2: punctuation.section.group.end.scala + pop: true + - match: (?=\S) + pop: true + - match: '\b{{varid}}' + scope: variable.parameter.scala # not indexed! + - match: '{{op}}' # let it fall through + - match: \[ + push: + - match: \] + pop: true + - include: delimited-type-expression + - match: '@' + scope: keyword.operator.at.scala + - match: '_\s*\*' + scope: keyword.operator.varargs.scala + - match: '_' + scope: variable.language.underscore.scala + - match: ',' + scope: punctuation.separator.scala + - match: (?=\}) + pop: true + nested-pattern-match: + - include: base-pattern-match + - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala + push: + - match: '(?=[,\)@])' + pop: true + - include: delimited-type-expression + - match: \( + scope: punctuation.section.group.begin.scala + push: + - match: \) + scope: punctuation.section.group.end.scala + pop: true + - include: nested-pattern-match + pattern-match: + - include: base-pattern-match + - include: ascription-no-function + - match: \( + scope: punctuation.section.group.begin.scala + push: + - match: \) + scope: punctuation.section.group.end.scala + pop: true + - include: nested-pattern-match + + base-type-expression-no-function: + - match: ; + scope: punctuation.terminator.scala + pop: true + - match: \( + scope: punctuation.definition.group.begin.scala + push: + - match: \) + scope: punctuation.definition.group.end.scala + pop: true + - include: delimited-type-expression + - match: \[ + scope: punctuation.definition.generic.begin.scala + push: + - match: \] + scope: punctuation.definition.generic.end.scala + pop: true + - include: delimited-type-expression + - match: \{ + scope: punctuation.definition.block.begin.scala + push: + - match: \} + scope: punctuation.definition.block.end.scala + pop: true + - include: declarations + - match: '_\s*\*' + scope: keyword.operator.varargs.scala + + base-type-expression: + - include: base-type-expression-no-function + - match: '{{rightarrow}}' + scope: keyword.operator.arrow.scala + + type-constraints: + - match: '<:|>:|<%|\+|-|:' + scope: keyword.operator.bound.scala + + delimited-type-expression: + - include: annotation + # kind-projector support + - match: '\?|\*' + scope: variable.language.hole.scala + # \x{03BB} = λ + - match: '\bLambda\b|\x{03BB}' + scope: keyword.operator.type-lambda.scala + - match: '\btype\b' + scope: keyword.other.scala + - match: '\bwith\b' + scope: keyword.declaration.scala + - match: '[\.#]' + scope: punctuation.accessor.scala + - match: ',' + scope: punctuation.separator.scala + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings + - include: base-types + - match: '\b(?:forSome)\b' + scope: keyword.declaration.scala + - match: '\b(?:this|super)\b' + scope: variable.language.scala + - match: '(?={{keywords}})' + pop: true + - match: '{{upperid}}' + scope: support.class.scala + - match: _ + scope: variable.language.underscore.scala + - match: '{{typeid}}' + scope: support.type.scala + - include: base-type-expression + + # single-type is a type expression with semicolon inference + single-type-expression-no-function: + - match: '\btype\b' + scope: keyword.other.scala + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + scope: storage.type.primitive.scala + set: single-type-expression-tail-no-function + - match: '\b(?:forSome)\b' + scope: keyword.declaration.scala + - match: '\b(?:this|super)\b' + scope: variable.language.scala + set: single-type-expression-tail-no-function + - match: '{{upperid}}' + scope: support.class.scala + set: single-type-expression-tail-no-function + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings + - match: '{{typeid}}' + scope: support.type.scala + set: single-type-expression-tail-no-function + - match: (?=@{{plainid}}) + set: single-type-expression-tail-no-function + - match: \( + scope: punctuation.definition.generic.begin.scala + set: + - match: \) + scope: punctuation.definition.generic.end.scala + set: single-type-expression-tail-no-function + - include: delimited-type-expression + - include: base-type-expression-no-function + - match: '(?=.)' # we can be SUPER aggressive about popping out here + pop: true + + single-type-expression: + - match: '(?=\bif\b)' # for pattern matching + pop: true + - match: '\btype\b' + scope: keyword.other.scala + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + scope: storage.type.primitive.scala + set: single-type-expression-tail + - match: '\b(?:forSome)\b' + scope: keyword.declaration.scala + - match: '\b(?:this|super)\b' + scope: variable.language.scala + set: single-type-expression-tail + - match: '{{upperid}}' + scope: support.class.scala + set: single-type-expression-tail + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings + - match: '(?={{keywords}})' + pop: true + - match: '{{typeid}}' + scope: support.type.scala + set: single-type-expression-tail + - match: (?=@{{plainid}}) + set: single-type-expression-tail + - match: \( + scope: punctuation.definition.group.begin.scala + set: + - match: \) + scope: punctuation.definition.group.end.scala + set: single-type-expression-tail + - include: delimited-type-expression + - include: base-type-expression + - match: '(?=.)' # we can be SUPER aggressive about popping out here + pop: true + + # single-type-expression, but with an allowance for one *leading* newline and whitespace + single-type-expression-leading-newline: + - match: \n + set: + - match: '\s+' + set: single-type-expression + - match: '(?=\S)' + set: single-type-expression + - match: '\s+' + set: single-type-expression + - match: '(?=.)' + set: single-type-expression + + # we already saw one type component, now we *might* see a second + single-type-expression-tail-no-function: + - match: (?=@{{plainid}}) + set: + - include: annotation + - match: '(?=\S)' + set: single-type-expression-tail-no-function + - match: '[\.#]' + scope: punctuation.accessor.scala + set: single-type-expression-no-function + - match: \[ + scope: punctuation.definition.generic.begin.scala + set: + - meta_scope: meta.generic.scala + - match: \] + scope: punctuation.definition.generic.end.scala + set: single-type-expression-tail-no-function + - include: delimited-type-expression + - match: '\b(with)(?:\s+|\b)' + captures: + 1: keyword.declaration.scala + set: single-type-expression-no-function + - match: '\btype\b' + scope: invalid.keyword.type.in-tail-position.scala + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + scope: storage.type.primitive.scala + set: single-type-expression-tail-no-function-type-expectation + - match: '\b(?:forSome)\b' + scope: keyword.declaration.scala + - match: '\b(?:this|super)\b' + scope: variable.language.scala + set: single-type-expression-tail-no-function-type-expectation + - match: '{{upperid}}' + scope: support.class.scala + set: single-type-expression-tail-no-function-type-expectation + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings + - match: '(?={{keywords}})' + pop: true + - match: '{{typeid}}' + scope: support.type.scala + set: single-type-expression-tail-no-function-type-expectation + - match: '\{' + scope: punctuation.definition.block.begin.scala + set: + - match: \} + scope: punctuation.definition.block.end.scala + set: single-type-expression-tail-no-function + - include: main + - match: '(?=\()' + push: try-dispatch + - include: base-type-expression-no-function + - match: \n + pop: true + - match: '(?=\S)' + pop: true + + single-type-expression-tail: + - match: (?=@{{plainid}}) + set: + - include: annotation + - match: '(?=\S)' + set: single-type-expression-tail + - match: '[\.#]' + scope: punctuation.accessor.scala + set: single-type-expression + - match: \[ + scope: punctuation.definition.generic.begin.scala + set: + - meta_scope: meta.generic.scala + - match: \] + scope: punctuation.definition.generic.end.scala + set: single-type-expression-tail + - include: delimited-type-expression + - match: '(?=\bif\b)' + pop: true + - match: '\b(with)(?:\s+|\b)' + captures: + 1: keyword.declaration.scala + set: single-type-expression + - match: '\btype\b' + scope: invalid.keyword.type.in-tail-position.scala + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + scope: storage.type.primitive.scala + set: single-type-expression-tail-type-expectation + - match: '\b(?:forSome)\b' + scope: keyword.declaration.scala + - match: '\b(?:this|super)\b' + scope: variable.language.scala + set: single-type-expression-tail-type-expectation + - match: '{{upperid}}' + scope: support.class.scala + set: single-type-expression-tail-type-expectation + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings + - match: '(?={{keywords}})' + pop: true + - match: '{{typeid}}' + scope: support.type.scala + set: single-type-expression-tail-type-expectation + - match: '\{' + scope: punctuation.definition.block.begin.scala + set: + - match: \} + scope: punctuation.definition.block.end.scala + set: single-type-expression-tail + - include: main + - match: '(?=\()' + push: try-dispatch + - match: '{{rightarrow}}' + scope: keyword.operator.arrow.scala + set: single-type-expression-leading-newline + - include: base-type-expression-no-function + - match: \n + pop: true + - match: '(?=\S)' + pop: true + + # we saw an infix type component, eat a single newline + single-type-expression-tail-no-function-type-expectation: + - match: \n + set: single-type-expression-tail-no-function-newline + - match: '(?=\S)' + set: single-type-expression-no-function + + single-type-expression-tail-type-expectation: + - match: \n + set: single-type-expression-tail-newline + - match: '(?=\S)' + set: single-type-expression + + single-type-expression-tail-no-function-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: single-type-expression-no-function + + single-type-expression-tail-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: single-type-expression diff --git a/assets/syntaxes/Packages/Scala/Snippets/adt.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/adt.sublime-snippet new file mode 100644 index 000000000..b94da6269 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/adt.sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[sealed trait ${1:ADT} extends Product with Serializable + +object $1 { + $0 +}]]></content> + <tabTrigger>adt</tabTrigger> + <scope>source.scala</scope> + <description>ADT</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/app.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/app.sublime-snippet new file mode 100644 index 000000000..11d5fb867 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/app.sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[object ${1:Main} { + def main(args: Array[String]): Unit = { + ${0:???} + } +}]]></content> + <tabTrigger>app</tabTrigger> + <scope>source.scala</scope> + <description>main class</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/case.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/case.sublime-snippet new file mode 100644 index 000000000..bfd0b36c7 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/case.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[case ${1:_} => ${0}]]></content> + <tabTrigger>case</tabTrigger> + <scope>source.scala</scope> + <description>case</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/cc.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/cc.sublime-snippet new file mode 100644 index 000000000..5e1204d10 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/cc.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[final case class ${1:Name}($2)]]></content> + <tabTrigger>cc</tabTrigger> + <scope>source.scala</scope> + <description>case class</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/co.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/co.sublime-snippet new file mode 100644 index 000000000..7f0e0e05c --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/co.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[case object ${1:Name}]]></content> + <tabTrigger>co</tabTrigger> + <scope>source.scala</scope> + <description>case object</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/def.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/def.sublime-snippet new file mode 100644 index 000000000..00100f3a8 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/def.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[def ${1:name}($2): ${3:Type} = ${0:???}]]></content> + <tabTrigger>def</tabTrigger> + <scope>source.scala</scope> + <description>def method</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/match.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/match.sublime-snippet new file mode 100644 index 000000000..9fc63f650 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/match.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[match { + case ${1:_} => $0 +}]]></content> + <tabTrigger>match</tabTrigger> + <scope>source.scala</scope> + <description>match</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/p.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/p.sublime-snippet new file mode 100644 index 000000000..ab76fe852 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/p.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[println($1)]]></content> + <tabTrigger>p</tabTrigger> + <scope>source.scala</scope> + <description>println</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/try.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/try.sublime-snippet new file mode 100644 index 000000000..057a327a6 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/try.sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[try { + $0 +} catch { + case _ => ??? +}]]></content> + <tabTrigger>try</tabTrigger> + <scope>source.scala</scope> + <description>try/catch</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/tryf.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/tryf.sublime-snippet new file mode 100644 index 000000000..a9d5db117 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/tryf.sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[try { + $0 +} finally { + ??? +}]]></content> + <tabTrigger>tryf</tabTrigger> + <scope>source.scala</scope> + <description>try/finally</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/val.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/val.sublime-snippet new file mode 100644 index 000000000..03c104556 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/val.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[val ${1:name}: ${2:Type} = ${0:???}]]></content> + <tabTrigger>val</tabTrigger> + <scope>source.scala</scope> + <description>val</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Snippets/var.sublime-snippet b/assets/syntaxes/Packages/Scala/Snippets/var.sublime-snippet new file mode 100644 index 000000000..4e9d413fa --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Snippets/var.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[var ${1:name}: ${2:Type} = ${0:???}]]></content> + <tabTrigger>var</tabTrigger> + <scope>source.scala</scope> + <description>var</description> +</snippet> diff --git a/assets/syntaxes/Packages/Scala/Symbols-class.tmPreferences b/assets/syntaxes/Packages/Scala/Symbols-class.tmPreferences new file mode 100644 index 000000000..221c8489a --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Symbols-class.tmPreferences @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbols (class)</string> + <key>scope</key> + <string>source.scala meta.class.identifier</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Symbols-def.tmPreferences b/assets/syntaxes/Packages/Scala/Symbols-def.tmPreferences new file mode 100644 index 000000000..bdabd7bd7 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Symbols-def.tmPreferences @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbols (def)</string> + <key>scope</key> + <string>source.scala entity.name.function</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string> + s/(.+)/ def $1\(...\)/ + </string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Symbols-namespace.tmPreferences b/assets/syntaxes/Packages/Scala/Symbols-namespace.tmPreferences new file mode 100644 index 000000000..03658cb60 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Symbols-namespace.tmPreferences @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbols (namespace)</string> + <key>scope</key> + <string>source.scala entity.name.namespace.scoped</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string> + s/(.+)/package $1 { ... }/ + </string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Symbols-type.tmPreferences b/assets/syntaxes/Packages/Scala/Symbols-type.tmPreferences new file mode 100644 index 000000000..eacce89a9 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Symbols-type.tmPreferences @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbols (type)</string> + <key>scope</key> + <string>source.scala entity.name.type</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string> + s/(.+)/ type $1/ + </string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Symbols-val.tmPreferences b/assets/syntaxes/Packages/Scala/Symbols-val.tmPreferences new file mode 100644 index 000000000..4d55ad83e --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Symbols-val.tmPreferences @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbols (val)</string> + <key>scope</key> + <string>source.scala variable.other.constant</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string> + s/(.+)/ val $1/ + </string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Symbols-var.tmPreferences b/assets/syntaxes/Packages/Scala/Symbols-var.tmPreferences new file mode 100644 index 000000000..e7fb5e190 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Symbols-var.tmPreferences @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbols (var)</string> + <key>scope</key> + <string>source.scala variable.other.readwrite</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string> + s/(.+)/ var $1/ + </string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/Symbols.tmPreferences b/assets/syntaxes/Packages/Scala/Symbols.tmPreferences new file mode 100644 index 000000000..46551f654 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/Symbols.tmPreferences @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List</string> + <key>scope</key> + <string>source.scala entity.name.function, source.scala entity.name.class, source.scala variable.other.constant, source.scala variable.other.readwrite, source.scala entity.name.type, source.scala entity.name.namespace.scoped</string> + <key>settings</key> + <dict> + <key>showInIndexedSymbolList</key> + <integer>1</integer> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Scala/info.plist b/assets/syntaxes/Packages/Scala/info.plist new file mode 100644 index 000000000..876f6d540 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/info.plist @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>contactEmailRot13</key> + <string>mads379@gmail.com</string> + <key>contactName</key> + <string>Mads Hartmann</string> +</dict> +</plist> \ No newline at end of file diff --git a/assets/syntaxes/Packages/Scala/syntax_test_scala.scala b/assets/syntaxes/Packages/Scala/syntax_test_scala.scala new file mode 100644 index 000000000..979fec761 --- /dev/null +++ b/assets/syntaxes/Packages/Scala/syntax_test_scala.scala @@ -0,0 +1,2204 @@ +// SYNTAX TEST "Packages/Scala/Scala.sublime-syntax" +// <- source.scala comment.line.double-slash.scala + +package fubar +// ^^^^ keyword.control +// ^^^^^ entity.name.namespace.header.scala + +package fubar { +// ^^^^ keyword.control.scala +// ^^^^^ entity.name.namespace.scoped.scala +// ^ punctuation.section.block.begin.scala +// <- meta.namespace.scala + } +// ^ punctuation.section.block.end.scala + +import fubar.{Unit, Foo} +// ^^^ keyword.other.import +// <- meta.import.scala +// ^ punctuation.separator.scala + +def foo: Baz = 42 +//^ storage.type.function.scala +// ^^^ entity.name.function.scala +// ^^^ support.class +// ^ keyword.operator.assignment.scala +// ^^ constant.numeric.integer.decimal.scala + +def foo: Baz => Bar = 42; +// ^^^ support.class +// ^^^ support.class +// ^ keyword.operator.assignment.scala +// ^ punctuation.terminator.scala + + +def foo(a: Int, b: Bar): Baz = 42 +//^ storage.type.function.scala +// ^^^ entity.name.function.scala +// ^ variable.parameter +// ^^^ storage.type.primitive.scala +// ^^^ support.class +// ^^^ support.class +// ^ keyword.operator.assignment.scala +// ^^ constant.numeric.integer.decimal.scala + + def +(a: Int) +// ^^^ storage.type.function.scala +// ^ entity.name.function.scala + + def `this is a test`(a: Int) +// ^^^ storage.type.function.scala +// ^^^^^^^^^^^^^^^^ entity.name.function.scala + + def ::(a: Int) +// ^^^ storage.type.function.scala +// ^^ entity.name.function.scala + + def foo_+(a: Int) +// ^^^ storage.type.function.scala +// ^^^^^ entity.name.function.scala + + def foo_2(a: Int) +// ^^^ storage.type.function.scala +// ^^^^^ entity.name.function.scala + + def foo42_+(a: Int) +// ^^^ storage.type.function.scala +// ^^^^^^^ entity.name.function.scala + + def __many_underscores__+(a: Int) +// ^^^ storage.type.function.scala +// ^^^^^^^^^^^^^^^^^^^^^ entity.name.function.scala + + def foo42_+_abc(a: Int) +// ^^^ storage.type.function.scala +// ^^^^^^^ entity.name.function.scala +// ^^^^ - entity.name.function + + def +_foo() +// ^^^^ - entity.name.function + + def foo[A] +// ^^^ storage.type.function.scala +// ^^^ entity.name.function.scala +// ^ support.class + + def foo(implicit bar: Int): Unit +// ^^^^^^^^ storage.modifier.other +// ^ punctuation.ascription.scala +// ^ punctuation.ascription.scala + + val foo: Unit; 42 +// ^^^ storage.type.stable.scala +// ^^^ variable.other.constant.scala +// ^^^^ storage.type.primitive.scala +// ^ punctuation.terminator.scala +// ^^ constant.numeric.integer.decimal.scala + + var foo: Unit +// ^^^ storage.type.volatile.scala +// ^^^ variable.other.readwrite.scala +// ^^^^ storage.type.primitive.scala + + class Foo[A](a: Bar) extends Baz with Bin +// ^^^^^^^^^ meta.class.identifier.scala +// ^^ storage.type.class.scala +// ^^^ entity.name.class +// ^ support.class +// ^ variable.parameter +// ^^^ support.class +// ^^^^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala +// ^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala + + class Foo private[this] (a: Int)(b: String) +// ^^^^^^^ storage.modifier.access +// ^^^^ variable.language.scala +// ^ variable.parameter +// ^ variable.parameter + +class Foo(x: Int = 42) +// ^ - support +// ^ keyword.operator.assignment.scala +// ^^ constant.numeric + +def foo(x: Int = 42) +// ^ - support +// ^ keyword.operator.assignment.scala +// ^^ constant.numeric + +trait Foo +// ^^ storage.type.class.scala +// ^^^ entity.name.class + +object Foo +// ^^^ storage.type.class.scala +// ^^^ entity.name.class + + type Foo = Bar +// ^^^^ storage.type.scala +// ^^^ entity.name.type.scala +// ^ keyword.operator.assignment.scala +// ^^^ support.class.scala + + type Foo = Bar => Baz +// ^^^^ storage.type.scala +// ^^^ entity.name.type.scala +// ^ keyword.operator.assignment.scala +// ^^^ support.class.scala +// ^^^ support.class.scala + + + type Foo[A, B, C] = Bar +// ^ support.class +// ^ punctuation.separator.scala +// ^ support.class +// ^ punctuation.separator.scala +// ^ support.class +// ^ keyword.operator.assignment.scala + +type Foo = Bar { + def baz: Int +// ^^^ entity.name.function +} + +type Foo = Bar[A] forSome { type A } +// ^^^^^^^ keyword.declaration.scala + + type Foo + Bar +// ^^^ support.constant + +// floating point numbers + + 42D 42d +//^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + + 42F 42f +//^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + + .045 .045e2 .045e-2 .045e+2 .045e2f .045e-2f .045e+2f +//^ - constant +// ^ punctuation.separator.decimal.scala +// ^^^^ constant.numeric.float.decimal.scala +// ^ - constant +// ^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + + 0.045 0.045e2 0.045e-2 0.045e+2 0.045e2f 0.045e-2f 0.045e+2f +//^ - constant +// ^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + + 1e2 1e-2 1e+2 1e2f 1e-2f 1e+2f +//^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ - constant +// ^^^^ constant.numeric.float.decimal.scala +// ^ - constant +// ^^^^ constant.numeric.float.decimal.scala +// ^ - constant +// ^^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala + +// decimal integers + + 42 42L 42l +//^ - constant +// ^^ constant.numeric.integer.decimal.scala +// ^ - constant +// ^^^ constant.numeric.integer.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^ constant.numeric.integer.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + +// hexadecimal integers + + 0x0aF9123 0x42L 0x42l +//^ - constant +// ^^ punctuation.definition.numeric.base.scala +// ^^^^^^^^^ constant.numeric.integer.hexadecimal.scala +// ^ - constant +// ^^ punctuation.definition.numeric.base.scala +// ^^^^^ constant.numeric.integer.hexadecimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^ punctuation.definition.numeric.base.scala +// ^^^^^ constant.numeric.integer.hexadecimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + +// characters + + 'a' +// ^^^ constant.character.literal.scala + + '\u1221' +// ^^^^^^^^ constant.character.literal.scala + + true +// ^^^^ constant.language.scala + + false +// ^^^^^ constant.language.scala + + null +// ^^^^ constant.language.scala + + Nil +// ^^^ support.constant.scala + + None +// ^^^^ support.constant.scala + + this +// ^^^^ variable.language.scala + + super +// ^^^^^ variable.language.scala + + "testing" +// ^ punctuation.definition.string.begin.scala +// ^^^^^^^^^ string.quoted.double.scala +// ^ punctuation.definition.string.end.scala + + "escaped chars: \u1221 \125 \n" +// ^^^^^^ constant.character.escape.scala +// ^^^ constant.character.escape.scala +// ^^ constant.character.escape.scala + + "bad escaping: \p" +// ^ invalid.illegal.lone-escape.scala + + """escaped in triple: \u1221 \125 \n""" +//^^^ punctuation.definition.string.begin.scala +// ^^^^^^ constant.character.escape.scala +// ^^^ - constant.character.escape.scala +// ^^ - constant.character.escape.scala +// ^^^ punctuation.definition.string.end.scala + + """testing""" +// ^^^^^^^^^^^^^ string.quoted.triple.scala + + s"testing $a ${42}" +// ^^^^^^^^^ string.quoted.interpolated.scala +// ^ support.function +// ^^ variable.other +// ^^ punctuation.definition.expression +// ^^ constant.numeric.integer.decimal.scala +// ^ punctuation.definition.expression + + s"""testing $a ${42}""" +// ^^^^^^^^^^^ string.quoted.triple.interpolated.scala +// ^ support.function +// ^^ variable.other +// ^^ punctuation.definition.expression +// ^^ constant.numeric.integer.decimal.scala +// ^ punctuation.definition.expression +// ^^^ string.quoted.triple.interpolated.scala + + f"formatted: x: $x%+,.3f ca" +// ^ support.function +// ^ variable.other.scala - string +// ^^^^^^ constant.other.formatting.scala + + f"formatted: date: $x%T " +// ^ support.function +// ^ variable.other.scala +// ^^ constant.other.formatting.scala + + Unit +// ^^^^ storage.type.primitive.scala + + Byte +// ^^^^ storage.type.primitive.scala + + Short +// ^^^^^ storage.type.primitive.scala + + Int +// ^^^ storage.type.primitive.scala + + Long +// ^^^^ storage.type.primitive.scala + + Float +// ^^^^^ storage.type.primitive.scala + + Double +// ^^^^^^ storage.type.primitive.scala + + Boolean +// ^^^^^^^ storage.type.primitive.scala + + String +// ^^^^^^ support.constant + + // this is a comment +// ^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.scala + +/* +// <- comment.block.scala +*/ + +/** +// <- comment.block.documentation.scala + * +// ^ punctuation.definition.comment.scala +*/ + + /**/0xff +//^^^^ comment.block.empty.scala +// ^^^^ - comment + + if +// ^^ keyword.control.flow.scala + + else +// ^^^^ keyword.control.flow.scala + + do +// ^^ keyword.control.flow.scala + + while +// ^^^^^ keyword.control.flow.scala + + for +// ^^^ keyword.control.flow.scala + + yield +// ^^^^^ keyword.control.flow.scala + + match +// ^^^^^ keyword.control.flow.scala + +{ + case => +// ^^^^ keyword.other.declaration.scala +} + + macro +// ^^^^^ keyword.other.scala + + type +// ^^^^ storage.type.scala + + return +// ^^^^^^ keyword.control.flow.jump.scala + + throw +// ^^^^^ keyword.control.flow.jump.scala + + catch +// ^^^^^ keyword.control.exception.scala + + finally +// ^^^^^^^ keyword.control.exception.scala + + ??? +// ^^^ keyword.other.scala + + try +// ^^^ keyword.control.exception.scala + + forSome +// ^^^^^^^ keyword.declaration.scala + + new +// ^^^ keyword.other.scala + + extends +// ^^^^^^^ invalid.keyword.dangling-extends.scala + + with +// ^^^^ invalid.keyword.dangling-with.scala + + class +// ^^^^^ storage.type.class.scala + + trait +// ^^^^^ storage.type.class.scala + + object +// ^^^^^^ storage.type.class.scala + + def +// ^^^ storage.type.function.scala + + val +// ^^^ storage.type.stable.scala + + var +// ^^^ storage.type.volatile.scala + + import +// ^^^^^^ keyword.other.import.scala + + package +// ^^^^^^^ keyword.control.scala + + private +// ^^^^^^^ storage.modifier.access + + protected +// ^^^^^^^^^ storage.modifier.access + + abstract +// ^^^^^^^^ storage.modifier.other + + final +// ^^^^^ storage.modifier.other + + lazy +// ^^^^ storage.modifier.other + + sealed +// ^^^^^^ storage.modifier.other + + implicit +// ^^^^^^^^ storage.modifier.other + + override +// ^^^^^^^^ storage.modifier.other + + a :: b :: Nil +// ^^^^^^^^^ source.scala +// ^^^ support.constant.scala + + (a :: b :: Nil) +// ^^^^^^^^^ source.scala +// ^^^ support.constant.scala + + a: Int +// ^^ source.scala +// ^^^ storage.type.primitive.scala + + (a: Int) +// ^ source.scala +// ^^^ storage.type.primitive.scala + + a: Foo +// ^^^ support.class + +{ + case (abc: Foo, cba @ _) => +// ^^^^ keyword.other.declaration.scala +// ^^^ variable.parameter +// ^^^ support.class +// ^^^ variable.parameter +// ^ variable.language.underscore.scala +// ^^ storage.type.function.arrow.case.scala + + case abc @ `abc` => +// ^^^ variable.parameter +// ^ keyword.operator.at.scala +// ^ punctuation.definition.identifier.scala +// ^ punctuation.definition.identifier.scala +// ^^ storage.type.function.arrow.case.scala +// ^^^^^ - variable.parameter + + case foo: (Int => Boolean) :: _ => +// ^ variable.language.underscore.scala + + case /* testing */ => +// ^^^^^^^^^^^^^ comment.block.scala + + case // testing +// ^^^^^^^^^^ comment.line.double-slash.scala + => + + case 42 => +// ^^ constant.numeric.integer.decimal.scala + + case 'a' => +// ^^^ constant.character.literal.scala + + case 'foo => +// ^^^^ constant.other.symbol + + case "foo" => +// ^^^^^ string.quoted.double.scala + + case """foo""" => +// ^^^^^^^^^ string.quoted.triple.scala + + case q"""..$foo""" => +// ^^^^^^ string.quoted.triple.interpolated.scala +// ^^^^ variable.other +// ^^^ string.quoted.triple.interpolated.scala + + case <foo/> => +// ^^^^^^ text.xml +// ^^^ entity.name.tag + + case true => +// ^^^ constant.language.scala + + case _ ⇒ _ +// ^ - keyword + + case _ if stuff => +// ^^ keyword.control.flow.scala +// ^^^^^ - entity.name +} + + val abc @ `abc` +// ^^^ storage.type.stable.scala +// ^^^ variable.other.constant.scala +// ^ keyword.operator.at.scala +// ^ punctuation.definition.identifier.scala +// ^ punctuation.definition.identifier.scala +// ^^^^^ - entity.name + + _ +// ^ - keyword + + val ble @ `abc` = _ +// ^^^ storage.type.stable.scala +// ^^^ variable.other.constant.scala +// ^ keyword.operator.at.scala +// ^^^^^ - entity.name +// ^ keyword.operator.assignment.scala +// ^ - keyword + + case object Thingy extends Other +// ^^^^ storage.type.class.scala +// ^^^^^^ storage.type.class.scala +// ^^^^^^ entity.name.class.scala +// ^^^^^^^ keyword.declaration.scala +// ^^^^^ entity.other.inherited-class.scala + + case object Thingy extends (Foo => Bar) +// ^^^^ storage.type.class.scala +// ^^^^^^ storage.type.class.scala +// ^^^^^^ entity.name.class.scala +// ^^^^^^^ keyword.declaration.scala +// ^^^ support.class + +{ + case class +// ^^^^ storage.type.class.scala +// ^^^^^ storage.type.class.scala +} + + case class Thingy(abc: Int) extends Other +// ^^^^^^^^^^^^^^^^^ meta.class.identifier.scala +// ^^^^ storage.type.class.scala +// ^^^^^ storage.type.class.scala +// ^^^^^^ entity.name.class.scala +// ^^^ variable.parameter +// ^^^^^^^ keyword.declaration.scala +// ^^^^^ entity.other.inherited-class.scala +// + + for { +// ^^^ keyword.control.flow.scala + + a <- _ +// ^ variable.parameter +// ^^ keyword.operator.assignment.scala +// ^ - keyword + + a ← _ +// ^ variable.parameter +// ^ keyword.operator.assignment.scala +// ^ - entity.name + + (b, c @ _) <- _ +// ^ variable.parameter +// ^ variable.parameter +// ^ keyword.operator.at.scala +// ^ variable.language.underscore.scala +// ^^ keyword.operator.assignment.scala +// ^ - keyword + _ +// ^ - entity.name + + testing = _ +// ^^^^^^^ variable.parameter +// ^ keyword.operator.assignment.scala +// ^ - variable.operator.scala + + testing = { +// ^^^^^^^ variable.parameter + testing = false +// ^^^^^^^ - entity.name +// ^ keyword.operator.assignment.scala + } + + testing = ( +// ^^^^^^^ variable.parameter + testing = false +// ^^^^^^^ - variable.parameter + ) + + val testing = 42 +// ^^^ storage.type.stable.scala +// ^^^^^^^ variable.parameter + } abc +// ^^^ - variable.parameter + + for (a <- _; (b, c @ _) ← d; val abc = e) f +// ^^^ keyword.control.flow.scala +// ^ variable.parameter +// ^ - keyword +// ^ variable.parameter +// ^ variable.parameter +// ^ keyword.operator.at.scala +// ^ variable.language.underscore.scala +// ^ keyword.operator.assignment.scala +// ^ - variable.parameter +// ^^^ storage.type.stable.scala +// ^^^ variable.parameter +// ^ - variable.parameter +// ^ - variable.parameter + + for { + sss <- { {} } +// ^^^ variable.parameter + qqq <- stuff +// ^^^ variable.parameter + } + + for { + back <- Traverse[Option] +// ^^^^ variable.parameter +// ^^^^^^^^ support.constant +// ^^^^^^^^ meta.generic.scala +// ^ punctuation.definition.generic.begin.scala +// ^^^^^^ support.class +// ^ punctuation.definition.generic.end.scala + .traverse[Free, Stuff](res) { r => } +// ^^^^^^^^ - entity.name +// ^^^ - entity.name +// ^ - entity.name + } + + + val baseSettings: Seq[Def.Setting[_]] = _ +// ^^^^^^^^^^^^ variable.other.constant.scala +// ^^^ support.class +// ^ variable.language.underscore.scala - keyword + + for { + r <- blah + } yield r.copy(foo = a) +// ^ - variable +// ^^^^ - variable +// ^ punctuation.section.group.begin.scala +// ^^^ - variable +// ^ punctuation.section.group.end.scala + + { + case foo.Bar => 42 +// ^^^ - variable +// ^ punctuation.accessor.scala + case Bar.foo => 42 +// ^^^ - variable +// ^ punctuation.accessor.scala + } + + val Foo = 42 +// ^^^ variable.other.constant.scala + + val * = 42 +// ^ variable.other.constant.scala + + val *: abc = 42 +// ^ variable.other.constant.scala +// ^ invalid.ascription.following-operator.scala +// ^^^ support.type.scala + + val foo_::: abc +// ^^^^^^ variable.other.constant.scala +// ^ invalid.ascription.following-operator.scala + + val ::: abc +// ^ invalid.ascription.following-operator.scala + + val :: : abc +// ^^ variable.other.constant.scala +// ^ punctuation.ascription.scala - invalid + + val foo_:::: = 42 +// ^^^^^^^^ variable.other.constant.scala +// ^ - invalid + + val :::: = 42 +// ^^^^ variable.other.constant.scala +// ^ - invalid + + val foo_: : abc +// ^^^^^ variable.other.constant.scala +// ^ - invalid +// ^ - invalid + val foo_:: : abc +// ^^^^^^ variable.other.constant.scala +// ^ - invalid +// ^ - invalid + + val * : abc = 42 +// ^ variable.other.constant.scala +// ^ punctuation.ascription.scala - invalid +// ^^^ support.type.scala + + val (Foo, x) = 42 +// ^^^ support.constant.scala +// ^ variable.other.constant.scala + +{ + Set[Foo[A, A] forSome { type A }, A] +// ^ support.class +} + def foo: Int +// ^^^ entity.name.function + +// fubar +// <- source.scala comment.line.double-slash + +new Foo +// ^^^ support.class.scala + +new (Foo ~> Bar) +// ^^^ support.class.scala +// ^^ support.type.scala +// ^^^ support.class.scala + + class Foo(val bar: Baz) extends AnyVal +// ^^^ storage.type.scala +// ^^^^^^^ keyword.declaration.scala +// ^^^^^^ entity.other.inherited-class.scala + + class Foo(implicit bar: Baz) extends AnyVal +// ^^^^^^^^ storage.modifier.other +// ^^^^^^^ keyword.declaration.scala +// ^^^^^^ entity.other.inherited-class.scala + + val Stuff(f1, v1) = ??? +// ^^^^^ support.constant.scala + +new Foo(new Foo) +// ^^^ keyword.other.scala + +new Foo.Bar.Baz +// ^ punctuation.accessor.scala +// ^^^ support.class.scala +// ^ punctuation.accessor.scala +// ^^^ support.class.scala + +new Foo#Bar#Baz +// ^ punctuation.accessor.scala +// ^^^ support.class.scala +// ^ punctuation.accessor.scala +// ^^^ support.class.scala + +type Foo = Foo.Bar +// ^ punctuation.accessor.scala + +type Foo = Foo#Bar +// ^ punctuation.accessor.scala + +class Foo[+A] +// ^ keyword.operator + +class Foo[-A] +// ^ keyword.operator + +class Foo[A <: Int] +// ^^ keyword.operator + +class Foo[A >: Int] +// ^^ keyword.operator + +class Foo[A <% Int] +// ^^ keyword.operator + +class Foo[A: Int] +// ^ keyword.operator + +type Foo <: Bar +// ^^ keyword.operator +// ^^^ support.class + +type Foo >: Bar +// ^^ keyword.operator +// ^^^ support.class + + { a => ??? } +// ^ variable.parameter + + { (a, b) => ??? } +// ^ punctuation.section.group.begin.scala +// ^ variable.parameter.scala +// ^ variable.parameter.scala +// ^ punctuation.section.group.end.scala + + { a: Int => ??? } +// ^ variable.parameter +// ^^^ storage.type.primitive.scala + + { (a: Int, b: Int) => ??? } +// ^ variable.parameter +// ^^^ storage.type.primitive.scala +// ^ variable.parameter +// ^^^ storage.type.primitive.scala + + (a) => ??? +// ^ variable.parameter + + (a, b) => ??? +// ^ variable.parameter +// ^ variable.parameter + + (a: Int) => ??? +// ^ variable.parameter +// ^^^ storage.type.primitive.scala + + (a: Int, b: Int) => ??? +// ^ variable.parameter +// ^^^ storage.type.primitive.scala +// ^ variable.parameter +// ^^^ storage.type.primitive.scala + + (a: Int, b: Int) ⇒ ??? +// ^ variable.parameter +// ^^^ storage.type.primitive.scala +// ^ variable.parameter +// ^^^ storage.type.primitive.scala +// ^ storage.type.function.arrow + + a => ??? +// ^ variable.parameter + + a: Int => ??? +// ^ variable.parameter +// ^^^ storage.type.primitive.scala + +{ + case _ if thing => +// ^^^^ keyword.other.declaration.scala +// ^^^^^ - variable.parameter +// ^^ - keyword +} + + a =>a +// ^ variable.parameter + + a =>42 +// ^ variable.parameter +// ^^ constant.numeric.integer.decimal.scala + + (a: Int => Boolean) => 42 +// ^^ keyword.operator.arrow.scala +// ^^^^^^^ storage.type + + (a: Foo[A] forSome { type A }) => 42 +// ^ variable.parameter +// ^^^ support.class +// ^^^^^^^ keyword.declaration.scala + + () +// ^^ constant.language.scala + +{ + case () => () +// ^^ constant.language.scala +} + + Foo() +// ^^^ support.constant.scala +// ^^ - constant.language.scala + + Foo[A]() +// ^^ - constant.language.scala + + foo[A]() +// ^^ - constant.language.scala + +foo() bar () +// ^^ - constant.language.scala +// ^^ constant.language.scala + +foo()() +// ^^ - constant.language.scala + +foo(())() +// ^^ constant.language.scala +// ^^ - constant.language.scala + + () => 42 +// ^^ - constant.language.scala +// ^^ storage.type.function.arrow + +"testing /*comments*/" +// ^^^^^^^^^^^^ string.quoted.double +// ^^^^^^^^^^^^ - comment + + cb: ((Throwable \/ Unit) => Unit) => 42 +// ^^ variable.parameter +// ^^ support.type.scala +// ^^ storage.type.function.arrow + +def foo(a: A <:< B) +// ^^^ support.type.scala + +def foo(a: A >:> B) +// ^^^ support.type.scala + +def foo(a: A =:= B) +// ^^^ support.type.scala + +def foo(a: A =:= B = null) +// ^ keyword.operator.assignment.scala +// ^^^^ constant.language.scala + +def foo(a: A :: B) +// ^^ support.type.scala + +class Foo(a: A <:< B) +// ^^^ support.type.scala + +class Foo(a: A >:> B) +// ^^^ support.type.scala + +class Foo(a: A =:= B) +// ^^^ support.type.scala + +class Foo(a: A =:= B = null) +// ^ keyword.operator.assignment.scala +// ^^^^ constant.language.scala + +class Foo(a: A :: B) +// ^^ support.type.scala + +import foo +// <- meta.import.scala + +import foo, bar +// ^ punctuation.separator.scala + +import foo; import bar +// ^ punctuation.terminator.scala +// ^^^^^^ keyword.other.import.scala + +import foo.bar +// ^ punctuation.accessor.dot.scala + +import foo.{bar, bar => baz, bar=>baz} +// ^^^^^^^^^^^^^^^^^ meta.import.selector.scala +// ^^ keyword.operator.arrow.scala +// ^^ keyword.operator.arrow.scala + + +import foo.{ + bar => bin +// ^^^ meta.import.scala +// ^^^ meta.import.scala +} + +import foo._ +// ^ variable.language.underscore.scala + +import foo.{Foo => _} +// ^ variable.language.underscore.scala + +for {} yield () +// ^^^^^ keyword.control.flow.scala +// ^^ constant.language.scala + + 42.bar +// ^ - constant.numeric.scala + + baz[m.type] +// ^^^^ keyword.other.scala + +foo: m.type +// ^^^^ keyword.other.scala + + === +// ^^^ - keyword + +offset >= 0 +// ^^ - keyword + +{ + case chunk #: h => +// ^ variable.parameter +} + +val chunk #: h = ??? +// ^ variable.other.constant.scala + +for { + if things >= stuff +// ^^^^^^ - variable.parameter +// ^^^^^ - variable.parameter +} + + +for (if things >= stuff) +// ^^^^^^ - variable.parameter +// ^^^^^ - variable.parameter + + _ +// ^ variable.language.underscore.scala + +foo._1 +// ^ - variable.language.scala + +foo_= +// ^ - keyword + +foo_ +// ^ - variable.language + +foo({ _ => () }) +// ^ variable.language.underscore.scala +// ^^ storage.type.function.arrow + +foo({ _: Unit => () }) +// ^ variable.language.underscore.scala +// ^^ storage.type.function.arrow + + stuff: _* +// ^^ keyword.operator.varargs.scala + +{ + case _ @ _* => +// ^^ keyword.operator.varargs.scala +} + + val _ @ _* = things +// ^^ keyword.operator.varargs.scala + +s"testing ${things} and more!" +// ^^^^^^ - string +// ^^^^^^ source.scala.embedded + +foo.bar +// ^ punctuation.accessor.scala + +(foo, bar) +// ^ punctuation.separator.scala + +{ +case (foo, bar) => +// ^ punctuation.separator.scala +} + +val (foo, bar) = ??? +// ^ punctuation.separator.scala + +foo eq bar +// ^^ keyword.operator.comparison.scala + +foo ne bar +// ^^ keyword.operator.comparison.scala + +new Config() +// ^^ - constant + +val A: Foo = stuff +// ^ variable.other.constant.scala + +type Maybe[A] = { type Inner = A; def x: Int } +// ^^ storage.type.function.scala +// ^ entity.name.function.scala + + for { +// ^^^ keyword.control.flow.scala + stuff = sequenceU.map(_.flatten) // thingy + _ <- fooinConns.map(_.map(t => { })) +// ^^ keyword.operator.assignment.scala + } yield () + +new Foo with Bar with Baz +// ^^^^ keyword.declaration.scala +// ^^^ support.class.scala +// ^^^^ keyword.declaration.scala +// ^^^ support.class.scala + +type Thing = Foo with Bar with Baz +// ^^^^ keyword.declaration.scala +// ^^^ support.class.scala + +Foo[Foo with Bar] +// ^^^^ keyword.declaration.scala +// ^^^ support.class.scala + +xs: Foo with Bar +// ^^^^ keyword.declaration.scala +// ^^^ support.class.scala + + classTag[U] +// ^^^^^ - storage.type + + s"before ${classTag[U] stuff} after" +// ^^^^^^ string.quoted.interpolated.scala +// ^^^^^ - storage.type +// ^^^^^ string.quoted.interpolated.scala + +{ + case Stuff(thing, other) => +// ^^^^^ variable.parameter.scala +// ^^^^^ variable.parameter.scala +} + +{ + case (x, y: Int => String) => () +// ^^ keyword.operator.arrow.scala +// ^^^^^^ support.class.scala +} + +{ + case (foo.bar, _) => () +// ^^^ - variable +} + +val Stuff(thing, other) = ??? +// ^^^^^ variable.other.constant.scala +// ^^^^^ variable.other.constant.scala + + x: List[Int] => () +// ^ variable.parameter.scala +// ^^ storage.type.function.arrow.lambda.scala + +/** private */ class Foo +// ^^^^^ storage.type.class + + foo +// ^^^ - comment + + /* + /* + test +// ^^^^ comment.block.scala + */ + test +// ^^^^ comment.block.scala + */ + test +// ^^^^ - comment + + /** + /** + test +// ^^^^ comment.block.documentation.scala + */ + test +// ^^^^ comment.block.documentation.scala + */ + test +// ^^^^ - comment + +def <(a: Int) = 42 +// ^ entity.name.function.scala +// ^ variable.parameter.scala + + <thing foo="42"/> +// ^^^^^ text.xml entity.name.tag.xml +// ^^^ text.xml entity.other.attribute-name.localname.xml +// ^ text.xml string.quoted.double.xml punctuation.definition.string.begin.xml +// ^^ text.xml string.quoted.double.xml +// ^ text.xml string.quoted.double.xml punctuation.definition.string.end.xml + + <!-- not a comment --> +// ^^^^^^^^^^^^^^^^^^^^^^ - comment + + <foo bar="test" baz='test' bin={ 42 }> +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ text.xml meta.tag.xml +// ^ text.xml meta.tag.xml +// ^ text.xml string.quoted.single.xml punctuation.definition.string.begin.xml +// ^ text.xml string.quoted.single.xml punctuation.definition.string.end.xml +// ^^ source.scala constant.numeric.integer.decimal.scala + { + 42 + "thing" +// ^^^^^^^^^^^^ - text.xml +// ^^ source.scala constant.numeric.integer.decimal.scala +// ^^^^^^^ source.scala string.quoted.double.scala + // comments! +// ^^^^^^^^^^^^ source.scala comment.line.double-slash.scala + + <nested/> +// ^^^^^^^^^ - text.xml text.xml +// ^^^^^^^^^ text.xml meta.tag.xml +// ^^^^^^ entity.name.tag.xml + } + + "stuff" +// ^^^^^^^ - string + + <!-- comments --> +// ^^^^^^^^^^^^^^^^^ comment.block.xml + + <thing/> + + <more> + more tags! + /* not a comment */ +// ^^^^^^^^^^^^^^^^^^^ - comment + </more> + </foo> + + </thing> +// invalid.illegal.bad-closing-tag.xml + + <?xml version="1.0"?> +// ^^^^^^^^^^^^^^^^^^^^^ invalid.illegal.reserved-proc-instr.xml + + <?xml +// ^^^^^ invalid.illegal.reserved-proc-instr.xml + + <?xmll?> +// ^^^^^^^^ - invalid + + <?foo thing="false"?> +// ^^ punctuation.definition.tag.begin.xml +// ^^^ entity.name.tag.xml +// ^^^^^^^ string.quoted.double.xml +// ^^ punctuation.definition.tag.end.xml + + <!-- not a comment --> +// ^^^^^^^^^^^^^^^^^^^^^^ - comment + + <foo a="&" b="<" c=">"/> +// ^^^^^^^^^^^^^^^^^^^^^^^^ text.xml meta.tag.xml +// ^ punctuation.definition.tag.begin.xml +// ^ invalid.illegal.bad-ampersand.xml +// ^ invalid.illegal.missing-entity.xml +// ^ invalid.illegal.missing-entity.xml +// ^^ punctuation.definition.tag.end.xml + + <foo a="&"/> +// ^^^^^^^^^^^^^^^^ text.xml meta.tag.xml +// ^ punctuation.definition.tag.begin.xml +// ^^^ constant.character.entity.xml + + <foo> +// ^ punctuation.definition.tag.begin.xml + & +// ^^^^^ constant.character.entity.xml - meta.tag.xml + </foo> + +class Test1 + (a: String) +// ^ variable.parameter.scala + +class Test1 + + (a: String) +// ^ - variable + +class Test1 + (val a: String) { + "string" +// ^^^^^^^^ string.quoted.double.scala +} + +def test + (arg: String) = arg +// ^^^ variable.parameter.scala + +def test + (arg: String) + (arg: String) = arg +// ^^^ variable.parameter.scala + +// the following test is paired together + def foo: Map[Bar] + def connectionMap: Unit +// ^^^ storage.type.function.scala + +def foo: Map[Bar]=42 +// ^^ constant.numeric.integer.decimal.scala + + x: Foo.Bar => () +// ^ variable.parameter.scala +// ^^ storage.type.function.arrow.lambda.scala + + x: Foo#Bar => () +// ^ variable.parameter.scala +// ^^ storage.type.function.arrow.lambda.scala + + object Stuff { + case + } + thing +// ^^^^^ - variable + + s"thingy " +// ^ punctuation.definition.string.begin.scala + + def thing(): Other + def boo: Int +// ^^^ storage.type.function.scala +// ^^^ entity.name.function.scala + +for { + abc = () => 42 +// ^^ storage.type.function.arrow.lambda.scala +} + + +for ( + abc = () => 42 +// ^^ storage.type.function.arrow.lambda.scala +) + +new { + "foo" +// ^^^^^ string.quoted.double.scala +} + +def foo(a: String*, b: (Int => String)*, c: Int*): Negative* +// ^ keyword.operator.varargs.scala +// ^ keyword.operator.varargs.scala +// ^ keyword.operator.varargs.scala +// ^ - support + +def foo[A[_] <: B](a: Int + String): Unit +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala +// ^ punctuation.definition.generic.end.scala +// ^^^^^^^^^^^ meta.generic.scala +// ^ punctuation.section.group.begin.scala +// ^ support.type.scala - keyword +// ^ punctuation.section.group.end.scala + +class Foo(a: String*) +// ^ keyword.operator.varargs.scala + +class Foo(a: String* ) +// ^ - keyword + +def foo(a: String* ) +// ^ - keyword + +trait AlgebraF[F[_]] { type f[x] = Algebra[F,x] } +// ^^^^ storage.type.scala +// ^ keyword.operator.assignment.scala + +class Foo @Inject()(a: String) +// ^^^^^^ meta.annotation.identifier +// ^- meta.annotation +// ^ variable.parameter.scala + +class Foo @Inject() @Provided(scope = "test")(a: String) +// ^^^^^^ meta.annotation.identifier +// ^- meta.annotation +// ^^^^^^^ meta.annotation.identifier +// ^^^^^^^ meta.annotation.parameters +// ^- meta.annotation +// ^ variable.parameter.scala + +class Foo @Inject(z = "a")(a: String) +// ^^^^^^ variable.annotation +// ^^^^^^^ meta.annotation.parameters +// ^ variable.parameter.scala + +class Foo[A] @Inject()(a: String) +// ^ support.class +// ^^^^^^ meta.annotation.identifier +// ^- meta.annotation +// ^ variable.parameter.scala + +// annotation examples from: http://www.scala-lang.org/files/archive/spec/2.11/11-annotations.html +@deprecated("Use D", "1.0") class C { ... } +// <- meta.annotation +// ^^ variable.annotation +// ^ meta.annotation.parameters.scala punctuation.section.arguments.annotation.begin.scala +// ^^ string +// ^ meta.annotation +// ^ - meta.annotation + +@transient @volatile var m: Int +// ^^ variable.annotation +// ^ variable.annotation + +String @local +// ^ punctuation.definition.annotation +// ^^ variable.annotation + +(e: @unchecked) match { ... } +// ^^ variable.annotation +// ^^^^^ keyword.control.flow + +// more complex: +@scala.beans.BeanProperty +// <- meta.annotation + // <- meta.annotation.identifier +//^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.identifier +// ^^^^^^^^^^^^ variable.annotation +// ^ punctuation.accessor + +(e: Int @unchecked) match { ... } +// ^^ storage.type.primitive +// ^^ variable.annotation +// ^^^^^ keyword.control.flow + +@obsolete("this class is horrible don't use it", alpha=3) +// ^^ variable.annotation +// ^ string +// ^ constant.numeric.integer +trait Function0[@specialized(Unit, Int, Double) T] { +// ^^ variable.annotation +// ^^ storage.type.primitive +// ^ support.class +// ^ punctuation.definition.annotation +// ^ meta.annotation +// ^ meta.annotation.parameters +// ^ - meta.annotation +// ^ punctuation.separator.arguments.annotation + def apply: T +} + +x: Foo @volatile with Bar @foo.bar @bar with Baz +// ^^ variable.annotation +// ^^ keyword.declaration +// ^^^ support.class +// ^^^^^ - variable.annotation +// ^^^ variable.annotation +// ^^^ variable.annotation +// ^^^ support.class + + extends +// ^^^^^^^ invalid.keyword.dangling-extends.scala + + with +// ^^^^ invalid.keyword.dangling-with.scala + +class Foo with Bar +// ^^^^ invalid.keyword.with-before-extends.scala + +class Foo extends Bar extends Baz +// ^^^^^^^ invalid.keyword.extends-after-extends.scala + +class Foo extends Bar[A with B](42) +// ^ support.class.scala +// ^^^^ keyword.declaration.scala +// ^ support.class.scala +// ^^ constant.numeric.integer.decimal.scala + +class Foo extends Bar { val x = 42 } with Baz +// ^ punctuation.section.braces.begin.scala +// ^ punctuation.section.braces.end.scala +// ^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala + +class Foo { val x = 42 } extends Bar with Baz +// ^ punctuation.section.braces.begin.scala +// ^ punctuation.section.braces.end.scala +// ^^^^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala + +class Foo { + +// <- meta.class.body.scala +} + +class Foo extends Bar { + +// <- meta.class.body.scala +} + + { +// ^ punctuation.section.block.begin.scala + // <- meta.block.scala + } +// ^ punctuation.section.block.end.scala + + ( +// ^ punctuation.section.group.begin.scala + // <- meta.group.scala + ) +// ^ punctuation.section.group.end.scala + + [ +// ^ punctuation.definition.generic.begin.scala + // <- meta.generic.scala + ] +// ^ punctuation.definition.generic.end.scala + +class Foo extends Bar(42) +// ^ punctuation.section.parens.begin.scala +// ^ punctuation.section.parens.end.scala + +class Foo extends (Int => String) +// ^ punctuation.definition.parens.begin.scala +// ^ punctuation.definition.parens.end.scala + +class Foo extends Bar[Int] +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala + + object Underscore_ +// ^^^^^^ storage.type.class.scala +// ^^^^^^^^^^^ entity.name.class.scala + +match { + case _ +//^^^^ - meta.pattern +// ^ meta.pattern.scala + => 42 +// ^^ - meta.block.case.first +// ^^ - meta.pattern +// ^^ meta.block.case.first.scala +{ + + // <- - meta.block.case +} + + case _ => 42 +// ^^ - meta.block.case.non-first +// ^^ - meta.pattern +// ^^ meta.block.case.non-first.scala + + case _ => 42 +// ^^ - meta.block.case.non-first +// ^^ meta.block.case.non-first.scala +} + +class Foo + extends Bar +// ^^^^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala + +class Foo extends Bar + with Baz +// ^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala + +class Foo extends Bar + with Baz + with Bin +// ^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala + +def foo + 42 +// ^^ constant.numeric.integer.decimal.scala + +def foo() + 42 +// ^^ constant.numeric.integer.decimal.scala + +def foo(): + 42 +// ^^ constant.numeric.integer.decimal.scala + +val foo: Thing =42 +// ^^ constant.numeric.integer.decimal.scala + +var foo: Thing =42 +// ^^ constant.numeric.integer.decimal.scala + +class Foo extends Bar with { + import Thing._ +// ^^^^^^ keyword.other.import.scala +} + +class Foo extends Bar.Baz with bin.Baz +// ^^^^^^^ entity.other.inherited-class.scala +// ^ punctuation.accessor.scala +// ^^^^^^^ entity.other.inherited-class.scala +// ^ punctuation.accessor.scala + +final case class + +{ + final case => +// ^^^^^ - variable +} + + val ~ = 42 +// ^ variable.other.constant.scala + val \/- = 42 +// ^^^ variable.other.constant.scala + +type ~[+A] = A +// ^ keyword.operator +type ~[A <: B] = A +// ^^ keyword.operator +type ~[A >: B] = A +// ^^ keyword.operator + + +() +// ^^ - constant + +for { + // abc <- +} yield thing +// ^^^^^ - variable + +for ( + // abc <- +) yield thing +// ^^^^^ - variable + +for { + abc /* <- */ +} yield thing +// ^^^^^ - variable + +for { + "abc <-" +} yield thing +// ^^^^^ - variable + +for { + abc /* abc */ <- +// ^^^ variable.parameter.scala +} yield thing +// ^^^^^ - variable + + <![CDATA[<sender>John Smith</sender>]]> +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.cdata.xml +// ^ - invalid +// ^^^^^^^^^ punctuation.definition.string.begin.xml +// ^^^^^^ - entity +// ^^^ punctuation.definition.string.end.xml +// ^ - invalid + + <foo> +//^^^^^ text.xml meta.tag.xml +//^ punctuation.definition.tag.begin +// ^^^ entity.name.tag +// ^ punctuation.definition.tag.end +// ^ - text.xml text.xml + <![CDATA[<sender>John Smith</sender>]]> +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ text.xml string.unquoted.cdata.xml +// ^ - invalid +// ^^^^^^^^^ punctuation.definition.string.begin.xml +// ^^^^^^ - entity +// ^^^ punctuation.definition.string.end.xml +// ^ - invalid + </foo> +//^^^^^^ text.xml meta.tag.xml +//^^ punctuation.definition.tag.begin +// ^^^ entity.name.tag +// ^ punctuation.definition.tag.end + + case class +// ^^^^ storage.type.class.scala + +new Monad[Catenable] with Traverse +// ^ punctuation.definition.generic.begin.scala +// ^^^^^^^^^^^ meta.generic.scala +// ^ punctuation.definition.generic.end.scala +// ^^^^ keyword.declaration.scala +// ^^^^^^^^ support.class.scala + + final class A + final class B[A[_] <: B](a: B) +// ^^^^^ storage.modifier.other.scala +// ^^^^^ storage.type.class.scala +// ^ entity.name.class.scala +// ^^^^^^^^^^^ meta.generic.scala +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala +// ^^ keyword.operator.bound.scala +// ^ punctuation.definition.generic.end.scala +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala + +abc match { + case $foo(bar) => () + // ^^^^ - variable +} + + sealed trait Foo + sealed trait Bar +// ^^^^^^ storage.modifier.other.scala +// ^^^^^ storage.type.class.scala +// ^^^ entity.name.class.scala + +package object foo extends Bar with Baz +// ^^^^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala +// ^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala + +new RangeColumn(range) with LongColumn { def apply(row: Int) = a + row } +// ^^^^ keyword.declaration.scala +// ^^^^^^^^^^ support.class.scala +// ^^^ storage.type.function.scala + + implicit def M: Monad[M] + implicit def Monad +// ^^^^^^^^ storage.modifier.other.scala +// ^^^ storage.type.function.scala +// ^ entity.name.function.scala + + type Foo = + Bar +// ^^^ support.class.scala + + type Foo = + + Bar +// ^^^ support.constant.scala - support.class + + type Foo = Unit + type Bar = Unit +// ^^^ entity.name.type.scala +// ^ keyword.operator.assignment.scala + +type =?>[A] = Any +// ^^^ entity.name.type.scala +// ^^^ meta.generic.scala +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala + val x: Foo @> Bar +// ^^ support.type.scala + +val x: = 42 +// ^^ constant.numeric.integer.decimal.scala + + object Foo + IO +// ^^ support.constant.scala + + class Foo() + IO +// ^^ support.constant.scala + +val a' = 42 +// ^ - entity.name + +val ' = 42 +// ^ - entity.name + +type Foo = Monad[OptionT[IO, ?]] +// ^ variable.language.hole.scala + +type Foo = Monad[OptionT[IO, *]] +// ^ variable.language.hole.scala + +type Foo = Monad[λ[α => OptionT[IO, α]]] +// ^ keyword.operator.type-lambda.scala + +type Foo = Monad[Lambda[α => OptionT[IO, α]]] +// ^^^^^^ keyword.operator.type-lambda.scala + +import scalaz._, + Scalaz._ +// ^^^^^^ meta.import.scala + +import scalaz._ + Scalaz._ +// ^^^^^^ support.constant.scala - meta.import + + for { +// ^ punctuation.section.block.begin.scala + _ <_ + } yield true +// ^ punctuation.section.block.end.scala +// ^^^^^ keyword.control.flow.scala + + x: ResourceError \/ Resource +// ^^^^^^^^^^^^^ support.class.scala +// ^^ support.type.scala +// ^^^^^^^^ support.class.scala + + type TS1 = trans.TransSpec1 + import library._ +// ^^^^^^ - support.type + + type Foo = Thing { val a: Int } + // ^ punctuation.definition.block.begin.scala + // ^ punctuation.definition.block.end.scala + + type Foo = (Bar op (Baz)) + // ^ punctuation.definition.group.begin.scala + // ^ punctuation.definition.group.begin.scala + // ^ punctuation.definition.group.end.scala + // ^ punctuation.definition.group.end.scala + + def identity: CFId + override final def equals(other: Any): Boolean +// ^^^^^^^^ - support.type + + def blam(other: Foo forSome { val or: Repr }) = +// ^ keyword.operator.assignment.scala + + type P = Repr.this +// ^^^^ variable.language.scala + + type P = Repr.super +// ^^^^^ variable.language.scala + +a match { +// ^ punctuation.section.block.begin.scala + case x: b if Foo => +// ^^ keyword.control.flow.scala +// ^^^ support.constant.scala +} + +val foo: Abc if bar = 42 +// ^^ invalid.keyword.if-in-val-match.scala + +val (a: Foo, b: Bar) = () +// ^^^ support.class.scala +// ^^^ support.class.scala + + if (true) + new BitSet + else +// ^^^^ keyword.control.flow.scala + () + +Data.Boolean() +// ^^ - constant + + prop { k: Int Refined RPositive => } + +tail: _ * +// ^^^ keyword.operator.varargs.scala + + val Message( + Address(from), +// ^^^^ variable.other.constant.scala + Address(to), +// ^^ variable.other.constant.scala + subject, +// ^^^^^^^ variable.other.constant.scala + Content(tpe, value)) = m +// ^^^ variable.other.constant.scala +// ^^^^^ variable.other.constant.scala + +{ + case Foo() => +// ^^ - constant +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala + case foo(abc) => +// ^^^ support.constant.scala +// ^^^ - variable +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala + case foo() => +// ^^^ - variable +// ^^ - constant +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala +} + +val Foo() = 42 +// ^^ - constant +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala + +val foo() = 42 +// ^^^ support.constant.scala - entity +// ^^ - constant +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala + +val (Foo(), _) = 42 +// ^^ - constant +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala + +val (foo(), _) = 42 +// ^^^ support.constant.scala - entity +// ^^ - constant +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala + +for { + _<- fu +// ^ variable.language.underscore.scala +// ^^ keyword.operator.assignment.scala + + _← fu +// ^ variable.language.underscore.scala +// ^ keyword.operator.assignment.scala + + _= fu +// ^ variable.language.underscore.scala +// ^ keyword.operator.assignment.scala +} + +for (_<- fu; _← fu; _= fu) +// ^ punctuation.section.group.begin.scala +// ^ variable.language.underscore.scala +// ^^ keyword.operator.assignment.scala +// ^ variable.language.underscore.scala +// ^ keyword.operator.assignment.scala +// ^ variable.language.underscore.scala +// ^ keyword.operator.assignment.scala +// ^ punctuation.section.group.end.scala + + raw"foo\nbar\rbaz" +// ^^^ string.quoted.raw.interpolated.scala support.function.scala +// ^ string.quoted.raw.interpolated.scala punctuation.definition.string.begin.scala +// ^^^^^^^^^^^^^ string.quoted.raw.interpolated.scala +// ^^ string.quoted.raw.interpolated.scala +// ^^ string.quoted.raw.interpolated.scala +// ^ string.quoted.raw.interpolated.scala punctuation.definition.string.end.scala + +case (foo => } abc +// ^^^ - variable + +val x: Any +// ^^^ storage.type.primitive.scala + +val x: AnyRef +// ^^^^^^ storage.type.primitive.scala + +val x: AnyVal +// ^^^^^^ storage.type.primitive.scala + +val x: Nothing +// ^^^^^^^ storage.type.primitive.scala + +fold(a => b, { case c => d }) +// ^^ storage.type.function.arrow.lambda.scala +// ^^ storage.type.function.arrow.case.scala + +gzis =>/* foo */ +// ^^ storage.type.function.arrow.lambda.scala +// ^^^^^^^^^ comment.block.scala + +gzis =>// foo +// ^^ storage.type.function.arrow.lambda.scala +// ^^ comment.line.double-slash.scala punctuation.definition.comment.scala + +s"testing '$foo' bar" +// ^ string.quoted.interpolated.scala - variable +// ^ string.quoted.interpolated.scala - variable + + class Context(var abc: Boolean, val fed: Int) +// ^^^ storage.type.volatile.scala +// ^^^ variable.parameter.scala +// ^^^ storage.type.scala +// ^^^ variable.parameter.scala + +(abc)() +// ^^ - constant + + type S = Map + evalNT +// ^^^^^^ - support.type + + type S = Map x + evalNT +// ^^^^^^ support.type.scala + + type S = Map x y + evalNT +// ^^^^^^ - support.type + + type S = Map x y z + evalNT +// ^^^^^^ support.type.scala + + type S = Map x y z q + evalNT +// ^^^^^^ - support.type + + new Foo + evalNT +// ^^^^^^ - support.type.scala + + def c: String + override def d = "blah" +// ^^^^^^^^ storage.modifier.other.scala + + new DataCodec { + import PreciseKeys._ +// ^^^^^^ meta.import.scala keyword.other.import.scala +// ^^^^^^^^^^^ meta.import.scala +// ^ meta.import.scala punctuation.accessor.dot.scala +// ^ meta.import.scala variable.language.underscore.scala + } foo + bar +// ^^^ - support + +type Foo = (Bar, Baz) => Result +// ^^ keyword.operator.arrow.scala +// ^^^^^^ support.class.scala + +{ + case _: NumberFormatException => + val col = foo +// ^^^ storage.type.stable.scala +// ^^^ variable.other.constant.scala +// ^ keyword.operator.assignment.scala + case _: (NumberFormatException => Bar) => Bar + // ^^^ support.class.scala +} + +new AsyncException else data(i) +// ^^^^ keyword.control.flow.scala +// ^^^^ - support + +type Foo = this.Bar +// ^^^ support.class.scala + +type Foo = super.Bar +// ^^^ support.class.scala + +new Foo().bar +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala +// ^^^ - support + +new Foo[A].bar +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala +// ^^^ - support + +val foo: () => Unit +// ^^ - constant + +type T = Foo => (Bar, Baz) +// ^^^ support.class.scala +// ^^^ support.class.scala +// ^^^ support.class.scala + +new Array[Long]() +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala + +val foo: Bar = baz +// ^ punctuation.ascription.scala +// ^ - punctuation + +val (foo: Bar) = baz +// ^ punctuation.ascription.scala + +{ + case foo: Bar => baz +// ^ punctuation.ascription.scala +} + +foo: Bar +// ^ punctuation.ascription.scala + +(foo: Bar) => 42 +// ^ punctuation.ascription.scala + +def foo(bar: Baz): Unit +// ^ punctuation.ascription.scala + +class Foo(bar: Baz) +// ^ punctuation.ascription.scala + +val firstA :: firstB :: Nil = results +// ^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^ support.constant.scala - entity + +val (firstA :: firstB :: Nil) :: (secondA :: secondB :: Nil) :: Nil = results +// ^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^ support.constant.scala - entity +// ^^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^^^^ variable.other.constant.scala +// ^^^ support.constant.scala - entity +// ^^ - entity +// ^^^ support.constant.scala - entity + +{ + case (firstA :: firstB :: Nil) :: (secondA :: secondB :: Nil) :: Nil => results +// ^^^^^^ variable.parameter.scala +// ^^ - variable +// ^^^^^^ variable.parameter.scala +// ^^ - variable +// ^^^ support.constant.scala - variable +// ^^ - variable +// ^^^^^^^ variable.parameter.scala +// ^^ - variable +// ^^^^^^^ variable.parameter.scala +// ^^ - variable +// ^^^ support.constant.scala - variable +// ^^ - variable +// ^^^ support.constant.scala - variable +// ^^^^^^^ - variable +} + + val JsonStreamEq: + protected +// ^^^^^^^^^ storage.modifier.access.scala + +foo == bar +// ^^ keyword.operator.comparison.scala + +foo != bar +// ^^ keyword.operator.comparison.scala + +foo eq bar +// ^^ keyword.operator.comparison.scala + +foo ne bar +// ^^ keyword.operator.comparison.scala diff --git a/assets/syntaxes/Packages/ShellScript/.python-version b/assets/syntaxes/Packages/ShellScript/.python-version new file mode 100644 index 000000000..98fccd6d0 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/.python-version @@ -0,0 +1 @@ +3.8 \ No newline at end of file diff --git a/assets/syntaxes/Packages/ShellScript/Bash.sublime-syntax b/assets/syntaxes/Packages/ShellScript/Bash.sublime-syntax new file mode 100644 index 000000000..e973e319a --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Bash.sublime-syntax @@ -0,0 +1,1400 @@ +%YAML 1.2 +# [Sublime]: https://www.sublimetext.com/docs/3/syntax.html +# [Bash]: https://www.gnu.org/software/bash/manual/bash.html +--- #--------------------------------------------------------------------------- + +name: Bourne Again Shell (bash) + +# The suffix is bash, but we still use .shell as a suffix anyway. This is to +# promote reusability of foreign scopes. +scope: source.shell.bash + +file_extensions: + - sh + - bash + - zsh + - ash + - .bash_aliases + - .bash_completions + - .bash_functions + - .bash_login + - .bash_logout + - .bash_profile + - .bash_variables + - .bashrc + - .profile + - .textmate_init + - .zlogin + - .zlogout + - .zprofile + - .zshenv + - .zshrc + - PKGBUILD # https://jlk.fjfi.cvut.cz/arch/manpages/man/PKGBUILD.5 + - .ebuild + - .eclass + +first_line_match: | + (?x) + ^\#! .* \b(bash|zsh|sh|tcsh|ash)\b + | ^\# \s* -\*- [^*]* mode: \s* shell-script [^*]* -\*- + +#------------------------------------------------------------------------------- +variables: + call_token: \./ + cmd_boundary: (?=\s|;|$|>|<) + extension: \.sh + identifier: '[[:alpha:]_][[:alnum:]_]*' + identifier_non_posix: '[^{{metachar}}\d][^{{metachar}}=]*' + is_command: (?=\S) + is_end_of_interpolation: \) + is_end_of_option: '[^\w$-]|$' + is_function: \s*\b(function)\s+|(?=\s*{{identifier_non_posix}}\s*\(\s*\)) + is_path_component: (?=[^\s/]*/) + is_start_of_arguments: '[`=|&;()<>\s]' + is_variable: (?=\s*{{nbc}}(?:[({]{{nbc}}[)}])?{{nbc}}=) + keyword_break: (?![-=\w]) + + # A character that, when unquoted, separates words. A metacharacter is a + # space, tab, newline, or one of the following characters: ‘|’, ‘&’, ‘;’, + # ‘(’, ‘)’, ‘<’, or ‘>’. + metachar: '[\s\t\n|&;()<>]' + + nbc: '[^{}()=\s]*' # non bracket characters (and also non-whitespace, parens) + start_of_option: (?:\s+|^)--?(?=[\w$]) + varassign: '[+\-?]?=' +#------------------------------------------------------------------------------- +contexts: + + comment: + - match: (?:^\s*|\s+)(\#) + captures: + 1: + comment.line.number-sign.shell + punctuation.definition.comment.begin.shell + push: + - meta_content_scope: comment.line.number-sign.shell + # NOTE: The reason for consuming the newline character is as follows. + # When triggering a snippet, its scope is tested to the *right* of the + # cursor. So, if you don't want your snippet to trigger in a comment, + # you have to use something like <scope>source.shell - comment</scope>. + # If the newline character is not scoped as a comment too, then that + # scope will never work, because the scope to the right of the cursor + # will never be a comment scope. That is, unless we consume the newline + # character (or we are editing something in the middle of an existing + # comment). + - match: \n + scope: comment.line.number-sign.shell + pop: true + + line-continuation-or-pop-at-end: + - include: pop-at-end + - include: line-continuation + + pop-at-end: + - match: $ + pop: true + + any-escape: + - match: \\. + scope: constant.character.escape.shell + + line-continuation: + - match: \\\n + scope: punctuation.separator.continuation.line.shell + push: + - match: ^ + pop: true + - match: \\(\s+)\n + captures: + 1: invalid.illegal.extraneous-spaces-after-line-continuation.shell + + prototype: + - include: comment + - include: line-continuation + - include: any-escape + + main: + - include: funcdef + - include: vardef + - include: redirection + - include: operator-exclamation + - match: '{{is_command}}' + push: cmd + + # NOTE: Contexts with a "-bt" suffix are the "backtick" contexts. They mirror + # the ordinary contexts, except that when a backtick is encountered while in + # a "-bt" context, we pop. + # Normally, we are in a non-bt context. When we encounter a backtick character + # (the ` character), we enter the main-bt context. Popping when encountering + # another ` character then ensures that we don't enter yet another backtick + # context. + # The "expansion" context is the **only** place where this main-bt context is + # used. If you, the reader, knows of a more elegant way to handle backticks, + # don't hesitate to change it. + main-bt: + - include: funcdef-bt + - include: vardef + - include: redirection + - match: '{{is_command}}' + push: cmd-bt + + control: + - match: \bif{{keyword_break}} + scope: keyword.control.conditional.if.shell + pop: true + - match: \bthen{{keyword_break}} + scope: keyword.control.conditional.then.shell + pop: true + - match: \belif{{keyword_break}} + scope: keyword.control.conditional.elseif.shell + pop: true + - match: \bfi{{keyword_break}} + scope: keyword.control.conditional.end.shell + set: [cmd-post, cmd-args] + - match: \belse{{keyword_break}} + scope: keyword.control.conditional.else.shell + pop: true + - match: \bfor{{keyword_break}} + scope: keyword.control.loop.for.shell + set: [cmd-post, for-args] + - match: \bdo{{keyword_break}} + scope: keyword.control.loop.do.shell + pop: true + - match: \bdone{{keyword_break}} + scope: keyword.control.loop.end.shell + set: [cmd-post, cmd-args] + - match: \bwhile{{keyword_break}} + scope: keyword.control.loop.while.shell + - match: \buntil{{keyword_break}} + scope: keyword.control.loop.until.shell + - match: \bcase{{keyword_break}} + scope: keyword.control.conditional.case.shell + set: [case-body, case-word] + - match: \bcontinue{{keyword_break}} + scope: keyword.control.flow.continue.shell + - match: \bbreak{{keyword_break}} + scope: keyword.control.flow.break.shell + set: [cmd-post, cmd-args] + - match: \besac{{keyword_break}} + scope: keyword.control.conditional.end.shell + pop: true + + case-word: + - match: \bin{{keyword_break}} + scope: keyword.control.in.shell + pop: true + - include: case-end-ahead + - include: expansion-and-string + + case-body: + - meta_scope: meta.conditional.case.shell + - match: \besac{{keyword_break}} + scope: keyword.control.conditional.end.shell + pop: true + - match: (?=\() + push: + - clear_scopes: 1 # remove meta.conditional.case.shell + - match: \( + scope: keyword.control.conditional.patterns.begin.shell + set: case-clause-patterns + - match: (?=\S) + push: case-clause-patterns + + case-clause-patterns: + - clear_scopes: 1 # remove meta.conditional.case.shell + - meta_scope: meta.conditional.case.clause.patterns.shell + - match: \) + scope: keyword.control.conditional.patterns.end.shell + set: case-clause-commands + # emergency bail outs if ')' is missing + - match: (?=;;&?|;&) + set: case-clause-commands + - include: case-end-ahead + - include: case-clause-patterns-body + + case-clause-patterns-body: + # [Bash] 3.2.4.2: Each pattern undergoes tilde expansion, parameter + # expansion, command substitution, and arithmetic expansion. + - include: expansion-pattern + - include: expansion-tilde + - include: expansion-parameter + - include: expansion-command + - include: expansion-arithmetic + - include: string + - match: \| + scope: keyword.operator.logical.shell + - match: \( + scope: punctuation.section.parens.begin.shell + push: + - match: \) + scope: punctuation.section.parens.end.shell + pop: true + - include: case-clause-patterns-body + + case-clause-commands: + - clear_scopes: 1 # remove meta.conditional.case.shell + - meta_content_scope: meta.conditional.case.clause.commands.shell + - match: ;;&?|;& + scope: + meta.conditional.case.clause.commands.shell + punctuation.terminator.case.clause.shell + pop: true + - include: case-end-ahead + - include: main + + case-end-ahead: + - match: (?=\besac{{keyword_break}}) + pop: true + + # I don't think anybody will write a for-loop inside backticks. Hence no + # for-args-bt context. + for-args: + - match: "" + set: + - meta_scope: meta.group.for.shell + - include: cmd-args-boilerplate + - include: arithmetic + - match: \bin{{keyword_break}} + scope: keyword.control.in.shell + + expansion-and-string: + - include: string + - include: expansion + + funcdef: + - match: '{{is_function}}' + captures: + 1: storage.type.function.shell + push: [funcdef-body, funcdef-parens, funcdef-name] + - match: \bcoproc{{keyword_break}} + scope: keyword.other.coproc.shell + push: [cmd-post, cmd-args, coproc-body] + + funcdef-bt: + - match: '{{is_function}}' + captures: + 1: storage.type.function.shell + push: [funcdef-body-bt, funcdef-parens, funcdef-name] + - match: \bcoproc{{keyword_break}} + scope: keyword.other.coproc.shell + push: [cmd-post, cmd-args-bt, coproc-body] + + coproc-body: + - match: \s*(?=\S+\s*\{) + set: + - meta_content_scope: entity.name.function.coproc.shell + - match: (?=\s*\{) + set: + - match: \{ + scope: punctuation.section.braces.begin.shell + set: + - meta_scope: meta.function.coproc.shell + - match: \} + scope: punctuation.section.braces.end.shell + pop: true + - include: main + - match: "" + set: main-with-pop-at-end + + funcdef-name: + - match: \s* + set: + - meta_content_scope: entity.name.function.shell + - match: (?=\s*[({]|$) + pop: true + + funcdef-parens: + - match: (\()\s*(\)) + captures: + 1: punctuation.section.parens.begin.shell + 2: punctuation.section.parens.end.shell + - match: \{ + scope: punctuation.section.braces.begin.shell + pop: true + - match: \( + scope: punctuation.definition.compound.begin.shell + pop: true + + funcdef-body: + - meta_scope: meta.function.shell + - match: \} + scope: punctuation.section.braces.end.shell + pop: true + - match: \) + scope: punctuation.definition.compound.end.shell + pop: true + - include: main + + funcdef-body-bt: + - meta_scope: meta.function.shell + - match: \} + scope: punctuation.section.braces.end.shell + pop: true + - match: \) + scope: punctuation.definition.compound.end.shell + pop: true + - include: main-bt + + vardef: + - match: \s*\b(alias){{keyword_break}} + captures: + 1: support.function.alias.shell + push: + - vardef-ensure-function-call-scope + - vardef-maybe-more + - vardef-value + - vardef-assign + - vardef-alias-name + - vardef-alias-options + - match: \s*\b(typeset|declare|local){{keyword_break}} + captures: + 1: storage.modifier.shell + push: + - vardef-ensure-function-call-scope + - vardef-maybe-more + - vardef-value + - vardef-assign + - vardef-name + - vardef-declare-options + - match: \s*\b(export){{keyword_break}} + captures: + 1: storage.modifier.shell + push: + - vardef-ensure-function-call-scope + - vardef-maybe-more + - vardef-value + - vardef-assign + - vardef-name + - vardef-export-options + - match: \s*\b(readonly){{keyword_break}} + captures: + 1: storage.modifier.shell + push: + - vardef-ensure-function-call-scope + - vardef-maybe-more + - vardef-value + - vardef-assign + - vardef-name + - vardef-readonly-options + - match: '{{is_variable}}' + push: + - vardef-value + - vardef-assign + - vardef-name + + vardef-readonly-options: + - match: \s*((-)(?:[aAf]+|p)) + captures: + 2: punctuation.definition.parameter.shell + 1: variable.parameter.option.shell + - match: \s* + pop: true + + vardef-export-options: + - match: \s*((-)(?:[fn]+|p)) + captures: + 2: punctuation.definition.parameter.shell + 1: variable.parameter.option.shell + - match: \s* + pop: true + + vardef-ensure-function-call-scope: + - meta_include_prototype: false + - meta_scope: meta.function-call.shell + - match: "" + pop: true + + vardef-maybe-more: + - meta_include_prototype: false + - match: (?=`) + pop: true + - match: (?=\s*#) + pop: true + - include: cmd-args-boilerplate + - match: (?=\S) + push: [vardef-value, vardef-assign, vardef-name] + + vardef-alias-options: + - match: \s*((-)p) + captures: + 2: punctuation.definition.parameter.shell + 1: variable.parameter.option.shell + - match: \s* + pop: true + + vardef-alias-name: + - match: \s* + set: + - meta_include_prototype: false + - meta_content_scope: entity.name.function.alias.shell + - include: line-continuation-or-pop-at-end + - include: any-escape + - match: (?={{varassign}}|\s)|$ + pop: true + - include: array + - match: \s*$ + pop: true + - include: string + + vardef-declare-options: + - match: \s*((-)(?:[aAfFgilnrtux]+|p)) + captures: + 2: punctuation.definition.parameter.shell + 1: variable.parameter.option.shell + - match: \s* + pop: true + + vardef-name: + - match: \s* + set: + - meta_include_prototype: false + - meta_content_scope: variable.other.readwrite.assignment.shell + - include: line-continuation-or-pop-at-end + - include: any-escape + - match: (?={{varassign}}|\s)|$|(?=[;&`]|{{metachar}}) + pop: true + - include: array + - match: \s*$ + pop: true + - include: string + + vardef-assign: + - meta_include_prototype: false + - include: line-continuation-or-pop-at-end + - include: any-escape + - match: '{{varassign}}' + scope: keyword.operator.assignment.shell + pop: true + - match: "" + pop: true + + vardef-value: + - meta_include_prototype: false + - match: \( + scope: punctuation.section.parens.begin.shell + set: + - match: \) + scope: punctuation.section.parens.end.shell + pop: true + - match: \[ + scope: punctuation.section.brackets.begin.shell + push: + - match: \] + scope: punctuation.section.brackets.end.shell + set: + - match: = + scope: keyword.operator.assignment.shell + pop: true + - match: "" + pop: true + - include: expansion-and-string + - include: expansion-and-string + - match: (?=[&`]) + pop: true + - match: "" + set: + - meta_include_prototype: false + - meta_scope: string.unquoted.shell + - match: (?=`) + pop: true + - include: expansion-and-string + - include: line-continuation-or-pop-at-end + - include: any-escape + - match: (?={{metachar}}) + pop: true + + redirection: + - include: redirection-here-string + - include: redirection-here-document + - include: redirection-process + - include: redirection-input + - include: redirection-output + - include: redirection-inout + + redirection-process: + - match: (\d*)([<>])(\() + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.process.shell + 3: punctuation.section.parens.begin.shell + push: + - match: \) + scope: punctuation.section.parens.end.shell + pop: true + - include: main + + redirection-output: + - match: (\d*)(>>!?|>&?|&>|&?>(?:\||>)) + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + push: redirection-post + + redirection-input: + - match: (\d*)(<&?) + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + push: redirection-post + + redirection-post: + - match: \s*(?:(\d+)|(-)) + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: punctuation.terminator.file-descriptor.shell + pop: true + - match: \s*(?=\S) + set: + - match: (?={{metachar}}|`) + pop: true + - include: expansion-and-string + - match: \s* + pop: true + + redirection-inout: + - match: (\d*)(<>) + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + + redirection-here-string: + - match: (\d*)(<<<)\s + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.herestring.shell + + redirection-here-document: + # These are the variants that allow tabs before the end token + - match: (\d*)(<<-)\s*(')({{identifier}})(') + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + 3: punctuation.definition.string.begin.shell + 4: keyword.control.heredoc-token.shell + 5: punctuation.definition.string.end.shell + push: [heredocs-body-allow-tabs-no-expansion, heredocs-preamble] + - match: (\d*)(<<-)\s*(")({{identifier}})(") + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + 3: punctuation.definition.string.begin.shell + 4: keyword.control.heredoc-token.shell + 5: punctuation.definition.string.end.shell + push: [heredocs-body-allow-tabs-no-expansion, heredocs-preamble] + - match: (\d*)(<<-)\s*(\\)({{identifier}}) + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + 3: punctuation.definition.string.shell + 4: keyword.control.heredoc-token.shell + push: [heredocs-body-allow-tabs-no-expansion, heredocs-preamble] + - match: (\d*)(<<-)\s*({{identifier}}) + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + 3: keyword.control.heredoc-token.shell + push: [heredocs-body-allow-tabs, heredocs-preamble] + # These are the variants that DON'T allow tabs before the end token + - match: (\d*)(<<)\s*(')({{identifier}})(') + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + 3: punctuation.definition.string.begin.shell + 4: keyword.control.heredoc-token.shell + 5: punctuation.definition.string.end.shell + push: [heredocs-body-no-expansion, heredocs-preamble] + - match: (\d*)(<<)\s*(")({{identifier}})(") + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + 3: punctuation.definition.string.begin.shell + 4: keyword.control.heredoc-token.shell + 5: punctuation.definition.string.end.shell + push: [heredocs-body-no-expansion, heredocs-preamble] + - match: (\d*)(<<)\s*(\\)({{identifier}}) + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + 3: punctuation.definition.string.shell + 4: keyword.control.heredoc-token.shell + push: [heredocs-body-no-expansion, heredocs-preamble] + - match: (\d*)(<<)\s*({{identifier}}) + captures: + 1: constant.numeric.integer.decimal.file-descriptor.shell + 2: keyword.operator.assignment.redirection.shell + 3: keyword.control.heredoc-token.shell + push: [heredocs-body, heredocs-preamble] + + heredocs-body: + - meta_include_prototype: false + - meta_scope: string.unquoted.heredoc.shell + - include: heredocs-body-common-with-expansion + - match: ^\3(\s+)\n # the third capture from redirection-here-document + captures: + 1: invalid.illegal.no-spaces-allowed-after-heredoc-token.shell + # rather not pop, but sublime throws an error otherwise. + pop: true + - match: ^\3$ # the third capture from redirection-here-document + scope: keyword.control.heredoc-token.shell + pop: true + + heredocs-body-allow-tabs: + - meta_include_prototype: false + - meta_scope: string.unquoted.heredoc.shell + - include: heredocs-body-common-with-expansion + - match: ^\s*\3(\s+)\n # the third capture from redirection-here-document + captures: + 1: invalid.illegal.no-spaces-allowed-after-heredoc-token.shell + # rather not pop, but sublime throws an error otherwise. + pop: true + - match: ^\s*(\3)$ # the third capture from redirection-here-document + captures: + 1: keyword.control.heredoc-token.shell + pop: true + + heredocs-body-common-with-expansion: + # [Bash] 3.6.6: all lines of the here-document are subjected to parameter + # expansion, command substitution, and arithmetic expansion, the character + # sequence \newline is ignored, and ‘\’ must be used to quote the + # characters ‘\’, ‘$’, and ‘`’. + - match: \\[`$"\\] + scope: constant.character.escape.backtick.shell + - include: expansion-parameter + - include: expansion-arithmetic + - include: expansion-command + + heredocs-body-no-expansion: + - meta_include_prototype: false + - meta_scope: string.unquoted.heredoc.shell + - match: ^\4(\s+)\n # the fourth capture from redirection-here-document + captures: + 1: invalid.illegal.no-spaces-allowed-after-heredoc-token.shell + # rather not pop, but sublime throws an error otherwise. + pop: true + - match: ^\4$ # the fourth capture from redirection-here-document + scope: keyword.control.heredoc-token.shell + pop: true + + heredocs-body-allow-tabs-no-expansion: + - meta_include_prototype: false + - meta_scope: string.unquoted.heredoc.shell + - match: ^\s*\4(\s+)\n # the fourth capture from redirection-here-document + captures: + 1: invalid.illegal.no-spaces-allowed-after-heredoc-token.shell + # rather not pop, but sublime throws an error otherwise. + pop: true + - match: ^\s*(\4)$ # the fourth capture from redirection-here-document + captures: + 1: keyword.control.heredoc-token.shell + pop: true + + heredocs-preamble: + - match: "" + set: + # This enables us to keep parsing on the line where the start token of + # the heredoc is. Once the first line has ended, we enter the body of + # the heredoc, where everything is just an unquoted string. + # One clear_scope for the string.unquoted. + # The problem with this is that when we also end a function definition + # on the same line (with the "}" token), we cannot do that. + - clear_scopes: 1 + - match: $ + pop: true + - match: \s*(?=\S) + push: [main-with-pop-at-end, cmd-post, cmd-args] + + main-with-pop-at-end: + - include: line-continuation-or-pop-at-end + - include: main + + cmd-name-common: + - match: (?=}|\s+#|\s*(?:[|;]|&(?!>))) + pop: true + - include: string + - include: expansion-parameter + - include: expansion-arithmetic + - include: expansion-command + - include: expansion-tilde + - include: expansion-job + - include: line-continuation-or-pop-at-end + + cmd-args-common: + - match: (?=}|\s+#) + pop: true + - include: redirection + - match: (?=\s*([|;]|&(?!>))) + pop: true + - include: expansion-and-string + - include: line-continuation-or-pop-at-end + + cmd-post: # looks like [main, cmd-post] at this point + - match: ;(?![;&]) + scope: keyword.operator.logical.continue.shell + pop: true + - match: \|\| + scope: keyword.operator.logical.or.shell + pop: true + - match: \| + scope: keyword.operator.logical.pipe.shell + pop: true + - match: \&\& + scope: keyword.operator.logical.and.shell + pop: true + - match: \& + scope: keyword.operator.logical.job.shell + pop: true + - match: $|(?=\S) + pop: true + + cmd-args-boilerplate: + - match: (?={{is_end_of_interpolation}}) + pop: true + - include: cmd-args-common + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: end-of-options-common + + cmd-args-boilerplate-bt: + - match: (?={{is_end_of_interpolation}}|`) # <-------------- extra backtick + pop: true + - include: cmd-args-common + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - match: (?=`) # <-------------------------------------- extra backtick + pop: true + - include: end-of-options-common + + end-of-options-common: + - include: redirection + - match: (?=[)};&|]) + pop: true + - include: expansion-and-string + - include: line-continuation-or-pop-at-end + + cmd-args: + - match: "" + set: + - meta_scope: meta.function-call.arguments.shell + - include: cmd-args-boilerplate + - match: '{{start_of_option}}' + scope: punctuation.definition.parameter.shell + push: + - meta_scope: variable.parameter.option.shell + - match: (?==) + set: + - match: = + scope: keyword.operator.assignment.option.shell + pop: true + - match: (?={{is_end_of_option}}) + pop: true + - include: expansion-and-string + + cmd-args-bt: + - match: "" + set: + - meta_scope: meta.function-call.arguments.shell + - include: cmd-args-boilerplate-bt + - match: '{{start_of_option}}' + scope: punctuation.definition.parameter.shell + push: + - meta_scope: variable.parameter.option.shell + - match: (?==) + set: + - match: = + scope: keyword.operator.assignment.option.shell + pop: true + - match: (?={{is_end_of_option}}|`) # <------------- extra backtick + pop: true + - include: expansion-and-string + + cmd: + - include: cmd-common + - match: \( + scope: punctuation.definition.compound.begin.shell + push: + - match: \) + scope: punctuation.definition.compound.end.shell + set: [cmd-post, cmd-args] + - include: main + - include: scope:commands.builtin.shell.bash#main + - match: \blet\b + scope: support.function.let.bash + push: + - meta_scope: meta.function-call.shell + - match: $ + pop: true + - include: expression + - match: (\[\[)(?=\s) + captures: + 1: support.function.double-brace.begin.shell + set: [cmd-post, cmd-test-double-brace-args] + - match: (\[)(?=\s) + captures: + 1: support.function.test.begin.shell + set: [cmd-post, cmd-test-brace-args] + - match: (\{)(?=\s) + captures: + 1: punctuation.definition.compound.braces.begin.shell + push: + - match: \} + scope: punctuation.definition.compound.braces.end.shell + set: [cmd-post, cmd-args] + - include: main + - match: (?=\S) + set: [cmd-post, cmd-args, cmd-name] + + cmd-bt: + - include: cmd-common + - match: \( + scope: punctuation.definition.compound.begin.shell + push: + - match: \) + scope: punctuation.definition.compound.end.shell + set: [cmd-post, cmd-args-bt] + - include: main + - include: scope:commands.builtin.shell.bash#main-bt + - match: \blet\b + scope: support.function.let.bash + push: + - meta_scope: meta.function-call.shell + - match: $|(?=\`) + pop: true + - include: expression + - match: (\[\[)(?=\s) + captures: + 1: support.function.double-brace.begin.shell + set: [cmd-post, cmd-test-double-brace-args-bt] + - match: (\[)(?=\s) + captures: + 1: support.function.test.begin.shell + set: [cmd-post, cmd-test-brace-args-bt] + - match: (\{)(?=\s) + captures: + 1: punctuation.definition.compound.braces.begin.shell + push: + - match: \} + scope: punctuation.definition.compound.braces.end.shell + set: [cmd-post, cmd-args-bt] + - include: main-bt + - match: (?=\S) + set: [cmd-post, cmd-args-bt, cmd-name-bt] + + cmd-test-brace-args: + - match: "" + set: + - meta_scope: meta.function-call.arguments.shell + - include: cmd-args-boilerplate + - match: \s+(\]) + captures: + 1: support.function.test.end.shell + pop: true + - include: expression-test + + cmd-test-brace-args-bt: + - match: "" + set: + - meta_scope: meta.function-call.arguments.shell + - include: cmd-args-boilerplate-bt + - match: \s+(\]) + captures: + 1: support.function.test.end.shell + pop: true + - include: expression-test + + cmd-test-double-brace-args: + - meta_scope: meta.function-call.arguments.shell + - match: \s+(\]\]) + captures: + 1: support.function.double-brace.end.shell + pop: true + - include: expression-test + # - include: cmd-args-boilerplate + + cmd-test-double-brace-args-bt: + - meta_scope: meta.function-call.arguments.shell + - match: \s+(\]\]) + captures: + 1: support.function.double-brace.end.shell + pop: true + - include: expression-test + # - include: cmd-args-boilerplate-bt + + cmd-name: + - match: "" + set: + - meta_scope: meta.function-call.shell variable.function.shell + - match: (?={{is_start_of_arguments}}|{{is_end_of_interpolation}}) + pop: true + - include: cmd-name-common + + cmd-name-bt: + - match: "" + set: + - meta_scope: meta.function-call.shell variable.function.shell + # extra backtick + - match: (?={{is_start_of_arguments}}|{{is_end_of_interpolation}}|`) + pop: true + - include: cmd-name-common + + cmd-common: + - include: control + - include: arithmetic + - match: (?=\)|}) + pop: true + - include: line-continuation-or-pop-at-end + + arithmetic: + - match: \(\((?=.+\)\)) + scope: punctuation.section.arithmetic.begin.shell + push: + - meta_scope: meta.group.arithmetic.shell + - match: \)\) + scope: punctuation.section.arithmetic.end.shell + pop: true + - include: expression + + expansion-tilde: + - match: '~' + scope: meta.group.expansion.tilde variable.language.tilde.shell + + expansion-brace: + - match: \{ + scope: punctuation.section.expansion.brace.begin.shell + push: + - meta_scope: meta.group.expansion.brace.shell + - match: \} + scope: punctuation.section.expansion.brace.end.shell + pop: true + - match: \, + scope: punctuation.separator.shell + - include: expansion-and-string + + expansion-parameter: + - match: (\$)(\{) + captures: + 0: meta.group.expansion.parameter.shell + 1: punctuation.definition.variable.shell + 2: punctuation.section.expansion.parameter.begin.shell + push: + - meta_content_scope: meta.group.expansion.parameter.shell + - meta_include_prototype: false + - match: \! + scope: keyword.operator.indirection.shell + set: expansion-parameter-post-first-character + - match: \# + scope: keyword.operator.arithmetic.shell + set: expansion-parameter-post-first-character + - match: "" + set: expansion-parameter-post-first-character + - match: (\$)(\d) + captures: + 0: meta.group.expansion.parameter.shell + 1: punctuation.definition.variable.shell + 2: variable.other.readwrite.shell + - match: (\$)([$#@!~*?_-])(?!\w) + captures: + 0: meta.group.expansion.parameter.shell + 1: punctuation.definition.variable.shell + 2: variable.language.shell + - match: (\$)({{identifier}}) + captures: + 0: meta.group.expansion.parameter.shell + 1: punctuation.definition.variable.shell + 2: variable.other.readwrite.shell + + expansion-pattern: + - match: ([?*+@!])(\() + captures: + 1: keyword.operator.regexp.quantifier.shell + 2: punctuation.section.parens.begin.shell + push: + - match: \) + scope: punctuation.section.parens.end.shell + pop: true + - match: \| + scope: keyword.operator.logical.or.shell + - include: expansion-and-string + - match: '[*?]' + scope: keyword.operator.regexp.quantifier.shell + - match: \[(?=.*]) + scope: keyword.control.regexp.set.begin.shell + push: + - match: (?=]) + set: expansion-pattern-post-first-char + - match: '[!^]' + scope: keyword.operator.logical.not.shell + set: expansion-pattern-post-first-char + - match: \- + set: expansion-pattern-post-first-char + - match: "" + set: expansion-pattern-post-first-char + + expansion-pattern-post-first-char: + - match: (?:-)?(\]) + captures: + 1: keyword.control.regexp.set.end.shell + pop: true + - match: \- + scope: keyword.operator.word.shell + - match: (\.)[[:word:]](\.) + captures: + 1: punctuation.separator.collate.begin.shell + 2: punctuation.separator.collate.end.shell + - match: (=)[[:word:]](=) + captures: + 1: punctuation.separator.equivalence-class.begin.shell + 2: punctuation.separator.equivalence-class.end.shell + - match: (:)[[:lower:]]+(:) + captures: + 1: punctuation.separator.character-class.begin.shell + 2: punctuation.separator.character-class.end.shell + # You cannot have a regex set inside a regex set, so just consume this + # character in order to not push into another regex set. + # Except when writing a character class like [:lower:], so negative look + # ahead for that possibility. + - match: \[(?![\.=:]) + - include: expansion-and-string + + expansion-arithmetic: + - match: (\$)(\(\()(?=.+\)\)) + captures: + 1: punctuation.definition.variable.shell + 2: punctuation.section.parens.begin.shell + push: + - meta_scope: meta.group.expansion.arithmetic.shell + - match: \)\) + scope: punctuation.section.parens.end.shell + pop: true + - include: expression + + expansion-command: + - match: (\$)(\() + captures: + 1: punctuation.definition.variable.shell + 2: punctuation.section.parens.begin.shell + push: + - meta_scope: meta.group.expansion.command.parens.shell + - match: \s*(\)) + captures: + 1: punctuation.section.parens.end.shell + pop: true + - include: main + - match: \` + scope: punctuation.section.group.begin.shell + push: + - meta_scope: meta.group.expansion.command.backticks.shell + - match: \` + scope: punctuation.section.group.end.shell + pop: true + - include: main-bt # all those *-bt contexts just for this!!!! + + expansion: + - include: expansion-pattern + - include: expansion-parameter + - include: expansion-brace + - include: expansion-arithmetic + - include: expansion-command + - include: expansion-tilde + - include: expansion-job + + expansion-parameter-common: + - meta_content_scope: meta.group.expansion.parameter.shell + - match: \} + scope: + meta.group.expansion.parameter.shell + punctuation.section.expansion.parameter.end.shell + pop: true + - include: string + - include: expansion-parameter + # no brace expansion + - include: expansion-arithmetic + - include: expansion-command + - include: expansion-tilde + # no pattern expansion + - include: any-escape + + array: + - match: \[ + scope: punctuation.section.braces.begin.shell + push: + - match: \] + scope: punctuation.section.braces.end.shell + pop: true + - match: '[*@]' + scope: variable.language.array.shell + - include: expression + + expansion-parameter-post-first-character: + - meta_content_scope: + meta.group.expansion.parameter.shell + variable.other.readwrite.shell + - include: expansion-parameter-common + - match: (?=[@*]?/) + set: + - meta_content_scope: meta.group.expansion.parameter.shell + - match: ([@*])?(/) + captures: + 1: variable.language.shell + 2: keyword.operator.substitution.shell + set: + - meta_include_prototype: false + - meta_content_scope: meta.group.expansion.parameter.shell + - match: '[/#%]' + scope: variable.parameter.switch.shell + set: expansion-parameter-pattern + - match: "" + set: expansion-parameter-pattern + - match: (?=\:?[-+=?]) + set: + - meta_content_scope: meta.group.expansion.parameter.shell + - match: \:?[-+=?] + scope: keyword.operator.assignment.shell + set: expansion-parameter-common + - match: (?=@?:) + set: + - meta_content_scope: meta.group.expansion.parameter.shell + - match: '(@)?(:)' + captures: + 1: variable.language.shell + 2: keyword.operator.substring.begin.shell + set: + - meta_content_scope: meta.group.expansion.parameter.shell + - match: (?=:) + set: + - meta_content_scope: meta.group.expansion.parameter.shell + - match: ":" + scope: keyword.operator.substring.end.shell + set: + - meta_content_scope: meta.group.expansion.parameter.shell + - include: expression + - include: expansion-parameter-common + - include: expression + - include: expansion-parameter-common + - match: \#(?=}) + - match: ([@*])?(\#\#?|%%?|\^\^?|,,?) + captures: + 1: variable.language.shell + 2: keyword.operator.expansion.shell + set: + - meta_include_prototype: false + - meta_content_scope: meta.group.expansion.parameter.shell + - include: expansion-parameter-common + - include: expansion-pattern + - match: ([@*]?)(@)([QEPAa])(?=}) + captures: + 1: variable.language.shell + 2: keyword.operator.expansion.shell + 3: variable.parameter.switch.shell + - include: array + - match: '[*@](?=})' + scope: variable.language.shell + + expansion-parameter-pattern: + - meta_content_scope: meta.group.expansion.parameter.shell + - match: / + scope: keyword.operator.substitution.shell + set: expansion-parameter-common + - include: expansion-parameter-common + - include: expansion-pattern + + expansion-job: + # There are a number of ways to refer to a job in the shell. + # The symbols ‘%%’ and ‘%+’ refer to the shell’s notion of the current job, + # which is the last job stopped while it was in the foreground or started in + # the background. The previous job may be referenced using ‘%-’. + - match: (%)([%+-]) + captures: + 0: meta.group.expansion.job.shell + 1: punctuation.definition.variable.job.shell + 2: variable.language.job.shell + # The character ‘%’ introduces a job specification (jobspec). Job number n + # may be referred to as ‘%n’. + - match: (%)(\d+) + captures: + 0: meta.group.expansion.job.shell + 1: punctuation.definition.variable.job.shell + 2: constant.numeric.integer.decimal.job.shell + # A job may also be referred to using a prefix of the name used to start it, + # or using a substring that appears in its command line. For example, ‘%ce’ + # refers to a stopped ce job. Using ‘%?ce’, on the other hand, refers to any + # job containing the string ‘ce’ in its command line. If the prefix or + # substring matches more than one job, Bash reports an error. + - match: (%)(\??)(\w+) + captures: + 0: meta.group.expansion.job.shell + 1: punctuation.definition.variable.job.shell + 2: keyword.operator.regexp.quantifier.shell + 3: variable.other.readwrite.shell + # A single ‘%’ (with no accompanying job specification) also refers to the + # current job. + - match: '%' + scope: + meta.group.expansion.job.shell + punctuation.definition.variable.job.shell + + + expression: + # A leading ‘0x’ or ‘0X’ denotes hexadecimal. + - match: \b0[xX] + scope: punctuation.definition.numeric.base.shell + push: + - meta_scope: constant.numeric.integer.hexadecimal.shell + - match: '[g-zG-Z]' + scope: invalid.illegal.not-a-hex-character.shell + pop: true + - match: (?=\H) + pop: true + # Constants with a leading 0 are interpreted as octal numbers. + - match: \b0(?=[0-7]) + scope: punctuation.definition.numeric.base.shell + push: + - meta_scope: constant.numeric.integer.octal.shell + - match: '[89]' + scope: invalid.illegal.not-an-octal-character.shell + pop: true + - match: (?=[^0-7]) + pop: true + # Otherwise, numbers take the form [base#]n, where the optional base is a + # decimal number between 2 and 64 representing the arithmetic base, and n is + # a number in that base. When specifying n, the digits greater than 9 are + # represented by the lowercase letters, the uppercase letters, ‘@’, and ‘_’, + # in that order. + - match: \b(\d+#)[a-zA-Z0-9@_]+ + scope: constant.numeric.integer.other.shell + captures: + 1: punctuation.definition.numeric.base.shell + # If base# is omitted, then base 10 is used. + - match: \b\d+ + scope: constant.numeric.integer.decimal.shell + - match: '[*/%+\-&^|]?=|<<=|>>=' + scope: keyword.operator.assignment.shell + - match: \+\+?|\-\-?|\*\*?|%|/ + scope: keyword.operator.arithmetic.shell + - match: <[=<]?|>[=>]?|[=!]=|&&|\:|\|\||! + scope: keyword.operator.logical.shell + - match: '[&|^~]' + scope: keyword.operator.bitwise.shell + - match: '[,;]' + scope: punctuation.separator.shell + - match: \? + scope: keyword.operator.ternary.shell + - match: \( + scope: punctuation.section.parens.begin.shell + push: + - meta_scope: meta.group.parens.shell + - match: \) + scope: punctuation.section.parens.end.shell + pop: true + - include: expression + # Shell variables are allowed as operands; parameter expansion is performed + # before the expression is evaluated. Within an expression, shell variables + # may also be referenced by name without using the parameter expansion + # syntax. + - include: string + - include: expansion-parameter + - include: expansion-arithmetic + - include: expansion-command + + expression-test: + - include: expansion-and-string + - match: ((-)[aobcdefghknoprstuvwxzGLNORS])(?=\s) + captures: + 2: punctuation.definition.parameter.shell + 1: variable.parameter.option.shell + - match: ((-)(?:ef|nt|ot|eq|ne|lt|le|gt|ge))(?=\s) + captures: + 2: punctuation.definition.parameter.shell + 1: variable.parameter.option.shell + - match: (=~)\s* + captures: + 1: keyword.operator.logical.shell + push: + - meta_content_scope: meta.regexp.shell + - match: (?=\s) + pop: true + - include: expansion-and-string + - match: ==?|!=?|<|>|\|\||&& + scope: keyword.operator.logical.shell + + operator-exclamation: + - match: \!(?!\S) + scope: keyword.operator.logical.shell + - match: (\!)(-?\d+|!) + scope: variable.language.history.shell + captures: + 1: punctuation.definition.history.shell + - match: \! + scope: punctuation.definition.history.shell + + string: + - include: string-quoted-double + - include: string-quoted-single + - include: string-ansi-c + - include: string-locale + + # nothing is escaped in a singly-quoted string! + string-quoted-single: + - match: \' + scope: punctuation.definition.string.begin.shell + push: + - meta_include_prototype: false + - meta_scope: string.quoted.single.shell + - match: \' + scope: punctuation.definition.string.end.shell + pop: true + + string-quoted-double: + - match: \" + scope: punctuation.definition.string.begin.shell + push: + - meta_include_prototype: false + - meta_scope: string.quoted.double.shell + - include: string-quoted-double-common + + string-quoted-double-escape-character: + - match: \\[$`"\\] + scope: constant.character.escape.shell + - match: \\\n + scope: constant.character.escape.shell + push: + - meta_include_prototype: false + - match: (?=\S) + pop: true + + # [Bash] 3.1.2.4 + string-ansi-c: + - match: \$' + scope: punctuation.definition.string.begin.shell + push: + - meta_include_prototype: false + - meta_scope: string.quoted.single.ansi-c.shell + - match: "'" + scope: punctuation.definition.string.end.shell + pop: true + - include: string-quoted-double-escape-character + - match: \\([abfnrtv'"?]|[0-8]{1,3}|x\h{1,8}|c[a-z]) + scope: constant.character.escape.shell + + # [Bash] 3.1.2.5 + # If the string is translated and replaced, the replacement is double-quoted. + string-locale: + - match: \$" + scope: punctuation.definition.string.begin.shell + push: + - meta_include_prototype: false + - meta_scope: string.quoted.double.locale.shell + - include: string-quoted-double-common + + string-quoted-double-common: + - match: \" + scope: punctuation.definition.string.end.shell + pop: true + - include: string-quoted-double-escape-character + - include: expansion-parameter + - include: expansion-arithmetic + - include: expansion-command + diff --git a/assets/syntaxes/Packages/ShellScript/Comments.tmPreferences b/assets/syntaxes/Packages/ShellScript/Comments.tmPreferences new file mode 100644 index 000000000..18b5fb285 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Comments.tmPreferences @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>source.shell</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string># </string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/ShellScript/Completion Rules.tmPreferences b/assets/syntaxes/Packages/ShellScript/Completion Rules.tmPreferences new file mode 100644 index 000000000..034ef714b --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Completion Rules.tmPreferences @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>scope</key> + <string>source.shell</string> + <key>settings</key> + <dict> + <key>cancelCompletion</key> + <string>^.*\b(fi|esac|then|do|done)$</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/ShellScript/Indentation.tmPreferences b/assets/syntaxes/Packages/ShellScript/Indentation.tmPreferences new file mode 100644 index 000000000..db0e98811 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Indentation.tmPreferences @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Indentation</string> + <key>scope</key> + <string>source.shell</string> + <key>settings</key> + <dict> + <key>decreaseIndentPattern</key> + <string>^\s*(\}|(elif|else|fi|esac|done)\b)</string> + <key>increaseIndentPattern</key> + <string>(?x) + ^\s*(elif|else|case)\b + | ^.*(\{|\b(do)\b)\s*$ + | ^.*\bthen\b\s*$ + </string> + <key>indentNextLinePattern</key> + <string>^.*[^\\]\\$</string> + <key>disableIndentNextLinePattern</key> + <string>^\s*then\s*$</string> + <key>bracketIndentNextLinePattern</key> + <string>^\s*if\b.*(?!\bthen\b)$</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/ShellScript/Makefile b/assets/syntaxes/Packages/ShellScript/Makefile new file mode 100644 index 000000000..7450965c0 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Makefile @@ -0,0 +1,15 @@ +# The update script is located in the tools subdirectory because otherwise +# Sublime will read the file during start-up. No need for that. + +all: $(addsuffix .sublime-syntax, $(basename $(wildcard *.yml))) + +%.sublime-syntax: %.yml tools/update-commands.py + @printf "$< ==> $@ ... " + @python tools/update-commands.py $< $@ + @echo "Done." + +test: + @-/usr/bin/env bash test/syntax_test_bash.sh 2>&1 \ + | sed -nE "/^test\/syntax_test_bash.sh: line [[:digit:]]+: syntax .*/p" + +.PHONY: test diff --git a/assets/syntaxes/Packages/ShellScript/Shell-Unix-Generic.sublime-syntax b/assets/syntaxes/Packages/ShellScript/Shell-Unix-Generic.sublime-syntax new file mode 100644 index 000000000..819051f86 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Shell-Unix-Generic.sublime-syntax @@ -0,0 +1,10 @@ +%YAML 1.2 +--- +name: Shell-Unix-Generic +hidden: true +scope: source.shell +contexts: + prototype: + - include: scope:source.shell.bash#prototype + main: + - include: scope:source.shell.bash diff --git a/assets/syntaxes/Packages/ShellScript/ShellScript.py b/assets/syntaxes/Packages/ShellScript/ShellScript.py new file mode 100644 index 000000000..9d50cb397 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/ShellScript.py @@ -0,0 +1,44 @@ +import copy +import os +import re +import shlex +import Default.exec + + +class RunShellScriptCommand(Default.exec.ExecCommand): + + def run(self, **kwargs): + view = self.window.active_view() + if not view: + return + file_name = view.file_name() + if not file_name: + return + + # Determine the shell to run + firstline = view.substr(view.line(0)) + match = re.match(r"\s*#!(.+)", firstline) + if match: + # Note: we split on whitespace and turn it + # into a list, otherwise things like + # "/usr/bin/env bash" won't work + shell = shlex.split(match.group(1)) + else: + # No shebang line... Take the user's default shell + shell = [os.environ["SHELL"]] + + # Determine the working directory + working_dir = kwargs.get("working_dir", None) + if not working_dir: + working_dir = os.path.dirname(file_name) + + # Determine the environment variables + env = copy.deepcopy(os.environ) + custom_env = kwargs.get("env", None) + if custom_env: + env.update(custom_env) + + # Delegate to the super class + super().run(cmd=shell + [file_name], + working_dir=working_dir, + env=env) diff --git a/assets/syntaxes/Packages/ShellScript/ShellScript.sublime-build b/assets/syntaxes/Packages/ShellScript/ShellScript.sublime-build new file mode 100644 index 000000000..894a3a8b7 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/ShellScript.sublime-build @@ -0,0 +1,4 @@ +{ + "selector" : "source.shell", + "target" : "run_shell_script" +} diff --git a/assets/syntaxes/Packages/ShellScript/Snippets/#!-usr-bin-env-(!env).sublime-snippet b/assets/syntaxes/Packages/ShellScript/Snippets/#!-usr-bin-env-(!env).sublime-snippet new file mode 100644 index 000000000..102acb50c --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Snippets/#!-usr-bin-env-(!env).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[#!/usr/bin/env ${1:${TM_SCOPE/(?:source|.*)\.(?:(shell\.(?!bash)(\w+))|(shell)|(\w+)).*/(?1$2)(?3bash:$4)/}} +]]></content> + <tabTrigger>!env</tabTrigger> + <scope>source.actionscript.2, source.applescript, source.clojure, source.cs, source.d, source.dart, source.fsharp, source.groovy, source.haskell, source.java, source.js, source.julia, source.lisp, source.lua, source.makefile, source.ocaml, source.perl, source.php, source.python, source.r, source.ruby, source.rust, source.scala, source.shell, source.swift, source.tcl, source.ts</scope> + <description>#!/usr/bin/env</description> +</snippet> diff --git a/assets/syntaxes/Packages/ShellScript/Snippets/case-..-esac-(case).sublime-snippet b/assets/syntaxes/Packages/ShellScript/Snippets/case-..-esac-(case).sublime-snippet new file mode 100644 index 000000000..8c238438c --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Snippets/case-..-esac-(case).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[case ${1:word} in + ${2:pattern} ) + $0;; +esac]]></content> + <tabTrigger>case</tabTrigger> + <scope>source.shell.bash</scope> + <description>case … esac</description> +</snippet> diff --git a/assets/syntaxes/Packages/ShellScript/Snippets/elif-..-(elif).sublime-snippet b/assets/syntaxes/Packages/ShellScript/Snippets/elif-..-(elif).sublime-snippet new file mode 100644 index 000000000..2898dfb6d --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Snippets/elif-..-(elif).sublime-snippet @@ -0,0 +1,7 @@ +<snippet> + <content><![CDATA[elif ${2:[[ ${1:condition} ]]}; then + ${0:#statements}]]></content> + <tabTrigger>elif</tabTrigger> + <scope>source.shell.bash</scope> + <description>elif …</description> +</snippet> diff --git a/assets/syntaxes/Packages/ShellScript/Snippets/for-...-done-(for).sublime-snippet b/assets/syntaxes/Packages/ShellScript/Snippets/for-...-done-(for).sublime-snippet new file mode 100644 index 000000000..9079ef442 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Snippets/for-...-done-(for).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[for (( i = 0; i < ${1:10}; i++ )); do + ${0:#statements} +done]]></content> + <tabTrigger>for</tabTrigger> + <scope>source.shell.bash</scope> + <description>for … done</description> +</snippet> diff --git a/assets/syntaxes/Packages/ShellScript/Snippets/for-in-done-(forin).sublime-snippet b/assets/syntaxes/Packages/ShellScript/Snippets/for-in-done-(forin).sublime-snippet new file mode 100644 index 000000000..cd39e386f --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Snippets/for-in-done-(forin).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[for ${1:i}${2/.+/ in /}${2:words}; do + ${0:#statements} +done]]></content> + <tabTrigger>forin</tabTrigger> + <scope>source.shell.bash</scope> + <description>for … in … done</description> +</snippet> diff --git a/assets/syntaxes/Packages/ShellScript/Snippets/if-...-then-(if).sublime-snippet b/assets/syntaxes/Packages/ShellScript/Snippets/if-...-then-(if).sublime-snippet new file mode 100644 index 000000000..20322aa0d --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Snippets/if-...-then-(if).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[if ${2:[[ ${1:condition} ]]}; then + ${0:#statements} +fi]]></content> + <tabTrigger>if</tabTrigger> + <scope>source.shell.bash</scope> + <description>if … fi</description> +</snippet> diff --git a/assets/syntaxes/Packages/ShellScript/Snippets/until-(done).sublime-snippet b/assets/syntaxes/Packages/ShellScript/Snippets/until-(done).sublime-snippet new file mode 100644 index 000000000..67999de3a --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Snippets/until-(done).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[until ${2:[[ ${1:condition} ]]}; do + ${0:#statements} +done]]></content> + <tabTrigger>until</tabTrigger> + <scope>source.shell.bash</scope> + <description>until … done</description> +</snippet> diff --git a/assets/syntaxes/Packages/ShellScript/Snippets/while-(done).sublime-snippet b/assets/syntaxes/Packages/ShellScript/Snippets/while-(done).sublime-snippet new file mode 100644 index 000000000..5fdedde07 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Snippets/while-(done).sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[while ${2:[[ ${1:condition} ]]}; do + ${0:#statements} +done]]></content> + <tabTrigger>while</tabTrigger> + <scope>source.shell.bash</scope> + <description>while … done</description> +</snippet> diff --git a/assets/syntaxes/Packages/ShellScript/Symbol List - Aliases.tmPreferences b/assets/syntaxes/Packages/ShellScript/Symbol List - Aliases.tmPreferences new file mode 100644 index 000000000..8dab74c53 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Symbol List - Aliases.tmPreferences @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List - Aliases</string> + <key>scope</key> + <string>entity.name.function.alias.shell</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>showInIndexedSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string>s/.+/alias\: $0/</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/ShellScript/Symbol List - Expansions.tmPreferences b/assets/syntaxes/Packages/ShellScript/Symbol List - Expansions.tmPreferences new file mode 100644 index 000000000..f9a251677 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Symbol List - Expansions.tmPreferences @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List - Variables</string> + <key>scope</key> + <string>meta.group.expansion</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>showInIndexedSymbolList</key> + <integer>0</integer> + <key>symbolTransformation</key> + <string>s/.+/expansion\: $0/</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/ShellScript/Symbol List - Functions.tmPreferences b/assets/syntaxes/Packages/ShellScript/Symbol List - Functions.tmPreferences new file mode 100644 index 000000000..8bb715ad6 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Symbol List - Functions.tmPreferences @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List - Functions</string> + <key>scope</key> + <string>entity.name.function.shell</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>showInIndexedSymbolList</key> + <integer>1</integer> + <key>symbolTransformation</key> + <string>s/.+/function\: $0/</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/ShellScript/Symbol List - Variables.tmPreferences b/assets/syntaxes/Packages/ShellScript/Symbol List - Variables.tmPreferences new file mode 100644 index 000000000..b61fa617d --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/Symbol List - Variables.tmPreferences @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List - Variables</string> + <key>scope</key> + <string>variable.other.readwrite.assignment.shell</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + <key>showInIndexedSymbolList</key> + <integer>0</integer> + <key>symbolTransformation</key> + <string>s/.+/variable\: $0/</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/ShellScript/commands-builtin-shell-bash.sublime-syntax b/assets/syntaxes/Packages/ShellScript/commands-builtin-shell-bash.sublime-syntax new file mode 100644 index 000000000..11556a8d5 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/commands-builtin-shell-bash.sublime-syntax @@ -0,0 +1,1223 @@ +%YAML 1.2 +--- +# Automatically generated file -- do not edit! +contexts: + cmd-args-bg: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-bg-base + cmd-args-bg-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + cmd-args-bg-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-bg-base + cmd-args-bind: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-bind-base + cmd-args-bind-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[mqurfx]|[lpsvPSVX]+)(?=\s|;|$|`|\)) + cmd-args-bind-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-bind-base + cmd-args-builtin: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-builtin-base + cmd-args-builtin-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + cmd-args-builtin-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-builtin-base + cmd-args-caller: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-caller-base + cmd-args-caller-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + cmd-args-caller-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-caller-base + cmd-args-cd: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-cd-base + cmd-args-cd-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[LPe@])(?=\s|;|$|`|\)) + cmd-args-cd-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-cd-base + cmd-args-colon: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + cmd-args-colon-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + cmd-args-command: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-command-base + cmd-args-command-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[pVv]+)(?=\s|;|$|`|\)) + cmd-args-command-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-command-base + cmd-args-disown: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-disown-base + cmd-args-disown-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[h]|[ar]+)(?=\s|;|$|`|\)) + cmd-args-disown-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-disown-base + cmd-args-dot: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + cmd-args-dot-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + cmd-args-echo: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-echo-base + cmd-args-echo-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[neE]+)(?=\s|;|$|`|\)) + cmd-args-echo-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-echo-base + cmd-args-enable: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-enable-base + cmd-args-enable-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[af]|[dnps]+)(?=\s|;|$|`|\)) + cmd-args-enable-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-enable-base + cmd-args-eval: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + cmd-args-eval-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + cmd-args-exec: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-exec-base + cmd-args-exec-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[a]|[cl]+)(?=\s|;|$|`|\)) + cmd-args-exec-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-exec-base + cmd-args-exit: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + cmd-args-exit-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + cmd-args-fg: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-fg-base + cmd-args-fg-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + cmd-args-fg-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-fg-base + cmd-args-getopts: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-getopts-base + cmd-args-getopts-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + cmd-args-getopts-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-getopts-base + cmd-args-hash: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-hash-base + cmd-args-hash-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[rpl]|[dt]+)(?=\s|;|$|`|\)) + cmd-args-hash-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-hash-base + cmd-args-help: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-help-base + cmd-args-help-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[dms]+)(?=\s|;|$|`|\)) + cmd-args-help-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-help-base + cmd-args-jobs: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-jobs-base + cmd-args-jobs-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[x]|[lnprs]+)(?=\s|;|$|`|\)) + cmd-args-jobs-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-jobs-base + cmd-args-kill: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-kill-base + cmd-args-kill-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[snlL])(?=\s|;|$|`|\)) + cmd-args-kill-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-kill-base + cmd-args-logout: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-logout-base + cmd-args-logout-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + cmd-args-logout-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-logout-base + cmd-args-mapfile: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-mapfile-base + cmd-args-mapfile-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[dnOstuCc])(?=\s|;|$|`|\)) + cmd-args-mapfile-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-mapfile-base + cmd-args-printf: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-printf-base + cmd-args-printf-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[v])(?=\s|;|$|`|\)) + cmd-args-printf-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-printf-base + cmd-args-pwd: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-pwd-base + cmd-args-pwd-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[LP]+)(?=\s|;|$|`|\)) + cmd-args-pwd-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-pwd-base + cmd-args-read: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-read-base + cmd-args-read-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[adeinNprstu]|[ers]+)(?=\s|;|$|`|\)) + cmd-args-read-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-read-base + cmd-args-readarray: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-readarray-base + cmd-args-readarray-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[adeinNprstu]|[ers]+)(?=\s|;|$|`|\)) + cmd-args-readarray-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-readarray-base + cmd-args-return: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + cmd-args-return-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + cmd-args-set: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-set-base + cmd-args-set-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((\-|\+)(?:[o]|[abefhkmnptuvxBCEHPT]+))(?=\s|;|$|`|\)) + cmd-args-set-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-set-base + cmd-args-shift: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + cmd-args-shift-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + cmd-args-shopt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-shopt-base + cmd-args-shopt-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[o]|[pqsu]+)(?=\s|;|$|`|\)) + cmd-args-shopt-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-shopt-base + cmd-args-source: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-source-base + cmd-args-source-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + cmd-args-source-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-source-base + cmd-args-suspend: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-suspend-base + cmd-args-suspend-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[f])(?=\s|;|$|`|\)) + cmd-args-suspend-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-suspend-base + cmd-args-times: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-times-base + cmd-args-times-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + cmd-args-times-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-times-base + cmd-args-trap: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-trap-base + cmd-args-trap-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[lp]+)(?=\s|;|$|`|\)) + cmd-args-trap-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-trap-base + cmd-args-type: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-type-base + cmd-args-type-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[afptP]+)(?=\s|;|$|`|\)) + cmd-args-type-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-type-base + cmd-args-ulimit: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-ulimit-base + cmd-args-ulimit-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[HSabcdefiklmnpqrstuvxPT]+)(?=\s|;|$|`|\)) + cmd-args-ulimit-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-ulimit-base + cmd-args-umask: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-umask-base + cmd-args-umask-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[pS])(?=\s|;|$|`|\)) + cmd-args-umask-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-umask-base + cmd-args-unalias: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-unalias-base + cmd-args-unalias-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[a])(?=\s|;|$|`|\)) + cmd-args-unalias-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-unalias-base + cmd-args-unset: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-unset-base + cmd-args-unset-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[fnv]+)(?=\s|;|$|`|\)) + cmd-args-unset-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-unset-base + cmd-args-wait: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate + - include: cmd-args-wait-base + cmd-args-wait-base: + - match: (?:\s+|^)--(?=\s|$) + scope: keyword.operator.end-of-options.shell + set: + - meta_content_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#expansion-and-string + - include: scope:source.shell.bash#line-continuation-or-pop-at-end + - captures: + 1: variable.parameter.option.shell + 2: punctuation.definition.parameter.shell + match: (?:\s+|^)((-)[n])(?=\s|;|$|`|\)) + cmd-args-wait-bt: + - match: '' + set: + - meta_scope: meta.function-call.arguments.shell + - include: scope:source.shell.bash#cmd-args-boilerplate-bt + - include: cmd-args-wait-base + main: + - match: '{{boundary_begin}}set{{boundary_end}}' + scope: meta.function-call.shell support.function.set.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-set + - match: '{{boundary_begin}}help{{boundary_end}}' + scope: meta.function-call.shell support.function.help.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-help + - match: '{{boundary_begin}}mapfile{{boundary_end}}' + scope: meta.function-call.shell support.function.mapfile.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-mapfile + - match: '{{boundary_begin}}getopts{{boundary_end}}' + scope: meta.function-call.shell support.function.getopts.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-getopts + - match: '{{boundary_begin}}cd{{boundary_end}}' + scope: meta.function-call.shell support.function.cd.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-cd + - match: '{{boundary_begin}}suspend{{boundary_end}}' + scope: meta.function-call.shell support.function.suspend.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-suspend + - match: '{{boundary_begin}}:{{boundary_end}}' + scope: meta.function-call.shell support.function.colon.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-colon + - match: '{{boundary_begin}}printf{{boundary_end}}' + scope: meta.function-call.shell support.function.printf.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-printf + - match: '{{boundary_begin}}hash{{boundary_end}}' + scope: meta.function-call.shell support.function.hash.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-hash + - match: '{{boundary_begin}}ulimit{{boundary_end}}' + scope: meta.function-call.shell support.function.ulimit.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-ulimit + - match: '{{boundary_begin}}umask{{boundary_end}}' + scope: meta.function-call.shell support.function.umask.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-umask + - match: '{{boundary_begin}}source{{boundary_end}}' + scope: meta.function-call.shell support.function.source.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-source + - match: '{{boundary_begin}}builtin{{boundary_end}}' + scope: meta.function-call.shell support.function.builtin.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-builtin + - match: '{{boundary_begin}}exit{{boundary_end}}' + scope: meta.function-call.shell support.function.exit.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-exit + - match: '{{boundary_begin}}type{{boundary_end}}' + scope: meta.function-call.shell support.function.type.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-type + - match: '{{boundary_begin}}bg{{boundary_end}}' + scope: meta.function-call.shell support.function.bg.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-bg + - match: '{{boundary_begin}}return{{boundary_end}}' + scope: meta.function-call.shell keyword.control.flow.return.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-return + - match: '{{boundary_begin}}exec{{boundary_end}}' + scope: meta.function-call.shell support.function.exec.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-exec + - match: '{{boundary_begin}}read{{boundary_end}}' + scope: meta.function-call.shell support.function.read.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-read + - match: '{{boundary_begin}}enable{{boundary_end}}' + scope: meta.function-call.shell support.function.enable.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-enable + - match: '{{boundary_begin}}pwd{{boundary_end}}' + scope: meta.function-call.shell support.function.pwd.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-pwd + - match: '{{boundary_begin}}logout{{boundary_end}}' + scope: meta.function-call.shell support.function.logout.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-logout + - match: '{{boundary_begin}}eval{{boundary_end}}' + scope: meta.function-call.shell support.function.eval.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-eval + - match: '{{boundary_begin}}fg{{boundary_end}}' + scope: meta.function-call.shell support.function.fg.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-fg + - match: '{{boundary_begin}}disown{{boundary_end}}' + scope: meta.function-call.shell support.function.disown.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-disown + - match: '{{boundary_begin}}echo{{boundary_end}}' + scope: meta.function-call.shell support.function.echo.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-echo + - match: '{{boundary_begin}}\.{{boundary_end}}' + scope: meta.function-call.shell support.function.dot.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-dot + - match: '{{boundary_begin}}wait{{boundary_end}}' + scope: meta.function-call.shell support.function.wait.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-wait + - match: '{{boundary_begin}}jobs{{boundary_end}}' + scope: meta.function-call.shell support.function.jobs.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-jobs + - match: '{{boundary_begin}}bind{{boundary_end}}' + scope: meta.function-call.shell support.function.bind.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-bind + - match: '{{boundary_begin}}caller{{boundary_end}}' + scope: meta.function-call.shell support.function.caller.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-caller + - match: '{{boundary_begin}}times{{boundary_end}}' + scope: meta.function-call.shell support.function.times.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-times + - match: '{{boundary_begin}}unalias{{boundary_end}}' + scope: meta.function-call.shell support.function.unalias.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-unalias + - match: '{{boundary_begin}}command{{boundary_end}}' + scope: meta.function-call.shell support.function.command.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-command + - match: '{{boundary_begin}}trap{{boundary_end}}' + scope: meta.function-call.shell support.function.trap.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-trap + - match: '{{boundary_begin}}shift{{boundary_end}}' + scope: meta.function-call.shell support.function.shift.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-shift + - match: '{{boundary_begin}}kill{{boundary_end}}' + scope: meta.function-call.shell support.function.kill.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-kill + - match: '{{boundary_begin}}readarray{{boundary_end}}' + scope: meta.function-call.shell support.function.readarray.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-readarray + - match: '{{boundary_begin}}shopt{{boundary_end}}' + scope: meta.function-call.shell support.function.shopt.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-shopt + - match: '{{boundary_begin}}unset{{boundary_end}}' + scope: meta.function-call.shell support.function.unset.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-unset + main-bt: + - match: '{{boundary_begin}}set{{boundary_end}}' + scope: meta.function-call.shell support.function.set.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-set-bt + - match: '{{boundary_begin}}help{{boundary_end}}' + scope: meta.function-call.shell support.function.help.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-help-bt + - match: '{{boundary_begin}}mapfile{{boundary_end}}' + scope: meta.function-call.shell support.function.mapfile.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-mapfile-bt + - match: '{{boundary_begin}}getopts{{boundary_end}}' + scope: meta.function-call.shell support.function.getopts.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-getopts-bt + - match: '{{boundary_begin}}cd{{boundary_end}}' + scope: meta.function-call.shell support.function.cd.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-cd-bt + - match: '{{boundary_begin}}suspend{{boundary_end}}' + scope: meta.function-call.shell support.function.suspend.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-suspend-bt + - match: '{{boundary_begin}}:{{boundary_end}}' + scope: meta.function-call.shell support.function.colon.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-colon-bt + - match: '{{boundary_begin}}printf{{boundary_end}}' + scope: meta.function-call.shell support.function.printf.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-printf-bt + - match: '{{boundary_begin}}hash{{boundary_end}}' + scope: meta.function-call.shell support.function.hash.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-hash-bt + - match: '{{boundary_begin}}ulimit{{boundary_end}}' + scope: meta.function-call.shell support.function.ulimit.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-ulimit-bt + - match: '{{boundary_begin}}umask{{boundary_end}}' + scope: meta.function-call.shell support.function.umask.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-umask-bt + - match: '{{boundary_begin}}source{{boundary_end}}' + scope: meta.function-call.shell support.function.source.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-source-bt + - match: '{{boundary_begin}}builtin{{boundary_end}}' + scope: meta.function-call.shell support.function.builtin.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-builtin-bt + - match: '{{boundary_begin}}exit{{boundary_end}}' + scope: meta.function-call.shell support.function.exit.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-exit-bt + - match: '{{boundary_begin}}type{{boundary_end}}' + scope: meta.function-call.shell support.function.type.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-type-bt + - match: '{{boundary_begin}}bg{{boundary_end}}' + scope: meta.function-call.shell support.function.bg.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-bg-bt + - match: '{{boundary_begin}}return{{boundary_end}}' + scope: meta.function-call.shell keyword.control.flow.return.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-return-bt + - match: '{{boundary_begin}}exec{{boundary_end}}' + scope: meta.function-call.shell support.function.exec.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-exec-bt + - match: '{{boundary_begin}}read{{boundary_end}}' + scope: meta.function-call.shell support.function.read.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-read-bt + - match: '{{boundary_begin}}enable{{boundary_end}}' + scope: meta.function-call.shell support.function.enable.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-enable-bt + - match: '{{boundary_begin}}pwd{{boundary_end}}' + scope: meta.function-call.shell support.function.pwd.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-pwd-bt + - match: '{{boundary_begin}}logout{{boundary_end}}' + scope: meta.function-call.shell support.function.logout.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-logout-bt + - match: '{{boundary_begin}}eval{{boundary_end}}' + scope: meta.function-call.shell support.function.eval.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-eval-bt + - match: '{{boundary_begin}}fg{{boundary_end}}' + scope: meta.function-call.shell support.function.fg.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-fg-bt + - match: '{{boundary_begin}}disown{{boundary_end}}' + scope: meta.function-call.shell support.function.disown.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-disown-bt + - match: '{{boundary_begin}}echo{{boundary_end}}' + scope: meta.function-call.shell support.function.echo.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-echo-bt + - match: '{{boundary_begin}}\.{{boundary_end}}' + scope: meta.function-call.shell support.function.dot.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-dot-bt + - match: '{{boundary_begin}}wait{{boundary_end}}' + scope: meta.function-call.shell support.function.wait.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-wait-bt + - match: '{{boundary_begin}}jobs{{boundary_end}}' + scope: meta.function-call.shell support.function.jobs.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-jobs-bt + - match: '{{boundary_begin}}bind{{boundary_end}}' + scope: meta.function-call.shell support.function.bind.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-bind-bt + - match: '{{boundary_begin}}caller{{boundary_end}}' + scope: meta.function-call.shell support.function.caller.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-caller-bt + - match: '{{boundary_begin}}times{{boundary_end}}' + scope: meta.function-call.shell support.function.times.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-times-bt + - match: '{{boundary_begin}}unalias{{boundary_end}}' + scope: meta.function-call.shell support.function.unalias.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-unalias-bt + - match: '{{boundary_begin}}command{{boundary_end}}' + scope: meta.function-call.shell support.function.command.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-command-bt + - match: '{{boundary_begin}}trap{{boundary_end}}' + scope: meta.function-call.shell support.function.trap.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-trap-bt + - match: '{{boundary_begin}}shift{{boundary_end}}' + scope: meta.function-call.shell support.function.shift.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-shift-bt + - match: '{{boundary_begin}}kill{{boundary_end}}' + scope: meta.function-call.shell support.function.kill.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-kill-bt + - match: '{{boundary_begin}}readarray{{boundary_end}}' + scope: meta.function-call.shell support.function.readarray.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-readarray-bt + - match: '{{boundary_begin}}shopt{{boundary_end}}' + scope: meta.function-call.shell support.function.shopt.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-shopt-bt + - match: '{{boundary_begin}}unset{{boundary_end}}' + scope: meta.function-call.shell support.function.unset.shell + set: + - scope:source.shell.bash#cmd-post + - cmd-args-unset-bt + prototype: + - include: scope:source.shell.bash#prototype +hidden: true +scope: commands.builtin.shell.bash +variables: + boundary_begin: '' + boundary_end: (?=\s|;|$|>|<|\|) diff --git a/assets/syntaxes/Packages/ShellScript/commands-builtin-shell-bash.yml b/assets/syntaxes/Packages/ShellScript/commands-builtin-shell-bash.yml new file mode 100644 index 000000000..d1da3d8ef --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/commands-builtin-shell-bash.yml @@ -0,0 +1,155 @@ +%YAML 1.2 +--- #--------------------------------------------------------------------------- + +bind: + short-options: mqurfx + short-options-compact: lpsvPSVX + +builtin: + ~ + +caller: + ~ + +colon: + match: ":" + allow-end-of-options-token: false + scope: support.function.colon.shell + +command: + short-options-compact: pVv + +cd: + short-options: LPe@ + +dot: + match: "\\." + allow-end-of-options-token: false + scope: support.function.dot.shell + +enable: + short-options: af + short-options-compact: dnps + +help: + short-options-compact: dms + +logout: + ~ + +mapfile: + short-options: dnOstuCc + +printf: + short-options: v + +read: + short-options-compact: ers + short-options: adeinNprstu + +readarray: + short-options-compact: ers + short-options: adeinNprstu + +source: + allow-end-of-options-token: false + scope: support.function.dot.shell + +type: + short-options-compact: afptP + +ulimit: + short-options-compact: HSabcdefiklmnpqrstuvxPT + +unalias: + short-options: a + +eval: + allow-end-of-options-token: false + +exec: + short-options-compact: cl + short-options: a + +exit: + allow-end-of-options-token: false + +# "export" is handled as storage.modifier in the syntax def, don't put it here! +# export, readonly, declare, local, typeset + +getopts: + ~ + +hash: + short-options: rpl + short-options-compact: dt + +pwd: + short-options-compact: LP + +# "readonly" is handled as storage.modifier in the syntax def, don't put it here! + +return: + allow-end-of-options-token: false + scope: keyword.control.flow.return.shell + +shift: + allow-end-of-options-token: false + +times: + ~ + +trap: + short-options-compact: lp + +umask: + short-options: pS + +unset: + short-options-compact: fnv + +echo: + short-options-compact: neE + +set: + short-options-compact: abefhkmnptuvxBCEHPT + short-options: o + short-option-prefixes: [\-, \+] + allow-end-of-options-token: true + allow-short-end-of-options-token: true + +source: + ~ + +shopt: + short-options-compact: pqsu + short-options: o + +# These are from +# https://www.gnu.org/software/bash/manual/bash.html#Job-Control-Builtins + +bg: + ~ + +fg: + ~ + +jobs: + short-options-compact: lnprs + short-options: x + +kill: + short-options: snlL + # TODO: -sigspec + +wait: + short-options: "n" + +disown: + short-options-compact: ar + short-options: h + +suspend: + short-options: f + +... diff --git a/assets/syntaxes/Packages/ShellScript/test/syntax_test_bash.sh b/assets/syntaxes/Packages/ShellScript/test/syntax_test_bash.sh new file mode 100755 index 000000000..bfe863be0 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/test/syntax_test_bash.sh @@ -0,0 +1,2435 @@ +# SYNTAX TEST "Packages/ShellScript/Bash.sublime-syntax" +# <- comment.line punctuation.definition.comment +#^ comment.line +# ^ comment.line +# ^ comment.line + +############## +# The basics # +############## + +echo hello, world! +# <- meta.function-call support.function - meta.function-call.arguments +# ^ meta.function-call.arguments +echo hello, \ +# ^^ punctuation.separator.continuation.line +# <- support.function.echo +world! +# TODO: This should be a variable.function above here +# The above is again a command, because the line continuation was prematurely +# ended by the comment. +echo hello, \ +world! +# <- meta.function-call.arguments - variable.function +# The above is not a command, because of the line continuation. +echo hello, \ +# ^^ - punctuation.separator.continuation.line +# (there's an extra space following the backslash, so not a line-continuation) +world! +# <- variable.function +echo This is a smiley :-\) \(I have to escape the parentheses, though!\) +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +echo the q"uick" f"ox" ju"mp"ed o"ve"r t'he' 'la'zy 'dog' +# ^ string.quoted.double punctuation.definition.string.begin +# ^^^^ string.quoted.double +# ^ string.quoted.double punctuation.definition.string.end +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ string.quoted.single +# ^ string.quoted.single punctuation.definition.string.end +echo 'no\e$capes\in\$ingle\quotes' +# ^ string.quoted.single punctuation.definition.string.begin +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single +# ^ string.quoted.single punctuation.definition.string.end +# ^ - constant +# ^ - keyword +# ^ - constant +# ^ - constant +# ^ - keyword +# ^ - constant +echo $'\a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z' +# ^^ punctuation +# ^^^^ constant.character.escape +# ^^^^^^ - constant.character.escape +# ^^ constant.character.escape +# ^^^^^^^^^^^^^^ - constant.character.escape +# ^^ constant.character.escape +# ^^^^^^ - constant.character.escape +# ^^ constant.character.escape +# ^^ - constant.character.escape +# ^^ constant.character.escape +# ^^ - constant.character.escape +# ^^ constant.character.escape +# ^^^^^^^^ - constant.character.escape +# ^ punctuation +echo $"Hello" +# ^^ punctuation +# ^ punctuation +randomname argument --opt1 --opt2 -x -y &>/dev/null +# <- meta.function-call variable.function - meta.function-call.arguments +#^^^^^^^^^ meta.function-call variable.function - meta.function-call.arguments +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +# ^^ variable.parameter.option punctuation +# ^^^^ variable.parameter.option - punctuation +# ^^ variable.parameter.option punctuation +# ^^^^ variable.parameter.option - punctuation +# ^ variable.parameter.option punctuation +# ^ variable.parameter.option - punctuation +# ^ variable.parameter.option punctuation +# ^ variable.parameter.option - punctuation +another-random-command arg foo--not-an-option +# ^ - variable.parameter +# ^ - variable.parameter +# ^ - variable.parameter +# ^ - variable.parameter +# Test if commands are recognized even in the presence of strings and variable +# expansions +ch=ch +e${ch}"o" hello, world! +# <- meta.function-call variable.function +#^^^^^^^^ meta.function-call variable.function +# ^^^^^^^^^^^^^^ meta.function-call.arguments +#^ punctuation.definition.variable +# ^ punctuation.section.expansion.parameter.begin +# ^^ variable.other.readwrite +# ^ punctuation.section.expansion.parameter.end +# ^ string.quoted.double punctuation.definition.string.begin +# ^ string.quoted.double +# ^ string.quoted.double punctuation.definition.string.end +e=e +${e}'ch'o hello, world! +# <- meta.function-call variable.function +#^^^^^^^^ meta.function-call variable.function +# ^^^^^^^^^^^^^^ meta.function-call.arguments +# <- punctuation.definition.variable +#^ punctuation +# ^ variable.other.readwrite +# ^ punctuation +# ^ string.quoted.single punctuation.definition.string.begin +# ^^ string.quoted.single +# ^ string.quoted.single punctuation.definition.string.end +echo hello#not-a-comment +# ^^^^^^^^^^^^^^ meta.function-call.arguments - comment.line - variable.function +echo -e "foo" +# ^ variable.parameter.option punctuation +# ^ variable.parameter +foo --opt1 arg1 +# ^^ variable.parameter punctuation +# ^^^^^^ variable.parameter +foo --opt1 arg1 -- --not-an-option +# ^^ keyword.operator +# ^ - variable.parameter punctuation +set -e +# ^ variable.parameter.option punctuation +# ^ variable.parameter.option - punctuation +set +e +# ^ variable.parameter.option punctuation +# ^ variable.parameter.option - punctuation +python foo.py --option=value --other-option +# ^ keyword.operator.assignment.option +git log --format="%h git has this pattern, too" +# ^ keyword.operator.assignment.option + +######################## +# Variable assignments # +######################## +x=a +# <- variable.other.readwrite.assignment +#^ keyword.operator.assignment +# ^ string.unquoted +x=a # some comment +# ^ - string.unquoted +x=a#not-a-comment +# ^ string.unquoted - comment +x=a pwd +# <- variable.other.readwrite.assignment +#^ keyword.operator.assignment +# ^ - string.unquoted +# ^^^ meta.function-call support.function +x="a b" pwd +# ^ string.quoted.double punctuation.definition.string.begin +# ^^^ string.quoted.double +# ^ string.quoted.double punctuation.definition.string.end +# ^ - string.unquoted +# ^^^ meta.function-call support.function +x=a y=b pwd +#^ keyword.operator.assignment +# ^ string.unquoted +# ^ - string.unquoted +# ^ keyword.operator.assignment +# ^ string.unquoted +# ^ - string.unquoted +# ^^^ meta.function-call support.function +foo=bar baz=qux +# ^^^ string.unquoted +# ^^^ string.unquoted +x=${foo} y=${baz}"asdf" pwd +#^ keyword.operator.assignment +# ^ string.unquoted punctuation.definition.variable +# ^ string.unquoted punctuation +# ^^^ string.unquoted variable.other.readwrite +# ^ string.unquoted punctuation +# ^ keyword.operator.assignment +# ^ string.unquoted punctuation.definition.variable +# ^ string.unquoted punctuation +# ^^^ string.unquoted variable.other.readwrite +# ^ string.unquoted punctuation +# ^ string.unquoted string.quoted.double punctuation.definition.string.begin +# ^^^^ string.unquoted string.quoted.double +# ^ string.unquoted string.quoted.double punctuation.definition.string.end +# ^^^ meta.function-call support.function + +# Spaces following an assignment token means an empty string value! +x= pwd +# <- variable.other.readwrite.assignment +#^ keyword.operator.assignment +# ^^^ meta.function-call support.function + +BOWL=$(($(cat food.txt | wc -l) + 5)) +# ^ keyword.operator.assignment +# ^ punctuation.definition.variable +# ^^ punctuation +# ^ punctuation.definition.variable +# ^^^ variable.function +# ^^^^^^^^ - variable.function +# ^ - meta.function-call +# ^ keyword.operator +# ^ - meta.function-call +# ^^ meta.function-call variable.function +# ^ punctuation +# ^ keyword.operator +# ^ constant.numeric +# ^^ punctuation + +############# +# Variables # +############# + +: $__ + #^ variable.other + +: $var_0 + # ^ variable.other + +: $_var0 + #^ variable.other + +: $_0var_ + #^ variable.other + +# Expands to the positional parameters, starting from one. When the expansion is +# not within double quotes, each positional parameter expands to a separate +# word. In contexts where it is performed, those words are subject to further +# word splitting and pathname expansion. When the expansion occurs within double +# quotes, it expands to a single word with the value of each parameter separated +# by the first character of the IFS special variable. That is, "$*" is +# equivalent to "$1c$2c…", where c is the first character of the value of the +# IFS variable. If IFS is unset, the parameters are separated by spaces. If IFS +# is null, the parameters are joined without intervening separators. +: $* +# ^ variable.language + +# Expands to the positional parameters, starting from one. When the expansion +# occurs within double quotes, each parameter expands to a separate word. That +# is, "$@" is equivalent to "$1" "$2" …. If the double-quoted expansion occurs +# within a word, the expansion of the first parameter is joined with the +# beginning part of the original word, and the expansion of the last parameter +# is joined with the last part of the original word. When there are no +# positional parameters, "$@" and $@ expand to nothing (i.e., they are removed). +: $@ +# ^ variable.language + +# Expands to the number of positional parameters in decimal. +: $# +# ^ variable.language + +# Expands to the exit status of the most recently executed foreground pipeline. +: $? +# ^ variable.language + +# Expands to the current option flags as specified upon invocation, by the set +# builtin command, or those set by the shell itself (such as the -i option). +: $- +# ^ variable.language + +# Expands to the process ID of the shell. In a () subshell, it expands to the +# process ID of the invoking shell, not the subshell. +: $$ +# ^ variable.language + +# Expands to the process ID of the job most recently placed into the background, +# whether executed as an asynchronous command or using the bg builtin +: $! +# ^ variable.language + +# Expands to the name of the shell or shell script. This is set at shell +# initialization. If Bash is invoked with a file of commands (see Shell +# Scripts), $0 is set to the name of that file. If Bash is started with the -c +# option (see Invoking Bash), then $0 is set to the first argument after the +# string to be executed, if one is present. Otherwise, it is set to the filename +# used to invoke Bash, as given by argument zero. +: $0 +# ^ variable.other.readwrite + +# At shell startup, set to the absolute pathname used to invoke the shell or +# shell script being executed as passed in the environment or argument list. +# Subsequently, expands to the last argument to the previous command, after +# expansion. Also set to the full pathname used to invoke each command executed +# and placed in the environment exported to that command. When checking mail, +# this parameter holds the name of the mail file. +: $_ +# ^ variable.language + +fg % +# ^ meta.group.expansion.job punctuation.definition.variable.job +fg %% +# ^ meta.group.expansion.job punctuation.definition.variable.job +# ^ meta.group.expansion.job variable.language.job +fg %+ +# ^ meta.group.expansion.job punctuation.definition.variable.job +# ^ meta.function-call.arguments meta.group.expansion.job variable.language.job +fg %- +# ^ meta.group.expansion.job punctuation.definition.variable.job +# ^ meta.function-call.arguments meta.group.expansion.job variable.language.job +fg %1 %2 %3 +# ^ meta.group.expansion.job punctuation.definition.variable.job +# ^ meta.group.expansion.job constant.numeric.integer.decimal.job +# ^ meta.group.expansion.job punctuation.definition.variable.job +# ^ meta.group.expansion.job constant.numeric.integer.decimal.job +# ^ meta.group.expansion.job punctuation.definition.variable.job +# ^ meta.group.expansion.job constant.numeric.integer.decimal.job +fg %ce +# ^ meta.group.expansion.job punctuation.definition.variable.job +# ^^ meta.group.expansion.job variable.other.readwrite +fg %?ce +# ^ meta.group.expansion.job punctuation.definition.variable.job +# ^ meta.group.expansion.job keyword.operator.regexp.quantifier +# ^^ meta.group.expansion.job variable.other.readwrite + +%1 +# <- meta.group.expansion.job punctuation.definition.variable.job +#^ meta.group.expansion.job constant.numeric.integer.decimal.job + +sleep 2 & jobs +# <- meta.function-call variable.function +# ^ meta.function-call.arguments +# ^ keyword.operator +# ^ meta.function-call support.function - meta.function-call.arguments + +subdir/./myscript.sh --option arg1 arg2 -x + +${foo}/${bar}/${baz} +# ^^^ variable.function variable.other +# ^^^ variable.function variable.other +# ^^^ variable.function variable.other + +declare foo # 'foo' is a variable name +# ^ - variable.other.readwrite +# ^ - meta.function-call +declare -A foo bar # 'foo' and 'bar' are variable names +#^^^^^^^^^^^^^^^^^ meta.function-call +# ^ - meta.function-call +declare ret; bar=foo +# ^ keyword.operator +# ^ keyword.operator +# ^ string.unquoted +declare ret ; +# ^ keyword.operator +declare ret& +# ^ keyword.operator +declare ret & +# ^ keyword.operator +printFunction "$variableString1" "$(declare -p variableArray)" +# ^ string.quoted.double punctuation.definition.string.begin +# ^ string.quoted.double meta.group.expansion.command.parens punctuation.definition.variable +# ^ string.quoted.double meta.group.expansion.command.parens punctuation.section.parens.begin +# ^ string.quoted.double meta.group.expansion.command.parens storage.modifier +# ^ string.quoted.double meta.group.expansion.command.parens variable.other +# ^ string.quoted.double meta.group.expansion.command.parens punctuation.section.parens.end +# ^ string.quoted.double punctuation.definition.string.end + +# <- - variable.other +printFunction "$variableString1" "`declare -p variableArray`" +# ^ string.quoted.double punctuation.definition.string.begin +# ^ string.quoted.double meta.group.expansion.command.backticks punctuation.section.group.begin +# ^ string.quoted.double meta.group.expansion.command.backticks storage.modifier +# ^ string.quoted.double meta.group.expansion.command.backticks variable.other +# ^ string.quoted.double meta.group.expansion.command.backticks punctuation.section.group.end +# ^ string.quoted.double punctuation.definition.string.end +foo=`readonly x=5` +# <- variable.other.readwrite.assignment +# ^ meta.group.expansion.command.backticks punctuation.section.group.begin +# ^ meta.group.expansion.command.backticks variable.other.readwrite.assignment +# ^ meta.group.expansion.command.backticks keyword.operator.assignment +# ^ meta.group.expansion.command.backticks string.unquoted +# ^ meta.group.expansion.command.backticks punctuation.section.group.end + +# <- - meta.group.expansion.command.backticks +export foo # 'foo' is a variable name +#^^^^^^^^^ meta.function-call +# <- storage.modifier +# ^^^ variable.other.readwrite.assignment +# ^ - meta.function-call +export foo bar # 'foo' and 'bar' are variable names +# <- storage.modifier +# ^^^ variable.other.readwrite.assignment +# ^ - variable +# ^^^ variable.other.readwrite.assignment +# ^ - meta.function-call +export foo='bar' # 'foo' is a variable name +# <- storage.modifier +# ^^^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ string.unquoted string.quoted.single punctuation.definition.string.begin +#^^^^^^^^^^^^^^ meta.function-call +# ^ - meta.function-call +local foo bar # 'foo' and 'bar' are variable names +# <- storage.modifier +# ^ - variable +# ^^^ variable.other.readwrite.assignment +# ^ - variable +# ^^^ variable.other.readwrite.assignment +# ^ - meta.function-call +local foo bar='baz' # 'foo' and 'bar' are variable names +# <- storage.modifier +# ^ - variable +# ^^^ variable.other.readwrite.assignment +# ^ - variable +# ^^^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ string.unquoted string.quoted.single punctuation.definition.string.begin +# ^ - string.unquoted +#^^^^^^^^^^^^^^^^^^ meta.function-call +# ^ - meta.function-call +readonly foo # 'foo' is a variable name +# <- storage.modifier +# ^ - variable +# ^^^ variable.other.readwrite.assignment +# ^ - variable.other.readwrite +#^^^^^^^^^^^ meta.function-call +# ^ - meta.function-call +typeset foo # 'foo' is a variable name +#^^^^^^^^^^ meta.function-call +# <- storage.modifier +# ^ - variable +# ^^^ variable.other.readwrite.assignment +# ^ - variable.other.readwrite +#^^^^^^^^^^ meta.function-call +# ^ - meta.function-call +unset foo bar # 'foo' and 'bar' are variable names +# <- support.function +# ^ - variable +# these are all legal identifiers for variables +alias=hello +# <- - storage.modifier +# ^ keyword.operator +typeset=hello +# <- - storage.modifier +# ^ keyword.operator +declare=hello +# <- - storage.modifier +# ^ keyword.operator +local=hello +# <- - storage.modifier +# ^ keyword.operator +export=hello +# <- - storage.modifier +# ^ keyword.operator +readonly=hello +# <- - storage.modifier +# ^ keyword.operator +for=hello +# <- - keyword.control +# ^ keyword.operator +if=hello +# <- - keyword.control +# ^ keyword.operator +while=hello +# <- - keyword.control +# ^ keyword.operator +until=hello +# <- - keyword.control +# ^ keyword.operator +do=hello +# <- - keyword.control +# ^ keyword.operator +done=hello +# <- - keyword.control +# ^ keyword.operator + +(foo=bar) +# <- punctuation.definition.compound.begin +# ^ keyword.operator.assignment +# ^^^ string.unquoted +# ^ punctuation.definition.compound.end - string-unquoted + +foo= pwd +local pid="$(cat "$PIDFILE" 2>/dev/null)" +# ^ - variable.parameter +local-pid +# ^ - storage.modifier +# ^^ - variable.parameter + +if [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; then PLATFORM=docker; fi +#^ keyword.control.conditional.if +# ^ keyword.operator.logical +# ^^ keyword.operator.logical.and +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function +# ^^ keyword.operator.logical.or.shell +# ^ keyword.operator.logical.shell +# ^^^^ meta.function-call.shell variable.function.shell +# ^ keyword.operator.logical.continue +# ^^^^ keyword.control.conditional.then +# ^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ string.unquoted +if cmd && \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if cmd && + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if cmd || \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if cmd || + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if !cmd +# ^ punctuation.definition.history.shell +# ^^^ meta.function-call.shell variable.function.shell +! cmd +# <- keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +!cmd +# <- punctuation.definition.history.shell +#^^^ meta.function-call.shell variable.function.shell +! \ +# <- keyword.operator.logical.shell +# ^ punctuation.separator.continuation.line.shell +! \ + cmd +#^^^ meta.function-call.shell variable.function.shell +!\ +# <- punctuation.definition.history.shell +#^ punctuation.separator.continuation.line.shell +!\ + cmd +#^^^ meta.function-call.shell variable.function.shell +! [[ ]] +# <- keyword.operator.logical.shell +# ^^^^^ meta.function-call.arguments.shell +![[ ]] +# <- punctuation.definition.history.shell +#^^^^^ meta.function-call.arguments.shell +!! +# <- variable.language.history.shell punctuation.definition.history.shell +#^ variable.language.history.shell +!-1 +# <- variable.language.history.shell punctuation.definition.history.shell +#^^ variable.language.history.shell +!51 +# <- variable.language.history.shell punctuation.definition.history.shell +#^^ variable.language.history.shell + +then- +#^^^^ - keyword +-then +#^^^^ - keyword +if-up +# <- - keyword +# ^ - keyword +up-if +# ^^ - keyword +then- +#^^^^ - keyword +-then +#^^^^ - keyword +then-fi +#^^^^^^ - keyword +if-then +#^^^^^^ - keyword +done-foo +# <- - keyword +foo-done +# ^ - keyword +for-bar +# <- - keyword +# ^ - keyword + +[ ] +# <- support.function.test.begin +# ^ support.function.test.end + +[[ ]] +# <- support.function.double-brace.begin + # <- support.function.double-brace.begin + # ^^ support.function.double-brace.end + +asdf foo && FOO=some-value pwd +# <- meta.function-call variable.function +# ^^ keyword.operator.logical.and +# ^^^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^^^^^^^^^^ string.unquoted +# ^^^ meta.function-call support.function.pwd + +(cd Layer1-linux && PLATFORM=${PLATFORM} ./build ) && +# <- punctuation.definition.compound.begin +# ^ punctuation.definition.compound.end +# ^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ string.unquoted +# ^ variable.function +(cd Layer2-nodejs && PLATFORM=${PLATFORM} ./build ) && +# ^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ string.unquoted +# ^ variable.function +(cd Layer3-base && PLATFORM=${PLATFORM} ./build ) && +# ^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ string.unquoted +# ^ variable.function +(cd Layer4-custom && PLATFORM=${PLATFORM} name=${NOSN} ./build ) || err $? +# ^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ string.unquoted +# ^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ string.unquoted +# ^ variable.function +alias foo=bar +# <- support.function.alias +# ^^^ entity.name.function.alias +# ^ keyword.operator.assignment +# ^^^ string.unquoted +alias -p foo=bar +# <- support.function.alias +# ^^ variable.parameter +# ^^^ entity.name.function.alias +# ^ keyword.operator.assignment +# ^^^ string.unquoted + +#################################################### +# Strings and interpolation in parameter expansion # +#################################################### + +${foo:=bar} +# ^ keyword.operator.assignment +# <- - variable.other.readwrite.assignment +# ^^^^ - string.unquoted +# ^ punctuation +# <- meta.function-call variable.function + +: ${foo:-bar} + # <- punctuation.definition.variable + # ^^ keyword + # ^ punctuation + +: ${foo:0:8} + # <- punctuation.definition.variable + #^ punctuation + # ^^^ variable + # ^ keyword + # ^ constant.numeric - variable + # ^ keyword + # ^ constant.numeric - variable + # ^ punctuation + +: ${@:0:1} +# ^^^^^^^^ meta.group.expansion.parameter +# ^ variable.language + +: ${*:0:1} +# ^^^^^^^^ meta.group.expansion.parameter +# ^ - variable.language + +: ${foo:='bar'} + # <- punctuation.definition.variable + # ^^ keyword + # ^ punctuation + # ^^^^^ string.quoted + # ^ punctuation + # ^ punctuation + +: ${foo/#bar/baz} + # ^ variable.parameter.switch + +: ${foo/%bar/baz} + # ^ variable.parameter.switch + +: ${foo//bar/baz} + # <- punctuation.definition.variable + # ^ keyword + # ^ variable.parameter.switch + # ^ keyword + # ^ punctuation + +: ${#*} + # ^ variable.language +: ${#@} + # ^ variable.language +: ${@/bar/baz} + # ^ variable.language +: ${*/bar/baz} + # ^ variable.language +: ${@#pattern} +# ^ variable.language +: ${*#pattern} +# ^ variable.language +: ${@##pattern} +# ^ variable.language +: ${*##pattern} +# ^ variable.language +: ${@%pattern} +# ^ variable.language +: ${*%%pattern} +# ^ variable.language +: ${@,pattern} +# ^ variable.language +: ${*,,pattern} +# ^ variable.language +: ${@^pattern} +# ^ variable.language +: ${*^^pattern} +# ^ variable.language +: ${foo@Q} +# ^ keyword.operator +: ${foo@E} +# ^ keyword.operator +: ${foo@P} +# ^ keyword.operator +: ${foo@A} +# ^ keyword.operator +: ${foo@a} +# ^ keyword.operator +: ${foo@t} + # ^ - keyword.operator + +: ${foo:=`bar`} + # <- punctuation.definition.variable + # ^^ keyword + # ^ punctuation + # ^ punctuation + # ^ punctuation + +: ${foo:=$( bar )} + # <- punctuation.definition.variable + # ^^ keyword + # ^ punctuation.definition.variable + # ^ punctuation + # ^ punctuation + # ^ punctuation + +: ${foo:=$(( 1 + 1 ))} + # <- punctuation.definition.variable + # ^^ keyword + # ^ punctuation.definition.variable + # ^^ punctuation + # ^ constant.numeric + # ^ keyword.operator + # ^ constant.numeric + # ^^ punctuation + # ^ punctuation + +: ${foo:=$bar} + # <- punctuation.definition.variable + # ^^ keyword + # ^ punctuation.definition.variable + # ^^^ variable.other + # ^ punctuation + +: ${foo:="$bar"} + # <- punctuation.definition.variable + # ^^ keyword + # ^ punctuation + # ^ punctuation.definition.variable + # ^^^ variable.other + # ^ punctuation + # ^ punctuation + +: ${foo//\}/foo} +# ^ punctuation.definition.variable +# ^ punctuation +# ^ keyword +# ^ variable.parameter.switch +# ^^ constant.character.escape +# ^ keyword +# ^ punctuation + +: ${foo//%/} +# ^ - keyword +: ${foo//#/} +# ^ - keyword +: ${foo//!/} +# ^ - keyword +: ${foo//:/} +# ^ - keyword +: ${foo//@/} +# ^ - keyword + +: ${foo#} +# ^ - keyword +: ${foo!} +# ^ - keyword +: ${!foo} +# ^ keyword +: ${#foo} +# ^ keyword + +: ${foo//a\/b/c/d} +# ^ keyword +# ^ variable.parameter.switch +# ^^ constant.character.escape +# ^ keyword +# ^ - keyword + +################################# +# Braces in parameter expansion # +################################# + +: ${foo//foo\}foo\/foo/foo} + # <- punctuation.definition.variable + # ^ keyword + # ^ variable.parameter.switch + # ^^ constant.character.escape + # ^^ constant.character.escape + # ^ keyword + # ^ punctuation + +: ${foo:="${bar} baz"} +# ^^^^^^^^^^^^^^^^^^^^ meta.group.expansion.parameter +# ^^^^^^ meta.group.expansion.parameter meta.group.expansion.parameter + # <- punctuation.definition.variable + # ^^ keyword + # ^ punctuation + # ^ punctuation.definition.string.end + # ^ punctuation + +# Sublime bug fix: " +# ^ comment.line.number-sign + +${!varprefix*} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ variable.language +# ^ punctuation +# ^^^^^^^^^^^^ variable.function + +${!varprefix@} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ variable.language +# ^ punctuation + +${var#Pattern} +#^^^^^^^^^^^^^meta.group.expansion.parameter +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ punctuation + +${var##Pattern} +#^^^^^^^^^^^^^^meta.group.expansion.parameter +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ punctuation + +${var###Pattern} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ - keyword.operator +# ^ punctuation + +: ${foo# #} # hello +# ^ keyword.operator.expansion +# ^ meta.group.expansion - comment-line +# ^ punctuation +# ^ comment.line punctuation + +${var%Pattern} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ punctuation + +${var%%Pattern} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ punctuation + +${var%%%Pattern} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ - keyword.operator +# ^ punctuation + +: ${foo% #} # hello +# ^ keyword.operator.expansion +# ^ meta.group.expansion - comment-line +# ^ punctuation +# ^ comment.line punctuation + +: ${foo#\ \#} # hello +# ^ keyword.operator.expansion +# ^^^^ constant.character.escape +# ^ meta.group.expansion - comment-line +# ^ punctuation +# ^ comment.line punctuation + +: ${foo%\ \#} # hello +# ^ keyword.operator.expansion +# ^^^^ constant.character.escape +# ^ meta.group.expansion - comment-line +# ^ punctuation +# ^ comment.line punctuation + +#################################################################### +# Parameter-expansion operators # +# cf. http://www.tldp.org/LDP/abs/html/parameter-substitution.html # +#################################################################### + +${foo//%/} +# <- punctuation.definition.variable +# ^ keyword +# ^ variable.parameter.switch +# ^ - keyword +# ^ keyword +# ^ punctuation + +${foo//#/} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ variable.parameter.switch +# ^ - keyword +# ^ keyword.operator +# ^ punctuation + +${foo//!/} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ variable.parameter.switch +# ^ - keyword +# ^ keyword.operator +# ^ punctuation + +${foo//:/} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ variable.parameter.switch +# ^ - keyword +# ^ keyword.operator +# ^ punctuation + +${foo//@/} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ variable.parameter.switch +# ^ - keyword +# ^ keyword.operator +# ^ punctuation + +${foo#} # "#" is not a operator here +# <- punctuation.definition.variable +# ^ - keyword.operator +# ^ punctuation + +${foo!} # "!" is not a operator here +# <- punctuation.definition.variable +# ^ - keyword.operator +# ^ punctuation + +${var:pos:len} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ keyword.operator +# ^ punctuation + +${foo//a\/b/c/d} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ variable.parameter.switch +# ^^ constant.character.escape +# ^ keyword.operator +# ^ - keyword.operator +# ^ punctuation + +${foo^} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ punctuation + +${foo,} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ punctuation + +${foo^^} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ punctuation + +${foo,,} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ punctuation + +${foo,,,Pattern} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ - keyword +# ^ punctuation + +${foo,,Pattern} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ punctuation + +${foo-bar} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ punctuation + +${foo:-bar} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ punctuation + +${foo+bar} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ punctuation + +${foo:+bar} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ punctuation + +: ${foo=bar} + # <- punctuation.definition.variable + # ^ keyword.operator + # ^ punctuation + +: ${foo:=bar} + # <- punctuation.definition.variable + # ^^ keyword.operator + # ^ punctuation + +${foo?bar} +# <- punctuation.definition.variable +# ^ keyword.operator +# ^ punctuation + +${foo:?bar} +# <- punctuation.definition.variable +# ^^ keyword.operator +# ^ punctuation + +: ${foo}@ +# ^ - variable.language + +: ${foo}# +# ^ - variable.language + +: ${foo:="${bar} baz"} +# <- meta.function-call support.function.colon +# ^ meta.function-call.arguments punctuation.definition.variable +# ^^ meta.function-call.arguments keyword.operator.assignment +# ^ meta.function-call.arguments string.quoted.double punctuation.definition.string.begin +# ^ meta.function-call.arguments string.quoted.double punctuation +# ^^^ meta.function-call.arguments string.quoted.double variable.other.readwrite +# ^ meta.function-call.arguments string.quoted.double punctuation - variable.other.readwrite +# ^^^^ meta.function-call.arguments string.quoted.double +# ^ meta.function-call.arguments string.quoted.double punctuation.definition.string.end +# ^ meta.function-call.arguments punctuation + +echo "Url: 'postgres://root:$DB_PASSWORD@$IP:$PORT/db'" +# ^ meta.function-call.arguments string.quoted.double punctuation.definition.variable +# ^^^^^^^^^^^ meta.function-call.arguments string.quoted.double variable.other.readwrite +# ^ - variable.language +status="${status#"${status%%[![:space:]]*}"}" +# ^ keyword.operator.assignment +# ^ keyword.operator.expansion +# ^^ keyword.operator.expansion +# ^ - punctuation +# ^ - punctuation +# ^^ - punctuation +status="${status#${status%%[![:space:]]*}}" +# ^ keyword.operator.assignment +# ^ keyword.operator.expansion +# ^^ keyword.operator.expansion +# ^ - punctuation +# ^ - punctuation +# ^^ - punctuation +CURPOS=${CURPOS#*[} +# ^ - keyword.control.regexp +echo "${ROW#*[}" +# ^ - keyword.control.regexp +echo * +# ^ keyword.operator.regexp.quantifier +echo {a,g*} +# ^ meta.function-call.arguments punctuation.section.expansion.brace.begin +# ^ meta.function-call.arguments punctuation.separator +# ^ meta.function-call.arguments keyword.operator.regexp.quantifier +# ^ meta.function-call.arguments punctuation.section.expansion.brace.end +echo ca{${x/z/t}" "{legs,f${o//a/o}d,f${o:0:1}t},r" "{tires,wh${o//a/e}ls}} +# ^ punctuation.section.expansion.brace.begin +# ^ punctuation.definition.variable +# ^ punctuation.section.expansion.parameter.begin +# ^ keyword.operator.substitution - variable.other.readwrite +# ^ keyword.operator.substitution +# ^ string.quoted.double +# ^ punctuation.section.expansion.brace.begin +# ^ punctuation.separator +# ^ punctuation.definition.variable +# ^ punctuation.section.expansion.parameter.begin +# ^ variable.other.readwrite +# ^ punctuation.separator +# ^ keyword.operator.substring - variable.other.readwrite +# ^ keyword.operator.substring +# ^ punctuation.section.expansion.parameter.end +# ^ punctuation.section.expansion.brace.end +# ^ punctuation.separator +# ^ string.quoted.double +echo [^:]* +# ^ meta.function-call.arguments keyword.control.regexp.set.begin +# ^ meta.function-call.arguments keyword.operator.logical.not +# ^ meta.function-call.arguments keyword.control.regexp.set.end +# ^ meta.function-call.arguments keyword.operator.regexp.quantifier +charclass=\}ower +# ^^ constant.character.escape +echo *(g[[:${charclass/\}/l}:]]*) +# ^ keyword.operator.regexp.quantifier +# ^ punctuation.section.parens.begin +# ^^ keyword.control.regexp.set.begin +# ^ punctuation.definition.variable +# ^^^^^^^^^ variable.other.readwrite +# ^ keyword.operator.substitution - variable.other.readwrite +# ^^ constant.character.escape +# ^ keyword.operator.substitution +# ^ punctuation.section.expansion.parameter.end +# ^^ keyword.control.regexp.set.end +# ^ keyword.operator.regexp.quantifier +# ^ punctuation.section.parens.end +echo ?([[:alpha:]]|[[:digit:]])* +# ^ keyword.operator.regexp.quantifier +# ^ punctuation.section.parens.begin +# ^ keyword.operator.logical.or +# ^ punctuation.section.parens.end +# ^ keyword.operator.regexp.quantifier +echo @(foo*)* +# ^ keyword.operator.regexp.quantifier +# ^ punctuation.section.parens.begin +# ^ keyword.operator.regexp.quantifier +# ^ punctuation.section.parens.end +# ^ keyword.operator.regexp.quantifier +echo +(bar|qux) +# ^ keyword.operator.regexp.quantifier +# ^ punctuation.section.parens.begin +# ^ keyword.operator.logical.or +# ^ punctuation.section.parens.end +[[ a == [abc[]* ]] +# ^ - keyword.control +# ^^ support.function +: ${foo//[abc[]/x} +# ^ - keyword.control +# ^ punctuation.section.expansion.parameter.end +if [[ ' foobar' == [\ ]foo* ]]; then + # ^ keyword.control.regexp.set.begin + # ^^ constant.character.escape + # ^ keyword.control.regexp.set.end + # ^^ support.function.double-brace.end + : +fi + +case- +#^ - keyword + +esac +#^ keyword.control.conditional.end - meta.conditional.case + +case +#^ meta.conditional.case keyword.control.conditional.case + +esac +#^ meta.conditional.case keyword.control.conditional.end + +case $_G_unquoted_arg in +*[\[\~\#\&\*\(\)\{\}\|\;\<\>\?\'\ ]*|*]*|"") +#^ keyword.control.regexp.set.begin +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape +# ^ keyword.control.regexp.set.end +# ^ - keyword.control + _G_quoted_arg=\"$_G_unquoted_arg\" + ;; +*) + _G_quoted_arg=$_G_unquoted_arg +;; +esac +case $1 in +*[\\\`\"\$]*) +#^ keyword.control.regexp.set.begin +# ^^^^^^^^ constant.character.escape +# ^ keyword.control.regexp.set.end + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; +*) + _G_unquoted_arg=$1 ;; +esac +coproc sed s/^/foo/ +# <- keyword.other.coproc +# ^^^ variable.function +coproc ls thisfiledoesntexist; read; 2>&1 +# <- keyword.other.coproc +# ^^ meta.function-call variable.function +# ^ keyword.operator +# ^^^^ support.function +# ^ keyword.operator +# ^ constant.numeric.integer.decimal.file-descriptor +# ^^ keyword.operator.assignment.redirection +# ^ constant.numeric.integer.decimal.file-descriptor +coproc awk '{print "foo" $0;fflush()}' +# <- keyword.other.coproc +# ^^^ variable.function +# ^ string.quoted.single punctuation.definition.string.begin +# ^ string.quoted.single punctuation.definition.string.end +{ coproc tee { tee logfile ;} >&3 ;} 3>&1 +# <- punctuation.definition.compound.braces.begin +# ^^^^^^ keyword.other.coproc +# ^^^ entity.name.function.coproc +# ^ punctuation.section.braces.begin +# ^^^ variable.function +# ^ punctuation.section.braces.end +# ^^ keyword.operator.assignment.redirection +# ^ constant.numeric.integer.decimal.file-descriptor +# ^ punctuation.definition.compound.braces.end +# ^ constant.numeric.integer.decimal.file-descriptor +# ^^ keyword.operator.assignment.redirection +# ^ constant.numeric.integer.decimal.file-descriptor +coproc foobar { + # ^^^^^^ entity.name.function.coproc + read + # <- meta.function.coproc meta.function-call +} + +# <- - meta.function +exec >&${tee[1]} 2>&1 +# ^^ keyword.operator.assignment.redirection +# ^ meta.group.expansion.parameter punctuation.definition.variable + +################### +# Misc. operators # +################### +(( 0123456708 )) +# ^ constant.numeric.integer.octal punctuation.definition.numeric.base +# ^^^^^^^^^ constant.numeric.integer.octal +# ^ constant.numeric.integer.octal invalid.illegal.not-an-octal-character +(( 0 )) +# ^ - punctuation +(( ~1 )) +# ^ meta.group.arithmetic keyword.operator.bitwise +(( !1 )) +# ^ meta.group.arithmetic keyword.operator.logical +(( a/b )) +# ^ meta.group.arithmetic keyword.operator.arithmetic +(( a%b )) +# ^ meta.group.arithmetic keyword.operator.arithmetic +(( a+b )) +# ^ meta.group.arithmetic keyword.operator.arithmetic +(( a-b )) +# ^ meta.group.arithmetic keyword.operator.arithmetic +(( a*b )) +# ^ meta.group.arithmetic keyword.operator.arithmetic +((a++)) +# ^^ meta.group.arithmetic keyword.operator.arithmetic +((a--)) +# ^^ meta.group.arithmetic keyword.operator.arithmetic +((++a)) +# ^^ meta.group.arithmetic keyword.operator.arithmetic +((--a)) +# ^^ meta.group.arithmetic keyword.operator.arithmetic +((a**16)) +# ^^ meta.group.arithmetic keyword.operator.arithmetic +((a<<12)) +# ^^ meta.group.arithmetic keyword.operator.logical +((a>>14)) +# ^^ meta.group.arithmetic keyword.operator.logical +((a&b)) +# ^ meta.group.arithmetic keyword.operator.bitwise +(( a <= b)) +# ^^ meta.group.arithmetic keyword.operator.logical +(( a >= b)) +# ^^ meta.group.arithmetic keyword.operator.logical +((a < b)) +# ^ meta.group.arithmetic keyword.operator.logical +((a > b)) +# ^ meta.group.arithmetic keyword.operator.logical +((a^b)) +# ^ meta.group.arithmetic keyword.operator.bitwise +((a|b)) +# ^ meta.group.arithmetic keyword.operator.bitwise +((a&&b)) +# ^^ meta.group.arithmetic keyword.operator.logical +((a||b)) +# ^^ meta.group.arithmetic keyword.operator.logical +((a ? 0 : 1)) +# ^ keyword.operator.ternary +# ^ keyword.operator.logical +(( a=b, a*=b, a/=b, a%=b, a+=b, a-=b, a<<=b, a>>=b, a&=b, a^=b, a|=b )) +# ^ keyword.operator.assignment +# ^ meta.group.arithmetic punctuation.separator +# ^^ keyword.operator.assignment +# ^ meta.group.arithmetic punctuation.separator +# ^^ keyword.operator.assignment +# ^ meta.group.arithmetic +# ^^ keyword.operator.assignment +# ^ meta.group.arithmetic +# ^^ keyword.operator.assignment +# ^ meta.group.arithmetic punctuation.separator +# ^^ keyword.operator.assignment +# ^^^ keyword.operator.assignment +# ^^^ keyword.operator.assignment +# ^^ keyword.operator.assignment +# ^^ keyword.operator.assignment +# ^^ keyword.operator.assignment +(((a>b) ? (a>c?a:c) : (b>c?b:c))) +# <- punctuation.section.arithmetic.begin +#^ punctuation.section.arithmetic.begin +# ^ punctuation.section.parens.begin +# ^ punctuation.section.parens.end +# ^ punctuation.section.parens.begin +# ^ punctuation.section.parens.end +# ^ punctuation.section.parens.begin +# ^ punctuation.section.parens.end +# ^^ punctuation.section.arithmetic.end +# ^^^^^ meta.group.parens +# ^^^ - meta.group.parens +# ^^^^^^^^^ meta.group.parens +# ^^^ - meta.group.parens +# ^^^^^^^^^ meta.group.parens +# ^^ - meta.group.parens +(( 0xDEADBEEF 0xdeadbeef 0x1234567890abcdefg )) +# ^^ constant.numeric.integer.hexadecimal punctuation.definition.numeric.base +# ^^^^^^^^ constant.numeric.integer.hexadecimal +# ^^ constant.numeric.integer.hexadecimal punctuation.definition.numeric.base +# ^^^^^^^^ constant.numeric.integer.hexadecimal +# ^^ constant.numeric.integer.hexadecimal punctuation.definition.numeric.base +# ^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal +# ^ constant.numeric.integer.hexadecimal invalid.illegal.not-a-hex-character +(( 64#123@_ )) +# ^^^^^^^^ constant.numeric.integer.other +# ^^^ punctuation.definition.numeric.base +(( 0x1f )) +# ^^^^ constant.numeric.integer.hexadecimal +# ^^ punctuation.definition.numeric.base +(( a * b )) +# ^ keyword.operator.arithmetic - keyword.operator.regexp +((a+=b)) +# ^ - string.unquoted +ls>foo.txt +# <- variable.function +# ^^ - variable.function +echo>foo.txt +# <- support.function +# ^^ - support.function + +if [[ $- != *i* ]] ; then + # ^ punctuation.definition.variable + # ^ variable.language + echo shell is not interactive +fi + +echo +(bar|qux) | wc +# ^ keyword.operator.logical.or +# ^ keyword.operator.logical.pipe + +foo='bar' +# ^ keyword.operator + +echo git rev-list "$(echo --all)" | grep -P 'c354a80' +# ^ punctuation.definition.variable +# ^ punctuation +# ^ punctuation +x="$(( foo++ ))" +# ^ punctuation.definition.variable +# ^^ punctuation +# ^^ keyword +# ^^ punctuation +foo[${j}+10]="`foo`" +# ^ variable.other.readwrite.assignment punctuation +# ^ variable.other.readwrite.assignment punctuation.definition.variable +# ^ variable.other.readwrite.assignment punctuation +# ^ variable.other.readwrite.assignment variable.other.readwrite +# ^ variable.other.readwrite.assignment punctuation +# ^ variable.other.readwrite.assignment keyword.operator.arithmetic +# ^^ variable.other.readwrite.assignment constant.numeric.integer +# ^ variable.other.readwrite.assignment punctuation.section.braces.end +# ^ keyword.operator + +# Invokes "foo -e", so "-e" is a switch. +foo \ +-e Hello +# <- punctuation +#^ variable.parameter + +# Invokes "foo-e", so "-e" is NOT a switch. +foo\ +-e Hello +# <- - punctuation +#^ - variable.parameter + +# Invokes "echo -e", so "-e" is a switch. +echo \ +-e Hello +# <- punctuation +#^ variable.parameter + +# Invokes "echo-e", so "-e" is NOT a switch. +echo\ +-e Hello +# <- - punctuation +#^ - variable.parameter + +foo+=" baz" +# ^^ keyword.operator + +export foo='bar' +# <- storage.modifier +# ^ keyword.operator + +unset -f -n -v foo +# <- support.function +# ^ punctuation +# ^ variable +# ^ punctuation +# ^ variable +# ^ punctuation +# ^ variable + +foo=`let 5+5` +# ^ punctuation.section.group.begin +# ^ constant.numeric.integer +# ^ punctuation.section.group.end +# ^^^^^^^ meta.function-call +foo=`some-command --long1` +# ^ punctuation.section.group.begin +# ^^^^^^^^^^^^ meta.function-call variable.function +# ^^ meta.function-call.arguments variable.parameter punctuation.definition.parameter +# ^^^^^ meta.function-call.arguments variable.parameter +# ^ punctuation.section.group.end +foo=`some-command -x` +# ^ punctuation.section.group.begin +# ^^^^^^^^^^^^ meta.function-call variable.function +# ^ meta.function-call.arguments variable.parameter punctuation.definition.parameter +# ^ meta.function-call.arguments variable.parameter +# ^ punctuation.section.group.end + +foo=`echo -e` +# ^ punctuation.section.group.begin +# ^^^^ meta.function-call support.function.echo +# ^ meta.function-call.arguments punctuation.definition.parameter +# ^ meta.function-call.arguments variable.parameter +# ^ punctuation.section.group.end + +foo=`cd -L` +# ^ punctuation.section.group.begin +# ^^ meta.function-call support.function.cd +# ^ meta.function-call.arguments punctuation.definition.parameter +# ^ meta.function-call.arguments variable.parameter +# ^ punctuation.section.group.end + +echo "`dirname -- foo/bar`" +# ^ punctuation.section.group.begin +# ^^ keyword.operator.end-of-options +# ^ punctuation.section.group.end + +foo=`(uname -r) 2>/dev/null` +# ^ punctuation.section.group.end - punctuation.section.group.begin +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +# ^ punctuation.section.group.end +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +# ^ punctuation.section.group.end +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +# ^ punctuation.section.group.end + +commits=($(git rev-list --reverse --abbrev-commit "$latest".. -- "$prefix")) + +# <- - variable.other.readwrite + +[[ $str =~ ^$'\t' ]] +# ^^ keyword.operator.logical +# ^^^^^^ meta.regexp + +[[ $str =~ ^abc$var$ ]] +# ^^ keyword.operator.logical +# ^^^^ meta.regexp +# ^^^ variable.other.readwrite +# ^ meta.regexp + +################ +# Control flow # +################ + +while true; do +# <- keyword.control +# ^ meta.function-call variable.function +# ^ keyword.operator +# ^ keyword.control + break + # <- keyword.control.flow.break.shell + + continue + # <- keyword.control.flow.continue.shell + +done +# <- keyword.control + +declare -a array +array[500]=value +# ^ variable.other.readwrite.assignment punctuation.section.braces.begin +# ^^^ variable.other.readwrite.assignment constant.numeric.integer +# ^ variable.other.readwrite.assignment punctuation.section.braces.end +# ^ keyword.operator.assignment +# ^^^^^ string.unquoted +echo ${array[@]} +# ^ meta.function-call.arguments variable.other.readwrite punctuation.section.braces.begin +# ^ meta.function-call.arguments variable.other.readwrite variable.language.array +# ^ meta.function-call.arguments variable.other.readwrite punctuation.section.braces.end + +array["foo"]=bar +# ^ variable.other.readwrite.assignment punctuation.section.braces.begin +# ^ variable.other.readwrite.assignment string.quoted.double punctuation.definition.string.begin +# ^^^ variable.other.readwrite.assignment string.quoted.double +# ^ variable.other.readwrite.assignment string.quoted.double punctuation.definition.string.end +# ^ variable.other.readwrite.assignment punctuation.section.braces.end +# ^ keyword.operator.assignment +array[foo]=bar +# ^ variable.other.readwrite.assignment punctuation.section.braces.begin +# ^^^ variable.other.readwrite.assignment +# ^ variable.other.readwrite.assignment punctuation.section.braces.end +# ^ keyword.operator.assignment +# ^^^ string.unquoted +array=($one "two" ${three} 'four' $5) +# <- variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ punctuation.section.parens.begin +# ^ punctuation.definition.variable +# ^^^ variable.other.readwrite +# ^ string.quoted.double punctuation.definition.string.begin +# ^^^ string.quoted.double +# ^ string.quoted.double punctuation.definition.string.end +# ^ punctuation.definition.variable +# ^ punctuation +# ^^^^^ variable.other.readwrite +# ^ punctuation +# ^ string.quoted.single punctuation.definition.string.begin +# ^^^^ string.quoted.single +# ^ string.quoted.single punctuation.definition.string.end +# ^ punctuation.definition.variable +# ^ variable.other.readwrite +# ^ punctuation.section.parens.end +array=([foo]== ["bar"]='what' [5+10]=qux) +# ^ keyword.operator.assignment +# ^ punctuation.section.parens.begin +# ^ punctuation.section.brackets.begin +# ^ punctuation.section.brackets.end +# ^ keyword.operator.assignment +# ^ - keyword.operator.assignment +# ^ punctuation.section.brackets.begin +# ^ string.quoted.double punctuation.definition.string.begin +# ^ string.quoted.double punctuation.definition.string.end +# ^ punctuation.section.brackets.end +# ^ keyword.operator.assignment +# ^ string.quoted.single punctuation.definition.string.begin +# ^ string.quoted.single punctuation.definition.string.end +# ^ punctuation.section.brackets.begin +# ^ - constant.numeric +# ^ - keyword +# ^^ - constant.numeric +# ^ punctuation.section.brackets.end +# ^ keyword.operator.assignment +# ^ punctuation.section.parens.end +array=() # an empty array +# ^ keyword.operator.assignment +# ^ punctuation.section.parens.begin +# ^ punctuation.section.parens.end +for (( i = 0; i < 10; i++ )); do +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.arithmetic +# <- keyword.control +# ^^ meta.group.for punctuation.section.arithmetic.begin +# ^ meta.group.for keyword.operator.assignment +# ^ meta.group.for constant.numeric.integer - punctuation +# ^ meta.group.for punctuation.separator +# ^ meta.group.for keyword.operator.logical +# ^^ meta.group.for constant.numeric.integer +# ^ meta.group.for punctuation.separator +# ^^ meta.group.for keyword.operator.arithmetic +# ^^ meta.group.for punctuation.section.arithmetic.end +# ^ keyword.operator.logical.continue +# ^^ keyword.control.loop.do + echo $i + # <- meta.function-call support.function.echo + # ^ meta.function-call.arguments punctuation.definition.variable + # ^ meta.function-call.arguments variable.other.readwrite +done +# <- keyword.control.loop.end + +for i in $(seq 100); do +# <- keyword.control.loop.for +# ^^ meta.group.for keyword.control.in +# ^ meta.group.for punctuation.definition.variable +# ^ meta.group.for punctuation.section.parens.begin +# ^^^ meta.group.for meta.function-call variable.function +# ^ meta.group.for punctuation.section.parens.end +# ^ keyword.operator.logical.continue +# ^^ keyword.control.loop.do + : + # <- meta.function-call support.function.colon +done +# <- keyword.control.loop.end + +[[ "${foo}" == bar*baz ]] + # <- support.function.double-brace.begin +# <- support.function.double-brace.begin +# ^^ meta.function-call.arguments keyword.operator.logical +# ^ meta.function-call.arguments keyword.operator.regexp.quantifier +# ^^ meta.function-call.arguments support.function.double-brace.end + +case "$1" in +# <- keyword.control.conditional.case +# ^ string.quoted.double punctuation.definition.string.begin +# ^ string.quoted.double punctuation.definition.variable +# ^ string.quoted.double variable.other.readwrite +# ^ string.quoted.double punctuation.definition.string.end +# ^^ keyword.control.in +setup ) +# <- - variable.function - support.function - meta.function-call +# ^ keyword.control.conditional.patterns +echo Preparing the server... +# <- meta.function-call support.function.echo +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +;; +# <- punctuation.terminator.case.clause +#^ punctuation.terminator.case.clause +deploy ) +# <- - variable.function - support.function - meta.function-call +# ^ keyword.control.conditional.patterns +echo Deploying... +# <- meta.function-call support.function.echo +# ^^^^^^^^^^^^^ meta.function-call.arguments +;; +# <- punctuation.terminator.case.clause +#^ punctuation.terminator.case.clause +* ) +# <- keyword.operator.regexp.quantifier +# ^ keyword.control.conditional.patterns +cat <<'ENDCAT' +# <- meta.function-call variable.function +# ^^ meta.function-call.arguments string.unquoted.heredoc keyword.operator.assignment.redirection +# ^ meta.function-call.arguments string.unquoted.heredoc punctuation.definition.string.begin +# ^^^^^^ meta.function-call.arguments string.unquoted.heredoc keyword.control.heredoc-token +# ^ meta.function-call.arguments string.unquoted.heredoc punctuation.definition.string.end +foo +# <- meta.function-call.arguments string.unquoted.heredoc +ENDCAT +# <- meta.function-call.arguments string.unquoted.heredoc keyword.control.heredoc-token +;; +# <- punctuation.terminator.case.clause +#^ punctuation.terminator.case.clause +esac +# <- keyword.control.conditional.end + +if [ ! -f q4m-$Q4MVER.tar.gz ]; then + #^ support.function.test.begin + # ^ support.function.test.end + #^ keyword.operator + # ^ variable.parameter punctuation + # ^ variable.parameter + # ^ - keyword.operator + # ^ keyword.operator + : + # <- meta.function-call support.function +fi +# <- keyword.control + +if (ruby extconf.rb && +# ^ punctuation.definition.compound.begin + { make clean || true; } && + # <- punctuation.definition.compound.braces.begin + # ^ punctuation.definition.compound.braces.end + make) 1> build.log 2>&1 + # ^ punctuation.definition.compound.end + # ^ - variable.function +fi + +{ +# <- punctuation.definition.compound.braces.begin + { + # <- punctuation.definition.compound.braces.begin + foo args + # <- meta.function-call variable.function + } 2>> "$stderr_log" + # <- punctuation.definition.compound.braces.end + # ^ constant.numeric.integer.decimal.file-descriptor - variable.function +} 1>> "$stdout_log" +# <- punctuation.definition.compound.braces.end +# ^ constant.numeric.integer.decimal.file-descriptor - variable.function + +if [ "$1" != "" -a "$2" != "" ]; then +# <- keyword.control.conditional.if +# ^ support.function.test.begin +# ^^ meta.function-call.arguments keyword.operator.logical +# ^ meta.function-call.arguments variable.parameter punctuation.definition.parameter +# ^ meta.function-call.arguments variable.parameter +# ^^ meta.function-call.arguments keyword.operator.logical +# ^ meta.function-call.arguments support.function.test.end +# ^ keyword.operator.logical.continue +# ^^^^ keyword.control.conditional.then + local DIR=$1 + # <- storage.modifier + # ^^^ variable.other.readwrite.assignment + # ^ keyword.operator.assignment + local TARGET=$2 + # <- storage.modifier + # ^^^^^^ variable.other.readwrite.assignment + # ^ keyword.operator.assignment +elif [ "$1" ]; then +# <- keyword.control.conditional.elseif +# ^^^^ keyword.control.conditional.then + local DIR=$PWD + # <- storage.modifier + # ^^^ variable.other.readwrite.assignment + # ^ keyword.operator.assignment + local TARGET=$1 + # <- storage.modifier + # ^^^^^^ variable.other.readwrite.assignment + # ^ keyword.operator.assignment +fi +# <- keyword.control.conditional.end + +function clk { + typeset base=/sys/class/drm/card0/device + [[ -r ${base}/hwmon/hwmon0/temp1_input && -r ${base}/power_profile ]] || return 1 + # ^^ support.function.double-brace.end + case $1 in + low|high|default) + printf '%s\n' "temp: $(<${base}/hwmon/hwmon0/temp1_input)C" "old profile: $(<${base}/power_profile)" + echo "$1" >${base}/power_profile + echo "new profile: $(<${base}/power_profile)" + ;; + *) + echo "Usage: $FUNCNAME [ low | high | default ]" + printf '%s\n' "temp: $(<${base}/hwmon/hwmon0/temp1_input)C" "current profile: $(<${base}/power_profile)" + esac + # <- meta.function keyword.control.conditional.end +} +# <- punctuation + +f() { + local -a "$@" + local x + # <- storage.modifier + + for x; do + case $x in + $1) + local "$x"'+=(1)' ;;& + # ^^^ punctuation + $2) + local "$x"'+=(2)' ;& + # ^^ punctuation + $3) + local "$x"'+=(3)' ;; + # ^^ punctuation + $1|$2) + local "$x"'+=(4)' + esac + # <- meta.function keyword.control.conditional.end + + IFS=, local -a "$x"'=("${x}: ${'"$x"'[*]}")' + # ^ variable.other.readwrite.assignment + # ^ keyword.operator.assignment + # ^ string.unquoted + # ^ storage.modifier + done + + for x; do + echo "${!x}" + done +} + +case "${foo}" in- in_ in=10 in +#^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.case.shell +# <- keyword.control.conditional.case +# ^^ - keyword.control.in +# ^^ - keyword.control.in +# ^^ - keyword.control.in +# ^^ keyword.control.in + ( help | h ) bar ;; +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^^^^^^^^ meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^ meta.conditional.case.clause.commands - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # <- keyword.control.conditional.patterns.begin + # ^ keyword.control.conditional.patterns.end + # ^^ punctuation.terminator.case.clause + do1 ) foo1 ;& +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^ meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^^ meta.conditional.case.clause.commands - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # ^ keyword.control.conditional.patterns.end + # ^^ punctuation.terminator.case.clause + (do2 ) foo2 ;;& +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^^ meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^^^ meta.conditional.case.clause.commands - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # <- keyword.control.conditional.patterns.begin + # ^ keyword.control.conditional.patterns.end + # ^^^ punctuation.terminator.case.clause + *) bar +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^ meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^ meta.conditional.case.clause.commands - meta.conditional.case.clause.patterns - meta.conditional.case.shell + #^ keyword.control.conditional.patterns.end +esac +# <- keyword.control.conditional.end + +case $TERM in + sun-cmd) + # ^ keyword.control.conditional.patterns + update_terminal_cwd() { print -Pn "\e]l%~\e\\" };; + # ^ meta.function punctuation.section.braces.end + # ^^ punctuation.terminator.case.clause + *xterm*|rxvt|(dt|k|E)term) + # ^ keyword.operator.regexp.quantifier + # ^ keyword.operator.logical + # ^ punctuation.section.parens.begin + # ^ keyword.operator.logical + # ^ keyword.operator.logical + # ^ punctuation.section.parens.end + # ^ keyword.control.conditional.patterns + update_terminal_cwd() { print -Pn "\e]2;%~\a" };; + # ^ meta.function punctuation.section.braces.end + # ^^ punctuation.terminator.case.clause + *) + # <- keyword.operator.regexp.quantifier + #^ keyword.control.conditional.patterns + update_terminal_cwd() {};; + # ^ meta.function punctuation.section.braces.end + # ^^ punctuation.terminator.case.clause +esac + +case $SERVER in +# <- keyword.control.conditional.case +ws-+([0-9]).host.com) echo "Web Server" +# ^ keyword.operator.regexp.quantifier +# ^ punctuation.section.parens.begin +# ^ keyword.control.regexp.set.begin +# ^ keyword.operator.word +# ^ keyword.control.regexp.set.end +# ^ punctuation.section.parens.end +# ^ keyword.control.conditional.patterns +;; +# <- punctuation.terminator.case.clause + # <- punctuation.terminator.case.clause +db-+([0-9])\.host\.com) echo "DB server" +# ^ keyword.operator.regexp.quantifier +# ^ punctuation.section.parens.begin +# ^ keyword.control.regexp.set.begin +# ^ keyword.operator.word +# ^ keyword.control.regexp.set.end +# ^ punctuation.section.parens.end +# ^ keyword.control.conditional.patterns +;; +# <- punctuation.terminator.case.clause + # <- punctuation.terminator.case.clause +bk-+([0-9])\.host\.com) echo "Backup server" +# ^ keyword.operator.regexp.quantifier +# ^ punctuation.section.parens.begin +# ^ keyword.control.regexp.set.begin +# ^ keyword.operator.word +# ^ keyword.control.regexp.set.end +# ^ punctuation.section.parens.end +# ^ keyword.control.conditional.patterns +;; +# <- punctuation.terminator.case.clause + # <- punctuation.terminator.case.clause +*)echo "Unknown server" +# <- keyword.operator.regexp.quantifier + # <- keyword.control.conditional.patterns +;; +# <- punctuation.terminator.case.clause + # <- punctuation.terminator.case.clause +esac +# <- keyword.control.conditional.end + +if [ "$*" = '*' ] +then remotefilter="cat" +# ^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +else remotefilter="grep" +# ^ variable.other.readwrite.assignment +# ^ string.unquoted string.quoted.double punctuation.definition.string.begin + for glob in "$@" + do glob=$( + # ^ variable.other.readwrite.assignment + # ^ keyword.operator.assignment + # ^ string.unquoted punctuation.definition.variable + # ^ string.unquoted punctuation.section.parens.begin + echo "$glob" | + sed -e 's@\*@[^ ]*@g' -e 's/\?/[^ ]/g' + # <- string.unquoted meta.function-call variable.function + ) + # <- string.unquoted punctuation.section.parens.end + remotefilter="$remotefilter -e '^$glob ' -e ' $glob\$'" + # ^ variable.other.readwrite.assignment + # ^ keyword.operator.assignment + done + # <- keyword.control.loop.end +fi +# <- keyword.control.conditional.end + +################################ +# And, or, pipes, redirections # +################################ +function show_help() { + echo "Usage: imgcat [-p] filename ..." 1>& 2 + # ^ constant.numeric.integer.decimal.file-descriptor + echo " or: cat filename | imgcat" 1>& 2 + # ^ constant.numeric.integer.decimal.file-descriptor +} +cmd1 --opt1 arg1 | cmd2 --opt2 arg2 | cmd3 --opt3 arg3 +# ^ meta.function-call variable.function +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword + # ^ meta.function-call variable.function + # ^ variable.parameter - variable.function + # ^ - variable + # ^ keyword + # ^ meta.function-call variable.function + # ^ variable.parameter - variable.function + # ^ - variable +C2=c2 C3=c3 C4=c4 +c1 -c1 c1 && ${C2} -c2 c2 || c3 -c3 ${C3} ; c4 -${C4} c4 | c5 -c5 c5 +#^ meta.function-call variable.function +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword + # ^ meta.function-call variable.function + # ^ variable.parameter - variable.function + # ^ - variable + # ^ keyword + # ^ meta.function-call variable.function + # ^ variable.parameter - variable.function + # ^ - variable.parameter + # ^ keyword + # ^^ variable.function + # ^^^^^^ variable.parameter + +foo 2>&1 +# ^ meta.function-call.arguments constant.numeric.integer.decimal.file-descriptor +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +# ^ meta.function-call.arguments constant.numeric.integer.decimal.file-descriptor +foo 2>&- +# ^ punctuation.terminator +foo | bar 2>&1 +# ^ meta.function-call.arguments constant.numeric.integer.decimal.file-descriptor +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +# ^ meta.function-call.arguments constant.numeric.integer.decimal.file-descriptor +foo | bar --opt1 arg1 < file.txt +# ^ meta.function-call.arguments keyword.operator.assignment.redirection +foo | bar --opt1 arg1 > file.txt +# ^ meta.function-call.arguments keyword.operator.assignment.redirection +foo -x arg1 &>/dev/null +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +foo -x arg1 &> /dev/null +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +tr "o" "a" < <(echo "Foo") +# ^ keyword.operator.assignment.redirection - keyword.operator.assignment.redirection.process +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ support.function +# ^ punctuation +wc <(cat /usr/share/dict/linux.words) +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ variable.function +# ^ meta.function-call.arguments meta.function-call.arguments +# ^ meta.function-call.arguments meta.function-call.arguments +# ^ punctuation +comm <(ls -l) <(ls -al) +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^^ variable.parameter +# ^ punctuation +# ^ meta.function-call.arguments +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ variable.function +# ^^^ variable.parameter +# ^ punctuation +gzip | tee >(md5sum - | sed 's/-$/mydata.lz2/'>mydata-gz.md5) > mydata.gz +# ^ keyword.operator.logical.pipe +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ keyword.operator.logical.pipe +# ^ keyword.operator.assignment.redirection +# ^ punctuation +# ^ keyword.operator.assignment.redirection +LC_ALL=C 2> /dev/null +# ^ constant.numeric.integer.decimal.file-descriptor +# ^ keyword.operator.assignment.redirection +# ^ - variable.function +2>&1 echo foo +# <- constant.numeric.integer.decimal.file-descriptor +#^^ keyword.operator.assignment.redirection +# ^ constant.numeric.integer.decimal.file-descriptor +# ^^^^ meta.function-call support.function.echo +# ^^^^ meta.function-call.arguments +touch file.txt +foo=x <file.txt +# ^ keyword.operator.assignment.redirection +# ^ - variable.function + +################## +# Here documents # +################## +var=world! +cat <<FOOSTRING ; echo more stuff here +# ^^ meta.function-call.arguments keyword.operator +# ^^^^^^^^^ meta.function-call.arguments keyword.control.heredoc-token +# ^ +# ^ keyword.operator.logical.continue +# ^ meta.function-call support.function +# ^ meta.function-call.arguments +Hello, ${"v"'a'r} +# <- meta.function-call.arguments string.unquoted.heredoc +# ^ punctuation.definition.variable +# ^ punctuation +# ^ string.quoted.double punctuation.definition.string.begin +# ^ string.quoted.double +# ^ string.quoted.double punctuation.definition.string.end +# ^ string.quoted.single punctuation.definition.string.begin +# ^ string.quoted.single +# ^ string.quoted.single punctuation.definition.string.end +# ^ punctuation +FOOSTRING +# <- meta.function-call.arguments string.unquoted.heredoc keyword.control.heredoc-token +cat << 'WHAT' ; echo more stuff here +# <- meta.function-call variable.function +# ^^ meta.function-call.arguments string.unquoted.heredoc keyword.operator.assignment.redirection +# ^ punctuation.definition.string.begin +# ^^^^ keyword.control.heredoc-token +# ^ punctuation.definition.string.end +# ^ +# ^ keyword.operator.logical.continue +# ^ meta.function-call support.function +# ^ meta.function-call.arguments +Hello, ${var} +# <- meta.function-call.arguments string.unquoted.heredoc +# ^ - variable.other.readwrite - punctuation.definition.variable +# ^ - variable.other.readwrite - punctuation.section.brackets.begin +# ^^^ - variable.other.readwrite +# ^ - variable.other.readwrite - punctuation.section.brackets.end +WHAT +# <- meta.function-call.arguments string.unquoted.heredoc keyword.control.heredoc-token + +cat <<< "A wild herestring appears" ; cat more stuff | bar | qux +# <- meta.function-call variable.function +# ^^^ meta.function-call.arguments keyword.operator.herestring +# ^ meta.function-call.arguments string.quoted.double punctuation.definition.string.begin +# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments string.quoted.double +# ^ meta.function-call.arguments string.quoted.double punctuation.definition.string.end +# ^ +# ^ keyword.operator.logical.continue +# ^ - meta.function-call +# ^^^ meta.function-call variable.function +# ^^^^^^^^^^^ meta.function-call.arguments +# ^ +# ^ keyword.operator.logical.pipe + +# Escaped and non-escaped backticks in heredocs... +cat << backticks_are_deprecated +# ^ meta.function-call.arguments string.unquoted.heredoc keyword.control.heredoc-token +foo=\`pwd\` +# ^^ meta.function-call.arguments string.unquoted.heredoc constant.character.escape.backtick +# ^^ meta.function-call.arguments string.unquoted.heredoc constant.character.escape.backtick +foo=`pwd` +# ^ meta.function-call.arguments string.unquoted.heredoc punctuation.section.group.begin +# ^ meta.function-call.arguments string.unquoted.heredoc punctuation.section.group.end +backticks_are_deprecated +# <- meta.function-call.arguments string.unquoted.heredoc keyword.control.heredoc-token + +# Redirection after heredoc token +cat << redirection_comes_next > foo.txt +# <- meta.function-call variable.function +# ^ meta.function-call.arguments string.unquoted.heredoc keyword.control.heredoc-token +# ^ meta.function-call.arguments - variable.function keyword.operator.assignment.redirection +# ^ meta.function-call.arguments - variable.function +hello +# <- meta.function-call.arguments string.unquoted.heredoc +redirection_comes_next +# <- meta.function-call.arguments string.unquoted.heredoc keyword.control.heredoc-token + +cat << FARAWAY +# ^ keyword.control +foo +# <- string.unquoted +FARAWAY +# <- keyword.control + +cat <<- INDENTED + # ^ keyword.control.heredoc-token + say what now ${foo} + # ^ variable.other.readwrite + INDENTED + # <- keyword.control.heredoc-token + +cat <<- 'indented_without_expansions' + # ^ string.unquoted.heredoc punctuation.definition.string.begin + # ^ string.unquoted.heredoc keyword.control.heredoc-token + # ^ string.unquoted.heredoc punctuation.definition.string.end + ${foo} + # <- - variable.other + indented_without_expansions + # <- keyword.control.heredoc-token + +variable=$(cat <<SETVAR +This variable +runs over multiple lines. +SETVAR +# <- keyword.control.heredoc-token +) +# <- punctuation.section.parens.end + +cat <<- "FOO" + # ^ punctuation + # ^ keyword.control.heredoc-token + # ^ punctuation + no \"escape\'\$ and $expansion + # ^^ - constant + # ^^^^ - constant + # ^ - keyword + FOO + # <- keyword.control.heredoc-token + +cat <<- \FOO + # ^ punctuation + # ^ keyword.control.heredoc-token + no \"escape\'\$ and $expansion + # ^^ - constant + # ^^^^ - constant + # ^ - keyword + FOO + # <- keyword.control.heredoc-token + +cat << "FOO" + # ^ punctuation + # ^ keyword.control.heredoc-token + # ^ punctuation + no \"escape\'\$ and $expansion + # ^^ - constant + # ^^^^ - constant + # ^ - keyword +FOO +# <- keyword.control.heredoc-token + +cat << \FOO + # ^ punctuation + # ^ keyword.control.heredoc-token + no \"escape\'\$ and $expansion + # ^^ - constant + # ^^^^ - constant + # ^ - keyword +FOO +# <- keyword.control.heredoc-token + +sed 's/^ //' << EOF >$dummy.c +# <- meta.function-call variable.function +# ^^ keyword.operator.assignment.redirection +# ^^^ keyword.control.heredoc-token +# ^ keyword.operator.assignment.redirection +# ^ punctuation.definition.variable +# ^^^^^ variable.other.readwrite +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF +# <- keyword.control.heredoc-token + +############# +# Functions # +############# + + logC () { [[ $# == 2 ]] && tput setaf $2 || tput setaf 3; echo -e "$1"; tput setaf 15; } +# <- meta.function - entity.name.function +#^^ meta.function - entity.name.function +# ^^^^ meta.function entity.name.function +# ^ meta.function punctuation.section.parens.begin +# ^ meta.function punctuation.section.parens.end +# ^ meta.function +# ^ meta.function punctuation.section.braces.begin +# ^^ meta.function support.function.double-brace.begin +# ^ meta.function meta.function-call.arguments punctuation.definition.variable +# ^ meta.function meta.function-call.arguments variable.language +# ^^ meta.function meta.function-call.arguments keyword.operator.logical +# ^^ meta.function meta.function-call.arguments support.function.double-brace.end +# ^^ meta.function keyword.operator.logical.and +logExit () { +#^^^^^^ meta.function entity.name.function +# ^ meta.function punctuation.section.parens.begin +# ^ meta.function punctuation.section.parens.end +# ^ meta.function +# ^ meta.function punctuation.section.braces.begin + [[ $1 == '0' ]] && tput setaf 2 || tput setaf 1; + # <- meta.function support.function.double-brace.begin + # ^^ meta.function meta.function-call.arguments support.function.double-brace.end + [[ $1 == '0' ]] && echo -e "$2 PASSED" || echo -e "$2 FAILED"; + # <- meta.function support.function.double-brace.begin + # ^^ meta.function meta.function-call.arguments support.function.double-brace.end + # ^^ meta.function keyword.operator.logical.and + # ^^^^ meta.function meta.function-call support.function.echo + tput setaf 15; + # <- meta.function meta.function-call variable.function + # ^ meta.function keyword.operator.logical.continue + [[ $1 == '0' ]] || exit -1 + # <- meta.function support.function.double-brace.begin + # ^^ meta.function meta.function-call.arguments support.function.double-brace.end + # ^^ meta.function keyword.operator.logical.or + # ^^^^ meta.function meta.function-call support.function.exit +} + +function connect_to_db() { +# <- meta.function storage.type.function +# ^ meta.function +# ^^^^^^^^^^^^^ meta.function entity.name.function +# ^ meta.function punctuation.section.parens.begin +# ^ meta.function punctuation.section.parens.end +# ^ meta.function +# ^ meta.function punctuation.section.braces.begin + export PGPASSWORD=$(cat "$DOKKU_ROOT/.postgresql/pwd_$APP") + # <- meta.function storage.modifier + # ^^^^^^^^^^ meta.function variable.other.readwrite.assignment + # ^ meta.function keyword.operator.assignment + #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call + IP=$(get_postgresql_ip) + # <- meta.function variable.other.readwrite.assignment + # ^ meta.function keyword.operator.assignment + # ^ meta.function string.unquoted punctuation.definition.variable + # ^ meta.function string.unquoted punctuation.section.parens.begin + # ^^^^^^^^^^^^^^^^^ meta.function string.unquoted meta.function-call variable.function + # ^ meta.function string.unquoted punctuation.section.parens.end + PORT=$(get_postgresql_port) + # <- meta.function variable.other.readwrite.assignment + # ^ meta.function keyword.operator.assignment + # ^ meta.function string.unquoted punctuation.definition.variable + # ^ meta.function string.unquoted punctuation.section.parens.begin + # ^^^^^^^^^^^^^^^^^^^ meta.function string.unquoted meta.function-call variable.function + # ^ meta.function string.unquoted punctuation.section.parens.end + + psql -h $IP -p $PORT -U root db +} +# <- meta.function punctuation.section.braces.end + +# <- - meta.function + +logExit $? $WEIRD +# <- meta.function-call variable.function +# ^ meta.function-call.arguments punctuation.definition.variable +# ^ meta.function-call.arguments variable.language +# ^ meta.function-call.arguments punctuation.definition.variable +# ^^^^^ meta.function-call.arguments variable.other.readwrite + +declare -f _init_completion > /dev/null && complete -F _upto upto +# <- storage.modifier +# ^ variable.parameter punctuation +# ^ variable.parameter +# ^ keyword.operator.assignment.redirection +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call +typeset -f _init_completion > /dev/null && complete -F _upto upto +# <- storage.modifier +# ^ variable.parameter punctuation +# ^ variable.parameter +# ^ keyword.operator.assignment.redirection +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call + +function foo +# <- meta.function +#^^^^^^^^^^^ meta.function +# ^ - entity.name.function +# ^^^ entity.name.function +# ^ - entity.name.function +{ +# <- punctuation.section + foo bar + # <- variable.function + # <- meta.function meta.function-call + + return 0 + # <- keyword.control.flow.return.shell +} +# <- punctuation.section + +# <- - meta.function + +function foo ( ) { +# <- meta.function +#^^^^^^^^^^^ meta.function +# ^ - entity.name.function +# ^^^ entity.name.function +# ^ - entity.name.function +# ^ punctuation.section +# ^ punctuation.section +# ^ punctuation.section + echo 'hello from foo' + # <- support.function + # <- meta.function meta.function-call +} +# <- punctuation.section + +# <- - meta.function + +f () ( +# <- meta.function entity.name.function + # ^ meta.function punctuation.definition.compound.begin + echo hello + # <- meta.function meta.function-call support.function.echo +) +# <- meta.function punctuation.definition.compound.end + +function f ( + # ^ meta.function storage.type.function + # ^ meta.function entity.name.function + # ^ meta.function punctuation.definition.compound.begin + echo hello + # <- meta.function meta.function-call support.function.echo +) +# <- meta.function punctuation.definition.compound.end + +function foo { + # <- meta.function + function bar { + # <- meta.function meta.function + echo "baz" + } + bar + # <- meta.function meta.function-call + + bar () { + # <- meta.function meta.function + echo "baz" + } + bar + # <- meta.function meta.function-call + function function + # <- meta.function meta.function + # ^ - entity.name.function + # ^^^^^^^^ entity.name.function + # ^ - entity.name.function + { + echo "Hello! From 'function'!" + } + "function" + # <- meta.function meta.function-call +} + +# <- - meta.function + +foo=$( + # ^ punctuation.section + func() { + # <- meta.function entity.name.function + # ^ punctuation.section + echo bar + } + # <- punctuation.section + func + + # <- meta.group.expansion.command +) +# <- punctuation.section +echo $foo # prints "bar" + +# <- - meta.function - meta.group.expansion + +foo:foo () { + # <- meta.function entity.name.function + echo "this foo:foo" +} +~ () { +# <- meta.function entity.name.function + echo "this is ~" +} +"~" +# <- meta.function-call variable.function +#^^ meta.function-call variable.function +^ () { +# <- meta.function entity.name.function + echo "this is ^" +} +^ +# <- meta.function-call variable.function +@ () { +# <- meta.function entity.name.function + echo "this is @" +} +@ +# <- meta.function-call variable.function +function [] () { + echo "Hello from []" +} +[] +# <- meta.function-call variable.function +#^ meta.function-call variable.function +function [[]] () { + echo "Hello from [[]]" +} +[[]] +# <- meta.function-call variable.function +#^^^ meta.function-call variable.function + +__git_aliased_command () +{ + local word cmdline=$(__git config --get "alias.$1") + for word in $cmdline; do + case "$word" in + {) : skip start of shell helper function ;; +# ^ - punctuation.section.expansion.brace.begin +# ^ keyword.control.conditional.patterns + \'*) : skip opening quote after sh -c ;; + *) + echo "$word" + return + esac + done +} +# <- meta.function punctuation.section.braces.end + +# <- - meta.function diff --git a/assets/syntaxes/Packages/ShellScript/test/syntax_test_shell_unix_generic.sh b/assets/syntaxes/Packages/ShellScript/test/syntax_test_shell_unix_generic.sh new file mode 100644 index 000000000..3c44806a7 --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/test/syntax_test_shell_unix_generic.sh @@ -0,0 +1,10 @@ +# SYNTAX TEST "Packages/ShellScript/Shell-Unix-Generic.sublime-syntax" + +[[ ]] +# <- support.function.double-brace.begin + # <- support.function.double-brace.begin + # ^^ support.function.double-brace.end + + # make sure the prototype is included + # <- comment.line.number-sign punctuation.definition.comment.begin + #^^^^^^^^ comment.line.number-sign diff --git a/assets/syntaxes/Packages/ShellScript/tools/update-commands.py b/assets/syntaxes/Packages/ShellScript/tools/update-commands.py new file mode 100644 index 000000000..7e98c2abb --- /dev/null +++ b/assets/syntaxes/Packages/ShellScript/tools/update-commands.py @@ -0,0 +1,150 @@ +from __future__ import print_function +import yaml +import sys +import os + + +def main(): + parent = "scope:source.shell.{}#".format( + os.path.splitext(sys.argv[1])[0].split("-")[-1]) + with open(sys.argv[1], "r") as stream: + commands_input = yaml.load(stream) + main = [] + main_bt = [] + contexts = {"main": main, "main-bt": main_bt} + eoo = { + "match": r"(?:\s+|^)--(?=\s|$)", + "scope": r"keyword.operator.end-of-options.shell", + "set": [ + {"meta_content_scope": r"meta.function-call.arguments.shell"}, + {"include": parent + r"expansion-and-string"}, + {"include": parent + r"line-continuation-or-pop-at-end"} + ] + } + opt_end_boundary = r"(?=\s|;|$|`|\))" + for command, value in commands_input.items(): + if not value: + value = {} + match = value.get("match", None) + short_options = value.get("short-options", None) + long_options = value.get("long-options", None) + short_option_prefixes = value.get("short-option-prefixes", None) + short_options_compact = value.get("short-options-compact", None) + allow_eoo = value.get("allow-end-of-options-token", True) + scope = value.get("scope", None) + if not scope: + scope = "support.function.{}.shell".format(command) + scope = "meta.function-call.shell " + scope + cmd_args_base = [] + cmd_args = [] + cmd_args_bt = [] + if match: + match = "{{boundary_begin}}%s{{boundary_end}}" % match + else: + match = "{{boundary_begin}}%s{{boundary_end}}" % command + if allow_eoo: + cmd_args_base.append(eoo) + if long_options: + thedict = { + "match": r"(?:\s+|^)((--)" + "|".join(long_options) + + r")" + + opt_end_boundary, + "captures": { + 2: "punctuation.definition.parameter.shell", + 1: "variable.parameter.option.shell" + } + } + cmd_args_base.append(thedict) + thedict = {} + thelist = [] + opts = "" + if short_options: + opts += "[" + short_options + "]" + if short_options_compact: + if opts: + opts += "|" + opts += "[" + short_options_compact + "]+" + if opts: + if short_option_prefixes: + prefix = "|".join(short_option_prefixes) + thedict = { + "match": r"(?:\s+|^)((" + prefix + + r")(?:" + + opts + + r"))" + + opt_end_boundary, + "captures": { + 2: "punctuation.definition.parameter.shell", + 1: "variable.parameter.option.shell" + } + } + else: + thedict = { + "match": r"(?:\s+|^)((-)" + opts + r")" + opt_end_boundary, + "captures": { + 2: "punctuation.definition.parameter.shell", + 1: "variable.parameter.option.shell" + } + } + if thedict: + cmd_args_base.append(thedict) + if thelist: + cmd_args_base.extend(thelist) + cmd_args.append({"meta_scope": "meta.function-call.arguments.shell"}) + cmd_args.append({"include": parent + r"cmd-args-boilerplate"}) + cmd_args_bt.append({ + "meta_scope": "meta.function-call.arguments.shell"}) + cmd_args_bt.append({"include": parent + r"cmd-args-boilerplate-bt"}) + if len(cmd_args_base) > 0: + cmd_args.append({"include": "cmd-args-{}-base".format(command)}) + cmd_args_bt.append({"include": "cmd-args-{}-base".format(command)}) + contexts["cmd-args-{}-base".format(command)] = cmd_args_base + cmd_args = [{"match": "", "set": cmd_args}] + cmd_args_bt = [{"match": "", "set": cmd_args_bt}] + contexts["cmd-args-{}".format(command)] = cmd_args + contexts["cmd-args-{}-bt".format(command)] = cmd_args_bt + main.append({ + "match": match, + "scope": scope, + "set": [ + "{}cmd-post".format(parent), + "cmd-args-{}".format(command)] + }) + main_bt.append({ + "match": match, + "scope": scope, + "set": [ + "{}cmd-post".format(parent), + "cmd-args-{}-bt".format(command)] + }) + contexts["prototype"] = [{ + "include": parent + r"prototype" + }] + + commands_output = { + "scope": os.path.splitext(sys.argv[1])[0].replace("-", "."), + "hidden": True, + "variables": { + "boundary_end": r"(?=\s|;|$|>|<|\|)", + "boundary_begin": '' + }, + "contexts": contexts + } + + with open(sys.argv[2], "w") as stream: + print("%YAML 1.2\n---", file=stream) + print("# Automatically generated file -- do not edit!", file=stream) + noalias_dumper = yaml.dumper.SafeDumper + noalias_dumper.ignore_aliases = lambda self, data: True + yaml.dump(commands_output, + stream, + default_flow_style=False, + allow_unicode=True, + default_style='', + Dumper=noalias_dumper) + + return 0 + + +if __name__ == '__main__': + exit(main()) diff --git a/assets/syntaxes/Packages/TCL/Comments.tmPreferences b/assets/syntaxes/Packages/TCL/Comments.tmPreferences new file mode 100644 index 000000000..0102454ef --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Comments.tmPreferences @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>source.tcl</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string># </string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/TCL/HTML (Tcl).sublime-syntax b/assets/syntaxes/Packages/TCL/HTML (Tcl).sublime-syntax new file mode 100644 index 000000000..0e769429d --- /dev/null +++ b/assets/syntaxes/Packages/TCL/HTML (Tcl).sublime-syntax @@ -0,0 +1,20 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: HTML (Tcl) +file_extensions: + - adp +scope: text.html.tcl +contexts: + main: + - match: <% + scope: punctuation.section.embedded.begin.tcl + push: + - meta_scope: source.tcl.embedded.html + - match: "%>" + scope: punctuation.section.embedded.end.tcl + pop: true + - match: \b(env|ns_adp_argc|ns_adp_argv|ns_adp_bind_args|ns_adp_break|ns_adp_debug|ns_adp_dir|ns_adp_dump|ns_adp_eval|ns_adp_exception|ns_adp_include|ns_adp_parse|ns_adp_puts|ns_adp_registertag|ns_adp_return|ns_adp_stream|ns_adp_tell|ns_adp_trunc|ns_atclose|ns_atexit|ns_atshutdown|ns_atsignal|ns_cache_flush|ns_cache_names|ns_cache_size|ns_cache_stats|ns_checkurl|ns_chmod|ns_cond|ns_config|ns_configsection|ns_configsections|ns_conn|ns_conncptofp|ns_connsendfp|ns_cp|ns_cpfp|ns_critsec|ns_crypt|ns_db|ns_dbconfigpath|ns_dberror|ns_dbformvalue|ns_dbformvalueput|ns_dbquotename|ns_dbquotevalue|ns_deleterow|ns_eval|ns_event|ns_ext|ns_findrowbyid|ns_fmttime|ns_ftruncate|ns_getcsv|ns_getform|ns_get_multipart_formdata|ns_geturl|ns_gifsize|ns_gmtime|ns_guesstype|ns_hostbyaddr|ns_hrefs|ns_httpget|ns_httpopen|ns_httptime|ns_info|ns_insertrow|ns_jpegsize|ns_kill|ns_library|ns_link|ns_localsqltimestamp|ns_localtime|ns_log|ns_logroll|ns_markfordelete|ns_mkdir|ns_mktemp|ns_modulepath|ns_mutex|ns_normalizepath|ns_param|ns_parseheader|ns_parsehttptime|ns_parsequery|ns_passwordcheck|ns_perm|ns_permpasswd|ns_pooldescription|ns_puts|ns_queryexists|ns_queryget|ns_querygetall|ns_quotehtml|ns_rand|ns_register_adptag|ns_register_filter|ns_register_proc|ns_register_trace|ns_rename|ns_requestauthorize|ns_respond|ns_return|ns_returnredirect|ns_rmdir|ns_rollfile|ns_rwlock|ns_schedule_daily|ns_schedule_proc|ns_schedule_weekly|ns_section|ns_sema|ns_sendmail|ns_server|ns_set|ns_setexpires|ns_set_precision|ns_share|ns_shutdown|ns_sleep|ns_sockaccept|ns_sockblocking|ns_sockcallback|ns_sockcheck|ns_socketpair|ns_socklistencallback|ns_socknonblocking|ns_socknread|ns_sockopen|ns_sockselect|ns_striphtml|ns_symlink|ns_thread|ns_time|ns_tmpnam|ns_truncate|ns_unlink|ns_unschedule_proc|ns_url2file|ns_urldecode|ns_urlencode|ns_uudecode|ns_uuencode|ns_write|ns_writecontent|ns_writefp|nsv_incr)\b + scope: keyword.other.aolserver.tcl + - include: scope:source.tcl + - include: scope:text.html.basic diff --git a/assets/syntaxes/Packages/TCL/Snippets/for...-(for).sublime-snippet b/assets/syntaxes/Packages/TCL/Snippets/for...-(for).sublime-snippet new file mode 100644 index 000000000..45279fb33 --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Snippets/for...-(for).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[for {${1:set i 0}} {${2:\$i < \$n}} {${3:incr i}} { + ${4} +} +]]></content> + <tabTrigger>for</tabTrigger> + <scope>source.tcl</scope> + <description>for...</description> +</snippet> diff --git a/assets/syntaxes/Packages/TCL/Snippets/foreach...-(foreach).sublime-snippet b/assets/syntaxes/Packages/TCL/Snippets/foreach...-(foreach).sublime-snippet new file mode 100644 index 000000000..9134529ae --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Snippets/foreach...-(foreach).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[foreach ${1:var} ${2:\$list} { + ${3} +} +]]></content> + <tabTrigger>foreach</tabTrigger> + <scope>source.tcl</scope> + <description>foreach...</description> +</snippet> diff --git a/assets/syntaxes/Packages/TCL/Snippets/if...-(if).sublime-snippet b/assets/syntaxes/Packages/TCL/Snippets/if...-(if).sublime-snippet new file mode 100644 index 000000000..d1c89f9c0 --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Snippets/if...-(if).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[if {${1:condition}} { + ${2} +} +]]></content> + <tabTrigger>if</tabTrigger> + <scope>source.tcl</scope> + <description>if...</description> +</snippet> diff --git a/assets/syntaxes/Packages/TCL/Snippets/proc...-(proc).sublime-snippet b/assets/syntaxes/Packages/TCL/Snippets/proc...-(proc).sublime-snippet new file mode 100644 index 000000000..9d46f7afc --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Snippets/proc...-(proc).sublime-snippet @@ -0,0 +1,10 @@ +<snippet> + <content><![CDATA[proc ${1:name} {${2:args}} \\ +{ + ${3} +} +]]></content> + <tabTrigger>proc</tabTrigger> + <scope>source.tcl</scope> + <description>proc...</description> +</snippet> diff --git a/assets/syntaxes/Packages/TCL/Snippets/switch...-(switch).sublime-snippet b/assets/syntaxes/Packages/TCL/Snippets/switch...-(switch).sublime-snippet new file mode 100644 index 000000000..34078bf13 --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Snippets/switch...-(switch).sublime-snippet @@ -0,0 +1,12 @@ +<snippet> + <content><![CDATA[switch ${1:-exact} -- ${2:\$var} { + ${3:match} { + ${4} + } + default {${5}} +} +]]></content> + <tabTrigger>switch</tabTrigger> + <scope>source.tcl</scope> + <description>switch...</description> +</snippet> diff --git a/assets/syntaxes/Packages/TCL/Snippets/while...-(while).sublime-snippet b/assets/syntaxes/Packages/TCL/Snippets/while...-(while).sublime-snippet new file mode 100644 index 000000000..2e40404ec --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Snippets/while...-(while).sublime-snippet @@ -0,0 +1,9 @@ +<snippet> + <content><![CDATA[while {${1:condition}} { + ${2} +} +]]></content> + <tabTrigger>while</tabTrigger> + <scope>source.tcl</scope> + <description>while...</description> +</snippet> diff --git a/assets/syntaxes/Packages/TCL/Symbol List Indent NS Proc.tmPreferences b/assets/syntaxes/Packages/TCL/Symbol List Indent NS Proc.tmPreferences new file mode 100644 index 000000000..adcc4befd --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Symbol List Indent NS Proc.tmPreferences @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List Indent NS Proc</string> + <key>scope</key> + <string>meta.namespace.tcl entity.name.function.tcl, meta.function.tcl entity.name.namespace.tcl, meta.function.tcl meta.function.tcl entity.name.function, meta.namespace.tcl meta.namespace.tcl entity.name.namespace</string> + <key>settings</key> + <dict> + <key>symbolTransformation</key> + <string>s/^/ /;</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/TCL/Symbol List.tmPreferences b/assets/syntaxes/Packages/TCL/Symbol List.tmPreferences new file mode 100644 index 000000000..fd4aaadd5 --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Symbol List.tmPreferences @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Symbol List</string> + <key>scope</key> + <string>entity.name.namespace.tcl</string> + <key>settings</key> + <dict> + <key>showInSymbolList</key> + <integer>1</integer> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/TCL/Tcl.sublime-syntax b/assets/syntaxes/Packages/TCL/Tcl.sublime-syntax new file mode 100644 index 000000000..4421b7aac --- /dev/null +++ b/assets/syntaxes/Packages/TCL/Tcl.sublime-syntax @@ -0,0 +1,445 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Tcl +file_extensions: + - tcl +scope: source.tcl +variables: + special_chars: '[;{}\[\]"\\]' + unquoted_string: '[^\s{{special_chars}}][^\s${{special_chars}}]*' + end_chars: '[;\n\}\]]' + inline_end_chars: '[;\s\}\]\\]' + var_unquoted_string: '(?:\$\{[^ \}]+\}|{{unquoted_string}})+' + most_likely_code: 'while|for|catch|return|break|continue|switch|exit|foreach|if|after|append|array|auto_execok|auto_import|auto_load|auto_mkindex|auto_mkindex_old|auto_qualify|auto_reset|bgerror|binary|cd|clock|close|concat|dde|encoding|eof|error|eval|exec|expr|fblocked|fconfigure|fcopy|file|fileevent|filename|flush|format|gets|glob|global|history|http|incr|info|interp|join|lappend|library|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|memory|msgcat|namespace|open|package|parray|pid|pkg::create|pkg_mkIndex|proc|puts|pwd|re_syntax|read|registry|rename|resource|scan|seek|set|socket|SafeBase|source|split|string|subst|Tcl|tcl_endOfWord|tcl_findLibrary|tcl_startOfNextWord|tcl_startOfPreviousWord|tcl_wordBreakAfter|tcl_wordBreakBefore|tcltest|tclvars|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait' + +contexts: + main: + - include: commands + + commands: + - match: ^(?=\s*[^\[\{]) + push: command-name + - match: ';' + scope: punctuation.terminator.tcl + push: command-name + - match: '(?={{most_likely_code}})' + push: command-name + - include: expressions + + continued-line: + - match: (?={{end_chars}}) + pop: true + - match: '^(?=\s*#)' + push: + - match: '#' + scope: comment.line.number-sign.tcl punctuation.definition.comment.tcl + set: + - meta_content_scope: comment.line.number-sign.tcl + - match: \n + pop: true + - match: \\\\ + - match: \\\n + scope: punctuation.separator.continuation.tcl + - include: expressions + + expressions: + - match: \\(?=\n) + scope: punctuation.separator.continuation.tcl + push: + - match: \n + - match: (?=\S) + set: continued-line + - include: braces + - include: substitution + - include: escape + - include: variable + - match: '-' + scope: keyword.operator.tcl + - include: numbers + - include: strings + + strings: + - match: '"' + scope: punctuation.definition.string.begin.tcl + push: + - meta_scope: string.quoted.double.tcl + - match: '"' + scope: punctuation.definition.string.end.tcl + pop: true + - match: \\(?=\n) + scope: punctuation.separator.continuation.tcl + push: + - match: \n + - match: (?=\S) + pop: true + - include: escape + - include: variable + - match: '(?=\[(?!{{special_chars}}))' + push: + - clear_scopes: 1 + - include: substitution + - match: '' + pop: true + - match: '{{unquoted_string}}' + + numbers: + - match: \b0x\h*\b(?={{inline_end_chars}}) + scope: constant.numeric.integer.tcl + - match: \b0b[01]*\b(?={{inline_end_chars}}) + scope: constant.numeric.integer.tcl + - match: \b0o[0-7]*\b(?={{inline_end_chars}}) + scope: constant.numeric.integer.tcl + - match: \b[0-9]+\.[0-9]+\b(?={{inline_end_chars}}) + scope: constant.numeric.float.tcl + - match: \b[0-9]+\b(?={{inline_end_chars}}) + scope: constant.numeric.integer.tcl + + comments: + - match: '#' + scope: comment.line.number-sign.tcl punctuation.definition.comment.tcl + set: + - meta_content_scope: comment.line.number-sign.tcl + - match: \n + scope: comment.line.number-sign.tcl + pop: true + - match: \\\\ + - match: \\\n + scope: punctuation.separator.continuation.tcl + + command-name: + - match: '(?=\bproc\b\s)' + set: proc + - match: '\bexpr\b(?=\s)' + scope: keyword.other.tcl + set: expr + - match: \b(namespace)\s+eval\s+({{var_unquoted_string}}) + captures: + 1: keyword.other.tcl + 2: entity.name.namespace.tcl + set: + - meta_scope: meta.namespace.tcl + - match: '(?={{end_chars}})' + pop: true + - include: commands + - match: \b(if)\b\s+(\{) + captures: + 1: keyword.control.tcl + 2: meta.block.tcl punctuation.section.block.begin.tcl + set: [conditional, conditional-expr] + - match: \b(if)\b\s+(?=\S) + captures: + 1: keyword.control.tcl + 2: meta.block.tcl punctuation.section.block.begin.tcl + set: [conditional, conditional-bare-expr] + - match: \bset\b + scope: keyword.other.tcl + push: + - match: \b\w+\b + set: + - match: '\{(?=(\n|\s*({{most_likely_code}})))' + scope: punctuation.section.block.begin.tcl + set: [command-braces, command-name] + - match: '\{(?=\s)' + scope: punctuation.section.block.begin.tcl + set: non-command-braces + - match: '\{' + scope: punctuation.definition.string.begin.tcl + set: string-braces + - match: '(?=\S)' + set: + - match: (?={{inline_end_chars}}) + pop: true + - include: expressions + - match: (?=\S) + pop: true + - match: \b(while|for|catch|return|break|continue|switch|exit|foreach)\b(?=[{{inline_end_chars}}]) + scope: keyword.control.tcl + set: + - match: '(?={{end_chars}})' + pop: true + - include: expr-body + - match: '\b(after|append|array|auto_execok|auto_import|auto_load|auto_mkindex|auto_mkindex_old|auto_qualify|auto_reset|bgerror|binary|cd|clock|close|concat|dde|encoding|eof|error|eval|exec|expr|fblocked|fconfigure|fcopy|file|fileevent|filename|flush|format|gets|glob|global|history|http|incr|info|interp|join|lappend|library|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|memory|msgcat|namespace|open|package|parray|pid|pkg::create|pkg_mkIndex|proc|puts|pwd|re_syntax|read|registry|rename|resource|scan|seek|set|socket|SafeBase|source|split|string|subst|Tcl|tcl_endOfWord|tcl_findLibrary|tcl_startOfNextWord|tcl_startOfPreviousWord|tcl_wordBreakAfter|tcl_wordBreakBefore|tcltest|tclvars|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait)\b' + scope: keyword.other.tcl + pop: true + - match: '\b(regexp|regsub)\b(?=\s)' + captures: + 1: keyword.other.tcl + set: + - match: '(?={{end_chars}})' + pop: true + # Consume the switches (https://www.tcl.tk/man/tcl8.4/TclCmd/regexp.htm) + - match: '\s+-(about|all|expanded|indices|inline|linestop|lineanchor|line|nocase|start\s+\b[0-9]+)\b(?=\s)' + # The next non-space element will be a regex string + - match: '(?=\{|\s+--\s+)' + set: + - match: \{ + set: + - meta_content_scope: string.regexp.tcl + - match: \} + pop: true + - include: regexp-braces + - match: '(?=")' + set: + - include: strings + # One of these characters indicates the string is complete + - match: '(?={{inline_end_chars}})' + pop: true + - match: '(?=")' + set: + - include: strings + # One of these characters indicates the string is complete + - match: '(?={{inline_end_chars}})' + pop: true + - match: '(?=\S)' + set: + - meta_content_scope: string.regexp.tcl + # One of these characters indicates the string is complete + - match: '(?={{inline_end_chars}})' + pop: true + - match: (?=#) + set: comments + - match: '(?={{var_unquoted_string}})' + set: + - meta_content_scope: variable.function.tcl + - include: variable + - match: '{{unquoted_string}}' + - match: '' + pop: true + - match: '(?=\S)' + pop: true + + regexp-braces: + - match: \{ + push: + - match: \} + pop: true + - include: regexp-braces + - include: escape + + conditional: + - match: '(?={{end_chars}})' + pop: true + - match: '\b(elseif)\b\s+(\{)' + captures: + 1: keyword.control.tcl + 2: meta.block.tcl punctuation.section.block.begin.tcl + push: conditional-expr + - match: '\b(then|elseif|else)\b(?=\s)' + scope: keyword.control.tcl + - include: commands + + conditional-expr: + - meta_content_scope: meta.block.tcl + - match: '(\})([^{{inline_end_chars}}]*)' + captures: + 1: meta.block.tcl punctuation.section.block.end.tcl + 2: invalid.illegal.tcl + pop: true + - match: '\\[\\{}n]' + scope: constant.character.escape.tcl + - include: operators + - include: commands + + conditional-bare-expr: + - meta_content_scope: meta.block.tcl + - match: '(?=[\{{{inline_end_chars}}{{end_chars}}])' + pop: true + - match: '\\[\\{}n]' + scope: constant.character.escape.tcl + - include: operators + - include: commands + + proc: + - match: \b(proc)\s+({{var_unquoted_string}}) + scope: meta.function.tcl + captures: + 1: keyword.other.tcl + 2: entity.name.function.tcl + set: proc-parameters + - match: \bproc\b(?=\s) + scope: keyword.other.tcl + pop: true + + proc-parameters: + - match: \s+ + scope: meta.function.tcl + - match: \{ + scope: punctuation.section.block.begin.tcl + set: + - meta_scope: meta.function.parameters.tcl meta.block.tcl + - match: '(\})([^{{inline_end_chars}}]*)' + captures: + 1: punctuation.section.block.end.tcl + 2: invalid.illegal.tcl + set: proc-body + - match: '^\s*(#)' + captures: + 1: comment.line.number-sign.tcl punctuation.definition.comment.tcl + push: + - meta_content_scope: comment.line.number-sign.tcl + - match: \n + pop: true + - match: \\\\ + - match: \\\n + scope: punctuation.separator.continuation.tcl + - include: proc-parameter + - match: '(\[)\s*(list)\b(?=\s)' + captures: + 1: punctuation.definition.substitution.begin.tcl + 2: keyword.other.tcl + set: + - meta_scope: meta.function.parameters.tcl meta.substitution.tcl + - match: \] + scope: punctuation.definition.substitution.end.tcl + set: proc-body + - include: proc-parameter + - match: '' + pop: true + + proc-parameter: + - match: '\{' + scope: punctuation.section.block.begin.tcl + push: + - meta_scope: meta.block.tcl + - match: '{{unquoted_string}}' + scope: variable.parameter.tcl + set: + - meta_content_scope: meta.block.tcl + - match: '(\})([^{{inline_end_chars}}]*)' + captures: + 1: meta.block.tcl punctuation.section.block.end.tcl + 2: invalid.illegal.tcl + pop: true + - include: commands + - match: '\[\s*(list)\b(?=\s)' + captures: + 1: punctuation.definition.substitution.begin.tcl + 2: keyword.other.tcl + push: + - meta_scope: meta.substitution.tcl + - match: '{{unquoted_string}}' + scope: variable.parameter.tcl + set: + - match: \] + scope: punctuation.definition.substitution.end.tcl + pop: true + - include: commands + - match: '{{unquoted_string}}' + scope: variable.parameter.tcl + - match: (?=\S) + pop: true + + proc-body: + - meta_content_scope: meta.function.tcl + - match: '(?={{end_chars}})' + pop: true + - include: commands + + expr: + - match: (?={{end_chars}}) + pop: true + - include: expr-body + + expr-body: + - match: '\{' + scope: punctuation.section.block.begin.tcl + push: + - meta_scope: meta.block.tcl + - match: '(\})([^{{inline_end_chars}}]*)' + captures: + 1: punctuation.section.block.end.tcl + 2: invalid.illegal.tcl + pop: true + - match: '\\[\\{}n]' + scope: constant.character.escape.tcl + - include: operators + - include: commands + - include: operators + - include: commands + + operators: + - match: '[~!*/%<>&^|=?:+-]' + scope: keyword.operator.tcl + - match: '\b(eq|ne|in|ni)\b(?=\s)' + scope: keyword.operator.word.tcl + + command-braces: + - meta_scope: meta.block.tcl + - match: \} + scope: punctuation.section.block.end.tcl + pop: true + - include: commands + + non-command-braces: + - meta_scope: meta.block.tcl + - match: ^\s*(?=#) + push: comments + - include: braces + - match: '(\})([^{{inline_end_chars}}]*)' + captures: + 1: punctuation.section.block.end.tcl + 2: invalid.illegal.tcl + pop: true + - match: '\\[\\{}n]' + scope: constant.character.escape.tcl + - include: expressions + + string-braces: + - meta_scope: string.quoted.brace.tcl + - match: '(\})(?=[\s\n{{inline_end_chars}}])' + captures: + 1: punctuation.definition.string.end.tcl + 2: invalid.illegal.tcl + pop: true + - match: '\n' + pop: true + - match: '\\[\\{}n]' + scope: constant.character.escape.tcl + + braces: + - match: (\{)(\*)(\}) + scope: meta.block.tcl + captures: + 1: punctuation.section.block.begin.tcl + 2: keyword.operator.tcl + 3: punctuation.section.block.end.tcl + # Heuristic: if the brace is followed by whitespace, + # or what appears to be a command name followed by + # whitespace, treat it as code, otherwise a regexp + - match: '\{(?=\s*({{most_likely_code}})\b|\n)' + scope: punctuation.section.block.begin.tcl + push: + - meta_scope: meta.block.tcl + - match: \} + scope: punctuation.section.block.end.tcl + pop: true + - include: commands + - match: '\{(?=\s|\})' + scope: punctuation.section.block.begin.tcl + push: non-command-braces + - match: '\{' + scope: punctuation.definition.string.begin.tcl + push: string-braces + + substitution: + - match: '\[(?!{{special_chars}})' + scope: punctuation.definition.substitution.begin.tcl + push: [substitution-body, command-name] + + substitution-body: + - meta_scope: meta.substitution.tcl + - match: '\]' + scope: meta.substitution.tcl punctuation.definition.substitution.end.tcl + pop: true + - include: commands + + escape: + - match: '\\(\d{1,3}|x\h+|u\h{1,4}|.|n)' + scope: constant.character.escape.tcl + + variable: + - match: '(\$)((?:[a-zA-Z0-9_]|::)+(\([^\)]+\))?|\{[^\}]*\})' + scope: variable.other.tcl + captures: + 1: punctuation.definition.variable.tcl diff --git a/assets/syntaxes/Packages/TCL/syntax_test_tcl.tcl b/assets/syntaxes/Packages/TCL/syntax_test_tcl.tcl new file mode 100644 index 000000000..fa0f0f6f3 --- /dev/null +++ b/assets/syntaxes/Packages/TCL/syntax_test_tcl.tcl @@ -0,0 +1,407 @@ +# SYNTAX TEST "Packages/TCL/Tcl.sublime-syntax" + +# ----------------- # +# Line continuation +# ----------------- # + +set MyDict [list\ + Key1 {Key Value 1}\ +# ^ punctuation.separator.continuation +] + +pg_select $database \ +"SELECT abc, def FROM xyz" +# <- string + +pg_select $database \ +"SELECT abc, def FROM xyz" \ +data +# <- - variable.function + +becs::wizFrame -info [becs_infobody "interface.jpg" \ + "Specify VID parameters<br><br><strong>VID groups</strong> can be used to build ranges that is added to the VID range field."] \ + -title "$ifacename VID parameters" +# ^ - meta.substitution + +if {[catch {becs::objectCreate -class interface \ + -flags "statistics,interfaceautoprobe" \ + -name $aggrname -role $extra_role \ + -parameters [array get params] \ + -opaque [list "becs.editor" "ifrole.tcl"] \ + -parentoid $aggr_attach_oid} err]} { +return "Creating aggregator interface $aggrname under element/management element-module OID $aggr_attach_oid: $err" +} +#^ - meta.block +#^ - meta.substitution + +# -------------------------------------------------------------------------- # +# Issue 134: https://github.com/SublimeTextIssues/DefaultPackages/issues/134 +# -------------------------------------------------------------------------- # + +regsub -all {\/} $line {\\} line; +# <- keyword.other +# ^ string.regexp +# ^ constant.character.escape + +foreach {one_arg_opt_pattern} [list {-first\S*} {-second\S*} {-group\S*}] { + regsub -- "${one_arg_opt_pattern}\\s+\\S+" $args {} args +# ^ string.quoted.double +} + +regsub -all {\\\\} $line {\\} line; +# <- keyword.other +# ^ string.regexp constant.character.escape +# ^ constant.character.escape +puts "Not Highlighting" +# <- keyword.other +# ^ string.quoted.double + +namespace eval A { +#^^^^^^^^^^^^^^^^^ meta.namespace +# ^ entity.name.namespace + namespace eval B { +# ^^^^^^^^^^^^^^^^^^ meta.namespace meta.namespace +# ^ entity.name.namespace + proc C { +# ^^^^^^^^^^^ meta.function +# ^ entity.name.function + puts hi + } + } +} + +set dirname "${v_seagull_cfg_root}/seagull-[format "%02d" [expr $ctrlport - $v_seagull_ctrl_port]]" +# ^^^^^^ keyword.other +# ^^^^ keyword.other + +set a [list] +# ^^^^ keyword.other + +set res "[join [lrange [split $res ","] 0 end-1] ","] ..." +# ^^^^ keyword.other +# ^^^^^^ keyword.other +# ^^^^^ keyword.other + +regexp {instance="?([^" \t]+)"?} $counter matchedstring instance; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^ string.regexp + +set check1 [regexp {^'(.){0,32}'$} $param] +# ^^^^^^^^^^^^^ string.regexp + +set check2 [regexp {[*\?\|"<>:/\]+} $param] +# ^^^^^^^^^^^^^^ string.regexp + +set stepquote [regsub -all {"} $line {""} ] +# ^ - string + +set copy [[$root selectNodes //*\[@ID="$idref"\]] cloneNode -deep] +# ^^ constant.character.escape +# ^^ constant.character.escape + +set v "String with $var and [command substitution] in it. Also, \n escapes." +# ^^^^ variable.other +# ^^^^^^^^^^^^^^^^^^^^^^ meta.substitution +# ^^^^^^^ variable.function +# ^^ constant.character.escape + +proc a {} { + return "this is [proc c {p1 p2 p3} { puts 42 }; set b 42;] here, \[here it's $b\], highlighted too" +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.substitution +# ^ entity.name.function +# ^^^^^^^^^^ meta.block meta.substitution meta.function.parameters +# ^ punctuation.terminator +# ^ keyword.other +# ^^ constant.numeric +# ^^^^^^^^^^^^^^^ - meta.substitution +# ^^ constant.character.escape +# ^^^^ - variable.function +# ^^ constant.character.escape +} + +expr 5 + 4 +# ^ constant.numeric +# ^ constant.numeric + +proc D {a {b "default"} args} { +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^ entity.name.function +# ^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters meta.block +# ^ variable.parameter +# ^^^^^^^^^^^^^ meta.block meta.block +# ^ variable.parameter +# ^^^^^^^^^ string.quoted.double +# ^^^^ variable.parameter + +} +# <- meta.function + # <- - meta.function + +proc ${ns}::suffix {} {} +# ^^^^^^^^^^^^^ entity.name.function + +# -------------------------------------------------------------------------- # +# Issue 131: https://github.com/SublimeTextIssues/DefaultPackages/issues/131 +# -------------------------------------------------------------------------- # +set ok1 {["]"]} +# ^^^^^^^ string.quoted.brace +set ok2 {["][]"]} +# ^^^^^^^^^ string.quoted.brace +set not_ok {["]["]} +# ^^^^^^^^ string.quoted.brace +puts $ok1 ;# ["]"] +# ^ keyword.other +# ^^^^ variable.other +# ^ punctuation.definition.variable +# ^ comment.line +puts $ok2 ;# ["][]"] +# ^ keyword.other +# ^^^^ variable.other +# ^ punctuation.definition.variable +# ^ comment.line +puts $not_ok ;# ["]["] +# ^ keyword.other +# ^^^^^^^ variable.other +# ^ punctuation.definition.variable +# ^ comment.line + +my-command param1 $param2 +# <- variable.function + +${ns}::command 1 2 +#^^^^^^^^^^^^^ variable.function + +array 1 2 3 +#^^^^ keyword.other + +[ list foo baz] +# ^ keyword.other +#^^^^^^^^^^^^^^ meta.substitution + +if {$var == true} { +# <- keyword.control +# ^^^^^^^^^^^^^^ meta.block +# ^^ keyword.operator +# ^ meta.block + +} elseif {$foo < $bar} { +# ^^^^^^ keyword.control +# ^^^^^^^^^^^^^ meta.block +# ^ keyword.operator + +} else { +# ^^^^ keyword.control + +} + +# Ensure else doesn't work outside of if command +else {} +# <- - keyword.control + +# Ideally this would be a test to make the "a" invalid, +# but there isn't a good way to handle that and brace strings +# containing regexes as exhibited in the tests for issues +# 783 and 784 +set y {1 2 3}a +# ^^^^^^^^ string.quoted.brace +# ^ punctuation.definition.string.begin +# ^ - punctuation.definition.string + +# -------------------------------------------------# +# https://github.com/sublimehq/Packages/issues/779 +# ------------------------------------------------ # +regexp -inline -all -- {%[a-zA-Z_]*%} "whatever" +# ^^^^^^^^^^^^^^^^ - string + +regexp -all -inline {%[a-zA-Z_]*%} "whatever" +# ^^^^^^^^^^^^^ - string + +# -------------------------------------------------# +# https://github.com/sublimehq/Packages/issues/783 +# https://github.com/sublimehq/Packages/issues/784 +# ------------------------------------------------ # +set objRegExp {(^[a-zA-Z]{2}[a-zA-Z0-9-]{2,12}$)} +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.brace - invalid +# ^ - meta.block +set objRegExp {(.{0,200})} +# ^^^^^^^^^^^^ string.quoted.brace - invalid +# ^ - meta.block + +proc test {} { + + set saoid [svcmap_saoid sm] +# ^^^ keyword.other + # Syntax highligting works inside an if statement: + if {[defvar cpe_uplink_ifoid 0] == 0} { + array set cpe_param [objectGetField -oid $cpeoid -fieldname parameters] +# ^^^^^ keyword.other +# ^^^^^^^^^^^^^^ variable.function + if {[info exists cpe_param(model)]} { + set cpe_model $cpe_param(model) + } else { + error "ERROR: Model not set" +# ^^^^^ keyword.other +# ^ string.quoted.double + } + } + + # but not within for example a foreach loop: + foreach cpe_ifoid [objectTreeFind -oid $cpeoid -walkdown 0 -classmask interface] { +# ^^^^^^^ keyword.control +# ^^^^^^^^^^^^^^ variable.function + set cpe_if_role [objectGetField -oid $cpe_ifoid -fieldname role] +# ^^^ keyword.other + if {[string match "uplink.running" $cpe_if_role]} { +# ^^ keyword.control +# ^^^^^^ keyword.other + set cpe_uplink_ifoid $cpe_ifoid + set cpe_uplink_name [objectGetField -oid $cpe_uplink_ifoid -fieldname name] + break + } + } + + switch -- $parclass { +# ^^^^^^ keyword.control + "element-attach" { +# ^^^^^^^^^^^^^^^^ string.quoted.double + # CPE SA +# ^^^^^^^^^ comment + return [svcmap_hook_return sm] +# ^^^^^^ keyword.control +# ^^^^^^^^^^^^^^^^^^ variable.function + } + + "interface" { +# ^^^^^^^^^^^ string.quoted.double + set ifoid $paroid + set eaoid [elm_oid_by_iface $ifoid] + set earole [objectGetField -oid $eaoid -fieldname role] + } + } +} + +# https://github.com/sublimehq/Packages/issues/1145 + +# When set has a brace followed by non-whitespace, +# we treat it as a string +set w {foobar} +# ^^^^^^^^ string.quoted.brace +# ^ punctuation.definition.string.begin +# ^ punctuation.definition.string.end + +# For set when the brace is not followed by a newline, +# we treat it as expression, but without command names +set x { 1 { 2 3 } } +# ^^^^^^^^^^^^^ meta.block +# ^ constant.numeric +# ^^^^^^^ meta.block meta.block +# ^ constant.numeric +# ^ constant.numeric + +set y { foo {} +# ^^^^^^^^ meta.block +# ^ punctuation.section.block.begin +# ^ - variable.function +# ^^ meta.block meta.block +# ^ punctuation.section.block.begin +# ^ punctuation.section.block.end + # comment +# ^^^^^^^^^^ comment + bar {} +# ^^^^^^ meta.block +# ^ - variable.function +# ^^ meta.block meta.block +# ^ punctuation.section.block.begin +# ^ punctuation.section.block.end + baz {} } +# ^^^^^^^^ meta.block +# ^ - variable.function +# ^^ meta.block meta.block +# ^ punctuation.section.block.begin +# ^ punctuation.section.block.end +# ^ meta.block punctuation.section.block.end + +# For a set with a brace followed by a newline, we +# treat it as a block of code with commands +set z { +# ^ meta.block punctuation.section.block.begin + foo {} +# ^ meta.block variable.function +# ^^ meta.block meta.block +# ^ punctuation.section.block.begin +# ^ punctuation.section.block.end + bar {} +# ^ variable.function +# ^^ meta.block meta.block +# ^ punctuation.section.block.begin +# ^ punctuation.section.block.end + baz {} +# ^ variable.function +# ^^ meta.block meta.block +# ^ punctuation.section.block.begin +# ^ punctuation.section.block.end +} +# <- meta.block punctuation.section.block.end + +if { 1 } { +# <- keyword.control +# ^^^^^ meta.block +# ^ constant.numeric +# ^ - meta.block +# ^ meta.block + +# This tests an implicit block after the if statement. This could +# be refactored, but the current implementation treats it this way. + if 2 { +# ^^^ meta.block - meta.block meta.block +# ^^ keyword.control +# ^ meta.block meta.block constant.numeric +# ^ meta.block - meta.block meta.block +# ^ meta.block meta.block punctuation.section.block.begin + + set x 1 +# ^^^^^^^ meta.block meta.block +# ^ constant.numeric + + set y 2 +# ^^^^^^^ meta.block meta.block +# ^ constant.numeric + } +# ^ meta.block meta.block punctuation.section.block.end +} +# <- meta.block punctuation.section.block.end + +if { $mpv(radar) eq "VHF" } { +# <- keyword.control +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.block +# ^^ keyword.operator.word +# ^ meta.block punctuation.section.block.begin + + if [ catch {UpdateIfKst} imf ] { +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block +# ^^ keyword.control +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.substitution +# ^ meta.block meta.block punctuation.section.block.begin + set imf -1 +# ^ keyword.operator +# ^ constant.numeric + + if { $mpv(ifmon_errcount) < 5 } { +# ^ keyword.control +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block meta.block meta.block +# ^ keyword.operator +# ^ constant.numeric + EngineMsg [list $msg] [Utime] +# ^ variable.function + incr mpv(ifmon,errcount) + } else { +# ^ punctuation.section.block.end +# ^ keyword.control +# ^ punctuation.section.block.begin + set msg "Too many IF monitor errors -- giving up" +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double + EngineMsg [list $msg] [Utime] +# ^ variable.function + } + } +} + diff --git a/assets/syntaxes/Packages/Text/Plain text.tmLanguage b/assets/syntaxes/Packages/Text/Plain text.tmLanguage new file mode 100644 index 000000000..8d2bf100f --- /dev/null +++ b/assets/syntaxes/Packages/Text/Plain text.tmLanguage @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>fileTypes</key> + <array> + <string>txt</string> + </array> + <key>name</key> + <string>Plain Text</string> + <key>patterns</key> + <array> + </array> + <key>scopeName</key> + <string>text.plain</string> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/Text/Snippets/lorem.sublime-snippet b/assets/syntaxes/Packages/Text/Snippets/lorem.sublime-snippet new file mode 100644 index 000000000..7e291ee47 --- /dev/null +++ b/assets/syntaxes/Packages/Text/Snippets/lorem.sublime-snippet @@ -0,0 +1,11 @@ +<snippet> + <description>Lorem ipsum</description> + <content><![CDATA[Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non +proident, sunt in culpa qui officia deserunt mollit anim id est laborum.]]></content> + <tabTrigger>lorem</tabTrigger> + <scope>-source</scope> +</snippet> \ No newline at end of file diff --git a/assets/syntaxes/Packages/Textile/Snippets/Acronym.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Acronym.sublime-snippet new file mode 100644 index 000000000..95e635e97 --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Acronym.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[${1:ABC}(${2:Always Be Closing})]]></content> + <tabTrigger>acr</tabTrigger> + <scope>text.html.textile</scope> + <description>Acronym</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Snippets/Block-Quotes.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Block-Quotes.sublime-snippet new file mode 100644 index 000000000..160ff6c9b --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Block-Quotes.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[bq. ${1:A quote...} + +$0]]></content> + <tabTrigger>bq</tabTrigger> + <scope>text.html.textile</scope> + <description>Block Quote</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Snippets/Heading-1.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Heading-1.sublime-snippet new file mode 100644 index 000000000..dc555d855 --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Heading-1.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[h1. ${1:Text...} + +$0]]></content> + <tabTrigger>h1</tabTrigger> + <scope>text.html.textile</scope> + <description>Heading 1</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Snippets/Heading-2.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Heading-2.sublime-snippet new file mode 100644 index 000000000..b8f7c217d --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Heading-2.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[h2. ${1:Text...} + +$0]]></content> + <tabTrigger>h2</tabTrigger> + <scope>text.html.textile</scope> + <description>Heading 2</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Snippets/Heading-3.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Heading-3.sublime-snippet new file mode 100644 index 000000000..39299192d --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Heading-3.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[h3. ${1:Text...} + +$0]]></content> + <tabTrigger>h3</tabTrigger> + <scope>text.html.textile</scope> + <description>Heading 3</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Snippets/Heading-4.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Heading-4.sublime-snippet new file mode 100644 index 000000000..4f8ca00f1 --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Heading-4.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[h4. ${1:Text...} + +$0]]></content> + <tabTrigger>h4</tabTrigger> + <scope>text.html.textile</scope> + <description>Heading 4</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Snippets/Heading-5.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Heading-5.sublime-snippet new file mode 100644 index 000000000..f52e65c48 --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Heading-5.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[h5. ${1:Text...} + +$0]]></content> + <tabTrigger>h5</tabTrigger> + <scope>text.html.textile</scope> + <description>Heading 5</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Snippets/Heading-6.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Heading-6.sublime-snippet new file mode 100644 index 000000000..b7c9fff68 --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Heading-6.sublime-snippet @@ -0,0 +1,8 @@ +<snippet> + <content><![CDATA[h6. ${1:Text...} + +$0]]></content> + <tabTrigger>h6</tabTrigger> + <scope>text.html.textile</scope> + <description>Heading 6</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Snippets/Image.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Image.sublime-snippet new file mode 100644 index 000000000..f446e112c --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Image.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[!${1:http://site.com/image}(${2:Title})!]]></content> + <tabTrigger>img</tabTrigger> + <scope>text.html.textile</scope> + <description>Image</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Snippets/Linked-Image.sublime-snippet b/assets/syntaxes/Packages/Textile/Snippets/Linked-Image.sublime-snippet new file mode 100644 index 000000000..f368b8c39 --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Snippets/Linked-Image.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[!${1:http://site.com/image}(${2:Title})!:${3:http://linkedsite.com}]]></content> + <tabTrigger>linkimg</tabTrigger> + <scope>text.html.textile</scope> + <description>Linked Image</description> +</snippet> diff --git a/assets/syntaxes/Packages/Textile/Textile.sublime-syntax b/assets/syntaxes/Packages/Textile/Textile.sublime-syntax new file mode 100644 index 000000000..ffe80d5d7 --- /dev/null +++ b/assets/syntaxes/Packages/Textile/Textile.sublime-syntax @@ -0,0 +1,222 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Textile +file_extensions: + - textile +first_line_match: textile +scope: text.html.textile +contexts: + main: + - match: '(^h[1-6]([<>=()]+)?)(\([^)]*\)|\{[^}]*\})*(\.)' + captures: + 1: entity.name.tag.heading.textile + 3: entity.name.type.textile + 4: entity.name.tag.heading.textile + push: + - meta_scope: markup.heading.textile + - match: ^$ + captures: + 1: entity.name.tag.heading.textile + 3: entity.name.type.textile + 4: entity.name.tag.heading.textile + pop: true + - include: inline + - include: scope:text.html.basic + - match: '(^bq([<>=()]+)?)(\([^)]*\)|\{[^}]*\})*(\.)' + captures: + 1: entity.name.tag.blockquote.textile + 3: entity.name.type.textile + 4: entity.name.tag.blockquote.textile + push: + - meta_scope: markup.quote.textile + - match: ^$ + captures: + 1: entity.name.tag.blockquote.textile + 3: entity.name.type.textile + 4: entity.name.tag.blockquote.textile + pop: true + - include: inline + - include: scope:text.html.basic + - match: '(^fn[0-9]+([<>=()]+)?)(\([^)]*\)|\{[^}]*\})*(\.)' + captures: + 1: entity.name.tag.footnote.textile + 3: entity.name.type.textile + 4: entity.name.tag.footnote.textile + push: + - meta_scope: markup.other.footnote.textile + - match: ^$ + captures: + 1: entity.name.tag.footnote.textile + 3: entity.name.type.textile + 4: entity.name.tag.footnote.textile + pop: true + - include: inline + - include: scope:text.html.basic + - match: '(^table([<>=()]+)?)(\([^)]*\)|\{[^}]*\})*(\.)' + captures: + 1: entity.name.tag.footnote.textile + 3: entity.name.type.textile + 4: entity.name.tag.footnote.textile + push: + - meta_scope: markup.other.table.textile + - match: ^$ + captures: + 1: entity.name.tag.footnote.textile + 3: entity.name.type.textile + 4: entity.name.tag.footnote.textile + pop: true + - include: inline + - include: scope:text.html.basic + - match: ^(?=\S) + push: + - meta_scope: meta.paragraph.textile + - match: ^$ + pop: true + - match: '(^p([<>=()]+)?)(\([^)]*\)|\{[^}]*\})*(\.)' + scope: entity.name.section.paragraph.textile + captures: + 1: entity.name.tag.paragraph.textile + 3: entity.name.type.textile + 4: entity.name.tag.paragraph.textile + - include: inline + - include: scope:text.html.basic + - include: scope:text.html.basic + inline: + # & is handled automagically by textile, so we match it to avoid text.html.basic from flagging it + - match: "&(?![A-Za-z0-9]+;)" + scope: text.html.textile + - match: '^\*+(\([^)]*\)|\{[^}]*\})*(\s+|$)' + scope: markup.list.unnumbered.textile + captures: + 1: entity.name.type.textile + - match: '^#+(\([^)]*\)|\{[^}]*\})*\s+' + scope: markup.list.numbered.textile + captures: + 1: entity.name.type.textile + - match: |- + (?x) + " # Start name, etc + (?: # Attributes + # I swear, this is how the language is defined, + # couldnt make it up if I tried. + (?:\([^)]+\))?(?:\{[^}]+\})?(?:\[[^\]]+\])? + # Class, Style, Lang + | (?:\{[^}]+\})?(?:\[[^\]]+\])?(?:\([^)]+\))? + # Style, Lang, Class + | (?:\[[^\]]+\])?(?:\{[^}]+\})?(?:\([^)]+\))? + # Lang, Style, Class + )? + ([^"]+?) # Link name + \s? # Optional whitespace + (?:\(([^)]+?)\))? + ": # End name + (\w[-\w_]*) # Linkref + (?=[^\w\/;]*?(<|\s|$)) # Catch closing punctuation + # and end of meta.link + scope: meta.link.reference.textile + captures: + 1: string.other.link.title.textile + 2: string.other.link.description.title.textile + 3: constant.other.reference.link.textile + - match: |- + (?x) + " # Start name, etc + (?: # Attributes + # I swear, this is how the language is defined, + # couldnt make it up if I tried. + (?:\([^)]+\))?(?:\{[^}]+\})?(?:\[[^\]]+\])? + # Class, Style, Lang + | (?:\{[^}]+\})?(?:\[[^\]]+\])?(?:\([^)]+\))? + # Style, Lang, Class + | (?:\[[^\]]+\])?(?:\{[^}]+\})?(?:\([^)]+\))? + # Lang, Style, Class + )? + ([^"]+?) # Link name + \s? # Optional whitespace + (?:\(([^)]+?)\))? + ": # End Name + (\S*?(?:\w|\/|;)) # URL + (?=[^\w\/;]*?(<|\s|$)) # Catch closing punctuation + # and end of meta.link + scope: meta.link.inline.textile + captures: + 1: string.other.link.title.textile + 2: string.other.link.description.title.textile + 3: markup.underline.link.textile + - match: |- + (?x) + \! # Open image + (\<|\=|\>)? # Optional alignment + (?: # Attributes + # I swear, this is how the language is defined, + # couldnt make it up if I tried. + (?:\([^)]+\))?(?:\{[^}]+\})?(?:\[[^\]]+\])? + # Class, Style, Lang + | (?:\{[^}]+\})?(?:\[[^\]]+\])?(?:\([^)]+\))? + # Style, Lang, Class + | (?:\[[^\]]+\])?(?:\{[^}]+\})?(?:\([^)]+\))? + # Lang, Style, Class + )? + (?:\.[ ])? # Optional + ([^\s(!]+?) # Image URL + \s? # Optional space + (?:\(((?:[^\(\)]|\([^\)]+\))+?)\))? # Optional title + \! # Close image + (?: + : + (\S*?(?:\w|\/|;)) # URL + (?=[^\w\/;]*?(<|\s|$)) # Catch closing punctuation + )? + scope: meta.image.inline.textile + captures: + 2: markup.underline.link.image.textile + 3: string.other.link.description.textile + 4: markup.underline.link.textile + - match: '\|(\([^)]*\)|\{[^}]*\})*(\\\||.)+\|' + scope: markup.other.table.cell.textile + captures: + 1: entity.name.type.textile + - match: '\B(\*\*)((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)\*\*\B' + scope: markup.bold.textile + captures: + 3: entity.name.type.textile + - match: '\B(\*)((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)\*\B' + scope: markup.bold.textile + captures: + 3: entity.name.type.textile + - match: '\B-((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)-\B' + scope: markup.deleted.textile + captures: + 2: entity.name.type.textile + - match: '\B\+((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)\+\B' + scope: markup.inserted.textile + captures: + 2: entity.name.type.textile + - match: '(?:\b|\s)_((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)_(?:\b|\s)' + scope: markup.italic.textile + captures: + 2: entity.name.type.textile + - match: '\B(\?\?)((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)\?\?' + scope: markup.italic.phrasemodifiers.textile + captures: + 3: entity.name.type.textile + - match: '\B(@)((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)@' + scope: markup.italic.phrasemodifiers.textile + captures: + 3: entity.name.type.textile + - match: '\B(\^)((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)\^' + scope: markup.italic.phrasemodifiers.textile + captures: + 3: entity.name.type.textile + - match: '\B(~)((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)~' + scope: markup.italic.phrasemodifiers.textile + captures: + 3: entity.name.type.textile + - match: '\B(%)((\([^)]*\)|\{[^}]*\}|\[[^]]+\]){0,3})(\S.*?\S|\S)%' + scope: markup.italic.phrasemodifiers.textile + captures: + 3: entity.name.type.textile + # Footnotes + - match: '\[[0-9+]\]' + scope: entity.name.tag.textile diff --git a/assets/syntaxes/Packages/Textile/syntax_test_textile.textile b/assets/syntaxes/Packages/Textile/syntax_test_textile.textile new file mode 100644 index 000000000..6266c1fef --- /dev/null +++ b/assets/syntaxes/Packages/Textile/syntax_test_textile.textile @@ -0,0 +1,46 @@ +| SYNTAX TEST "Packages/Textile/Textile.sublime-syntax" + +h1. Heading +| <- markup.heading entity.name.tag +|^^ entity.name.tag +|^^^^^^^^^^ markup.heading + +This is a paragraph. This is a *bold* word. _This is italic_. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph +| ^^^^^^ markup.bold +| ^^^^^^^^^^^^^^^^ markup.italic + +bq. This is a block quotation +| <- markup.quote entity.name.tag +|^^ entity.name.tag +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote + +This paragraph contains a reference[1]. +| ^^^ entity.name.tag + +??Citation?? +| <- markup.italic.phrasemodifiers +|^^^^^^^^^^^ markup.italic.phrasemodifiers + +@this.is(code)@ +| <- markup.italic.phrasemodifiers +|^^^^^^^^^^^^^^ markup.italic.phrasemodifiers + +This is a -deleted- word. +| ^^^^^^^^^ markup.deleted +This is an +added+ word. +| ^^^^^^^ markup.inserted + +The following number is superscript: ^2^. +| ^^^ markup.italic.phrasemodifiers + +The following word is strikethrough: ~word~ +| ^^^^^^ markup.italic.phrasemodifiers + +A force %span%. +| ^^^^^^ markup.italic.phrasemodifiers + +fn1. This is the footnote +| <- markup.other.footnote entity.name.tag +|^^^ entity.name.tag +|^^^^^^^^^^^^^^^^^^^^^^^^ markup.other.footnote diff --git a/assets/syntaxes/Packages/XML/Comments.tmPreferences b/assets/syntaxes/Packages/XML/Comments.tmPreferences new file mode 100644 index 000000000..7e8205f48 --- /dev/null +++ b/assets/syntaxes/Packages/XML/Comments.tmPreferences @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>text.xml - meta.tag</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string><![CDATA[<!-- ]]></string> + </dict> + <dict> + <key>name</key> + <string>TM_COMMENT_END</string> + <key>value</key> + <string><![CDATA[ -->]]></string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/XML/Miscellaneous.tmPreferences b/assets/syntaxes/Packages/XML/Miscellaneous.tmPreferences new file mode 100644 index 000000000..603954205 --- /dev/null +++ b/assets/syntaxes/Packages/XML/Miscellaneous.tmPreferences @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Miscellaneous</string> + <key>scope</key> + <string>text.xml</string> + <key>settings</key> + <dict> + <key>comment</key> + <string><![CDATA[ + /* + * Don't indent: + * <?, </, <! + * <whatever></whatever> + * <whatever /> + * <% %> + * <!-- --> + * <%-- --%> + * + * Do indent: + * <whatever> + * <% + * <!-- + * <%-- + * + * Decrease indent for: + * </whatever> + * --> + * --%> + */ + ]]></string> + <key>decreaseIndentPattern</key> + <string><![CDATA[^\s*(</[^>]+>|-->|--%>)]]></string> + <key>increaseIndentPattern</key> + <string><![CDATA[^\s*<(([^!/?]|%)(?!.+?([/%]>|</.+?>))|[%!]--\s*$)]]></string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/XML/Snippets/xml-cdata.sublime-snippet b/assets/syntaxes/Packages/XML/Snippets/xml-cdata.sublime-snippet new file mode 100644 index 000000000..11ec3b7b1 --- /dev/null +++ b/assets/syntaxes/Packages/XML/Snippets/xml-cdata.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <description>CDATA</description> + <content><![CDATA[${0:$SELECTION}]]></content> + <tabTrigger>cdata</tabTrigger> + <scope>text.xml</scope> +</snippet> diff --git a/assets/syntaxes/Packages/XML/Snippets/xml-declaration.sublime-snippet b/assets/syntaxes/Packages/XML/Snippets/xml-declaration.sublime-snippet new file mode 100644 index 000000000..a60565e7b --- /dev/null +++ b/assets/syntaxes/Packages/XML/Snippets/xml-declaration.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]></content> + <tabTrigger>xml-declaration</tabTrigger> + <scope>text.xml</scope> + <description>XML Declaration</description> +</snippet> diff --git a/assets/syntaxes/Packages/XML/Snippets/xml-long-tag.sublime-snippet b/assets/syntaxes/Packages/XML/Snippets/xml-long-tag.sublime-snippet new file mode 100644 index 000000000..3d01c2739 --- /dev/null +++ b/assets/syntaxes/Packages/XML/Snippets/xml-long-tag.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[<${1:p}>${0:$SELECTION}</${1/([^ ]+).*/$1/}>]]></content> + <tabTrigger>lt</tabTrigger> + <scope>text.xml - meta.tag - comment - string</scope> + <description>Long Tag</description> +</snippet> diff --git a/assets/syntaxes/Packages/XML/Snippets/xml-model.sublime-snippet b/assets/syntaxes/Packages/XML/Snippets/xml-model.sublime-snippet new file mode 100644 index 000000000..1861c677d --- /dev/null +++ b/assets/syntaxes/Packages/XML/Snippets/xml-model.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[<?xml-model href="${1:http://}" schematypens="${2:http://}"?>$0]]></content> + <tabTrigger>xml-model</tabTrigger> + <scope>text.xml</scope> + <description>XML Model</description> +</snippet> diff --git a/assets/syntaxes/Packages/XML/Snippets/xml-short-tag.sublime-snippet b/assets/syntaxes/Packages/XML/Snippets/xml-short-tag.sublime-snippet new file mode 100644 index 000000000..2561d680b --- /dev/null +++ b/assets/syntaxes/Packages/XML/Snippets/xml-short-tag.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[<${1:name} />]]></content> + <tabTrigger>st</tabTrigger> + <scope>text.xml - meta.tag - comment - string</scope> + <description>Short Tag</description> +</snippet> diff --git a/assets/syntaxes/Packages/XML/Snippets/xml-stylesheet.sublime-snippet b/assets/syntaxes/Packages/XML/Snippets/xml-stylesheet.sublime-snippet new file mode 100644 index 000000000..6ac1f4717 --- /dev/null +++ b/assets/syntaxes/Packages/XML/Snippets/xml-stylesheet.sublime-snippet @@ -0,0 +1,6 @@ +<snippet> + <content><![CDATA[<?xml-stylesheet type='${2:text/xsd}' href='${2:file.xsd}'?>$0]]></content> + <tabTrigger>xml-stylesheet</tabTrigger> + <scope>text.xml</scope> + <description>XML Stylesheet</description> +</snippet> diff --git a/assets/syntaxes/Packages/XML/XML.sublime-settings b/assets/syntaxes/Packages/XML/XML.sublime-settings new file mode 100644 index 000000000..3f8131ffc --- /dev/null +++ b/assets/syntaxes/Packages/XML/XML.sublime-settings @@ -0,0 +1,3 @@ +{ + "hidden_extensions": ["rss", "sublime-snippet", "tmLanguage", "tmTheme", "tmSnippet", "tmPreferences", "dae", "csproj", "fsproj", "sqlproj", "vbproj", "vcproj", "vcxproj", "props", "targets" ] +} diff --git a/assets/syntaxes/Packages/XML/XML.sublime-syntax b/assets/syntaxes/Packages/XML/XML.sublime-syntax new file mode 100644 index 000000000..ad7d9c871 --- /dev/null +++ b/assets/syntaxes/Packages/XML/XML.sublime-syntax @@ -0,0 +1,619 @@ +%YAML 1.2 +--- + +name: XML +file_extensions: + - xml + - xsd + - xslt + - tld + - dtml + - rng + - rss + - opml + - svg +first_line_match: |- + (?x: + ^(?: + <\?xml\s + | \s*<([\w-]+):Envelope\s+xmlns:\1\s*=\s*"http://schemas.xmlsoap.org/soap/envelope/"\s*> + | \s*(?i:<!DOCTYPE\s+(?!html[ \t\n\f>])) + ) + ) +scope: text.xml +variables: + # The atomic part of a tag or attribute name without namespace separator `:` + identifier: '[[:alpha:]_][[:alnum:]_.-]*' + # This is the full XML Name production, but should not be used where namespaces + # are possible. Those locations should use a qualified_name. + name: '[[:alpha:]:_][[:alnum:]:_.-]*' + # The qualified tag name allows a namespace prefix (ns:) followed by a local + # name while both parts are validated separately. The namespace is optional, + # but is matched valid if not followed by a localname in order to not disturb + # writing. + qualified_tag_name: |- + (?x) + (?: + (?: + ({{identifier}}) # 1: valid namespace + | + ([^?!/<>\s][^:/<>\s]*) # 2: invalid namespace + )(:) + )? # namespace is optional + (?: + ({{identifier}})(?=[/<>\s]) # 3: valid localname + | + ([^?!/<>\s][^/<>\s]*) # 4: invalid localname + ) + + qualified_attribute_name: |- + (?x) + (?: + (?: + ({{identifier}}) # 1: valid namespace + | + ([^:=/<>\s]+) # 2: invalid namespace + )(:) + )? # namespace is optional + (?: + ({{identifier}}) # 3: valid localname + | + ([^=/<>\s]+?) # 4: invalid localname + )(?=[=<>\s]|[/?]>) + + # A doctype definition identifier is always followed by one of the + # characters of `dtd_break`. + dtd_break: '[''"\[\]()<>\s]' + # A valid or invalid doctype declaration identifiere consists of any + # character but one of `dtd_break`. + invalid_dtd_name: '[^{{dtd_break}}]+' + # A qualified doctype declaration identifier consists of a valid + # name which is followed by a valid break character. + qualified_dtd_name: '{{name}}(?=[{{dtd_break}}])' + + +contexts: + + main: + - include: preprocessor + - include: doctype + - include: comment + - include: cdata + - include: tag + - include: entity + - include: should-be-entity + +###[ CDATA ]################################################################## + + cdata: + - match: (<!\[)(CDATA)(\[) + captures: + 1: punctuation.definition.tag.begin.xml + 2: keyword.declaration.cdata.xml + 3: punctuation.definition.tag.begin.xml + push: + - meta_scope: meta.tag.sgml.cdata.xml + - meta_content_scope: string.unquoted.cdata.xml + - match: ']]>' + scope: punctuation.definition.tag.end.xml + pop: true + +###[ COMMENT ]################################################################ + + comment: + - match: '<!--' + scope: punctuation.definition.comment.begin.xml + push: + - meta_scope: comment.block.xml + - match: '-->' + scope: punctuation.definition.comment.end.xml + pop: true + - match: '-{2,}' + scope: invalid.illegal.double-hyphen-within-comment.xml + +###[ DOCTYPE DECLARATION ]#################################################### + + doctype: + - match: (<!)(?:(DOCTYPE)|(?i:(DOCTYPE)))\b + captures: + 1: punctuation.definition.tag.begin.xml + 2: keyword.declaration.doctype.xml + 3: invalid.illegal.bad-tag-name.xml + push: + - doctype-meta + - dtd-subset-brackets + - dtd-content-quoted + - dtd-content-type + - doctype-root-name + + doctype-meta: + - meta_scope: meta.tag.sgml.doctype.xml + - include: dtd-end + + doctype-root-name: + - match: '{{qualified_tag_name}}' + captures: + 1: variable.other.documentroot.namespace.xml + 2: invalid.illegal.bad-tag-name.xml + 3: variable.other.documentroot.xml punctuation.separator.namespace.xml + 4: variable.other.documentroot.localname.xml + 5: invalid.illegal.bad-tag-name.xml + pop: true + - include: dtd-else-pop + +###[ DTD TAGS ]############################################################### + + dtd: + - include: cdata + - include: comment + - include: dtd-entity + - include: dtd-element + - include: dtd-attlist + - include: dtd-notation + - include: dtd-subset + - include: dtd-unknown + - include: entity-parameter + - include: preprocessor + +###[ DTD ENTITY ]############################################################# + + dtd-entity: + - match: (<!)(ENTITY)\b + captures: + 1: punctuation.definition.tag.begin.xml + 2: keyword.declaration.entity.xml + push: + - dtd-entity-meta + - dtd-entity-content + - dtd-content-type + - dtd-entity-name + - dtd-entity-punctuation + + dtd-entity-meta: + - meta_scope: meta.tag.sgml.entity.xml + - include: dtd-end + + dtd-entity-punctuation: + - match: '%' + scope: punctuation.definition.entity.xml + pop: true + - include: dtd-else-pop + + dtd-entity-name: + - match: '{{qualified_dtd_name}}' + scope: variable.other.entity.xml + pop: true + - include: dtd-common-name + + dtd-entity-content: + - match: NDATA\b + scope: storage.type.ndata.xml + set: dtd-content-unquoted + - include: dtd-content-quoted + +###[ DTD ELEMENT ]############################################################ + + dtd-element: + - match: (<!)(ELEMENT)\b + captures: + 1: punctuation.definition.tag.begin.xml + 2: keyword.declaration.element.xml + push: + - dtd-element-meta + - dtd-element-content + - dtd-element-name + + dtd-element-meta: + - meta_scope: meta.tag.sgml.element.xml + - include: dtd-end + + dtd-element-name: + - match: '{{qualified_dtd_name}}' + scope: variable.other.element.xml + pop: true + - include: dtd-common-name + + dtd-element-content: + - match: \b(?:EMPTY|ANY)\b + scope: constant.other.xml + pop: true + - match: \( + scope: punctuation.definition.group.begin.xml + set: dtd-element-parens + - include: entity-parameter + - include: dtd-content-quoted + + dtd-element-parens: + - meta_scope: meta.group.xml + - match: \) + scope: punctuation.definition.group.end.xml + set: + - match: '[*?+]' + scope: keyword.operator.xml + pop: true + - include: dtd-else-pop + - match: \( + scope: punctuation.definition.group.begin.xml + push: dtd-element-parens + - match: '[*?+]' + scope: keyword.operator.xml + - match: '[,|]' + scope: punctuation.separator.xml + - include: entity-parameter + - include: entity + - include: should-be-entity + - include: string-unquoted + +###[ DTD ATTLIST ]############################################################ + + dtd-attlist: + - match: (<!)(ATTLIST)\b + captures: + 1: punctuation.definition.tag.begin.xml + 2: keyword.declaration.attlist.xml + push: + - dtd-attlist-meta + - dtd-attlist-content + - dtd-element-name + + dtd-attlist-meta: + - meta_scope: meta.tag.sgml.attlist.xml + - include: dtd-end + + dtd-attlist-content: + - include: entity-parameter + - include: dtd-attlist-parens + - match: \b(?:CDATA|ENTITY|ENTITIES|IDREFS?|ID|NMTOKENS?|NOTATION)\b + scope: storage.type.attribute.xml + - match: (#)(?:FIXED|IMPLIED|REQUIRED)\b + scope: storage.modifier.attribute.default-value.xml + captures: + 1: punctuation.definition.storage.xml + - match: \b{{name}}\b + scope: entity.other.attribute-name.xml + - include: dtd-content-quoted + + dtd-attlist-parens: + - match: \( + scope: punctuation.definition.group.begin.xml + push: + - meta_scope: meta.group.enumerated.xml + - match: \) + scope: punctuation.definition.group.end.xml + pop: true + - match: \| + scope: punctuation.separator.logical.xml + - include: entity-parameter + - include: entity + - include: should-be-entity + - include: string-unquoted + +###[ DTD NOTATION ]########################################################### + + dtd-notation: + - match: (<!)(NOTATION)\b + captures: + 1: punctuation.definition.tag.begin.xml + 2: keyword.declaration.notation.xml + push: + - dtd-notation-meta + - dtd-content-quoted + - dtd-content-type + - dtd-notation-name + + dtd-notation-meta: + - meta_scope: meta.tag.sgml.notation.xml + - include: dtd-end + + dtd-notation-name: + - match: '{{qualified_dtd_name}}' + scope: variable.other.notation.xml + pop: true + - include: dtd-common-name + +###[ DTD SUBSET ]############################################################# + + dtd-subset: + - match: <!\[ + scope: punctuation.definition.tag.begin.xml + push: + - dtd-subset-meta + - dtd-subset-brackets + - dtd-subset-name + + dtd-subset-meta: + - meta_scope: meta.tag.sgml.subset.xml + - match: \]> + scope: punctuation.definition.tag.end.xml + pop: true + - match: '[/\?]?>' + scope: invalid.illegal.bad-tag-end.xml + pop: true + - include: tag-end-missing-pop + + dtd-subset-name: + - match: '{{qualified_dtd_name}}' + scope: variable.other.subset.xml + pop: true + - include: dtd-common-name + + dtd-subset-brackets: + - match: \[ + scope: punctuation.section.brackets.begin.xml + set: + - meta_scope: meta.brackets.xml meta.internal-subset.xml + - match: \] + scope: punctuation.section.brackets.end.xml + pop: true + - include: dtd + - include: dtd-else-pop + +###[ DTD UNKNOWN ]############################################################ + + dtd-unknown: + - match: (<!)([^?/<>\s]*) + captures: + 1: punctuation.definition.tag.begin.xml + 2: invalid.illegal.bad-tag-name.xml + push: + - meta_scope: meta.tag.sgml.unknown.xml + - include: dtd-end + +###[ DTD PROTOTYPES ]######################################################### + + dtd-common-name: + - match: (%){{name}}(;) + scope: variable.parameter.xml + captures: + 1: punctuation.definition.parameter.xml + 2: punctuation.terminator.parameter.xml + pop: true + - match: '{{invalid_dtd_name}}' + scope: invalid.illegal.bad-identifier.xml + pop: true + - include: dtd-else-pop + + dtd-content-unquoted: + - include: string-unquoted + - include: dtd-else-pop + + dtd-content-quoted: + - include: string-quoted + - include: dtd-else-pop + + dtd-content-type: + - match: (?:PUBLIC|SYSTEM)\b + scope: storage.type.external-content.xml + pop: true + - include: dtd-else-pop + + dtd-else-pop: + # try to keep one whitespace if the end of a subset is detected + # in order to scope it as `invalid.illegal.missing-tag-end` + - match: (?=\s?\]) + pop: true + - include: tag-else-pop + + dtd-end: + - match: '>' + scope: punctuation.definition.tag.end.xml + pop: true + - match: \s?(?=[<\]]) + scope: invalid.illegal.missing-tag-end.xml + pop: true + - match: '[/\?]>' + scope: invalid.illegal.bad-tag-end.xml + pop: true + - match: \S + scope: invalid.illegal.unexpected.xml + + entity-parameter: + - match: (#)P?CDATA + scope: constant.other.placeholder.xml + captures: + 1: punctuation.definition.constant.xml + - match: (%){{name}}(;) + scope: variable.parameter.xml + captures: + 1: punctuation.definition.parameter.xml + 2: punctuation.terminator.parameter.xml + +###[ XML PREPROCESSOR ]####################################################### + + preprocessor: + # Prolog tags like <?xml...?> without respect of details + # Examples: + # <?xml version="1.0" ?> + # <?xml-model href='freb.xsl'?> + # <?xml-stylesheet type='text/xsl' href='freb.xsl'?> + # <?xml-third-party ... ?> + - match: |- + (?x) + (<\?) # opening <? punctuation + (?: + # valid lowercase prolog tag name + (xml(?:-[_a-z][-_a-z0-9]*)?)(?=[?<>\s]) + | + # invalid mixed or uppercase tag name + ([xX][mM][lL][^?<>\s]*) + ) + captures: + 1: punctuation.definition.tag.begin.xml + 2: entity.name.tag.xml + 3: invalid.illegal.bad-tag-name.xml + push: + - meta_scope: meta.tag.preprocessor.xml + - include: preprocessor-end + - include: tag-end-missing-pop + - include: tag-attribute + # Processing instructions like <?...?> + # meta tag without internal highlighting + - match: (<\?)({{name}})\b + captures: + 1: punctuation.definition.tag.begin.xml + 2: entity.name.tag.xml + push: + - meta_scope: meta.tag.preprocessor.xml + - include: preprocessor-end + + preprocessor-end: + - match: \?> + scope: punctuation.definition.tag.end.xml + pop: true + +###[ XML TAGS ]############################################################### + + tag: + # end-tag without attribute support + - match: (</){{qualified_tag_name}} + captures: + 1: punctuation.definition.tag.begin.xml + 2: entity.name.tag.namespace.xml + 3: invalid.illegal.bad-tag-name.xml + 4: entity.name.tag.xml punctuation.separator.namespace.xml + 5: entity.name.tag.localname.xml + 6: invalid.illegal.bad-tag-name.xml + push: + - meta_scope: meta.tag.xml + - match: '>' + scope: punctuation.definition.tag.end.xml + pop: true + - include: tag-end-missing-pop + - match: '[/\?]>' + scope: invalid.illegal.bad-tag-end.xml + pop: true + - match: \S + scope: invalid.illegal.unexpected-attribute.xml + # opening maybe self-closing tag with optional attributes + - match: (<){{qualified_tag_name}} + captures: + 1: punctuation.definition.tag.begin.xml + 2: entity.name.tag.namespace.xml + 3: invalid.illegal.bad-tag-name.xml + 4: entity.name.tag.xml punctuation.separator.namespace.xml + 5: entity.name.tag.localname.xml + 6: invalid.illegal.bad-tag-name.xml + push: + - meta_scope: meta.tag.xml + - match: /?> + scope: punctuation.definition.tag.end.xml + pop: true + - match: \?> + scope: invalid.illegal.bad-tag-end.xml + pop: true + - include: tag-end-missing-pop + - include: tag-attribute + + tag-attribute: + - match: '{{qualified_attribute_name}}' + captures: + 1: entity.other.attribute-name.namespace.xml + 2: invalid.illegal.bad-attribute-name.xml + 3: entity.other.attribute-name.xml punctuation.separator.namespace.xml + 4: entity.other.attribute-name.localname.xml + 5: invalid.illegal.bad-attribute-name.xml + push: tag-attribute-separator-key-value + + tag-attribute-separator-key-value: + - match: '=' + scope: punctuation.separator.key-value.xml + set: + - include: string-quoted-pop + - match: '[^?/<>\s]+' + scope: invalid.illegal.bad-attribute-value.xml + pop: true + - include: tag-else-pop + - include: tag-else-pop + + tag-else-pop: + # pop, if nothing else matched and ensure `tag-end-missing-pop` works + - match: (?=\s?<|\S) + pop: true + + tag-end-missing-pop: + # pop, if the next opening tag is following, while scoping the + # preceding space to give a hint about the unclosed tag + - match: \s?(?=<) + scope: invalid.illegal.missing-tag-end.xml + pop: true + +###[ CONSTANTS ]############################################################## + + entity: + - match: (&#[xX])\h+(;) + scope: constant.character.entity.hexadecimal.xml + captures: + 1: punctuation.definition.entity.xml + 2: punctuation.terminator.entity.xml + - match: (&#)[0-9]+(;) + scope: constant.character.entity.decimal.xml + captures: + 1: punctuation.definition.entity.xml + 2: punctuation.terminator.entity.xml + - match: (&){{name}}(;) + scope: constant.character.entity.named.xml + captures: + 1: punctuation.definition.entity.xml + 2: punctuation.terminator.entity.xml + + should-be-entity: + - match: '&' + scope: invalid.illegal.bad-ampersand.xml + - match: '<' + scope: invalid.illegal.missing-entity.xml + + string-unquoted: + - match: '{{name}}' + scope: string.unquoted.xml + + string-unquoted-pop: + - match: '{{name}}' + scope: string.unquoted.xml + pop: true + + string-quoted: + - include: string-double-quoted + - include: string-single-quoted + + string-quoted-pop: + - include: string-double-quoted-pop + - include: string-single-quoted-pop + + string-double-quoted: + - match: '"' + scope: punctuation.definition.string.begin.xml + push: string-double-quoted-body + + string-double-quoted-pop: + - match: '"' + scope: punctuation.definition.string.begin.xml + set: string-double-quoted-body + + string-double-quoted-body: + - meta_scope: string.quoted.double.xml + - match: '"' + scope: punctuation.definition.string.end.xml + pop: true + - include: tag-end-missing-pop + - include: entity + - include: should-be-entity + + string-single-quoted: + - match: "'" + scope: punctuation.definition.string.begin.xml + push: string-single-quoted-body + + string-single-quoted-pop: + - match: "'" + scope: punctuation.definition.string.begin.xml + set: string-single-quoted-body + + string-single-quoted-body: + - meta_scope: string.quoted.single.xml + - match: "'" + scope: punctuation.definition.string.end.xml + pop: true + - include: tag-end-missing-pop + - include: entity + - include: should-be-entity + diff --git a/assets/syntaxes/Packages/XML/syntax_test_xml.xml b/assets/syntaxes/Packages/XML/syntax_test_xml.xml new file mode 100644 index 000000000..8db0895a6 --- /dev/null +++ b/assets/syntaxes/Packages/XML/syntax_test_xml.xml @@ -0,0 +1,1925 @@ +## SYNTAX TEST "Packages/XML/XML.sublime-syntax" + + +<!-- + XML Preprocessor + --> + + <!-- + The absense of attributes does not render the tagname invalid + even though this is no valid declaration + --> + + <?xml?> +## ^ - meta.tag.preprocessor +## ^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml +## ^ - meta.tag - invalid.illegal.missing-tag-end +## ^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag + + <?xml version +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name + + <?xml version= +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value + + <?xml version="1.0" +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end + + <?xml version="1.0" ?> +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml version= encoding standalone?> +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^ invalid.illegal.bad-attribute-value +## ^^^^^^^^^^ entity.other.attribute-name +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml version=encoding standalon??> +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^ invalid.illegal.bad-attribute-value +## ^^^^^^^^^^ invalid.illegal.bad-attribute-name +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml version=encoding standalone ?> +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^ invalid.illegal.bad-attribute-value +## ^^^^^^^^^^ entity.other.attribute-name +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml version=encoding= standalone= ?> +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^^ invalid.illegal.bad-attribute-value +## ^ - punctuation.separator.key-value +## ^^^^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml version = encoding=utf8 standalone=true?> +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^^^^^^ invalid.illegal.bad-attribute-value +## ^ - punctuation.separator.key-value +## ^^^^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^ invalid.illegal.bad-attribute-value +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml +## ^ - meta.tag - invalid.illegal.missing-tag-end +## ^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag + ?> +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml +## ^ - meta.tag - invalid.illegal.missing-tag-end +## ^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag + version +## ^^^^^^^ entity.other.attribute-name + ?> +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml +## ^ - meta.tag - invalid.illegal.missing-tag-end +## ^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag + version +## ^^^^^^^ entity.other.attribute-name + = +## ^ punctuation.separator.key-value + ?> +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml +## ^ - meta.tag - invalid.illegal.missing-tag-end +## ^ - meta.tag.preprocessor +## ^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag + version="1.0" +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end + ?> +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <!-- + Mixed- or uppercase XML prolog names are not well-formed. + Handle <?...?> normally but highlight invalid tag name. + --> + + <?XML?> +## ^ - meta.tag.preprocessor +## ^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ invalid.illegal.bad-tag-name +## ^^ punctuation.definition.tag.end + + <?Xml?> +## ^ - meta.tag.preprocessor +## ^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ invalid.illegal.bad-tag-name +## ^^ punctuation.definition.tag.end + + <?XML version="1.0" ?> +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ invalid.illegal.bad-tag-name +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end +## ^^ punctuation.definition.tag.end + + +<!-- + XML Stylesheet Preprocessor + --> + + <!-- + The absense of attributes does not render the tagname invalid + even though this is no valid declaration + --> + + <?xml-stylesheet?> +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^ entity.name.tag +## ^^ punctuation.definition.tag.end + + <?xml-stylesheet type='text/xsl' href='freb.xsl'?> +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^ entity.name.tag +## ^ - entity +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^^^^^^ string.quoted.single +## ^ punctuation.definition.string.end +## ^ - string + + <?xml-stylesheet +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^ entity.name.tag + ?> +## ^^ meta.tag.preprocessor punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <?xml-stylesheet +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^ entity.name.tag +## ^ - entity + type='text/xsl' +## ^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^^^^^^ string.quoted.single +## ^ punctuation.definition.string.end +## ^ - string + href = 'freb.xsl' +## ^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^^^^^^ string.quoted.single +## ^ punctuation.definition.string.end +## ^ - string + ?> +## ^^ meta.tag.preprocessor punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <!-- + Mixed- or uppercase XML prolog names are not well-formed. + Handle <?...?> normally but highlight invalid tag name. + --> + + <?xml-stYlesheet type='text/xsl' href='freb.xsl'?> +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^ invalid.illegal.bad-tag-name +## ^ - entity +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^^^^^^ string.quoted.single +## ^ punctuation.definition.string.end +## ^ - string + + +<!-- + XML Model Preprocessor + --> + + <!-- + The absense of attributes does not render the tagname invalid + even though this is no valid declaration + --> + + <?xml-model?> +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^ entity.name.tag +## ^^ punctuation.definition.tag.end + + <?xml-model href="http://www.oxygenxml.com/docbook/xml/5.0/rng/dbmathmlsvg.rng" schematypens="http://relaxng.org/ns/structure/1.0"?> +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^ entity.name.tag +## ^ - entity +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +## ^^ punctuation.definition.tag.end + + <?xml-model +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^ meta.tag.preprocessor +## ^^^^^^^^^ entity.name.tag +## ^ - entity + href="http://www.oxygenxml.com/docbook/xml/5.0/rng/dbmathmlsvg.rng" +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double + schematypens="http://relaxng.org/ns/structure/1.0"?> +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +<!-- + XML Custom Preprocessor + --> + + <!-- + The XML specification currently knows about the following declarations: + <?xml ...?> + <?xml-model ...?> + <?xml-stylesheet ...?> + + To be future proof, this syntax handles any kind of lower case + <?xml-...?> as valid declaration. + --> + + <?xml-third-party_preprocessor name = "foo" ?> +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag +## ^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^ string.quoted.double +## ^^ punctuation.definition.tag.end + + +<!-- + DOCTYPE Declaration + --> + + <!DOCTYPE +## ^ - meta.tag.sgml.doctype +## ^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype + + <!DOCTYPE SYSTEM +## ^ meta.tag.sgml.doctype invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^ - entity - constant - keyword +## ^^^^^^ variable.other.documentroot + + <!DOCTYPE SYSTEM "uri" +## ^ meta.tag.sgml.doctype invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^ - entity - constant - keyword +## ^^^^^^ variable.other.documentroot +## ^^^^^ string.quoted.double + + <!DOCTYPE SYSTEM SYSTEM +## ^ meta.tag.sgml.doctype invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^ - entity - constant +## ^^^^^^ variable.other.documentroot +## ^ - constant - keyword +## ^^^^^^ storage.type.external-content + + <!DOCTYPE SYSTEM SYSTEM "uri" +## ^ meta.tag.sgml.doctype invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^ - entity - constant +## ^^^^^^ variable.other.documentroot +## ^ - constant - keyword +## ^^^^^^ storage.type.external-content +## ^^^^^ string.quoted.double + + <!DOCTYPE ns:tag +## ^ meta.tag.sgml.doctype invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^ - entity - constant +## ^^ variable.other.documentroot.namespace +## ^ variable.other.documentroot punctuation.separator.namespace +## ^^^ variable.other.documentroot.localname + + <!DOCTYPE ns:tag SYSTEM +## ^ meta.tag.sgml.doctype invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^ - entity - constant +## ^^ variable.other.documentroot.namespace +## ^ variable.other.documentroot punctuation.separator.namespace +## ^^^ variable.other.documentroot.localname +## ^ - constant - keyword +## ^^^^^^ storage.type.external-content + + <!DOCTYPE -s:tag SYSTEM "-//W3C//DTD +## ^ meta.tag.sgml.doctype invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^ - entity - constant +## ^^ invalid.illegal.bad-tag-name +## ^ variable.other.documentroot punctuation.separator.namespace +## ^^^ variable.other.documentroot.localname +## ^ - constant - keyword +## ^^^^^^ storage.type.external-content +## ^^^^^^^^^^^^^ string.quoted.double + + <!DOCTYPE root PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/1999/xhtml"> +## ^ meta.tag.sgml.doctype string.quoted.double invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^ - meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^ - entity - constant +## ^^^^ variable.other.documentroot +## ^ - constant - keyword +## ^^^^^^ storage.type.external-content +## ^ - keyword - string +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +## ^ - string +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +## ^ punctuation.definition.tag.end - string + + <!DOCTYPE root SYSTEM "url" /> +## ^^ meta.tag.sgml.doctype invalid.illegal.bad-tag-end +## ^ - meta.tag.sgml.doctype + + <!DOCTYPE root SYSTEM "url" ?> +## ^^ meta.tag.sgml.doctype invalid.illegal.bad-tag-end +## ^ - meta.tag.sgml.doctype + + <!DOCTYPE ROOT PUBLIC "FPI" "URL" "don't care" [<!ATTLIST ]> +## ^ - meta.tag.sgml.doctype +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^ - meta.brackets - meta.internal-subset +## ^^^^^^^^^^^^ meta.brackets meta.internal-subset +## ^ - meta.brackets - meta.internal-subset +## ^ string.quoted.double +## ^ string.quoted.double +## ^ string.quoted.double +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end +## ^ punctuation.definition.tag.end +## ^ - meta.tag.sgml.doctype + + <!DOCTYPE ROOT SYSTEM "URL" "don't-care" [<!ENTITY ]> +## ^ - meta.tag.sgml.doctype +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^ - meta.brackets - meta.internal-subset +## ^^^^^^^^^^^ meta.brackets meta.internal-subset +## ^ - meta.brackets - meta.internal-subset +## ^ - meta.tag.sgml.doctype +## ^ string.quoted.double +## ^ string.quoted.double +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end +## ^ punctuation.definition.tag.end +## ^ - meta.tag.sgml.doctype + + <!DOCTYPE root [<!ENTITY br "\n"> %name; <!-- comment --> ]> +## ^ - meta.tag.sgml.doctype +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.brackets.xml meta.internal-subset +## ^ - meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^^^^ variable.other.documentroot +## ^ - constant - keyword - punctuation +## ^ punctuation.section.brackets.begin +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^^ variable.other.entity +## ^ punctuation.definition.parameter +## ^^^^ variable.parameter +## ^ punctuation.terminator.parameter +## ^^^^^^^^^^^^^^^^ comment.block +## ^^^^ punctuation.definition.comment.begin +## ^^^ punctuation.definition.comment.end +## ^ punctuation.section.brackets.end +## ^ punctuation.definition.tag.end + +<!DOCTYPE data [ +## ^ keyword.declaration.doctype +## ^ variable.other.documentroot + +<!-- + XML processing instructions + --> + + <?pi "markup" is <ignored>?> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +<!-- + DTD Entities + --> + + <!ENTITY auml "ä"> +## ^ - meta.tag.sgml.entity +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^ - meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^^^^ variable.other.entity +## ^^^^^^^^ string.quoted.double +## ^ punctuation.definition.tag.end + + <!ENTITY<!ENTITY <!ENTITY +## ^ - meta.tag.sgml.entity +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ invalid.illegal.missing-tag-end +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity + + <!ENTITY % +## ^ meta.tag.sgml.entity invalid.illegal.missing-tag-end +## ^^^^^^^^^^^ meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ punctuation.definition.entity + + <!ENTITY % entiy-name +## ^ meta.tag.sgml.entity invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ punctuation.definition.entity +## ^^^^^^^^^^ variable.other.entity + + <!ENTITY % entiy-name<!ENTITY +## ^ meta.tag.sgml.entity invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ punctuation.definition.entity +## ^^^^^^^^^^ variable.other.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity + + <!ENTITY % n$=?me<!ENTITY +## ^ meta.tag.sgml.entity invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ punctuation.definition.entity +## ^^^^^^ invalid.illegal.bad-identifier +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity + + <!ENTITY % PUBLIC +## ^ meta.tag.sgml.entity invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ punctuation.definition.entity +## ^^^^^^ variable.other.entity + + <!ENTITY % enity-name PUBLIC +## ^ meta.tag.sgml.entity invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ punctuation.definition.entity +## ^^^^^^^^^^ variable.other.entity +## ^^^^^^ storage.type.external-content + + <!ENTITY % enity-name PUBLIC "URL +## ^ meta.tag.sgml.entity invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ punctuation.definition.entity +## ^^^^^^^^^^ variable.other.entity +## ^^^^^^ storage.type.external-content +## ^^^^^ string.quoted.double + + <!ENTITY % enity-name PUBLIC "URL" "uri" NDATA jpeg> +## ^ meta.tag.sgml.entity invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^ - meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ punctuation.definition.entity +## ^^^^^^^^^^ variable.other.entity +## ^^^^^^ storage.type.external-content +## ^^^^^ string.quoted.double +## ^^^^^ string.quoted.double +## ^^^^^ storage.type.ndata +## ^^^^ string.unquoted +## ^ punctuation.definition.tag.end + + +<!-- + DTD Elements + --> + + <!ELEMENT +## ^ - meta.tag.sgml.element +## ^^^^^^^^^^ meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable + + <!ELEMENT<!ELEMENT +## ^ meta.tag.sgml.element invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^^ punctuation.definition.tag.begin - keyword +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable + + <!ELEMENT elem.name +## ^ meta.tag.sgml.element invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element + + <!ELEMENT %entity; +## ^ meta.tag.sgml.element invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^ variable.parameter +## ^ - keyword - variable - constant - string + + <!ELEMENT elem.name ANY> +## ^ meta.tag.sgml.element invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - keyword - variable - constant - string +## ^^^ constant.other +## ^ punctuation.definition.tag.end + + <!ELEMENT elem.name EMPTY> +## ^ - meta.tag.sgml.element - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - keyword - variable - constant - string +## ^^^^^ constant.other +## ^ punctuation.definition.tag.end + + <!ELEMENT elem.name "quoted content"> +## ^ - meta.tag.sgml.element - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^^^^^^^^^^^^^^^^ string.quoted.double +## ^ punctuation.definition.tag.end + + <!ELEMENT elem.name %author.content;> +## ^ - meta.tag.sgml.element - illegal +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ punctuation.definition.parameter +## ^^^^^^^^^^^^^^^^ variable.parameter +## ^ punctuation.terminator.parameter +## ^ punctuation.definition.tag.end + + <!ELEMENT elem.name (#PCDATA|str?,chr*|%ent;|(&,,¡)+)+> +## ^ - meta.tag.sgml.element - illegal +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +## ^^^^^^^^^^^^^^^^^^^^ meta.group meta.group +## ^^ meta.group +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ punctuation.definition.group.begin +## ^^^^^^^ constant.other.placeholder +## ^ punctuation.separator +## ^^^ string.unquoted +## ^ keyword.operator +## ^ punctuation.separator +## ^^^ string.unquoted +## ^ keyword.operator +## ^ punctuation.separator +## ^ punctuation.definition.parameter +## ^^^^^ variable.parameter +## ^ punctuation.terminator.parameter +## ^ punctuation.separator +## ^ punctuation.definition.group.begin +## ^ punctuation.definition.entity +## ^^^^^ constant.character.entity.named +## ^ punctuation.terminator.entity +## ^ punctuation.separator +## ^^ punctuation.definition.entity +## ^^^^^ constant.character.entity.decimal +## ^ punctuation.terminator.entity +## ^ punctuation.separator +## ^^^ punctuation.definition.entity +## ^^^^^^ constant.character.entity.hexadecimal +## ^ punctuation.terminator.entity +## ^ punctuation.definition.group.end +## ^ keyword.operator +## ^ punctuation.definition.group.end +## ^ keyword.operator +## ^ punctuation.definition.tag.end + + +<!-- + ATTLIST Tests + --> + + <!ATTLIST +## ^ - meta.tag.sgml.attlist - invalid +## ^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable + + <!ATTLIST> +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist - invalid +## ^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ punctuation.definition.tag.end + + <!ATTLIST list.name +## ^ - meta.tag.sgml.attlist - invalid +## ^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element + + <!ATTLIST list.name> +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ punctuation.definition.tag.end + + <!ATTLIST _xml:space-2> +## ^^^^^^^^^^^^ variable.other.element + + <!ATTLIST list%name> +## ^ - meta.tag.sgml.attlist - invalid +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ invalid.illegal.bad-identifier +## ^ punctuation.definition.tag.end + + <!ATTLIST list.name attr +## ^ - meta.tag.sgml.attlist - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name + + <!ATTLIST list.name attr> +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name +## ^ punctuation.definition.tag.end + + <!ATTLIST list.name attr CDATA +## ^ - meta.tag.sgml.attlist - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name +## ^ - entity - storage +## ^^^^^ storage.type.attribute + + <!ATTLIST list.name attr CDATA> +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name +## ^ - entity - storage +## ^^^^^ storage.type.attribute +## ^ punctuation.definition.tag.end + + <!ATTLIST list.name attr CDATA #IMPLI +## ^ - meta.tag.sgml.attlist - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name +## ^ - entity - storage +## ^^^^^ storage.type.attribute +## ^ - storage - constant +## ^^^^^^ - storage.modifier.attribute.default-value + + <!ATTLIST list.name attr CDATA #IMPLIED +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name +## ^ - entity - storage +## ^^^^^ storage.type.attribute +## ^ - storage - constant +## ^^^^^^^^ storage.modifier.attribute.default-value + + <!ATTLIST list.name attr CDATA #IMPLIED> +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name +## ^ - entity - storage +## ^^^^^ storage.type.attribute +## ^ - storage - constant +## ^^^^^^^^ storage.modifier.attribute.default-value +## ^ punctuation.definition.tag.end + + +<!-- + NOTATION Tests + --> + + <!NOTATION +## ^ - meta.tag.sgml.notation - invalid.illegal.missing-tag-end +## ^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^ - keyword - variable + + <!NOTATION<!NOTATION +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^^ punctuation.definition.tag.begin - keyword +## ^^^^^^^^ keyword.declaration.notation +## ^^ - keyword + + <!NOTATION PUBLIC +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^ - keyword - variable - storage +## ^^^^^^ variable.other.notation + + <!NOTATION PUBLIC PUBLIC +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^ - keyword - variable - storage +## ^^^^^^ variable.other.notation +## ^ - variable - storage +## ^^^^^^ storage.type.external-content + + <!NOTATION PUBLIC "public +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^ - keyword - variable - storage +## ^^^^^^ variable.other.notation +## ^^^^^^^^ string.quoted.double + + <!NOTATION PUBLIC PUBLIC "public +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^ - keyword - variable - storage +## ^^^^^^ variable.other.notation +## ^ - variable - storage +## ^^^^^^ storage.type.external-content +## ^^^^^^^^ string.quoted.double + + <!NOTATION name +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^ - keyword - variable +## ^^^^ variable.other.notation + + <!NOTATION name PUBLIC +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^ - keyword - variable +## ^^^^ variable.other.notation +## ^ - variable - storage +## ^^^^^^ storage.type.external-content + + <!NOTATION name PUBLIC "public +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^ - keyword - variable +## ^^^^ variable.other.notation +## ^ - variable - storage +## ^^^^^^ storage.type.external-content +## ^^^^^^^^ string.quoted.double + + <!NOTATION m$me PUBLIC "public +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^ - keyword - variable - storage +## ^^^^ invalid.illegal.bad-identifier +## ^^^^^^ storage.type.external-content +## ^^^^^^^^ string.quoted.double + + <!NOTATION name PUBLIC "public_ID" "URI"> +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^ - meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^^^^^^ storage.type.external-content +## ^^^^^^^^^^^ string.quoted.double +## ^^^^^ string.quoted.double +## ^ punctuation.definition.tag.end + + + <!-- + DTD Subsets + --> + + <![CDATA[<this is no tag>]]> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.cdata + + <![ +## ^^^ meta.tag.sgml.subset punctuation.definition.tag.begin + + <![subset-name +## ^ meta.tag.sgml.subset invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^ variable.other.subset + + <![sub?et!name +## ^ meta.tag.sgml.subset invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^ invalid.illegal.bad-identifier + + <![subset-name[] +## ^ meta.tag.sgml.subset invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^ variable.other.subset +## ^^ meta.brackets +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end + + <![sub?et!name[] +## ^ meta.tag.sgml.subset invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^ invalid.illegal.bad-identifier +## ^^ meta.brackets +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end + + <![subset-name[]> +## ^ meta.tag.sgml.subset invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^ - meta.tag.sgml.subset +## ^^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^ variable.other.subset +## ^^ meta.brackets +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end +## ^ invalid.illegal.bad-tag-end + + <![subset-name[]] +## ^ - meta.tag.sgml.subset - invalid +## ^^^^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^ variable.other.subset +## ^^ meta.brackets +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end +## ^ - punctuation + + <![subset-name[]]> +## ^ meta.tag.sgml.subset invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^ - meta.tag.sgml.subset +## ^^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^ variable.other.subset +## ^^ meta.brackets +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end +## ^^ punctuation.definition.tag.end + + <![%subset-name;[<!ELEMENT element-name 'value'><!-- comment -->]]> +## ^ - meta.tag.sgml.subset - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.internal-subset meta.internal-subset +## ^^^ punctuation.definition.tag.begin +## ^ punctuation.definition.parameter +## ^^^^^^^^^^^^^ variable.parameter +## ^ punctuation.terminator.parameter +## ^ punctuation.section.brackets.begin +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^^^^^^^^^^^^ variable.other.element +## ^ punctuation.definition.string.begin +## ^^^^^^ string.quoted.single +## ^ punctuation.definition.string.end +## ^ punctuation.definition.tag.end +## ^^^^^^^^^^^^^^^^ comment.block +## ^ punctuation.section.brackets.end +## ^^ punctuation.definition.tag.end + +<!-- + UNKNOWN Tests + --> + + <!attlist +## ^^^^^^^^^^ meta.tag.sgml.unknown +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ invalid.illegal.bad-tag-name +## ^ - keyword - variable + + <!attlist name content> +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.unknown +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ invalid.illegal.bad-tag-name +## ^^^^ invalid.illegal.unexpected +## ^^^^^^^ invalid.illegal.unexpected + + <!element +## ^^^^^^^^^^ meta.tag.sgml.unknown +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ invalid.illegal.bad-tag-name + + <!element name content> +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.unknown +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ invalid.illegal.bad-tag-name +## ^^^^ invalid.illegal.unexpected +## ^^^^^^^ invalid.illegal.unexpected + + <!entity +## ^^^^^^^^^ meta.tag.sgml.unknown +## ^^ punctuation.definition.tag.begin +## ^^^^^^ invalid.illegal.bad-tag-name + + <!entity name content> +## ^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.unknown +## ^^ punctuation.definition.tag.begin +## ^^^^^^ invalid.illegal.bad-tag-name +## ^^^^ invalid.illegal.unexpected +## ^^^^^^^ invalid.illegal.unexpected + +]> + + <!doctype > +## ^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ invalid.illegal.bad-tag-name +## ^ punctuation.definition.tag.end + +<!-- + Comments + --> + + <!-- A Comment! --> +## ^^^^ punctuation.definition.comment.begin +## ^ - punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^ - comment.block + + <!-- tags and character entities inside me will be ignored <foobar hello="world" /> & <unclosed <!-- --> +## ^^^^ punctuation.definition.comment.begin +## ^ - punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block - meta.tag - constant.character.entity +## ^^^ punctuation.definition.comment.end +## ^ - comment.block +## ^^^^ - punctuation.definition + + <!-- <![CDATA[[ignored --> +## ^^^^ punctuation.definition.comment.begin +## ^ - punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block - string.unquoted.cdata +## ^^^ punctuation.definition.comment.end +## ^ - comment.block + + <!-- multi + line + comment --> +## <- comment.block +## ^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^ - comment.block + + <!-- comments containing double hyphens -- are illegal and can't be ended with more than 2 hyphens --->, so should end here: --> +## ^^ comment.block invalid.illegal.double-hyphen-within-comment +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block - invalid +## ^^^ comment.block invalid.illegal.double-hyphen-within-comment +## ^^^ comment.block punctuation.definition.comment.end +## ^ - comment + + +<!-- + Elements / Tags + --> + <ns +## ^ - meta.tag - invalid.illegal.missing-tag-end +## ^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.localname + + <ns: +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ invalid.illegal.bad-tag-name + + <:tagname +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^^^^^^^ invalid.illegal.bad-tag-name + + <ns:tagname +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname + + <ns:tagname xmlns +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^^^^^ entity.other.attribute-name.localname + + <ns:tagname xmlns: +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^^^^^^ invalid.illegal.bad-attribute-name + + <ns:tagname xmlns:ns +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^^^^^ entity.other.attribute-name.namespace +## ^ punctuation.separator.namespace +## ^^ entity.other.attribute-name.localname + + <ns:tagname xmlns:ns= +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^^^^^ entity.other.attribute-name.namespace +## ^ punctuation.separator.namespace +## ^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value + + <ns:tagname xmlns:ns="uri" +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^ - entity +## ^^^^^ entity.other.attribute-name.namespace +## ^ punctuation.separator.namespace +## ^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end + + <ns:tagname xmlns:ns="uri"> +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^ - entity +## ^^^^^ entity.other.attribute-name.namespace +## ^ punctuation.separator.namespace +## ^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end +## ^ punctuation.definition.tag.end + + <ns:tagname +## ^ - meta.tag - invalid.illegal +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname + xmlns +## ^^^^^ entity.other.attribute-name.localname + + <ns:tagname +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname + xmlns: +## ^^^^^^ invalid.illegal.bad-attribute-name + + <ns:tagname +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname + xmlns:ns +## ^^^^^ entity.other.attribute-name.namespace +## ^ punctuation.separator.namespace +## ^^ entity.other.attribute-name.localname + + <ns:tagname +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname + xmlns:ns +## ^^^^^ entity.other.attribute-name.namespace +## ^ punctuation.separator.namespace +## ^^ entity.other.attribute-name.localname + = +## ^ punctuation.separator.key-value + + <ns:tagname +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^ - entity + xmlns:ns +## ^^^^^ entity.other.attribute-name.namespace +## ^ punctuation.separator.namespace +## ^^ entity.other.attribute-name.localname + = +## ^ punctuation.separator.key-value + + <ns:tagname +## ^ meta.tag invalid.illegal.missing-tag-end +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^ - entity + xmlns:ns +## ^^^^^ entity.other.attribute-name.namespace +## ^ punctuation.separator.namespace +## ^^ entity.other.attribute-name.localname + = + "uri" +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end + > +## ^ punctuation.definition.tag.end +## ^ - meta.tag + + <ns:tagname <!-- a comment is a next tag --> > +## ^ - meta.tag +## ^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^ invalid.illegal.missing-tag-end - entity +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^ - punctuation.definition.tag.end + + <foo <!-- a comment is a next tag --> > +## ^ - meta.tag +## ^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^ - punctuation.definition.tag.end + + <foo bar <!-- a comment is a next tag --> bar="baz" /> +## ^ - meta.tag +## ^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^^^ entity.other.attribute-name.localname +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double +## ^^ - punctuation.definition.tag.end + + <foo bar= <!-- a comment is a next tag --> bar="baz" /> +## ^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double +## ^^ - punctuation.definition.tag.end + + <foo bar="baz <!-- a comment is a next tag --> bar="baz" /> +## ^ - meta.tag +## ^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^ string.quoted.double +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double +## ^^ - punctuation.definition.tag.end + + <foo bar="baz" <!-- a comment is a next tag --> bar="baz" /> +## ^ - meta.tag +## ^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^ string.quoted.double +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double +## ^^ - punctuation.definition.tag.end + + <foo +## ^ - meta.tag +## ^^^^^ meta.tag + bar +## ^^^ entity.other.attribute-name.localname + <!-- a comment is a next tag --> +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end + bar="baz" +## ^^^^^^^^^ text +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double + /> +## ^^ text - punctuation.definition.tag.end + + <foo +## ^ - meta.tag +## ^^^^^ meta.tag + bar= +## ^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value + <!-- a comment is a next tag --> +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end + bar="baz" +## ^^^^^^^^^ text +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double + /> +## ^^ text - punctuation.definition.tag.end + + <foo +## ^ - meta.tag +## ^^^^^ meta.tag + bar="baz" +## ^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^ string.quoted.double + <!-- a comment is a next tag --> +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end + bar="baz" +## ^^^^^^^^^ text +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double + /> +## ^^ text - punctuation.definition.tag.end + + text +## ^^^^ text + > +## ^ text - punctuation - illegal + + <![CDATA[<!DOCTYPE catalog plist "dtd">]]> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.cdata +## ^^^ punctuation.definition.tag.begin +## ^^^^^ keyword.declaration.cdata +## ^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.cdata +## ^ - string.unquoted.cdata +## ^^^ punctuation.definition.tag.end + <![CDATA[ +## ^^^^^^^^^^ meta.tag.sgml.cdata +## ^^^ punctuation.definition.tag.begin +## ^^^^^ keyword.declaration.cdata +## ^ punctuation.definition.tag.begin + <!DOCTYPE catalog plist "dtd"> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.cdata + ]]> +## ^ - string.unquoted.cdata +## ^^^ punctuation.definition.tag.end + + <![CDATA[ + <![CDATA[ unparsed! ]]> +## ^^^^^^^^^^^^^^^^^^^^ string.unquoted.cdata +## ^^^ - punctuation.definition.tag.begin +## ^^^^^ - keyword.declaration.cdata +## ^ - punctuation.definition.tag.begin +## ^^^ punctuation.definition.tag.end + ]]> +## ^^^ - punctuation - invalid.illegal.missing-entity.xml + + <?pi "markup" is <ignored>?> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + <таĝñäᴹə ατţř="șƬűʃ⨍" >Contents</таĝñäᴹə> +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^^^^^^ entity.name.tag.localname +## ^ - entity.name.tag.localname +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value - entity.other.attribute-name.localname +## ^^^^^^^ string.quoted +## ^ - string.quoted - punctuation.definition +## ^ punctuation.definition.tag.end +## ^^^^^^^^ text - meta.tag +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^ meta.tag +## ^^^^^^^ entity.name.tag.localname +## ^ punctuation.definition.tag.end +## ^ - meta.tag + + <example ñș:äpos ='''/> +## ^ punctuation.definition.tag.begin +## ^^ punctuation.definition.tag.end - string +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^^ entity.other.attribute-name.namespace +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^^^^ string.quoted.single +## ^ punctuation.definition.string.begin +## ^ punctuation.definition.string.end +## ^^^^^ constant.character.entity + + </ns +## ^ - meta.tag - invalid.illegal.missing-tag-end +## ^^^^ meta.tag +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.localname + + </ns: +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^ meta.tag +## ^^ punctuation.definition.tag.begin +## ^^^ invalid.illegal.bad-tag-name + + </:tagname +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^^ meta.tag +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ invalid.illegal.bad-tag-name + + </ns:tagname +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^ meta.tag +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname + + </ns:tagname> +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^ punctuation.definition.tag.end + + </ns:tagname/> +## ^ - meta.tag - invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^ meta.tag +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^^ invalid.illegal.bad-tag-end + + </ns:tagname attr="Value" /> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^^^^^^^^^^^^ invalid.illegal.unexpected-attribute +## ^^ invalid.illegal.bad-tag-end + + </ns:tagname attr="Value" ?> +## ^^ meta.tag invalid.illegal.bad-tag-end + + <element attr_with.space = "value" /> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^^^^^ entity.name.tag.localname +## ^^^^^^^^^^^^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^^^ string.quoted.double +## ^ punctuation.definition.string.end +## ^^ punctuation.definition.tag.end + + <element validinattr="a > b ]]> c"/> +## ^^^^^^^^^^^ string.quoted - punctuation - illegal + + <foo +## ^ - meta.tag +## ^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +bar="baz" /> +##^^^^^^^^^^ meta.tag +## ^ - meta.tag +##^ entity.other.attribute-name.localname +## ^^^^^ string.quoted.double +## ^ - string.quoted.double + + <foo +## ^ - meta.tag +## ^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname + bar = "baz" /> +##^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^^^ entity.other.attribute-name.localname +## ^^^^^ string.quoted.double +## ^ - string.quoted.double +## ^^ punctuation.definition.tag.end + + <foo +## ^ - meta.tag +## ^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname + bar +## ^^^ entity.other.attribute-name.localname +##^^^^^^^^ meta.tag + = + "baz" +##^^^^^^^^^^ meta.tag +## ^ - string.quoted.double +## ^^^^^ string.quoted.double +## ^ - string.quoted.double + /> +##^^^^^^ meta.tag +## ^^ punctuation.definition.tag.end +## ^ - meta.tag + + <xs:sequence/> +## ^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^^ entity.name.tag.localname +## ^^ punctuation.definition.tag.end + + <xs:sequence + /> +## ^^ meta.tag punctuation.definition.tag.end +## ^ - meta.tag + +<!-- + Entities + --> + + & +## ^ punctuation.definition.entity +## ^^^ - punctuation.definition.entity +## ^^^^^ constant.character.entity +## ^ punctuation.terminator.entity +## ^ - constant.character.entity - punctuation.definition.entity + + &ut-d-att_da; +## ^ punctuation.definition.entity +## ^^^ - punctuation.definition.entity +## ^^^^^^^^^^^^^ constant.character.entity +## ^ punctuation.terminator.entity +## ^ - constant.character.entity - punctuation.definition.entity + +   +## ^ punctuation.definition.entity +## ^^^ - punctuation.definition.entity +## ^^^^^^ constant.character.entity +## ^ punctuation.terminator.entity +## ^ - constant.character.entity + + © +## ^ punctuation.definition.entity +## ^^ - punctuation.definition.entity +## ^^^^^^ constant.character.entity +## ^ punctuation.terminator.entity +## ^ - constant.character.entity + + %no-parameter; +## ^^^^^^^^^^^^^^ - variable.parameter + + <!-- & --> +## ^ - punctuation.definition.entity + + <example attr=""test"" /> +## ^^^^^^^^^^^^^^^^^^ string.quoted.double +## ^ - string.quoted.double +## ^^^^^^ constant.character.entity +## ^^^^^^ constant.character.entity + +<!-- + Illegals + --> + + & +## ^ invalid.illegal.bad-ampersand +## ^ - invalid.illegal.bad-ampersand + + <1tag></-tag> +## ^^^^ invalid.illegal - entity.name.tag +## ^^^^ invalid.illegal - entity.name.tag +## ^ punctuation.definition.tag.end +## ^ punctuation.definition.tag.begin +## ^ punctuation.definition.tag.end +## ^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag + + <1tag attr1="ok" 2attr="nope"></-tag> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^^^ invalid.illegal - entity.name.tag +## ^^^^^^^^^^^^ - invalid.illegal - entity.name.tag +## ^^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^ string.quoted +## ^^^^^ invalid.illegal - entity.other.attribute-name.localname +## ^^^^^ string.quoted +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin +## ^^^^ invalid.illegal - entity.name.tag +## ^ punctuation.definition.tag.end +## ^ - meta.tag + + < +## ^ invalid.illegal.missing-entity +## ^ - invalid.illegal.missing-entity + + ]]> +## ^^^ - punctuation - invalid.illegal.missing-entity + + <ns::tag ns::attr1="na" ns:2a?tr = "nope"></ns:t:ag> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^ invalid.illegal.bad-tag-name - entity.name.tag +## ^^ entity.other.attribute-name.namespace +## ^ entity.other.attribute-name.xml punctuation.separator.namespace.xml +## ^^^^^^ invalid.illegal.bad-attribute-name - entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^ string.quoted +## ^^ entity.other.attribute-name.namespace +## ^ entity.other.attribute-name.xml punctuation.separator.namespace.xml +## ^^^^^ invalid.illegal.bad-attribute-name - entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^ string.quoted +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace.xml +## ^^^^ invalid.illegal.bad-tag-name - entity.name.tag +## ^ punctuation.definition.tag.end +## ^ - meta.tag + + <-ns:tag -ns:attr="value">content <!-- comment --></-ns:tag> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ - entity - illegal +## ^^^ invalid.illegal.bad-attribute-name +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ punctuation.definition.tag.end + + <1ns:tag 1ns:attr="value">content <!-- comment --></1ns:tag> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ - entity - illegal +## ^^^ invalid.illegal.bad-attribute-name +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ punctuation.definition.tag.end + + <n!s:tag n!s:attr="value">content <!-- comment --></n!s:tag> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ - entity - illegal +## ^^^ invalid.illegal.bad-attribute-name +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ punctuation.definition.tag.end + + <n?s:tag N?s:attr="value">content <!-- comment --></n?s:tag> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ - entity - illegal +## ^^^ invalid.illegal.bad-attribute-name +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ punctuation.definition.tag.end diff --git a/assets/syntaxes/Packages/YAML/Comments.tmPreferences b/assets/syntaxes/Packages/YAML/Comments.tmPreferences new file mode 100644 index 000000000..96d485ff3 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/Comments.tmPreferences @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>source.yaml</string> + <key>settings</key> + <dict> + <key>shellVariables</key> + <array> + <dict> + <key>name</key> + <string>TM_COMMENT_START</string> + <key>value</key> + <string># </string> + </dict> + </array> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/YAML/Indentation Rules.tmPreferences b/assets/syntaxes/Packages/YAML/Indentation Rules.tmPreferences new file mode 100644 index 000000000..9f23049a0 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/Indentation Rules.tmPreferences @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>scope</key> + <string>source.yaml - string - comment</string> + <key>settings</key> + <dict> + <key>increaseIndentPattern</key> + <string>^.*[:\[{]\s*$</string> + <key>decreaseIndentPattern</key> + <string>^\s*[\]}]</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/YAML/Symbol List.tmPreferences b/assets/syntaxes/Packages/YAML/Symbol List.tmPreferences new file mode 100644 index 000000000..9f5bcc611 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/Symbol List.tmPreferences @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>scope</key> + <string>entity.name.other.anchor.yaml</string> + <key>settings</key> + <dict> + <!-- Not indexed because YAML anchors are file-local --> + <key>showInSymbolList</key> + <string>1</string> + </dict> +</dict> +</plist> diff --git a/assets/syntaxes/Packages/YAML/YAML.sublime-settings b/assets/syntaxes/Packages/YAML/YAML.sublime-settings new file mode 100644 index 000000000..2fce91952 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/YAML.sublime-settings @@ -0,0 +1,8 @@ +{ + // YAML mandates that tabs aren't used for indentation + "translate_tabs_to_spaces": true, + + // In practice, editing YAML files with anything other than two space + // indentation is tedious, due to the "- " list prefix + "tab_size": 2, +} diff --git a/assets/syntaxes/Packages/YAML/YAML.sublime-syntax b/assets/syntaxes/Packages/YAML/YAML.sublime-syntax new file mode 100644 index 000000000..b9db2c190 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/YAML.sublime-syntax @@ -0,0 +1,614 @@ +%YAML 1.2 +# The MIT License (MIT) +# +# Copyright (c) 2015 FichteFoll <fichtefoll2@googlemail.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# +# This syntax definition +# is based on http://yaml.org/spec/1.2/spec.html, +# which also serves as a base for variables. +# References have been included where appropriate. +# +# Acknowledgements: +# - Most indentation is not checked, +# except for block scalars, +# where it is also not verified +# (i.e. highlights even if less indentation used than required). +# - Properties are sometimes incorrectly highlighted +# for nested block collections (`- !!seq -`). +--- +name: YAML +file_extensions: + - yaml + - yml + - sublime-syntax +first_line_match: ^%YAML( ?1.\d+)? # Technically the number is required, but we'll be a bit loose here +scope: source.yaml + +############################################################################## + +variables: + # General + s_sep: '[ \t]+' # actually s-separate-in-line + c_indicator: '[-?:,\[\]{}#&*!|>''"%@`]' + c_flow_indicator: '[\[\]{},]' + ns_word_char: '[0-9A-Za-z\-]' + ns_uri_char: '(?x: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&=+$,_.!~*''()\[\]] )' + + # Tag stuff + c_tag_handle: (?:!(?:{{ns_word_char}}*!)?) + ns_tag_char: '(?x: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&=+$_.~*''()] )' # ns-uri-char - "!" - c-flow-indicator + ns_tag_prefix: |- # "!" ns-uri-char* | ns-tag-char ns-uri-char* + (?x: + ! {{ns_uri_char}}* + | (?![,!\[\]{}]) {{ns_uri_char}}+ + ) + c_ns_tag_property: |- # c-verbatim-tag | c-ns-shorthand-tag | c-non-specific-tag + (?x: + ! < {{ns_uri_char}}+ > + | {{c_tag_handle}} {{ns_tag_char}}+ + | ! + ) + + # Anchor & Alias + ns_anchor_char: '[^\s\[\]/{/},]' + ns_anchor_name: '{{ns_anchor_char}}+' + + # double-quoted scalar + c_ns_esc_char: \\(?:[0abtnvfre "/\\N_Lp]|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|U[\dA-Fa-f]{8}) + + # plain scalar begin and end patterns + ns_plain_first_plain_in: |- # c=plain-in + (?x: + [^\s{{c_indicator}}] + | [?:-] [^\s{{c_flow_indicator}}] + ) + + ns_plain_first_plain_out: |- # c=plain-out + (?x: + [^\s{{c_indicator}}] + | [?:-] \S + ) + + _flow_scalar_end_plain_in: |- # kind of the negation of nb-ns-plain-in-line(c) c=plain-in + (?x: + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + | \s* : {{c_flow_indicator}} + | \s* {{c_flow_indicator}} + ) + ) + + _flow_scalar_end_plain_out: |- # kind of the negation of nb-ns-plain-in-line(c) c=plain-out + (?x: + (?= + \s* $ + | \s+ \# + | \s* : (\s|$) + ) + ) + + # patterns for plain scalars of implicit different types + # (for the Core Schema: http://www.yaml.org/spec/1.2/spec.html#schema/core/) + _type_null: (?:null|Null|NULL|~) # http://yaml.org/type/null.html + _type_bool: |- # http://yaml.org/type/bool.html + (?x: + y|Y|yes|Yes|YES|n|N|no|No|NO + |true|True|TRUE|false|False|FALSE + |on|On|ON|off|Off|OFF + ) + _type_int: |- # http://yaml.org/type/int.html + (?x: + ([-+]? (0b) [0-1_]+) # (base 2) + | ([-+]? (0) [0-7_]+) # (base 8) + | ([-+]? (?: 0|[1-9][0-9_]*)) # (base 10) + | ([-+]? (0x) [0-9a-fA-F_]+) # (base 16) + | ([-+]? [1-9] [0-9_]* (?: :[0-5]?[0-9])+) # (base 60) + ) + _type_float: |- # http://yaml.org/type/float.html + (?x: + ([-+]? (?: [0-9] [0-9_]*)? (\.) [0-9.]* (?: [eE] [-+] [0-9]+)?) # (base 10) + | ([-+]? [0-9] [0-9_]* (?: :[0-5]?[0-9])+ (\.) [0-9_]*) # (base 60) + | ([-+]? (\.) (?: inf|Inf|INF)) # (infinity) + | ( (\.) (?: nan|NaN|NAN)) # (not a number) + ) + _type_timestamp: |- # http://yaml.org/type/timestamp.html + (?x: + \d{4} (-) \d{2} (-) \d{2} # (y-m-d) + | \d{4} # (year) + (-) \d{1,2} # (month) + (-) \d{1,2} # (day) + (?: [Tt] | [ \t]+) \d{1,2} # (hour) + (:) \d{2} # (minute) + (:) \d{2} # (second) + (?: (\.)\d*)? # (fraction) + [ \t]* + (?: + Z | [-+] \d{1,2} (?: (:)\d{1,2})? + )? # (time zone) + ) + + _type_value: '=' # http://yaml.org/type/value.html + _type_merge: '<<' # http://yaml.org/type/merge.html + + _type_all: |- + (?x: + ({{_type_null}}) + | ({{_type_bool}}) + | ({{_type_int}}) + | ({{_type_float}}) + | ({{_type_timestamp}}) + | ({{_type_value}}) + | ({{_type_merge}}) + ) + +############################################################################## + +contexts: + prototype: + - include: comment + - include: property + + main: + - include: directive + - match: ^--- + scope: entity.other.document.begin.yaml + - match: ^\.{3} + scope: entity.other.document.end.yaml + - include: node + # Use this for debugging. It should not match anything. + # - match: \S + # scope: invalid.illegal.unmatched.yaml + + node: + - include: block-node + + flow-node: + # http://yaml.org/spec/1.2/spec.html#style/flow/ + # ns-flow-yaml-node(n,c) + - include: flow-alias + - include: flow-collection + - include: flow-scalar + + flow-scalar: + # http://yaml.org/spec/1.2/spec.html#style/flow/scalar + - include: flow-scalar-double-quoted + - include: flow-scalar-single-quoted + - include: flow-scalar-plain-in + + flow-collection: + # http://yaml.org/spec/1.2/spec.html#style/flow/collection + - include: flow-sequence + - include: flow-mapping + + block-node: + # http://yaml.org/spec/1.2/spec.html#style/block/ + - include: block-scalar + - include: block-collection + - include: flow-scalar-plain-out # needs higher priority than flow-node, which includes flow-scalar-plain-in + - include: flow-node + + block-collection: + # http://yaml.org/spec/1.2/spec.html#style/block/collection + - include: block-sequence + - include: block-mapping + + +###################################### + + directive: + # http://yaml.org/spec/1.2/spec.html#directive// + - match: ^% + scope: punctuation.definition.directive.begin.yaml + push: + - meta_scope: meta.directive.yaml + # %YAML directive + # http://yaml.org/spec/1.2/spec.html#directive/YAML/ + - match: (YAML)[ \t]+(\d+\.\d+) + captures: + 1: keyword.other.directive.yaml.yaml + 2: constant.numeric.yaml-version.yaml + set: directive-finish + # %TAG directive + # http://yaml.org/spec/1.2/spec.html#directive/TAG/ + - match: | + (?x) + (TAG) + (?:[ \t]+ + ({{c_tag_handle}}) + (?:[ \t]+ ({{ns_tag_prefix}}) )? + )? + # handle and prefix are optional for when typing + captures: + 1: keyword.other.directive.tag.yaml + 2: storage.type.tag-handle.yaml + 3: support.type.tag-prefix.yaml + set: directive-finish + # Any other directive + # http://yaml.org/spec/1.2/spec.html#directive/reserved/ + - match: (?x) (\w+) (?:[ \t]+ (\w+) (?:[ \t]+ (\w+))? )? + # name and parameter are optional for when typing + captures: + 1: support.other.directive.reserved.yaml + 2: string.unquoted.directive-name.yaml + 3: string.unquoted.directive-parameter.yaml + set: directive-finish + - match: '' + set: directive-finish + + directive-finish: + - match: (?=$|[ \t]+($|#)) + pop: true + - match: \S+ + scope: invalid.illegal.unrecognized.yaml + + property: + # http://yaml.org/spec/1.2/spec.html#node/property/ + - match: (?=!|&) + push: + - meta_scope: meta.property.yaml + # &Anchor + # http://yaml.org/spec/1.2/spec.html#&%20anchor// + - match: (&)({{ns_anchor_name}})(\S+)? + captures: + 1: keyword.control.property.anchor.yaml punctuation.definition.anchor.yaml + 2: entity.name.other.anchor.yaml + 3: invalid.illegal.character.anchor.yaml + pop: true + # !Tag Handle + # http://yaml.org/spec/1.2/spec.html#tag/property/ + - match: '{{c_ns_tag_property}}(?=\ |\t|$)' + scope: storage.type.tag-handle.yaml + pop: true + - match: \S+ + scope: invalid.illegal.tag-handle.yaml + pop: true + + flow-alias: + # http://yaml.org/spec/1.2/spec.html#alias// + - match: (\*)({{ns_anchor_name}})([^\s\]},]\S*)? + captures: + 1: keyword.control.flow.alias.yaml punctuation.definition.alias.yaml + 2: variable.other.alias.yaml + 3: invalid.illegal.character.anchor.yaml + + flow-scalar-double-quoted: + # http://yaml.org/spec/1.2/spec.html#style/flow/double-quoted + # c-double-quoted(n,c) + - match: '"' + scope: punctuation.definition.string.begin.yaml + push: + # TODO consider scoping meaningful trailing whitespace for color + # schemes with background color definitions. + - meta_scope: string.quoted.double.yaml + meta_include_prototype: false + - match: '{{c_ns_esc_char}}' + scope: constant.character.escape.double-quoted.yaml + - match: \\\n + scope: constant.character.escape.double-quoted.newline.yaml + - match: '"' + scope: punctuation.definition.string.end.yaml + pop: true + + flow-scalar-single-quoted: + # http://yaml.org/spec/1.2/spec.html#style/flow/single-quoted + # c-single-quoted(n,c) + - match: "'" + scope: punctuation.definition.string.begin.yaml + push: + - meta_scope: string.quoted.single.yaml + meta_include_prototype: false + - match: "''" + scope: constant.character.escape.single-quoted.yaml + - match: "'" + scope: punctuation.definition.string.end.yaml + pop: true + + flow-scalar-plain-in-implicit-type: + - match: | + (?x) + {{_type_all}} + {{_flow_scalar_end_plain_in}} + captures: # &implicit_type_captures + 1: constant.language.null.yaml + 2: constant.language.boolean.yaml + # binary integer + 4: constant.numeric.integer.binary.yaml + 5: punctuation.definition.numeric.base.yaml + # octal integer + 6: constant.numeric.integer.octal.yaml + 7: punctuation.definition.numeric.base.yaml + # decimal integer + 8: constant.numeric.integer.decimal.yaml + # hexadecimal integer + 9: constant.numeric.integer.hexadecimal.yaml + 10: punctuation.definition.numeric.base.yaml + # other integer + 11: constant.numeric.integer.other.yaml + # decimal float + 13: constant.numeric.float.decimal.yaml + 14: punctuation.separator.decimal.yaml + # other float + 15: constant.numeric.float.other.yaml + 16: punctuation.separator.decimal.yaml + # infinity float + 17: constant.numeric.float.other.yaml + 18: punctuation.separator.decimal.yaml + # not a number + 19: constant.numeric.float.other.yaml + 20: punctuation.separator.decimal.yaml + # timestamp + 21: constant.other.timestamp.yaml + 22: punctuation.separator.date.yaml + 23: punctuation.separator.date.yaml + 24: punctuation.separator.date.yaml + 25: punctuation.separator.date.yaml + 26: punctuation.separator.time.yaml + 27: punctuation.separator.time.yaml + 28: punctuation.separator.time.yaml + 29: punctuation.separator.time.yaml + # constants + 30: constant.language.value.yaml + 31: constant.language.merge.yaml + + flow-scalar-plain-out-implicit-type: + - match: | + (?x) + {{_type_all}} + {{_flow_scalar_end_plain_out}} + captures: # *implicit_type_captures + # Alias does not work, see https://github.com/SublimeTextIssues/Core/issues/967 + 1: constant.language.null.yaml + 2: constant.language.boolean.yaml + # binary integer + 4: constant.numeric.integer.binary.yaml + 5: punctuation.definition.numeric.base.yaml + # octal integer + 6: constant.numeric.integer.octal.yaml + 7: punctuation.definition.numeric.base.yaml + # decimal integer + 8: constant.numeric.integer.decimal.yaml + # hexadecimal integer + 9: constant.numeric.integer.hexadecimal.yaml + 10: punctuation.definition.numeric.base.yaml + # other integer + 11: constant.numeric.integer.other.yaml + # decimal float + 13: constant.numeric.float.decimal.yaml + 14: punctuation.separator.decimal.yaml + # other float + 15: constant.numeric.float.other.yaml + 16: punctuation.separator.decimal.yaml + # infinity float + 17: constant.numeric.float.other.yaml + 18: punctuation.separator.decimal.yaml + # not a number + 19: constant.numeric.float.other.yaml + 20: punctuation.separator.decimal.yaml + # timestamp + 21: constant.other.timestamp.yaml + 22: punctuation.separator.date.yaml + 23: punctuation.separator.date.yaml + 24: punctuation.separator.date.yaml + 25: punctuation.separator.date.yaml + 26: punctuation.separator.time.yaml + 27: punctuation.separator.time.yaml + 28: punctuation.separator.time.yaml + 29: punctuation.separator.time.yaml + # constants + 30: constant.language.value.yaml + 31: constant.language.merge.yaml + + flow-scalar-plain-out: + # http://yaml.org/spec/1.2/spec.html#style/flow/plain + # ns-plain(n,c) (c=flow-out, c=block-key) + - include: flow-scalar-plain-out-implicit-type + - match: '{{ns_plain_first_plain_out}}' + push: + - meta_scope: string.unquoted.plain.out.yaml + meta_include_prototype: false + - match: '{{_flow_scalar_end_plain_out}}' + pop: true + + flow-scalar-plain-in: + # http://yaml.org/spec/1.2/spec.html#style/flow/plain + # ns-plain(n,c) (c=flow-in, c=flow-key) + - include: flow-scalar-plain-in-implicit-type + - match: '{{ns_plain_first_plain_in}}' + push: + - meta_scope: string.unquoted.plain.in.yaml + meta_include_prototype: false + - match: '{{_flow_scalar_end_plain_in}}' + pop: true + + flow-sequence: + # http://yaml.org/spec/1.2/spec.html#style/flow/sequence + # c-flow-sequence(n,c) + - match: \[ + scope: punctuation.definition.sequence.begin.yaml + push: + - meta_scope: meta.flow-sequence.yaml + - match: \] + scope: punctuation.definition.sequence.end.yaml + pop: true + - match: ',' + scope: punctuation.separator.sequence.yaml + - include: flow-pair + - include: flow-node + + flow-mapping: + - match: \{ + scope: punctuation.definition.mapping.begin.yaml + push: + - meta_scope: meta.flow-mapping.yaml + - match: \} + scope: punctuation.definition.mapping.end.yaml + pop: true + - match: ',' + scope: punctuation.separator.mapping.yaml + - include: flow-pair + + flow-pair: + - match: \? + scope: punctuation.definition.key-value.begin.yaml + push: + - meta_scope: meta.flow-pair.explicit.yaml + - match: (?=[},\]]) # Empty mapping keys & values are allowed + pop: true + - include: flow-pair + - include: flow-node + - match: :(?=\s|$|{{c_flow_indicator}}) + scope: punctuation.separator.key-value.mapping.yaml + set: flow-pair-value + # Attempt to match plain-in scalars and highlight as "entity.name.tag", + # if followed by a colon + - match: | + (?x) + (?= + {{ns_plain_first_plain_in}} + ( + [^\s:{{c_flow_indicator}}] + | : [^\s{{c_flow_indicator}}] + | \s+ (?![#\s]) + )* + \s* + : + (\s|$) + ) + push: + # TODO Use a merge type here and add "pop: true" and "scope: entity.name.tag.yaml"; + # https://github.com/SublimeTextIssues/Core/issues/966 + - meta_scope: meta.flow-pair.key.yaml + - include: flow-scalar-plain-in-implicit-type + - match: '{{_flow_scalar_end_plain_in}}' + pop: true + - match: '{{ns_plain_first_plain_in}}' + set: + - meta_scope: string.unquoted.plain.in.yaml entity.name.tag.yaml + meta_include_prototype: false + - match: '{{_flow_scalar_end_plain_in}}' + pop: true + - include: flow-node + - match: :(?=\s|$|{{c_flow_indicator}}) # Empty mapping keys allowed + scope: meta.flow-pair.yaml punctuation.separator.key-value.mapping.yaml + push: flow-pair-value + + flow-pair-value: + - meta_content_scope: meta.flow-pair.value.yaml + - include: flow-node + - match: (?=[},\]]) + pop: true + + block-scalar: + # http://www.yaml.org/spec/1.2/spec.html#style/block/scalar + # c-l+literal(n) | c-l+folded(n) + - match: (?:(\|)|(>))([1-9])?([-+])? # c-b-block-header(m,t) + captures: + 1: keyword.control.flow.block-scalar.literal.yaml + 2: keyword.control.flow.block-scalar.folded.yaml + 3: constant.numeric.integer.decimal.indentation-indicator.yaml + 4: storage.modifier.chomping-indicator.yaml + push: + - meta_include_prototype: false + - match: ^([ ]+)(?! ) # match first non-empty line to determine indentation level + # note that we do not check if indentation is enough + set: + - meta_scope: string.unquoted.block.yaml + meta_include_prototype: false + - match: ^(?!\1|\s*$) + pop: true + - match: ^(?=\S) # the block is empty + pop: true + - include: comment # include comments but not properties + - match: .+ + scope: invalid.illegal.expected-comment-or-newline.yaml + + block-sequence: + # http://www.yaml.org/spec/1.2/spec.html#style/block/sequence + # l+block-sequence(n) + - match: (-)(?!\S) + scope: punctuation.definition.block.sequence.item.yaml + + block-mapping: + # http://www.yaml.org/spec/1.2/spec.html#style/block/mapping + # l+block-mapping(n) + - include: block-pair + + block-pair: + - match: \? + scope: punctuation.definition.key-value.begin.yaml + push: + - meta_scope: meta.block-mapping.yaml + - match: (?=\?) # Empty mapping keys & values are allowed + pop: true + - match: ^ *(:) + captures: + 1: punctuation.separator.key-value.mapping.yaml + pop: true + - match: ':' + scope: invalid.illegal.expected-newline.yaml + pop: true + - include: block-node + # Attempt to match plain-out scalars and highlight as "entity.name.tag", + # if followed by a colon + - match: | + (?x) + (?= + {{ns_plain_first_plain_out}} + ( + [^\s:] + | : \S + | \s+ (?![#\s]) + )* + \s* + : + (\s|$) + ) + push: + - include: flow-scalar-plain-out-implicit-type + - match: '{{_flow_scalar_end_plain_out}}' + pop: true + - match: '{{ns_plain_first_plain_out}}' + set: + - meta_scope: string.unquoted.plain.out.yaml entity.name.tag.yaml + meta_include_prototype: false + - match: '{{_flow_scalar_end_plain_out}}' + pop: true + - match: :(?=\s|$) + scope: punctuation.separator.key-value.mapping.yaml + + comment: + # http://www.yaml.org/spec/1.2/spec.html#comment// + - match: | # l-comment + (?x) + (?: ^ [ \t]* | [ \t]+ ) + (?=\#) + captures: + push: + - match: '#' + scope: punctuation.definition.comment.line.number-sign.yaml + set: + - meta_scope: comment.line.number-sign.yaml + - match: \n|\z + pop: true +... diff --git a/assets/syntaxes/Packages/YAML/preview.yaml b/assets/syntaxes/Packages/YAML/preview.yaml new file mode 100644 index 000000000..6f4c5f519 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/preview.yaml @@ -0,0 +1,41 @@ +%YAML 1.2 +%TAG !e! tag:example.com,2000:app/ # comment +%RESERVED name parameter #comment +--- +- [~, null, Null, NULL, nUll, + yes, no, true, false, + 0b0, +0b1_0_1, -0b1, ~, 0b, 0b2, + 01, +0_761, -07, ~, 09, + 0, +1, -12_345, + 0x0, +0x12_34_56, -0xabcdef, ~, 0xyz, 0x, + 1:20, +1:9, -1_234:59:00, ~, 1:60, :60, + 0.1, +.293, -1_123.e-3, 2.234.567, + .inf, +.INF, -.Inf, .nan, ~, .inF, + .NaN, ~, .Nan, + 2015-08-15, 2015-08-15 1:20:30.123, 2015-08-15T12:20:30.123-9:00, + plain scalar, 'single-quoted ('''') scalar', "double-quoted (\"\") scalar" + ] + +- &anchor !!omap + - 1: a + - 2: b + - foo: bar + +- !!pairs + - 0: {<<: *anchor, 2: c} + - 1: a2 [also part of the plain scalar] + - 2: :another scalar {} + - !e!float 3: !<tag:example.com,2000:app/int> 1 - 3 + +- {? !!int '12' : value, + ? !!str foo : :bar} + +- - key: {more key: baz} + asdf: ~ + + ? |- + block scalar as key + # comment here + : !!str >5 + block scalar as value +... diff --git a/assets/syntaxes/Packages/YAML/tests/syntax_test_block.yaml b/assets/syntaxes/Packages/YAML/tests/syntax_test_block.yaml new file mode 100644 index 000000000..910f49cb3 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/tests/syntax_test_block.yaml @@ -0,0 +1,132 @@ +# SYNTAX TEST "Packages/YAML/YAML.sublime-syntax" +# <- source.yaml comment + +# http://yaml.org/spec/1.2/spec.html#style/block/ + + +############################################################################## +## Scalars +# http://yaml.org/spec/1.2/spec.html#style/block/scalar + +# Headers ############################ +# (note that block scalars may be empty) +- | +# ^ keyword.control.flow.block-scalar.literal + +- > +# ^ keyword.control.flow.block-scalar.folded + +- >1 +# ^ keyword.control.flow.block-scalar +# ^ constant.numeric.integer.decimal.indentation-indicator + +- |1- +# ^ keyword.control.flow.block-scalar +# ^ constant.numeric.integer.decimal.indentation-indicator +# ^ storage.modifier.chomping-indicator + +# Headers and content ################ +- | + literal +#^^^^^^^ string.unquoted.block + +- >1 + folded +#^^^^^^^ string.unquoted.block + +- |+ + keep +#^^^^ string.unquoted.block + +- >1- + strip +#^^^^^^ string.unquoted.block + +- > + content + # still content +#^^^^^^^^^^^^^^^^^ string.unquoted.block + +- > + # content + # still content + # not content +#^^^^^^^^^^^^^ comment + +# Empty blocks ####################### +- > asdf +# ^^^^^ invalid.illegal.expected-comment-or-newline +- ># not comment +# ^^^^^^^^^^^^^ invalid.illegal.expected-comment-or-newline +- | +plain +# <- -string.unquoted.block + + +############################################################################## +## Sequence +# http://yaml.org/spec/1.2/spec.html#style/block/sequence + +- +# <- punctuation.definition.block.sequence.item +- - +# <- punctuation.definition.block.sequence.item +# ^ punctuation.definition.block.sequence.item +- !!omap - +# <- punctuation.definition.block.sequence.item +# ^ punctuation.definition.block.sequence.item +- + + +############################################################################## +## Mapping +# http://yaml.org/spec/1.2/spec.html#style/block/mapping + +key: value +#^^ string.unquoted.plain.out entity.name.tag +# ^ punctuation.separator.key-value.mapping, -entity +# ^^^^^ string.unquoted.plain.out +key# : value +#^^^ string.unquoted.plain.out entity.name.tag +# ^ -string +# ^ punctuation.separator.key-value.mapping +# ^^^^^ string.unquoted.plain.out +: +# <- punctuation.separator.key-value.mapping + +_type_null: (?:null|Null|NULL|~) # http://yaml.org/type/null.html +#^^^^^^^^^ entity.name.tag +# ^^^^^^^^^^^^^^^^^^^^ -entity.name.tag +# ^ comment + +key on line one: +#^^^^^^^^^^^^^^ entity.name.tag + value on line two + +? explicit key # Empty value +#^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-mapping +# ^^^^^^^^^^^^ string.unquoted.plain.out +# ^^^^^^^^^^^^^ comment +# <- meta.block-mapping punctuation.definition.key-value.begin + +? | + block key +# ^^^^^^^^^ meta.block-mapping string.unquoted.block +# ^^^^^^^^^ -meta.block-mapping meta.block-mapping +: - one # Explicit compact +# <- meta.block-mapping punctuation.separator.key-value.mapping + - two: :three # block value +# ^ punctuation.definition.block.sequence +# ^^^ string.unquoted.plain.out entity.name.tag +# ^ punctuation.separator.key-value.mapping +# ^^^^^^ string.unquoted.plain.out + +? a key : not a value +# ^ meta.block-mapping invalid.illegal.expected-newline + +scalar +# <- -meta.block-mapping + +x: + - #1 +# ^^ comment.line diff --git a/assets/syntaxes/Packages/YAML/tests/syntax_test_directives.yaml b/assets/syntaxes/Packages/YAML/tests/syntax_test_directives.yaml new file mode 100644 index 000000000..40246f414 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/tests/syntax_test_directives.yaml @@ -0,0 +1,94 @@ +# SYNTAX TEST "Packages/YAML/YAML.sublime-syntax" +# <- source.yaml comment + +# http://yaml.org/spec/1.2/spec.html#directive// + + +############################################################################## +## YAML DIRECTIVE +# http://yaml.org/spec/1.2/spec.html#directive/YAML/ + +%YAML 1.2 +#^^^^ keyword.other.directive.yaml +# ^^^ constant.numeric.yaml-version +# <- meta.directive punctuation.definition.directive.begin +%YAML 9821.2213213 # comment +# ^^^^^^^^^^^^ constant.numeric.yaml-version +# ^ comment +%YAML 9821.2213213 more +# ^^^^ invalid.illegal + + +############################################################################## +## TAG DIRECTIVE +# http://yaml.org/spec/1.2/spec.html#directive/TAG/ + +%TAG +#^^^ meta.directive keyword.other.directive.tag +# <- meta.directive +%TAG ! +#^^^ keyword.other.directive.tag +# ^ storage.type.tag-handle +%TAG ! tag:example.com,2000:app/ +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.directive +#^^^ keyword.other.directive.tag +# ^ storage.type.tag-handle +# ^^^^^^^^^^^^^^^^^^^^^^^^^ support.type.tag-prefix +%TAG !! tag:example.com,2000:app/ +# ^^ storage.type.tag-handle +# ^ support.type.tag-prefix +%TAG !e! tag:example.com,2000:app/ # comment +# ^^^ storage.type.tag-handle +# ^ support.type.tag-prefix +# ^ comment +%TAG !e! !empty- +# ^^^ storage.type.tag-handle +# ^^^^^^^ support.type.tag-prefix + +%TAG !tag some text +# ^^^ invalid.illegal +# ^^^^ invalid.illegal +# ^^^^ invalid.illegal +%TAG !yea-! [ +# ^^^^^^ storage.type.tag-handle +# ^ invalid.illegal +%TAG !y_ea! [ +# ^^^^^ invalid.illegal +%TAG !yea! tag more +# ^^^^ invalid.illegal +%TAG !yea!%%YAML +# ^^^^^^ invalid.illegal + + +############################################################################## +## RESERVED DIRECTIVE +# http://yaml.org/spec/1.2/spec.html#directive/reserved/ + +%RESERVED +#^^^^^^^^ meta.directive support.other.directive.reserved +# <- meta.directive punctuation.definition.directive.begin +%1 +#^ support.other.directive.reserved +%RESERVED name +#^^^^^^^^ support.other.directive.reserved +# ^ string.unquoted.directive-name +%RESERVED name parameter #comment +#^^^^^^^^ support.other.directive.reserved +# ^^^^ string.unquoted.directive-name +# ^^^^^^^^^ string.unquoted.directive-parameter +# ^ comment +%RESERVED name parameter#no-comment +# ^^^^^^^^^^^ invalid.illegal +%RESERVED name parameter more +# ^^^^ invalid.illegal + + +############################################################################## +## MISC + +% +# <- meta.directive punctuation.definition.directive.begin +% TAG +# ^^^ invalid.illegal +%% +#^ invalid.illegal diff --git a/assets/syntaxes/Packages/YAML/tests/syntax_test_flow-plain.yaml b/assets/syntaxes/Packages/YAML/tests/syntax_test_flow-plain.yaml new file mode 100644 index 000000000..c8311a79d --- /dev/null +++ b/assets/syntaxes/Packages/YAML/tests/syntax_test_flow-plain.yaml @@ -0,0 +1,86 @@ +# SYNTAX TEST "Packages/YAML/YAML.sublime-syntax" +# <- source.yaml comment + +# http://yaml.org/spec/1.2/spec.html#style/flow/plain + + +############################################################################## +## Plain (flow-out, block-key) + +plain +#^^^^ string.unquoted.plain.out +# ^ -string +# <- string.unquoted.plain.out + +-plain- ?plain? :plain +#^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.plain.out +# <- string.unquoted.plain.out + + +plain - plain ? plain : plain: plain +#^^^^^^^^^^^^^^^^^^^^ string.unquoted.plain.out +# ^^^ -string +# ^^^^^ string.unquoted.plain.out +# ^^ -string +# ^^^^^ string.unquoted.plain.out +# <- string.unquoted.plain.out + + +http://example.com/foo?baz#bar # comment +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.plain.out - entity.name.tag +# ^^^^ -comment +# ^ comment -string +# <- string.unquoted.plain.out + +pl[a]i,n +#^^^^^^^ string.unquoted.plain.out +# <- string.unquoted.plain.out + + +############################################################################## +## Plain (flow-in, flow-key) + +[ +plain +#^^^^ string.unquoted.plain.in +# ^ -string +# <- string.unquoted.plain.in + +-plain- ?plain? :plain +#^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.plain.in +# <- string.unquoted.plain.in + +plain - plain ? plain : plain: plain +#^^^^^^^^^^^^^^^^^^^^ string.unquoted.plain.in +# ^^^ -string +# ^^^^^ string.unquoted.plain.in +# ^^ -string +# ^^^^^ string.unquoted.plain.in +# <- string.unquoted.plain.in + +http://example.com/foo?baz#bar # comment +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.plain.in +# ^^^^ -comment +# ^ comment +# <- string.unquoted.plain.in + +p[l]a,in:[] +# <- string.unquoted.plain.in +#^ -string +# ^ string.unquoted.plain.in +# ^ -string +# ^ string.unquoted.plain.in +# ^ -string +# ^^ string.unquoted.plain.in +# ^^^ -string +] + + +{ bar: 1} +# ^ constant.numeric.integer +{ bar: 1 } +# ^ constant.numeric.integer +# ^ - string +{ key: string } +# ^^^^^^ string.unquoted.plain.in +# ^ - string.unquoted.plain.in diff --git a/assets/syntaxes/Packages/YAML/tests/syntax_test_flow.yaml b/assets/syntaxes/Packages/YAML/tests/syntax_test_flow.yaml new file mode 100644 index 000000000..7cf372544 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/tests/syntax_test_flow.yaml @@ -0,0 +1,158 @@ +# SYNTAX TEST "Packages/YAML/YAML.sublime-syntax" +# <- source.yaml comment + +# http://yaml.org/spec/1.2/spec.html#style/flow/ + + +############################################################################## +## Aliases +# http://yaml.org/spec/1.2/spec.html#alias// + +*alias +#^^^^^ variable.other.alias +# <- keyword.control.flow.alias punctuation.definition.alias + +*al[ias] +#^^ variable.other.alias +# ^^^^^ invalid.illegal.character +# <- keyword.control.flow.alias punctuation.definition.alias + + +############################################################################## +## Double-quoted +# http://yaml.org/spec/1.2/spec.html#style/flow/double-quoted + +"flow string" +#^^^^^^^^^^^^ string.quoted.double +# ^ punctuation.definition.string.end +# <- string.quoted.double punctuation.definition.string.begin + +"flow string + more string" +#^^^^^^^^^^^^ string.quoted.double +# ^ punctuation.definition.string.end + +"\" \0 \\ \x1b \u12c4 \U1234F678" +#^^ constant.character.escape +# ^^ constant.character.escape +# ^^ constant.character.escape +# ^^^^ constant.character.escape +# ^^^^^^ constant.character.escape +# ^^^^^^^^^^ constant.character.escape +# ^ -constant + +"\x1 \u123 \U1234567" +#^^^^^^^^^^^^^^^^^^^ -constant.character.escape + +"\x123 \u12345 \U123456789" +#^^^^ constant.character.escape +# ^ -constant.character.escape +# ^^^^^^ constant.character.escape +# ^ -constant.character.escape +# ^^^^^^^^^^ constant.character.escape +# ^ -constant.character.escape + +# The following can't be tested because there must be a newline after the +# backslash and comments are not allowed in strings. +# Just verify manually that the \ is highlighted as +# "constant.character.escape.newline". +"string\ +continuation" + + +############################################################################## +## Single-quoted +# http://yaml.org/spec/1.2/spec.html#style/flow/single-quoted + +'flow string' +#^^^^^^^^^^^^ string.quoted.single +# ^ punctuation.definition.string.end +# <- string.quoted.single punctuation.definition.string.begin + +'flow string + more string' +#^^^^^^^^^^^^ string.quoted.single +# ^ punctuation.definition.string.end +# <- string.quoted.single + +' '' ' +#^ -constant +# ^^ constant.character.escape +# ^ -constant + + +############################################################################## +## Flow-sequence +# http://yaml.org/spec/1.2/spec.html#style/flow/sequence + +[a, b, c, +# <- meta.flow-sequence punctuation.definition.sequence.begin +#^ string.unquoted.plain.in +# ^ punctuation.separator.sequence +# ^ punctuation.separator.sequence +*alias] +#^^^^^ variable.other.alias +# ^ meta.flow-sequence punctuation.definition.sequence.end + +[a: b, c,'d', e: f, g:h] +#^ meta.flow-pair.key string.unquoted.plain.in entity.name.tag +# ^ meta.flow-pair punctuation.separator.key-value.mapping -meta.flow-pair.value +# ^ meta.flow-pair.value string.unquoted.plain.in -entity.name.tag +# ^ string.unquoted.plain.in +# ^ punctuation.separator.sequence +# ^^^ string.quoted.single +# ^ string.unquoted.plain.in entity.name.tag +# ^ punctuation.separator.key-value.mapping +# ^ punctuation.separator.sequence +# ^^^ string.unquoted.plain.in - entity.name.tag + + +############################################################################## +## Flow-mapping +# http://yaml.org/spec/1.2/spec.html#style/flow/sequence + +{a: b, :c: :d, +#^ meta.flow-pair.key string.unquoted.plain.in entity.name.tag +# ^ meta.flow-pair punctuation.separator.key-value.mapping +# ^ meta.flow-pair.value string.unquoted.plain.in -entity.name.tag +# ^ punctuation.separator.mapping +# ^^ string.unquoted.plain.in entity.name.tag +# ^ punctuation.separator.key-value.mapping +# ^^ string.unquoted.plain.in, -entity.name.tag +# ^ punctuation.separator.mapping +# <- meta.flow-mapping punctuation.definition.mapping.begin +*alias, e : f } +#^^^^^ variable.other.alias +# ^ punctuation.separator.mapping +# ^ string.unquoted.plain.in entity.name.tag +# ^ -string +# ^ punctuation.separator.key-value.mapping +# ^ string.unquoted.plain.in, -entity.name.tag +# ^ meta.flow-mapping punctuation.definition.mapping.end + +{? !!str 'key' : !!str value, +#^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.flow-pair.explicit +# ^^^^^^^^^^^^ meta.flow-pair.value +# ^ punctuation.separator.mapping -meta.flow-pair +#^ punctuation.definition.key-value.begin +# ^^^^^ storage +# ^^^^^ string +# ^ punctuation +# ^ punctuation +# ^ punctuation.separator.key-value.mapping +# ^^^^^ storage +# ^^^^^ string + ? !!str foo : :bar +#^ punctuation.definition.key-value.begin +# ^^^^^ storage +# ^^^ string entity.name.tag +# ^ punctuation.separator.key-value.mapping -string +# ^ string.unquoted.plain.in +} + +!!set {this, is, a, set} +# ^ storage +# ^ string -entity +# ^ string -entity +# ^ string -entity +# ^ string -entity diff --git a/assets/syntaxes/Packages/YAML/tests/syntax_test_general.yaml b/assets/syntaxes/Packages/YAML/tests/syntax_test_general.yaml new file mode 100644 index 000000000..e0a86bbeb --- /dev/null +++ b/assets/syntaxes/Packages/YAML/tests/syntax_test_general.yaml @@ -0,0 +1,26 @@ +# SYNTAX TEST "Packages/YAML/YAML.sublime-syntax" +# <- source.yaml comment + + +############################################################################## +## Comments +# http://www.yaml.org/spec/1.2/spec.html#comment// + +# comment +# <- comment.line.number-sign punctuation.definition.comment.line.number-sign +#^^^^^^^^^ comment.line.number-sign + + # comment +#^^ - comment + + +############################################################################## +## Document markers + +--- +#^^ entity.other.document.begin +# <- entity.other.document.begin + +... +#^^ entity.other.document.end +# <- entity.other.document.end diff --git a/assets/syntaxes/Packages/YAML/tests/syntax_test_properties.yaml b/assets/syntaxes/Packages/YAML/tests/syntax_test_properties.yaml new file mode 100644 index 000000000..8933d47cb --- /dev/null +++ b/assets/syntaxes/Packages/YAML/tests/syntax_test_properties.yaml @@ -0,0 +1,54 @@ +# SYNTAX TEST "Packages/YAML/YAML.sublime-syntax" +# <- source.yaml comment + +# http://yaml.org/spec/1.2/spec.html#node/property/ + + +############################################################################## +## Tag Handles +# http://yaml.org/spec/1.2/spec.html#tag/property/ + +- !foo "" +# ^^^^ meta.property storage.type.tag-handle +# ^^ -storage.type.tag-handle +- !!str "" +# ^^^^^ storage.type.tag-handle +- !* "" +# ^^ storage.type.tag-handle +- !m-!y 1 +# ^^^^^ storage.type.tag-handle +# ^ -storage.type.tag-handle + +- !<!my-light> light +# ^^^^^^^^^^^^ storage.type.tag-handle +# ^^^^^ -storage.type.tag-handle +- !<tag:example.com,2000:app/int> 1 - 3 +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ storage.type.tag-handle + +- !*! "" +# ^^^ -storage, invalid.illegal.tag-handle +- !*!str "" +# ^^^^^^ invalid.illegal.tag-handle +- !asd@asd!str "" +# ^^^^^^^^^^^^ invalid.illegal.tag-handle +- !justtyping! +# ^^^^^^^^^^^^ invalid.illegal.tag-handle + +scalar !not-tag-handle +# ^^^^^^^^^^^^^^^ -storage.type.tag-handle + + +############################################################################## +## Anchors +# http://yaml.org/spec/1.2/spec.html#&%20anchor// + +&anchor +#^^^^^^ entity.name.other.anchor +# <- keyword.control.property.anchor punctuation.definition.anchor +&an[chor] +#^^ entity.name.other.anchor +# ^^^^^^ invalid.illegal.character +# <- keyword.control.property.anchor punctuation.definition.anchor + +scalar ¬-anchor +# ^^^^^^^^^^^ -keyword.control.property.anchor diff --git a/assets/syntaxes/Packages/YAML/tests/syntax_test_types.yaml b/assets/syntaxes/Packages/YAML/tests/syntax_test_types.yaml new file mode 100644 index 000000000..814c50663 --- /dev/null +++ b/assets/syntaxes/Packages/YAML/tests/syntax_test_types.yaml @@ -0,0 +1,173 @@ +# SYNTAX TEST "Packages/YAML/YAML.sublime-syntax" +# <- source.yaml comment + +# http://yaml.org/type/ + + +############################################################################## +## Implicit Types + +############################################################################## +## http://yaml.org/type/null.html + +- [null, Null, NULL, ~, nUll, ~ tilde] +# ^^^^ constant.language.null +# ^^^^ constant.language.null +# ^^^^ constant.language.null +# ^ constant.language.null +# ^^^^^^^^^^^^^ -constant + + +############################################################################## +## http://yaml.org/type/bool.html + +- [yes, no, true, false, No, y, ON, off, Off, ~, oFF, nO, false true] +# ^^^ constant.language.boolean +# ^^ constant.language.boolean +# ^^^^ constant.language.boolean +# ^^^^^ constant.language.boolean +# ^^ constant.language.boolean +# ^ constant.language.boolean +# ^^ constant.language.boolean +# ^^^ constant.language.boolean +# ^^^ constant.language.boolean +# ^^^^^^^^^^^^^^^^^^^ -constant + + +############################################################################## +## http://yaml.org/type/int.html + +- [0b0, +0b1_0_1, -0b1, ~, 0b, 0b2, 0b1 abc +# ^^^ constant.numeric.integer.binary +# ^^ punctuation.definition.numeric.base +# ^^^^^^^^ constant.numeric.integer.binary +# ^^ punctuation.definition.numeric.base +# ^^^^ constant.numeric.integer.binary +# ^^ punctuation.definition.numeric.base +# ^^^^^^^^^^^^^^^^ -constant + + 01, +0_761, -07, ~, 09, 0123 f +# ^^ constant.numeric.integer.octal +# ^ punctuation.definition.numeric.base +# ^^^^^^ constant.numeric.integer.octal +# ^ punctuation.definition.numeric.base +# ^^^ constant.numeric.integer.octal +# ^ punctuation.definition.numeric.base +# ^^^^^^^^^^ -constant + + 0, +1, -12_345, ~, 3 not a number +# ^ constant.numeric.integer.decimal +# ^^ constant.numeric.integer.decimal +# ^^^^^^^ constant.numeric.integer.decimal +# ^^^^^^^^^^^^^^ -constant + + 0x0, +0x12_34_56, -0xabcdef, ~, 0xyz, 0x, +# ^^^ constant.numeric.integer.hexadecimal +# ^^ punctuation.definition.numeric.base +# ^^^^^^^^^^^ constant.numeric.integer.hexadecimal +# ^^ punctuation.definition.numeric.base +# ^^^^^^^^^ constant.numeric.integer.hexadecimal +# ^^ punctuation.definition.numeric.base +# ^^^^^^^^ -constant + +# Note: pyyaml does not handle hexagesimal literals correctly (for linting purposes) + 1:20, +1:9, -1_234:59:00, ~, 1:60, :60, 1:2 s +# ^^^^ constant.numeric.integer.other +# ^^^^ constant.numeric.integer.other +# ^^^^^^^^^^^^ constant.numeric.integer.other +# ^^^^^^^^^^^^^^^^ -constant + ] + + +############################################################################## +## http://yaml.org/type/float.html + +- [0.1, +.293, -1_123.e-3, 2.234.567, ~, 0.1 f +# ^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal +# ^^^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal +# ^^^^^^^^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal +# ^^^^^^^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal +# ^^^^^ -constant + .inf, +.INF, -.Inf, ~, .inF, .inf .inf +# ^^^^ constant.numeric.float.other +# ^ punctuation.separator.decimal +# ^^^^^ constant.numeric.float.other +# ^ punctuation.separator.decimal +# ^^^^^ constant.numeric.float.other +# ^ punctuation.separator.decimal +# ^^^^^^^^^^^^^^^ -constant + .NaN, ~, .Nan, +# ^^^^ constant.numeric.float.other +# ^ punctuation.separator.decimal +# ^^^^ -constant +] + + +############################################################################## +## http://yaml.org/type/timestamp.html + +- [2015-08-15, 2015-08-15 1:20:30.123, 2015-08-15T12:20:30.123-9:00, 2015-08-15 1:20:30.123 Z, 2001-12-14 21:59:43.10 -5] +# ^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time + + +############################################################################## +## http://yaml.org/type/value.html http://yaml.org/type/merge.html +- [=, <<, ~, << abc] +# ^ constant.language.value +# ^^ constant.language.merge +# ^^^^^^ -constant + + +############################################################################## +## In a mapping + +true: false +#^^^ constant.language.boolean +# ^ punctuation.separator.key-value.mapping +# ^^^^^ constant.language.boolean +3.e-3: 3.e+3 +#^^^^ constant.numeric.float.decimal +#^ punctuation.separator.decimal +# ^ punctuation.separator.key-value.mapping +# ^^^^^ constant.numeric.float.decimal +{.NaN: 2, 2: 2015-08-15} +#^^^^ constant.numeric.float.other +# ^ punctuation.separator.key-value.mapping +# ^ constant.numeric.integer.decimal +# ^ punctuation.separator.mapping +# ^ constant.numeric.integer.decimal +# ^ punctuation.separator.key-value.mapping +# ^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date diff --git a/build.rs b/build.rs index 2fc2ffb77..0865c8a62 100644 --- a/build.rs +++ b/build.rs @@ -36,6 +36,13 @@ mod tracked { Ok(()) } + pub(crate) fn track_recursive(path: impl AsRef<Path>) -> Result<()> { + for entry in walkdir::WalkDir::new(path) { + track(entry?.path())?; + } + Ok(()) + } + pub(crate) fn read(path: impl AsRef<Path>) -> Result<Vec<u8>> { let path = path.as_ref(); track(path)?; @@ -72,6 +79,7 @@ fn main() -> Result<()> { write_git_version(out_dir)?; compile_sass(out_dir)?; write_known_targets(out_dir)?; + compile_syntax(out_dir).context("could not compile syntax files")?; Ok(()) } @@ -171,3 +179,40 @@ fn write_known_targets(out_dir: &Path) -> Result<()> { Ok(()) } + +fn compile_syntax(out_dir: &Path) -> Result<()> { + use syntect::{ + dumps::dump_to_uncompressed_file, + parsing::{SyntaxDefinition, SyntaxSetBuilder}, + }; + + fn tracked_add_from_folder( + builder: &mut SyntaxSetBuilder, + path: impl AsRef<Path>, + ) -> Result<()> { + // There's no easy way to know exactly which files matter, so just track everything in the + // folder + tracked::track_recursive(&path)?; + builder.add_from_folder(path, true)?; + Ok(()) + } + + let mut builder = SyntaxSetBuilder::new(); + builder.add_plain_text_syntax(); + + tracked_add_from_folder(&mut builder, "assets/syntaxes/Packages/")?; + + // The TOML syntax already includes `Cargo.lock` in its alternative file extensions, but we + // also want to support `Cargo.toml.orig` files. + let mut toml = SyntaxDefinition::load_from_str( + &tracked::read_to_string("assets/syntaxes/Extras/TOML/TOML.sublime-syntax")?, + true, + Some("TOML"), + )?; + toml.file_extensions.push("Cargo.toml.orig".into()); + builder.add(toml); + + dump_to_uncompressed_file(&builder.build(), out_dir.join("syntect.packdump"))?; + + Ok(()) +} diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 0a6008a85..52a249bcc 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -50,6 +50,7 @@ COPY src src/ RUN find src -name "*.rs" -exec touch {} \; COPY templates/style templates/style COPY vendor vendor/ +COPY assets assets/ RUN cargo build --release diff --git a/src/web/crate_details.rs b/src/web/crate_details.rs index 17cf144bd..3610a47e1 100644 --- a/src/web/crate_details.rs +++ b/src/web/crate_details.rs @@ -1,4 +1,4 @@ -use super::{match_version, redirect_base, render_markdown, MatchSemver, MetaData}; +use super::{markdown, match_version, redirect_base, MatchSemver, MetaData}; use crate::utils::{get_correct_docsrs_style_file, report_error}; use crate::{ db::Pool, @@ -69,7 +69,7 @@ where { markdown .as_ref() - .map(|markdown| render_markdown(markdown)) + .map(|markdown| markdown::render(markdown)) .serialize(serializer) } diff --git a/src/web/highlight.rs b/src/web/highlight.rs new file mode 100644 index 000000000..199065690 --- /dev/null +++ b/src/web/highlight.rs @@ -0,0 +1,81 @@ +use crate::error::Result; +use once_cell::sync::Lazy; +use syntect::{ + html::{ClassStyle, ClassedHTMLGenerator}, + parsing::{SyntaxReference, SyntaxSet}, + util::LinesWithEndings, +}; + +static SYNTAXES: Lazy<SyntaxSet> = Lazy::new(|| { + static SYNTAX_DATA: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/syntect.packdump")); + + let syntaxes: SyntaxSet = syntect::dumps::from_uncompressed_data(SYNTAX_DATA).unwrap(); + + let names = syntaxes + .syntaxes() + .iter() + .map(|s| &s.name) + .collect::<Vec<_>>(); + log::debug!("known syntaxes {names:?}"); + + syntaxes +}); + +fn try_with_syntax(syntax: &SyntaxReference, code: &str) -> Result<String> { + let mut html_generator = ClassedHTMLGenerator::new_with_class_style( + syntax, + &SYNTAXES, + ClassStyle::SpacedPrefixed { prefix: "syntax-" }, + ); + + for line in LinesWithEndings::from(code) { + html_generator.parse_html_for_line_which_includes_newline(line)?; + } + + Ok(html_generator.finalize()) +} + +fn select_syntax(name: Option<&str>, code: &str) -> &'static SyntaxReference { + name.and_then(|name| { + SYNTAXES.find_syntax_by_token(name).or_else(|| { + name.rsplit_once('.') + .and_then(|(_, ext)| SYNTAXES.find_syntax_by_token(ext)) + }) + }) + .or_else(|| SYNTAXES.find_syntax_by_first_line(code)) + .unwrap_or_else(|| SYNTAXES.find_syntax_plain_text()) +} + +pub fn try_with_lang(lang: Option<&str>, code: &str) -> Result<String> { + try_with_syntax(select_syntax(lang, code), code) +} + +pub fn with_lang(lang: Option<&str>, code: &str) -> String { + match try_with_lang(lang, code) { + Ok(highlighted) => highlighted, + Err(err) => { + log::error!("failed while highlighting code: {err:?}"); + code.to_owned() + } + } +} + +#[cfg(test)] +mod tests { + use super::select_syntax; + + #[test] + fn custom_filetypes() { + let toml = select_syntax(Some("toml"), ""); + + assert_eq!(select_syntax(Some("Cargo.toml.orig"), "").name, toml.name); + assert_eq!(select_syntax(Some("Cargo.lock"), "").name, toml.name); + } + + #[test] + fn dotfile_with_extension() { + let toml = select_syntax(Some("toml"), ""); + + assert_eq!(select_syntax(Some(".rustfmt.toml"), "").name, toml.name); + } +} diff --git a/src/web/markdown.rs b/src/web/markdown.rs new file mode 100644 index 000000000..1f32ec924 --- /dev/null +++ b/src/web/markdown.rs @@ -0,0 +1,118 @@ +use crate::web::highlight; +use comrak::{ + adapters::SyntaxHighlighterAdapter, ComrakExtensionOptions, ComrakOptions, ComrakPlugins, + ComrakRenderPlugins, +}; +use std::{collections::HashMap, fmt::Write}; + +#[derive(Debug)] +struct CodeAdapter<F>(F); + +impl<F: Fn(Option<&str>, &str) -> String> SyntaxHighlighterAdapter for CodeAdapter<F> { + fn highlight(&self, lang: Option<&str>, code: &str) -> String { + // comrak does not treat `,` as an info-string delimiter, so we do that here + // TODO: https://github.com/kivikakk/comrak/issues/246 + let lang = lang.and_then(|lang| lang.split(',').next()); + (self.0)(lang, code) + } + + fn build_pre_tag(&self, attributes: &HashMap<String, String>) -> String { + build_opening_tag("pre", attributes) + } + + fn build_code_tag(&self, attributes: &HashMap<String, String>) -> String { + // similarly to above, since comrak does not treat `,` as an info-string delimiter it will + // try to apply `class="language-rust,ignore"` for the info-string `rust,ignore`, so we + // have to detect that case and fixup the class here + // TODO: https://github.com/kivikakk/comrak/issues/246 + let mut attributes = attributes.clone(); + if let Some(classes) = attributes.get_mut("class") { + *classes = classes + .split(' ') + .flat_map(|class| [class.split(',').next().unwrap_or(class), " "]) + .collect(); + // remove trailing ' ' + // TODO: https://github.com/rust-lang/rust/issues/79524 or itertools + classes.pop(); + } + build_opening_tag("code", &attributes) + } +} + +fn build_opening_tag(tag: &str, attributes: &HashMap<String, String>) -> String { + let mut tag_parts = format!("<{tag}"); + for (attr, val) in attributes { + write!(tag_parts, " {attr}=\"{val}\"").unwrap(); + } + tag_parts.push('>'); + tag_parts +} + +fn render_with_highlighter( + text: &str, + highlighter: impl Fn(Option<&str>, &str) -> String, +) -> String { + comrak::markdown_to_html_with_plugins( + text, + &ComrakOptions { + extension: ComrakExtensionOptions { + superscript: true, + table: true, + autolink: true, + tasklist: true, + strikethrough: true, + ..ComrakExtensionOptions::default() + }, + ..ComrakOptions::default() + }, + &ComrakPlugins { + render: ComrakRenderPlugins { + codefence_syntax_highlighter: Some(&CodeAdapter(highlighter)), + }, + }, + ) +} + +/// Wrapper around the Markdown parser and renderer to render markdown +pub fn render(text: &str) -> String { + render_with_highlighter(text, highlight::with_lang) +} + +#[cfg(test)] +mod test { + use super::render_with_highlighter; + use indoc::indoc; + use std::cell::RefCell; + + #[test] + fn ignore_info_string_attributes() { + let highlighted = RefCell::new(vec![]); + + let output = render_with_highlighter( + indoc! {" + ```rust,ignore + ignore::commas(); + ``` + + ```rust ignore + ignore::spaces(); + ``` + "}, + |lang, code| { + highlighted + .borrow_mut() + .push((lang.map(str::to_owned), code.to_owned())); + code.to_owned() + }, + ); + + assert!(output.matches(r#"<code class="language-rust">"#).count() == 2); + assert_eq!( + highlighted.borrow().as_slice(), + [ + (Some("rust".into()), "ignore::commas();\n".into()), + (Some("rust".into()), "ignore::spaces();\n".into()) + ] + ); + } +} diff --git a/src/web/mod.rs b/src/web/mod.rs index cf0164a0a..282c87e24 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -81,6 +81,8 @@ mod error; mod extensions; mod features; mod file; +mod highlight; +mod markdown; pub(crate) mod metrics; mod releases; mod routes; @@ -414,25 +416,6 @@ fn match_version( Err(Nope::VersionNotFound) } -/// Wrapper around the Markdown parser and renderer to render markdown -fn render_markdown(text: &str) -> String { - use comrak::{markdown_to_html, ComrakExtensionOptions, ComrakOptions}; - - let options = ComrakOptions { - extension: ComrakExtensionOptions { - superscript: true, - table: true, - autolink: true, - tasklist: true, - strikethrough: true, - ..ComrakExtensionOptions::default() - }, - ..ComrakOptions::default() - }; - - markdown_to_html(text, &options) -} - #[must_use = "`Server` blocks indefinitely when dropped"] pub struct Server { inner: Listening, diff --git a/src/web/page/templates.rs b/src/web/page/templates.rs index 99c944b76..6b42bc019 100644 --- a/src/web/page/templates.rs +++ b/src/web/page/templates.rs @@ -100,6 +100,7 @@ pub(super) fn load_templates(conn: &mut Client) -> Result<Tera> { tera.register_filter("fas", IconType::Strong); tera.register_filter("far", IconType::Regular); tera.register_filter("fab", IconType::Brand); + tera.register_filter("highlight", Highlight); Ok(tera) } @@ -303,6 +304,36 @@ impl tera::Filter for IconType { } } +struct Highlight; + +impl tera::Filter for Highlight { + fn filter(&self, value: &Value, args: &HashMap<String, Value>) -> TeraResult<Value> { + let code = value.as_str().ok_or_else(|| { + let msg = format!( "Filter `highlight` was called on an incorrect value: got `{value}` but expected a string"); + tera::Error::msg(msg) + })?; + let lang = args + .get("lang") + .and_then(|lang| { + if lang.is_null() { + None + } else { + Some(lang.as_str().ok_or_else(|| { + let msg = format!("Filter `highlight` received an incorrect type for arg `{lang}`: got `{lang}` but expected a string"); + tera::Error::msg(msg) + })) + } + }) + .transpose()?; + let highlighted = crate::web::highlight::with_lang(lang, code); + Ok(format!("<pre><code>{highlighted}</code></pre>").into()) + } + + fn is_safe(&self) -> bool { + true + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/src/web/source.rs b/src/web/source.rs index 10cd9b931..5541d637f 100644 --- a/src/web/source.rs +++ b/src/web/source.rs @@ -26,6 +26,21 @@ struct File { mime: String, } +impl File { + fn from_path_and_mime(path: &str, mime: &str) -> File { + let (name, mime) = if let Some((dir, _)) = path.split_once('/') { + (dir, "dir") + } else { + (path, mime) + }; + + Self { + name: name.to_owned(), + mime: mime.to_owned(), + } + } +} + /// A list of source files #[derive(Debug, Clone, PartialEq, Serialize)] struct FileList { @@ -98,22 +113,8 @@ impl FileList { } // look only files for req_path - if path.starts_with(req_path) { - // remove req_path from path to reach files in this directory - let path = path.replace(req_path, ""); - let path_splited: Vec<&str> = path.split('/').collect(); - - // if path have '/' it is a directory - let mime = if path_splited.len() > 1 { - "dir".to_owned() - } else { - mime.to_owned() - }; - - let file = File { - name: path_splited[0].to_owned(), - mime, - }; + if let Some(path) = path.strip_prefix(req_path) { + let file = File::from_path_and_mime(path, mime); // avoid adding duplicates, a directory may occur more than once if !file_list.contains(&file) { @@ -163,8 +164,8 @@ impl FileList { struct SourcePage { file_list: FileList, show_parent_link: bool, + file: Option<File>, file_content: Option<String>, - is_rust_source: bool, canonical_url: String, } @@ -271,20 +272,26 @@ pub fn source_browser_handler(req: &mut Request) -> IronResult<Response> { None }; - let (file_content, is_rust_source) = if let Some(blob) = blob { + let (file, file_content) = if let Some(blob) = blob { + let is_text = blob.mime.starts_with("text") || blob.mime == "application/json"; // serve the file with DatabaseFileHandler if file isn't text and not empty - if !blob.mime.starts_with("text") && !blob.is_empty() { + if !is_text && !blob.is_empty() { return Ok(DbFile(blob).serve()); - } else if blob.mime.starts_with("text") && !blob.is_empty() { + } else if is_text && !blob.is_empty() { + let path = blob + .path + .rsplit_once('/') + .map(|(_, path)| path) + .unwrap_or(&blob.path); ( + Some(File::from_path_and_mime(path, &blob.mime)), String::from_utf8(blob.content).ok(), - blob.path.ends_with(".rs"), ) } else { - (None, false) + (None, None) } } else { - (None, false) + (None, None) }; let file_list = FileList::from_path( @@ -299,8 +306,8 @@ pub fn source_browser_handler(req: &mut Request) -> IronResult<Response> { SourcePage { file_list, show_parent_link: !req_path.is_empty(), + file, file_content, - is_rust_source, canonical_url, } .into_response(req) @@ -423,4 +430,78 @@ mod tests { Ok(()) }) } + + #[test] + fn cargo_special_filetypes_are_highlighted() { + wrapper(|env| { + env.fake_release() + .name("fake") + .version("0.1.0") + .source_file("Cargo.toml.orig", b"[package]") + .source_file("Cargo.lock", b"[dependencies]") + .create()?; + + let web = env.frontend(); + + let response = web + .get("/crate/fake/0.1.0/source/Cargo.toml.orig") + .send()? + .text()?; + assert!(response.contains(r#"<span class="syntax-source syntax-toml">"#)); + + let response = web + .get("/crate/fake/0.1.0/source/Cargo.lock") + .send()? + .text()?; + assert!(response.contains(r#"<span class="syntax-source syntax-toml">"#)); + + Ok(()) + }); + } + + #[test] + fn dotfiles_with_extension_are_highlighted() { + wrapper(|env| { + env.fake_release() + .name("fake") + .version("0.1.0") + .source_file(".rustfmt.toml", b"[rustfmt]") + .create()?; + + let web = env.frontend(); + + let response = web + .get("/crate/fake/0.1.0/source/.rustfmt.toml") + .send()? + .text()?; + assert!(response.contains(r#"<span class="syntax-source syntax-toml">"#)); + + Ok(()) + }); + } + + #[test] + fn json_is_served_as_rendered_html() { + wrapper(|env| { + env.fake_release() + .name("fake") + .version("0.1.0") + .source_file("config.json", b"{}") + .create()?; + + let web = env.frontend(); + + let response = web.get("/crate/fake/0.1.0/source/config.json").send()?; + assert!(response + .headers() + .get("content-type") + .unwrap() + .to_str() + .unwrap() + .starts_with("text/html")); + assert!(response.text()?.starts_with(r#"<!DOCTYPE html>"#)); + + Ok(()) + }); + } } diff --git a/src/web/statics.rs b/src/web/statics.rs index 915d71fbc..9a5925f24 100644 --- a/src/web/statics.rs +++ b/src/web/statics.rs @@ -258,7 +258,7 @@ mod tests { wrapper(|env| { let web = env.frontend(); - let files = &[("highlightjs/styles/dark.min.css", "text/css")]; + let files = &[("vendored.css", "text/css")]; for (file, mime) in files { let url = format!("/-/static/{}", file); diff --git a/templates/core/about/builds.html b/templates/core/about/builds.html index 5e4f74c26..93a47f7f3 100644 --- a/templates/core/about/builds.html +++ b/templates/core/about/builds.html @@ -31,11 +31,11 @@ <h4 id="setting-a-readme"> <a href="#setting-a-readme">Setting a README</a> </h4 <h4 id="detecting-docsrs"> <a href="#detecting-docsrs">Detecting Docs.rs</a> </h4> <p> To recognize Docs.rs from <code>build.rs</code> files, you can test for the environment variable <code>DOCS_RS</code>, e.g.: - {% filter dedent(levels=3) -%} - <pre><code class="lang-rust">if std::env::var("DOCS_RS").is_ok() { + {% filter highlight(lang="rust") %}{% filter dedent(levels=3) -%} + if std::env::var("DOCS_RS").is_ok() { // ... your code here ... - }</code></pre> - {%- endfilter %} + } + {%- endfilter %}{% endfilter %} This approach can be helpful if you need dependencies for building the library, but not for building the documentation. </p> @@ -46,10 +46,10 @@ <h4 id="cross-compiling"> <a href="#cross-compiling">Cross-compiling</a> </h4> <p> You can configure how your crate is built by adding <a href="metadata">package metadata</a> to your <code>Cargo.toml</code>, e.g.: - {% filter dedent -%} - <pre><code class="lang-toml">[package.metadata.docs.rs] - rustc-args = ["--cfg", "docsrs"]</code></pre> - {%- endfilter %} + {% filter highlight(lang="toml") %}{% filter dedent -%} + [package.metadata.docs.rs] + rustc-args = ["--cfg", "docsrs"] + {%- endfilter %}{% endfilter %} Here, the compiler arguments are set so that <code>#[cfg(docsrs)]</code> (not to be confused with <code>#[cfg(doc)]</code>) can be used for conditional compilation. This approach is also useful for setting <a href="https://doc.rust-lang.org/cargo/reference/features.html">cargo features</a>. </p> @@ -107,11 +107,3 @@ <h4 id="failures-and-rebuilds"> <a href="#failures-and-rebuilds">Other failures <br /> </div> {%- endblock body %} - -{% block css -%} - {{ macros::highlight_css() }} -{%- endblock css %} - -{% block javascript -%} - {{ macros::highlight_js(languages=["ini"]) }} -{%- endblock javascript %} diff --git a/templates/core/about/metadata.html b/templates/core/about/metadata.html index f9a2b08cc..99880d42b 100644 --- a/templates/core/about/metadata.html +++ b/templates/core/about/metadata.html @@ -14,15 +14,9 @@ <h1>Metadata for custom builds</h1> <p>The available configuration flags you can customize are:</p> - <pre><code class="lang-toml">{%- include "core/Cargo.toml.example" -%}</code></pre> + {% filter highlight(lang="toml") %} + {%- include "core/Cargo.toml.example" -%} + {% endfilter %} </div> </div> {%- endblock body %} - -{% block css -%} - {{ macros::highlight_css() }} -{%- endblock css %} - -{% block javascript -%} - {{ macros::highlight_js(languages=["ini"]) }} -{%- endblock javascript %} diff --git a/templates/crate/details.html b/templates/crate/details.html index 9fb08caa9..bf8c280bf 100644 --- a/templates/crate/details.html +++ b/templates/crate/details.html @@ -194,12 +194,3 @@ </div> </div> {%- endblock body -%} - -{%- block css -%} - {{ macros::highlight_css() }} -{%- endblock css -%} - -{%- block javascript -%} - {# Enable and load Rust and TOML syntax highlighting #} - {{ macros::highlight_js(languages=["rust", "ini"]) }} -{% endblock javascript -%} diff --git a/templates/crate/source.html b/templates/crate/source.html index cf1bc029c..510fb293f 100644 --- a/templates/crate/source.html +++ b/templates/crate/source.html @@ -113,21 +113,14 @@ {# If the file has content, then display it in a codeblock #} {%- if file_content -%} <div id="source-code" class="pure-u-1 pure-u-sm-17-24 pure-u-md-19-24"> - <pre><code>{{ file_content }}</code></pre> + {{- file_content | highlight(lang=file.name) -}} </div> {%- endif -%} </div> </div> {%- endblock body -%} -{%- block css -%} - {# Highlight.js CSS #} - {{ macros::highlight_css() }} -{%- endblock css -%} - {%- block javascript -%} - {# Highlight.js JavaScript #} - {{ macros::highlight_js(languages=["rust", "ini", "markdown"]) }} {% if file_content %} <script nonce="{{ csp_nonce }}" type="text/javascript" src="/-/static/source.js?{{ docsrs_version() | slugify }}"></script> {% endif %} diff --git a/templates/macros.html b/templates/macros.html index 40ca6703a..8ee4fc0e9 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -1,52 +1,3 @@ -{# - Makes the appropriate JS imports for highlighting - * `languages` An array of strings where each is a valid highlight.js language -#} -{% macro highlight_js(languages) %} - {# Load the highlight script #} - <script nonce="{{ csp_nonce }}" src="/-/static/highlightjs/highlight.min.js" type="text/javascript"></script> - - {# Load the script for each provided language #} - {%- for language in languages -%} - <script nonce="{{ csp_nonce }}" src="/-/static/highlightjs/languages/{{ language }}.min.js" type="text/javascript"></script> - {%- endfor -%} - - {# Activate highlighting #} - <script nonce="{{ csp_nonce }}" type="text/javascript"> - hljs.initHighlighting(); - </script> -{% endmacro highlight_js %} - -{# Makes the appropriate CSS imports for highlighting #} -{% macro highlight_css() %} - {# Load the highlighting theme css #} - <script nonce="{{ csp_nonce }}" type="text/javascript"> - // Choose which highlight.js theme to load based on the user theme - var stylesheet; - switch(document.documentElement.dataset.theme) { - case "ayu": - stylesheet = "/-/static/ayu-highlight.css"; - break; - case "dark": - stylesheet = "/-/static/highlightjs/styles/dark.min.css"; - break; - case "null": // The user is visiting docs.rs for the first time and hasn't set a theme yet. - case "light": - stylesheet = "/-/static/highlightjs/styles/github.min.css"; - break; - default: - throw "unrecognized theme " + document.documentElement.dataset.theme; - break; - } - // Now add the stylesheet to the document - var link = document.createElement("link"); - link.rel = "stylesheet"; - link.href = stylesheet; - link.media = "all"; - document.head.appendChild(link); - </script> -{% endmacro highlight_css %} - {# Creates a list entry for active tabs. When the active tab is the same as `expected`, it will show the current tab as active. * `expected` A string that represents the current tab, when `active_tab == expected` the current will be shown as active diff --git a/templates/style/_syntax-themes.scss b/templates/style/_syntax-themes.scss new file mode 100644 index 000000000..ac6dc076e --- /dev/null +++ b/templates/style/_syntax-themes.scss @@ -0,0 +1,59 @@ +html { + --color-syntax-foreground: inherit; + --color-syntax-attribute: #c82829; + --color-syntax-background: #f5f5f5; + --color-syntax-bool: #c82829; + --color-syntax-comment: #8e908c; + --color-syntax-doc-comment: #4d4d4c; + --color-syntax-keyword1: #8959a8; + --color-syntax-keyword2: #4271ae; + --color-syntax-lifetime: #b76514; + --color-syntax-macro: #3e999f; + --color-syntax-number: #718c00; + --color-syntax-prelude-ty: #4271ae; + --color-syntax-prelude-val: #c82829; + --color-syntax-question-mark: #ff9011; + --color-syntax-self: #c82829; + --color-syntax-string: #718c00; +} + +// To add a new theme, copy the above theme into a new `html[data-theme="name"]` +// block below and change the colors + +html[data-theme="dark"] { + --color-syntax-foreground: inherit; + --color-syntax-attribute: #ee6868; + --color-syntax-background: #2a2a2a; + --color-syntax-bool: #ee6868; + --color-syntax-comment: #8d8d8b; + --color-syntax-doc-comment: #8ca375; + --color-syntax-keyword1: #ab8ac1; + --color-syntax-keyword2: #769acb; + --color-syntax-lifetime: #d97f26; + --color-syntax-macro: #3e999f; + --color-syntax-number: #83a300; + --color-syntax-prelude-ty: #769acb; + --color-syntax-prelude-val: #ee6868; + --color-syntax-question-mark: #ff9011; + --color-syntax-self: #ee6868; + --color-syntax-string: #83a300; +} + +html[data-theme="ayu"] { + --color-syntax-foreground: #e6e1cf; + --color-syntax-attribute: #e6e1cf; + --color-syntax-background: #191f26; + --color-syntax-bool: #ff7733; + --color-syntax-comment: #788797; + --color-syntax-doc-comment: #a1ac88; + --color-syntax-keyword1: #ff7733; + --color-syntax-keyword2: #ff7733; + --color-syntax-lifetime: #ff7733; + --color-syntax-macro: #a37acc; + --color-syntax-number: #b8cc52; + --color-syntax-prelude-ty: #ff7733; + --color-syntax-prelude-val: #ff7733; + --color-syntax-question-mark: #ff9011; + --color-syntax-self: #36a3d9; + --color-syntax-string: #b8cc52; +} diff --git a/templates/style/_syntax.scss b/templates/style/_syntax.scss new file mode 100644 index 000000000..735aec8cd --- /dev/null +++ b/templates/style/_syntax.scss @@ -0,0 +1,36 @@ +@import "syntax-themes"; + +pre > code { + color: var(--color-syntax-foreground); + background-color: var(--color-syntax-background); + padding: 0.5em; + display: block; + overflow-x: auto; +} + +// Rust +.syntax-keyword { color: var(--color-syntax-keyword1); } +.syntax-annotation, .syntax-annotation .syntax-operator { color: var(--color-syntax-attribute); } +.syntax-macro { color: var(--color-syntax-macro); } +.syntax-type { color: var(--color-syntax-keyword1); } +.syntax-comment { color: var(--color-syntax-comment); } +.syntax-documentation, .syntax-documentation .syntax-comment { color: var(--color-syntax-doc-comment); } +.syntax-operator, .syntax-modifier { color: var(--color-syntax-keyword2); } +.syntax-lifetime { color: var(--color-syntax-lifetime); } +.syntax-string { color: var(--color-syntax-string); } +.syntax-numeric { color: var(--color-syntax-number); } + +// TOML +.syntax-table { color: var(--color-syntax-attribute); font-weight: bold; } +.syntax-constant { color: var(--color-syntax-bool); } + +// Markdown +.syntax-heading { color: var(--color-syntax-attribute); font-weight: bold; } + +// YAML +.syntax-yaml .syntax-string { color: var(--color-syntax-string); } +.syntax-yaml .syntax-name { color: var(--color-syntax-foreground); } +// 99% of the time a "boolean" is actually `on` which is really a string +.syntax-yaml .syntax-boolean { color: var(--color-syntax-foreground); } +.syntax-yaml .syntax-punctuation { color: var(--color-syntax-keyword1); } +.syntax-yaml .syntax-comment .syntax-punctuation { color: var(--color-syntax-comment); } diff --git a/templates/style/style.scss b/templates/style/style.scss index 0063f60ec..a5da2da43 100644 --- a/templates/style/style.scss +++ b/templates/style/style.scss @@ -1,5 +1,5 @@ // FIXME: Use modules -@import "vars", "utils", "navbar", "themes", "fa", "footer"; +@import "vars", "utils", "navbar", "themes", "fa", "footer", "syntax"; /* See FiraSans-LICENSE.txt for the Fira Sans license. */ @font-face { diff --git a/vendor/highlightjs/LICENSE b/vendor/highlightjs/LICENSE deleted file mode 100644 index 2250cc7ec..000000000 --- a/vendor/highlightjs/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2006, Ivan Sagalaev. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/highlightjs/highlight.min.js b/vendor/highlightjs/highlight.min.js deleted file mode 100644 index 532ae2a28..000000000 --- a/vendor/highlightjs/highlight.min.js +++ /dev/null @@ -1,1296 +0,0 @@ -/* - Highlight.js 10.5.0 (af20048d) - License: BSD-3-Clause - Copyright (c) 2006-2020, Ivan Sagalaev -*/ -var hljs=function(){"use strict";function e(t){ -return t instanceof Map?t.clear=t.delete=t.set=()=>{ -throw Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=()=>{ -throw Error("set is read-only") -}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach((n=>{var s=t[n] -;"object"!=typeof s||Object.isFrozen(s)||e(s)})),t}var t=e,n=e;t.default=n -;class s{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data} -ignoreMatch(){this.ignore=!0}}function r(e){ -return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'") -}function a(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t] -;return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n}const i=e=>!!e.kind -;class o{constructor(e,t){ -this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){ -this.buffer+=r(e)}openNode(e){if(!i(e))return;let t=e.kind -;e.sublanguage||(t=`${this.classPrefix}${t}`),this.span(t)}closeNode(e){ -i(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){ -this.buffer+=`<span class="${e}">`}}class l{constructor(){this.rootNode={ -children:[]},this.stack=[this.rootNode]}get top(){ -return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){ -this.top.children.push(e)}openNode(e){const t={kind:e,children:[]} -;this.add(t),this.stack.push(t)}closeNode(){ -if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ -for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)} -walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){ -return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t), -t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){ -"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{ -l._collapse(e)})))}}class c extends l{constructor(e){super(),this.options=e} -addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())} -addText(e){""!==e&&this.add(e)}addSublanguage(e,t){const n=e.root -;n.kind=t,n.sublanguage=!0,this.add(n)}toHTML(){ -return new o(this,this.options).value()}finalize(){return!0}}function u(e){ -return e?"string"==typeof e?e:e.source:null} -const g="[a-zA-Z]\\w*",d="[a-zA-Z_]\\w*",h="\\b\\d+(\\.\\d+)?",f="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",p="\\b(0b[01]+)",m={ -begin:"\\\\[\\s\\S]",relevance:0},b={className:"string",begin:"'",end:"'", -illegal:"\\n",contains:[m]},x={className:"string",begin:'"',end:'"', -illegal:"\\n",contains:[m]},E={ -begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ -},v=(e,t,n={})=>{const s=a({className:"comment",begin:e,end:t,contains:[]},n) -;return s.contains.push(E),s.contains.push({className:"doctag", -begin:"(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):",relevance:0}),s -},N=v("//","$"),w=v("/\\*","\\*/"),R=v("#","$");var y=Object.freeze({ -__proto__:null,IDENT_RE:g,UNDERSCORE_IDENT_RE:d,NUMBER_RE:h,C_NUMBER_RE:f, -BINARY_NUMBER_RE:p, -RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", -SHEBANG:(e={})=>{const t=/^#![ ]*\// -;return e.binary&&(e.begin=((...e)=>e.map((e=>u(e))).join(""))(t,/.*\b/,e.binary,/\b.*/)), -a({className:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{ -0!==e.index&&t.ignoreMatch()}},e)},BACKSLASH_ESCAPE:m,APOS_STRING_MODE:b, -QUOTE_STRING_MODE:x,PHRASAL_WORDS_MODE:E,COMMENT:v,C_LINE_COMMENT_MODE:N, -C_BLOCK_COMMENT_MODE:w,HASH_COMMENT_MODE:R,NUMBER_MODE:{className:"number", -begin:h,relevance:0},C_NUMBER_MODE:{className:"number",begin:f,relevance:0}, -BINARY_NUMBER_MODE:{className:"number",begin:p,relevance:0},CSS_NUMBER_MODE:{ -className:"number", -begin:h+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?", -relevance:0},REGEXP_MODE:{begin:/(?=\/[^/\n]*\/)/,contains:[{className:"regexp", -begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[m,{begin:/\[/,end:/\]/, -relevance:0,contains:[m]}]}]},TITLE_MODE:{className:"title",begin:g,relevance:0 -},UNDERSCORE_TITLE_MODE:{className:"title",begin:d,relevance:0},METHOD_GUARD:{ -begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},END_SAME_AS_BEGIN:e=>Object.assign(e,{ -"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{ -t.data._beginMatch!==e[1]&&t.ignoreMatch()}})});function _(e,t){ -"."===e.input[e.index-1]&&t.ignoreMatch()}function k(e,t){ -t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)", -e.__beforeBegin=_,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords) -}function M(e,t){ -Array.isArray(e.illegal)&&(e.illegal=((...e)=>"("+e.map((e=>u(e))).join("|")+")")(...e.illegal)) -}function O(e,t){if(e.match){ -if(e.begin||e.end)throw Error("begin & end are not supported with match") -;e.begin=e.match,delete e.match}}function A(e,t){ -void 0===e.relevance&&(e.relevance=1)} -const L=["of","and","for","in","not","or","if","then","parent","list","value"] -;function B(e,t){return t?Number(t):(e=>L.includes(e.toLowerCase()))(e)?0:1} -function I(e,{plugins:t}){function n(t,n){ -return RegExp(u(t),"m"+(e.case_insensitive?"i":"")+(n?"g":""))}class s{ -constructor(){ -this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} -addRule(e,t){ -t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]), -this.matchAt+=(e=>RegExp(e.toString()+"|").exec("").length-1)(e)+1}compile(){ -0===this.regexes.length&&(this.exec=()=>null) -;const e=this.regexes.map((e=>e[1]));this.matcherRe=n(((e,t="|")=>{ -const n=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;let s=0,r="" -;for(let a=0;a<e.length;a++){s+=1;const i=s;let o=u(e[a]) -;for(a>0&&(r+=t),r+="(";o.length>0;){const e=n.exec(o);if(null==e){r+=o;break} -r+=o.substring(0,e.index), -o=o.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?r+="\\"+(Number(e[1])+i):(r+=e[0], -"("===e[0]&&s++)}r+=")"}return r})(e),!0),this.lastIndex=0}exec(e){ -this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e) -;if(!t)return null -;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),s=this.matchIndexes[n] -;return t.splice(0,n),Object.assign(t,s)}}class r{constructor(){ -this.rules=[],this.multiRegexes=[], -this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ -if(this.multiRegexes[e])return this.multiRegexes[e];const t=new s -;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))), -t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){ -return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){ -this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){ -const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex -;let n=t.exec(e) -;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{ -const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)} -return n&&(this.regexIndex+=n.position+1, -this.regexIndex===this.count&&this.considerAll()),n}} -if(e.compilerExtensions||(e.compilerExtensions=[]), -e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") -;return e.classNameAliases=a(e.classNameAliases||{}),function t(s,i){const o=s -;if(s.compiled)return o -;[O].forEach((e=>e(s,i))),e.compilerExtensions.forEach((e=>e(s,i))), -s.__beforeBegin=null,[k,M,A].forEach((e=>e(s,i))),s.compiled=!0;let l=null -;if("object"==typeof s.keywords&&(l=s.keywords.$pattern, -delete s.keywords.$pattern),s.keywords&&(s.keywords=((e,t)=>{const n={} -;return"string"==typeof e?s("keyword",e):Object.keys(e).forEach((t=>{s(t,e[t]) -})),n;function s(e,s){t&&(s=s.toLowerCase()),s.split(" ").forEach((t=>{ -const s=t.split("|");n[s[0]]=[e,B(s[0],s[1])]}))} -})(s.keywords,e.case_insensitive)), -s.lexemes&&l)throw Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ") -;return l=l||s.lexemes||/\w+/, -o.keywordPatternRe=n(l,!0),i&&(s.begin||(s.begin=/\B|\b/), -o.beginRe=n(s.begin),s.endSameAsBegin&&(s.end=s.begin), -s.end||s.endsWithParent||(s.end=/\B|\b/), -s.end&&(o.endRe=n(s.end)),o.terminatorEnd=u(s.end)||"", -s.endsWithParent&&i.terminatorEnd&&(o.terminatorEnd+=(s.end?"|":"")+i.terminatorEnd)), -s.illegal&&(o.illegalRe=n(s.illegal)), -s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>a(e,{ -variants:null},t)))),e.cachedVariants?e.cachedVariants:T(e)?a(e,{ -starts:e.starts?a(e.starts):null -}):Object.isFrozen(e)?a(e):e))("self"===e?s:e)))),s.contains.forEach((e=>{t(e,o) -})),s.starts&&t(s.starts,i),o.matcher=(e=>{const t=new r -;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin" -}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end" -}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(o),o}(e)}function T(e){ -return!!e&&(e.endsWithParent||T(e.starts))}function j(e){const t={ -props:["language","code","autodetect"],data:()=>({detectedLanguage:"", -unknownLanguage:!1}),computed:{className(){ -return this.unknownLanguage?"":"hljs "+this.detectedLanguage},highlighted(){ -if(!this.autoDetect&&!e.getLanguage(this.language))return console.warn(`The language "${this.language}" you specified could not be found.`), -this.unknownLanguage=!0,r(this.code);let t={} -;return this.autoDetect?(t=e.highlightAuto(this.code), -this.detectedLanguage=t.language):(t=e.highlight(this.language,this.code,this.ignoreIllegals), -this.detectedLanguage=this.language),t.value},autoDetect(){ -return!(this.language&&(e=this.autodetect,!e&&""!==e));var e}, -ignoreIllegals:()=>!0},render(e){return e("pre",{},[e("code",{ -class:this.className,domProps:{innerHTML:this.highlighted}})])}};return{ -Component:t,VuePlugin:{install(e){e.component("highlightjs",t)}}}}const S={ -"after:highlightBlock":({block:e,result:t,text:n})=>{const s=D(e) -;if(!s.length)return;const a=document.createElement("div") -;a.innerHTML=t.value,t.value=((e,t,n)=>{let s=0,a="";const i=[];function o(){ -return e.length&&t.length?e[0].offset!==t[0].offset?e[0].offset<t[0].offset?e:t:"start"===t[0].event?e:t:e.length?e:t -}function l(e){a+="<"+P(e)+[].map.call(e.attributes,(function(e){ -return" "+e.nodeName+'="'+r(e.value)+'"'})).join("")+">"}function c(e){ -a+="</"+P(e)+">"}function u(e){("start"===e.event?l:c)(e.node)} -for(;e.length||t.length;){let t=o() -;if(a+=r(n.substring(s,t[0].offset)),s=t[0].offset,t===e){i.reverse().forEach(c) -;do{u(t.splice(0,1)[0]),t=o()}while(t===e&&t.length&&t[0].offset===s) -;i.reverse().forEach(l) -}else"start"===t[0].event?i.push(t[0].node):i.pop(),u(t.splice(0,1)[0])} -return a+r(n.substr(s))})(s,D(a),n)}};function P(e){ -return e.nodeName.toLowerCase()}function D(e){const t=[];return function e(n,s){ -for(let r=n.firstChild;r;r=r.nextSibling)3===r.nodeType?s+=r.nodeValue.length:1===r.nodeType&&(t.push({ -event:"start",offset:s,node:r}),s=e(r,s),P(r).match(/br|hr|img|input/)||t.push({ -event:"stop",offset:s,node:r}));return s}(e,0),t}const C=e=>{console.error(e) -},H=(e,...t)=>{console.log("WARN: "+e,...t)},$=(e,t)=>{ -console.log(`Deprecated as of ${e}. ${t}`)},U=r,z=a,K=Symbol("nomatch") -;return(e=>{const n=Object.create(null),r=Object.create(null),a=[];let i=!0 -;const o=/(^(<[^>]+>|\t|)+|\n)/gm,l="Could not find the language '{}', did you forget to load/include a language module?",u={ -disableAutodetect:!0,name:"Plain text",contains:[]};let g={ -noHighlightRe:/^(no-?highlight)$/i, -languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-", -tabReplace:null,useBR:!1,languages:null,__emitter:c};function d(e){ -return g.noHighlightRe.test(e)}function h(e,t,n,s){const r={code:t,language:e} -;_("before:highlight",r);const a=r.result?r.result:f(r.language,r.code,n,s) -;return a.code=r.code,_("after:highlight",a),a}function f(e,t,r,o){const c=t -;function u(e,t){const n=w.case_insensitive?t[0].toLowerCase():t[0] -;return Object.prototype.hasOwnProperty.call(e.keywords,n)&&e.keywords[n]} -function d(){null!=_.subLanguage?(()=>{if(""===O)return;let e=null -;if("string"==typeof _.subLanguage){ -if(!n[_.subLanguage])return void M.addText(O) -;e=f(_.subLanguage,O,!0,k[_.subLanguage]),k[_.subLanguage]=e.top -}else e=p(O,_.subLanguage.length?_.subLanguage:null) -;_.relevance>0&&(A+=e.relevance),M.addSublanguage(e.emitter,e.language) -})():(()=>{if(!_.keywords)return void M.addText(O);let e=0 -;_.keywordPatternRe.lastIndex=0;let t=_.keywordPatternRe.exec(O),n="";for(;t;){ -n+=O.substring(e,t.index);const s=u(_,t);if(s){const[e,r]=s -;M.addText(n),n="",A+=r;const a=w.classNameAliases[e]||e;M.addKeyword(t[0],a) -}else n+=t[0];e=_.keywordPatternRe.lastIndex,t=_.keywordPatternRe.exec(O)} -n+=O.substr(e),M.addText(n)})(),O=""}function h(e){ -return e.className&&M.openNode(w.classNameAliases[e.className]||e.className), -_=Object.create(e,{parent:{value:_}}),_}function m(e,t,n){let r=((e,t)=>{ -const n=e&&e.exec(t);return n&&0===n.index})(e.endRe,n);if(r){if(e["on:end"]){ -const n=new s(e);e["on:end"](t,n),n.ignore&&(r=!1)}if(r){ -for(;e.endsParent&&e.parent;)e=e.parent;return e}} -if(e.endsWithParent)return m(e.parent,t,n)}function b(e){ -return 0===_.matcher.regexIndex?(O+=e[0],1):(T=!0,0)}function x(e){ -const t=e[0],n=c.substr(e.index),s=m(_,e,n);if(!s)return K;const r=_ -;r.skip?O+=t:(r.returnEnd||r.excludeEnd||(O+=t),d(),r.excludeEnd&&(O=t));do{ -_.className&&M.closeNode(),_.skip||_.subLanguage||(A+=_.relevance),_=_.parent -}while(_!==s.parent) -;return s.starts&&(s.endSameAsBegin&&(s.starts.endRe=s.endRe), -h(s.starts)),r.returnEnd?0:t.length}let E={};function v(t,n){const a=n&&n[0] -;if(O+=t,null==a)return d(),0 -;if("begin"===E.type&&"end"===n.type&&E.index===n.index&&""===a){ -if(O+=c.slice(n.index,n.index+1),!i){const t=Error("0 width match regex") -;throw t.languageName=e,t.badRule=E.rule,t}return 1} -if(E=n,"begin"===n.type)return function(e){ -const t=e[0],n=e.rule,r=new s(n),a=[n.__beforeBegin,n["on:begin"]] -;for(const n of a)if(n&&(n(e,r),r.ignore))return b(t) -;return n&&n.endSameAsBegin&&(n.endRe=RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")), -n.skip?O+=t:(n.excludeBegin&&(O+=t), -d(),n.returnBegin||n.excludeBegin||(O=t)),h(n),n.returnBegin?0:t.length}(n) -;if("illegal"===n.type&&!r){ -const e=Error('Illegal lexeme "'+a+'" for mode "'+(_.className||"<unnamed>")+'"') -;throw e.mode=_,e}if("end"===n.type){const e=x(n);if(e!==K)return e} -if("illegal"===n.type&&""===a)return 1 -;if(B>1e5&&B>3*n.index)throw Error("potential infinite loop, way more iterations than matches") -;return O+=a,a.length}const w=N(e) -;if(!w)throw C(l.replace("{}",e)),Error('Unknown language: "'+e+'"') -;const R=I(w,{plugins:a});let y="",_=o||R;const k={},M=new g.__emitter(g);(()=>{ -const e=[];for(let t=_;t!==w;t=t.parent)t.className&&e.unshift(t.className) -;e.forEach((e=>M.openNode(e)))})();let O="",A=0,L=0,B=0,T=!1;try{ -for(_.matcher.considerAll();;){ -B++,T?T=!1:_.matcher.considerAll(),_.matcher.lastIndex=L -;const e=_.matcher.exec(c);if(!e)break;const t=v(c.substring(L,e.index),e) -;L=e.index+t}return v(c.substr(L)),M.closeAllNodes(),M.finalize(),y=M.toHTML(),{ -relevance:A,value:y,language:e,illegal:!1,emitter:M,top:_}}catch(t){ -if(t.message&&t.message.includes("Illegal"))return{illegal:!0,illegalBy:{ -msg:t.message,context:c.slice(L-100,L+100),mode:t.mode},sofar:y,relevance:0, -value:U(c),emitter:M};if(i)return{illegal:!1,relevance:0,value:U(c),emitter:M, -language:e,top:_,errorRaised:t};throw t}}function p(e,t){ -t=t||g.languages||Object.keys(n);const s=(e=>{const t={relevance:0, -emitter:new g.__emitter(g),value:U(e),illegal:!1,top:u} -;return t.emitter.addText(e),t})(e),r=t.filter(N).filter(R).map((t=>f(t,e,!1))) -;r.unshift(s);const a=r.sort(((e,t)=>{ -if(e.relevance!==t.relevance)return t.relevance-e.relevance -;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1 -;if(N(t.language).supersetOf===e.language)return-1}return 0})),[i,o]=a,l=i -;return l.second_best=o,l}const m={"before:highlightBlock":({block:e})=>{ -g.useBR&&(e.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ /]*>/g,"\n")) -},"after:highlightBlock":({result:e})=>{ -g.useBR&&(e.value=e.value.replace(/\n/g,"<br>"))}},b=/^(<[^>]+>|\t)+/gm,x={ -"after:highlightBlock":({result:e})=>{ -g.tabReplace&&(e.value=e.value.replace(b,(e=>e.replace(/\t/g,g.tabReplace))))}} -;function E(e){let t=null;const n=(e=>{let t=e.className+" " -;t+=e.parentNode?e.parentNode.className:"";const n=g.languageDetectRe.exec(t) -;if(n){const t=N(n[1]) -;return t||(H(l.replace("{}",n[1])),H("Falling back to no-highlight mode for this block.",e)), -t?n[1]:"no-highlight"}return t.split(/\s+/).find((e=>d(e)||N(e)))})(e) -;if(d(n))return;_("before:highlightBlock",{block:e,language:n}),t=e -;const s=t.textContent,a=n?h(n,s,!0):p(s);_("after:highlightBlock",{block:e, -result:a,text:s}),e.innerHTML=a.value,((e,t,n)=>{const s=t?r[t]:n -;e.classList.add("hljs"),s&&e.classList.add(s)})(e,n,a.language),e.result={ -language:a.language,re:a.relevance,relavance:a.relevance -},a.second_best&&(e.second_best={language:a.second_best.language, -re:a.second_best.relevance,relavance:a.second_best.relevance})}const v=()=>{ -v.called||(v.called=!0,document.querySelectorAll("pre code").forEach(E))} -;function N(e){return e=(e||"").toLowerCase(),n[e]||n[r[e]]} -function w(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{r[e]=t -}))}function R(e){const t=N(e);return t&&!t.disableAutodetect}function _(e,t){ -const n=e;a.forEach((e=>{e[n]&&e[n](t)}))}Object.assign(e,{highlight:h, -highlightAuto:p,fixMarkup:e=>{ -return $("10.2.0","fixMarkup will be removed entirely in v11.0"), -$("10.2.0","Please see https://github.com/highlightjs/highlight.js/issues/2534"), -t=e, -g.tabReplace||g.useBR?t.replace(o,(e=>"\n"===e?g.useBR?"<br>":e:g.tabReplace?e.replace(/\t/g,g.tabReplace):e)):t -;var t},highlightBlock:E,configure:e=>{ -e.useBR&&($("10.3.0","'useBR' will be removed entirely in v11.0"), -$("10.3.0","Please see https://github.com/highlightjs/highlight.js/issues/2559")), -g=z(g,e)},initHighlighting:v,initHighlightingOnLoad:()=>{ -window.addEventListener("DOMContentLoaded",v,!1)},registerLanguage:(t,s)=>{ -let r=null;try{r=s(e)}catch(e){ -if(C("Language definition for '{}' could not be registered.".replace("{}",t)), -!i)throw e;C(e),r=u} -r.name||(r.name=t),n[t]=r,r.rawDefinition=s.bind(null,e),r.aliases&&w(r.aliases,{ -languageName:t})},listLanguages:()=>Object.keys(n),getLanguage:N, -registerAliases:w,requireLanguage:e=>{ -$("10.4.0","requireLanguage will be removed entirely in v11."), -$("10.4.0","Please see https://github.com/highlightjs/highlight.js/pull/2844") -;const t=N(e);if(t)return t -;throw Error("The '{}' language is required, but not loaded.".replace("{}",e))}, -autoDetection:R,inherit:z,addPlugin:e=>{a.push(e)},vuePlugin:j(e).VuePlugin -}),e.debugMode=()=>{i=!1},e.safeMode=()=>{i=!0},e.versionString="10.5.0" -;for(const e in y)"object"==typeof y[e]&&t(y[e]) -;return Object.assign(e,y),e.addPlugin(m),e.addPlugin(S),e.addPlugin(x),e})({}) -}();"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs); -hljs.registerLanguage("apache",(()=>{"use strict";return e=>{const n={ -className:"number",begin:/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?/} -;return{name:"Apache config",aliases:["apacheconf"],case_insensitive:!0, -contains:[e.HASH_COMMENT_MODE,{className:"section",begin:/<\/?/,end:/>/, -contains:[n,{className:"number",begin:/:\d{1,5}/ -},e.inherit(e.QUOTE_STRING_MODE,{relevance:0})]},{className:"attribute", -begin:/\w+/,relevance:0,keywords:{ -nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername" -},starts:{end:/$/,relevance:0,keywords:{literal:"on off all deny allow"}, -contains:[{className:"meta",begin:/\s\[/,end:/\]$/},{className:"variable", -begin:/[\$%]\{/,end:/\}/,contains:["self",{className:"number",begin:/[$%]\d+/}] -},n,{className:"number",begin:/\d+/},e.QUOTE_STRING_MODE]}}],illegal:/\S/}} -})()); -hljs.registerLanguage("bash",(()=>{"use strict";function e(...e){ -return e.map((e=>{return(s=e)?"string"==typeof s?s:s.source:null;var s -})).join("")}return s=>{const n={},t={begin:/\$\{/,end:/\}/,contains:["self",{ -begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{ -begin:e(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},t]});const a={ -className:"subst",begin:/\$\(/,end:/\)/,contains:[s.BACKSLASH_ESCAPE]},i={ -begin:/<<-?\s*(?=\w+)/,starts:{contains:[s.END_SAME_AS_BEGIN({begin:/(\w+)/, -end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/, -contains:[s.BACKSLASH_ESCAPE,n,a]};a.contains.push(c);const o={begin:/\$\(\(/, -end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},s.NUMBER_MODE,n] -},r=s.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10 -}),l={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0, -contains:[s.inherit(s.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{ -name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z._-]+\b/, -keyword:"if then else elif fi for while in do done case esac function", -literal:"true false", -built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp" -},contains:[r,s.SHEBANG(),l,o,s.HASH_COMMENT_MODE,i,c,{className:"",begin:/\\"/ -},{className:"string",begin:/'/,end:/'/},n]}}})()); -hljs.registerLanguage("c",(()=>{"use strict";function e(e){ -return((...e)=>e.map((e=>(e=>e?"string"==typeof e?e:e.source:null)(e))).join(""))("(",e,")?") -}return t=>{const n=(t=>{const n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}] -}),r="[a-zA-Z_]\\w*::",a="(decltype\\(auto\\)|"+e(r)+"[a-zA-Z_]\\w*"+e("<[^<>]+>")+")",s={ -className:"keyword",begin:"\\b[a-z\\d_]*_t\\b"},i={className:"string", -variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n", -contains:[t.BACKSLASH_ESCAPE]},{ -begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", -end:"'",illegal:"."},t.END_SAME_AS_BEGIN({ -begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={ -className:"number",variants:[{begin:"\\b(0b[01']+)"},{ -begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" -},{ -begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" -}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ -"meta-keyword":"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" -},contains:[{begin:/\\\n/,relevance:0},t.inherit(i,{className:"meta-string"}),{ -className:"meta-string",begin:/<.*?>/,end:/$/,illegal:"\\n" -},n,t.C_BLOCK_COMMENT_MODE]},l={className:"title",begin:e(r)+t.IDENT_RE, -relevance:0},d=e(r)+t.IDENT_RE+"\\s*\\(",u={ -keyword:"int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using asm case typeid wchar_t short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignas alignof constexpr consteval constinit decltype concept co_await co_return co_yield requires noexcept static_assert thread_local restrict final override atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq", -built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr _Bool complex _Complex imaginary _Imaginary", -literal:"true false nullptr NULL"},m=[c,s,n,t.C_BLOCK_COMMENT_MODE,o,i],p={ -variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{ -beginKeywords:"new throw return else",end:/;/}],keywords:u,contains:m.concat([{ -begin:/\(/,end:/\)/,keywords:u,contains:m.concat(["self"]),relevance:0}]), -relevance:0},_={className:"function",begin:"("+a+"[\\*&\\s]+)+"+d, -returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:u,illegal:/[^\w\s\*&:<>.]/, -contains:[{begin:"decltype\\(auto\\)",keywords:u,relevance:0},{begin:d, -returnBegin:!0,contains:[l],relevance:0},{className:"params",begin:/\(/, -end:/\)/,keywords:u,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,i,o,s,{ -begin:/\(/,end:/\)/,keywords:u,relevance:0, -contains:["self",n,t.C_BLOCK_COMMENT_MODE,i,o,s]}] -},s,n,t.C_BLOCK_COMMENT_MODE,c]};return{ -aliases:["c","cc","h","c++","h++","hpp","hh","hxx","cxx"],keywords:u, -disableAutodetect:!0,illegal:"</",contains:[].concat(p,_,m,[c,{ -begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<", -end:">",keywords:u,contains:["self",s]},{begin:t.IDENT_RE+"::",keywords:u},{ -className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/, -contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{ -preprocessor:c,strings:i,keywords:u}}})(t) -;return n.name="C",n.aliases=["c","h"],n}})()); -hljs.registerLanguage("coffeescript",(()=>{"use strict" -;const e=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],n=["true","false","null","undefined","NaN","Infinity"],a=[].concat(["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],["arguments","this","super","console","window","document","localStorage","module","global"],["Intl","DataView","Number","Math","Date","String","RegExp","Object","Function","Boolean","Error","Symbol","Set","Map","WeakSet","WeakMap","Proxy","Reflect","JSON","Promise","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Float32Array","Array","Uint8Array","Uint8ClampedArray","ArrayBuffer"],["EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"]) -;return r=>{const t={ -keyword:e.concat(["then","unless","until","loop","by","when","and","or","is","isnt","not"]).filter((i=["var","const","let","function","static"], -e=>!i.includes(e))).join(" "), -literal:n.concat(["yes","no","on","off"]).join(" "), -built_in:a.concat(["npm","print"]).join(" ")};var i -;const s="[A-Za-z$_][0-9A-Za-z$_]*",o={className:"subst",begin:/#\{/,end:/\}/, -keywords:t},c=[r.BINARY_NUMBER_MODE,r.inherit(r.C_NUMBER_MODE,{starts:{ -end:"(\\s*/)?",relevance:0}}),{className:"string",variants:[{begin:/'''/, -end:/'''/,contains:[r.BACKSLASH_ESCAPE]},{begin:/'/,end:/'/, -contains:[r.BACKSLASH_ESCAPE]},{begin:/"""/,end:/"""/, -contains:[r.BACKSLASH_ESCAPE,o]},{begin:/"/,end:/"/, -contains:[r.BACKSLASH_ESCAPE,o]}]},{className:"regexp",variants:[{begin:"///", -end:"///",contains:[o,r.HASH_COMMENT_MODE]},{begin:"//[gim]{0,3}(?=\\W)", -relevance:0},{begin:/\/(?![ *]).*?(?![\\]).\/[gim]{0,3}(?=\W)/}]},{begin:"@"+s -},{subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,variants:[{ -begin:"```",end:"```"},{begin:"`",end:"`"}]}];o.contains=c -;const l=r.inherit(r.TITLE_MODE,{begin:s}),d="(\\(.*\\)\\s*)?\\B[-=]>",g={ -className:"params",begin:"\\([^\\(]",returnBegin:!0,contains:[{begin:/\(/, -end:/\)/,keywords:t,contains:["self"].concat(c)}]};return{name:"CoffeeScript", -aliases:["coffee","cson","iced"],keywords:t,illegal:/\/\*/, -contains:c.concat([r.COMMENT("###","###"),r.HASH_COMMENT_MODE,{ -className:"function",begin:"^\\s*"+s+"\\s*=\\s*"+d,end:"[-=]>",returnBegin:!0, -contains:[l,g]},{begin:/[:\(,=]\s*/,relevance:0,contains:[{className:"function", -begin:d,end:"[-=]>",returnBegin:!0,contains:[g]}]},{className:"class", -beginKeywords:"class",end:"$",illegal:/[:="\[\]]/,contains:[{ -beginKeywords:"extends",endsWithParent:!0,illegal:/[:="\[\]]/,contains:[l]},l] -},{begin:s+":",end:":",returnBegin:!0,returnEnd:!0,relevance:0}])}}})()); -hljs.registerLanguage("cpp",(()=>{"use strict";function e(e){ -return((...e)=>e.map((e=>(e=>e?"string"==typeof e?e:e.source:null)(e))).join(""))("(",e,")?") -}return t=>{const n=(t=>{const n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}] -}),r="[a-zA-Z_]\\w*::",a="(decltype\\(auto\\)|"+e(r)+"[a-zA-Z_]\\w*"+e("<[^<>]+>")+")",s={ -className:"keyword",begin:"\\b[a-z\\d_]*_t\\b"},i={className:"string", -variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n", -contains:[t.BACKSLASH_ESCAPE]},{ -begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", -end:"'",illegal:"."},t.END_SAME_AS_BEGIN({ -begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={ -className:"number",variants:[{begin:"\\b(0b[01']+)"},{ -begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" -},{ -begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" -}],relevance:0},o={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ -"meta-keyword":"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" -},contains:[{begin:/\\\n/,relevance:0},t.inherit(i,{className:"meta-string"}),{ -className:"meta-string",begin:/<.*?>/,end:/$/,illegal:"\\n" -},n,t.C_BLOCK_COMMENT_MODE]},l={className:"title",begin:e(r)+t.IDENT_RE, -relevance:0},d=e(r)+t.IDENT_RE+"\\s*\\(",u={ -keyword:"int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using asm case typeid wchar_t short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignas alignof constexpr consteval constinit decltype concept co_await co_return co_yield requires noexcept static_assert thread_local restrict final override atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq", -built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr _Bool complex _Complex imaginary _Imaginary", -literal:"true false nullptr NULL"},p=[o,s,n,t.C_BLOCK_COMMENT_MODE,c,i],m={ -variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{ -beginKeywords:"new throw return else",end:/;/}],keywords:u,contains:p.concat([{ -begin:/\(/,end:/\)/,keywords:u,contains:p.concat(["self"]),relevance:0}]), -relevance:0},_={className:"function",begin:"("+a+"[\\*&\\s]+)+"+d, -returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:u,illegal:/[^\w\s\*&:<>.]/, -contains:[{begin:"decltype\\(auto\\)",keywords:u,relevance:0},{begin:d, -returnBegin:!0,contains:[l],relevance:0},{className:"params",begin:/\(/, -end:/\)/,keywords:u,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,i,c,s,{ -begin:/\(/,end:/\)/,keywords:u,relevance:0, -contains:["self",n,t.C_BLOCK_COMMENT_MODE,i,c,s]}] -},s,n,t.C_BLOCK_COMMENT_MODE,o]};return{ -aliases:["c","cc","h","c++","h++","hpp","hh","hxx","cxx"],keywords:u, -disableAutodetect:!0,illegal:"</",contains:[].concat(m,_,p,[o,{ -begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<", -end:">",keywords:u,contains:["self",s]},{begin:t.IDENT_RE+"::",keywords:u},{ -className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/, -contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{ -preprocessor:o,strings:i,keywords:u}}})(t) -;return n.disableAutodetect=!1,n.name="C++", -n.aliases=["cc","c++","h++","hpp","hh","hxx","cxx"],n}})()); -hljs.registerLanguage("csharp",(()=>{"use strict";return e=>{var n={ -keyword:["abstract","as","base","break","case","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"]).join(" "), -built_in:"bool byte char decimal delegate double dynamic enum float int long nint nuint object sbyte short string ulong unit ushort", -literal:"default false null true"},a=e.inherit(e.TITLE_MODE,{ -begin:"[a-zA-Z](\\.?\\w)*"}),i={className:"number",variants:[{ -begin:"\\b(0b[01']+)"},{ -begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{ -begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" -}],relevance:0},s={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}] -},t=e.inherit(s,{illegal:/\n/}),r={className:"subst",begin:/\{/,end:/\}/, -keywords:n},l=e.inherit(r,{illegal:/\n/}),c={className:"string",begin:/\$"/, -end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/ -},e.BACKSLASH_ESCAPE,l]},o={className:"string",begin:/\$@"/,end:'"',contains:[{ -begin:/\{\{/},{begin:/\}\}/},{begin:'""'},r]},d=e.inherit(o,{illegal:/\n/, -contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},l]}) -;r.contains=[o,c,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,i,e.C_BLOCK_COMMENT_MODE], -l.contains=[d,c,t,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,i,e.inherit(e.C_BLOCK_COMMENT_MODE,{ -illegal:/\n/})];var g={variants:[o,c,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] -},E={begin:"<",end:">",contains:[{beginKeywords:"in out"},a] -},_=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",b={ -begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"], -keywords:n,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0, -contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{ -begin:"\x3c!--|--\x3e"},{begin:"</?",end:">"}]}] -}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#", -end:"$",keywords:{ -"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum" -}},g,i,{beginKeywords:"class interface",relevance:0,end:/[{;=]/, -illegal:/[^\s:,]/,contains:[{beginKeywords:"where class" -},a,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace", -relevance:0,end:/[{;=]/,illegal:/[^\s:]/, -contains:[a,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ -beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/, -contains:[a,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta", -begin:"^\\s*\\[",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{ -className:"meta-string",begin:/"/,end:/"/}]},{ -beginKeywords:"new return throw await else",relevance:0},{className:"function", -begin:"("+_+"\\s+)+"+e.IDENT_RE+"\\s*(<.+>\\s*)?\\(",returnBegin:!0, -end:/\s*[{;=]/,excludeEnd:!0,keywords:n,contains:[{ -beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial", -relevance:0},{begin:e.IDENT_RE+"\\s*(<.+>\\s*)?\\(",returnBegin:!0, -contains:[e.TITLE_MODE,E],relevance:0},{className:"params",begin:/\(/,end:/\)/, -excludeBegin:!0,excludeEnd:!0,keywords:n,relevance:0, -contains:[g,i,e.C_BLOCK_COMMENT_MODE] -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},b]}}})()); -hljs.registerLanguage("css",(()=>{"use strict";return e=>{ -var n="[a-zA-Z-][a-zA-Z0-9_-]*",a={ -begin:/([*]\s?)?(?:[A-Z_.\-\\]+|--[a-zA-Z0-9_-]+)\s*(\/\*\*\/)?:/, -returnBegin:!0,end:";",endsWithParent:!0,contains:[{className:"attribute", -begin:/\S/,end:":",excludeEnd:!0,starts:{endsWithParent:!0,excludeEnd:!0, -contains:[{begin:/[\w-]+\(/,returnBegin:!0,contains:[{className:"built_in", -begin:/[\w-]+/},{begin:/\(/,end:/\)/, -contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.CSS_NUMBER_MODE]}] -},e.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,e.C_BLOCK_COMMENT_MODE,{ -className:"number",begin:"#[0-9A-Fa-f]+"},{className:"meta",begin:"!important"}] -}}]};return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/, -contains:[e.C_BLOCK_COMMENT_MODE,{className:"selector-id", -begin:/#[A-Za-z0-9_-]+/},{className:"selector-class",begin:"\\."+n},{ -className:"selector-attr",begin:/\[/,end:/\]/,illegal:"$", -contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},{className:"selector-pseudo", -begin:/:(:)?[a-zA-Z0-9_+()"'.-]+/},{begin:"@(page|font-face)", -lexemes:"@[a-z-]+",keywords:"@page @font-face"},{begin:"@",end:"[{;]", -illegal:/:/,returnBegin:!0,contains:[{className:"keyword", -begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0, -relevance:0,keywords:"and or not only",contains:[{begin:/[a-z-]+:/, -className:"attribute"},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.CSS_NUMBER_MODE] -}]},{className:"selector-tag",begin:n,relevance:0},{begin:/\{/,end:/\}/, -illegal:/\S/,contains:[e.C_BLOCK_COMMENT_MODE,{begin:/;/},a]}]}}})()); -hljs.registerLanguage("diff",(()=>{"use strict";return e=>({name:"Diff", -aliases:["patch"],contains:[{className:"meta",relevance:10,variants:[{ -begin:/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/},{begin:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{ -begin:/^--- +\d+,\d+ +----$/}]},{className:"comment",variants:[{begin:/Index: /, -end:/$/},{begin:/^index/,end:/$/},{begin:/={3,}/,end:/$/},{begin:/^-{3}/,end:/$/ -},{begin:/^\*{3} /,end:/$/},{begin:/^\+{3}/,end:/$/},{begin:/^\*{15}$/},{ -begin:/^diff --git/,end:/$/}]},{className:"addition",begin:/^\+/,end:/$/},{ -className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/, -end:/$/}]})})()); -hljs.registerLanguage("go",(()=>{"use strict";return e=>{const n={ -keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune", -literal:"true false iota nil", -built_in:"append cap close complex copy imag len make new panic print println real recover delete" -};return{name:"Go",aliases:["golang"],keywords:n,illegal:"</", -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string", -variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{ -className:"number",variants:[{begin:e.C_NUMBER_RE+"[i]",relevance:1 -},e.C_NUMBER_MODE]},{begin:/:=/},{className:"function",beginKeywords:"func", -end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params", -begin:/\(/,end:/\)/,keywords:n,illegal:/["']/}]}]}}})()); -hljs.registerLanguage("http",(()=>{"use strict";function e(...e){ -return e.map((e=>{return(n=e)?"string"==typeof n?n:n.source:null;var n -})).join("")}return n=>{const a="HTTP/(2|1\\.[01])",s=[{className:"attribute", -begin:e("^",/[A-Za-z][A-Za-z0-9-]*/,"(?=\\:\\s)"),starts:{contains:[{ -className:"punctuation",begin:/: /,relevance:0,starts:{end:"$",relevance:0}}]} -},{begin:"\\n\\n",starts:{subLanguage:[],endsWithParent:!0}}];return{ -name:"HTTP",aliases:["https"],illegal:/\S/,contains:[{begin:"^(?="+a+" \\d{3})", -end:/$/,contains:[{className:"meta",begin:a},{className:"number", -begin:"\\b\\d{3}\\b"}],starts:{end:/\b\B/,illegal:/\S/,contains:s}},{ -begin:"(?=^[A-Z]+ (.*?) "+a+"$)",end:/$/,contains:[{className:"string", -begin:" ",end:" ",excludeBegin:!0,excludeEnd:!0},{className:"meta",begin:a},{ -className:"keyword",begin:"[A-Z]+"}],starts:{end:/\b\B/,illegal:/\S/,contains:s} -}]}}})()); -hljs.registerLanguage("ini",(()=>{"use strict";function e(e){ -return e?"string"==typeof e?e:e.source:null}function n(...n){ -return n.map((n=>e(n))).join("")}return s=>{const a={className:"number", -relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:s.NUMBER_RE}] -},i=s.COMMENT();i.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const t={ -className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/ -}]},r={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={ -className:"string",contains:[s.BACKSLASH_ESCAPE],variants:[{begin:"'''", -end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"' -},{begin:"'",end:"'"}]},c={begin:/\[/,end:/\]/,contains:[i,r,t,l,a,"self"], -relevance:0 -},g="("+[/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/].map((n=>e(n))).join("|")+")" -;return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/, -contains:[i,{className:"section",begin:/\[+/,end:/\]+/},{ -begin:n(g,"(\\s*\\.\\s*",g,")*",n("(?=",/\s*=\s*[^#\s]/,")")),className:"attr", -starts:{end:/$/,contains:[i,c,r,t,l,a]}}]}}})()); -hljs.registerLanguage("java",(()=>{"use strict" -;var e="\\.([0-9](_*[0-9])*)",n="[0-9a-fA-F](_*[0-9a-fA-F])*",a={ -className:"number",variants:[{ -begin:`(\\b([0-9](_*[0-9])*)((${e})|\\.)?|(${e}))[eE][+-]?([0-9](_*[0-9])*)[fFdD]?\\b` -},{begin:`\\b([0-9](_*[0-9])*)((${e})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{ -begin:`(${e})[fFdD]?\\b`},{begin:"\\b([0-9](_*[0-9])*)[fFdD]\\b"},{ -begin:`\\b0[xX]((${n})\\.?|(${n})?\\.(${n}))[pP][+-]?([0-9](_*[0-9])*)[fFdD]?\\b` -},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${n})[lL]?\\b`},{ -begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}], -relevance:0};return e=>{ -var n="false synchronized int abstract float private char boolean var static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",s={ -className:"meta",begin:"@[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*", -contains:[{begin:/\(/,end:/\)/,contains:["self"]}]};const r=a;return{ -name:"Java",aliases:["jsp"],keywords:n,illegal:/<\/|#/, -contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/, -relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{ -begin:/import java\.[a-z]+\./,keywords:"import",relevance:2 -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{ -className:"class",beginKeywords:"class interface enum",end:/[{;=]/, -excludeEnd:!0,keywords:"class interface enum",illegal:/[:"\[\]]/,contains:[{ -beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{ -beginKeywords:"new throw return else",relevance:0},{className:"class", -begin:"record\\s+"+e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,excludeEnd:!0, -end:/[{;=]/,keywords:n,contains:[{beginKeywords:"record"},{ -begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0, -contains:[e.UNDERSCORE_TITLE_MODE]},{className:"params",begin:/\(/,end:/\)/, -keywords:n,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE] -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"function", -begin:"([\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*(<[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*(\\s*,\\s*[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*)*>)?\\s+)+"+e.UNDERSCORE_IDENT_RE+"\\s*\\(", -returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:n,contains:[{ -begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0, -contains:[e.UNDERSCORE_TITLE_MODE]},{className:"params",begin:/\(/,end:/\)/, -keywords:n,relevance:0, -contains:[s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,e.C_BLOCK_COMMENT_MODE] -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},r,s]}}})()); -hljs.registerLanguage("javascript",(()=>{"use strict" -;const e="[A-Za-z$_][0-9A-Za-z$_]*",n=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],a=["true","false","null","undefined","NaN","Infinity"],s=[].concat(["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],["arguments","this","super","console","window","document","localStorage","module","global"],["Intl","DataView","Number","Math","Date","String","RegExp","Object","Function","Boolean","Error","Symbol","Set","Map","WeakSet","WeakMap","Proxy","Reflect","JSON","Promise","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Float32Array","Array","Uint8Array","Uint8ClampedArray","ArrayBuffer"],["EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"]) -;function r(e){return i("(?=",e,")")}function i(...e){return e.map((e=>{ -return(n=e)?"string"==typeof n?n:n.source:null;var n})).join("")}return t=>{ -const c=e,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/, -isTrulyOpeningTag:(e,n)=>{const a=e[0].length+e.index,s=e.input[a] -;"<"!==s?">"===s&&(((e,{after:n})=>{const a="</"+e[0].slice(1) -;return-1!==e.input.indexOf(a,n)})(e,{after:a -})||n.ignoreMatch()):n.ignoreMatch()}},l={$pattern:e,keyword:n.join(" "), -literal:a.join(" "),built_in:s.join(" ") -},b="\\.([0-9](_?[0-9])*)",g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={ -className:"number",variants:[{ -begin:`(\\b(${g})((${b})|\\.)?|(${b}))[eE][+-]?([0-9](_?[0-9])*)\\b`},{ -begin:`\\b(${g})\\b((${b})\\b|\\.)?|(${b})\\b`},{ -begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{ -begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{ -begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{ -begin:"\\b0[0-7]+n?\\b"}],relevance:0},E={className:"subst",begin:"\\$\\{", -end:"\\}",keywords:l,contains:[]},u={begin:"html`",end:"",starts:{end:"`", -returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,E],subLanguage:"xml"}},_={ -begin:"css`",end:"",starts:{end:"`",returnEnd:!1, -contains:[t.BACKSLASH_ESCAPE,E],subLanguage:"css"}},m={className:"string", -begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,E]},N={className:"comment", -variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{ -className:"doctag",begin:"@[A-Za-z]+",contains:[{className:"type",begin:"\\{", -end:"\\}",relevance:0},{className:"variable",begin:c+"(?=\\s*(-)|$)", -endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}] -}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE] -},y=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,u,_,m,d,t.REGEXP_MODE] -;E.contains=y.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(y) -});const f=[].concat(N,E.contains),A=f.concat([{begin:/\(/,end:/\)/,keywords:l, -contains:["self"].concat(f)}]),p={className:"params",begin:/\(/,end:/\)/, -excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A};return{name:"Javascript", -aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:A}, -illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node", -relevance:5}),{label:"use_strict",className:"meta",relevance:10, -begin:/^\s*['"]use (strict|asm)['"]/ -},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,u,_,m,N,d,{ -begin:i(/[{,\n]\s*/,r(i(/(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,c+"\\s*:"))), -relevance:0,contains:[{className:"attr",begin:c+r("\\s*:"),relevance:0}]},{ -begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", -keywords:"return throw case",contains:[N,t.REGEXP_MODE,{className:"function", -begin:"(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>", -returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{ -begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0 -},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A}]}] -},{begin:/,/,relevance:0},{className:"",begin:/\s/,end:/\s*/,skip:!0},{ -variants:[{begin:"<>",end:"</>"},{begin:o.begin,"on:begin":o.isTrulyOpeningTag, -end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0, -contains:["self"]}]}],relevance:0},{className:"function", -beginKeywords:"function",end:/[{;]/,excludeEnd:!0,keywords:l, -contains:["self",t.inherit(t.TITLE_MODE,{begin:c}),p],illegal:/%/},{ -beginKeywords:"while if switch catch for"},{className:"function", -begin:t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", -returnBegin:!0,contains:[p,t.inherit(t.TITLE_MODE,{begin:c})]},{variants:[{ -begin:"\\."+c},{begin:"\\$"+c}],relevance:0},{className:"class", -beginKeywords:"class",end:/[{;=]/,excludeEnd:!0,illegal:/[:"[\]]/,contains:[{ -beginKeywords:"extends"},t.UNDERSCORE_TITLE_MODE]},{begin:/\b(?=constructor)/, -end:/[{;]/,excludeEnd:!0,contains:[t.inherit(t.TITLE_MODE,{begin:c}),"self",p] -},{begin:"(get|set)\\s+(?="+c+"\\()",end:/\{/,keywords:"get set", -contains:[t.inherit(t.TITLE_MODE,{begin:c}),{begin:/\(\)/},p]},{begin:/\$[(.]/}] -}}})()); -hljs.registerLanguage("json",(()=>{"use strict";return n=>{const e={ -literal:"true false null" -},i=[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],a=[n.QUOTE_STRING_MODE,n.C_NUMBER_MODE],l={ -end:",",endsWithParent:!0,excludeEnd:!0,contains:a,keywords:e},t={begin:/\{/, -end:/\}/,contains:[{className:"attr",begin:/"/,end:/"/, -contains:[n.BACKSLASH_ESCAPE],illegal:"\\n"},n.inherit(l,{begin:/:/ -})].concat(i),illegal:"\\S"},s={begin:"\\[",end:"\\]",contains:[n.inherit(l)], -illegal:"\\S"};return a.push(t,s),i.forEach((n=>{a.push(n)})),{name:"JSON", -contains:a,keywords:e,illegal:"\\S"}}})()); -hljs.registerLanguage("kotlin",(()=>{"use strict" -;var e="\\.([0-9](_*[0-9])*)",n="[0-9a-fA-F](_*[0-9a-fA-F])*",a={ -className:"number",variants:[{ -begin:`(\\b([0-9](_*[0-9])*)((${e})|\\.)?|(${e}))[eE][+-]?([0-9](_*[0-9])*)[fFdD]?\\b` -},{begin:`\\b([0-9](_*[0-9])*)((${e})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{ -begin:`(${e})[fFdD]?\\b`},{begin:"\\b([0-9](_*[0-9])*)[fFdD]\\b"},{ -begin:`\\b0[xX]((${n})\\.?|(${n})?\\.(${n}))[pP][+-]?([0-9](_*[0-9])*)[fFdD]?\\b` -},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${n})[lL]?\\b`},{ -begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}], -relevance:0};return e=>{const n={ -keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual", -built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing", -literal:"true false null"},i={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@" -},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},t={ -className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},r={className:"string", -variants:[{begin:'"""',end:'"""(?=[^"])',contains:[t,s]},{begin:"'",end:"'", -illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/, -contains:[e.BACKSLASH_ESCAPE,t,s]}]};s.contains.push(r);const l={ -className:"meta", -begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?" -},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/, -end:/\)/,contains:[e.inherit(r,{className:"meta-string"})]}] -},o=a,b=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),E={ -variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/, -contains:[]}]},d=E;return d.variants[1].contains=[E],E.variants[1].contains=[d], -{name:"Kotlin",aliases:["kt"],keywords:n,contains:[e.COMMENT("/\\*\\*","\\*/",{ -relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}] -}),e.C_LINE_COMMENT_MODE,b,{className:"keyword", -begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol", -begin:/@\w+/}]}},i,l,c,{className:"function",beginKeywords:"fun",end:"[(]|$", -returnBegin:!0,excludeEnd:!0,keywords:n,relevance:5,contains:[{ -begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0, -contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/, -keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/, -endsParent:!0,keywords:n,relevance:0,contains:[{begin:/:/,end:/[=,\/]/, -endsWithParent:!0,contains:[E,e.C_LINE_COMMENT_MODE,b],relevance:0 -},e.C_LINE_COMMENT_MODE,b,l,c,r,e.C_NUMBER_MODE]},b]},{className:"class", -beginKeywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0, -illegal:"extends implements",contains:[{ -beginKeywords:"public protected internal private constructor" -},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0, -excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,]|$/, -excludeBegin:!0,returnEnd:!0},l,c]},r,{className:"meta",begin:"^#!/usr/bin/env", -end:"$",illegal:"\n"},o]}}})()); -hljs.registerLanguage("less",(()=>{"use strict";return e=>{ -var n="([\\w-]+|@\\{[\\w-]+\\})",a=[],s=[],t=e=>({className:"string", -begin:"~?"+e+".*?"+e}),r=(e,n,a)=>({className:e,begin:n,relevance:a}),i={ -begin:"\\(",end:"\\)",contains:s,relevance:0} -;s.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t("'"),t('"'),e.CSS_NUMBER_MODE,{ -begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]", -excludeEnd:!0} -},r("number","#[0-9A-Fa-f]+\\b"),i,r("variable","@@?[\\w-]+",10),r("variable","@\\{[\\w-]+\\}"),r("built_in","~?`[^`]*?`"),{ -className:"attribute",begin:"[\\w-]+\\s*:",end:":",returnBegin:!0,excludeEnd:!0 -},{className:"meta",begin:"!important"});var c=s.concat({begin:/\{/,end:/\}/, -contains:a}),l={beginKeywords:"when",endsWithParent:!0,contains:[{ -beginKeywords:"and not"}].concat(s)},g={begin:n+"\\s*:",returnBegin:!0, -end:"[;}]",relevance:0,contains:[{className:"attribute",begin:n,end:":", -excludeEnd:!0,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:s} -}]},d={className:"keyword", -begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b", -starts:{end:"[;{}]",returnEnd:!0,contains:s,relevance:0}},o={ -className:"variable",variants:[{begin:"@[\\w-]+\\s*:",relevance:15},{ -begin:"@[\\w-]+"}],starts:{end:"[;}]",returnEnd:!0,contains:c}},b={variants:[{ -begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:n,end:/\{/}],returnBegin:!0, -returnEnd:!0,illegal:"[<='$\"]",relevance:0, -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l,r("keyword","all\\b"),r("variable","@\\{[\\w-]+\\}"),r("selector-tag",n+"%?",0),r("selector-id","#"+n),r("selector-class","\\."+n,0),r("selector-tag","&",0),{ -className:"selector-attr",begin:"\\[",end:"\\]"},{className:"selector-pseudo", -begin:/:(:)?[a-zA-Z0-9_\-+()"'.]+/},{begin:"\\(",end:"\\)",contains:c},{ -begin:"!important"}]} -;return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d,o,g,b),{ -name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:a}}})()); -hljs.registerLanguage("lua",(()=>{"use strict";return e=>{ -const t="\\[=*\\[",a="\\]=*\\]",n={begin:t,end:a,contains:["self"] -},o=[e.COMMENT("--(?!\\[=*\\[)","$"),e.COMMENT("--\\[=*\\[",a,{contains:[n], -relevance:10})];return{name:"Lua",keywords:{$pattern:e.UNDERSCORE_IDENT_RE, -literal:"true false nil", -keyword:"and break do else elseif end for goto if in local not or repeat return then until while", -built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove" -},contains:o.concat([{className:"function",beginKeywords:"function",end:"\\)", -contains:[e.inherit(e.TITLE_MODE,{ -begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params", -begin:"\\(",endsWithParent:!0,contains:o}].concat(o) -},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string", -begin:t,end:a,contains:[n],relevance:5}])}}})()); -hljs.registerLanguage("makefile",(()=>{"use strict";return e=>{const i={ -className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)", -contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},a={className:"string", -begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i]},n={className:"variable", -begin:/\$\([\w-]+\s/,end:/\)/,keywords:{ -built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value" -},contains:[i]},s={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},r={ -className:"section",begin:/^[^\s]+:/,end:/$/,contains:[i]};return{ -name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/, -keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath" -},contains:[e.HASH_COMMENT_MODE,i,a,n,s,{className:"meta",begin:/^\.PHONY:/, -end:/$/,keywords:{$pattern:/[\.\w]+/,"meta-keyword":".PHONY"}},r]}}})()); -hljs.registerLanguage("xml",(()=>{"use strict";function e(e){ -return e?"string"==typeof e?e:e.source:null}function n(e){return a("(?=",e,")")} -function a(...n){return n.map((n=>e(n))).join("")}function s(...n){ -return"("+n.map((n=>e(n))).join("|")+")"}return e=>{ -const t=a(/[A-Z_]/,a("(",/[A-Z0-9_.-]+:/,")?"),/[A-Z0-9_.-]*/),i={ -className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},r={begin:/\s/, -contains:[{className:"meta-keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}] -},c=e.inherit(r,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{ -className:"meta-string"}),g=e.inherit(e.QUOTE_STRING_MODE,{ -className:"meta-string"}),m={endsWithParent:!0,illegal:/</,relevance:0, -contains:[{className:"attr",begin:/[A-Za-z0-9._:-]+/,relevance:0},{begin:/=\s*/, -relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/, -end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}] -}]};return{name:"HTML, XML", -aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"], -case_insensitive:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/, -relevance:10,contains:[r,g,l,c,{begin:/\[/,end:/\]/,contains:[{className:"meta", -begin:/<![a-z]/,end:/>/,contains:[r,c,g,l]}]}]},e.COMMENT(/<!--/,/-->/,{ -relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{ -className:"meta",begin:/<\?xml/,end:/\?>/,relevance:10},{className:"tag", -begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[m],starts:{ -end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag", -begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[m],starts:{ -end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{ -className:"tag",begin:/<>|<\/>/},{className:"tag", -begin:a(/</,n(a(t,s(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name", -begin:t,relevance:0,starts:m}]},{className:"tag",begin:a(/<\//,n(a(t,/>/))), -contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0}]}]}} -})()); -hljs.registerLanguage("markdown",(()=>{"use strict";function n(...n){ -return n.map((n=>{return(e=n)?"string"==typeof e?e:e.source:null;var e -})).join("")}return e=>{const a={begin:/<\/?[A-Za-z_]/,end:">", -subLanguage:"xml",relevance:0},i={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0 -},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/, -relevance:2},{begin:n(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/), -relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{ -begin:/\[.+?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{ -className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0, -returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)", -excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[", -end:"\\]",excludeBegin:!0,excludeEnd:!0}]},s={className:"strong",contains:[], -variants:[{begin:/_{2}/,end:/_{2}/},{begin:/\*{2}/,end:/\*{2}/}]},c={ -className:"emphasis",contains:[],variants:[{begin:/\*(?!\*)/,end:/\*/},{ -begin:/_(?!_)/,end:/_/,relevance:0}]};s.contains.push(c),c.contains.push(s) -;let t=[a,i] -;return s.contains=s.contains.concat(t),c.contains=c.contains.concat(t), -t=t.concat(s,c),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{ -className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:t},{ -begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n", -contains:t}]}]},a,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)", -end:"\\s+",excludeEnd:!0},s,c,{className:"quote",begin:"^>\\s+",contains:t, -end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{ -begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{ -begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))", -contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{ -begin:"^[-\\*]{3,}",end:"$"},i,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{ -className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{ -className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}}})()); -hljs.registerLanguage("nginx",(()=>{"use strict";return e=>{const n={ -className:"variable",variants:[{begin:/\$\d+/},{begin:/\$\{/,end:/\}/},{ -begin:/[$@]/+e.UNDERSCORE_IDENT_RE}]},a={endsWithParent:!0,keywords:{ -$pattern:"[a-z/_]+", -literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll" -},relevance:0,illegal:"=>",contains:[e.HASH_COMMENT_MODE,{className:"string", -contains:[e.BACKSLASH_ESCAPE,n],variants:[{begin:/"/,end:/"/},{begin:/'/,end:/'/ -}]},{begin:"([a-z]+):/",end:"\\s",endsWithParent:!0,excludeEnd:!0,contains:[n] -},{className:"regexp",contains:[e.BACKSLASH_ESCAPE,n],variants:[{begin:"\\s\\^", -end:"\\s|\\{|;",returnEnd:!0},{begin:"~\\*?\\s+",end:"\\s|\\{|;",returnEnd:!0},{ -begin:"\\*(\\.[a-z\\-]+)+"},{begin:"([a-z\\-]+\\.)+\\*"}]},{className:"number", -begin:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{ -className:"number",begin:"\\b\\d+[kKmMgGdshdwy]*\\b",relevance:0},n]};return{ -name:"Nginx config",aliases:["nginxconf"],contains:[e.HASH_COMMENT_MODE,{ -begin:e.UNDERSCORE_IDENT_RE+"\\s+\\{",returnBegin:!0,end:/\{/,contains:[{ -className:"section",begin:e.UNDERSCORE_IDENT_RE}],relevance:0},{ -begin:e.UNDERSCORE_IDENT_RE+"\\s",end:";|\\{",returnBegin:!0,contains:[{ -className:"attribute",begin:e.UNDERSCORE_IDENT_RE,starts:a}],relevance:0}], -illegal:"[^\\s\\}]"}}})()); -hljs.registerLanguage("objectivec",(()=>{"use strict";return e=>{ -const n=/[a-zA-Z@][a-zA-Z0-9_]*/,_={$pattern:n, -keyword:"@interface @class @protocol @implementation"};return{ -name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"], -keywords:{$pattern:n, -keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN", -literal:"false true FALSE TRUE nil YES NO NULL", -built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once" -},illegal:"</",contains:[{className:"built_in", -begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+" -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{ -className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n", -contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/, -keywords:{ -"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include" -},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{ -className:"meta-string"}),{className:"meta-string",begin:/<.*?>/,end:/$/, -illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ -className:"class",begin:"("+_.keyword.split(" ").join("|")+")\\b",end:/(\{|$)/, -excludeEnd:!0,keywords:_,contains:[e.UNDERSCORE_TITLE_MODE]},{ -begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}})()); -hljs.registerLanguage("perl",(()=>{"use strict";function e(...e){ -return e.map((e=>{return(n=e)?"string"==typeof n?n:n.source:null;var n -})).join("")}return n=>{const t=/[dualxmsipn]{0,12}/,s={$pattern:/[\w.]+/, -keyword:"getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qq fileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmget sub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedir ioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when" -},r={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},i={begin:/->\{/, -end:/\}/},a={variants:[{begin:/\$\d/},{ -begin:e(/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])") -},{begin:/[$%@][^\s\w{]/,relevance:0}] -},o=[n.BACKSLASH_ESCAPE,r,a],c=[a,n.HASH_COMMENT_MODE,n.COMMENT(/^=\w/,/=cut/,{ -endsWithParent:!0}),i,{className:"string",contains:o,variants:[{ -begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[", -end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{ -begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">", -relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'", -contains:[n.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`", -contains:[n.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,contains:[],relevance:0},{ -begin:"-?\\w+\\s*=>",contains:[],relevance:0}]},{className:"number", -begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b", -relevance:0},{ -begin:"(\\/\\/|"+n.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*", -keywords:"split return print reverse grep",relevance:0, -contains:[n.HASH_COMMENT_MODE,{className:"regexp", -begin:e(/(s|tr|y)/,/\//,/(\\.|[^\\\/])*/,/\//,/(\\.|[^\\\/])*/,/\//,t), -relevance:10},{className:"regexp",begin:/(m|qr)?\//,end:e(/\//,t), -contains:[n.BACKSLASH_ESCAPE],relevance:0}]},{className:"function", -beginKeywords:"sub",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5, -contains:[n.TITLE_MODE]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$", -end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$", -className:"comment"}]}];return r.contains=c,i.contains=c,{name:"Perl", -aliases:["pl","pm"],keywords:s,contains:c}}})()); -hljs.registerLanguage("php",(()=>{"use strict";return e=>{const r={ -className:"variable", -begin:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?![A-Za-z0-9])(?![$])"},t={ -className:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?[=]?/},{ -begin:/\?>/}]},a={className:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/, -end:/\}/}]},n=e.inherit(e.APOS_STRING_MODE,{illegal:null -}),i=e.inherit(e.QUOTE_STRING_MODE,{illegal:null, -contains:e.QUOTE_STRING_MODE.contains.concat(a)}),o=e.END_SAME_AS_BEGIN({ -begin:/<<<[ \t]*(\w+)\n/,end:/[ \t]*(\w+)\b/, -contains:e.QUOTE_STRING_MODE.contains.concat(a)}),l={className:"string", -contains:[e.BACKSLASH_ESCAPE,t],variants:[e.inherit(n,{begin:"b'",end:"'" -}),e.inherit(i,{begin:'b"',end:'"'}),i,n,o]},c={ -variants:[e.BINARY_NUMBER_MODE,e.C_NUMBER_MODE]},s={ -keyword:"__CLASS__ __DIR__ __FILE__ __FUNCTION__ __LINE__ __METHOD__ __NAMESPACE__ __TRAIT__ die echo exit include include_once print require require_once array abstract and as binary bool boolean break callable case catch class clone const continue declare default do double else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval extends final finally float for foreach from global goto if implements instanceof insteadof int integer interface isset iterable list match|0 new object or private protected public real return string switch throw trait try unset use var void while xor yield", -literal:"false null true", -built_in:"Error|0 AppendIterator ArgumentCountError ArithmeticError ArrayIterator ArrayObject AssertionError BadFunctionCallException BadMethodCallException CachingIterator CallbackFilterIterator CompileError Countable DirectoryIterator DivisionByZeroError DomainException EmptyIterator ErrorException Exception FilesystemIterator FilterIterator GlobIterator InfiniteIterator InvalidArgumentException IteratorIterator LengthException LimitIterator LogicException MultipleIterator NoRewindIterator OutOfBoundsException OutOfRangeException OuterIterator OverflowException ParentIterator ParseError RangeException RecursiveArrayIterator RecursiveCachingIterator RecursiveCallbackFilterIterator RecursiveDirectoryIterator RecursiveFilterIterator RecursiveIterator RecursiveIteratorIterator RecursiveRegexIterator RecursiveTreeIterator RegexIterator RuntimeException SeekableIterator SplDoublyLinkedList SplFileInfo SplFileObject SplFixedArray SplHeap SplMaxHeap SplMinHeap SplObjectStorage SplObserver SplObserver SplPriorityQueue SplQueue SplStack SplSubject SplSubject SplTempFileObject TypeError UnderflowException UnexpectedValueException ArrayAccess Closure Generator Iterator IteratorAggregate Serializable Throwable Traversable WeakReference Directory __PHP_Incomplete_Class parent php_user_filter self static stdClass" -};return{aliases:["php","php3","php4","php5","php6","php7","php8"], -case_insensitive:!0,keywords:s, -contains:[e.HASH_COMMENT_MODE,e.COMMENT("//","$",{contains:[t] -}),e.COMMENT("/\\*","\\*/",{contains:[{className:"doctag",begin:"@[A-Za-z]+"}] -}),e.COMMENT("__halt_compiler.+?;",!1,{endsWithParent:!0, -keywords:"__halt_compiler"}),t,{className:"keyword",begin:/\$this\b/},r,{ -begin:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{className:"function", -relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0, -illegal:"[$%\\[]",contains:[e.UNDERSCORE_TITLE_MODE,{begin:"=>"},{ -className:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0, -keywords:s,contains:["self",r,e.C_BLOCK_COMMENT_MODE,l,c]}]},{className:"class", -beginKeywords:"class interface",relevance:0,end:/\{/,excludeEnd:!0, -illegal:/[:($"]/,contains:[{beginKeywords:"extends implements" -},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";", -illegal:/[.']/,contains:[e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"use", -relevance:0,end:";",contains:[e.UNDERSCORE_TITLE_MODE]},l,c]}}})()); -hljs.registerLanguage("php-template",(()=>{"use strict";return n=>({ -name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/, -subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"', -end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},n.inherit(n.APOS_STRING_MODE,{ -illegal:null,className:null,contains:null,skip:!0 -}),n.inherit(n.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null, -skip:!0})]}]})})()); -hljs.registerLanguage("plaintext",(()=>{"use strict";return t=>({ -name:"Plain text",aliases:["text","txt"],disableAutodetect:!0})})()); -hljs.registerLanguage("properties",(()=>{"use strict";return e=>{ -var n="[ \\t\\f]*",a=n+"[:=]"+n,t="("+a+"|[ \\t\\f]+)",r="([^\\\\\\W:= \\t\\f\\n]|\\\\.)+",s="([^\\\\:= \\t\\f\\n]|\\\\.)+",i={ -end:t,relevance:0,starts:{className:"string",end:/$/,relevance:0,contains:[{ -begin:"\\\\\\\\"},{begin:"\\\\\\n"}]}};return{name:".properties", -case_insensitive:!0,illegal:/\S/,contains:[e.COMMENT("^\\s*[!#]","$"),{ -returnBegin:!0,variants:[{begin:r+a,relevance:1},{begin:r+"[ \\t\\f]+", -relevance:0}],contains:[{className:"attr",begin:r,endsParent:!0,relevance:0}], -starts:i},{begin:s+t,returnBegin:!0,relevance:0,contains:[{className:"meta", -begin:s,endsParent:!0,relevance:0}],starts:i},{className:"attr",relevance:0, -begin:s+n+"$"}]}}})()); -hljs.registerLanguage("python",(()=>{"use strict";return e=>{const n={ -keyword:"and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal|10 not or pass raise return try while with yield", -built_in:"__import__ abs all any ascii bin bool breakpoint bytearray bytes callable chr classmethod compile complex delattr dict dir divmod enumerate eval exec filter float format frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter len list locals map max memoryview min next object oct open ord pow print property range repr reversed round set setattr slice sorted staticmethod str sum super tuple type vars zip", -literal:"__debug__ Ellipsis False None NotImplemented True"},a={ -className:"meta",begin:/^(>>>|\.\.\.) /},s={className:"subst",begin:/\{/, -end:/\}/,keywords:n,illegal:/#/},i={begin:/\{\{/,relevance:0},r={ -className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{ -begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/, -contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{ -begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/, -contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{ -begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/, -contains:[e.BACKSLASH_ESCAPE,a,i,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/, -end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,i,s]},{begin:/([uU]|[rR])'/,end:/'/, -relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{ -begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/, -end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/, -contains:[e.BACKSLASH_ESCAPE,i,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/, -contains:[e.BACKSLASH_ESCAPE,i,s]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] -},t="[0-9](_?[0-9])*",l=`(\\b(${t}))?\\.(${t})|\\b(${t})\\.`,b={ -className:"number",relevance:0,variants:[{ -begin:`(\\b(${t})|(${l}))[eE][+-]?(${t})[jJ]?\\b`},{begin:`(${l})[jJ]?`},{ -begin:"\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?\\b"},{ -begin:"\\b0[bB](_?[01])+[lL]?\\b"},{begin:"\\b0[oO](_?[0-7])+[lL]?\\b"},{ -begin:"\\b0[xX](_?[0-9a-fA-F])+[lL]?\\b"},{begin:`\\b(${t})[jJ]\\b`}]},o={ -className:"params",variants:[{begin:/\(\s*\)/,skip:!0,className:null},{ -begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:n, -contains:["self",a,b,r,e.HASH_COMMENT_MODE]}]};return s.contains=[r,b,a],{ -name:"Python",aliases:["py","gyp","ipython"],keywords:n, -illegal:/(<\/|->|\?)|=>/,contains:[a,b,{begin:/\bself\b/},{beginKeywords:"if", -relevance:0},r,e.HASH_COMMENT_MODE,{variants:[{className:"function", -beginKeywords:"def"},{className:"class",beginKeywords:"class"}],end:/:/, -illegal:/[${=;\n,]/,contains:[e.UNDERSCORE_TITLE_MODE,o,{begin:/->/, -endsWithParent:!0,keywords:"None"}]},{className:"meta",begin:/^[\t ]*@/, -end:/(?=#)|$/,contains:[b,o,r]},{begin:/\b(print|exec)\(/}]}}})()); -hljs.registerLanguage("python-repl",(()=>{"use strict";return s=>({ -aliases:["pycon"],contains:[{className:"meta",starts:{end:/ |$/,starts:{end:"$", -subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{ -begin:/^\.\.\.(?=[ ]|$)/}]}]})})()); -hljs.registerLanguage("r",(()=>{"use strict";function e(...e){return e.map((e=>{ -return(a=e)?"string"==typeof a?a:a.source:null;var a})).join("")}return a=>{ -const n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/;return{name:"R", -illegal:/->/,keywords:{$pattern:n, -keyword:"function if in break next repeat else for while", -literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10", -built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm" -},compilerExtensions:[(a,n)=>{if(!a.beforeMatch)return -;if(a.starts)throw Error("beforeMatch cannot be used with starts") -;const i=Object.assign({},a);Object.keys(a).forEach((e=>{delete a[e] -})),a.begin=e(i.beforeMatch,e("(?=",i.begin,")")),a.starts={relevance:0, -contains:[Object.assign(i,{endsParent:!0})]},a.relevance=0,delete i.beforeMatch -}],contains:[a.COMMENT(/#'/,/$/,{contains:[{className:"doctag", -begin:"@examples",starts:{contains:[{begin:/\n/},{begin:/#'\s*(?=@[a-zA-Z]+)/, -endsParent:!0},{begin:/#'/,end:/$/,excludeBegin:!0}]}},{className:"doctag", -begin:"@param",end:/$/,contains:[{className:"variable",variants:[{begin:n},{ -begin:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{className:"doctag", -begin:/@[a-zA-Z]+/},{className:"meta-keyword",begin:/\\[a-zA-Z]+/}] -}),a.HASH_COMMENT_MODE,{className:"string",contains:[a.BACKSLASH_ESCAPE], -variants:[a.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/ -}),a.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/ -}),a.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/ -}),a.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/ -}),a.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/ -}),a.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"', -relevance:0},{begin:"'",end:"'",relevance:0}]},{className:"number",relevance:0, -beforeMatch:/([^a-zA-Z0-9._])/,variants:[{ -match:/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/},{ -match:/0[xX][0-9a-fA-F]+([pP][+-]?\d+)?[Li]?/},{ -match:/(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?[Li]?/}]},{begin:"%",end:"%"},{ -begin:e(/[a-zA-Z][a-zA-Z_0-9]*/,"\\s+<-\\s+")},{begin:"`",end:"`",contains:[{ -begin:/\\./}]}]}}})()); -hljs.registerLanguage("ruby",(()=>{"use strict";function e(...e){ -return e.map((e=>{return(n=e)?"string"==typeof n?n:n.source:null;var n -})).join("")}return n=>{ -var a,i="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",s={ -keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor __FILE__", -built_in:"proc lambda",literal:"true false nil"},r={className:"doctag", -begin:"@[A-Za-z]+"},b={begin:"#<",end:">"},t=[n.COMMENT("#","$",{contains:[r] -}),n.COMMENT("^=begin","^=end",{contains:[r],relevance:10 -}),n.COMMENT("^__END__","\\n$")],c={className:"subst",begin:/#\{/,end:/\}/, -keywords:s},d={className:"string",contains:[n.BACKSLASH_ESCAPE,c],variants:[{ -begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/, -end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{ -begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/, -end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{ -begin:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{ -begin:/<<[-~]?'?(\w+)\n(?:[^\n]*\n)*?\s*\1\b/,returnBegin:!0,contains:[{ -begin:/<<[-~]?'?/},n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/, -contains:[n.BACKSLASH_ESCAPE,c]})]}]},g="[0-9](_?[0-9])*",l={className:"number", -relevance:0,variants:[{ -begin:`\\b([1-9](_?[0-9])*|0)(\\.(${g}))?([eE][+-]?(${g})|r)?i?\\b`},{ -begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b" -},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{ -begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{ -begin:"\\b0(_?[0-7])+r?i?\\b"}]},o={className:"params",begin:"\\(",end:"\\)", -endsParent:!0,keywords:s},_=[d,{className:"class",beginKeywords:"class module", -end:"$|;",illegal:/=/,contains:[n.inherit(n.TITLE_MODE,{ -begin:"[A-Za-z_]\\w*(::\\w+)*(\\?|!)?"}),{begin:"<\\s*",contains:[{ -begin:"("+n.IDENT_RE+"::)?"+n.IDENT_RE}]}].concat(t)},{className:"function", -begin:e(/def\s*/,(a=i+"\\s*(\\(|;|$)",e("(?=",a,")"))),keywords:"def",end:"$|;", -contains:[n.inherit(n.TITLE_MODE,{begin:i}),o].concat(t)},{begin:n.IDENT_RE+"::" -},{className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{ -className:"symbol",begin:":(?!\\s)",contains:[d,{begin:i}],relevance:0},l,{ -className:"variable", -begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{ -className:"params",begin:/\|/,end:/\|/,relevance:0,keywords:s},{ -begin:"("+n.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{ -className:"regexp",contains:[n.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{ -begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(", -end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}] -}].concat(b,t),relevance:0}].concat(b,t);c.contains=_,o.contains=_;var E=[{ -begin:/^\s*=>/,starts:{end:"$",contains:_}},{className:"meta", -begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+>|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])", -starts:{end:"$",contains:_}}];return t.unshift(b),{name:"Ruby", -aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/, -contains:[n.SHEBANG({binary:"ruby"})].concat(E).concat(t).concat(_)}}})()); -hljs.registerLanguage("rust",(()=>{"use strict";return e=>{ -const n="([ui](8|16|32|64|128|size)|f(32|64))?",t="drop i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize f32 f64 str char bool Box Option Result String Vec Copy Send Sized Sync Drop Fn FnMut FnOnce ToOwned Clone Debug PartialEq PartialOrd Eq Ord AsRef AsMut Into From Default Iterator Extend IntoIterator DoubleEndedIterator ExactSizeIterator SliceConcatExt ToString assert! assert_eq! bitflags! bytes! cfg! col! concat! concat_idents! debug_assert! debug_assert_eq! env! panic! file! format! format_args! include_bin! include_str! line! local_data_key! module_path! option_env! print! println! select! stringify! try! unimplemented! unreachable! vec! write! writeln! macro_rules! assert_ne! debug_assert_ne!" -;return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?", -keyword:"abstract as async await become box break const continue crate do dyn else enum extern false final fn for if impl in let loop macro match mod move mut override priv pub ref return self Self static struct super trait true try type typeof unsafe unsized use virtual where while yield", -literal:"true false Some None Ok Err",built_in:t},illegal:"</", -contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"] -}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{ -className:"string",variants:[{begin:/r(#*)"(.|\n)*?"\1(?!#)/},{ -begin:/b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/}]},{className:"symbol", -begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{className:"number",variants:[{ -begin:"\\b0b([01_]+)"+n},{begin:"\\b0o([0-7_]+)"+n},{ -begin:"\\b0x([A-Fa-f0-9_]+)"+n},{ -begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+n}],relevance:0},{ -className:"function",beginKeywords:"fn",end:"(\\(|<)",excludeEnd:!0, -contains:[e.UNDERSCORE_TITLE_MODE]},{className:"meta",begin:"#!?\\[",end:"\\]", -contains:[{className:"meta-string",begin:/"/,end:/"/}]},{className:"class", -beginKeywords:"type",end:";",contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{ -endsParent:!0})],illegal:"\\S"},{className:"class", -beginKeywords:"trait enum struct union",end:/\{/, -contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{endsParent:!0})],illegal:"[\\w\\d]" -},{begin:e.IDENT_RE+"::",keywords:{built_in:t}},{begin:"->"}]}}})()); -hljs.registerLanguage("scss",(()=>{"use strict";return e=>{var t="@[a-z-]+",i={ -className:"variable",begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b"},r={ -className:"number",begin:"#[0-9A-Fa-f]+"} -;return e.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE, -e.APOS_STRING_MODE,e.C_BLOCK_COMMENT_MODE,{name:"SCSS",case_insensitive:!0, -illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{ -className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{ -className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},{ -className:"selector-attr",begin:"\\[",end:"\\]",illegal:"$"},{ -className:"selector-tag", -begin:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b", -relevance:0},{className:"selector-pseudo", -begin:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)" -},{className:"selector-pseudo", -begin:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)" -},i,{className:"attribute", -begin:"\\b(src|z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b", -illegal:"[^\\s]"},{ -begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b" -},{begin:":",end:";", -contains:[i,r,e.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{ -className:"meta",begin:"!important"}]},{begin:"@(page|font-face)",lexemes:t, -keywords:"@page @font-face"},{begin:"@",end:"[{;]",returnBegin:!0, -keywords:"and or not only",contains:[{begin:t,className:"keyword" -},i,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,r,e.CSS_NUMBER_MODE]}]}}})()); -hljs.registerLanguage("shell",(()=>{"use strict";return s=>({ -name:"Shell Session",aliases:["console"],contains:[{className:"meta", -begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#]/,starts:{end:/[^\\](?=\s*$)/, -subLanguage:"bash"}}]})})()); -hljs.registerLanguage("sql",(()=>{"use strict";function e(e){ -return e?"string"==typeof e?e:e.source:null}function r(...r){ -return r.map((r=>e(r))).join("")}function t(...r){ -return"("+r.map((r=>e(r))).join("|")+")"}return e=>{ -const n=e.COMMENT("--","$"),a=["true","false","unknown"],i=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],s=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],o=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],c=s,l=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update ","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter((e=>!s.includes(e))),u={ -begin:r(/\b/,t(...c),/\s*\(/),keywords:{built_in:c.join(" ")}};return{ -name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{ -$pattern:/\b[\w\.]+/,keyword:((e,{exceptions:r,when:t}={})=>{const n=t -;return r=r||[],e.map((e=>e.match(/\|\d+$/)||r.includes(e)?e:n(e)?e+"|0":e)) -})(l,{when:e=>e.length<3}).join(" "),literal:a.join(" "),type:i.join(" "), -built_in:"current_catalog current_date current_default_transform_group current_path current_role current_schema current_transform_group_for_type current_user session_user system_time system_user current_time localtime current_timestamp localtimestamp" -},contains:[{begin:t(...o),keywords:{$pattern:/[\w\.]+/, -keyword:l.concat(o).join(" "),literal:a.join(" "),type:i.join(" ")}},{ -className:"type", -begin:t("double precision","large object","with timezone","without timezone") -},u,{className:"variable",begin:/@[a-z0-9]+/},{className:"string",variants:[{ -begin:/'/,end:/'/,contains:[{begin:/''/}]}]},{begin:/"/,end:/"/,contains:[{ -begin:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,{className:"operator", -begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}}})()); -hljs.registerLanguage("swift",(()=>{"use strict";function e(e){ -return e?"string"==typeof e?e:e.source:null}function n(e){return i("(?=",e,")")} -function i(...n){return n.map((n=>e(n))).join("")}function a(...n){ -return"("+n.map((n=>e(n))).join("|")+")"} -const t=e=>i(/\b/,e,/\w$/.test(e)?/\b/:/\B/),u=["Protocol","Type"].map(t),s=["init","self"].map(t),r=["Any","Self"],o=["associatedtype",/as\?/,/as!/,"as","break","case","catch","class","continue","convenience","default","defer","deinit","didSet","do","dynamic","else","enum","extension","fallthrough","fileprivate(set)","fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout","internal(set)","internal","in","is","lazy","let","mutating","nonmutating","open(set)","open","operator","optional","override","postfix","precedencegroup","prefix","private(set)","private","protocol","public(set)","public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias","unowned(safe)","unowned(unsafe)","unowned","var","weak","where","while","willSet"],l=["false","nil","true"],c=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warn_unqualified_access","#warning"],b=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],p=a(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),F=a(p,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),d=i(p,F,"*"),g=a(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFFFD]/),f=a(g,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),m=i(g,f,"*"),w=i(/[A-Z]/,f,"*"),E=["autoclosure",i(/convention\(/,a("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",i(/objc\(/,m,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","testable","UIApplicationMain","unknown","usableFromInline"],y=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"] -;return e=>{const p=e.COMMENT("/\\*","\\*/",{contains:["self"]}),g={ -className:"keyword",begin:i(/\./,n(a(...u,...s))),end:a(...u,...s), -excludeBegin:!0},A={begin:i(/\./,a(...o)),relevance:0 -},C=o.filter((e=>"string"==typeof e)).concat(["_|0"]),v={variants:[{ -className:"keyword", -begin:a(...o.filter((e=>"string"!=typeof e)).concat(r).map(t),...s)}]},_={ -$pattern:a(/\b\w+(\(\w+\))?/,/#\w+/),keyword:C.concat(c).join(" "), -literal:l.join(" ")},N=[g,A,v],D=[{begin:i(/\./,a(...b)),relevance:0},{ -className:"built_in",begin:i(/\b/,a(...b),/(?=\()/)}],B={begin:/->/,relevance:0 -},M=[B,{className:"operator",relevance:0,variants:[{begin:d},{ -begin:`\\.(\\.|${F})+`}]}],h="([0-9a-fA-F]_*)+",S={className:"number", -relevance:0,variants:[{ -begin:"\\b(([0-9]_*)+)(\\.(([0-9]_*)+))?([eE][+-]?(([0-9]_*)+))?\\b"},{ -begin:`\\b0x(${h})(\\.(${h}))?([pP][+-]?(([0-9]_*)+))?\\b`},{ -begin:/\b0o([0-7]_*)+\b/},{begin:/\b0b([01]_*)+\b/}]},O=(e="")=>({ -className:"subst",variants:[{begin:i(/\\/,e,/[0\\tnr"']/)},{ -begin:i(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),x=(e="")=>({className:"subst", -begin:i(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),k=(e="")=>({className:"subst", -label:"interpol",begin:i(/\\/,e,/\(/),end:/\)/}),L=(e="")=>({begin:i(e,/"""/), -end:i(/"""/,e),contains:[O(e),x(e),k(e)]}),I=(e="")=>({begin:i(e,/"/), -end:i(/"/,e),contains:[O(e),k(e)]}),$={className:"string", -variants:[L(),L("#"),L("##"),L("###"),I(),I("#"),I("##"),I("###")]},T=[{ -begin:i(/`/,m,/`/)},{className:"variable",begin:/\$\d+/},{className:"variable", -begin:`\\$${f}+`}],j=[{begin:/(@|#)available\(/,end:/\)/,keywords:{ -$pattern:/[@#]?\w+/,keyword:y.concat(["@available","#available"]).join(" ")}, -contains:[...M,S,$]},{className:"keyword",begin:i(/@/,a(...E))},{ -className:"meta",begin:i(/@/,m)}],K={begin:n(/\b[A-Z]/),relevance:0,contains:[{ -className:"type", -begin:i(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,f,"+") -},{className:"type",begin:w,relevance:0},{begin:/[?!]+/,relevance:0},{ -begin:/\.\.\./,relevance:0},{begin:i(/\s+&\s+/,n(w)),relevance:0}]},P={ -begin:/</,end:/>/,keywords:_,contains:[...N,...j,B,K]};K.contains.push(P) -;for(const e of $.variants){const n=e.contains.find((e=>"interpol"===e.label)) -;n.keywords=_;const i=[...N,...D,...M,S,$,...T];n.contains=[...i,{begin:/\(/, -end:/\)/,contains:["self",...i]}]}return{name:"Swift",keywords:_, -contains:[e.C_LINE_COMMENT_MODE,p,{className:"function",beginKeywords:"func", -end:/\{/,excludeEnd:!0,contains:[e.inherit(e.TITLE_MODE,{ -begin:/[A-Za-z$_][0-9A-Za-z$_]*/}),{begin:/</,end:/>/},{className:"params", -begin:/\(/,end:/\)/,endsParent:!0,keywords:_, -contains:["self",...N,S,$,e.C_BLOCK_COMMENT_MODE,{begin:":"}],illegal:/["']/}], -illegal:/\[|%/},{className:"class", -beginKeywords:"struct protocol class extension enum",end:"\\{",excludeEnd:!0, -keywords:_,contains:[e.inherit(e.TITLE_MODE,{ -begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...N]},{beginKeywords:"import", -end:/$/,contains:[e.C_LINE_COMMENT_MODE,p],relevance:0 -},...N,...D,...M,S,$,...T,...j,K]}}})()); -hljs.registerLanguage("typescript",(()=>{"use strict" -;const e="[A-Za-z$_][0-9A-Za-z$_]*",n=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],a=["true","false","null","undefined","NaN","Infinity"],s=[].concat(["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],["arguments","this","super","console","window","document","localStorage","module","global"],["Intl","DataView","Number","Math","Date","String","RegExp","Object","Function","Boolean","Error","Symbol","Set","Map","WeakSet","WeakMap","Proxy","Reflect","JSON","Promise","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Float32Array","Array","Uint8Array","Uint8ClampedArray","ArrayBuffer"],["EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"]) -;function t(e){return i("(?=",e,")")}function i(...e){return e.map((e=>{ -return(n=e)?"string"==typeof n?n:n.source:null;var n})).join("")}return r=>{ -const c={$pattern:e, -keyword:n.concat(["type","namespace","typedef","interface","public","private","protected","implements","declare","abstract","readonly"]).join(" "), -literal:a.join(" "), -built_in:s.concat(["any","void","number","boolean","string","object","never","enum"]).join(" ") -},o={className:"meta",begin:"@[A-Za-z$_][0-9A-Za-z$_]*"},l=(e,n,a)=>{ -const s=e.contains.findIndex((e=>e.label===n)) -;if(-1===s)throw Error("can not find mode to replace");e.contains.splice(s,1,a) -},b=(r=>{const c=e,o={begin:/<[A-Za-z0-9\\._:-]+/, -end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{ -const a=e[0].length+e.index,s=e.input[a];"<"!==s?">"===s&&(((e,{after:n})=>{ -const a="</"+e[0].slice(1);return-1!==e.input.indexOf(a,n)})(e,{after:a -})||n.ignoreMatch()):n.ignoreMatch()}},l={$pattern:e,keyword:n.join(" "), -literal:a.join(" "),built_in:s.join(" ") -},b="\\.([0-9](_?[0-9])*)",d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={ -className:"number",variants:[{ -begin:`(\\b(${d})((${b})|\\.)?|(${b}))[eE][+-]?([0-9](_?[0-9])*)\\b`},{ -begin:`\\b(${d})\\b((${b})\\b|\\.)?|(${b})\\b`},{ -begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{ -begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{ -begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{ -begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{", -end:"\\}",keywords:l,contains:[]},E={begin:"html`",end:"",starts:{end:"`", -returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},m={ -begin:"css`",end:"",starts:{end:"`",returnEnd:!1, -contains:[r.BACKSLASH_ESCAPE,u],subLanguage:"css"}},_={className:"string", -begin:"`",end:"`",contains:[r.BACKSLASH_ESCAPE,u]},y={className:"comment", -variants:[r.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{ -className:"doctag",begin:"@[A-Za-z]+",contains:[{className:"type",begin:"\\{", -end:"\\}",relevance:0},{className:"variable",begin:c+"(?=\\s*(-)|$)", -endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}] -}),r.C_BLOCK_COMMENT_MODE,r.C_LINE_COMMENT_MODE] -},p=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,E,m,_,g,r.REGEXP_MODE] -;u.contains=p.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(p) -});const N=[].concat(y,u.contains),f=N.concat([{begin:/\(/,end:/\)/,keywords:l, -contains:["self"].concat(N)}]),A={className:"params",begin:/\(/,end:/\)/, -excludeBegin:!0,excludeEnd:!0,keywords:l,contains:f};return{name:"Javascript", -aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:f}, -illegal:/#(?![$_A-z])/,contains:[r.SHEBANG({label:"shebang",binary:"node", -relevance:5}),{label:"use_strict",className:"meta",relevance:10, -begin:/^\s*['"]use (strict|asm)['"]/ -},r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,E,m,_,y,g,{ -begin:i(/[{,\n]\s*/,t(i(/(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,c+"\\s*:"))), -relevance:0,contains:[{className:"attr",begin:c+t("\\s*:"),relevance:0}]},{ -begin:"("+r.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", -keywords:"return throw case",contains:[y,r.REGEXP_MODE,{className:"function", -begin:"(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+r.UNDERSCORE_IDENT_RE+")\\s*=>", -returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{ -begin:r.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0 -},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:f}]}] -},{begin:/,/,relevance:0},{className:"",begin:/\s/,end:/\s*/,skip:!0},{ -variants:[{begin:"<>",end:"</>"},{begin:o.begin,"on:begin":o.isTrulyOpeningTag, -end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0, -contains:["self"]}]}],relevance:0},{className:"function", -beginKeywords:"function",end:/[{;]/,excludeEnd:!0,keywords:l, -contains:["self",r.inherit(r.TITLE_MODE,{begin:c}),A],illegal:/%/},{ -beginKeywords:"while if switch catch for"},{className:"function", -begin:r.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", -returnBegin:!0,contains:[A,r.inherit(r.TITLE_MODE,{begin:c})]},{variants:[{ -begin:"\\."+c},{begin:"\\$"+c}],relevance:0},{className:"class", -beginKeywords:"class",end:/[{;=]/,excludeEnd:!0,illegal:/[:"[\]]/,contains:[{ -beginKeywords:"extends"},r.UNDERSCORE_TITLE_MODE]},{begin:/\b(?=constructor)/, -end:/[{;]/,excludeEnd:!0,contains:[r.inherit(r.TITLE_MODE,{begin:c}),"self",A] -},{begin:"(get|set)\\s+(?="+c+"\\()",end:/\{/,keywords:"get set", -contains:[r.inherit(r.TITLE_MODE,{begin:c}),{begin:/\(\)/},A]},{begin:/\$[(.]/}] -}})(r) -;return Object.assign(b.keywords,c),b.exports.PARAMS_CONTAINS.push(o),b.contains=b.contains.concat([o,{ -beginKeywords:"namespace",end:/\{/,excludeEnd:!0},{beginKeywords:"interface", -end:/\{/,excludeEnd:!0,keywords:"interface extends" -}]),l(b,"shebang",r.SHEBANG()),l(b,"use_strict",{className:"meta",relevance:10, -begin:/^\s*['"]use strict['"]/ -}),b.contains.find((e=>"function"===e.className)).relevance=0,Object.assign(b,{ -name:"TypeScript",aliases:["ts"]}),b}})()); -hljs.registerLanguage("vbnet",(()=>{"use strict";function e(e){ -return e?"string"==typeof e?e:e.source:null}function n(...n){ -return n.map((n=>e(n))).join("")}function t(...n){ -return"("+n.map((n=>e(n))).join("|")+")"}return e=>{ -const a=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,r=/\d{1,2}(:\d{1,2}){1,2}/,o={ -className:"literal",variants:[{begin:n(/# */,t(i,a),/ *#/)},{ -begin:n(/# */,r,/ *#/)},{begin:n(/# */,s,/ *#/)},{ -begin:n(/# */,t(i,a),/ +/,t(s,r),/ *#/)}]},l=e.COMMENT(/'''/,/$/,{contains:[{ -className:"doctag",begin:/<\/?/,end:/>/}]}),c=e.COMMENT(null,/$/,{variants:[{ -begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET", -aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{ -keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield", -built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort", -type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort", -literal:"true false nothing"}, -illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[{ -className:"string",begin:/"(""|[^/n])"C\b/},{className:"string",begin:/"/, -end:/"/,illegal:/\n/,contains:[{begin:/""/}]},o,{className:"number",relevance:0, -variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/ -},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{ -begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},{ -className:"label",begin:/^\w+:/},l,c,{className:"meta", -begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/, -end:/$/,keywords:{ -"meta-keyword":"const disable else elseif enable end externalsource if region then" -},contains:[c]}]}}})()); -hljs.registerLanguage("yaml",(()=>{"use strict";return e=>{ -var n="true false yes no null",a="[\\w#;/?:@&=+$,.~*'()[\\]]+",s={ -className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/ -},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable", -variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},i=e.inherit(s,{ -variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),l={ -end:",",endsWithParent:!0,excludeEnd:!0,contains:[],keywords:n,relevance:0},t={ -begin:/\{/,end:/\}/,contains:[l],illegal:"\\n",relevance:0},g={begin:"\\[", -end:"\\]",contains:[l],illegal:"\\n",relevance:0},b=[{className:"attr", -variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ \t]|$)"},{ -begin:'"\\w[\\w :\\/.-]*":(?=[ \t]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ \t]|$)" -}]},{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string", -begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{ -begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0, -relevance:0},{className:"type",begin:"!\\w+!"+a},{className:"type", -begin:"!<"+a+">"},{className:"type",begin:"!"+a},{className:"type",begin:"!!"+a -},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta", -begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)", -relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},{ -className:"number", -begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b" -},{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},t,g,s],r=[...b] -;return r.pop(),r.push(i),l.contains=r,{name:"YAML",case_insensitive:!0, -aliases:["yml","YAML"],contains:b}}})()); \ No newline at end of file diff --git a/vendor/highlightjs/languages/ini.min.js b/vendor/highlightjs/languages/ini.min.js deleted file mode 100644 index a05233541..000000000 --- a/vendor/highlightjs/languages/ini.min.js +++ /dev/null @@ -1,16 +0,0 @@ -hljs.registerLanguage("ini",(()=>{"use strict";function e(e){ -return e?"string"==typeof e?e:e.source:null}function n(...n){ -return n.map((n=>e(n))).join("")}return s=>{const a={className:"number", -relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:s.NUMBER_RE}] -},i=s.COMMENT();i.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const t={ -className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/ -}]},r={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={ -className:"string",contains:[s.BACKSLASH_ESCAPE],variants:[{begin:"'''", -end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"' -},{begin:"'",end:"'"}]},c={begin:/\[/,end:/\]/,contains:[i,r,t,l,a,"self"], -relevance:0 -},g="("+[/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/].map((n=>e(n))).join("|")+")" -;return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/, -contains:[i,{className:"section",begin:/\[+/,end:/\]+/},{ -begin:n(g,"(\\s*\\.\\s*",g,")*",n("(?=",/\s*=\s*[^#\s]/,")")),className:"attr", -starts:{end:/$/,contains:[i,c,r,t,l,a]}}]}}})()); \ No newline at end of file diff --git a/vendor/highlightjs/languages/markdown.min.js b/vendor/highlightjs/languages/markdown.min.js deleted file mode 100644 index 0760aa904..000000000 --- a/vendor/highlightjs/languages/markdown.min.js +++ /dev/null @@ -1,29 +0,0 @@ -hljs.registerLanguage("markdown",(()=>{"use strict";function n(...n){ -return n.map((n=>{return(e=n)?"string"==typeof e?e:e.source:null;var e -})).join("")}return e=>{const a={begin:/<\/?[A-Za-z_]/,end:">", -subLanguage:"xml",relevance:0},i={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0 -},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/, -relevance:2},{begin:n(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/), -relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{ -begin:/\[.+?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{ -className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0, -returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)", -excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[", -end:"\\]",excludeBegin:!0,excludeEnd:!0}]},s={className:"strong",contains:[], -variants:[{begin:/_{2}/,end:/_{2}/},{begin:/\*{2}/,end:/\*{2}/}]},c={ -className:"emphasis",contains:[],variants:[{begin:/\*(?!\*)/,end:/\*/},{ -begin:/_(?!_)/,end:/_/,relevance:0}]};s.contains.push(c),c.contains.push(s) -;let t=[a,i] -;return s.contains=s.contains.concat(t),c.contains=c.contains.concat(t), -t=t.concat(s,c),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{ -className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:t},{ -begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n", -contains:t}]}]},a,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)", -end:"\\s+",excludeEnd:!0},s,c,{className:"quote",begin:"^>\\s+",contains:t, -end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{ -begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{ -begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))", -contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{ -begin:"^[-\\*]{3,}",end:"$"},i,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{ -className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{ -className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}}})()); \ No newline at end of file diff --git a/vendor/highlightjs/languages/rust.min.js b/vendor/highlightjs/languages/rust.min.js deleted file mode 100644 index 495d20eaf..000000000 --- a/vendor/highlightjs/languages/rust.min.js +++ /dev/null @@ -1,21 +0,0 @@ -hljs.registerLanguage("rust",(()=>{"use strict";return e=>{ -const n="([ui](8|16|32|64|128|size)|f(32|64))?",t="drop i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize f32 f64 str char bool Box Option Result String Vec Copy Send Sized Sync Drop Fn FnMut FnOnce ToOwned Clone Debug PartialEq PartialOrd Eq Ord AsRef AsMut Into From Default Iterator Extend IntoIterator DoubleEndedIterator ExactSizeIterator SliceConcatExt ToString assert! assert_eq! bitflags! bytes! cfg! col! concat! concat_idents! debug_assert! debug_assert_eq! env! panic! file! format! format_args! include_bin! include_str! line! local_data_key! module_path! option_env! print! println! select! stringify! try! unimplemented! unreachable! vec! write! writeln! macro_rules! assert_ne! debug_assert_ne!" -;return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?", -keyword:"abstract as async await become box break const continue crate do dyn else enum extern false final fn for if impl in let loop macro match mod move mut override priv pub ref return self Self static struct super trait true try type typeof unsafe unsized use virtual where while yield", -literal:"true false Some None Ok Err",built_in:t},illegal:"</", -contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"] -}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{ -className:"string",variants:[{begin:/r(#*)"(.|\n)*?"\1(?!#)/},{ -begin:/b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/}]},{className:"symbol", -begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{className:"number",variants:[{ -begin:"\\b0b([01_]+)"+n},{begin:"\\b0o([0-7_]+)"+n},{ -begin:"\\b0x([A-Fa-f0-9_]+)"+n},{ -begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+n}],relevance:0},{ -className:"function",beginKeywords:"fn",end:"(\\(|<)",excludeEnd:!0, -contains:[e.UNDERSCORE_TITLE_MODE]},{className:"meta",begin:"#!?\\[",end:"\\]", -contains:[{className:"meta-string",begin:/"/,end:/"/}]},{className:"class", -beginKeywords:"type",end:";",contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{ -endsParent:!0})],illegal:"\\S"},{className:"class", -beginKeywords:"trait enum struct union",end:/\{/, -contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{endsParent:!0})],illegal:"[\\w\\d]" -},{begin:e.IDENT_RE+"::",keywords:{built_in:t}},{begin:"->"}]}}})()); \ No newline at end of file diff --git a/vendor/highlightjs/styles/dark.min.css b/vendor/highlightjs/styles/dark.min.css deleted file mode 100644 index e4269de0a..000000000 --- a/vendor/highlightjs/styles/dark.min.css +++ /dev/null @@ -1 +0,0 @@ -.hljs{display:block;overflow-x:auto;padding:.5em;background:#444}.hljs-keyword,.hljs-link,.hljs-literal,.hljs-section,.hljs-selector-tag{color:#fff}.hljs,.hljs-subst{color:#ddd}.hljs-addition,.hljs-attribute,.hljs-built_in,.hljs-bullet,.hljs-name,.hljs-string,.hljs-symbol,.hljs-template-tag,.hljs-template-variable,.hljs-title,.hljs-type,.hljs-variable{color:#d88}.hljs-comment,.hljs-deletion,.hljs-meta,.hljs-quote{color:#777}.hljs-doctag,.hljs-keyword,.hljs-literal,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-strong,.hljs-title,.hljs-type{font-weight:700}.hljs-emphasis{font-style:italic} \ No newline at end of file diff --git a/vendor/highlightjs/styles/github.min.css b/vendor/highlightjs/styles/github.min.css deleted file mode 100644 index f5c1fa8f7..000000000 --- a/vendor/highlightjs/styles/github.min.css +++ /dev/null @@ -1 +0,0 @@ -.hljs{display:block;overflow-x:auto;padding:.5em;color:#333;background:#f8f8f8}.hljs-comment,.hljs-quote{color:#998;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#333;font-weight:700}.hljs-literal,.hljs-number,.hljs-tag .hljs-attr,.hljs-template-variable,.hljs-variable{color:teal}.hljs-doctag,.hljs-string{color:#d14}.hljs-section,.hljs-selector-id,.hljs-title{color:#900;font-weight:700}.hljs-subst{font-weight:400}.hljs-class .hljs-title,.hljs-type{color:#458;font-weight:700}.hljs-attribute,.hljs-name,.hljs-tag{color:navy;font-weight:400}.hljs-link,.hljs-regexp{color:#009926}.hljs-bullet,.hljs-symbol{color:#990073}.hljs-built_in,.hljs-builtin-name{color:#0086b3}.hljs-meta{color:#999;font-weight:700}.hljs-deletion{background:#fdd}.hljs-addition{background:#dfd}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700} \ No newline at end of file