Skip to content

Commit cc36029

Browse files
committed
Initial support for LCB syntax highlighting and indentation
1 parent d0de7d8 commit cc36029

7 files changed

Lines changed: 220 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
npm-debug.log
3+
node_modules

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## 0.1.0 - Initial development preview
2+
* Basic support for LiveCode Builder
3+
* Syntax highlighting
4+
* Indentation rules for "if", "handler" and "repeat" blocks

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# LiveCode Language package for Atom
2+
3+
This is a language package for Atom that provides support for editing LiveCode
4+
source code.
5+
6+
To find out more about LiveCode, please visit the LiveCode website.
7+
8+
## Supported languages
9+
10+
Currently, this package supports editing LiveCode Builder source code in `.lcb`
11+
files. It provides syntax highlighting and indentation support.
12+
13+
## Installation
14+
15+
Install the `language-livecode` package from the "Install Packages and Themes"
16+
view in Atom's "Settings" window.
17+
18+
## Reporting bugs and contributing
19+
20+
Please report any problems to the [GitHub issues tracker]( https://github.com/peter-b/atom-language-livecode/issues).

grammars/lcb.cson

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# If this is your first time writing a language grammar, check out:
2+
# - http://manual.macromates.com/en/language_grammars
3+
4+
'scopeName': 'source.lcb'
5+
'name': 'LiveCode Builder'
6+
'fileTypes': [
7+
'lcb'
8+
]
9+
'patterns': [
10+
{
11+
'include': '#comment-line'
12+
}
13+
{
14+
'include': '#comment-block'
15+
}
16+
{
17+
'include': '#string'
18+
}
19+
{
20+
'include': '#if'
21+
}
22+
{
23+
'include': '#repeat-block'
24+
}
25+
{
26+
'match': '\\s*(next|end)\\s*repeat\\b'
27+
'name': 'keyword.control.lcb'
28+
}
29+
{
30+
'include': '#end-block'
31+
}
32+
{
33+
'include': '#define-module'
34+
}
35+
{
36+
'include': '#define-constant'
37+
}
38+
{
39+
'include': '#define-variable'
40+
}
41+
{
42+
'include': '#define-handler'
43+
}
44+
{
45+
'include': '#handler-return'
46+
}
47+
{
48+
'include': '#brackets'
49+
}
50+
{
51+
'match': '\\b(true|false|nothing|any)\\b'
52+
'captures':
53+
'1':
54+
'name': 'constant.language.lcb'
55+
}
56+
{
57+
'match': '\\b([tpskmxr][A-Z]\\w*)\\b'
58+
'captures':
59+
'1':
60+
'name': 'variable.lcb'
61+
}
62+
{
63+
'match': '\\b(returns)\\b'
64+
'captures':
65+
'1':
66+
'name': 'keyword.control.lcb'
67+
}
68+
]
69+
70+
'repository':
71+
72+
'comment-line':
73+
'begin': '--'
74+
'beginCaptures':
75+
'0':
76+
'name': 'punctuation.definition.comment.double-dash.lcb'
77+
'end': '\\n'
78+
'name': 'comment.line.lcb'
79+
80+
'comment-block':
81+
'begin': '/\\*'
82+
'captures':
83+
'0':
84+
'name': 'punctuation.definition.comment.lcb'
85+
'end': '\\*/'
86+
'name': 'comment.block.lcb'
87+
88+
'string':
89+
'begin': '"'
90+
'beginCaptures':
91+
'0':
92+
'name': 'punctuation.definition.string.begin.lcb'
93+
'end': '"'
94+
'endCaptures':
95+
'0':
96+
'name': 'punctuation.definition.string.end.lcb'
97+
'name': 'string.quoted.double.lcb'
98+
99+
'if':
100+
'begin': '^\\s*(else\\s*if|if|else)\\b'
101+
'captures':
102+
'1':
103+
'name': 'keyword.control.lcb'
104+
'end': '\\b(then)\\b'
105+
'patterns': [
106+
{
107+
'include': '$self'
108+
}
109+
]
110+
111+
'end-block':
112+
'match': '^\\s*(end(?:\\s*(?:module|library|widget|handler|if|repeat))?)'
113+
'name': 'keyword.control.lcb'
114+
115+
'repeat-block':
116+
'match': '^\\s*(repeat)\\b'
117+
'name': 'keyword.control.lcb'
118+
119+
'define-module':
120+
'match': '^\\s*(module|library|widget|use)(\\s+[^\\s]*)?\\b'
121+
'captures':
122+
'1':
123+
'name':
124+
'keyword.control.lcb'
125+
'2':
126+
'name':
127+
'entity.name.section.module.lcb'
128+
129+
'define-constant':
130+
'begin': '^\\s*constant\\b'
131+
'end': '\\bis\\b'
132+
'captures':
133+
'0':
134+
'name': 'keyword.control.lcb'
135+
'patterns': [
136+
{
137+
'match': '\\b\\w+\\b'
138+
'name': 'variable.constant.lcb'
139+
}
140+
]
141+
142+
'define-variable':
143+
'match': '^\\s*(variable)(?:\\s+(\\w*)(?:\\s+(as(?:\\soptional)?)(?:\\s+(\\w*))?)?)?'
144+
'captures':
145+
'1':
146+
'name': 'keyword.control.lcb'
147+
'2':
148+
'name': 'variable.lcb'
149+
'3':
150+
'name': 'keyword.control.lcb'
151+
'4':
152+
'name': 'storage.type.lcb'
153+
154+
'define-handler':
155+
'match': '^\\s*((?:(?:public|private)\\s+)?handler)(?:\\s+(\\w+))\\b'
156+
'captures':
157+
'1':
158+
'name': 'keyword.control.lcb'
159+
'2':
160+
'name': 'entity.name.function.lcb'
161+
162+
'handler-return':
163+
'match': '^\\s*return\\b'
164+
'name': 'keyword.control.lcb'
165+
166+
'brackets':
167+
'begin': '\\['
168+
'end': '\\]'
169+
'captures':
170+
'0':
171+
'name': 'punctuation.separator.list'

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "language-livecode",
3+
"version": "0.1.0",
4+
"description": "Support for editing LiveCode source code",
5+
"repository": "https://github.com/peter-b/atom-language-livecode",
6+
"license": "GPLv3",
7+
"engines": {
8+
"atom": "*"
9+
}
10+
}

settings/language-livecode.cson

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# If you want some examples of settings, check out:
2+
# https://github.com/atom/language-gfm/blob/master/settings/gfm.cson
3+
4+
'.source.lcb':
5+
'editor':
6+
'commentStart': '-- '
7+
'tabLength': 3
8+
'foldEndPattern': '^\\s*end\\b'
9+
'increaseIndentPattern': '^\\s*(((public\\s*)?handler)|if|repeat|else)\\b'
10+
'decreaseIndentPattern': '^\\s*(end(\\s*(if|repeat|handler))?|else(\\s*if)?)\\b'

snippets/language-livecode.cson

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# If you want some example snippets, check out:
2+
# https://github.com/atom/language-gfm/blob/master/snippets/gfm.cson

0 commit comments

Comments
 (0)