Skip to content

Commit

Permalink
Merge pull request #1 from iceflow19/master
Browse files Browse the repository at this point in the history
Reformatting, Preliminary Code Completion, and Snippets for Preprocessor Directives
  • Loading branch information
Oldes committed Jan 8, 2015
2 parents f68112c + 993331a commit 41e1a06
Show file tree
Hide file tree
Showing 13 changed files with 378 additions and 83 deletions.
6 changes: 6 additions & 0 deletions #call.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<description>#call</description>
<content><![CDATA[#call [${1:func} ${2:args}]]]></content>
<tabTrigger>pcall</tabTrigger>
<scope>source.red</scope>
</snippet>
6 changes: 6 additions & 0 deletions #define-macro.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<description>#define macro</description>
<content><![CDATA[#define ${1:name}(${2:args}) (${3:})]]></content>
<tabTrigger>pdefm</tabTrigger>
<scope>source.red</scope>
</snippet>
6 changes: 6 additions & 0 deletions #define.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<description>#define</description>
<content><![CDATA[#define ${1:name} ${2:value}]]></content>
<tabTrigger>pdef</tabTrigger>
<scope>source.red</scope>
</snippet>
10 changes: 10 additions & 0 deletions #either.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<snippet>
<description>#either</description>
<content><![CDATA[#either ${1:option} ${2:op} ${3:value} [
][
]]]></content>
<tabTrigger>peither</tabTrigger>
<scope>source.red</scope>
</snippet>
6 changes: 6 additions & 0 deletions #enum.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<description>#enum</description>
<content><![CDATA[#enum ${1:name}! [${2:}]]]></content>
<tabTrigger>penum</tabTrigger>
<scope>source.red</scope>
</snippet>
6 changes: 6 additions & 0 deletions #export.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<description>#export</description>
<content><![CDATA[#export ${1:cconv} [${2:symbols}]]]></content>
<tabTrigger>pexport</tabTrigger>
<scope>source.red</scope>
</snippet>
8 changes: 8 additions & 0 deletions #if.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<description>#if</description>
<content><![CDATA[#if ${1:option} ${2:op} ${3:value} [
${4:}
]]]></content>
<tabTrigger>pif</tabTrigger>
<scope>source.red</scope>
</snippet>
6 changes: 6 additions & 0 deletions #include.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<description>#include</description>
<content><![CDATA[#include %${1:file}]]></content>
<tabTrigger>pinclude</tabTrigger>
<scope>source.red</scope>
</snippet>
16 changes: 16 additions & 0 deletions #switch.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<snippet>
<description>#switch</description>
<content><![CDATA[#switch ${1:option} [
${2:value-1} [
]
${3:value-2} [
]
#default [
]
]]]></content>
<tabTrigger>pswitch</tabTrigger>
<scope>source.red</scope>
</snippet>
8 changes: 8 additions & 0 deletions #system.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<description>#system</description>
<content><![CDATA[#system [
${1:}
]]]></content>
<tabTrigger>psys</tabTrigger>
<scope>source.red</scope>
</snippet>
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Sublime-Red
===========

Sublime Text package for Red language [(www.red-lang.org)](http://www.red-lang.org)
A Sublime Text package for the Red language [(www.red-lang.org)](http://www.red-lang.org)

![Screenshot](https://raw.githubusercontent.com/Oldes/Sublime-Red/preview/preview/screenshot.png)

# Installation

Install using the [SublimeText PackageControl](https://sublime.wbond.net). Otherwise you can also Download/Clone the package and put it in your Packages-directory.
Install using the [SublimeText PackageControl](https://sublime.wbond.net). Otherwise you can also Download/Clone the package and put it in your Packages directory.

# Credits

The syntax rule is based on [RG-Chris TextMate Bundle](http://www.ross-gill.com/page/TextMate_and_REBOL)
The syntax rules are based on [RG-Chris's TextMate Bundle](http://www.ross-gill.com/page/TextMate_and_REBOL)
173 changes: 93 additions & 80 deletions Red.JSON-tmLanguage
Original file line number Diff line number Diff line change
@@ -1,76 +1,86 @@
{ "name": "Red",
"scopeName": "source.red",
"fileTypes": ["reds", "red"],
{
"name": "Red",
"scopeName": "source.red",
"fileTypes": ["reds", "red"],

"firstLineMatch": "^\\s*(Red|Red/System)\\s\\[",
"foldingStartMarker": "^([^;]*[\\[\\{\\(])+\\s*(\\;.*)?$",
"foldingStopMarker": "^\\s*[\\]\\}\\)].*$",
"firstLineMatch": "^\\s*(Red|Red/System)\\s\\[",
"foldingStartMarker": "^([^;]*[\\[\\{\\(])+\\s*(\\;.*)?$",
"foldingStopMarker": "^\\s*[\\]\\}\\)].*$",

"patterns": [
"patterns": [
{"include": "#comments"},
{"include": "#type-literal"},
{"include": "#strings"},
{"include": "#values"},
{"include": "#words"}
],
"repository": {
],

"repository": {

"binary-base-sixtyfour": {
"name": "binary.base64.red",
"begin": "64#\\{",
"beginCaptures": {
"0": { "name": "string.binary.prefix" }
},
"patterns": [
{ "name": "string.binary.base64.red",
"match": "[0-9a-zA-Z+/=\\s]*"
},
{ "name": "invalid.illegal.red",
"match": "."
}
],
"end": "\\}",
"endCaptures": {
"0": { "name": "string.binary.prefix" }
}
},
"binary-base-sixteen": {
"name": "binary.base16.red",
"begin": "(16)?#\\{",
"beginCaptures": {
"0": { "name": "string.binary.prefix" }
},
"patterns": [
{ "name": "string.binary.base16.red",
"match": "[0-9a-fA-F]{2,2}"
},
{ "name": "invalid.illegal.red",
"match": "."
}
],
"end": "\\}",
"endCaptures": {
"0": { "name": "string.binary.prefix" }
}
"name": "binary.base64.red",
"begin": "64#\\{",
"beginCaptures": {
"0": { "name": "string.binary.prefix" }
},
"patterns": [
{
"name": "string.binary.base64.red",
"match": "[0-9a-zA-Z+/=\\s]*"
},
{
"name": "invalid.illegal.red",
"match": "."
}
],
"end": "\\}",
"endCaptures": {
"0": { "name": "string.binary.prefix" }
}
},

"binary-base-sixteen": {
"name": "binary.base16.red",
"begin": "(16)?#\\{",
"beginCaptures": {
"0": { "name": "string.binary.prefix" }
},
"patterns": [
{
"name": "string.binary.base16.red",
"match": "[0-9a-fA-F]{2,2}"
},
{
"name": "invalid.illegal.red",
"match": "."
}
],
"end": "\\}",
"endCaptures": {
"0": { "name": "string.binary.prefix" }
}
},

"binary-base-two": {
"name": "binary.base2.red",
"begin": "2#\\{",
"beginCaptures": {
"0": { "name": "string.binary.prefix" }
},
"patterns": [
{ "name": "string.binary.base2.red",
"match": "([01]\\s*){8}"
},
{ "name": "invalid.illegal.red",
"match": "."
}
],
"end": "\\}",
"endCaptures": {
"0": { "name": "string.binary.prefix" }
}
"name": "binary.base2.red",
"begin": "2#\\{",
"beginCaptures": {
"0": { "name": "string.binary.prefix" }
},
"patterns": [
{
"name": "string.binary.base2.red",
"match": "([01]\\s*){8}"
},
{
"name": "invalid.illegal.red",
"match": "."
}
],
"end": "\\}",
"endCaptures": {
"0": { "name": "string.binary.prefix" }
}
},

"character": {
Expand All @@ -82,8 +92,8 @@
"name": "constant.character.entity.html",
"match": "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)",
"captures": {
"0": { "name": "punctuation.definition.entity.html" },
"2": { "name": "punctuation.definition.entity.html" }
"0": { "name": "punctuation.definition.entity.html" },
"2": { "name": "punctuation.definition.entity.html" }
}
},

Expand All @@ -93,18 +103,18 @@
},

"comment-docline": {
"name": "comment.docline.red",
"match": ";-.*?(?=\\%>|$)"
"name": "comment.docline.red",
"match": ";-.*?(?=\\%>|$)"
},

"comment-todo": {
"name": "comment.todo.red",
"match": ";@@.*?(?=\\%>|$)"
"name": "comment.todo.red",
"match": ";@@.*?(?=\\%>|$)"
},

"comment-line": {
"name": "comment.line.red",
"match": ";.*?(?=\\%>|$)"
"name": "comment.line.red",
"match": ";.*?(?=\\%>|$)"
},

"comment-multiline-block": {
Expand All @@ -117,6 +127,7 @@
{"include": "#comment-multiline-block-nested" }
]
},

"comment-multiline-block-string": {
"name": "comment.multiline.red",
"begin": "\"",
Expand Down Expand Up @@ -172,6 +183,7 @@
"begin": "'",
"end": "'"
},

"doublequotedString": {
"name": "string.quoted.double.xml",
"begin": "\"",
Expand Down Expand Up @@ -201,16 +213,17 @@
"name": "string.file.quoted.red",
"begin": "%\"",
"beginCaptures": {
"0": { "name": "string.file.quoted.red" }
"0": { "name": "string.file.quoted.red" }
},
"patterns": [
{ "name": "string.escape.ssraw",
"match": "%[A-Fa-f0-9]{2}"
}
{
"name": "string.escape.ssraw",
"match": "%[A-Fa-f0-9]{2}"
}
],
"end": "\"",
"endCaptures": {
"0": { "name": "string.file.quoted.red" }
"0": { "name": "string.file.quoted.red" }
}
},

Expand Down Expand Up @@ -255,16 +268,16 @@
"name": "entity.tag.red",
"begin": "<(?:\\/|%\\=?\\ )?(?:([-_a-zA-Z0-9]+):)?([-_a-zA-Z0-9:]+)",
"beginCaptures": {
"0": { "name": "entity.other.namespace.xml" },
"1": { "name": "entity.name.tag.xml" }
"0": { "name": "entity.other.namespace.xml" },
"1": { "name": "entity.name.tag.xml" }
},
"end": "(?:\\s/|\\ %)?>",
"patterns": [
{
"match": " (?:([-_a-zA-Z0-9]+):)?([_a-zA-Z-]+)",
"captures": {
"0": { "name": "entity.other.namespace.xml" },
"1": { "name": "entity.other.attribute-name.xml" }
"0": { "name": "entity.other.namespace.xml" },
"1": { "name": "entity.other.attribute-name.xml" }
}
},
{ "include": "#singlequotedString" },
Expand Down Expand Up @@ -461,7 +474,6 @@
{ "include": "#word-setword" },
{ "include": "#word-datatype" },
{ "include": "#word-refinement" }

]
},

Expand Down Expand Up @@ -495,5 +507,6 @@
]
}
},

"uuid": "d5b29cdd-d851-4c62-aee2-00cd24d5f158"
}
Loading

0 comments on commit 41e1a06

Please sign in to comment.