├── libs
├── tm-parser
│ ├── Onigmo
│ ├── test-cases
│ │ ├── themes
│ │ │ ├── .gitignore
│ │ │ ├── tests
│ │ │ │ ├── test-this.ts
│ │ │ │ ├── test-4287.jade
│ │ │ │ ├── test-13777.go
│ │ │ │ ├── test-keywords.ts
│ │ │ │ ├── 13448.html
│ │ │ │ ├── test-function-inv.ts
│ │ │ │ ├── test6916.js
│ │ │ │ ├── tsconfig.json
│ │ │ │ ├── 14119.less
│ │ │ │ ├── test-issue5465.ts
│ │ │ │ ├── test-object-literals.ts
│ │ │ │ ├── test-issue5566.ts
│ │ │ │ ├── issue-1550.yaml
│ │ │ │ ├── issue-4008.yaml
│ │ │ │ ├── test-members.ts
│ │ │ │ ├── 12750.html
│ │ │ │ ├── test-strings.ts
│ │ │ │ ├── test-issue5431.ts
│ │ │ │ ├── test.sql
│ │ │ │ ├── test-brackets.tsx
│ │ │ │ ├── test-variables.css
│ │ │ │ ├── test-cssvariables.less
│ │ │ │ ├── test-cssvariables.scss
│ │ │ │ ├── test-regex.coffee
│ │ │ │ ├── test.ini
│ │ │ │ ├── test-7115.xml
│ │ │ │ ├── test.swift
│ │ │ │ ├── test.json
│ │ │ │ ├── test.lua
│ │ │ │ ├── test.rs
│ │ │ │ ├── issue-6303.yaml
│ │ │ │ ├── test-6611.rs
│ │ │ │ ├── test.shader
│ │ │ │ ├── test.r
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── test.cpp
│ │ │ │ ├── COMMIT_EDITMSG
│ │ │ │ ├── test.yaml
│ │ │ │ ├── test-issue11.ts
│ │ │ │ ├── test.coffee
│ │ │ │ ├── test.bat
│ │ │ │ ├── test.hbs
│ │ │ │ ├── git-rebase-todo
│ │ │ │ ├── test.go
│ │ │ │ ├── test.handlebars
│ │ │ │ ├── makefile
│ │ │ │ ├── test.diff
│ │ │ │ ├── test.fs
│ │ │ │ ├── test.cc
│ │ │ │ ├── basic.java
│ │ │ │ ├── test.sh
│ │ │ │ ├── test.xml
│ │ │ │ ├── test.jsx
│ │ │ │ ├── test.c
│ │ │ │ ├── test.vb
│ │ │ │ ├── test.php
│ │ │ │ ├── test.less
│ │ │ │ ├── test.pl
│ │ │ │ ├── test2.pl
│ │ │ │ ├── test.js
│ │ │ │ ├── test.cshtml
│ │ │ │ ├── test.html
│ │ │ │ ├── test.clj
│ │ │ │ ├── test.m
│ │ │ │ ├── test.ps1
│ │ │ │ ├── test.rb
│ │ │ │ ├── test.py
│ │ │ │ ├── test.md
│ │ │ │ ├── test-4287.jade.result
│ │ │ │ ├── test.ts
│ │ │ │ └── test.css
│ │ │ ├── tsconfig.json
│ │ │ ├── go
│ │ │ │ ├── colorize-fixtures
│ │ │ │ │ ├── test-13777.go
│ │ │ │ │ └── test.go
│ │ │ │ └── colorize-results
│ │ │ │ │ └── test-13777_go.json
│ │ │ ├── syntaxes
│ │ │ │ ├── git-rebase.tmLanguage
│ │ │ │ ├── xsl.json
│ │ │ │ ├── cshtml.json
│ │ │ │ └── Dockerfile.tmLanguage
│ │ │ ├── dark_plus.json
│ │ │ └── light_plus.json
│ │ ├── first-mate
│ │ │ ├── README.md
│ │ │ └── fixtures
│ │ │ │ ├── loops.json
│ │ │ │ ├── include-external-repository-rule.json
│ │ │ │ ├── forever.json
│ │ │ │ ├── imaginary.json
│ │ │ │ ├── content-name.json
│ │ │ │ ├── objective-c-plus-plus.json
│ │ │ │ ├── infinite-loop.json
│ │ │ │ ├── hello.json
│ │ │ │ ├── nested-captures.json
│ │ │ │ ├── multiline.json
│ │ │ │ ├── todo.json
│ │ │ │ ├── hyperlink.json
│ │ │ │ ├── apply-end-pattern-last.json
│ │ │ │ ├── text.json
│ │ │ │ ├── html-rails.json
│ │ │ │ ├── git-commit.json
│ │ │ │ ├── html-erb.json
│ │ │ │ └── javascript-regex.json
│ │ ├── onigtests
│ │ │ └── fixtures
│ │ │ │ ├── onigasm-issue3.js
│ │ │ │ ├── php-onigasm-issue17.php
│ │ │ │ ├── test-issue11.ts
│ │ │ │ └── test.cs
│ │ └── suite1
│ │ │ └── fixtures
│ │ │ ├── 105.grammarB.json
│ │ │ ├── 105.grammarA.json
│ │ │ ├── 66.plist
│ │ │ ├── testlang12.plist
│ │ │ └── whileLang.plist
│ ├── tests
│ │ ├── results
│ │ │ ├── read
│ │ │ │ ├── coffee-script.jsonsql.json
│ │ │ │ ├── hello.json
│ │ │ │ └── text.json
│ │ │ └── parsed
│ │ │ │ ├── coffee-script.jsonsql.json
│ │ │ │ ├── hello.json
│ │ │ │ └── text.json
│ │ ├── cases
│ │ │ ├── test.xml
│ │ │ ├── test.cpp
│ │ │ ├── README.md
│ │ │ └── test.c
│ │ └── meson.build
│ ├── textmate
│ │ ├── extensions
│ │ │ ├── main.cpp
│ │ │ ├── meson.build
│ │ │ ├── utf8.h
│ │ │ ├── util.h
│ │ │ └── extension.h
│ │ ├── scopes
│ │ │ ├── main.cpp
│ │ │ ├── parse.h
│ │ │ ├── scopes_parse.h
│ │ │ ├── meson.build
│ │ │ ├── types.cpp
│ │ │ └── types.h
│ │ ├── resources
│ │ │ ├── themes.h
│ │ │ └── grammars.h
│ │ ├── parser
│ │ │ ├── main.cpp
│ │ │ ├── defines.h
│ │ │ ├── reader.h
│ │ │ ├── parse.h
│ │ │ ├── meson.build
│ │ │ ├── grammar.h
│ │ │ ├── private.h
│ │ │ └── pattern.h
│ │ ├── theme
│ │ │ ├── meson.build
│ │ │ ├── stringop.h
│ │ │ └── main.cpp
│ │ └── meson.build
│ ├── screenshots
│ │ ├── Screenshot from 2020-05-28 22-55-06.png
│ │ ├── Screenshot from 2020-06-05 23-10-30.png
│ │ ├── Screenshot from 2020-06-05 23-10-46.png
│ │ ├── Screenshot from 2020-06-05 23-11-41.png
│ │ └── Screenshot from 2020-06-05 23-13-41.png
│ ├── tests-c
│ │ ├── meson.build
│ │ └── main.cpp
│ ├── .gitignore
│ ├── README.md
│ ├── meson.build
│ └── .clang-format
└── Onigmo
│ ├── enc
│ ├── iso_8859.h
│ ├── gb2312.c
│ ├── us_ascii.c
│ ├── jis
│ │ └── props.kwd
│ ├── shift_jis.c
│ └── windows_31j.c
│ ├── autogen.sh
│ ├── AUTHORS
│ ├── test.rb
│ ├── testc.c
│ ├── build_nmake.cmd
│ ├── win32
│ ├── testc.c
│ ├── makedef.py
│ ├── config.h
│ └── onigmo.rc
│ ├── onigmo.pc.in
│ ├── tool
│ ├── .gitignore
│ ├── convert-jis-props.sh
│ ├── download-ucd.sh
│ └── Makefile
│ ├── doc
│ ├── FAQ.ja
│ └── FAQ
│ ├── .travis.yml
│ ├── .editorconfig
│ ├── sample
│ ├── Makefile.am
│ ├── simple.c
│ ├── syntax.c
│ ├── names.c
│ ├── scan.c
│ ├── sql.c
│ ├── posix.c
│ └── listcap.c
│ ├── appveyor.yml
│ ├── .gitignore
│ ├── onigmo-config.in
│ ├── configure.ac
│ ├── regversion.c
│ ├── regtrav.c
│ └── onigmognu.h
├── .gitignore
├── Makefile
└── README.md
/libs/tm-parser/Onigmo:
--------------------------------------------------------------------------------
1 | ../Onigmo
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build/*
2 | **/*.so
3 |
--------------------------------------------------------------------------------
/libs/Onigmo/enc/iso_8859.h:
--------------------------------------------------------------------------------
1 | #define SHARP_s 0xdf
2 |
--------------------------------------------------------------------------------
/libs/Onigmo/autogen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | autoreconf -vfi
4 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/.gitignore:
--------------------------------------------------------------------------------
1 | /tests/*.diff.html
2 |
--------------------------------------------------------------------------------
/libs/tm-parser/tests/results/read/coffee-script.jsonsql.json:
--------------------------------------------------------------------------------
1 | null
2 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-this.ts:
--------------------------------------------------------------------------------
1 | {
2 | this.foo = 9;
3 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-4287.jade:
--------------------------------------------------------------------------------
1 | .ssdsd
2 |
3 | // asdsdas
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/extensions/main.cpp:
--------------------------------------------------------------------------------
1 | int main()
2 | {
3 | return 0;
4 | }
--------------------------------------------------------------------------------
/libs/Onigmo/AUTHORS:
--------------------------------------------------------------------------------
1 | kentkt AT csc DOT jp (K.Takata)
2 | (K.Kosako)
3 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-13777.go:
--------------------------------------------------------------------------------
1 | var e [][]*aType // ( bug in highligher?)
--------------------------------------------------------------------------------
/libs/Onigmo/test.rb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/icedman/vim-textmate/HEAD/libs/Onigmo/test.rb
--------------------------------------------------------------------------------
/libs/Onigmo/testc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/icedman/vim-textmate/HEAD/libs/Onigmo/testc.c
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-keywords.ts:
--------------------------------------------------------------------------------
1 | export var foo = () => new RegExp('');
2 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "exclude": [
3 | "tests"
4 | ]
5 | }
--------------------------------------------------------------------------------
/libs/Onigmo/build_nmake.cmd:
--------------------------------------------------------------------------------
1 | @setlocal enabledelayedexpansion
2 | nmake -f "%~dp0win32\Makefile" %*
3 |
--------------------------------------------------------------------------------
/libs/Onigmo/win32/testc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/icedman/vim-textmate/HEAD/libs/Onigmo/win32/testc.c
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/go/colorize-fixtures/test-13777.go:
--------------------------------------------------------------------------------
1 | var e [][]*aType // ( bug in highligher?)
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/13448.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-function-inv.ts:
--------------------------------------------------------------------------------
1 | rowData.push(callback(new Cell(row, col, false)));
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test6916.js:
--------------------------------------------------------------------------------
1 | for(var i=0;i<9;i++){for(var j;j ({ 'bar': 'baz' })
3 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/issue-1550.yaml:
--------------------------------------------------------------------------------
1 | test1 : dsd
2 | test2 : abc-def
3 | test-3 : abcdef
4 | test-4 : abc-def
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/issue-4008.yaml:
--------------------------------------------------------------------------------
1 | - blue: a="brown,not_brown"
2 | - not_blue: foo
3 | - blue: foo="}"
4 | - not_blue: 1
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/README.md:
--------------------------------------------------------------------------------
1 | These testcases have been generated from the test cases of first-mate at https://github.com/atom/first-mate
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/resources/themes.h:
--------------------------------------------------------------------------------
1 | #ifndef THEMES_H
2 | #define THEMES_H
3 |
4 | extern const char* THEME_MONOKAI;
5 |
6 | #endif // THEMES_H
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-members.ts:
--------------------------------------------------------------------------------
1 | class A2 {
2 | public count: number = 9;
3 | public resolveNextGeneration(cell : A2) {
4 | }
5 | }
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/resources/grammars.h:
--------------------------------------------------------------------------------
1 | #ifndef GRAMMARS_H
2 | #define GRAMMARS_H
3 |
4 | extern const char* GRAMMAR_CPP;
5 |
6 | #endif // GRAMMARS_H
--------------------------------------------------------------------------------
/libs/tm-parser/tests/cases/test.xml:
--------------------------------------------------------------------------------
1 |
2 | Tove
3 | Jani
4 | Reminder
5 | Don't forget me this weekend!
6 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/12750.html:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/libs/tm-parser/screenshots/Screenshot from 2020-05-28 22-55-06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/icedman/vim-textmate/HEAD/libs/tm-parser/screenshots/Screenshot from 2020-05-28 22-55-06.png
--------------------------------------------------------------------------------
/libs/tm-parser/screenshots/Screenshot from 2020-06-05 23-10-30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/icedman/vim-textmate/HEAD/libs/tm-parser/screenshots/Screenshot from 2020-06-05 23-10-30.png
--------------------------------------------------------------------------------
/libs/tm-parser/screenshots/Screenshot from 2020-06-05 23-10-46.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/icedman/vim-textmate/HEAD/libs/tm-parser/screenshots/Screenshot from 2020-06-05 23-10-46.png
--------------------------------------------------------------------------------
/libs/tm-parser/screenshots/Screenshot from 2020-06-05 23-11-41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/icedman/vim-textmate/HEAD/libs/tm-parser/screenshots/Screenshot from 2020-06-05 23-11-41.png
--------------------------------------------------------------------------------
/libs/tm-parser/screenshots/Screenshot from 2020-06-05 23-13-41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/icedman/vim-textmate/HEAD/libs/tm-parser/screenshots/Screenshot from 2020-06-05 23-13-41.png
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-strings.ts:
--------------------------------------------------------------------------------
1 | var x = `Hello ${foo}!`;
2 | console.log(`string text line 1
3 | string text line 2`);
4 | x = tag`Hello ${ a + b } world ${ a * b }`;
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-issue5431.ts:
--------------------------------------------------------------------------------
1 | function foo(isAll, startTime, endTime) {
2 | const timeRange = isAll ? '所有时间' : `${startTime} - ${endTime}`;
3 | return true;
4 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.sql:
--------------------------------------------------------------------------------
1 | CREATE VIEW METRIC_STATS (ID, MONTH, TEMP_C, RAIN_C) AS
2 | SELECT ID,
3 | MONTH,
4 | (TEMP_F - 32) * 5 /9,
5 | RAIN_I * 0.3937
6 | FROM STATS;
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-brackets.tsx:
--------------------------------------------------------------------------------
1 | let a = Array(); // Highlight ok here
2 |
3 | interface egGenericsInArray {
4 | a: Array;
5 | }
6 | let s = "nothing should fail here...";
--------------------------------------------------------------------------------
/libs/tm-parser/tests/cases/test.cpp:
--------------------------------------------------------------------------------
1 | struct s {
2 | s();
3 | ~s();
4 |
5 | void test();
6 | };
7 |
8 | int x(1)
9 | {
10 | if (0) {
11 | return 0;
12 | }
13 | return 0;
14 | }
15 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-variables.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --spacing-unit: 6px;
3 | --cell-padding: (4 * var(--spacing-unit));
4 | }
5 | body {
6 | padding-left: calc(4 * var(--spacing-unit, 5px));
7 | }
--------------------------------------------------------------------------------
/libs/tm-parser/tests/results/parsed/coffee-script.jsonsql.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes" : null,
3 | "foldingStartMarker" : "",
4 | "foldingStopMarker" : "",
5 | "name" : "",
6 | "repository" : null,
7 | "scopeName" : ""
8 | }
9 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-cssvariables.less:
--------------------------------------------------------------------------------
1 | :root {
2 | --spacing-unit: 6px;
3 | --cell-padding: (4 * var(--spacing-unit));
4 | }
5 | body {
6 | padding-left: calc(4 * var(--spacing-unit, 5px));
7 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-cssvariables.scss:
--------------------------------------------------------------------------------
1 | :root {
2 | --spacing-unit: 6px;
3 | --cell-padding: (4 * var(--spacing-unit));
4 | }
5 | body {
6 | padding-left: calc(4 * var(--spacing-unit, 5px));
7 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/loops.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "loops",
3 | "scopeName": "source.loops",
4 | "patterns": [
5 | {
6 | "match": "(.*)(?=test)",
7 | "name": "variable.language.test"
8 | }
9 | ]
10 | }
--------------------------------------------------------------------------------
/libs/tm-parser/tests-c/meson.build:
--------------------------------------------------------------------------------
1 | testc_files = [
2 | 'main.cpp',
3 | ]
4 |
5 | executable(
6 | 'tests-c',
7 | testc_files,
8 | include_directories: [ textmate_inc ],
9 | dependencies: [ textmate_dep, jsoncpp_dep, onigmo_dep ]
10 | )
11 |
--------------------------------------------------------------------------------
/libs/tm-parser/tests/cases/README.md:
--------------------------------------------------------------------------------
1 | This app is a simple SublimeText replacement.
2 | It uses the textmate parser. And reuses some visual studio code extensions.
3 |
4 | # to-mvp
5 | * keybindings
6 | * scripting
7 |
8 | # features
9 | * minimap
10 | * themes
11 |
12 |
13 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-regex.coffee:
--------------------------------------------------------------------------------
1 | regex = /Hello (\d+) #{user}/g
2 | 2 / 3
3 | 2/3
4 |
5 | a = b/c + d/g
6 | someOtherStuff
7 |
8 | name="hello"
9 | test=/// #{name}
10 |
11 | fancyRegExp = ///
12 | (\d+) # numbers
13 | (\w*) # letters
14 | $ # the end
15 | ///
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.ini:
--------------------------------------------------------------------------------
1 | ; last modified 1 April 2001 by John Doe
2 | [owner]
3 | name=John Doe
4 | organization=Acme Widgets Inc.
5 |
6 | [database]
7 | ; use IP address in case network name resolution is not working
8 | server=192.0.2.62
9 | port=143
10 | file="payroll.dat"
--------------------------------------------------------------------------------
/libs/tm-parser/tests/meson.build:
--------------------------------------------------------------------------------
1 | test_files = [
2 | 'main.cpp',
3 | ]
4 |
5 | executable(
6 | 'tests',
7 | test_files,
8 | include_directories: [ parser_inc, scopes_inc, theme_inc ],
9 | dependencies: [ jsoncpp_dep, parser_dep, scopes_dep, theme_dep, onigmo_dep ]
10 | )
11 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-7115.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/include-external-repository-rule.json:
--------------------------------------------------------------------------------
1 | {
2 | "scopeName": "test.include-external-repository-rule",
3 | "patterns": [
4 | {
5 | "include": "source.nogrammar#a_rule"
6 | },
7 | {
8 | "include": "source.python#builtin_functions"
9 | }
10 | ]
11 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.swift:
--------------------------------------------------------------------------------
1 | var teamScore = 0
2 | var greeting = "Hello!"
3 | func hasAnyMatches(list: [Int], condition: (Int) -> Bool) -> Bool {
4 | for item in list {
5 | if condition(item) {
6 | return true
7 | }
8 | }
9 | return false
10 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/onigtests/fixtures/onigasm-issue3.js:
--------------------------------------------------------------------------------
1 | a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a12345678912345678=1
--------------------------------------------------------------------------------
/libs/Onigmo/enc/gb2312.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "regenc.h"
4 |
5 | void
6 | Init_gb2312(void)
7 | {
8 | rb_enc_register("GB2312", rb_enc_find("EUC-KR"));
9 | }
10 |
11 | ENC_ALIAS("EUC-CN", "GB2312")
12 | ENC_ALIAS("eucCN", "GB2312")
13 | ENC_REPLICATE("GB12345", "GB2312")
14 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.json:
--------------------------------------------------------------------------------
1 | {
2 | // a comment
3 | "options": {
4 | "myBool": true,
5 | "myInteger": 1,
6 | "myString": "String\u0056",
7 | "myNumber": 1.24,
8 | "myNull": null,
9 | "myArray": [ 1, "Hello", true, null, [], {}],
10 | "myObject" : {
11 | "foo": "bar"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/forever.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "forever",
3 | "scopeName": "source.forever",
4 | "patterns": [
5 | {
6 | "name": "text",
7 | "begin": "(?=forever)",
8 | "end": "whatevs",
9 | "patterns": [
10 | {
11 | "include": "$self"
12 | }
13 | ]
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/libs/tm-parser/.gitignore:
--------------------------------------------------------------------------------
1 | install_manifest.txt
2 | *.swp
3 | *.o
4 | *.a
5 | *.orig
6 | bin/
7 | test/
8 | build/
9 | build-*/
10 | .lvimrc
11 | config-debug
12 | subprojects/wlroots
13 | tmp
14 | subprojects
15 |
16 | Makefile
17 | moc_*
18 | .qmake*
19 | editor.app
20 | editor/editor
21 |
22 | node_modules
23 | dist
24 | .cache
25 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.lua:
--------------------------------------------------------------------------------
1 | -- defines a factorial function
2 | function fact (n)
3 | if n == 0 then
4 | return 1
5 | else
6 | return n * fact(n-1)
7 | end
8 | end
9 |
10 | print("enter a number:")
11 | a = io.read("*number") -- read a number
12 | print(fact(a))
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/parser/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "grammar.h"
4 | #include "reader.h"
5 |
6 | using namespace parse;
7 |
8 | int main(int argc, char** argv)
9 | {
10 | Json::Value root = loadJson("test-cases/first-mate/fixtures/hello.json");
11 | grammar_ptr gm = parse_grammar(root);
12 | return 0;
13 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/imaginary.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test",
3 | "scopeName": "source.imaginaryLanguage",
4 | "patterns": [
5 | {
6 | "name": "comment-body",
7 | "begin": "//",
8 | "end": "\\n",
9 | "beginCaptures": {
10 | "0": {
11 | "name": "comment-start"
12 | }
13 | }
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/libs/Onigmo/onigmo.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@prefix@
2 | exec_prefix=@exec_prefix@
3 | libdir=@libdir@
4 | includedir=@includedir@
5 | datarootdir=@datarootdir@
6 | datadir=@datadir@
7 |
8 | Name: onigmo
9 | Description: Regular expression library
10 | Version: @PACKAGE_VERSION@
11 | Requires:
12 | Libs: -L${libdir} -lonigmo
13 | Cflags: -I${includedir}
14 |
15 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/content-name.json:
--------------------------------------------------------------------------------
1 | {
2 | "scopeName": "source.test",
3 | "patterns": [
4 | {
5 | "begin": "#if",
6 | "end": "#endif",
7 | "name": "pre",
8 | "contentName": "nested"
9 | },
10 | {
11 | "begin": "\\s*",
12 | "end": "fin",
13 | "name": "all",
14 | "contentName": "middle"
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/objective-c-plus-plus.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes": [
3 | "mm",
4 | "M",
5 | "h"
6 | ],
7 | "keyEquivalent": "^~O",
8 | "name": "Objective-C++",
9 | "patterns": [
10 | {
11 | "include": "source.c++"
12 | },
13 | {
14 | "include": "source.objc"
15 | }
16 | ],
17 | "scopeName": "source.objc++"
18 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/suite1/fixtures/105.grammarB.json:
--------------------------------------------------------------------------------
1 | {
2 | "scopeName": "source.test.embedded",
3 | "patterns": [{ "include": "#test" }],
4 | "repository": {
5 | "test": {
6 | "begin": "testStart",
7 | "end": "testEnd",
8 | "patterns": [{ "include": "#test2" }]
9 | },
10 | "test2": {
11 | "include": "source.test#test2"
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/scopes/parse.h:
--------------------------------------------------------------------------------
1 | #ifndef SCOPES_PARSE_H
2 | #define SCOPES_PARSE_H
3 |
4 | #include "types.h"
5 |
6 | namespace scope {
7 |
8 | namespace parse {
9 |
10 | char const* selector(char const* first, char const* last,
11 | scope::types::selector_t& selector);
12 |
13 | } // namespace parse
14 |
15 | } // namespace scope
16 |
17 | #endif
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/infinite-loop.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "infinite-loop-grammar",
3 | "scopeName": "source.infinite-loop",
4 | "patterns": [
5 | {
6 | "name": "start",
7 | "begin": "^",
8 | "end": "$",
9 | "patterns": [
10 | {
11 | "name": "negative-look-ahead",
12 | "match": "(?!a)"
13 | }
14 | ]
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.rs:
--------------------------------------------------------------------------------
1 | use std::io;
2 |
3 | fn main() {
4 | println!("Guess the number!");
5 |
6 | println!("Please input your guess.");
7 |
8 | let mut guess = String::new();
9 |
10 | io::stdin().read_line(&mut guess)
11 | .ok()
12 | .expect("Failed to read line");
13 |
14 | println!("You guessed: {}", guess);
15 | }
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/scopes/scopes_parse.h:
--------------------------------------------------------------------------------
1 | #ifndef SCOPES_PARSE_H
2 | #define SCOPES_PARSE_H
3 |
4 | #include "types.h"
5 |
6 | namespace scope {
7 |
8 | namespace parse {
9 |
10 | char const* selector(char const* first, char const* last,
11 | scope::types::selector_t& selector);
12 |
13 | } // namespace parse
14 |
15 | } // namespace scope
16 |
17 | #endif
--------------------------------------------------------------------------------
/libs/Onigmo/tool/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore UCD files
2 | Blocks.txt
3 | CaseFolding.txt
4 | DerivedAge.txt
5 | DerivedCoreProperties.txt
6 | PropList.txt
7 | PropertyAliases.txt
8 | PropertyValueAliases.txt
9 | Scripts.txt
10 | SpecialCasing.txt
11 | UnicodeData.txt
12 | GraphemeBreakProperty.txt
13 | emoji-data.txt
14 |
15 | # ignore generated files
16 | casefold.h
17 | name2ctype.h
18 | name2ctype.kwd
19 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/issue-6303.yaml:
--------------------------------------------------------------------------------
1 | swagger: '2.0'
2 | info:
3 | description: 'The API Management Service API defines an updated and refined version
4 | of the concepts currently known as Developer, APP, and API Product in Edge. Of
5 | note is the introduction of the API concept, missing previously from Edge
6 |
7 | '
8 | title: API Management Service API
9 | version: initial
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-6611.rs:
--------------------------------------------------------------------------------
1 | impl Foo
2 | where A: B
3 | { }
4 |
5 | impl Foo for C
6 | where A: B
7 | { }
8 |
9 | impl Foo for C
10 | {
11 | fn foo -> C
12 | where A: B
13 | { }
14 | }
15 |
16 | fn foo -> C
17 | where A: B
18 | { }
19 |
20 | struct Foo
21 | where A: B
22 | { }
23 |
24 | trait Foo : C
25 | where A: B
26 | { }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/hello.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hello",
3 | "scopeName": "source.hello",
4 | "fileTypes": [
5 | "world"
6 | ],
7 | "patterns": [
8 | {
9 | "match": "hello",
10 | "name": "prefix.hello"
11 | },
12 | {
13 | "match": "world(!?)",
14 | "captures": {
15 | "1": {
16 | "name": "emphasis.hello"
17 | }
18 | },
19 | "name": "suffix.hello"
20 | }
21 | ]
22 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/nested-captures.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test",
3 | "scopeName": "nested",
4 | "patterns": [
5 | {
6 | "name": "text",
7 | "match": "(a(b))",
8 | "captures": {
9 | "1": {
10 | "patterns": [
11 | {
12 | "match": "ab",
13 | "name": "a"
14 | }
15 | ]
16 | },
17 | "2": {
18 | "name": "b"
19 | }
20 | }
21 | }
22 | ]
23 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.shader:
--------------------------------------------------------------------------------
1 | Shader "Example/Diffuse Simple" {
2 | SubShader {
3 | Tags { "RenderType" = "Opaque" }
4 | CGPROGRAM
5 | #pragma surface surf Lambert
6 | struct Input {
7 | float4 color : COLOR;
8 | };
9 | void surf (Input IN, inout SurfaceOutput o) {
10 | o.Albedo = 1;
11 | }
12 | ENDCG
13 | }
14 | Fallback "Diffuse"
15 | }
--------------------------------------------------------------------------------
/libs/Onigmo/doc/FAQ.ja:
--------------------------------------------------------------------------------
1 | FAQ 2016/11/07
2 |
3 | 1. 最長マッチ
4 |
5 | onig_new()の中で、ONIG_OPTION_FIND_LONGESTオプション
6 | を使用すれば最長マッチになる。
7 |
8 |
9 | 2. CR + LF
10 |
11 | DOSの改行(CR(0x0c) + LF(0x0a)の連続)
12 |
13 | regenc.hの中の、以下の部分を有効にし、onig_new()で
14 | ONIG_OPTION_NEWLINE_CRLFオプションを使用する。
15 |
16 | /* #define USE_CRNL_AS_LINE_TERMINATOR */
17 |
18 |
19 | 3. メーリングリスト
20 |
21 | 鬼雲/鬼車に関するメーリングリストは存在しない。
22 |
23 | //END
24 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/parser/defines.h:
--------------------------------------------------------------------------------
1 | #ifndef PARSE_DEFINES_H
2 | #define PARSE_DEFINES_H
3 |
4 | #include
5 | #include
6 |
7 | #ifdef WIN64
8 | #include
9 | #define ssize_t SSIZE_T
10 | #endif
11 |
12 | #ifndef SIZE_T_MAX
13 | #define SIZE_T_MAX SIZE_MAX
14 | #endif
15 |
16 | #ifndef NULL_STR
17 | #define NULL_STR ""
18 | #endif
19 |
20 | #ifndef nullptr
21 | #define nullptr 0
22 | #endif
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/libs/tm-parser/tests/cases/test.c:
--------------------------------------------------------------------------------
1 | // editor_command(editor, command.toNativeUtf8(), '${line}:${position}'.toNativeUtf8()); editor_command(editor, command.toNativeUtf8(), '${line}:${position}'.toNativeUtf8());
2 |
3 | /* test.c */
4 | #include
5 | /* a sample app */
6 | int main(int argc, char** argv)
7 | {
8 | for (int i = 0; i < 4; i++) {
9 | printf("%d", i);
10 | }
11 |
12 | return 0;
13 | }
14 |
15 | /* last line */
16 |
--------------------------------------------------------------------------------
/libs/tm-parser/tests/results/read/hello.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes" :
3 | [
4 | "world"
5 | ],
6 | "name" : "hello",
7 | "patterns" :
8 | [
9 | {
10 | "match" : "hello",
11 | "name" : "prefix.hello"
12 | },
13 | {
14 | "captures" :
15 | {
16 | "1" :
17 | {
18 | "name" : "emphasis.hello"
19 | }
20 | },
21 | "match" : "world(!?)",
22 | "name" : "suffix.hello"
23 | }
24 | ],
25 | "scopeName" : "source.hello"
26 | }
27 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/parser/reader.h:
--------------------------------------------------------------------------------
1 | #ifndef PARSE_READER_H
2 | #define PARSE_READER_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "grammar.h"
9 | #include "private.h"
10 |
11 | namespace parse {
12 |
13 | rule_ptr convert_json(Json::Value const& json, rule_ptr target = nullptr);
14 |
15 | Json::Value rule_to_json(rule_ptr const& rule);
16 |
17 | Json::Value loadJson(std::string filename);
18 |
19 | } // namespace parse
20 |
21 | #endif
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/onigtests/fixtures/php-onigasm-issue17.php:
--------------------------------------------------------------------------------
1 | is the HTML equivalent to a new line.
4 | $string = 'Hello World! ';
5 |
6 | // You can echo the variable, similar to the way you would echo a string.
7 | echo $string;
8 |
9 | // You could also use print.
10 | print $string;
11 |
12 | // Or, if you are familiar with C, printf can be used too.
13 | printf('%s', $string);
14 | ?>
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.r:
--------------------------------------------------------------------------------
1 | # © Microsoft. All rights reserved.
2 |
3 | #' Add together two numbers.
4 | #'
5 | #' @param x A number.
6 | #' @param y A number.
7 | #' @return The sum of \code{x} and \code{y}.
8 | #' @examples
9 | #' add(1, 1)
10 | #' add(10, 1)
11 | add <- function(x, y) {
12 | x + y
13 | }
14 |
15 | add(1, -2, 2.0)
16 | add(1.0e10, 2.0e10)
17 |
18 | paste("one", NULL)
19 | paste(NA, 'two')
20 |
21 | paste("multi-
22 | line",
23 | 'multi-
24 | line')
25 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu
2 | MAINTAINER Kimbro Staken
3 |
4 | RUN apt-get install -y software-properties-common python
5 | RUN add-apt-repository ppa:chris-lea/node.js
6 | RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list
7 | RUN apt-get update
8 | RUN apt-get install -y nodejs
9 | #RUN apt-get install -y nodejs=0.6.12~dfsg1-1ubuntu1
10 | RUN mkdir /var/www
11 |
12 | ADD app.js /var/www/app.js
13 |
14 | CMD ["/usr/bin/node", "/var/www/app.js"]
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.cpp:
--------------------------------------------------------------------------------
1 | // classes example
2 | #include
3 | using namespace std;
4 |
5 | class Rectangle {
6 | int width, height;
7 |
8 | public:
9 | void set_values(int, int);
10 | int area() { return width * height; }
11 | };
12 |
13 | void Rectangle::set_values(int x, int y)
14 | {
15 | width = x;
16 | height = y;
17 | }
18 |
19 | int main()
20 | {
21 | Rectangle rect;
22 | rect.set_values(3, 4);
23 | cout << "area: " << rect.area();
24 | return 0;
25 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/multiline.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test",
3 | "scopeName": "source.multilineLanguage",
4 | "patterns": [
5 | {
6 | "name": "outside-x",
7 | "begin": "X",
8 | "beginCaptures": {
9 | "0": {
10 | "name": "start"
11 | }
12 | },
13 | "end": "(X|\\n)",
14 | "endCaptures": {
15 | "0": {
16 | "name": "end"
17 | }
18 | },
19 | "patterns": [
20 | {
21 | "match": "\\\\\\n",
22 | "name": "inside-x"
23 | }
24 | ]
25 | }
26 | ]
27 | }
--------------------------------------------------------------------------------
/libs/Onigmo/doc/FAQ:
--------------------------------------------------------------------------------
1 | FAQ 2016/11/07
2 |
3 | 1. Longest match
4 |
5 | You can execute longest match by using ONIG_OPTION_FIND_LONGEST option
6 | in onig_new().
7 |
8 |
9 | 2. CR + LF
10 |
11 | DOS newline (CR (0x0c) + LF (0x0a) sequence)
12 |
13 | Enable the following line in regenc.h, and use ONIG_OPTION_NEWLINE_CRLF
14 | option in onig_new().
15 |
16 | /* #define USE_CRNL_AS_LINE_TERMINATOR */
17 |
18 |
19 | 3. Mailing list
20 |
21 | There is no mailing list about Onigmo/Oniguruma.
22 |
23 | // END
24 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/extensions/meson.build:
--------------------------------------------------------------------------------
1 | extensions_files = [
2 | 'utf8.cpp',
3 | 'util.cpp',
4 | 'tinyxml2.cpp',
5 | 'extension.cpp'
6 | ]
7 |
8 | extensions_lib
9 | = static_library('extensions', extensions_files, dependencies
10 | : [ jsoncpp_dep, onigmo_dep, scopes_dep, parser_dep, theme_dep ])
11 |
12 | extensions
13 | = executable('extensions', extensions_files, 'main.cpp', dependencies
14 | : [ jsoncpp_dep, onigmo_dep, scopes_dep, parser_dep, theme_dep ])
15 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/todo.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes": [],
3 | "injectionSelector": "comment, text.plain",
4 | "name": "TODO",
5 | "patterns": [
6 | {
7 | "match": "\\b(TODO|FIXME|CHANGED)\\b",
8 | "name": "storage.type.class.${1:/downcase}"
9 | },
10 | {
11 | "captures": {
12 | "1": {
13 | "name": "markup.underline.link.radar"
14 | }
15 | },
16 | "match": "<(ra?dar:/(?:/problem|)/(?:[&0-9]+))>",
17 | "name": "storage.type.class.radar"
18 | }
19 | ],
20 | "scopeName": "text.todo"
21 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/COMMIT_EDITMSG:
--------------------------------------------------------------------------------
1 | This is the summary line. It can't be too long.
2 | After I can write a much more detailed description without quite the same restrictions on length.
3 |
4 | # Please enter the commit message for your changes. Lines starting
5 | # with '#' will be ignored, and an empty message aborts the commit.
6 | # On branch master
7 | # Your branch is up-to-date with 'origin/master'.
8 | #
9 | # Changes to be committed:
10 | # deleted: README.md
11 | # modified: index.less
12 | # new file: spec/COMMIT_EDITMSG
13 | #
--------------------------------------------------------------------------------
/libs/tm-parser/tests/results/parsed/hello.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes" :
3 | [
4 | "world"
5 | ],
6 | "foldingStartMarker" : "",
7 | "foldingStopMarker" : "",
8 | "name" : "hello",
9 | "patterns" :
10 | [
11 | {
12 | "match" : "hello",
13 | "name" : "prefix.hello"
14 | },
15 | {
16 | "captures" :
17 | {
18 | "1" :
19 | {
20 | "name" : "emphasis.hello"
21 | }
22 | },
23 | "match" : "world(!?)",
24 | "name" : "suffix.hello"
25 | }
26 | ],
27 | "repository" : null,
28 | "scopeName" : "source.hello"
29 | }
30 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/suite1/fixtures/105.grammarA.json:
--------------------------------------------------------------------------------
1 | {
2 | "scopeName": "source.test",
3 | "patterns": [{ "include": "#test" }, { "include": "#embedded" }],
4 | "repository": {
5 | "test": {
6 | "begin": "testStart",
7 | "end": "testEnd",
8 | "patterns": [{ "include": "#test2" }]
9 | },
10 | "test2": {
11 | "match": "some test pattern",
12 | "name": "test.name"
13 | },
14 | "embedded": {
15 | "begin": "embedStart",
16 | "end": "embedEnd",
17 | "patterns": [{ "include": "source.test.embedded" }]
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.yaml:
--------------------------------------------------------------------------------
1 | # sequencer protocols for Laser eye surgery
2 | ---
3 | - step: &id001 # defines anchor label &id001
4 | instrument: Lasik 2000
5 | pulseEnergy: 5.4
6 | spotSize: 1mm
7 |
8 | - step: *id001 # refers to the first step (with anchor &id001)
9 | - step: *id001
10 | spotSize: 2mm
11 | - step: *id002
12 | - {name: John Smith, age: 33}
13 | - name: Mary Smith
14 | age: 27
15 | men: [John Smith, Bill Jones]
16 | women:
17 | - Mary Smith
18 | - Susan Williams
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-issue11.ts:
--------------------------------------------------------------------------------
1 | let keyCode = 0;
2 | if(!(keyCode === 8 || (keyCode>=48 && keyCode<=57))) {}
3 | for (let i=0; i<5; i++) {}
4 | for (var i=0; i<5; i++) {}
5 | for (let i=0; i<5; i++) {}
6 | for (; i<5;) {}
7 | for (let i=0; 1+( i<<5 ) < 5;i++) {}
8 | var p = 1?2:(3<4?5:6);
9 | class A { }
10 | class A1 string }> { }
11 | class B { }
12 | class C { }
13 | function foo() { return 1;}
14 | let x1: A<(param?: number) => void, B>;
15 | let x2: A;
16 | const t = 1 < (5 > 10 ? 1 : 2);
17 | var f6 = 1 < foo();
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/onigtests/fixtures/test-issue11.ts:
--------------------------------------------------------------------------------
1 | let keyCode = 0;
2 | if(!(keyCode === 8 || (keyCode>=48 && keyCode<=57))) {}
3 | for (let i=0; i<5; i++) {}
4 | for (var i=0; i<5; i++) {}
5 | for (let i=0; i<5; i++) {}
6 | for (; i<5;) {}
7 | for (let i=0; 1+( i<<5 ) < 5;i++) {}
8 | var p = 1?2:(3<4?5:6);
9 | class A { }
10 | class A1 string }> { }
11 | class B { }
12 | class C { }
13 | function foo() { return 1;}
14 | let x1: A<(param?: number) => void, B>;
15 | let x2: A;
16 | const t = 1 < (5 > 10 ? 1 : 2);
17 | var f6 = 1 < foo();
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.coffee:
--------------------------------------------------------------------------------
1 | """
2 | A CoffeeScript sample.
3 | """
4 |
5 | class Vehicle
6 | constructor: (@name) =>
7 |
8 | drive: () =>
9 | alert "Drive #{@name}"
10 |
11 | class Car extends Vehicle
12 | drive: () =>
13 | alert "Driving #{@name}"
14 |
15 | c = new Car "Volvo"
16 |
17 | while onTheRoad()
18 | c.drive()
19 |
20 | vehicles = (new Car for i in [1..100])
21 |
22 | startRace = (vehicles) -> [vehicle.drive() for vehicle in vehicles]
23 |
24 | fancyRegExp = ///
25 | (\d+) # numbers
26 | (\w*) # letters
27 | $ # the end
28 | ///
29 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/hyperlink.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes": [],
3 | "injectionSelector": "text, string, comment",
4 | "name": "Hyperlink",
5 | "patterns": [
6 | {
7 | "match": "(?x)\n\t\t\t\t( (https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man(-page)?|gopher|txmt|issue)://|mailto:)\n\t\t\t\t[-:@a-zA-Z0-9_.,~%+/?=]+(?
5 | #include
6 | #include
7 |
8 | #include "extension.h"
9 | #include "private.h"
10 | #include "scope.h"
11 |
12 | namespace parse {
13 | struct stack_t;
14 | typedef std::shared_ptr stack_ptr;
15 |
16 | void set_extensions(extension_list* extensions);
17 |
18 | stack_ptr parse(char const* first, char const* last, stack_ptr stack,
19 | std::map& scopes, bool firstLine);
20 | bool equal(stack_ptr lhs, stack_ptr rhs);
21 |
22 | } // namespace parse
23 |
24 | #endif
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | all: prebuild build install
2 |
3 | .PHONY: prebuild build install
4 |
5 | prebuild:
6 | cd libs/Onigmo && ./autogen.sh && ./configure
7 |
8 | build:
9 | mkdir -p build
10 | cd build && cmake ../cmake && make
11 | cp build/textmate.so ./
12 |
13 | install:
14 | mkdir -p ~/.vim/lua/vim-textmate
15 | cp -R ./textmate.so ~/.vim/lua/vim-textmate
16 | cp -R ./vim-textmate.lua ~/.vim/lua/vim-textmate
17 |
18 | uninstall:
19 | rm -R ~/.vim/lua/vim-textmate*
20 | rm ~/.vim/lua/textmate.*
21 |
22 | clean:
23 | rm -rf build
24 |
25 | format:
26 | stylua --quote-style=AutoPreferDouble --indent-type=Spaces --indent-width=2 ./vim-textmate.lua
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | setlocal
3 |
4 | title VSCode Dev
5 |
6 | pushd %~dp0\..
7 |
8 | :: Node modules
9 | if not exist node_modules call .\scripts\npm.bat install
10 |
11 | :: Get electron
12 | node .\node_modules\gulp\bin\gulp.js electron
13 |
14 | :: Build
15 | if not exist out node .\node_modules\gulp\bin\gulp.js compile
16 |
17 | :: Configuration
18 | set NODE_ENV=development
19 | set VSCODE_DEV=1
20 | set ELECTRON_DEFAULT_ERROR_MODE=1
21 | set ELECTRON_ENABLE_LOGGING=1
22 | set ELECTRON_ENABLE_STACK_DUMPING=1
23 |
24 | :: Launch Code
25 | .\.build\electron\electron.exe . %*
26 | popd
27 |
28 | endlocal
--------------------------------------------------------------------------------
/libs/Onigmo/.travis.yml:
--------------------------------------------------------------------------------
1 | language: c
2 |
3 | branches:
4 | except:
5 | - ruby-2.x
6 |
7 | compiler:
8 | - gcc
9 | - clang
10 |
11 | env:
12 | - CFLAGS=--coverage CONFOPT=
13 |
14 | sudo: false
15 |
16 | addons:
17 | apt:
18 | packages:
19 | - lcov
20 | #- python3
21 |
22 | before_install:
23 | - gem install lcoveralls
24 |
25 | before_script:
26 | - ./autogen.sh
27 | - ./configure $CONFOPT && make
28 |
29 | script:
30 | - make test
31 |
32 | after_success:
33 | - lcov -c -d .libs -d enc/.libs -o coverage.info
34 | - lcoveralls --retry-count 5 coverage.info
35 | - bash <(curl -s https://codecov.io/bash)
36 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.hbs:
--------------------------------------------------------------------------------
1 | Comments
2 |
3 |
10 |
11 | {{!-- only output author name if an author exists --}}
12 | {{#if author}}
13 |
{{firstName}} {{lastName}}
14 | {{/if}}
15 |
16 |
17 | {{> userMessage tagName="h1" }}
18 |
19 |
Comments
20 |
21 | {{#each comments}}
22 | {{> userMessage tagName="h2" }}
23 | {{/each}}
24 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/parser/meson.build:
--------------------------------------------------------------------------------
1 | parser_files = [
2 | 'grammar.cpp',
3 | 'reader.cpp',
4 | 'pattern.cpp',
5 | 'parser.cpp'
6 | ]
7 |
8 | parser_lib
9 | = static_library('parser', parser_files, dependencies
10 | : [ jsoncpp_dep, onigmo_dep, scopes_dep ])
11 |
12 | parser
13 | = executable('parser', parser_files, 'main.cpp', dependencies
14 | : [ jsoncpp_dep, onigmo_dep, scopes_dep ])
15 |
16 | parser_dep
17 | = declare_dependency(include_directories
18 | : [ parser_inc, scopes_inc, extension_inc ], link_with
19 | : parser_lib)
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/git-rebase-todo:
--------------------------------------------------------------------------------
1 | pick 1fc6c95 Patch A
2 | squash fa39187 Something to add to patch A
3 | pick 7b36971 Something to move before patch B
4 | pick 6b2481b Patch B
5 | fixup c619268 A fix for Patch B
6 | edit dd1475d Something I want to split
7 | reword 4ca2acc i cant' typ goods
8 |
9 | # Commands:
10 | # p, pick = use commit
11 | # r, reword = use commit, but edit the commit message
12 | # e, edit = use commit, but stop for amending
13 | # s, squash = use commit, but meld into previous commit
14 | # f, fixup = like "squash", but discard this commit's log message
15 | # x, exec = run command (the rest of the line) using shell
--------------------------------------------------------------------------------
/libs/tm-parser/README.md:
--------------------------------------------------------------------------------
1 | # tm-parser
2 |
3 | This project contains portions of macromate's textmate opensource app, specifically the langauge parser and the scope-style resolver.
4 | Langauge and theme formats supported is json only (vscode version).
5 |
6 | Some projects using this parser:
7 |
8 | github.com/icedman/ashlar-text (Qt)
9 | github.com/icedman/tashlar (curses and sdl)
10 |
11 | ashlar code (android - flutter)
12 | http://www.munchyapps.com
13 |
14 | # Legal
15 | The source for TextMate is released under the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
16 | TextMate is a trademark of Allan Odgaard.
17 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "encoding/base64"
5 | "fmt"
6 | )
7 |
8 | func main() {
9 | dnsName := "test-vm-from-go"
10 | storageAccount := "mystorageaccount"
11 |
12 | client, err := management.ClientFromPublishSettingsFile("path/to/downloaded.publishsettings", "")
13 | if err != nil {
14 | panic(err)
15 | }
16 |
17 | // create virtual machine
18 | role := vmutils.NewVMConfiguration(dnsName, vmSize)
19 | vmutils.ConfigureDeploymentFromPlatformImage(
20 | &role,
21 | vmImage,
22 | fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", storageAccount, dnsName),
23 | "")
24 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
{{title}}
3 | {{#if author}}
4 | {{author.firstName}} {{author.lastName}}
5 | {{else}}
6 | Unknown Author
7 | {{/if}}
8 | {{contentBody}}
9 |
10 |
11 | {{#unless license}}
12 | WARNING: This entry does not have a license!
13 | {{/unless}}
14 |
15 |
22 |
23 | Comments
24 |
25 |
--------------------------------------------------------------------------------
/libs/Onigmo/.editorconfig:
--------------------------------------------------------------------------------
1 | ; see: http://editorconfig.org/
2 |
3 | root = true
4 |
5 | [*]
6 | end_of_line = lf
7 | insert_final_newline = true
8 | trim_trailing_whitespace = true
9 |
10 | [**.[ch]]
11 | indent_style = tab
12 | indent_size = 2
13 | tab_width = 8
14 |
15 | [st.[ch]]
16 | indent_style = tab
17 | indent_size = 4
18 | tab_width = 8
19 |
20 | [**.py]
21 | indent_style = space
22 | indent_size = 4
23 |
24 | [**.rb]
25 | indent_style = space
26 | indent_size = 2
27 |
28 | [**.yml]
29 | indent_style = space
30 | indent_size = 2
31 |
32 | [HISTORY]
33 | indent_style = space
34 |
35 | [doc/*]
36 | indent_style = space
37 |
38 | [win32/*]
39 | end_of_line = crlf
40 |
41 | [win32/*.py]
42 | end_of_line = lf
43 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/go/colorize-fixtures/test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "encoding/base64"
5 | "fmt"
6 | )
7 |
8 | func main() {
9 | dnsName := "test-vm-from-go"
10 | storageAccount := "mystorageaccount"
11 |
12 | client, err := management.ClientFromPublishSettingsFile("path/to/downloaded.publishsettings", "")
13 | if err != nil {
14 | panic(err)
15 | }
16 |
17 | // create virtual machine
18 | role := vmutils.NewVMConfiguration(dnsName, vmSize)
19 | vmutils.ConfigureDeploymentFromPlatformImage(
20 | &role,
21 | vmImage,
22 | fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", storageAccount, dnsName),
23 | "")
24 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/makefile:
--------------------------------------------------------------------------------
1 | all: hello
2 |
3 | hello: main.o factorial.o hello.o
4 | g++ main.o factorial.o hello.o -o hello
5 |
6 | main.o: main.cpp
7 | g++ -c main.cpp
8 |
9 | factorial.o: factorial.cpp
10 | g++ -c factorial.cpp
11 |
12 | hello.o: hello.cpp
13 | g++ -c hello.cpp
14 |
15 | clean:
16 | rm *o hello
17 |
18 | define defined
19 | $(info Checkng existance of $(1))
20 | $(if ifeq "$(flavor $(1))" "undefined",0,1)
21 | endef
22 |
23 | ifeq ($(call defined,TOP_DIR),0)
24 | TOP_DIR must be set before including paths.mk
25 | endif
26 |
27 | include $(TOP_DIR)3rdparty.mk
28 |
29 | ifeq ($(call defined,CODIT_DIR),0)
30 | CODIT_DIR must be set in $(TOP_DIR)3rdparty.mk
31 | endif
--------------------------------------------------------------------------------
/libs/tm-parser/tests-c/main.cpp:
--------------------------------------------------------------------------------
1 | #include "textmate.h"
2 |
3 | #include
4 |
5 | int main(int argc, char** argv)
6 | {
7 | struct tm_t tm;
8 |
9 | tm_init(&tm);
10 | tm_load_grammar(&tm, "extensions/cpp/syntaxes/c.tmLanguage.json");
11 | tm_load_theme(&tm, "test-cases/themes/light_vs.json");
12 |
13 | char* test = "int main(int argc, char** argv)";
14 | char* first = test;
15 | char* last = first + strlen(test);
16 |
17 | tm_parser_state_t first_state = tm_create_state();
18 | tm_parser_state_t next_state = tm_parse_line(&tm, first, last, first_state);
19 |
20 | tm_free_state(first_state);
21 | tm_free_state(next_state);
22 |
23 | tm_free(&tm);
24 | return 0;
25 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.diff:
--------------------------------------------------------------------------------
1 | --- lao Sat Jan 26 23:30:39 1991
2 | +++ tzu Sat Jan 26 23:30:50 1991
3 | @@ -1,7 +1,6 @@
4 | -The Way that can be told of is not the eternal Way;
5 | -The name that can be named is not the eternal name.
6 | The Nameless is the origin of Heaven and Earth;
7 | -The Named is the mother of all things.
8 | +The named is the mother of all things.
9 | +
10 | Therefore let there always be non-being,
11 | so we may see their subtlety,
12 | And let there always be being,
13 | @@ -9,3 +8,6 @@
14 | The two are the same,
15 | But after they are produced,
16 | they have different names.
17 | +They both may be called deep and profound.
18 | +Deeper and more profound,
19 | +The door of all subtleties!
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/suite1/fixtures/66.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | scopeName
6 | text.test
7 |
8 | patterns
9 |
10 |
11 | begin ^.
12 | name comment
13 |
14 |
15 |
16 | begin .
17 | name invalid
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.fs:
--------------------------------------------------------------------------------
1 | // from https://msdn.microsoft.com/en-us/library/dd233160.aspx
2 |
3 | // The declaration creates a constructor that takes two values, name and age.
4 | type Person(name:string, age:int) =
5 | let mutable internalAge = age
6 |
7 | new(name:string) = Person(name, 0)
8 |
9 | member this.Name = name
10 | // A read/write property.
11 | member this.Age
12 | with get() = internalAge
13 | and set(value) = internalAge <- value
14 |
15 | member this.HasABirthday () = internalAge <- internalAge + 1
16 | member this.IsOfAge targetAge = internalAge >= targetAge
17 | override this.ToString () =
18 | "Name: " + name + "\n" + "Age: " + (string)internalAge
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/extensions/utf8.h:
--------------------------------------------------------------------------------
1 | #ifndef UTF8_H
2 | #define UTF8_H
3 |
4 | #include
5 | #include
6 |
7 | const char* utf8_to_codepoint(const char* p, unsigned* dst);
8 | int codepoint_to_utf8(uint32_t utf, char* out);
9 | std::string wstring_to_utf8string(std::wstring text);
10 | std::wstring utf8string_to_wstring(std::string text);
11 |
12 | std::string utf8_insert(std::string& text, size_t pos, std::string& str);
13 | std::string utf8_erase(std::string& text, size_t pos,
14 | size_t len = std::string::npos);
15 | std::string utf8_substr(std::string& text, size_t pos,
16 | size_t len = std::string::npos);
17 | size_t utf8_length(std::string& text);
18 | size_t utf8_clength(char* text);
19 |
20 | #endif // UTF8_H
21 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.cc:
--------------------------------------------------------------------------------
1 | #if B4G_DEBUG_CHECK
2 | fprintf(stderr,"num_candidate_ret=%d:", num_candidate);
3 | for(int i=0;i o(new O);
14 | // sadness.
15 |
16 | sprintf(options, "STYLE=Keramik;TITLE=%s;THEME=%s", ...);
17 | }
18 |
19 |
20 | int main2() {
21 | printf(";");
22 | // the rest of
23 | asm("movw $0x38, %ax; ltr %ax");
24 | fn("{};");
25 |
26 | // the rest of
27 | }
--------------------------------------------------------------------------------
/libs/tm-parser/meson.build:
--------------------------------------------------------------------------------
1 | project(
2 | 'textmate-parser',
3 | ['cpp'],
4 | version : '0.1',
5 | meson_version: '>=0.43.0',
6 | default_options : [
7 | 'warning_level=3',
8 | 'cpp_std=c++14'
9 | ]
10 | )
11 |
12 | add_project_arguments(
13 | [
14 | '-Wno-unused-parameter',
15 | '-Wno-pedantic',
16 | '-Wno-sign-compare',
17 | '-Wno-write-strings'
18 | ],
19 | language: ['cpp']
20 | )
21 |
22 | jsoncpp_dep = dependency('jsoncpp', required: true)
23 | onigmo_dep = dependency('onigmo', required: true)
24 |
25 | cmplr = meson.get_compiler('cpp')
26 |
27 | pwd = meson.current_source_dir()
28 |
29 | textmate_inc = include_directories('textmate')
30 |
31 | subdir('textmate')
32 | subdir('tests')
33 | subdir('tests-c')
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/basic.java:
--------------------------------------------------------------------------------
1 | package foo;
2 |
3 | import org.junit.Test;
4 | import org.junit.runners.*;
5 |
6 | /*
7 | * Multi line comment
8 | */
9 | public class TestClass {
10 |
11 | private String aString;
12 |
13 | /**
14 | * @param args
15 | */
16 | public void doSomething(int a) {
17 | double b = 0.0;
18 | double c = 10e3;
19 | long l = 134l;
20 | }
21 |
22 | /*
23 | * multiline comment
24 | */
25 | @SuppressWarnings(value = "aString")
26 | private long privateMethod(long b){
27 | for (int i = 0; i < 9; i++) {
28 | System.out.println("Hello" + i);
29 | }
30 | return 10;
31 | }
32 |
33 | //single line comment
34 | @Test
35 | public void someTests() {
36 | int hex = 0x5;
37 | Vector v = new Vector();
38 | }
39 |
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | if [[ "$OSTYPE" == "darwin"* ]]; then
4 | realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
5 | ROOT=$(dirname $(dirname $(realpath "$0")))
6 | else
7 | ROOT=$(dirname $(dirname $(readlink -f $0)))
8 | fi
9 |
10 | DEVELOPER=$(xcode-select -print-path)
11 | LIPO=$(xcrun -sdk iphoneos -find lipo)
12 |
13 | function code() {
14 | cd $ROOT
15 |
16 | # Node modules
17 | test -d node_modules || ./scripts/npm.sh install
18 |
19 | # Configuration
20 | export NODE_ENV=development
21 |
22 | # Launch Code
23 | if [[ "$OSTYPE" == "darwin"* ]]; then
24 | exec ./.build/electron/Electron.app/Contents/MacOS/Electron . "$@"
25 | else
26 | exec ./.build/electron/electron . "$@"
27 | fi
28 | }
29 |
30 | code "$@"
31 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/theme/meson.build:
--------------------------------------------------------------------------------
1 | theme_files = [
2 | 'theme.cpp',
3 | 'stringop.cpp',
4 | 'util.cpp'
5 | ]
6 |
7 | theme_lib
8 | = static_library('theme', theme_files, include_directories
9 | : [ theme_inc, scopes_inc, parser_inc ], dependencies
10 | : [ jsoncpp_dep, onigmo_dep, scopes_dep, parser_dep ])
11 |
12 | theme
13 | = executable('theme', theme_files, 'main.cpp', include_directories
14 | : [ theme_inc, scopes_inc, parser_inc ], dependencies
15 | : [ jsoncpp_dep, onigmo_dep, scopes_dep, parser_dep ])
16 |
17 | theme_dep
18 | = declare_dependency(include_directories
19 | : [ theme_inc, scopes_inc ], link_with
20 | : theme_lib)
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | Lucy
13 | 1952-03-03
14 | bossy, crabby and selfish
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/libs/Onigmo/sample/Makefile.am:
--------------------------------------------------------------------------------
1 | noinst_PROGRAMS = encode listcap names posix simple sql syntax scan crnl
2 |
3 | libname = $(top_builddir)/libonigmo.la
4 | LDADD = $(libname)
5 | AM_CPPFLAGS = -I$(top_srcdir) -I$(includedir)
6 |
7 | encode_SOURCES = encode.c
8 | listcap_SOURCES = listcap.c
9 | names_SOURCES = names.c
10 | posix_SOURCES = posix.c
11 | simple_SOURCES = simple.c
12 | sql_SOURCES = sql.c
13 | syntax_SOURCES = syntax.c
14 | scan_SOURCES = scan.c
15 | crnl_SOURCES = crnl.c
16 |
17 |
18 | sampledir = $(top_builddir)/sample
19 |
20 | test: encode$(EXEEXT) listcap$(EXEEXT) names$(EXEEXT) posix$(EXEEXT) simple$(EXEEXT) sql$(EXEEXT) syntax$(EXEEXT) scan$(EXEEXT) crnl$(EXEEXT)
21 | $(sampledir)/encode
22 | $(sampledir)/listcap
23 | $(sampledir)/names
24 | $(sampledir)/posix
25 | $(sampledir)/simple
26 | $(sampledir)/sql
27 | $(sampledir)/syntax
28 | $(sampledir)/scan
29 | $(sampledir)/crnl
30 |
--------------------------------------------------------------------------------
/libs/Onigmo/tool/convert-jis-props.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Convert props.kwd to props.h using GNU gperf.
4 | #
5 | # Usage:
6 | # ./tool/convert-jis-props.sh enc/jis/props.kwd enc/jis/props.h
7 |
8 | GPERF_VERSION=`gperf -v | head -n1 | sed -e 's/^GNU gperf \([0-9]\+\)\.\([0-9]\+.*\)$/\1 \2/' | xargs printf '%02d%02d'`
9 | if [ $GPERF_VERSION -ge '0301' ]; then
10 | # static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
11 | GPERF_REPLACE='s/\(onig_jis_property([^,]\+, \).\+\( len)\)/\1size_t\2/'
12 | else
13 | GPERF_REPLACE='#'
14 | fi
15 |
16 | JIS_PROPS_OPTIONS='-k1,3 -7 -c -j1 -i1 -t -C -P -t --ignore-case -H onig_jis_property_hash -Q onig_jis_property_pool -N onig_jis_property'
17 |
18 | gperf $JIS_PROPS_OPTIONS $1 | sed "$GPERF_REPLACE" | \
19 | sed 's/(int)(\(long\|size_t\))&((\([a-zA-Z_0-9 ]*[a-zA-Z_0-9]\) *\*)0)->\([a-zA-Z0-9_]*\),/(char)offsetof(\2, \3),/g' > $2
20 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/apply-end-pattern-last.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "applyEndPatternLast",
3 | "scopeName": "source.apply-end-pattern-last",
4 | "patterns": [
5 | {
6 | "name": "end-pattern-last-env",
7 | "begin": "last",
8 | "end": "^$",
9 | "patterns": [
10 | {
11 | "name": "scope",
12 | "begin": "\\{",
13 | "end": "\\}",
14 | "applyEndPatternLast": true,
15 | "patterns": [
16 | {
17 | "match": "\\}excentricSyntax",
18 | "name": "excentric"
19 | }
20 | ]
21 | }
22 | ]
23 | },
24 | {
25 | "name": "normal-env",
26 | "begin": "first",
27 | "end": "^$",
28 | "patterns": [
29 | {
30 | "name": "scope",
31 | "begin": "\\{",
32 | "end": "\\}",
33 | "patterns": [
34 | {
35 | "match": "\\}excentricSyntax",
36 | "name": "excentric"
37 | }
38 | ]
39 | }
40 | ]
41 | }
42 | ]
43 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/text.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes": [
3 | "txt"
4 | ],
5 | "keyEquivalent": "^~P",
6 | "name": "Plain Text",
7 | "patterns": [
8 | {
9 | "captures": {
10 | "1": {
11 | "name": "punctuation.definition.item.text"
12 | }
13 | },
14 | "match": "^\\s*(•).*$\\n?",
15 | "name": "meta.bullet-point.strong.text"
16 | },
17 | {
18 | "captures": {
19 | "1": {
20 | "name": "punctuation.definition.item.text"
21 | }
22 | },
23 | "match": "^\\s*(·).*$\\n?",
24 | "name": "meta.bullet-point.light.text"
25 | },
26 | {
27 | "captures": {
28 | "1": {
29 | "name": "punctuation.definition.item.text"
30 | }
31 | },
32 | "match": "^\\s*(\\*).*$\\n?",
33 | "name": "meta.bullet-point.star.text"
34 | },
35 | {
36 | "begin": "^([ \\t]*)(?=\\S)",
37 | "contentName": "meta.paragraph.text",
38 | "end": "^(?!\\1(?=\\S))"
39 | }
40 | ],
41 | "scopeName": "text.plain"
42 | }
--------------------------------------------------------------------------------
/libs/Onigmo/tool/download-ucd.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | files='Blocks.txt CaseFolding.txt DerivedAge.txt DerivedCoreProperties.txt PropertyAliases.txt PropertyValueAliases.txt PropList.txt Scripts.txt SpecialCasing.txt UnicodeData.txt auxiliary/GraphemeBreakProperty.txt'
4 | emoji_files='emoji-data.txt'
5 |
6 | if [ -z $1 ] || [ -z $2 ]; then
7 | echo "usage: $0 UNICODE_VERSION EMOJI_VERSION"
8 | exit 1
9 | fi
10 | UNICODE_VERSION=$1
11 | EMOJI_VERSION=$2
12 |
13 | # remove old files
14 | if [ -d $UNICODE_VERSION ]; then
15 | cd $UNICODE_VERSION
16 | rm -f $files $emoji_files
17 | rm -f GraphemeBreakProperty.txt
18 | cd -
19 | fi
20 |
21 | mkdir -p $UNICODE_VERSION/auxiliary
22 | cd $UNICODE_VERSION
23 |
24 | for i in $files; do
25 | echo http://www.unicode.org/Public/${UNICODE_VERSION}/ucd/$i
26 | done | xargs wget
27 | mv GraphemeBreakProperty.txt auxiliary
28 | for i in $emoji_files; do
29 | echo http://www.unicode.org/Public/emoji/${EMOJI_VERSION}/$i
30 | done | xargs wget
31 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.jsx:
--------------------------------------------------------------------------------
1 | var ToggleText = React.createClass({
2 | getInitialState: function () {
3 | return {
4 | showDefault: true
5 | }
6 | },
7 |
8 | toggle: function (e) {
9 | // Prevent following the link.
10 | e.preventDefault();
11 |
12 | // Invert the chosen default.
13 | // This will trigger an intelligent re-render of the component.
14 | this.setState({ showDefault: !this.state.showDefault })
15 | },
16 |
17 | render: function () {
18 | // Default to the default message.
19 | var message = this.props.default;
20 |
21 | // If toggled, show the alternate message.
22 | if (!this.state.showDefault) {
23 | message = this.props.alt;
24 | }
25 |
26 | return (
27 |
28 |
Hello {message}!
29 |
Toggle
30 |
31 | );
32 | }
33 | });
34 |
35 | React.render( , document.body);
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.c:
--------------------------------------------------------------------------------
1 | /* C Program to find roots of a quadratic equation when coefficients are entered by user. */
2 | /* Library function sqrt() computes the square root. */
3 |
4 | #include /* This is needed to use sqrt() function.*/
5 | #include
6 | int main()
7 | {
8 | float a, b, c, determinant, r1, r2, real, imag;
9 | printf("Enter coefficients a, b and c: ");
10 | scanf("%f%f%f", &a, &b, &c);
11 | determinant = b * b - 4 * a * c;
12 | if (determinant > 0) {
13 | r1 = (-b + sqrt(determinant)) / (2 * a);
14 | r2 = (-b - sqrt(determinant)) / (2 * a);
15 | printf("Roots are: %.2f and %.2f", r1, r2);
16 | } else if (determinant == 0) {
17 | r1 = r2 = -b / (2 * a);
18 | printf("Roots are: %.2f and %.2f", r1, r2);
19 | } else {
20 | real = -b / (2 * a);
21 | imag = sqrt(-determinant) / (2 * a);
22 | printf("Roots are: %.2f+%.2fi and %.2f-%.2fi", real, imag, real, imag);
23 | }
24 | return 0;
25 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.vb:
--------------------------------------------------------------------------------
1 | ' Copyright (c) Microsoft Corporation. All rights reserved.
2 |
3 | Public Sub LongTask(ByVal Duration As Single, _
4 | ByVal MinimumInterval As Single)
5 | Dim Threshold As Single
6 | Dim Start As Single
7 | Dim blnCancel As Boolean
8 |
9 | ' The Timer property of the DateAndTime object returns the seconds
10 | ' and milliseconds that have passed since midnight.
11 | Start = CSng(Timer)
12 | Threshold = MinimumInterval
13 |
14 | Do While CSng(Timer)< (Start + Duration)
15 | ' In a real application, some unit of work would
16 | ' be done here each time through the loop.
17 | If CSng(Timer)> (Start + Threshold) Then
18 | RaiseEvent PercentDone( _
19 | Threshold / Duration, blnCancel)
20 | ' Check to see if the operation was canceled.
21 | If blnCancel Then Exit Sub
22 | Threshold = Threshold + MinimumInterval
23 | End If
24 | Loop
25 | End Sub
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | Example page
4 |
5 |
6 |
7 |
8 | ");
36 |
37 | // display shuffled cards (EXAMPLE ONLY)
38 | for ($index = 0; $index < 52; $index++) {
39 | if ($starting_point == 52) { $starting_point = 0; }
40 | print("Uncut Point: $deck[$index] ");
41 | $starting_point++;
42 | }
43 | ?>
44 |
45 |
46 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.less:
--------------------------------------------------------------------------------
1 | @import "mystyle.css";
2 | @import url("mystyle.css");
3 | @import url("bluish.css") projection, tv;
4 |
5 | @base: #f938ab;
6 |
7 | .box-shadow(@style, @c) when (iscolor(@c)) {
8 | border-radius: @style @c;
9 | }
10 |
11 | .box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {
12 | .box-shadow(@style, rgba(0, 0, 0, @alpha));
13 | }
14 |
15 | .box {
16 | color: saturate(@base, 5%);
17 | border-color: lighten(@base, 30%);
18 |
19 | div {
20 | .box-shadow((0 0 5px), 30%);
21 | }
22 | }
23 |
24 | #header {
25 | h1 {
26 | font-size: 26px;
27 | font-weight: bold;
28 | }
29 |
30 | p { font-size: 12px;
31 | a { text-decoration: none;
32 | &:hover { border-width: 1px }
33 | }
34 | }
35 | }
36 |
37 | @the-border: 1px;
38 | @base-color: #111;
39 | @red: #842210;
40 |
41 | #header {
42 | color: (@base-color * 3);
43 | border-left: @the-border;
44 | border-right: (@the-border * 2);
45 | }
46 |
47 | #footer {
48 | color: (@base-color + #003300);
49 | border-color: desaturate(@red, 10%);
50 | }
51 |
--------------------------------------------------------------------------------
/libs/tm-parser/tests/results/read/text.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes" :
3 | [
4 | "txt"
5 | ],
6 | "keyEquivalent" : "^~P",
7 | "name" : "Plain Text",
8 | "patterns" :
9 | [
10 | {
11 | "captures" :
12 | {
13 | "1" :
14 | {
15 | "name" : "punctuation.definition.item.text"
16 | }
17 | },
18 | "match" : "^\\s*(\u2022).*$\\n?",
19 | "name" : "meta.bullet-point.strong.text"
20 | },
21 | {
22 | "captures" :
23 | {
24 | "1" :
25 | {
26 | "name" : "punctuation.definition.item.text"
27 | }
28 | },
29 | "match" : "^\\s*(\u00b7).*$\\n?",
30 | "name" : "meta.bullet-point.light.text"
31 | },
32 | {
33 | "captures" :
34 | {
35 | "1" :
36 | {
37 | "name" : "punctuation.definition.item.text"
38 | }
39 | },
40 | "match" : "^\\s*(\\*).*$\\n?",
41 | "name" : "meta.bullet-point.star.text"
42 | },
43 | {
44 | "begin" : "^([ \\t]*)(?=\\S)",
45 | "contentName" : "meta.paragraph.text",
46 | "end" : "^(?!\\1(?=\\S))"
47 | }
48 | ],
49 | "scopeName" : "text.plain"
50 | }
51 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.pl:
--------------------------------------------------------------------------------
1 | use strict;
2 |
3 | my $badfound = 0;
4 | sub check_line {
5 | my($fn, $line) = @_;
6 |
7 | # Check for that =.
8 | if($line =~ /^\s*if\s*\(.*[^!<>=]=([^=].*\)|\))/) {
9 | if(!$badfound) {
10 | print("The following suspicious lines were found:\n");
11 | $badfound = 1;
12 | }
13 | print "$fn:$.: $line\n";
14 | }
15 | }
16 |
17 | #
18 | # This function opens and reads one file, and calls
19 | # check_line to analyze each line. Call it with the
20 | # file name.
21 | #
22 | sub check_file {
23 | my($fn) = @_;
24 |
25 | if(!open(IN, $fn)) {
26 | print "Cannot read $fn.\n";
27 | return;
28 | }
29 |
30 | my($line);
31 | while($line = )
32 | {
33 | chomp $line;
34 | check_line($fn,$line);
35 | }
36 |
37 | close IN;
38 | }
39 |
40 | #
41 | # Go through the argument list and check each file
42 | #
43 | while(my $fn = shift @ARGV) {
44 | check_file($fn);
45 | }
46 | if(!$badfound) { print "No suspicious lines were found.\n"; }
--------------------------------------------------------------------------------
/libs/tm-parser/tests/results/parsed/text.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes" :
3 | [
4 | "txt"
5 | ],
6 | "foldingStartMarker" : "",
7 | "foldingStopMarker" : "",
8 | "name" : "Plain Text",
9 | "patterns" :
10 | [
11 | {
12 | "captures" :
13 | {
14 | "1" :
15 | {
16 | "name" : "punctuation.definition.item.text"
17 | }
18 | },
19 | "match" : "^\\s*(\u2022).*$\\n?",
20 | "name" : "meta.bullet-point.strong.text"
21 | },
22 | {
23 | "captures" :
24 | {
25 | "1" :
26 | {
27 | "name" : "punctuation.definition.item.text"
28 | }
29 | },
30 | "match" : "^\\s*(\u00b7).*$\\n?",
31 | "name" : "meta.bullet-point.light.text"
32 | },
33 | {
34 | "captures" :
35 | {
36 | "1" :
37 | {
38 | "name" : "punctuation.definition.item.text"
39 | }
40 | },
41 | "match" : "^\\s*(\\*).*$\\n?",
42 | "name" : "meta.bullet-point.star.text"
43 | },
44 | {
45 | "begin" : "^([ \\t]*)(?=\\S)",
46 | "contentName" : "meta.paragraph.text",
47 | "end" : "^(?!\\1(?=\\S))"
48 | }
49 | ],
50 | "repository" : null,
51 | "scopeName" : "text.plain"
52 | }
53 |
--------------------------------------------------------------------------------
/libs/Onigmo/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 1.0.{build}
2 |
3 | branches:
4 | except:
5 | - ruby-2.x
6 | - onig-5.9.x-mod
7 | - onig-5.9.x-mod_for_bregonig-v2
8 |
9 | environment:
10 | matrix:
11 | - ARCH: x64
12 | PYOPT: -3
13 | - ARCH: x86
14 | PYOPT: -3.4-32
15 |
16 | install:
17 | - cmd: |-
18 | rem Check environments.
19 | rem path
20 | rem dir C:\
21 | rem dir "C:\Program Files"
22 | rem dir "C:\Program Files\Microsoft SDKs\Windows"
23 | rem dir "C:\Program Files (x86)"
24 | rem dir "C:\Program Files (x86)\Windows Kits"
25 | rem Using Windows SDK 7.1 (VC10)
26 | rem "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /%ARCH% /release
27 | rem Using VC12
28 | "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %ARCH%
29 | path
30 |
31 | build_script:
32 | - cmd: |-
33 | nmake -f win32\Makefile
34 | dir build_%ARCH%\onigmo.dll
35 | \msys64\usr\bin\file build_%ARCH%\onigmo.dll
36 |
37 | test_script:
38 | - cmd: |-
39 | py %PYOPT% -c "import locale; print(locale.getpreferredencoding())"
40 | nmake -f win32\Makefile test
41 |
42 | # vim: ts=2 sw=2 sts=2 et
43 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/suite1/fixtures/testlang12.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | fileTypes
6 |
7 | testlang
8 |
9 | name
10 | testlang
11 | patterns
12 |
13 |
14 | include
15 | #indentedVerbatimOp
16 |
17 |
18 | repository
19 |
20 | indentedVerbatimOp
21 |
22 | begin
23 | ^([ \t]*)(?=(.*?)\|$)
24 | end
25 | ^(?!\1[ \t])(?=[ \t]*\S)
26 | name
27 | string.unquoted.verbatim.youki
28 |
29 |
30 | scopeName
31 | text.testlang
32 | uuid
33 | 159375af-d9b4-448c-a9da-d235eadf3556
34 |
35 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/theme/stringop.h:
--------------------------------------------------------------------------------
1 | #ifndef _SWAY_STRINGOP_H
2 | #define _SWAY_STRINGOP_H
3 |
4 | #include
5 | #include
6 | // #include "list.h"
7 |
8 | void strip_whitespace(char* str);
9 | void strip_quotes(char* str);
10 |
11 | // strcat that does nothing if dest or src is NULL
12 | char* lenient_strcat(char* dest, const char* src);
13 | char* lenient_strncat(char* dest, const char* src, size_t len);
14 |
15 | // strcmp that also handles null pointers.
16 | int lenient_strcmp(char* a, char* b);
17 |
18 | // Simply split a string with delims, free with `list_free_items_and_destroy`
19 | // list_t *split_string(const char *str, const char *delims);
20 |
21 | // Splits an argument string, keeping quotes intact
22 | char** split_args(const char* str, int* argc);
23 | void free_argv(int argc, char** argv);
24 |
25 | int unescape_string(char* string);
26 | char* join_args(char** argv, int argc);
27 |
28 | // Split string into 2 by delim, handle quotes
29 | char* argsep(char** stringp, const char* delim, char* matched_delim);
30 |
31 | // Expand a path using shell replacements such as $HOME and ~
32 | bool expand_path(char** path);
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test2.pl:
--------------------------------------------------------------------------------
1 | die("[$sheet->{label}] Unexpected sheet format.") unless (
2 | $sheet->{"$date_col$row"} =~ /CALL_DATE/i &&
3 | $sheet->{"$pixel_cols[4]$row"} =~ /Home_Bind_Count/i
4 | );
5 |
6 | $row++;
7 | while ($row < $sheet->{maxrow}) {
8 | $row++;
9 | $total_lines++;
10 |
11 | my $date = $sheet->{"$date_col$row"};
12 | next unless $date;
13 | (warning "Unexpected date format: '$date'"), next unless ($date =~ /^2\d\d\d-\d\d-\d\d$/);
14 |
15 | my $phone = trim($sheet->{"$phone_col$row"});
16 | (warning "Unexpected phone format: '$phone'."), next unless ($phone =~ /^\d{10}$/);
17 |
18 | info $phone;
19 | next if ($date gt $date_to || $date lt $date_from);
20 |
21 | my @pixels = (0) x 5;
22 | for (1..4) {
23 | $pixels[$_] = trim($sheet->{"$pixel_cols[4]$row"});
24 | (warning "Pixel $_ is not a number in the row # $row."), next unless looks_like_number($pixels[$_]);
25 | };
26 |
27 | for (1..4) {
28 | add_phone_activity($date, $phone, "pixel-$_", $pixels[$_]) if $pixels[$_];
29 | };
30 | $parsed_lines++;
31 | };
--------------------------------------------------------------------------------
/libs/Onigmo/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore dot-files, binary files and backup files
2 | .*
3 | *.o
4 | *.lo
5 | *.so
6 | *.a
7 | *.la
8 | *.obj
9 | *.def
10 | *.dll
11 | *.exe
12 | *.exp
13 | *.lib
14 | *.pdb
15 | *.pyc
16 | *.bak
17 | *.BAK
18 | *~
19 | *.swp
20 | *.orig
21 | *.rej
22 | *.RES
23 | *.res
24 |
25 | # gcov files
26 | *.gcda
27 | *.gcno
28 | *.gcov
29 |
30 | # don't want to ignore
31 | !.gitignore
32 | !.editorconfig
33 | !.travis.yml
34 |
35 | # working dirs
36 | .deps
37 | .libs
38 | /build*/
39 |
40 | # autotools generated files
41 | /aclocal.m4
42 | /autom4te.cache
43 | /compile
44 | /config.guess
45 | /config.h
46 | /config.h.in
47 | /config.log
48 | /config.status
49 | /config.sub
50 | /configure
51 | /depcomp
52 | /install-sh
53 | /libtool
54 | /ltmain.sh
55 | /m4/*.m4
56 | /missing
57 | /onigmo-config
58 | /onigmo.pc
59 | /Makefile
60 | /Makefile.in
61 | /sample/Makefile
62 | /sample/Makefile.in
63 | /stamp-h1
64 | /test-driver
65 |
66 | # generated executable files
67 | /enc/mktable
68 | /sample/crnl
69 | /sample/encode
70 | /sample/listcap
71 | /sample/names
72 | /sample/posix
73 | /sample/scan
74 | /sample/simple
75 | /sample/sql
76 | /sample/syntax
77 | /testc
78 | /testcu
79 | /testp
80 |
81 | # tag files
82 | tags
83 | TAGS
84 |
85 | # GNU global files
86 | GPATH
87 | GRTAGS
88 | GSYMS
89 | GTAGS
90 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/meson.build:
--------------------------------------------------------------------------------
1 | parser_inc = include_directories(['parser'])
2 | scopes_inc
3 | = include_directories(['scopes'])
4 | theme_inc
5 | = include_directories(['theme'])
6 | extension_inc
7 | = include_directories(['extensions'])
8 |
9 | subdir('scopes')
10 | subdir('parser')
11 | subdir('theme')
12 | subdir('extensions')
13 |
14 | textmate_files
15 | = [
16 | 'textmate.cpp',
17 | 'parser/grammar.cpp',
18 | 'parser/reader.cpp',
19 | 'parser/pattern.cpp',
20 | 'parser/parser.cpp',
21 | 'scopes/scope.cpp',
22 | 'scopes/types.cpp',
23 | 'scopes/parse.cpp',
24 | 'scopes/match.cpp',
25 | 'theme/theme.cpp',
26 | 'theme/util.cpp'
27 | ]
28 |
29 | textmate_lib
30 | = static_library('textmate', textmate_files, include_directories
31 | : [ textmate_inc, parser_inc, scopes_inc, theme_inc, extension_inc ], dependencies
32 | : [ jsoncpp_dep, onigmo_dep ])
33 |
34 | textmate_dep
35 | = declare_dependency(include_directories
36 | : [textmate_inc], link_with
37 | : textmate_lib)
38 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.js:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | var gulp = require('gulp');
7 | var tsb = require('gulp-tsb');
8 | var util = require('./lib/util');
9 | var watcher = require('./lib/watch');
10 | var assign = require('object-assign');
11 |
12 | var compilation = tsb.create(assign({ verbose: true }, require('./tsconfig.json').compilerOptions));
13 |
14 | gulp.task('compile', function() {
15 | return gulp.src('**/*.ts', { base: '.' })
16 | .pipe(compilation())
17 | .pipe(gulp.dest(''));
18 | });
19 |
20 | gulp.task('watch', function() {
21 | var src = gulp.src('**/*.ts', { base: '.' });
22 |
23 | return watcher('**/*.ts', { base: '.' })
24 | .pipe(util.incremental(compilation, src))
25 | .pipe(gulp.dest(''));
26 | });
27 |
28 | gulp.task('default', ['compile']);
29 |
30 | function cloneArray(arr) {
31 | _.foo();
32 | var r = [];
33 | for (var i = 0, len = arr.length; i < len; i++) {
34 | r[i] = doClone(arr[i]);
35 | }
36 | return r;
37 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | var total = 0;
3 | var totalMessage = "";
4 | @* a multiline
5 | razor comment embedded in csharp *@
6 | if (IsPost) {
7 |
8 | // Retrieve the numbers that the user entered.
9 | var num1 = Request["text1"];
10 | var num2 = Request["text2"];
11 |
12 | // Convert the entered strings into integers numbers and add.
13 | total = num1.AsInt() + num2.AsInt();
14 | totalMessage = "Total = " + total;
15 | }
16 | }
17 |
18 |
19 |
20 |
21 | Add Numbers
22 |
23 |
24 |
25 | Enter two whole numbers and then click Add .
26 |
35 |
36 | @* now we call the totalMessage method
37 | (a multi line razor comment outside code) *@
38 |
39 | @totalMessage
40 |
41 | @(totalMessage+"!")
42 |
43 | An email address (with escaped at character): name@@domain.com
44 |
45 |
46 |
--------------------------------------------------------------------------------
/libs/Onigmo/enc/us_ascii.c:
--------------------------------------------------------------------------------
1 | #include "regenc.h"
2 | #ifdef RUBY
3 | # include "encindex.h"
4 | #endif
5 |
6 | #ifndef ENCINDEX_US_ASCII
7 | # define ENCINDEX_US_ASCII 0
8 | #endif
9 |
10 | static int
11 | us_ascii_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc)
12 | {
13 | if (*p & 0x80)
14 | return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
15 | return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(1);
16 | }
17 |
18 | OnigEncodingDefine(us_ascii, US_ASCII) = {
19 | us_ascii_mbc_enc_len,
20 | "US-ASCII",/* name */
21 | 1, /* max byte length */
22 | 1, /* min byte length */
23 | onigenc_is_mbc_newline_0x0a,
24 | onigenc_single_byte_mbc_to_code,
25 | onigenc_single_byte_code_to_mbclen,
26 | onigenc_single_byte_code_to_mbc,
27 | onigenc_ascii_mbc_case_fold,
28 | onigenc_ascii_apply_all_case_fold,
29 | onigenc_ascii_get_case_fold_codes_by_str,
30 | onigenc_minimum_property_name_to_ctype,
31 | onigenc_ascii_is_code_ctype,
32 | onigenc_not_support_get_ctype_code_range,
33 | onigenc_single_byte_left_adjust_char_head,
34 | onigenc_always_true_is_allowed_reverse_match,
35 | #ifdef USE_CASE_MAP_API
36 | onigenc_single_byte_ascii_only_case_map,
37 | #else
38 | NULL,
39 | #endif
40 | ENCINDEX_US_ASCII,
41 | ONIGENC_FLAG_NONE,
42 | };
43 | ENC_ALIAS("ASCII", "US-ASCII")
44 | ENC_ALIAS("ANSI_X3.4-1968", "US-ASCII")
45 | ENC_ALIAS("646", "US-ASCII")
46 |
--------------------------------------------------------------------------------
/libs/Onigmo/enc/jis/props.kwd:
--------------------------------------------------------------------------------
1 | %{/* -*- c -*- */
2 | #define GPERF_DOWNCASE 1
3 | #define GPERF_CASE_STRNCMP 1
4 |
5 | static inline int
6 | gperf_case_strncmp(const char *s1, const char *s2, unsigned int n)
7 | {
8 | const UChar *str = (const UChar *)s1;
9 | const UChar *s = (const UChar *)s2;
10 | return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, n);
11 | }
12 |
13 | enum onigenc_jis_ctype {
14 | onigenc_jis_min = ONIGENC_MAX_STD_CTYPE,
15 | onigenc_jis_hiragana,
16 | onigenc_jis_katakana,
17 | onigenc_jis_han,
18 | onigenc_jis_latin,
19 | onigenc_jis_greek,
20 | onigenc_jis_cyrillic,
21 | onigenc_jis_max
22 | };
23 |
24 | enum {PropertyListNum = onigenc_jis_max - onigenc_jis_min - 1};
25 |
26 | static const OnigCodePoint* const PropertyList[PropertyListNum] = {
27 | CR_Hiragana,
28 | CR_Katakana,
29 | CR_Han,
30 | CR_Latin,
31 | CR_Greek,
32 | CR_Cyrillic,
33 | };
34 |
35 | struct enc_property {
36 | signed char name;
37 | unsigned char ctype;
38 | };
39 |
40 | static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
41 | %}
42 |
43 | struct enc_property;
44 |
45 | %%
46 | hiragana, onigenc_jis_hiragana
47 | katakana, onigenc_jis_katakana
48 | han, onigenc_jis_han
49 | latin, onigenc_jis_latin
50 | greek, onigenc_jis_greek
51 | cyrillic, onigenc_jis_cyrillic
52 | %%
53 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | VSCode Tests
5 |
6 |
7 |
13 |
14 |
15 |
16 |
17 |
19 |
20 |
21 |
22 |
36 |
37 |
38 |
You signed in with another tab or window. Reload to refresh your session.
39 |
You signed out in another tab or window. Reload to refresh your session.
40 |
41 |
42 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.clj:
--------------------------------------------------------------------------------
1 | ;; from http://clojure-doc.org/articles/tutorials/introduction.html
2 |
3 | (require '[clojure.string :as str])
4 | (def the-answer 42)
5 | [1 2 3] ; A vector
6 | [1 :two "three"]
7 | {:a 1 :b 2}
8 | #{:a :b :c}
9 | '(1 2 3)
10 | (def my-stuff ["shirt" "coat" "hat"]) ; this is more typical usage.
11 |
12 | (my-func (my-func2 arg1
13 | arg2)
14 | (other-func arg-a
15 | (foo-bar arg-x
16 | arg-y
17 | (+ arg-xx
18 | arg-yy
19 | arg-zz))
20 | arg-b))
21 | '(+ 1 2 3)
22 | ;; ⇒ (+ 1 2 3)
23 | (let [width 10
24 | height 20
25 | thickness 2]
26 | (println "hello from inside the `let`.")
27 | (* width
28 | height
29 | thickness))
30 |
31 | ;; Vectors
32 | (def v [:a :b :c])
33 | (def li '(:a :b :c))
34 | (conj v :d) ; ⇒ [:a :b :c :d]
35 | (conj li :d) ; ⇒ (:d :a :b :c)
36 |
37 | v ; ⇒ is still [:a :b :c]
38 | li ; ⇒ is still (:a :b :c)
39 |
40 | ;; Maps
41 | (def m {:a 1 :b 2})
42 | (assoc m :c 3) ; ⇒ {:a 1 :c 3 :b 2}
43 | (dissoc m :b) ; ⇒ {:a 1}
44 |
45 | (def my-atom (atom {:foo 1}))
46 | ;; ⇒ #'user/my-atom
47 | @my-atom
48 | ;; ⇒ {:foo 1}
49 | (swap! my-atom update-in [:foo] inc)
50 | ;; ⇒ {:foo 2}
51 | @my-atom
52 | ;; ⇒ {:foo 2}
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/html-rails.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes": [
3 | "rhtml",
4 | "erb",
5 | "html.erb"
6 | ],
7 | "foldingStartMarker": "(?x)\n\t\t(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)\\b.*?>\n\t\t|)\n\t\t|\\{\\s*($|\\?>\\s*$|//|/\\*(.*\\*/\\s*$|(?!.*?\\*/)))\n\t\t)",
8 | "foldingStopMarker": "(?x)\n\t\t((?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)>\n\t\t|^\\s*-->\n\t\t|(^|\\s)\\}\n\t\t)",
9 | "keyEquivalent": "^~R",
10 | "name": "HTML (Rails)",
11 | "patterns": [
12 | {
13 | "begin": "<%+#",
14 | "captures": {
15 | "0": {
16 | "name": "punctuation.definition.comment.erb"
17 | }
18 | },
19 | "end": "%>",
20 | "name": "comment.block.erb"
21 | },
22 | {
23 | "begin": "<%+(?!>)[-=]?",
24 | "captures": {
25 | "0": {
26 | "name": "punctuation.section.embedded.ruby"
27 | }
28 | },
29 | "end": "-?%>",
30 | "name": "source.ruby.rails.embedded.html",
31 | "patterns": [
32 | {
33 | "captures": {
34 | "1": {
35 | "name": "punctuation.definition.comment.ruby"
36 | }
37 | },
38 | "match": "(#).*?(?=-?%>)",
39 | "name": "comment.line.number-sign.ruby"
40 | },
41 | {
42 | "include": "source.ruby.rails"
43 | }
44 | ]
45 | },
46 | {
47 | "include": "text.html.basic"
48 | }
49 | ],
50 | "scopeName": "text.html.ruby"
51 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
vim-textmate
4 |
5 |
6 | A textmate-based syntax highlighter to vim, compatible with VScode themes and grammars
7 |
8 |
9 |
10 |
11 |
12 | [](https://www.buymeacoffee.com/icedman)
13 |
14 | # Install
15 |
16 | ```sh
17 | git clone http://github.com/icedman/vim-textmate
18 | cd vim-textmate
19 | make
20 | ```
21 | *.vimrc*
22 |
23 | ```sh
24 | luafile ~/.vim/lua/vim-textmate/vim-textmate.lua
25 | ```
26 |
27 | To preset a theme
28 | ```sh
29 | lua txmt_set_theme("Dracula")
30 | ```
31 | # via Plugged
32 |
33 | Add to your .vimrc:
34 |
35 | ```sh
36 | Plug 'icedman/vim-textmate'
37 | ```
38 |
39 | And also:
40 |
41 | ```sh
42 | luafile ~/.vim/plugged/vim-textmate/vim-textmate.lua
43 | ```
44 |
45 | # Themes and Grammars
46 |
47 | Theme and grammar packages will be searched in the following locations:
48 |
49 | ```sh
50 | ~/.vim/lua/vim-textmate/extensions/
51 | ~/.vscode/extensions/
52 | ~/.editor/extensions/
53 | ```
54 |
55 | # Commands
56 |
57 | * TxmtInfo
58 | * TxmtInfoLanguages
59 | * TxmtInfoThemes
60 | * TxmtSetTheme
61 | * TxmtEnable
62 | * TxmtDisable
63 | * TxmtDebugScopes
64 |
65 | ## Warning
66 |
67 | * This plugin is just a proof of concept - from a novice lua coder, and much worse - from a novice vim user
68 | * This also requires Lua and some C compilation
69 |
--------------------------------------------------------------------------------
/libs/Onigmo/win32/makedef.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | from __future__ import print_function
4 | import re
5 |
6 | header_files = (
7 | "onigmo.h", "regenc.h",
8 | "onigmognu.h", "onigmoposix.h"
9 | )
10 |
11 | exclude_symbols = [
12 | "OnigEncodingKOI8",
13 |
14 | # USE_UPPER_CASE_TABLE
15 | "OnigEncAsciiToUpperCaseTable",
16 | "OnigEncISO_8859_1_ToUpperCaseTable",
17 | ]
18 |
19 | features = {
20 | "USE_VARIABLE_META_CHARS": ("onig_set_meta_char",),
21 | "USE_CAPTURE_HISTORY": ("onig_get_capture_tree",)
22 | }
23 |
24 | for v in features.values():
25 | exclude_symbols += list(v)
26 |
27 | # Check if the features are enabled
28 | with open("regint.h", "r") as f:
29 | e = set()
30 | for line in f:
31 | for k, v in features.items():
32 | if re.match(r"^#define\s+" + k + r"\b", line):
33 | e |= set(v)
34 | exclude_symbols = list(set(exclude_symbols) - e)
35 |
36 | symbols = set()
37 |
38 | rx1 = re.compile("(ONIG_EXTERN.*)$")
39 | rx2 = re.compile(r"(\w+)( +PV?_\(\(.*\)\)|\[.*\])?;\s*(/\*.*\*/)?$")
40 | for filename in header_files:
41 | with open(filename, "r") as f:
42 | for line in f:
43 | m = rx1.match(line)
44 | if not m:
45 | continue
46 | s = m.group(1)
47 | if s[-1] != ';':
48 | s += ' ' + next(f)
49 | m2 = rx2.search(s)
50 | if m2 and (not m2.group(1) in exclude_symbols):
51 | symbols.add(m2.group(1))
52 |
53 | print('EXPORTS')
54 | for s in sorted(symbols):
55 | print('\t' + s)
56 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | //
4 |
5 | #import "UseQuotes.h"
6 | #import
7 |
8 | /*
9 | Multi
10 | Line
11 | Comments
12 | */
13 | @implementation Test
14 |
15 | - (void) applicationWillFinishLaunching:(NSNotification *)notification
16 | {
17 | }
18 |
19 | - (IBAction)onSelectInput:(id)sender
20 | {
21 | NSString* defaultDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0];
22 |
23 | NSOpenPanel* panel = [NSOpenPanel openPanel];
24 | [panel setAllowedFileTypes:[[NSArray alloc] initWithObjects:@"ipa", @"xcarchive", @"app", nil]];
25 |
26 | [panel beginWithCompletionHandler:^(NSInteger result)
27 | {
28 | if (result == NSFileHandlingPanelOKButton)
29 | [self.inputTextField setStringValue:[panel.URL path]];
30 | }];
31 | return YES;
32 |
33 | int hex = 0xFEF1F0F;
34 | float ing = 3.14;
35 | ing = 3.14e0;
36 | ing = 31.4e-2;
37 | }
38 |
39 | -(id) initWithParams:(id) aHandler withDeviceStateManager:(id) deviceStateManager
40 | {
41 | // add a tap gesture recognizer
42 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
43 | NSMutableArray *gestureRecognizers = [NSMutableArray array];
44 | [gestureRecognizers addObject:tapGesture];
45 | [gestureRecognizers addObjectsFromArray:scnView.gestureRecognizers];
46 | scnView.gestureRecognizers = gestureRecognizers;
47 |
48 | return tapGesture;
49 | return nil;
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.ps1:
--------------------------------------------------------------------------------
1 | # Copyright Microsoft Corporation
2 |
3 | function Test-IsAdmin() {
4 | try {
5 | $identity = [Security.Principal.WindowsIdentity]::GetCurrent()
6 | $principal = New-Object Security.Principal.WindowsPrincipal -ArgumentList $identity
7 | return $principal.IsInRole( [Security.Principal.WindowsBuiltInRole]::Administrator )
8 | } catch {
9 | throw "Failed to determine if the current user has elevated privileges. The error was: '{0}'." -f $_
10 | }
11 | }
12 |
13 | function Invoke-Environment()
14 | {
15 | param
16 | (
17 | [Parameter(Mandatory=1)][string]$Command
18 | )
19 |
20 | foreach($_ in cmd /c "$Command 2>&1 & set") {
21 | if ($_ -match '^([^=]+)=(.*)') {
22 | [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
23 | }
24 | }
25 | }
26 | Write-Host -Object 'Initializing Azure PowerShell environment...';
27 |
28 | # PowerShell commands need elevation for dependencies installation and running tests
29 | if (!(Test-IsAdmin)){
30 | Write-Host -Object 'Please launch command under administrator account. It is needed for environment setting up and unit test.' -ForegroundColor Red;
31 | }
32 |
33 | $env:AzurePSRoot = Split-Path -Parent -Path $env:AzurePSRoot;
34 |
35 | if (Test-Path -Path "$env:ADXSDKProgramFiles\Microsoft Visual Studio 12.0") {
36 | $vsVersion="12.0"
37 | } else {
38 | $vsVersion="11.0"
39 | }
40 |
41 | $setVSEnv = '"{0}\Microsoft Visual Studio {1}\VC\vcvarsall.bat" x64' -f $env:ADXSDKProgramFiles, $vsVersion;
42 |
43 | Invoke-Environment -Command $setVSEnv;
--------------------------------------------------------------------------------
/libs/Onigmo/sample/simple.c:
--------------------------------------------------------------------------------
1 | /*
2 | * simple.c
3 | */
4 | #include
5 | #include
6 | #include "onigmo.h"
7 |
8 | extern int main(int argc, char* argv[])
9 | {
10 | int r;
11 | unsigned char *start, *range, *end;
12 | regex_t* reg;
13 | OnigErrorInfo einfo;
14 | OnigRegion *region;
15 |
16 | static UChar* pattern = (UChar* )"a(.*)b|[e-f]+";
17 | static UChar* str = (UChar* )"zzzzaffffffffb";
18 |
19 | r = onig_new(®, pattern, pattern + strlen((char* )pattern),
20 | ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, ONIG_SYNTAX_DEFAULT, &einfo);
21 | if (r != ONIG_NORMAL) {
22 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
23 | onig_error_code_to_str(s, r, &einfo);
24 | fprintf(stderr, "ERROR: %s\n", s);
25 | return -1;
26 | }
27 |
28 | region = onig_region_new();
29 |
30 | end = str + strlen((char* )str);
31 | start = str;
32 | range = end;
33 | r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE);
34 | if (r >= 0) {
35 | int i;
36 |
37 | fprintf(stderr, "match at %d\n", r);
38 | for (i = 0; i < region->num_regs; i++) {
39 | fprintf(stderr, "%d: (%ld-%ld)\n", i, region->beg[i], region->end[i]);
40 | }
41 | r = 0;
42 | }
43 | else if (r == ONIG_MISMATCH) {
44 | fprintf(stderr, "search fail\n");
45 | r = -1;
46 | }
47 | else { /* error */
48 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
49 | onig_error_code_to_str(s, r);
50 | fprintf(stderr, "ERROR: %s\n", s);
51 | return -1;
52 | }
53 |
54 | onig_region_free(region, 1 /* 1:free self, 0:free contents only */);
55 | onig_free(reg);
56 | onig_end();
57 | return r;
58 | }
59 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/theme/main.cpp:
--------------------------------------------------------------------------------
1 | #include "json/json.h"
2 | #include "reader.h"
3 | #include "scope.h"
4 | #include "theme.h"
5 |
6 | #include
7 |
8 | void dump_color(color_info_t clr)
9 | {
10 | std::cout << " r:" << (int)(clr.red * 255)
11 | << " g:" << (int)(clr.green * 255)
12 | << " b:" << (int)(clr.blue * 255);
13 | }
14 |
15 | int main(int argc, char** argv)
16 | {
17 | // std::cout << "theme!" << std::endl;
18 |
19 | // Json::Value root = parse::loadJson("test-cases/themes/light_vs.json");
20 | Json::Value root = parse::loadJson("editor/dracula.json");
21 | // std::cout << root << std::endl;
22 |
23 | theme_ptr theme = parse_theme(root);
24 |
25 | // scope::scope_t scope1("comment.block.c");
26 | // style_t s1 = theme->styles_for_scope(scope1);
27 | // std::cout << s1.foreground.red << ","
28 | // << s1.foreground.green << ","
29 | // << s1.foreground.blue
30 | // << std::endl;
31 |
32 | // scope::scope_t scope2("punctuation.whitespace.function.leading.c");
33 | // style_t s2 = theme->styles_for_scope(scope2);
34 |
35 | // std::cout << s2.foreground.red << ","
36 | // << s2.foreground.green << ","
37 | // << s2.foreground.blue
38 | // << std::endl;
39 |
40 | scope::scope_t scope3("variable.parameter.probably.c");
41 | // scope::scope_t scope3("variable.parameter");
42 | style_t s3 = theme->styles_for_scope(scope3);
43 |
44 | std::cout << "??" << (s3.italic) << std::endl;
45 | dump_color(s3.foreground);
46 | std::cout << std::endl;
47 |
48 | return 0;
49 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/syntaxes/git-rebase.tmLanguage:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | fileTypes
6 |
7 | git-rebase-todo
8 |
9 | name
10 | Git Rebase Message
11 | patterns
12 |
13 |
14 | captures
15 |
16 | 1
17 |
18 | name
19 | punctuation.definition.comment.git-rebase
20 |
21 |
22 | match
23 | ^\s*(#).*$\n?
24 | name
25 | comment.line.number-sign.git-rebase
26 |
27 |
28 | captures
29 |
30 | 1
31 |
32 | name
33 | support.function.git-rebase
34 |
35 | 2
36 |
37 | name
38 | constant.sha.git-rebase
39 |
40 | 3
41 |
42 | name
43 | meta.commit-message.git-rebase
44 |
45 |
46 | match
47 | ^\s*(pick|p|reword|r|edit|e|squash|s|fixup|f|d|drop|x|exec)\s+([0-9a-f]+)\s+(.*)$
48 | name
49 | meta.commit-command.git-rebase
50 |
51 |
52 | scopeName
53 | text.git-rebase
54 | uuid
55 | 7F1CC209-5F6D-486A-8180-09FA282381A1
56 |
57 |
58 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/scopes/types.cpp:
--------------------------------------------------------------------------------
1 | #include "types.h"
2 |
3 | namespace scope {
4 |
5 | std::string text_format(const char* format, ...)
6 | {
7 | std::string res;
8 | ///
9 | return res;
10 | }
11 |
12 | namespace types {
13 | template
14 | std::string join(T const& container, std::string const& sep)
15 | {
16 | std::string res = "";
17 | for (auto const& it : container)
18 | res += (res.empty() ? "" : sep) + to_s(it);
19 | return res;
20 | }
21 |
22 | std::string to_s(any_ptr const& v) { return v ? v->to_s() : "(null)"; }
23 | std::string to_s(scope_t const& v)
24 | {
25 | return (v.anchor_to_previous ? "> " : "") + v.atoms;
26 | }
27 |
28 | std::string to_s(expression_t const& v)
29 | {
30 | return std::string(v.op != expression_t::op_none ? text_format("%c ", v.op)
31 | : "")
32 | + (v.negate ? "-" : "") + to_s(v.selector);
33 | }
34 |
35 | std::string to_s(composite_t const& v) { return join(v.expressions, " "); }
36 | std::string to_s(selector_t const& v) { return join(v.composites, ", "); }
37 |
38 | std::string path_t::to_s() const
39 | {
40 | return (anchor_to_bol ? "^ " : "") + join(scopes, " ") + (anchor_to_eol ? " $" : "");
41 | }
42 | std::string group_t::to_s() const
43 | {
44 | return "(" + scope::types::to_s(selector) + ")";
45 | }
46 |
47 | std::string filter_t::to_s() const
48 | {
49 | return text_format("%c:", filter) + scope::types::to_s(selector);
50 | }
51 |
52 | } // namespace types
53 |
54 | } // namespace scope
55 |
--------------------------------------------------------------------------------
/libs/Onigmo/tool/Makefile:
--------------------------------------------------------------------------------
1 | UNICODE_VERSION = 12.1.0
2 | EMOJI_VERSION = 12.0
3 |
4 | PROP_FILES = \
5 | $(UNICODE_VERSION)/Blocks.txt \
6 | $(UNICODE_VERSION)/DerivedAge.txt \
7 | $(UNICODE_VERSION)/DerivedCoreProperties.txt \
8 | $(UNICODE_VERSION)/PropertyAliases.txt \
9 | $(UNICODE_VERSION)/PropertyValueAliases.txt \
10 | $(UNICODE_VERSION)/PropList.txt \
11 | $(UNICODE_VERSION)/Scripts.txt \
12 | $(UNICODE_VERSION)/UnicodeData.txt \
13 | $(UNICODE_VERSION)/auxiliary/GraphemeBreakProperty.txt \
14 | $(UNICODE_VERSION)/emoji-data.txt
15 |
16 | CASEFOLD_FILES = \
17 | $(UNICODE_VERSION)/CaseFolding.txt \
18 | $(UNICODE_VERSION)/UnicodeData.txt \
19 | $(UNICODE_VERSION)/SpecialCasing.txt
20 |
21 | update: update-unicode-header update-jis-header update-doc
22 |
23 | update-unicode-header: casefold.h name2ctype.h
24 | cp casefold.h name2ctype.h ../enc/unicode
25 |
26 | update-jis-header: ../enc/jis/props.kwd
27 | cd .. && ./tool/convert-jis-props.sh enc/jis/props.kwd enc/jis/props.h && cd -
28 |
29 | update-doc: $(PROP_FILES) update-doc.py
30 | $(PYTHON) ./update-doc.py $(UNICODE_VERSION) > ../doc/UnicodeProps.txt
31 |
32 | download:
33 | ./download-ucd.sh $(UNICODE_VERSION) $(EMOJI_VERSION)
34 |
35 |
36 | casefold.h: $(CASEFOLD_FILES) case-folding.rb
37 | $(RUBY) ./case-folding.rb -m $(UNICODE_VERSION) -o casefold.h
38 |
39 | name2ctype.h: $(PROP_FILES) enc-unicode.rb
40 | $(RUBY) ./enc-unicode.rb --header $(UNICODE_VERSION) > name2ctype.h || rm -f name2ctype.h
41 |
42 |
43 | clean:
44 | -rm -f casefold.h name2ctype.kwd name2ctype.h
45 | -rm -f $(PROP_FILES) $(CASEFOLD_FILES)
46 | -rm -f GraphemeBreakProperty.txt
47 | -rmdir $(UNICODE_VERSION)/auxiliary
48 | -rmdir $(UNICODE_VERSION)
49 |
--------------------------------------------------------------------------------
/libs/Onigmo/onigmo-config.in:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2006 K.Kosako (sndgk393 AT ybb DOT ne DOT jp)
3 |
4 | ONIGMO_VERSION=@PACKAGE_VERSION@
5 |
6 | show_usage()
7 | {
8 | cat <= :mavericks
37 | version = `#{MAVERICKS_PKG_PATH}/usr/bin/clang --version`
38 | else
39 | version = `/usr/bin/clang --version`
40 | end
41 | version = version[/clang-(\d+\.\d+\.\d+(\.\d+)?)/, 1] || "0"
42 | version < latest_version
43 | end
44 |
45 | end
46 | end
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/extensions/util.h:
--------------------------------------------------------------------------------
1 | #ifndef UTIL_H
2 | #define UTIL_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | std::vector split_path_to_indices(const std::string& str,
9 | const std::set delimiters);
10 | std::vector split_path(const std::string& str,
11 | const std::set delimiters);
12 | std::vector enumerate_dir(const std::string path);
13 |
14 | bool expand_path(char** path);
15 |
16 | void initLog();
17 | void log(const char* format, ...);
18 |
19 | unsigned int murmur_hash(const void* key, int len, unsigned int seed);
20 | unsigned int hash_combine(int lhs, int rhs);
21 |
22 | std::string join(std::vector ss, char c);
23 | std::vector split(const std::string& s, char seperator);
24 | std::string clean_path(std::string fullPath);
25 |
26 | #include
27 | #include
28 |
29 | // #include
30 |
31 | /**
32 | * Wrap i into the range [0, max[
33 | */
34 | int wrap(int i, int max);
35 |
36 | /**
37 | * Given a string that represents an RGB(A) color, result will be set to a
38 | * uint32_t version of the color, as long as it is valid. If it is invalid,
39 | * then false will be returned and result will be untouched.
40 | */
41 | bool parse_color(const char* color, uint32_t* result);
42 |
43 | void color_to_rgba(float dest[4], uint32_t color);
44 |
45 | /**
46 | * Given a string that represents a boolean, return the boolean value. This
47 | * function also takes in the current boolean value to support toggling. If
48 | * toggling is not desired, pass in true for current so that toggling values
49 | * get parsed as not true.
50 | */
51 | bool parse_boolean(const char* boolean, bool current);
52 |
53 | /**
54 | * Given a string that represents a floating point value, return a float.
55 | * Returns NAN on error.
56 | */
57 | float parse_float(const char* value);
58 |
59 | #endif // UTIL_H
--------------------------------------------------------------------------------
/libs/Onigmo/sample/syntax.c:
--------------------------------------------------------------------------------
1 | /*
2 | * syntax.c
3 | */
4 | #include
5 | #include
6 | #include "onigmo.h"
7 |
8 | extern int exec(const OnigSyntaxType* syntax,
9 | char* apattern, char* astr)
10 | {
11 | int r;
12 | unsigned char *start, *range, *end;
13 | regex_t* reg;
14 | OnigErrorInfo einfo;
15 | OnigRegion *region;
16 | UChar* pattern = (UChar* )apattern;
17 | UChar* str = (UChar* )astr;
18 |
19 | r = onig_new(®, pattern, pattern + strlen((char* )pattern),
20 | ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, syntax, &einfo);
21 | if (r != ONIG_NORMAL) {
22 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
23 | onig_error_code_to_str(s, r, &einfo);
24 | fprintf(stderr, "ERROR: %s\n", s);
25 | return -1;
26 | }
27 |
28 | region = onig_region_new();
29 |
30 | end = str + strlen((char* )str);
31 | start = str;
32 | range = end;
33 | r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE);
34 | if (r >= 0) {
35 | int i;
36 |
37 | fprintf(stderr, "match at %d\n", r);
38 | for (i = 0; i < region->num_regs; i++) {
39 | fprintf(stderr, "%d: (%ld-%ld)\n", i, region->beg[i], region->end[i]);
40 | }
41 | r = 0;
42 | }
43 | else if (r == ONIG_MISMATCH) {
44 | fprintf(stderr, "search fail\n");
45 | r = -1;
46 | }
47 | else { /* error */
48 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
49 | onig_error_code_to_str(s, r);
50 | fprintf(stderr, "ERROR: %s\n", s);
51 | return -1;
52 | }
53 |
54 | onig_region_free(region, 1 /* 1:free self, 0:free contents only */);
55 | onig_free(reg);
56 | onig_end();
57 | return r;
58 | }
59 |
60 | extern int main(int argc, char* argv[])
61 | {
62 | int r = 0;
63 |
64 | r |= exec(ONIG_SYNTAX_PERL,
65 | "\\p{XDigit}\\P{XDigit}\\p{^XDigit}\\P{^XDigit}\\p{XDigit}",
66 | "bgh3a");
67 |
68 | r |= exec(ONIG_SYNTAX_JAVA,
69 | "\\p{XDigit}\\P{XDigit}[a-c&&b-g]\\u0020[\\u0021]", "bgc !");
70 |
71 | r |= exec(ONIG_SYNTAX_ASIS,
72 | "abc def* e+ g?ddd[a-rvvv] (vv){3,7}hv\\dvv(?:aczui ss)\\W\\w$",
73 | "abc def* e+ g?ddd[a-rvvv] (vv){3,7}hv\\dvv(?:aczui ss)\\W\\w$");
74 | onig_end();
75 | return r;
76 | }
77 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/go/colorize-results/test-13777_go.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "c": "var",
4 | "t": "go.keyword.var",
5 | "r": {
6 | "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)",
7 | "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)",
8 | "dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword rgb(86, 156, 214)",
9 | "light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword rgb(0, 0, 255)",
10 | "hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword rgb(86, 156, 214)"
11 | }
12 | },
13 | {
14 | "c": " e [][]*aType // ( ",
15 | "t": "",
16 | "r": {
17 | "dark_plus": ".vs-dark .token rgb(212, 212, 212)",
18 | "light_plus": ".vs .token rgb(0, 0, 0)",
19 | "dark_vs": ".vs-dark .token rgb(212, 212, 212)",
20 | "light_vs": ".vs .token rgb(0, 0, 0)",
21 | "hc_black": ".hc-black .token rgb(255, 255, 255)"
22 | }
23 | },
24 | {
25 | "c": "bug",
26 | "t": "declaration.go.other.variable",
27 | "r": {
28 | "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)",
29 | "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)",
30 | "dark_vs": ".vs-dark .token rgb(212, 212, 212)",
31 | "light_vs": ".vs .token rgb(0, 0, 0)",
32 | "hc_black": ".hc-black .token rgb(255, 255, 255)"
33 | }
34 | },
35 | {
36 | "c": " in highligher?",
37 | "t": "",
38 | "r": {
39 | "dark_plus": ".vs-dark .token rgb(212, 212, 212)",
40 | "light_plus": ".vs .token rgb(0, 0, 0)",
41 | "dark_vs": ".vs-dark .token rgb(212, 212, 212)",
42 | "light_vs": ".vs .token rgb(0, 0, 0)",
43 | "hc_black": ".hc-black .token rgb(255, 255, 255)"
44 | }
45 | },
46 | {
47 | "c": ")",
48 | "t": "bracket.go.other.punctuation.round",
49 | "r": {
50 | "dark_plus": ".vs-dark .token rgb(212, 212, 212)",
51 | "light_plus": ".vs .token rgb(0, 0, 0)",
52 | "dark_vs": ".vs-dark .token rgb(212, 212, 212)",
53 | "light_vs": ".vs .token rgb(0, 0, 0)",
54 | "hc_black": ".hc-black .token rgb(255, 255, 255)"
55 | }
56 | }
57 | ]
--------------------------------------------------------------------------------
/libs/Onigmo/configure.ac:
--------------------------------------------------------------------------------
1 | dnl Process this file with autoconf to produce a configure script.
2 | AC_INIT(onigmo, 6.2.0)
3 |
4 | AC_CONFIG_MACRO_DIR([m4])
5 |
6 | AM_INIT_AUTOMAKE([foreign subdir-objects])
7 | AC_CONFIG_HEADER(config.h)
8 |
9 |
10 | dnl default value for RUBYDIR
11 | RUBYDIR=".."
12 | AC_ARG_WITH(rubydir,
13 | [ --with-rubydir=RUBYDIR specify value for RUBYDIR (default ..)],
14 | [ RUBYDIR=$withval ])
15 | AC_SUBST(RUBYDIR)
16 |
17 | dnl default value for STATISTICS
18 | STATISTICS=""
19 | AC_ARG_WITH(statistics,
20 | [ --with-statistics take matching time statistical data],
21 | [ STATISTICS=-DONIG_DEBUG_STATISTICS ])
22 | AC_SUBST(STATISTICS)
23 |
24 | dnl check for COMBINATION_EXPLOSION
25 | AC_ARG_ENABLE(combination-explosion-check,
26 | [ --enable-combination-explosion-check enable combination explosion check],
27 | [comb_expl_check=$enableval])
28 | if test "${comb_expl_check}" = yes; then
29 | AC_DEFINE(USE_COMBINATION_EXPLOSION_CHECK,1,[Define if combination explosion check])
30 | fi
31 |
32 | dnl check for CRNL_AS_LINE_TERMINATOR
33 | AC_ARG_ENABLE(crnl-as-line-terminator,
34 | [ --enable-crnl-as-line-terminator enable CR+NL as line terminator],
35 | [crnl_as_line_terminator=$enableval])
36 | if test "${crnl_as_line_terminator}" = yes; then
37 | AC_DEFINE(USE_CRNL_AS_LINE_TERMINATOR,1,[Define if enable CR+NL as line terminator])
38 | fi
39 |
40 |
41 | dnl Checks for programs.
42 | AC_PROG_CC
43 | AC_PROG_LIBTOOL
44 | AM_PROG_CC_C_O
45 | LTVERSION="6:5:0"
46 | AC_SUBST(LTVERSION)
47 |
48 | AC_PROG_INSTALL
49 | AC_PROG_MAKE_SET
50 |
51 | AC_CHECK_PROGS(python_prog, python3 python python2)
52 |
53 | dnl Checks for libraries.
54 |
55 | dnl Checks for header files.
56 | AC_HEADER_STDC
57 | AC_CHECK_HEADERS(sys/time.h unistd.h sys/times.h stdint.h)
58 |
59 | dnl Checks for typedefs, structures, and compiler characteristics.
60 | AC_CHECK_SIZEOF(int, 4)
61 | AC_CHECK_SIZEOF(short, 2)
62 | AC_CHECK_SIZEOF(long, 4)
63 | AC_CHECK_SIZEOF([void*])
64 | AC_CHECK_SIZEOF([long long])
65 | AC_C_CONST
66 | AC_HEADER_TIME
67 |
68 | dnl Checks for library functions.
69 | AC_FUNC_ALLOCA
70 | AC_FUNC_MEMCMP
71 |
72 |
73 | AC_OUTPUT([Makefile onigmo-config sample/Makefile], [chmod +x onigmo-config])
74 |
--------------------------------------------------------------------------------
/libs/Onigmo/sample/names.c:
--------------------------------------------------------------------------------
1 | /*
2 | * names.c -- example of group name callback.
3 | */
4 | #include
5 | #include
6 | #include "onigmo.h"
7 |
8 | static int
9 | name_callback(const UChar* name, const UChar* name_end,
10 | int ngroup_num, int* group_nums,
11 | regex_t* reg, void* arg)
12 | {
13 | int i, gn, ref;
14 | char* s;
15 | OnigRegion *region = (OnigRegion* )arg;
16 |
17 | for (i = 0; i < ngroup_num; i++) {
18 | gn = group_nums[i];
19 | ref = onig_name_to_backref_number(reg, name, name_end, region);
20 | s = (ref == gn ? "*" : "");
21 | fprintf(stderr, "%s (%d): ", name, gn);
22 | fprintf(stderr, "(%ld-%ld) %s\n", region->beg[gn], region->end[gn], s);
23 | }
24 | return 0; /* 0: continue */
25 | }
26 |
27 | extern int main(int argc, char* argv[])
28 | {
29 | int r;
30 | unsigned char *start, *range, *end;
31 | regex_t* reg;
32 | OnigErrorInfo einfo;
33 | OnigRegion *region;
34 |
35 | static UChar* pattern = (UChar* )"(?a*)(?b*)(?c*)";
36 | static UChar* str = (UChar* )"aaabbbbcc";
37 |
38 | r = onig_new(®, pattern, pattern + strlen((char* )pattern),
39 | ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, ONIG_SYNTAX_DEFAULT, &einfo);
40 | if (r != ONIG_NORMAL) {
41 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
42 | onig_error_code_to_str(s, r, &einfo);
43 | fprintf(stderr, "ERROR: %s\n", s);
44 | return -1;
45 | }
46 |
47 | fprintf(stderr, "number of names: %d\n", onig_number_of_names(reg));
48 |
49 | region = onig_region_new();
50 |
51 | end = str + strlen((char* )str);
52 | start = str;
53 | range = end;
54 | r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE);
55 | if (r >= 0) {
56 | fprintf(stderr, "match at %d\n\n", r);
57 | r = onig_foreach_name(reg, name_callback, (void* )region);
58 | }
59 | else if (r == ONIG_MISMATCH) {
60 | fprintf(stderr, "search fail\n");
61 | r = -1;
62 | }
63 | else { /* error */
64 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
65 | onig_error_code_to_str(s, r);
66 | return -1;
67 | }
68 |
69 | onig_region_free(region, 1 /* 1:free self, 0:free contents only */);
70 | onig_free(reg);
71 | onig_end();
72 | return r;
73 | }
74 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/syntaxes/xsl.json:
--------------------------------------------------------------------------------
1 | {
2 | "scopeName": "text.xml.xsl",
3 | "name": "XSL",
4 | "fileTypes": [
5 | "xsl",
6 | "xslt"
7 | ],
8 | "patterns": [
9 | {
10 | "begin": "(<)(xsl)((:))(template)",
11 | "captures": {
12 | "1": {
13 | "name": "punctuation.definition.tag.xml"
14 | },
15 | "2": {
16 | "name": "entity.name.tag.namespace.xml"
17 | },
18 | "3": {
19 | "name": "entity.name.tag.xml"
20 | },
21 | "4": {
22 | "name": "punctuation.separator.namespace.xml"
23 | },
24 | "5": {
25 | "name": "entity.name.tag.localname.xml"
26 | }
27 | },
28 | "end": "(>)",
29 | "name": "meta.tag.xml.template",
30 | "patterns": [
31 | {
32 | "captures": {
33 | "1": {
34 | "name": "entity.other.attribute-name.namespace.xml"
35 | },
36 | "2": {
37 | "name": "entity.other.attribute-name.xml"
38 | },
39 | "3": {
40 | "name": "punctuation.separator.namespace.xml"
41 | },
42 | "4": {
43 | "name": "entity.other.attribute-name.localname.xml"
44 | }
45 | },
46 | "match": " (?:([-_a-zA-Z0-9]+)((:)))?([a-zA-Z-]+)"
47 | },
48 | {
49 | "include": "#doublequotedString"
50 | },
51 | {
52 | "include": "#singlequotedString"
53 | }
54 | ]
55 | },
56 | {
57 | "include": "text.xml"
58 | }
59 | ],
60 | "repository": {
61 | "doublequotedString": {
62 | "begin": "\"",
63 | "beginCaptures": {
64 | "0": {
65 | "name": "punctuation.definition.string.begin.xml"
66 | }
67 | },
68 | "end": "\"",
69 | "endCaptures": {
70 | "0": {
71 | "name": "punctuation.definition.string.end.xml"
72 | }
73 | },
74 | "name": "string.quoted.double.xml"
75 | },
76 | "singlequotedString": {
77 | "begin": "'",
78 | "beginCaptures": {
79 | "0": {
80 | "name": "punctuation.definition.string.begin.xml"
81 | }
82 | },
83 | "end": "'",
84 | "endCaptures": {
85 | "0": {
86 | "name": "punctuation.definition.string.end.xml"
87 | }
88 | },
89 | "name": "string.quoted.single.xml"
90 | }
91 | },
92 | "version": "https://github.com/atom/language-xml/commit/507de2ee7daca60cf02e9e21fbeb92bbae73e280"
93 | }
--------------------------------------------------------------------------------
/libs/Onigmo/sample/scan.c:
--------------------------------------------------------------------------------
1 | /*
2 | * scan.c
3 | */
4 | #include
5 | #include
6 | #include "onigmo.h"
7 |
8 | static int
9 | scan_callback(OnigPosition n, OnigPosition r, OnigRegion* region, void* arg)
10 | {
11 | int i;
12 |
13 | fprintf(stdout, "scan: %ld\n", n);
14 |
15 | fprintf(stdout, "match at %ld\n", r);
16 | for (i = 0; i < region->num_regs; i++) {
17 | fprintf(stdout, "%d: (%ld-%ld)\n", i, region->beg[i], region->end[i]);
18 | }
19 |
20 | return 0;
21 | }
22 |
23 | static int
24 | scan(regex_t* reg, unsigned char* str, unsigned char* end)
25 | {
26 | int r;
27 | OnigRegion *region;
28 |
29 | region = onig_region_new();
30 |
31 | r = onig_scan(reg, str, end, region, ONIG_OPTION_NONE, scan_callback, NULL);
32 | if (r >= 0) {
33 | fprintf(stdout, "total: %d match\n", r);
34 | }
35 | else { /* error */
36 | char s[ONIG_MAX_ERROR_MESSAGE_LEN];
37 | onig_error_code_to_str((OnigUChar* )s, r);
38 | fprintf(stderr, "ERROR: %s\n", s);
39 | return -1;
40 | }
41 |
42 | onig_region_free(region, 1 /* 1:free self, 0:free contents only */);
43 | return 0;
44 | }
45 |
46 | static int
47 | exec(OnigEncoding enc, OnigOptionType options, char* apattern, char* astr)
48 | {
49 | int r;
50 | unsigned char *end;
51 | regex_t* reg;
52 | OnigErrorInfo einfo;
53 | UChar* pattern_end;
54 | UChar* pattern = (UChar* )apattern;
55 | UChar* str = (UChar* )astr;
56 |
57 | onig_initialize(&enc, 1);
58 |
59 | pattern_end = pattern + onigenc_str_bytelen_null(enc, pattern);
60 |
61 | r = onig_new(®, pattern, pattern_end, options, enc, ONIG_SYNTAX_DEFAULT, &einfo);
62 | if (r != ONIG_NORMAL) {
63 | char s[ONIG_MAX_ERROR_MESSAGE_LEN];
64 | onig_error_code_to_str((OnigUChar* )s, r, &einfo);
65 | fprintf(stderr, "ERROR: %s\n", s);
66 | return -1;
67 | }
68 |
69 | end = str + onigenc_str_bytelen_null(enc, str);
70 | r = scan(reg, str, end);
71 |
72 | onig_free(reg);
73 | onig_end();
74 | return 0;
75 | }
76 |
77 |
78 | extern int main(int argc, char* argv[])
79 | {
80 | exec(ONIG_ENCODING_UTF8, ONIG_OPTION_NONE,
81 | "\\Ga+\\s*", "a aa aaa baaa");
82 |
83 | fprintf(stdout, "\n");
84 | exec(ONIG_ENCODING_UTF8, ONIG_OPTION_NONE,
85 | "a+\\s*", "a aa aaa baaa");
86 |
87 | return 0;
88 | }
89 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/parser/grammar.h:
--------------------------------------------------------------------------------
1 | #ifndef PARSE_GRAMMAR_H
2 | #define PARSE_GRAMMAR_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | #include "json/json.h"
11 | #include "private.h"
12 | #include "scope.h"
13 |
14 | namespace parse {
15 |
16 | struct rule_t;
17 | struct stack_t;
18 | typedef std::shared_ptr rule_ptr;
19 | typedef std::shared_ptr stack_ptr;
20 |
21 | struct grammar_t {
22 |
23 | grammar_t(Json::Value const& json);
24 | ~grammar_t();
25 |
26 | stack_ptr seed() const;
27 | std::mutex& mutex() { return _mutex; }
28 | Json::Value document() { return doc; }
29 |
30 | static int running_threads;
31 |
32 | private:
33 | struct rule_stack_t {
34 | rule_stack_t(rule_t const* rule = nullptr, rule_stack_t const* parent = nullptr)
35 | : rule(rule)
36 | , parent(parent)
37 | {
38 | }
39 |
40 | rule_t const* rule;
41 | rule_stack_t const* parent;
42 | };
43 |
44 | static void* setup_includes_thread(void* arg);
45 |
46 | struct setup_includes_payload_t {
47 | grammar_t* _this;
48 | rule_ptr rule;
49 | rule_ptr base;
50 | rule_ptr self;
51 | rule_stack_t stack;
52 | std::string path;
53 | };
54 |
55 | void setup_includes(rule_ptr const& rule, rule_ptr const& base,
56 | rule_ptr const& self, rule_stack_t const& stack);
57 | rule_ptr find_grammar(std::string const& scope, rule_ptr const& base);
58 | rule_ptr add_grammar(std::string const& scope, Json::Value const& json,
59 | rule_ptr const& base = rule_ptr(), bool spawn_thread = false);
60 | rule_ptr add_grammar(std::string const& scope, std::string const& path,
61 | rule_ptr const& base = rule_ptr(), bool spawn_thread = false);
62 |
63 | std::vector> injection_grammars();
64 |
65 | rule_ptr _rule;
66 | std::mutex _mutex;
67 | std::map _grammars;
68 | Json::Value doc;
69 |
70 | rule_ptr find_rule(grammar_t* grammar, int id);
71 | };
72 |
73 | typedef std::shared_ptr grammar_ptr;
74 | grammar_ptr parse_grammar(Json::Value const& json);
75 |
76 | } // namespace parse
77 |
78 | #endif
--------------------------------------------------------------------------------
/libs/Onigmo/regversion.c:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | regversion.c - Onigmo (Oniguruma-mod) (regular expression library)
3 | **********************************************************************/
4 | /*-
5 | * Copyright (c) 2002-2018 K.Kosako
6 | * Copyright (c) 2011-2019 K.Takata
7 | * All rights reserved.
8 | *
9 | * Redistribution and use in source and binary forms, with or without
10 | * modification, are permitted provided that the following conditions
11 | * are met:
12 | * 1. Redistributions of source code must retain the above copyright
13 | * notice, this list of conditions and the following disclaimer.
14 | * 2. Redistributions in binary form must reproduce the above copyright
15 | * notice, this list of conditions and the following disclaimer in the
16 | * documentation and/or other materials provided with the distribution.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 | * SUCH DAMAGE.
29 | */
30 |
31 | #include "onigmo.h"
32 |
33 | #define TOSTR_(a) #a
34 | #define ONIG_VERSION_TOSTR_(a,b,c) \
35 | TOSTR_(a) "." TOSTR_(b) "." TOSTR_(c)
36 | #define ONIG_VERSION_STRING \
37 | ONIG_VERSION_TOSTR_(ONIGMO_VERSION_MAJOR, ONIGMO_VERSION_MINOR, ONIGMO_VERSION_TEENY)
38 |
39 | extern const char*
40 | onig_version(void)
41 | {
42 | const char *s = ONIG_VERSION_STRING;
43 |
44 | return s;
45 | }
46 |
47 | extern const char*
48 | onig_copyright(void)
49 | {
50 | const char *s =
51 | "Onigmo " ONIG_VERSION_STRING " : Copyright (C) 2002-2018 K.Kosako, "
52 | "2011-2019 K.Takata";
53 |
54 | return s;
55 | }
56 |
--------------------------------------------------------------------------------
/libs/Onigmo/win32/config.h:
--------------------------------------------------------------------------------
1 | #define STDC_HEADERS 1
2 | #define HAVE_SYS_TYPES_H 1
3 | #define HAVE_SYS_STAT_H 1
4 | #define HAVE_STDLIB_H 1
5 | #define HAVE_STRING_H 1
6 | #define HAVE_MEMORY_H 1
7 | #define HAVE_FLOAT_H 1
8 | #define HAVE_OFF_T 1
9 | #define SIZEOF_INT 4
10 | #define SIZEOF_SHORT 2
11 | #define SIZEOF_LONG 4
12 | #define SIZEOF_LONG_LONG 8
13 | #define SIZEOF___INT64 8
14 | #define SIZEOF_OFF_T 4
15 | #ifdef _WIN64
16 | # define SIZEOF_VOIDP 8
17 | #else
18 | # define SIZEOF_VOIDP 4
19 | #endif
20 | #define SIZEOF_FLOAT 4
21 | #define SIZEOF_DOUBLE 8
22 | #define TOKEN_PASTE(x,y) x##y
23 | #ifndef NORETURN
24 | # if defined(_MSC_VER) && (_MSC_VER > 1100)
25 | # define NORETURN(x) __declspec(noreturn) x
26 | # else
27 | # define NORETURN(x) x
28 | # endif
29 | #endif
30 | #define HAVE_DECL_SYS_NERR 1
31 | #define HAVE_LIMITS_H 1
32 | #define HAVE_FCNTL_H 1
33 | #define HAVE_SYS_UTIME_H 1
34 | #if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
35 | # define HAVE_STDINT_H 1
36 | #endif
37 | #if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1800)
38 | # define HAVE_INTTYPES_H 1
39 | #endif
40 | #define uid_t int
41 | #define gid_t int
42 | #define HAVE_STRUCT_STAT_ST_RDEV 1
43 | #define HAVE_ST_RDEV 1
44 | #define GETGROUPS_T int
45 | #define RETSIGTYPE void
46 | #define HAVE_ALLOCA 1
47 | #define HAVE_DUP2 1
48 | #define HAVE_MEMCMP 1
49 | #define HAVE_MEMMOVE 1
50 | #define HAVE_MKDIR 1
51 | #define HAVE_STRERROR 1
52 | #define HAVE_STRFTIME 1
53 | #define HAVE_STRCHR 1
54 | #define HAVE_STRSTR 1
55 | #define HAVE_STRTOD 1
56 | #define HAVE_STRTOL 1
57 | #define HAVE_STRTOUL 1
58 | #define HAVE_FLOCK 1
59 | #define HAVE_VSNPRINTF 1
60 | #define HAVE_FINITE 1
61 | #define HAVE_FMOD 1
62 | #define HAVE_FREXP 1
63 | #define HAVE_HYPOT 1
64 | #define HAVE_MODF 1
65 | #define HAVE_WAITPID 1
66 | #define HAVE_CHSIZE 1
67 | #define HAVE_TIMES 1
68 | #define HAVE__SETJMP 1
69 | #define HAVE_TELLDIR 1
70 | #define HAVE_SEEKDIR 1
71 | #define HAVE_MKTIME 1
72 | #define HAVE_COSH 1
73 | #define HAVE_SINH 1
74 | #define HAVE_TANH 1
75 | #define HAVE_EXECVE 1
76 | #define HAVE_TZNAME 1
77 | #define HAVE_DAYLIGHT 1
78 | #define SETPGRP_VOID 1
79 | #define inline __inline
80 | #define NEED_IO_SEEK_BETWEEN_RW 1
81 | #define RSHIFT(x,y) ((x)>>(int)y)
82 | #define FILE_COUNT _cnt
83 | #define FILE_READPTR _ptr
84 | #define DEFAULT_KCODE KCODE_NONE
85 | #define DLEXT ".so"
86 | #define DLEXT2 ".dll"
87 |
--------------------------------------------------------------------------------
/libs/Onigmo/sample/sql.c:
--------------------------------------------------------------------------------
1 | /*
2 | * sql.c
3 | */
4 | #include
5 | #include
6 | #include "onigmo.h"
7 |
8 | extern int main(int argc, char* argv[])
9 | {
10 | static OnigSyntaxType SQLSyntax;
11 |
12 | int r;
13 | unsigned char *start, *range, *end;
14 | regex_t* reg;
15 | OnigErrorInfo einfo;
16 | OnigRegion *region;
17 |
18 | static UChar* pattern = (UChar* )"\\_%\\\\__zz";
19 | static UChar* str = (UChar* )"a_abcabcabc\\ppzz";
20 |
21 | onig_set_syntax_op (&SQLSyntax, ONIG_SYN_OP_VARIABLE_META_CHARACTERS);
22 | onig_set_syntax_op2 (&SQLSyntax, 0);
23 | onig_set_syntax_behavior(&SQLSyntax, 0);
24 | onig_set_syntax_options (&SQLSyntax, ONIG_OPTION_MULTILINE);
25 | onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ESCAPE, (OnigCodePoint )'\\');
26 | onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ANYCHAR, (OnigCodePoint )'_');
27 | onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ANYTIME,
28 | ONIG_INEFFECTIVE_META_CHAR);
29 | onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ZERO_OR_ONE_TIME,
30 | ONIG_INEFFECTIVE_META_CHAR);
31 | onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ONE_OR_MORE_TIME,
32 | ONIG_INEFFECTIVE_META_CHAR);
33 | onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ANYCHAR_ANYTIME,
34 | (OnigCodePoint )'%');
35 |
36 | r = onig_new(®, pattern, pattern + strlen((char* )pattern),
37 | ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, &SQLSyntax, &einfo);
38 | if (r != ONIG_NORMAL) {
39 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
40 | onig_error_code_to_str(s, r, &einfo);
41 | fprintf(stderr, "ERROR: %s\n", s);
42 | return -1;
43 | }
44 |
45 | region = onig_region_new();
46 |
47 | end = str + strlen((char* )str);
48 | start = str;
49 | range = end;
50 | r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE);
51 | if (r >= 0) {
52 | int i;
53 |
54 | fprintf(stderr, "match at %d\n", r);
55 | for (i = 0; i < region->num_regs; i++) {
56 | fprintf(stderr, "%d: (%ld-%ld)\n", i, region->beg[i], region->end[i]);
57 | }
58 | r = 0;
59 | }
60 | else if (r == ONIG_MISMATCH) {
61 | fprintf(stderr, "search fail\n");
62 | r = -1;
63 | }
64 | else { /* error */
65 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
66 | onig_error_code_to_str(s, r);
67 | fprintf(stderr, "ERROR: %s\n", s);
68 | return -1;
69 | }
70 |
71 | onig_region_free(region, 1 /* 1:free self, 0:free contents only */);
72 | onig_free(reg);
73 | onig_end();
74 | return r;
75 | }
76 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.py:
--------------------------------------------------------------------------------
1 | from banana import *
2 |
3 | class Monkey:
4 | # Bananas the monkey can eat.
5 | capacity = 10
6 | def eat(self, N):
7 | '''Make the monkey eat N bananas!'''
8 | capacity = capacity - N*banana.size
9 |
10 | def feeding_frenzy(self):
11 | eat(9.25)
12 | return "Yum yum"
13 |
14 | def some_func(a:
15 | lambda x=None:
16 | {key: val
17 | for key, val in
18 | (x if x is not None else [])
19 | }=42):
20 | pass
21 |
22 | if 1900 < year < 2100 and 1 <= month <= 12 \
23 | and 1 <= day <= 31 and 0 <= hour < 24 \
24 | and 0 <= minute < 60 and 0 <= second < 60: # Looks like a valid date
25 | return 1
26 |
27 | def firstn(g, n):
28 | for i in range(n):
29 | yield g.next()
30 |
31 | reduce(lambda x,y: x+y, [47,11,42,13])
32 | woerter = {"house" : "Haus", "cat":"Katze", "black":"schwarz"}
33 |
34 | mydictionary = {
35 | 'foo': 23, #comment
36 | 'bar': "hello" #sqadsad
37 | }
38 |
39 | def steuern(einkommen):
40 | """Berechnung der zu zahlenden Steuern fuer ein zu versteuerndes Einkommen von x"""
41 | if einkommen <= 8004:
42 | steuer = 0
43 | elif einkommen <= 13469:
44 | y = (einkommen -8004.0)/10000.0
45 | steuer = (912.17 * y + 1400)*y
46 | else:
47 | steuer = einkommen * 0.44 - 15694
48 | return steuer
49 |
50 | def beliebig(x, y, *mehr):
51 | print "x=", x, ", x=", y
52 | print "mehr: ", mehr
53 |
54 | class Memoize:
55 | def __init__(self, fn):
56 | self.fn = fn
57 | self.memo = {}
58 | def __call__(self, *args):
59 | if args not in self.memo:
60 | self.memo[args] = self.fn(*args)
61 | return self.memo[args]
62 |
63 | res = re.search(r"([0-9-]*)\s*([A-Za-z]+),\s+(.*)", i)
64 |
65 | while True:
66 | try:
67 | n = raw_input("Number: ")
68 | n = int(n)
69 | break
70 | except ValueError:
71 | print("Not a number")
72 |
73 | async with EXPR as VAR:
74 | BLOCK
75 |
76 | # Comments in dictionary items should be colorized accordingly
77 | my_dictionary = {
78 | 'foo':23, # this should be colorized as comment
79 | 'bar':"foobar" #this should be colorized as comment
80 | }
81 |
82 | # test raw strings
83 | text = r"""
84 | interval ``[1,2)`` leads to
85 | """
86 | highlight_error = True
87 |
88 | # highlight doctests
89 | r'''Module docstring
90 |
91 | Some text followed by code sample:
92 | >>> for a in foo(2, b=1,
93 | ... c=3):
94 | ... print(a)
95 | 0
96 | 1
97 | '''
98 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.md:
--------------------------------------------------------------------------------
1 | # Header 1 #
2 | ## Header 2 ##
3 | ### Header 3 ### (Hashes on right are optional)
4 | ## Markdown plus h2 with a custom ID ## {#id-goes-here}
5 | [Link back to H2](#id-goes-here)
6 |
7 | ### Alternate heading styles:
8 | Alternate Header 1
9 | ==================
10 | Alternate Header 2
11 | ------------------
12 |
13 |
14 |
15 |
16 | nested div
17 |
18 |
21 | This is a div _with_ underscores
22 | and a &
bold element.
23 |
26 |
27 |
28 | * Bullet lists are easy too
29 | - Another one
30 | + Another one
31 |
32 | This is a paragraph, which is text surrounded by
33 | whitespace. Paragraphs can be on one
34 | line (or many), and can drone on for hours.
35 |
36 | Now some inline markup like _italics_, **bold**,
37 | and `code()`. Note that underscores
38 | in_words_are ignored.
39 |
40 | ````application/json
41 | { value: ["or with a mime type"] }
42 | ````
43 |
44 | > Blockquotes are like quoted text in email replies
45 | >> And, they can be nested
46 |
47 | 1. A numbered list
48 | 2. Which is numbered
49 | 3. With periods and a space
50 |
51 | And now some code:
52 |
53 | // Code is just text indented a bit
54 | which(is_easy) to_remember();
55 |
56 | And a block
57 |
58 | ~~~
59 | // Markdown extra adds un-indented code blocks too
60 |
61 | if (this_is_more_code == true && !indented) {
62 | // tild wrapped code blocks, also not indented
63 | }
64 | ~~~
65 |
66 | Text with
67 | two trailing spaces
68 | (on the right)
69 | can be used
70 | for things like poems
71 |
72 | ### Horizontal rules
73 |
74 | * * * *
75 | ****
76 | --------------------------
77 |
78 | 
79 |
80 | ## Markdown plus tables ##
81 |
82 | | Header | Header | Right |
83 | | ------ | ------ | -----: |
84 | | Cell | Cell | $10 |
85 | | Cell | Cell | $20 |
86 |
87 | * Outer pipes on tables are optional
88 | * Colon used for alignment (right versus left)
89 |
90 | ## Markdown plus definition lists ##
91 |
92 | Bottled water
93 | : $ 1.25
94 | : $ 1.55 (Large)
95 |
96 | Milk
97 | Pop
98 | : $ 1.75
99 |
100 | * Multiple definitions and terms are possible
101 | * Definitions can include multiple paragraphs too
102 |
103 | *[ABBR]: Markdown plus abbreviations (produces an tag)
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test-4287.jade.result:
--------------------------------------------------------------------------------
1 | {
2 | "abyss": [
3 | {
4 | "content": ".ssdsd",
5 | "color": "#F280D0"
6 | },
7 | {
8 | "content": " // asdsdas",
9 | "color": "#22AA44"
10 | }
11 | ],
12 | "dark_vs": [
13 | {
14 | "content": ".ssdsd",
15 | "color": "#569CD6"
16 | },
17 | {
18 | "content": " // asdsdas",
19 | "color": "#CE9178"
20 | }
21 | ],
22 | "light_vs": [
23 | {
24 | "content": ".ssdsd",
25 | "color": "#0000FF"
26 | },
27 | {
28 | "content": " // asdsdas",
29 | "color": "#0000FF"
30 | }
31 | ],
32 | "hc_black": [
33 | {
34 | "content": ".ssdsd",
35 | "color": "#569CD6"
36 | },
37 | {
38 | "content": " // asdsdas",
39 | "color": "#CE9178"
40 | }
41 | ],
42 | "dark_plus": [
43 | {
44 | "content": ".ssdsd",
45 | "color": "#569CD6"
46 | },
47 | {
48 | "content": " // asdsdas",
49 | "color": "#CE9178"
50 | }
51 | ],
52 | "light_plus": [
53 | {
54 | "content": ".ssdsd",
55 | "color": "#0000FF"
56 | },
57 | {
58 | "content": " // asdsdas",
59 | "color": "#0000FF"
60 | }
61 | ],
62 | "kimbie_dark": [
63 | {
64 | "content": ".ssdsd",
65 | "color": "#F79A32"
66 | },
67 | {
68 | "content": " // asdsdas",
69 | "color": "#889B4A"
70 | }
71 | ],
72 | "monokai": [
73 | {
74 | "content": ".ssdsd",
75 | "color": "#AE81FF"
76 | },
77 | {
78 | "content": " // asdsdas",
79 | "color": "#E6DB74"
80 | }
81 | ],
82 | "monokai_dimmed": [
83 | {
84 | "content": ".ssdsd",
85 | "color": "#FF0080"
86 | },
87 | {
88 | "content": " // asdsdas",
89 | "color": "#9AA83A"
90 | }
91 | ],
92 | "quietlight": [
93 | {
94 | "content": ".ssdsd",
95 | "color": "#AB6526"
96 | },
97 | {
98 | "content": " // asdsdas",
99 | "color": "#448C27"
100 | }
101 | ],
102 | "red": [
103 | {
104 | "content": ".ssdsd",
105 | "color": "#994646FF"
106 | },
107 | {
108 | "content": " // asdsdas",
109 | "color": "#CD8D8DFF"
110 | }
111 | ],
112 | "solarized_dark": [
113 | {
114 | "content": ".ssdsd",
115 | "color": "#B58900"
116 | },
117 | {
118 | "content": " // asdsdas",
119 | "color": "#2AA198"
120 | }
121 | ],
122 | "solarized_light": [
123 | {
124 | "content": ".ssdsd",
125 | "color": "#B58900"
126 | },
127 | {
128 | "content": " // asdsdas",
129 | "color": "#2AA198"
130 | }
131 | ],
132 | "tomorrow_night_blue": [
133 | {
134 | "content": ".ssdsd",
135 | "color": "#FFC58F"
136 | },
137 | {
138 | "content": " // asdsdas",
139 | "color": "#D1F1A9"
140 | }
141 | ]
142 | }
--------------------------------------------------------------------------------
/libs/Onigmo/enc/shift_jis.c:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | shift_jis.c - Onigmo (Oniguruma-mod) (regular expression library)
3 | **********************************************************************/
4 | /*-
5 | * Copyright (c) 2002-2009 K.Kosako
6 | * Copyright (c) 2011-2017 K.Takata
7 | * All rights reserved.
8 | *
9 | * Redistribution and use in source and binary forms, with or without
10 | * modification, are permitted provided that the following conditions
11 | * are met:
12 | * 1. Redistributions of source code must retain the above copyright
13 | * notice, this list of conditions and the following disclaimer.
14 | * 2. Redistributions in binary form must reproduce the above copyright
15 | * notice, this list of conditions and the following disclaimer in the
16 | * documentation and/or other materials provided with the distribution.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 | * SUCH DAMAGE.
29 | */
30 |
31 | #include "shift_jis.h"
32 |
33 | OnigEncodingDefine(shift_jis, Shift_JIS) = {
34 | mbc_enc_len,
35 | "Shift_JIS", /* name */
36 | 2, /* max byte length */
37 | 1, /* min byte length */
38 | onigenc_is_mbc_newline_0x0a,
39 | mbc_to_code,
40 | code_to_mbclen,
41 | code_to_mbc,
42 | mbc_case_fold,
43 | apply_all_case_fold,
44 | get_case_fold_codes_by_str,
45 | property_name_to_ctype,
46 | is_code_ctype,
47 | get_ctype_code_range,
48 | left_adjust_char_head,
49 | is_allowed_reverse_match,
50 | #ifdef USE_CASE_MAP_API
51 | onigenc_ascii_only_case_map,
52 | #else
53 | NULL,
54 | #endif
55 | 0,
56 | ONIGENC_FLAG_NONE,
57 | };
58 | /*
59 | * Name: Shift_JIS
60 | * MIBenum: 17
61 | * Link: http://www.iana.org/assignments/character-sets
62 | * Link: http://ja.wikipedia.org/wiki/Shift_JIS
63 | */
64 |
65 | /*
66 | * Name: MacJapanese
67 | * Link: http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/JAPANESE.TXT
68 | * Link: http://ja.wikipedia.org/wiki/MacJapanese
69 | */
70 | ENC_REPLICATE("MacJapanese", "Shift_JIS")
71 | ENC_ALIAS("MacJapan", "MacJapanese")
72 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/dark_plus.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Dark+",
3 | "include": "./dark_vs.json",
4 | "settings": [
5 | {
6 | "name": "Function declarations",
7 | "scope": [
8 | "entity.name.function",
9 | "support.function"
10 | ],
11 | "settings": {
12 | "foreground": "#DCDCAA"
13 | }
14 | },
15 | {
16 | "name": "Types declaration and references",
17 | "scope": [
18 | "meta.return-type",
19 | "support.class",
20 | "support.type",
21 | "entity.name.type",
22 | "entity.name.class",
23 |
24 | "storage.type.cs",
25 | "storage.type.generic.cs",
26 | "storage.type.modifier.cs",
27 | "storage.type.variable.cs",
28 |
29 | "storage.type.annotation.java",
30 | "storage.type.generic.java",
31 | "storage.type.java",
32 | "storage.type.object.array.java",
33 | "storage.type.primitive.array.java",
34 | "storage.type.primitive.java",
35 | "storage.type.token.java",
36 |
37 | "storage.type.groovy",
38 | "storage.type.annotation.groovy",
39 | "storage.type.parameters.groovy",
40 | "storage.type.generic.groovy",
41 | "storage.type.object.array.groovy",
42 | "storage.type.primitive.array.groovy",
43 | "storage.type.primitive.groovy"
44 | ],
45 | "settings": {
46 | "foreground": "#4EC9B0"
47 | }
48 | },
49 | {
50 | "name": "Types declaration and references, TS grammar specific",
51 | "scope": [
52 | "meta.return.type",
53 | "meta.type.cast.expr",
54 | "meta.type.new.expr",
55 | "support.constant.math",
56 | "support.constant.dom",
57 | "support.constant.json"
58 | ],
59 | "settings": {
60 | "foreground": "#4EC9B0"
61 | }
62 | },
63 | {
64 | "name": "Control flow keywords",
65 | "scope": "keyword.control",
66 | "settings": {
67 | "foreground": "#C586C0"
68 | }
69 | },
70 | {
71 | "name": "Variable and parameter name",
72 | "scope": [
73 | "variable",
74 | "meta.definition.variable.name",
75 | "support.variable"
76 | ],
77 | "settings": {
78 | "foreground": "#9CDCFE"
79 | }
80 | },
81 | {
82 | "name": "Object keys, TS grammar specific",
83 | "scope": [
84 | "meta.object-literal.key",
85 | "meta.object-literal.key entity.name.function"
86 | ],
87 | "settings": {
88 | "foreground": "#9CDCFE"
89 | }
90 | },
91 | {
92 | "name": "CSS property value",
93 | "scope": [
94 | "constant.other.color.rgb-value.css",
95 | "constant.other.rgb-value.css",
96 | "meta.property-value.css support.function",
97 | "meta.property-value.css support",
98 |
99 | "constant.numeric.color.rgb-value.scss",
100 | "constant.rgb-value.scss",
101 | "meta.property-value.scss support.function",
102 | "meta.property-value.scss support"
103 | ],
104 | "settings": {
105 | "foreground": "#CE9178"
106 | }
107 | }
108 | ]
109 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/light_plus.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Light+",
3 | "include": "./light_vs.json",
4 | "settings": [
5 | {
6 | "name": "Function declarations",
7 | "scope": [
8 | "entity.name.function",
9 | "support.function"
10 | ],
11 | "settings": {
12 | "foreground": "#795E26"
13 | }
14 | },
15 | {
16 | "name": "Types declaration and references",
17 | "scope": [
18 | "meta.return-type",
19 | "support.class",
20 | "support.type",
21 | "entity.name.type",
22 | "entity.name.class",
23 |
24 | "storage.type.cs",
25 | "storage.type.generic.cs",
26 | "storage.type.modifier.cs",
27 | "storage.type.variable.cs",
28 |
29 | "storage.type.annotation.java",
30 | "storage.type.generic.java",
31 | "storage.type.java",
32 | "storage.type.object.array.java",
33 | "storage.type.primitive.array.java",
34 | "storage.type.primitive.java",
35 | "storage.type.token.java",
36 |
37 | "storage.type.groovy",
38 | "storage.type.annotation.groovy",
39 | "storage.type.parameters.groovy",
40 | "storage.type.generic.groovy",
41 | "storage.type.object.array.groovy",
42 | "storage.type.primitive.array.groovy",
43 | "storage.type.primitive.groovy"
44 | ],
45 | "settings": {
46 | "foreground": "#267f99"
47 | }
48 | },
49 | {
50 | "name": "Types declaration and references, TS grammar specific",
51 | "scope": [
52 | "meta.return.type",
53 | "meta.type.cast.expr",
54 | "meta.type.new.expr",
55 | "support.constant.math",
56 | "support.constant.dom",
57 | "support.constant.json"
58 | ],
59 | "settings": {
60 | "foreground": "#267f99"
61 | }
62 | },
63 | {
64 | "name": "Control flow keywords",
65 | "scope": "keyword.control",
66 | "settings": {
67 | "foreground": "#AF00DB"
68 | }
69 | },
70 | {
71 | "name": "Variable and parameter name",
72 | "scope": [
73 | "variable",
74 | "meta.definition.variable.name",
75 | "support.variable"
76 | ],
77 | "settings": {
78 | "foreground": "#001080"
79 | }
80 | },
81 | {
82 | "name": "Object keys, TS grammar specific",
83 | "scope": [
84 | "meta.object-literal.key",
85 | "meta.object-literal.key entity.name.function"
86 | ],
87 | "settings": {
88 | "foreground": "#001080"
89 | }
90 | },
91 | {
92 | "name": "CSS property value",
93 | "scope": [
94 | "constant.other.color.rgb-value.css",
95 | "constant.other.rgb-value.css",
96 | "meta.property-value.css support.function",
97 | "meta.property-value.css support",
98 |
99 | "constant.numeric.color.rgb-value.scss",
100 | "constant.rgb-value.scss",
101 | "meta.property-value.scss support.function",
102 | "meta.property-value.scss support"
103 | ],
104 | "settings": {
105 | "foreground": "#0451a5"
106 | }
107 | }
108 | ]
109 | }
--------------------------------------------------------------------------------
/libs/Onigmo/sample/posix.c:
--------------------------------------------------------------------------------
1 | /*
2 | * posix.c
3 | */
4 | #include
5 | #include "onigmoposix.h"
6 |
7 | typedef unsigned char UChar;
8 |
9 | static int x(regex_t* reg, unsigned char* pattern, unsigned char* str)
10 | {
11 | int r, i;
12 | char buf[200];
13 | regmatch_t pmatch[20];
14 |
15 | r = regexec(reg, (char* )str, reg->re_nsub + 1, pmatch, 0);
16 | if (r != 0 && r != REG_NOMATCH) {
17 | regerror(r, reg, buf, sizeof(buf));
18 | fprintf(stderr, "ERROR: %s\n", buf);
19 | return -1;
20 | }
21 |
22 | if (r == REG_NOMATCH) {
23 | fprintf(stderr, "FAIL: /%s/ '%s'\n", pattern, str);
24 | }
25 | else {
26 | fprintf(stderr, "OK: /%s/ '%s'\n", pattern, str);
27 | for (i = 0; i <= (int )reg->re_nsub; i++) {
28 | fprintf(stderr, "%d: %d-%d\n", i, pmatch[i].rm_so, pmatch[i].rm_eo);
29 | }
30 | }
31 | return 0;
32 | }
33 |
34 | extern int main(int argc, char* argv[])
35 | {
36 | int r;
37 | char buf[200];
38 | regex_t reg;
39 | UChar* pattern;
40 |
41 | /* default syntax (ONIG_SYNTAX_RUBY) */
42 | pattern = (UChar* )"^a+b{2,7}[c-f]?$|uuu";
43 | r = regcomp(®, (char* )pattern, REG_EXTENDED);
44 | if (r) {
45 | regerror(r, ®, buf, sizeof(buf));
46 | fprintf(stderr, "ERROR: %s\n", buf);
47 | return -1;
48 | }
49 | x(®, pattern, (UChar* )"aaabbbbd");
50 |
51 | /* POSIX Basic RE (REG_EXTENDED is not specified.) */
52 | pattern = (UChar* )"^a+b{2,7}[c-f]?|uuu";
53 | r = regcomp(®, (char* )pattern, 0);
54 | if (r) {
55 | regerror(r, ®, buf, sizeof(buf));
56 | fprintf(stderr, "ERROR: %s\n", buf);
57 | return -1;
58 | }
59 | x(®, pattern, (UChar* )"a+b{2,7}d?|uuu");
60 |
61 | /* POSIX Basic RE (REG_EXTENDED is not specified.) */
62 | pattern = (UChar* )"^a*b\\{2,7\\}\\([c-f]\\)$";
63 | r = regcomp(®, (char* )pattern, 0);
64 | if (r) {
65 | regerror(r, ®, buf, sizeof(buf));
66 | fprintf(stderr, "ERROR: %s\n", buf);
67 | return -1;
68 | }
69 | x(®, pattern, (UChar* )"aaaabbbbbbd");
70 |
71 | /* POSIX Extended RE */
72 | onig_set_default_syntax(ONIG_SYNTAX_POSIX_EXTENDED);
73 | pattern = (UChar* )"^a+b{2,7}[c-f]?)$|uuu";
74 | r = regcomp(®, (char* )pattern, REG_EXTENDED);
75 | if (r) {
76 | regerror(r, ®, buf, sizeof(buf));
77 | fprintf(stderr, "ERROR: %s\n", buf);
78 | return -1;
79 | }
80 | x(®, pattern, (UChar* )"aaabbbbd)");
81 |
82 | pattern = (UChar* )"^b.";
83 | r = regcomp(®, (char* )pattern, REG_EXTENDED | REG_NEWLINE);
84 | if (r) {
85 | regerror(r, ®, buf, sizeof(buf));
86 | fprintf(stderr, "ERROR: %s\n", buf);
87 | return -1;
88 | }
89 | x(®, pattern, (UChar* )"a\nb\n");
90 |
91 | /* Error test */
92 | pattern = (UChar* )" [";
93 | r = regcomp(®, (char* )pattern, REG_EXTENDED);
94 | if (r) {
95 | regerror(r, ®, buf, sizeof(buf));
96 | fprintf(stderr, "OK(E): %s\n", buf);
97 | }
98 |
99 | regfree(®);
100 | return 0;
101 | }
102 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/extensions/extension.h:
--------------------------------------------------------------------------------
1 | #ifndef EXTENSION_H
2 | #define EXTENSION_H
3 |
4 | #include "grammar.h"
5 | #include "json/json.h"
6 | #include "reader.h"
7 | #include "theme.h"
8 |
9 | struct grammar_info_t {
10 | std::string language;
11 | std::string scopeName;
12 | std::string path;
13 | };
14 |
15 | struct extension_t {
16 | std::string id;
17 | std::string publisher;
18 | std::string name;
19 | std::string path;
20 | std::string base_path;
21 | std::string nlsPath;
22 | Json::Value package;
23 | Json::Value nls;
24 |
25 | bool hasThemes;
26 | bool hasIcons;
27 | bool hasGrammars;
28 | bool hasCommands;
29 | bool addToHistory;
30 | bool nlsLoaded;
31 |
32 | std::vector grammars;
33 | };
34 |
35 | struct language_info_t {
36 | std::string id;
37 | std::string blockCommentStart;
38 | std::string blockCommentEnd;
39 | std::string lineComment;
40 |
41 | bool brackets;
42 | std::vector bracketOpen;
43 | std::vector bracketClose;
44 |
45 | bool hasCurly;
46 | bool hasRound;
47 | bool hasSquare;
48 |
49 | bool pairs;
50 | std::vector pairOpen;
51 | std::vector pairClose;
52 |
53 | parse::grammar_ptr grammar;
54 |
55 | Json::Value definition;
56 | };
57 |
58 | struct icon_theme_t {
59 | std::string path;
60 | std::string icons_path;
61 | Json::Value definition;
62 | };
63 |
64 | struct icon_t {
65 | std::string path;
66 | std::string character;
67 | int r;
68 | int g;
69 | int b;
70 | bool svg;
71 | };
72 |
73 | typedef std::shared_ptr language_info_ptr;
74 | typedef std::shared_ptr icon_theme_ptr;
75 |
76 | bool is_extension_available(const std::string id);
77 | void reset_extension_cache();
78 |
79 | void load_settings(const std::string path, Json::Value& settings);
80 | void load_extensions(const std::string path,
81 | std::vector& extensions);
82 |
83 | Json::Value load_plist_or_json(std::string path);
84 |
85 | icon_theme_ptr
86 | icon_theme_from_name(const std::string path,
87 | std::vector& extensions);
88 | theme_ptr theme_from_name(const std::string path,
89 | std::vector& extensions,
90 | std::string uiTheme = "",
91 | const char* data = NULL);
92 | language_info_ptr
93 | language_from_file(const std::string path,
94 | std::vector& extensions,
95 | const char* data = NULL);
96 |
97 | icon_t icon_for_file(icon_theme_ptr icons, std::string file,
98 | std::vector& extensions);
99 | icon_t icon_for_folder(icon_theme_ptr icons, std::string folder,
100 | std::vector& extensions);
101 |
102 | bool color_is_dark(color_info_t& color);
103 | bool theme_is_dark(theme_ptr theme);
104 |
105 | std::string package_string(struct extension_t& extension, std::string str);
106 |
107 | typedef std::vector extension_list;
108 |
109 | #endif // EXTENSION_H
110 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/git-commit.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes": [
3 | "COMMIT_EDITMSG",
4 | "MERGE_MSG"
5 | ],
6 | "foldingStartMarker": "^\\+\\+\\+",
7 | "foldingStopMarker": "^---",
8 | "name": "Git Commit Message",
9 | "patterns": [
10 | {
11 | "begin": "\\A(?!#)",
12 | "end": "(?=# Please enter the commit message)",
13 | "name": "meta.scope.message.git-commit",
14 | "patterns": [
15 | {
16 | "begin": "\\G",
17 | "end": "^(?!\\G)",
18 | "patterns": [
19 | {
20 | "captures": {
21 | "1": {
22 | "name": "keyword.other.$2.git-commit"
23 | }
24 | },
25 | "match": "\\G((fixup|squash)!)\\s*"
26 | },
27 | {
28 | "match": ".{66,}$",
29 | "name": "invalid.illegal.line-too-long.git-commit"
30 | },
31 | {
32 | "match": ".{51,}$",
33 | "name": "invalid.deprecated.line-too-long.git-commit"
34 | }
35 | ]
36 | }
37 | ]
38 | },
39 | {
40 | "begin": "(?=# Please enter the commit message)",
41 | "end": "\\z",
42 | "name": "meta.scope.metadata.git-commit",
43 | "patterns": [
44 | {
45 | "include": "#metadata"
46 | }
47 | ]
48 | }
49 | ],
50 | "repository": {
51 | "metadata": {
52 | "patterns": [
53 | {
54 | "begin": "(?=^# Changes to be committed:)",
55 | "end": "(?!\\G)((?=^# \\w)|(?!^#))",
56 | "patterns": [
57 | {
58 | "begin": "(^[ \\t]+)?(?=#)",
59 | "beginCaptures": {
60 | "1": {
61 | "name": "punctuation.whitespace.comment.leading.git-commit"
62 | }
63 | },
64 | "contentName": "comment.line.number-sign.git-commit",
65 | "end": "(?!\\G)^",
66 | "patterns": [
67 | {
68 | "match": "\\G#",
69 | "name": "punctuation.definition.comment.git-commit"
70 | },
71 | {
72 | "match": "((modified|renamed):.*)$\\n?",
73 | "name": "markup.changed.git-commit"
74 | },
75 | {
76 | "match": "(new file:.*)$\\n?",
77 | "name": "markup.inserted.git-commit"
78 | },
79 | {
80 | "match": "(deleted:.*)$\\n?",
81 | "name": "markup.deleted.git-commit"
82 | }
83 | ]
84 | }
85 | ]
86 | },
87 | {
88 | "begin": "(^[ \\t]+)?(?=#)",
89 | "beginCaptures": {
90 | "1": {
91 | "name": "punctuation.whitespace.comment.leading.git-commit"
92 | }
93 | },
94 | "contentName": "comment.line.number-sign.git-commit",
95 | "end": "(?!\\G)^",
96 | "patterns": [
97 | {
98 | "match": "\\G#",
99 | "name": "punctuation.definition.comment.git-commit"
100 | }
101 | ]
102 | },
103 | {
104 | "begin": "(?=diff\\ \\-\\-git)",
105 | "comment": "diff presented at the end of the commit message when using commit -v.",
106 | "contentName": "source.diff",
107 | "end": "\\z",
108 | "name": "meta.embedded.diff.git-commit",
109 | "patterns": [
110 | {
111 | "include": "source.diff"
112 | }
113 | ]
114 | }
115 | ]
116 | }
117 | },
118 | "scopeName": "text.git-commit"
119 | }
--------------------------------------------------------------------------------
/libs/Onigmo/regtrav.c:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | regtrav.c - Onigmo (Oniguruma-mod) (regular expression library)
3 | **********************************************************************/
4 | /*-
5 | * Copyright (c) 2002-2004 K.Kosako
6 | * Copyright (c) 2011 K.Takata
7 | * All rights reserved.
8 | *
9 | * Redistribution and use in source and binary forms, with or without
10 | * modification, are permitted provided that the following conditions
11 | * are met:
12 | * 1. Redistributions of source code must retain the above copyright
13 | * notice, this list of conditions and the following disclaimer.
14 | * 2. Redistributions in binary form must reproduce the above copyright
15 | * notice, this list of conditions and the following disclaimer in the
16 | * documentation and/or other materials provided with the distribution.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 | * SUCH DAMAGE.
29 | */
30 |
31 | #include "regint.h"
32 |
33 | #ifdef USE_CAPTURE_HISTORY
34 |
35 | static int
36 | capture_tree_traverse(OnigCaptureTreeNode* node, int at,
37 | int(*callback_func)(int,OnigPosition,OnigPosition,int,int,void*),
38 | int level, void* arg)
39 | {
40 | int r, i;
41 |
42 | if (node == (OnigCaptureTreeNode* )0)
43 | return 0;
44 |
45 | if ((at & ONIG_TRAVERSE_CALLBACK_AT_FIRST) != 0) {
46 | r = (*callback_func)(node->group, node->beg, node->end,
47 | level, ONIG_TRAVERSE_CALLBACK_AT_FIRST, arg);
48 | if (r != 0) return r;
49 | }
50 |
51 | for (i = 0; i < node->num_childs; i++) {
52 | r = capture_tree_traverse(node->childs[i], at,
53 | callback_func, level + 1, arg);
54 | if (r != 0) return r;
55 | }
56 |
57 | if ((at & ONIG_TRAVERSE_CALLBACK_AT_LAST) != 0) {
58 | r = (*callback_func)(node->group, node->beg, node->end,
59 | level, ONIG_TRAVERSE_CALLBACK_AT_LAST, arg);
60 | if (r != 0) return r;
61 | }
62 |
63 | return 0;
64 | }
65 | #endif /* USE_CAPTURE_HISTORY */
66 |
67 | extern int
68 | onig_capture_tree_traverse(OnigRegion* region, int at,
69 | int(*callback_func)(int,OnigPosition,OnigPosition,int,int,void*),
70 | void* arg)
71 | {
72 | #ifdef USE_CAPTURE_HISTORY
73 | return capture_tree_traverse(region->history_root, at,
74 | callback_func, 0, arg);
75 | #else
76 | return ONIG_NO_SUPPORT_CONFIG;
77 | #endif
78 | }
79 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/suite1/fixtures/whileLang.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | fileTypes
6 |
7 | whileLang
8 |
9 | name
10 | whileLang
11 | patterns
12 |
13 |
14 | include
15 | #alist
16 |
17 |
18 | include
19 | #blist
20 |
21 |
22 | repository
23 |
24 | number
25 |
26 | match
27 | [0-9]
28 | name
29 | number
30 |
31 | letter
32 |
33 | match
34 | x
35 | name
36 | letter
37 |
38 | alist
39 |
40 | begin
41 | A
42 | patterns
43 |
44 |
45 | include
46 | #alist
47 |
48 |
49 | include
50 | #blist
51 |
52 |
53 | include
54 | #letter
55 |
56 |
57 | name
58 | alist
59 | while
60 | a
61 |
62 | blist
63 |
64 | begin
65 | B
66 | patterns
67 |
68 |
69 | include
70 | #alist
71 |
72 |
73 | include
74 | #blist
75 |
76 |
77 | include
78 | #number
79 |
80 |
81 | name
82 | blist
83 | whileCaptures
84 |
85 | 2
86 |
87 | name
88 | bstart
89 |
90 |
91 | while
92 | (^|\G)(b)
93 |
94 |
95 | scopeName
96 | text.whileLang
97 | uuid
98 | 159375af-d9b4-448c-a9da-d235eadf3556
99 |
100 |
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/scopes/types.h:
--------------------------------------------------------------------------------
1 | #ifndef SCOPES_TYPES__H
2 | #define SCOPES_TYPES__H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "../parser/defines.h"
9 |
10 | namespace scope {
11 | struct scope_t;
12 |
13 | std::string text_format(const char* format, ...);
14 |
15 | namespace types {
16 | struct any_t {
17 | virtual ~any_t() {}
18 | virtual bool does_match(scope::scope_t const& lhs, scope::scope_t const& rhs,
19 | double* rank) const = 0;
20 | virtual std::string to_s() const = 0;
21 | };
22 |
23 | typedef std::shared_ptr any_ptr;
24 |
25 | struct scope_t {
26 | scope_t()
27 | : anchor_to_previous(false)
28 | {
29 | }
30 | std::string atoms;
31 | bool anchor_to_previous;
32 | };
33 |
34 | struct path_t : any_t {
35 | // WATCH_LEAKS(path_t);
36 |
37 | path_t()
38 | : anchor_to_bol(false)
39 | , anchor_to_eol(false)
40 | {
41 | }
42 | std::vector scopes;
43 | bool anchor_to_bol;
44 | bool anchor_to_eol;
45 |
46 | bool does_match(scope::scope_t const& lhs, scope::scope_t const& rhs,
47 | double* rank) const;
48 | std::string to_s() const;
49 | };
50 |
51 | struct expression_t {
52 | expression_t(char op)
53 | : op((op_t)op)
54 | , negate(false)
55 | {
56 | }
57 | enum op_t { op_none,
58 | op_or = '|',
59 | op_and = '&',
60 | op_minus = '-' } op;
61 | bool negate;
62 | any_ptr selector;
63 |
64 | bool does_match(scope::scope_t const& lhs, scope::scope_t const& rhs,
65 | double* rank) const;
66 | };
67 |
68 | struct composite_t {
69 | std::vector expressions;
70 |
71 | bool does_match(scope::scope_t const& lhs, scope::scope_t const& rhs,
72 | double* rank) const;
73 | };
74 |
75 | struct selector_t {
76 | // WATCH_LEAKS(selector_t);
77 |
78 | std::vector composites;
79 |
80 | bool does_match(scope::scope_t const& lhs, scope::scope_t const& rhs,
81 | double* rank) const;
82 | };
83 |
84 | struct group_t : any_t {
85 | // WATCH_LEAKS(group_t);
86 |
87 | selector_t selector;
88 |
89 | bool does_match(scope::scope_t const& lhs, scope::scope_t const& rhs,
90 | double* rank) const;
91 | std::string to_s() const;
92 | };
93 |
94 | struct filter_t : any_t {
95 | // WATCH_LEAKS(filter_t);
96 |
97 | filter_t()
98 | : filter(unset)
99 | {
100 | }
101 | enum side_t { unset,
102 | left = 'L',
103 | right = 'R',
104 | both = 'B' } filter;
105 | any_ptr selector;
106 |
107 | bool does_match(scope::scope_t const& lhs, scope::scope_t const& rhs,
108 | double* rank) const;
109 | std::string to_s() const;
110 | };
111 |
112 | std::string to_s(selector_t const& selector);
113 |
114 | } // namespace types
115 |
116 | } // namespace scope
117 |
118 | #endif
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/parser/private.h:
--------------------------------------------------------------------------------
1 | #ifndef PARSE_PRIVATE_H
2 | #define PARSE_PRIVATE_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "defines.h"
9 | #include "pattern.h"
10 | #include "scope.h"
11 |
12 | namespace parse {
13 |
14 | struct rule_t;
15 |
16 | typedef std::shared_ptr rule_ptr;
17 | typedef std::weak_ptr rule_weak_ptr;
18 | typedef std::map repository_t;
19 | typedef std::shared_ptr repository_ptr;
20 |
21 | struct rule_t {
22 |
23 | static size_t rule_id_counter;
24 |
25 | rule_t()
26 | : rule_id(++rule_id_counter)
27 | , include_string(NULL_STR)
28 | , scope_string(NULL_STR)
29 | , content_scope_string(NULL_STR)
30 | , match_string(NULL_STR)
31 | , while_string(NULL_STR)
32 | , end_string(NULL_STR)
33 | , apply_end_last(NULL_STR)
34 | {
35 | }
36 |
37 | size_t rule_id;
38 |
39 | bool operator==(rule_t const& rhs) const { return rule_id == rhs.rule_id; }
40 | bool operator!=(rule_t const& rhs) const { return rule_id != rhs.rule_id; }
41 |
42 | std::string include_string;
43 |
44 | std::string scope_string;
45 | std::string content_scope_string;
46 |
47 | std::string match_string;
48 | std::string while_string;
49 | std::string end_string;
50 |
51 | std::string apply_end_last;
52 |
53 | std::vector children;
54 | repository_ptr captures;
55 | repository_ptr begin_captures;
56 | repository_ptr while_captures;
57 | repository_ptr end_captures;
58 | repository_ptr repository;
59 | repository_ptr injection_rules;
60 | std::vector> injections;
61 |
62 | // =======================
63 | // = Pre-parsed versions =
64 | // =======================
65 |
66 | rule_t* include = nullptr;
67 |
68 | regexp::pattern_t match_pattern;
69 | regexp::pattern_t while_pattern;
70 | regexp::pattern_t end_pattern;
71 | bool match_pattern_is_anchored = false;
72 |
73 | // =================
74 | // = Mutable State =
75 | // =================
76 |
77 | bool included = false;
78 | bool is_root = false;
79 | };
80 |
81 | struct stack_t;
82 |
83 | typedef std::shared_ptr stack_ptr;
84 |
85 | struct stack_t {
86 |
87 | stack_t(rule_t* rule, scope::scope_t const& scope,
88 | stack_ptr const& parent = stack_ptr())
89 | : parent(parent)
90 | , rule(rule)
91 | , scope(scope)
92 | , anchor(0)
93 | {
94 | }
95 |
96 | stack_ptr parent;
97 |
98 | rule_t* rule; // the rule supplying patterns for current context
99 | scope::scope_t scope; // the scope of the current context
100 |
101 | std::string scope_string = NULL_STR; // expanded version of rule->scope_string
102 | std::string content_scope_string = NULL_STR; // expanded version of rule->content_scope_string
103 |
104 | regexp::pattern_t while_pattern; // a while-pattern active in current
105 | regexp::pattern_t end_pattern; // the end-pattern which exits
106 | // this context
107 | size_t anchor;
108 | bool zw_begin_match;
109 | bool apply_end_last;
110 |
111 | bool operator==(stack_t const& rhs) const;
112 | bool operator!=(stack_t const& rhs) const;
113 | };
114 |
115 | } // namespace parse
116 |
117 | #endif
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.ts:
--------------------------------------------------------------------------------
1 | /* Game of Life
2 | * Implemented in TypeScript
3 | * To learn more about TypeScript, please visit http://www.typescriptlang.org/
4 | */
5 |
6 | module Conway {
7 |
8 | export class Cell {
9 | public row: number;
10 | public col: number;
11 | public live: boolean;
12 |
13 | constructor(row: number, col: number, live: boolean) {
14 | this.row = row;
15 | this.col = col;
16 | this.live = live
17 | }
18 | }
19 |
20 | export class GameOfLife {
21 | private gridSize: number;
22 | private canvasSize: number;
23 | private lineColor: string;
24 | private liveColor: string;
25 | private deadColor: string;
26 | private initialLifeProbability: number;
27 | private animationRate: number;
28 | private cellSize: number;
29 | private world;
30 |
31 |
32 | constructor() {
33 | this.gridSize = 50;
34 | this.canvasSize = 600;
35 | this.lineColor = '#cdcdcd';
36 | this.liveColor = '#666';
37 | this.deadColor = '#eee';
38 | this.initialLifeProbability = 0.5;
39 | this.animationRate = 60;
40 | this.cellSize = 0;
41 | this.world = this.createWorld();
42 | this.circleOfLife();
43 | }
44 |
45 | public createWorld() {
46 | return this.travelWorld( (cell : Cell) => {
47 | cell.live = Math.random() < this.initialLifeProbability;
48 | return cell;
49 | });
50 | }
51 |
52 | public circleOfLife() : void {
53 | this.world = this.travelWorld( (cell: Cell) => {
54 | cell = this.world[cell.row][cell.col];
55 | this.draw(cell);
56 | return this.resolveNextGeneration(cell);
57 | });
58 | setTimeout( () => {this.circleOfLife()}, this.animationRate);
59 | }
60 |
61 | public resolveNextGeneration(cell : Cell) {
62 | var count = this.countNeighbors(cell);
63 | var newCell = new Cell(cell.row, cell.col, cell.live);
64 | if(count < 2 || count > 3) newCell.live = false;
65 | else if(count == 3) newCell.live = true;
66 | return newCell;
67 | }
68 |
69 | public countNeighbors(cell : Cell) {
70 | var neighbors = 0;
71 | for(var row = -1; row <=1; row++) {
72 | for(var col = -1; col <= 1; col++) {
73 | if(row == 0 && col == 0) continue;
74 | if(this.isAlive(cell.row + row, cell.col + col)) {
75 | neighbors++;
76 | }
77 | }
78 | }
79 | return neighbors;
80 | }
81 |
82 | public isAlive(row : number, col : number) {
83 | if(row < 0 || col < 0 || row >= this.gridSize || col >= this.gridSize) return false;
84 | return this.world[row][col].live;
85 | }
86 |
87 | public travelWorld(callback) {
88 | var result = [];
89 | for(var row = 0; row < this.gridSize; row++) {
90 | var rowData = [];
91 | for(var col = 0; col < this.gridSize; col++) {
92 | rowData.push(callback(new Cell(row, col, false)));
93 | }
94 | result.push(rowData);
95 | }
96 | return result;
97 | }
98 |
99 | public draw(cell : Cell) {
100 | if(this.cellSize == 0) this.cellSize = this.canvasSize/this.gridSize;
101 |
102 | this.context.strokeStyle = this.lineColor;
103 | this.context.strokeRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);
104 | this.context.fillStyle = cell.live ? this.liveColor : this.deadColor;
105 | this.context.fillRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);
106 | }
107 |
108 | }
109 | }
110 |
111 | var game = new Conway.GameOfLife();
112 |
--------------------------------------------------------------------------------
/libs/tm-parser/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | Language: Cpp
3 | # BasedOnStyle: WebKit
4 | AccessModifierOffset: -4
5 | AlignAfterOpenBracket: DontAlign
6 | AlignConsecutiveAssignments: false
7 | AlignConsecutiveDeclarations: false
8 | AlignEscapedNewlines: Right
9 | AlignOperands: false
10 | AlignTrailingComments: false
11 | AllowAllParametersOfDeclarationOnNextLine: true
12 | AllowShortBlocksOnASingleLine: false
13 | AllowShortCaseLabelsOnASingleLine: false
14 | AllowShortFunctionsOnASingleLine: All
15 | AllowShortIfStatementsOnASingleLine: false
16 | AllowShortLoopsOnASingleLine: false
17 | AlwaysBreakAfterDefinitionReturnType: None
18 | AlwaysBreakAfterReturnType: None
19 | AlwaysBreakBeforeMultilineStrings: false
20 | AlwaysBreakTemplateDeclarations: false
21 | BinPackArguments: true
22 | BinPackParameters: true
23 | BraceWrapping:
24 | AfterClass: false
25 | AfterControlStatement: false
26 | AfterEnum: false
27 | AfterFunction: true
28 | AfterNamespace: false
29 | AfterObjCDeclaration: false
30 | AfterStruct: false
31 | AfterUnion: false
32 | BeforeCatch: false
33 | BeforeElse: false
34 | IndentBraces: false
35 | SplitEmptyFunction: true
36 | SplitEmptyRecord: true
37 | SplitEmptyNamespace: true
38 | BreakBeforeBinaryOperators: All
39 | BreakBeforeBraces: WebKit
40 | BreakBeforeInheritanceComma: false
41 | BreakBeforeTernaryOperators: true
42 | BreakConstructorInitializersBeforeComma: false
43 | BreakConstructorInitializers: BeforeComma
44 | BreakAfterJavaFieldAnnotations: false
45 | BreakStringLiterals: true
46 | ColumnLimit: 0
47 | CommentPragmas: '^ IWYU pragma:'
48 | CompactNamespaces: false
49 | ConstructorInitializerAllOnOneLineOrOnePerLine: false
50 | ConstructorInitializerIndentWidth: 4
51 | ContinuationIndentWidth: 4
52 | Cpp11BracedListStyle: false
53 | DerivePointerAlignment: false
54 | DisableFormat: false
55 | ExperimentalAutoDetectBinPacking: false
56 | FixNamespaceComments: false
57 | ForEachMacros:
58 | - foreach
59 | - Q_FOREACH
60 | - BOOST_FOREACH
61 | IncludeCategories:
62 | - Regex: '^"config\.h"'
63 | Priority: -1
64 | # The main header for a source file automatically gets category 0
65 | - Regex: '.*'
66 | Priority: 1
67 | - Regex: '^<.*\.h>'
68 | Priority: 2
69 | IncludeIsMainRegex: '(Test)?$'
70 | IndentCaseLabels: false
71 | IndentWidth: 4
72 | IndentWrappedFunctionNames: false
73 | JavaScriptQuotes: Leave
74 | JavaScriptWrapImports: true
75 | KeepEmptyLinesAtTheStartOfBlocks: true
76 | MacroBlockBegin: ''
77 | MacroBlockEnd: ''
78 | MaxEmptyLinesToKeep: 1
79 | NamespaceIndentation: Inner
80 | ObjCBlockIndentWidth: 4
81 | ObjCSpaceAfterProperty: true
82 | ObjCSpaceBeforeProtocolList: true
83 | PenaltyBreakAssignment: 2
84 | PenaltyBreakBeforeFirstCallParameter: 19
85 | PenaltyBreakComment: 300
86 | PenaltyBreakFirstLessLess: 120
87 | PenaltyBreakString: 1000
88 | PenaltyExcessCharacter: 1000000
89 | PenaltyReturnTypeOnItsOwnLine: 60
90 | PointerAlignment: Left
91 | ReflowComments: true
92 | SortIncludes: true
93 | SortUsingDeclarations: true
94 | SpaceAfterCStyleCast: false
95 | SpaceAfterTemplateKeyword: true
96 | SpaceBeforeAssignmentOperators: true
97 | SpaceBeforeParens: ControlStatements
98 | SpaceInEmptyParentheses: false
99 | SpacesBeforeTrailingComments: 1
100 | SpacesInAngles: false
101 | SpacesInContainerLiterals: true
102 | SpacesInCStyleCastParentheses: false
103 | SpacesInParentheses: false
104 | SpacesInSquareBrackets: false
105 | Standard: Cpp11
106 | TabWidth: 4
107 | UseTab: Never
108 | ...
109 |
110 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/syntaxes/cshtml.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ASP.NET Razor",
3 | "scopeName": "text.html.cshtml",
4 | "fileTypes": [
5 | "cshtml",
6 | "gohtml"
7 | ],
8 | "patterns": [
9 | {
10 | "name": "section.embedded.source.cshtml",
11 | "begin": "(@?([a-zA-Z0-9]+)?)(\\s[a-zA-Z0-9]+)?(\n|\r)?(\\{)",
12 | "beginCaptures": {
13 | "0": {
14 | "name": "punctuation.section.embedded.begin.cshtml"
15 | },
16 | "1": {
17 | "name": "keyword.control.cshtml"
18 | }
19 | },
20 | "patterns": [
21 | {
22 | "name": "section.embedded.source.cshtml",
23 | "begin": "(@?([a-zA-Z0-9]+)?)(\\s[a-zA-Z0-9]+)?(\n|\r)?(\\{)",
24 | "beginCaptures": {
25 | "0": {
26 | "name": "punctuation.section.embedded.begin.cshtml"
27 | },
28 | "1": {
29 | "name": "keyword.control.cshtml"
30 | }
31 | },
32 | "patterns": [
33 | {
34 | "name": "string.quoted.single.cshtml",
35 | "match": "'"
36 | },
37 | {
38 | "include": "#embedded-code"
39 | },
40 | {
41 | "include": "#comments"
42 | },
43 | {
44 | "include": "source.cs"
45 | },
46 | {
47 | "include": "text.html.basic"
48 | }
49 | ],
50 | "end": "\\}",
51 | "endCaptures": {
52 | "0": {
53 | "name": "punctuation.section.embedded.begin.cshtml"
54 | }
55 | }
56 | },
57 | {
58 | "name": "string.quoted.single.cshtml",
59 | "match": "'"
60 | },
61 | {
62 | "include": "#embedded-code"
63 | },
64 | {
65 | "include": "#comments"
66 | },
67 | {
68 | "include": "text.html.basic"
69 | }
70 | ],
71 | "end": "\\}",
72 | "endCaptures": {
73 | "0": {
74 | "name": "punctuation.section.embedded.begin.cshtml"
75 | }
76 | },
77 | "comments": "Simple multi-line code section"
78 | },
79 | {
80 | "begin": "(@[a-zA-Z0-9]+)(\\s?)",
81 | "captures": {
82 | "0": {
83 | "name": "section.embedded.begin.cshtml"
84 | },
85 | "1": {
86 | "name": "keyword.control.cshtml"
87 | }
88 | },
89 | "patterns": [
90 | {
91 | "match": "(([a-zA-Z0-9]+)(\\.)?)+?",
92 | "captures": {
93 | "2": {
94 | "name": "entity.name.tag.source.cshtml"
95 | },
96 | "3": {
97 | "name": "punctuation.separator.namespace.source.cshtml"
98 | }
99 | }
100 | },
101 | {
102 | "include": "#embedded-code"
103 | },
104 | {
105 | "include": "#comments"
106 | },
107 | {
108 | "include": "source.cs"
109 | },
110 | {
111 | "include": "text.html.basic"
112 | }
113 | ],
114 | "end": "(\\n|\\s)",
115 | "comments": "Covers single line Razor tags"
116 | },
117 | {
118 | "include": "#comments"
119 | },
120 | {
121 | "include": "text.html.basic"
122 | }
123 | ],
124 | "repository": {
125 | "embedded-code": {
126 | "match": "(@?[a-zA-Z0-9]+)(\\.([a-zA-Z0-9]+))?",
127 | "captures": {
128 | "1": {
129 | "name": "keyword.control.cshtml"
130 | },
131 | "3": {
132 | "name": "entity.name.tag.source.cshtml"
133 | }
134 | },
135 | "patterns": [
136 | {
137 | "include": "#comments"
138 | }
139 | ]
140 | },
141 | "comments": {
142 | "begin": "@\\*",
143 | "captures": {
144 | "0": {
145 | "name": "punctuation.definition.comment.source.cshtml"
146 | }
147 | },
148 | "end": "\\*@",
149 | "name": "comment.block.cshtml"
150 | }
151 | },
152 | "version": "https://github.com/demyte/language-cshtml/commit/a49735dc7aef56ae772a3bcfd8e42c89895dcff4"
153 | }
--------------------------------------------------------------------------------
/libs/Onigmo/enc/windows_31j.c:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | windows_31j.c - Onigmo (Oniguruma-mod) (regular expression library)
3 | **********************************************************************/
4 | /*-
5 | * Copyright (c) 2002-2009 K.Kosako
6 | * Copyright (c) 2011 K.Takata
7 | * All rights reserved.
8 | *
9 | * Redistribution and use in source and binary forms, with or without
10 | * modification, are permitted provided that the following conditions
11 | * are met:
12 | * 1. Redistributions of source code must retain the above copyright
13 | * notice, this list of conditions and the following disclaimer.
14 | * 2. Redistributions in binary form must reproduce the above copyright
15 | * notice, this list of conditions and the following disclaimer in the
16 | * documentation and/or other materials provided with the distribution.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 | * SUCH DAMAGE.
29 | */
30 |
31 | #define ENC_CP932
32 | #include "shift_jis.h"
33 |
34 | OnigEncodingDefine(windows_31j, Windows_31J) = {
35 | mbc_enc_len,
36 | "Windows-31J", /* name */
37 | 2, /* max byte length */
38 | 1, /* min byte length */
39 | onigenc_is_mbc_newline_0x0a,
40 | mbc_to_code,
41 | code_to_mbclen,
42 | code_to_mbc,
43 | mbc_case_fold,
44 | apply_all_case_fold,
45 | get_case_fold_codes_by_str,
46 | property_name_to_ctype,
47 | is_code_ctype,
48 | get_ctype_code_range,
49 | left_adjust_char_head,
50 | is_allowed_reverse_match,
51 | #ifdef USE_CASE_MAP_API
52 | onigenc_ascii_only_case_map,
53 | #else
54 | NULL,
55 | #endif
56 | 0,
57 | ONIGENC_FLAG_NONE,
58 | };
59 | /*
60 | * Name: Windows-31J
61 | * MIBenum: 2024
62 | * Link: http://www.iana.org/assignments/character-sets
63 | * Link: http://www.microsoft.com/globaldev/reference/dbcs/932.mspx
64 | * Link: http://ja.wikipedia.org/wiki/Windows-31J
65 | * Link: http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/windows-932-2000.ucm
66 | *
67 | * Windows Standard Character Set and its mapping to Unicode by Microsoft.
68 | * Since 1.9.3, SJIS is the alias of Windows-31J because its character
69 | * set is usually this one even if its mapping may differ.
70 | */
71 | ENC_ALIAS("CP932", "Windows-31J")
72 | ENC_ALIAS("csWindows31J", "Windows-31J") /* IANA. IE6 don't accept Windows-31J but csWindows31J. */
73 | ENC_ALIAS("SJIS", "Windows-31J")
74 |
75 | /*
76 | * Name: PCK
77 | * Link: http://download.oracle.com/docs/cd/E19253-01/819-0606/x-2chn0/index.html
78 | * Link: http://download.oracle.com/docs/cd/E19253-01/819-0606/appb-pckwarn-1/index.html
79 | *
80 | * Solaris's SJIS variant. Its set is Windows Standard Character Set; it
81 | * consists JIS X 0201 Latin (US-ASCII), JIS X 0201 Katakana, JIS X 0208, NEC
82 | * special characters, NEC-selected IBM extended characters, and IBM extended
83 | * characters. Solaris's iconv seems to use SJIS-open.
84 | */
85 | ENC_ALIAS("PCK", "Windows-31J")
86 |
--------------------------------------------------------------------------------
/libs/Onigmo/onigmognu.h:
--------------------------------------------------------------------------------
1 | #ifndef ONIGMOGNU_H
2 | #define ONIGMOGNU_H
3 | /**********************************************************************
4 | onigmognu.h - Onigmo (Oniguruma-mod) (regular expression library)
5 | **********************************************************************/
6 | /*-
7 | * Copyright (c) 2002-2005 K.Kosako
8 | * Copyright (c) 2011-2016 K.Takata
9 | * All rights reserved.
10 | *
11 | * Redistribution and use in source and binary forms, with or without
12 | * modification, are permitted provided that the following conditions
13 | * are met:
14 | * 1. Redistributions of source code must retain the above copyright
15 | * notice, this list of conditions and the following disclaimer.
16 | * 2. Redistributions in binary form must reproduce the above copyright
17 | * notice, this list of conditions and the following disclaimer in the
18 | * documentation and/or other materials provided with the distribution.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 | * SUCH DAMAGE.
31 | */
32 |
33 | #include "onigmo.h"
34 |
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 | #define RE_MBCTYPE_ASCII 0
40 | #define RE_MBCTYPE_EUC 1
41 | #define RE_MBCTYPE_SJIS 2
42 | #define RE_MBCTYPE_UTF8 3
43 |
44 | /* GNU regex options */
45 | #ifndef RE_NREGS
46 | #define RE_NREGS ONIG_NREGION
47 | #endif
48 |
49 | #define RE_OPTION_IGNORECASE ONIG_OPTION_IGNORECASE
50 | #define RE_OPTION_EXTENDED ONIG_OPTION_EXTEND
51 | #define RE_OPTION_MULTILINE ONIG_OPTION_MULTILINE
52 | #define RE_OPTION_SINGLELINE ONIG_OPTION_SINGLELINE
53 | #define RE_OPTION_LONGEST ONIG_OPTION_FIND_LONGEST
54 | #define RE_OPTION_POSIXLINE (RE_OPTION_MULTILINE|RE_OPTION_SINGLELINE)
55 | #define RE_OPTION_FIND_NOT_EMPTY ONIG_OPTION_FIND_NOT_EMPTY
56 | #define RE_OPTION_NEGATE_SINGLELINE ONIG_OPTION_NEGATE_SINGLELINE
57 | #define RE_OPTION_DONT_CAPTURE_GROUP ONIG_OPTION_DONT_CAPTURE_GROUP
58 | #define RE_OPTION_CAPTURE_GROUP ONIG_OPTION_CAPTURE_GROUP
59 |
60 |
61 | ONIG_EXTERN
62 | void re_mbcinit(int);
63 | ONIG_EXTERN
64 | int re_compile_pattern(const char*, int, struct re_pattern_buffer*, char* err_buf);
65 | ONIG_EXTERN
66 | int re_recompile_pattern(const char*, int, struct re_pattern_buffer*, char* err_buf);
67 | ONIG_EXTERN
68 | void re_free_pattern(struct re_pattern_buffer*);
69 | ONIG_EXTERN
70 | int re_adjust_startpos(struct re_pattern_buffer*, const char*, int, int, int);
71 | ONIG_EXTERN
72 | int re_search(struct re_pattern_buffer*, const char*, int, int, int, struct re_registers*);
73 | ONIG_EXTERN
74 | int re_match(struct re_pattern_buffer*, const char *, int, int, struct re_registers*);
75 | ONIG_EXTERN
76 | void re_set_casetable(const char*);
77 | ONIG_EXTERN
78 | void re_free_registers(struct re_registers*);
79 | ONIG_EXTERN
80 | int re_alloc_pattern(struct re_pattern_buffer**); /* added */
81 |
82 | #ifdef __cplusplus
83 | }
84 | #endif
85 |
86 | #endif /* ONIGMOGNU_H */
87 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/html-erb.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes": [
3 | "erb",
4 | "rhtml",
5 | "html.erb"
6 | ],
7 | "injections": {
8 | "text.html.erb - (meta.embedded.block.erb | meta.embedded.line.erb | meta.tag | comment), meta.tag string.quoted": {
9 | "patterns": [
10 | {
11 | "begin": "(^\\s*)(?=<%+#(?![^%]*%>))",
12 | "beginCaptures": {
13 | "0": {
14 | "name": "punctuation.whitespace.comment.leading.erb"
15 | }
16 | },
17 | "end": "(?!\\G)(\\s*$\\n)?",
18 | "endCaptures": {
19 | "0": {
20 | "name": "punctuation.whitespace.comment.trailing.erb"
21 | }
22 | },
23 | "patterns": [
24 | {
25 | "include": "#comment"
26 | }
27 | ]
28 | },
29 | {
30 | "begin": "(^\\s*)(?=<%(?![^%]*%>))",
31 | "beginCaptures": {
32 | "0": {
33 | "name": "punctuation.whitespace.embedded.leading.erb"
34 | }
35 | },
36 | "end": "(?!\\G)(\\s*$\\n)?",
37 | "endCaptures": {
38 | "0": {
39 | "name": "punctuation.whitespace.embedded.trailing.erb"
40 | }
41 | },
42 | "patterns": [
43 | {
44 | "include": "#tags"
45 | }
46 | ]
47 | },
48 | {
49 | "include": "#comment"
50 | },
51 | {
52 | "include": "#tags"
53 | }
54 | ]
55 | }
56 | },
57 | "keyEquivalent": "^~H",
58 | "name": "HTML (Ruby - ERB)",
59 | "patterns": [
60 | {
61 | "include": "text.html.basic"
62 | }
63 | ],
64 | "repository": {
65 | "comment": {
66 | "patterns": [
67 | {
68 | "begin": "<%+#",
69 | "beginCaptures": {
70 | "0": {
71 | "name": "punctuation.definition.comment.begin.erb"
72 | }
73 | },
74 | "end": "%>",
75 | "endCaptures": {
76 | "0": {
77 | "name": "punctuation.definition.comment.end.erb"
78 | }
79 | },
80 | "name": "comment.block.erb"
81 | }
82 | ]
83 | },
84 | "tags": {
85 | "patterns": [
86 | {
87 | "begin": "<%+(?!>)[-=]?(?![^%]*%>)",
88 | "beginCaptures": {
89 | "0": {
90 | "name": "punctuation.section.embedded.begin.erb"
91 | }
92 | },
93 | "contentName": "source.ruby",
94 | "end": "(-?%)>",
95 | "endCaptures": {
96 | "0": {
97 | "name": "punctuation.section.embedded.end.erb"
98 | },
99 | "1": {
100 | "name": "source.ruby"
101 | }
102 | },
103 | "name": "meta.embedded.block.erb",
104 | "patterns": [
105 | {
106 | "captures": {
107 | "1": {
108 | "name": "punctuation.definition.comment.erb"
109 | }
110 | },
111 | "match": "(#).*?(?=-?%>)",
112 | "name": "comment.line.number-sign.erb"
113 | },
114 | {
115 | "include": "source.ruby"
116 | }
117 | ]
118 | },
119 | {
120 | "begin": "<%+(?!>)[-=]?",
121 | "beginCaptures": {
122 | "0": {
123 | "name": "punctuation.section.embedded.begin.erb"
124 | }
125 | },
126 | "contentName": "source.ruby",
127 | "end": "(-?%)>",
128 | "endCaptures": {
129 | "0": {
130 | "name": "punctuation.section.embedded.end.erb"
131 | },
132 | "1": {
133 | "name": "source.ruby"
134 | }
135 | },
136 | "name": "meta.embedded.line.erb",
137 | "patterns": [
138 | {
139 | "captures": {
140 | "1": {
141 | "name": "punctuation.definition.comment.erb"
142 | }
143 | },
144 | "match": "(#).*?(?=-?%>)",
145 | "name": "comment.line.number-sign.erb"
146 | },
147 | {
148 | "include": "source.ruby"
149 | }
150 | ]
151 | }
152 | ]
153 | }
154 | },
155 | "scopeName": "text.html.erb"
156 | }
--------------------------------------------------------------------------------
/libs/Onigmo/win32/onigmo.rc:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | onigmo.rc - Onigmo (Oniguruma-mod) (regular expression library)
3 | **********************************************************************/
4 | /*-
5 | * Copyright (c) 2011-2019 K.Takata
6 | * All rights reserved.
7 | *
8 | * Redistribution and use in source and binary forms, with or without
9 | * modification, are permitted provided that the following conditions
10 | * are met:
11 | * 1. Redistributions of source code must retain the above copyright
12 | * notice, this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright
14 | * notice, this list of conditions and the following disclaimer in the
15 | * documentation and/or other materials provided with the distribution.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 | * SUCH DAMAGE.
28 | */
29 |
30 | #include
31 | #include "onigmo.h"
32 |
33 | #define TOSTR_(a) #a
34 | #define ONIG_VERSION_TOSTR_(a,b,c) \
35 | TOSTR_(a) "." TOSTR_(b) "." TOSTR_(c)
36 | #define ONIG_VERSION_STRING \
37 | ONIG_VERSION_TOSTR_(ONIGMO_VERSION_MAJOR, ONIGMO_VERSION_MINOR, ONIGMO_VERSION_TEENY)
38 |
39 |
40 | /////////////////////////////////////////////////////////////////////////////
41 | // English resources
42 |
43 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
44 | #ifdef _WIN32
45 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
46 | #pragma code_page(1252)
47 | #endif //_WIN32
48 |
49 | /////////////////////////////////////////////////////////////////////////////
50 | //
51 | // Version
52 | //
53 |
54 | VS_VERSION_INFO VERSIONINFO
55 | FILEVERSION ONIGMO_VERSION_MAJOR,ONIGMO_VERSION_MINOR,ONIGMO_VERSION_TEENY,0
56 | PRODUCTVERSION ONIGMO_VERSION_MAJOR,ONIGMO_VERSION_MINOR,ONIGMO_VERSION_TEENY,0
57 | FILEFLAGSMASK 0x3fL
58 | #ifdef _DEBUG
59 | FILEFLAGS 0x1L
60 | #else
61 | FILEFLAGS 0x0L
62 | #endif
63 | FILEOS 0x40004L
64 | FILETYPE 0x2L
65 | FILESUBTYPE 0x0L
66 | BEGIN
67 | BLOCK "StringFileInfo"
68 | BEGIN
69 | BLOCK "040904b0"
70 | BEGIN
71 | VALUE "Comments", "\0"
72 | VALUE "CompanyName", " \0"
73 | VALUE "FileDescription", "Onigmo (Oniguruma-mod) (regular expression library)\0"
74 | VALUE "FileVersion", ONIG_VERSION_STRING "\0"
75 | VALUE "InternalName", "onigmo.dll\0"
76 | VALUE "LegalCopyright", "Copyright (C) 2002-2018 K.Kosako, 2011-2019 K.Takata\0"
77 | VALUE "LegalTrademarks", "\0"
78 | VALUE "OriginalFilename", "onigmo.dll\0"
79 | VALUE "PrivateBuild", "\0"
80 | VALUE "ProductName", "Onigmo (Oniguruma-mod)\0"
81 | VALUE "ProductVersion", ONIG_VERSION_STRING "\0"
82 | VALUE "SpecialBuild", "\0"
83 | END
84 | END
85 | BLOCK "VarFileInfo"
86 | BEGIN
87 | VALUE "Translation", 0x0409, 1200
88 | END
89 | END
90 |
91 |
92 |
93 | #endif // English resources
94 | /////////////////////////////////////////////////////////////////////////////
95 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/tests/test.css:
--------------------------------------------------------------------------------
1 | /* css Zen Garden default style v1.02 */
2 | /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */
3 | /* This file based on 'Tranquille' by Dave Shea */
4 | /* You may use this file as a foundation for any new work, but you may find it easier to start from scratch. */
5 | /* Not all elements are defined in this file, so you'll most likely want to refer to the xhtml as well. */
6 | /* Your images should be linked as if the CSS file sits in the same folder as the images. ie. no paths. */
7 | /* basic elements */
8 |
9 | @import "mystyle.css";
10 | @import url("mystyle.css");
11 | @import url("bluish.css") projection, tv;
12 |
13 | .html {
14 | padding: 0;
15 | font-style: 0;
16 | }
17 | body {
18 | font: 75% georgia, sans-serif;
19 | line-height: 1.88889;
20 | color: #555753;
21 | background: #fff url(blossoms.jpg) no-repeat bottom right;
22 | margin: 0;
23 | padding: 0;
24 | background-image: -webkit-linear-gradient(top, start-color, end-color);
25 | background-image: -webkit-gradient(linear, left top, left bottom, from(start-color), to(end-color));
26 | background-image: -moz-linear-gradient(top, start-color, end-color);
27 | background-image: linear-gradient(to bottom, start-color, end-color);
28 | }
29 |
30 | p {
31 | margin-top: 0;
32 | text-align: justify;
33 | }
34 |
35 | h3 {
36 | font: italic normal 1.4em georgia, sans-serif;
37 | letter-spacing: 1px;
38 | margin-bottom: 0;
39 | color: #7D775C;
40 | }
41 |
42 | a:link {
43 | font-weight: bold;
44 | text-decoration: none;
45 | color: #B7A5DF;
46 | }
47 |
48 | a:visited {
49 | font-weight: bold;
50 | text-decoration: none;
51 | color: #D4CDDC;
52 | cursor: pointer;
53 | }
54 |
55 | a:hover,
56 | a:focus,
57 | a:active {
58 | text-decoration: underline;
59 | color: #9685BA;
60 | }
61 |
62 | abbr {
63 | border-bottom: none;
64 | }
65 |
66 |
67 | /* specific divs */
68 |
69 | .page-wrapper {
70 | background: url(zen-bg.jpg) no-repeat top left;
71 | padding: 0 175px 0 110px;
72 | margin: 0;
73 | position: relative;
74 | }
75 |
76 | .intro {
77 | min-width: 470px;
78 | width: 100%;
79 | }
80 |
81 | header h1 {
82 | background: transparent url(h1.gif) no-repeat top left;
83 | margin-top: 10px;
84 | display: block;
85 | width: 219px;
86 | height: 87px;
87 | float: left;
88 | text-indent: 100%;
89 | white-space: nowrap;
90 | overflow: hidden;
91 | }
92 |
93 | header {
94 | padding-top: 20px;
95 | height: 87px;
96 | }
97 |
98 | .summary {
99 | clear: both;
100 | margin: 20px 20px 20px 10px;
101 | width: 160px;
102 | float: left;
103 | }
104 |
105 | .summary p {
106 | font: italic 1.1em/2.2 georgia;
107 | text-align: center;
108 | }
109 |
110 | .preamble {
111 | clear: right;
112 | padding: 0px 10px 0 10px;
113 | }
114 |
115 | .supporting {
116 | padding-left: 10px;
117 | margin-bottom: 40px;
118 | }
119 |
120 | #footer {
121 | text-align: center
122 | }
123 |
124 | footer a:link,
125 | footer a:visited {
126 | margin-right: 20px;
127 | }
128 |
129 | .sidebar {
130 | margin-left: 600px;
131 | position: absolute;
132 | top: 0;
133 | right: 0;
134 | }
135 |
136 | .sidebar .wrapper {
137 | font: 10px verdana, sans-serif;
138 | background: transparent url(paper-bg.jpg) top left repeat-y;
139 | padding: 10px;
140 | margin-top: 150px;
141 | width: 130px;
142 | }
143 |
144 | .sidebar li a:link {
145 | color: #988F5E;
146 | }
147 |
148 | .sidebar li a:visited {
149 | color: '#B3AE94';
150 | }
151 |
152 | .extra1 {
153 | background: transparent url(cr2.gif) top left no-repeat;
154 | position: absolute;
155 | top: 40px;
156 | right: 0;
157 | width: 148px;
158 | height: 110px;
159 | }
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/themes/syntaxes/Dockerfile.tmLanguage:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | fileTypes
6 |
7 | Dockerfile
8 |
9 | name
10 | Dockerfile
11 | patterns
12 |
13 |
14 | captures
15 |
16 | 1
17 |
18 | name
19 | keyword.control.dockerfile
20 |
21 | 2
22 |
23 | name
24 | keyword.other.special-method.dockerfile
25 |
26 |
27 | match
28 | ^\s*(?:(ONBUILD)\s+)?(FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|VOLUME|USER|WORKDIR|COPY|LABEL|STOPSIGNAL|ARG)\s
29 |
30 |
31 | captures
32 |
33 | 1
34 |
35 | name
36 | keyword.operator.dockerfile
37 |
38 | 2
39 |
40 | name
41 | keyword.other.special-method.dockerfile
42 |
43 |
44 | match
45 | ^\s*(?:(ONBUILD)\s+)?(CMD|ENTRYPOINT)\s
46 |
47 |
48 | begin
49 | "
50 | beginCaptures
51 |
52 | 1
53 |
54 | name
55 | punctuation.definition.string.begin.dockerfile
56 |
57 |
58 | end
59 | "
60 | endCaptures
61 |
62 | 1
63 |
64 | name
65 | punctuation.definition.string.end.dockerfile
66 |
67 |
68 | name
69 | string.quoted.double.dockerfile
70 | patterns
71 |
72 |
73 | match
74 | \\.
75 | name
76 | constant.character.escaped.dockerfile
77 |
78 |
79 |
80 |
81 | begin
82 | '
83 | beginCaptures
84 |
85 | 1
86 |
87 | name
88 | punctuation.definition.string.begin.dockerfile
89 |
90 |
91 | end
92 | '
93 | endCaptures
94 |
95 | 1
96 |
97 | name
98 | punctuation.definition.string.end.dockerfile
99 |
100 |
101 | name
102 | string.quoted.single.dockerfile
103 | patterns
104 |
105 |
106 | match
107 | \\.
108 | name
109 | constant.character.escaped.dockerfile
110 |
111 |
112 |
113 |
114 | captures
115 |
116 | 1
117 |
118 | name
119 | punctuation.whitespace.comment.leading.dockerfile
120 |
121 | 2
122 |
123 | name
124 | comment.line.number-sign.dockerfile
125 |
126 | 3
127 |
128 | name
129 | punctuation.definition.comment.dockerfile
130 |
131 |
132 | comment
133 | comment.line
134 | match
135 | ^(\s*)((#).*$\n?)
136 |
137 |
138 | scopeName
139 | source.dockerfile
140 | uuid
141 | a39d8795-59d2-49af-aa00-fe74ee29576e
142 |
143 |
--------------------------------------------------------------------------------
/libs/Onigmo/sample/listcap.c:
--------------------------------------------------------------------------------
1 | /*
2 | * listcap.c
3 | *
4 | * capture history (?@...) sample.
5 | */
6 | #include
7 | #include
8 | #include "onigmo.h"
9 |
10 | static int
11 | node_callback(int group, OnigPosition beg, OnigPosition end, int level,
12 | int at, void* arg)
13 | {
14 | int i;
15 |
16 | if (at != ONIG_TRAVERSE_CALLBACK_AT_FIRST)
17 | return -1; /* error */
18 |
19 | /* indent */
20 | for (i = 0; i < level * 2; i++)
21 | fputc(' ', stderr);
22 |
23 | fprintf(stderr, "%d: (%ld-%ld)\n", group, beg, end);
24 | return 0;
25 | }
26 |
27 | static int
28 | node_callback_last(int group, OnigPosition beg, OnigPosition end, int level,
29 | int at, void* arg)
30 | {
31 | int i;
32 |
33 | if (at != ONIG_TRAVERSE_CALLBACK_AT_LAST)
34 | return -1; /* error */
35 |
36 | /* indent */
37 | for (i = 0; i < level * 2; i++)
38 | fputc(' ', stderr);
39 |
40 | fprintf(stderr, "%d: (%ld-%ld)\n", group, beg, end);
41 | return 0;
42 | }
43 |
44 | extern int ex(unsigned char* str, unsigned char* pattern,
45 | OnigSyntaxType* syntax)
46 | {
47 | int r;
48 | unsigned char *start, *range, *end;
49 | regex_t* reg;
50 | OnigErrorInfo einfo;
51 | OnigRegion *region;
52 |
53 | r = onig_new(®, pattern, pattern + strlen((char* )pattern),
54 | ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, syntax, &einfo);
55 | if (r != ONIG_NORMAL) {
56 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
57 | onig_error_code_to_str(s, r, &einfo);
58 | fprintf(stderr, "ERROR: %s\n", s);
59 | return -1;
60 | }
61 |
62 | fprintf(stderr, "number of captures: %d\n", onig_number_of_captures(reg));
63 | fprintf(stderr, "number of capture histories: %d\n",
64 | onig_number_of_capture_histories(reg));
65 |
66 | region = onig_region_new();
67 |
68 | end = str + strlen((char* )str);
69 | start = str;
70 | range = end;
71 | r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE);
72 | if (r >= 0) {
73 | int i;
74 |
75 | fprintf(stderr, "match at %d\n", r);
76 | for (i = 0; i < region->num_regs; i++) {
77 | fprintf(stderr, "%d: (%ld-%ld)\n", i, region->beg[i], region->end[i]);
78 | }
79 | fprintf(stderr, "\n");
80 |
81 | r = onig_capture_tree_traverse(region, ONIG_TRAVERSE_CALLBACK_AT_FIRST,
82 | node_callback, (void* )0);
83 | fprintf(stderr, "\n");
84 |
85 | r = onig_capture_tree_traverse(region, ONIG_TRAVERSE_CALLBACK_AT_LAST,
86 | node_callback_last, (void* )0);
87 | fprintf(stderr, "\n");
88 | }
89 | else if (r == ONIG_MISMATCH) {
90 | fprintf(stderr, "search fail\n");
91 | }
92 | else { /* error */
93 | OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN];
94 | onig_error_code_to_str(s, r);
95 | return -1;
96 | }
97 |
98 | onig_region_free(region, 1 /* 1:free self, 0:free contents only */);
99 | onig_free(reg);
100 | return 0;
101 | }
102 |
103 |
104 | extern int main(int argc, char* argv[])
105 | {
106 | int r = 0;
107 | OnigSyntaxType syn;
108 |
109 | static UChar* str1 = (UChar* )"((())())";
110 | static UChar* pattern1
111 | = (UChar* )"\\g(?@
\\(\\g\\)){0}(?@(?:\\g
)*|){0}";
112 |
113 | static UChar* str2 = (UChar* )"x00x00x00";
114 | static UChar* pattern2 = (UChar* )"(?@x(?@\\d+))+";
115 |
116 | static UChar* str3 = (UChar* )"0123";
117 | static UChar* pattern3 = (UChar* )"(?@.)(?@.)(?@.)(?@.)";
118 |
119 | static UChar* str4 = (UChar* )"((abc)(abc))";
120 | static UChar* pattern4 = (UChar* )"\\((?@(?:[^(]|\\g<0>)*)\\)";
121 |
122 | /* enable capture hostory */
123 | onig_copy_syntax(&syn, ONIG_SYNTAX_DEFAULT);
124 | onig_set_syntax_op2(&syn,
125 | onig_get_syntax_op2(&syn) | ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY);
126 |
127 | r |= ex(str1, pattern1, &syn);
128 | r |= ex(str2, pattern2, &syn);
129 | r |= ex(str3, pattern3, &syn);
130 | r |= ex(str4, pattern4, &syn);
131 |
132 | onig_end();
133 | return r;
134 | }
135 |
--------------------------------------------------------------------------------
/libs/tm-parser/test-cases/first-mate/fixtures/javascript-regex.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileTypes": [],
3 | "hideFromUser": true,
4 | "name": "Regular Expressions (JavaScript)",
5 | "patterns": [
6 | {
7 | "include": "#regexp"
8 | }
9 | ],
10 | "repository": {
11 | "regex-character-class": {
12 | "patterns": [
13 | {
14 | "match": "\\\\[wWsSdD]|\\.",
15 | "name": "constant.character.character-class.regexp"
16 | },
17 | {
18 | "match": "\\\\([0-7]{3}|x\\h\\h|u\\h\\h\\h\\h)",
19 | "name": "constant.character.numeric.regexp"
20 | },
21 | {
22 | "match": "\\\\c[A-Z]",
23 | "name": "constant.character.control.regexp"
24 | },
25 | {
26 | "match": "\\\\.",
27 | "name": "constant.character.escape.backslash.regexp"
28 | }
29 | ]
30 | },
31 | "regexp": {
32 | "patterns": [
33 | {
34 | "match": "\\\\[bB]|\\^|\\$",
35 | "name": "keyword.control.anchor.regexp"
36 | },
37 | {
38 | "match": "\\\\[1-9]\\d*",
39 | "name": "keyword.other.back-reference.regexp"
40 | },
41 | {
42 | "match": "[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??",
43 | "name": "keyword.operator.quantifier.regexp"
44 | },
45 | {
46 | "match": "\\|",
47 | "name": "keyword.operator.or.regexp"
48 | },
49 | {
50 | "begin": "(\\()((\\?=)|(\\?!))",
51 | "beginCaptures": {
52 | "1": {
53 | "name": "punctuation.definition.group.regexp"
54 | },
55 | "3": {
56 | "name": "meta.assertion.look-ahead.regexp"
57 | },
58 | "4": {
59 | "name": "meta.assertion.negative-look-ahead.regexp"
60 | }
61 | },
62 | "end": "(\\))",
63 | "endCaptures": {
64 | "1": {
65 | "name": "punctuation.definition.group.regexp"
66 | }
67 | },
68 | "name": "meta.group.assertion.regexp",
69 | "patterns": [
70 | {
71 | "include": "#regexp"
72 | }
73 | ]
74 | },
75 | {
76 | "begin": "\\((\\?:)?",
77 | "beginCaptures": {
78 | "0": {
79 | "name": "punctuation.definition.group.regexp"
80 | }
81 | },
82 | "end": "\\)",
83 | "endCaptures": {
84 | "0": {
85 | "name": "punctuation.definition.group.regexp"
86 | }
87 | },
88 | "name": "meta.group.regexp",
89 | "patterns": [
90 | {
91 | "include": "#regexp"
92 | }
93 | ]
94 | },
95 | {
96 | "begin": "(\\[)(\\^)?",
97 | "beginCaptures": {
98 | "1": {
99 | "name": "punctuation.definition.character-class.regexp"
100 | },
101 | "2": {
102 | "name": "keyword.operator.negation.regexp"
103 | }
104 | },
105 | "end": "(\\])",
106 | "endCaptures": {
107 | "1": {
108 | "name": "punctuation.definition.character-class.regexp"
109 | }
110 | },
111 | "name": "constant.other.character-class.set.regexp",
112 | "patterns": [
113 | {
114 | "captures": {
115 | "1": {
116 | "name": "constant.character.numeric.regexp"
117 | },
118 | "2": {
119 | "name": "constant.character.control.regexp"
120 | },
121 | "3": {
122 | "name": "constant.character.escape.backslash.regexp"
123 | },
124 | "4": {
125 | "name": "constant.character.numeric.regexp"
126 | },
127 | "5": {
128 | "name": "constant.character.control.regexp"
129 | },
130 | "6": {
131 | "name": "constant.character.escape.backslash.regexp"
132 | }
133 | },
134 | "match": "(?:.|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))",
135 | "name": "constant.other.character-class.range.regexp"
136 | },
137 | {
138 | "include": "#regex-character-class"
139 | }
140 | ]
141 | },
142 | {
143 | "include": "#regex-character-class"
144 | }
145 | ]
146 | }
147 | },
148 | "scopeName": "source.js.regexp"
149 | }
--------------------------------------------------------------------------------
/libs/tm-parser/textmate/parser/pattern.h:
--------------------------------------------------------------------------------
1 | #ifndef PARSE_PATTERN_H
2 | #define PARSE_PATTERN_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "defines.h"
9 | #include "onigmognu.h"
10 |
11 | std::map extract_captures(OnigUChar const* buffer,
12 | OnigRegion const* match,
13 | OnigRegex regexp);
14 |
15 | namespace regexp {
16 | typedef std::shared_ptr regex_ptr;
17 | typedef std::shared_ptr region_ptr;
18 |
19 | struct match_t;
20 | struct pattern_t;
21 |
22 | struct match_t {
23 | private:
24 | region_ptr region;
25 | regex_ptr compiled_pattern;
26 | char const* buf;
27 |
28 | mutable std::shared_ptr>
29 | captured_variables;
30 | mutable std::shared_ptr>>
31 | captured_indices;
32 |
33 | friend match_t search(pattern_t const& ptrn, char const* first,
34 | char const* last, char const* from, char const* to,
35 | OnigOptionType options);
36 | match_t(region_ptr const& region, regex_ptr const& compiled_pattern,
37 | char const* buf)
38 | : region(region)
39 | , compiled_pattern(compiled_pattern)
40 | , buf(buf)
41 | {
42 | }
43 |
44 | public:
45 | match_t()
46 | : buf(NULL)
47 | {
48 | }
49 |
50 | int size() const { return region ? region->num_regs : 0; }
51 | bool empty(int i = 0) const { return begin(i) == end(i); }
52 |
53 | bool did_match(int i = 0) const { return i < size() && region->beg[i] != -1; }
54 |
55 | explicit operator bool() const { return did_match(); }
56 |
57 | char const* buffer() const { return buf; }
58 |
59 | size_t begin() const
60 | {
61 | return did_match() ? (size_t)region->beg[0] : SIZE_T_MAX;
62 | }
63 | size_t end() const
64 | {
65 | return did_match() ? (size_t)region->end[0] : SIZE_T_MAX;
66 | }
67 | size_t begin(int i) const
68 | {
69 | return did_match(i) ? (size_t)region->beg[i] : end();
70 | }
71 | size_t end(int i) const
72 | {
73 | return did_match(i) ? (size_t)region->end[i] : end();
74 | }
75 |
76 | std::map const& captures() const;
77 | std::multimap> const&
78 | capture_indices() const;
79 | std::string operator[](size_t i) const;
80 | };
81 |
82 | struct pattern_t {
83 | // WATCH_LEAKS(regexp::pattern_t);
84 | private:
85 | regex_ptr compiled_pattern;
86 | std::string pattern_string;
87 | void init(std::string const& pattern, OnigOptionType options);
88 |
89 | friend match_t search(pattern_t const& ptrn, char const* first,
90 | char const* last, char const* from, char const* to,
91 | OnigOptionType options);
92 | regex_ptr get() const { return compiled_pattern; }
93 |
94 | public:
95 | pattern_t()
96 | : pattern_string("(?=un)initialized")
97 | {
98 | }
99 | pattern_t(char const* pattern, OnigOptionType options = ONIG_OPTION_NONE);
100 | pattern_t(std::string const& pattern,
101 | OnigOptionType options = ONIG_OPTION_NONE);
102 | pattern_t(std::string const& pattern, std::string const& str_options);
103 | explicit operator bool() const { return compiled_pattern ? true : false; }
104 |
105 | bool operator==(pattern_t const& rhs) const
106 | {
107 | return pattern_string == rhs.pattern_string;
108 | }
109 | bool operator!=(pattern_t const& rhs) const { return !(*this == rhs); }
110 |
111 | friend std::string to_s(pattern_t const& ptrn);
112 | };
113 |
114 | inline std::string to_s(pattern_t const& ptrn) { return ptrn.pattern_string; }
115 |
116 | std::string validate(std::string const& ptrn);
117 | std::string escape(std::string ptrn);
118 | match_t search(pattern_t const& ptrn, char const* first, char const* last,
119 | char const* from = NULL, char const* to = NULL,
120 | OnigOptionType options = ONIG_OPTION_NONE);
121 | match_t search(pattern_t const& ptrn, std::string const& str);
122 |
123 | } // namespace regexp
124 |
125 | #endif
--------------------------------------------------------------------------------
{{title}}
6 |{{./name}} or {{this/name}} or {{this.name}}
9 |