Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- 4GL is not Case Sensitive.

- Better functions detection.
- More keywords added.
- Funtion snippet: Function vars are defined as you type params.
- Whenever snippet added.
  • Loading branch information...
commit f2f1670927f9ca3246628194a57b8c4c9080c1af 1 parent c2dc411
@skarcha authored
View
26 4GL.JSON-tmLanguage
@@ -1,8 +1,8 @@
{ "name": "4GL",
- "scopeName": "source.4GL",
- "fileTypes": ["4gl"],
+ "scopeName": "source.4GL",
+ "fileTypes": ["4gl"],
"patterns": [
- {
+ {
"name": "comment.block.source.4GL",
"begin": "\\{",
"patterns": [
@@ -27,27 +27,27 @@
},
{
"name": "keyword.operator.source.4GL",
- "match": "(=|!=|\\+|-|/|<|>|(\\s(or|and|is|not|set|initialize)(?=(\\s|$))))",
+ "match": "(?i)(=|!=|\\+|-|/|<|>|,|(\\s(or|and|is|mod|not|initialize)(?=(\\s|$)))|((\\s|^)set(?=\\s)))",
"comment": "Operators"
},
{
"name": "constant.language.source.4GL",
- "match": "(null|true|false|notfound)",
+ "match": "(?i)(dirty read|null|true|false|notfound)",
"comment": "Constants provided by de language"
},
{
"name": "variable.language.source.4GL",
- "match": "(today|\\sstatus|pageno)",
+ "match": "(?i)(isolation|today|\\sstatus|pageno)",
"comment": "Variables provided by de language"
},
{
"name": "keyword.control.source.4GL",
- "match": "((\\s|^)case(\\s*|$)|continue (.*)|when |otherwise|end case|while |end while|for(\\s+|$)|foreach | into |end for(each)?|(\\s|^)if(?=\\s+|$)|(\\s+|^)then(\\s+|$)|(\\s+|^)else(\\s+|$)|end if|return(\\s+|$)|exit (.*))",
+ "match": "(?i)((\\s|^)case(\\s*|$)|continue (.*)|when |otherwise|end case|while |end while|(\\s|^)for(\\s|$)|foreach | into |end for(each)?|(\\s|^)if(?=\\s+|$)|(\\s+|^)then(\\s+|$)|(\\s+|^)else(\\s+|$)|end if|return(\\s+|$)|exit (.*))",
"comment": "Control"
},
{
"name": "keyword.other.source.4GL",
- "match": "( between |call(?=\\s+|$)| clipped|(\\s|^)close(\\s+|$)|create(?=\\s+|$)|database |\\sreturning |declare |delete(?=\\s+|$)|display\\s+|((\\s|^)fetch((\\s+|$)|(\\s+(first|last)\\s+)))|(\\s|^)from(\\s+|$)|(\\s+|^)free\\s+|group by\\s|(\\s+|^)(desc|asc)(\\s+|$)|(\\s+|^)insert\\s+into(\\s+|$)|((scroll)* cursor )|(\\s|^)open(\\s+|$)|prepare |(start|finish|output to) report|(\\s|^)select(\\s+|$)| spaces|(\\s|^)update(\\s+|$)|(\\s|^)where(\\s+|$)|output |order by|format( |$)|(first\\s+)*page header|before group of|on (every|last) row|after group of| using |begin\\s+work|commit\\s+work|rollback\\s+work|(\\s+|^)values(\\s+|$))",
+ "match": "(?i)( between |call(?=\\s+|$)| clipped|(\\s|^)close\\s+(form|window)*|(\\s|^)create\\s+(temp\\s+)?(table|index)(?=\\s+|$)|database |\\sreturning |declare |delete(?=\\s|$)|display\\s+|((\\s|^)drop\\s+(table|index)(\\s|$))|((\\s|^)fetch((\\s+|$)|(\\s+(first|last)\\s+)))|(\\s|^)from(\\s+|$)|(\\s+|^)free\\s+|group by\\s|(\\s+|^)(desc|asc)(\\s+|$)|(\\s|^)insert\\s+into(\\s+|$)|((scroll)* cursor(?=\\s)(\\swith hold)*)|((top|right|bottom|left)\\s+margin)|page length|(\\s|^)open\\s+(form|window)*|(\\s|^)prepare |(^|\\s)prompt\\s|(^|\\s)input by name(\\s|$)|((start|finish)\\s+report)|(\\s|^)select(\\s+|$)| spaces|(\\s|^)update(\\s+|$)|(\\s|^)where(\\s+|$)|(\\s|^)output(?=\\s|$)|(?<=\\s)to(?=\\s|$)|order by|format( |$)|(first\\s+)*page header|before group of|on (every|last) row|after group of| using |begin\\s+work|commit\\s+work|rollback\\s+work|(\\s+|^)values(\\s+|$)|((\\s|^)whenever\\s+(any\\s+)?error\\s+(continue|stop)(\\s|$))|(\\s|^)run\\s+|end input)",
"comment": "Keywords"
},
{
@@ -57,7 +57,7 @@
},
{
"name": "meta.function.source.4GL",
- "match": "(function|report)\\s+(.*)\\s*\\((.*)\\)",
+ "match": "(?i)(?<!\\w\\s)(function|report)\\s+(.*)\\s*\\((.*)\\)",
"captures": {
"1": { "name": "storage.type.function.source.4GL"},
"2": { "name": "entity.name.function.source.4GL"},
@@ -67,7 +67,7 @@
},
{
"name": "meta.function.source.4GL",
- "match": "(main)(\\s*|$)",
+ "match": "(?i)(main)(\\s*|$)",
"captures": {
"1": { "name": "entity.name.function.source.4GL"},
"1": { "name": "storage.type.function.source.4GL"}
@@ -76,17 +76,17 @@
},
{
"name": "storage.type.function.source.4GL",
- "match": "(end function|end main|end report)(\\s*|$)",
+ "match": "(?i)(end function|end main|end report)(\\s*|$)",
"comment": "Functions definitions"
},
{
"name": "storage.type.source.4GL",
- "match": "(\\schar(?=[\\s\\(,$]))|(\\sdate(\\s+|$)|decimal|define | smallint| integer| float|let | like |record like)",
+ "match": "(?i)(\\schar(?=[\\s\\(,$]))|(\\sdate(\\s+|$)|decimal|define | smallint| integer| float|let | like |(end)* record|(((^|\\s+)|(end\\s+))globals))",
"comment": "Storage types"
},
{
"name": "support.function.source.4GL",
- "match": "((?<=\\s)(length|day|month|year|p_open|p_close)(?=\\s*\\(.*?\\)))",
+ "match": "(?i)((?<=\\s)(length|day|month|year|p_open|p_close)(?=\\s*\\(.*?\\)))",
"comment": "Some functions"
}
],
View
344 4GL.tmLanguage
@@ -1,172 +1,172 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>fileTypes</key>
- <array>
- <string>4gl</string>
- </array>
- <key>name</key>
- <string>4GL</string>
- <key>patterns</key>
- <array>
- <dict>
- <key>begin</key>
- <string>\{</string>
- <key>end</key>
- <string>\}</string>
- <key>name</key>
- <string>comment.block.source.4GL</string>
- <key>patterns</key>
- <array>
- <dict>
- <key>match</key>
- <string>.</string>
- </dict>
- </array>
- </dict>
- <dict>
- <key>comment</key>
- <string>A comment starting with '#'</string>
- <key>match</key>
- <string>#.*$</string>
- <key>name</key>
- <string>comment.number-sign.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Single quoted string</string>
- <key>match</key>
- <string>('(?:\\'|.)*?')</string>
- <key>name</key>
- <string>string.single.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Double quoted string</string>
- <key>match</key>
- <string>(\"(?:\\"|.)*?\")</string>
- <key>name</key>
- <string>string.double.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Operators</string>
- <key>match</key>
- <string>(=|!=|\+|-|/|&lt;|&gt;|(\s(or|and|is|not|set|initialize)(?=(\s|$))))</string>
- <key>name</key>
- <string>keyword.operator.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Constants provided by de language</string>
- <key>match</key>
- <string>(null|true|false|notfound)</string>
- <key>name</key>
- <string>constant.language.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Variables provided by de language</string>
- <key>match</key>
- <string>(today|\sstatus|pageno)</string>
- <key>name</key>
- <string>variable.language.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Control</string>
- <key>match</key>
- <string>((\s|^)case(\s*|$)|continue (.*)|when |otherwise|end case|while |end while|for(\s+|$)|foreach | into |end for(each)?|(\s|^)if(?=\s+|$)|(\s+|^)then(\s+|$)|(\s+|^)else(\s+|$)|end if|return(\s+|$)|exit (.*))</string>
- <key>name</key>
- <string>keyword.control.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Keywords</string>
- <key>match</key>
- <string>( between |call(?=\s+|$)| clipped|(\s|^)close(\s+|$)|create(?=\s+|$)|database |\sreturning |declare |delete(?=\s+|$)|display\s+|((\s|^)fetch((\s+|$)|(\s+(first|last)\s+)))|(\s|^)from(\s+|$)|(\s+|^)free\s+|group by\s|(\s+|^)(desc|asc)(\s+|$)|(\s+|^)insert\s+into(\s+|$)|((scroll)* cursor )|(\s|^)open(\s+|$)|prepare |(start|finish|output to) report|(\s|^)select(\s+|$)| spaces|(\s|^)update(\s+|$)|(\s|^)where(\s+|$)|output |order by|format( |$)|(first\s+)*page header|before group of|on (every|last) row|after group of| using |begin\s+work|commit\s+work|rollback\s+work|(\s+|^)values(\s+|$))</string>
- <key>name</key>
- <string>keyword.other.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Constant numeric</string>
- <key>match</key>
- <string>(?&lt;!\w)((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))</string>
- <key>name</key>
- <string>constant.numeric.source.4GL</string>
- </dict>
- <dict>
- <key>captures</key>
- <dict>
- <key>1</key>
- <dict>
- <key>name</key>
- <string>storage.type.function.source.4GL</string>
- </dict>
- <key>2</key>
- <dict>
- <key>name</key>
- <string>entity.name.function.source.4GL</string>
- </dict>
- <key>3</key>
- <dict>
- <key>name</key>
- <string>variable.parameter.function.source.4GL</string>
- </dict>
- </dict>
- <key>comment</key>
- <string>Functions definitions</string>
- <key>match</key>
- <string>(function|report)\s+(.*)\s*\((.*)\)</string>
- <key>name</key>
- <string>meta.function.source.4GL</string>
- </dict>
- <dict>
- <key>captures</key>
- <dict>
- <key>1</key>
- <dict>
- <key>name</key>
- <string>storage.type.function.source.4GL</string>
- </dict>
- </dict>
- <key>comment</key>
- <string>Main function definition</string>
- <key>match</key>
- <string>(main)(\s*|$)</string>
- <key>name</key>
- <string>meta.function.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Functions definitions</string>
- <key>match</key>
- <string>(end function|end main|end report)(\s*|$)</string>
- <key>name</key>
- <string>storage.type.function.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Storage types</string>
- <key>match</key>
- <string>(\schar(?=[\s\(,$]))|(\sdate(\s+|$)|decimal|define | smallint| integer| float|let | like |record like)</string>
- <key>name</key>
- <string>storage.type.source.4GL</string>
- </dict>
- <dict>
- <key>comment</key>
- <string>Some functions</string>
- <key>match</key>
- <string>((?&lt;=\s)(length|day|month|year|p_open|p_close)(?=\s*\(.*?\)))</string>
- <key>name</key>
- <string>support.function.source.4GL</string>
- </dict>
- </array>
- <key>scopeName</key>
- <string>source.4GL</string>
- <key>uuid</key>
- <string>92ff564a-23b6-471d-8a26-831d4dec08c9</string>
-</dict>
-</plist>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>fileTypes</key>
+ <array>
+ <string>4gl</string>
+ </array>
+ <key>name</key>
+ <string>4GL</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>begin</key>
+ <string>\{</string>
+ <key>end</key>
+ <string>\}</string>
+ <key>name</key>
+ <string>comment.block.source.4GL</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>match</key>
+ <string>.</string>
+ </dict>
+ </array>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>A comment starting with '#'</string>
+ <key>match</key>
+ <string>#.*$</string>
+ <key>name</key>
+ <string>comment.number-sign.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Single quoted string</string>
+ <key>match</key>
+ <string>('(?:\\'|.)*?')</string>
+ <key>name</key>
+ <string>string.single.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Double quoted string</string>
+ <key>match</key>
+ <string>(\"(?:\\"|.)*?\")</string>
+ <key>name</key>
+ <string>string.double.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Operators</string>
+ <key>match</key>
+ <string>(?i)(=|!=|\+|-|/|&lt;|&gt;|,|(\s(or|and|is|mod|not|initialize)(?=(\s|$)))|((\s|^)set(?=\s)))</string>
+ <key>name</key>
+ <string>keyword.operator.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Constants provided by de language</string>
+ <key>match</key>
+ <string>(?i)(dirty read|null|true|false|notfound)</string>
+ <key>name</key>
+ <string>constant.language.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Variables provided by de language</string>
+ <key>match</key>
+ <string>(?i)(isolation|today|\sstatus|pageno)</string>
+ <key>name</key>
+ <string>variable.language.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Control</string>
+ <key>match</key>
+ <string>(?i)((\s|^)case(\s*|$)|continue (.*)|when |otherwise|end case|while |end while|(\s|^)for(\s|$)|foreach | into |end for(each)?|(\s|^)if(?=\s+|$)|(\s+|^)then(\s+|$)|(\s+|^)else(\s+|$)|end if|return(\s+|$)|exit (.*))</string>
+ <key>name</key>
+ <string>keyword.control.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Keywords</string>
+ <key>match</key>
+ <string>(?i)( between |call(?=\s+|$)| clipped|(\s|^)close\s+(form|window)*|(\s|^)create\s+(temp\s+)?(table|index)(?=\s+|$)|database |\sreturning |declare |delete(?=\s|$)|display\s+|((\s|^)drop\s+(table|index)(\s|$))|((\s|^)fetch((\s+|$)|(\s+(first|last)\s+)))|(\s|^)from(\s+|$)|(\s+|^)free\s+|group by\s|(\s+|^)(desc|asc)(\s+|$)|(\s|^)insert\s+into(\s+|$)|((scroll)* cursor(?=\s)(\swith hold)*)|((top|right|bottom|left)\s+margin)|page length|(\s|^)open\s+(form|window)*|(\s|^)prepare |(^|\s)prompt\s|(^|\s)input by name(\s|$)|((start|finish)\s+report)|(\s|^)select(\s+|$)| spaces|(\s|^)update(\s+|$)|(\s|^)where(\s+|$)|(\s|^)output(?=\s|$)|(?&lt;=\s)to(?=\s|$)|order by|format( |$)|(first\s+)*page header|before group of|on (every|last) row|after group of| using |begin\s+work|commit\s+work|rollback\s+work|(\s+|^)values(\s+|$)|((\s|^)whenever\s+(any\s+)?error\s+(continue|stop)(\s|$))|(\s|^)run\s+|end input)</string>
+ <key>name</key>
+ <string>keyword.other.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Constant numeric</string>
+ <key>match</key>
+ <string>(?&lt;!\w)((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))</string>
+ <key>name</key>
+ <string>constant.numeric.source.4GL</string>
+ </dict>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>storage.type.function.source.4GL</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>entity.name.function.source.4GL</string>
+ </dict>
+ <key>3</key>
+ <dict>
+ <key>name</key>
+ <string>variable.parameter.function.source.4GL</string>
+ </dict>
+ </dict>
+ <key>comment</key>
+ <string>Functions definitions</string>
+ <key>match</key>
+ <string>(?i)(?&lt;!\w\s)(function|report)\s+(.*)\s*\((.*)\)</string>
+ <key>name</key>
+ <string>meta.function.source.4GL</string>
+ </dict>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>storage.type.function.source.4GL</string>
+ </dict>
+ </dict>
+ <key>comment</key>
+ <string>Main function definition</string>
+ <key>match</key>
+ <string>(?i)(main)(\s*|$)</string>
+ <key>name</key>
+ <string>meta.function.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Functions definitions</string>
+ <key>match</key>
+ <string>(?i)(end function|end main|end report)(\s*|$)</string>
+ <key>name</key>
+ <string>storage.type.function.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Storage types</string>
+ <key>match</key>
+ <string>(?i)(\schar(?=[\s\(,$]))|(\sdate(\s+|$)|decimal|define | smallint| integer| float|let | like |(end)* record|(((^|\s+)|(end\s+))globals))</string>
+ <key>name</key>
+ <string>storage.type.source.4GL</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>Some functions</string>
+ <key>match</key>
+ <string>(?i)((?&lt;=\s)(length|day|month|year|p_open|p_close)(?=\s*\(.*?\)))</string>
+ <key>name</key>
+ <string>support.function.source.4GL</string>
+ </dict>
+ </array>
+ <key>scopeName</key>
+ <string>source.4GL</string>
+ <key>uuid</key>
+ <string>92ff564a-23b6-471d-8a26-831d4dec08c9</string>
+</dict>
+</plist>
View
6 function.sublime-snippet
@@ -3,9 +3,9 @@
{
${2:Function description...}
}
-function ${1:function_name}(${3:param1, param2, ...})
-${3/(.*?),/define $1\n/g}
- ${4:sentences...}
+function ${1:function_name}(${3:param1, param2, paramn})
+${3/\s*([a-zA-Z0-9_]+)(,*)/define $1\n/g}
+ ${4:# sentences...}
end function
]]></content>
<tabTrigger>function</tabTrigger>
View
2  select.sublime-snippet
@@ -2,7 +2,7 @@
<content><![CDATA[
select
${1:*}
-from
+from
${2:table}
where
View
9 whenever.sublime-snippet
@@ -0,0 +1,9 @@
+<snippet>
+ <content><![CDATA[
+whenever error continue
+ ${1:# sentences...}
+whenever error stop
+]]></content>
+ <tabTrigger>whenever</tabTrigger>
+ <scope>source.4GL</scope>
+</snippet>
Please sign in to comment.
Something went wrong with that request. Please try again.