-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1af6000
commit 5435b52
Showing
3 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Registers the Docker language in Komodo. | ||
|
||
import logging | ||
from koUDLLanguageBase import KoUDLLanguage | ||
|
||
log = logging.getLogger("koDockerLanguage") | ||
#log.setLevel(logging.DEBUG) | ||
|
||
def registerLanguage(registry): | ||
log.debug("Registering language Docker") | ||
registry.registerLanguage(KoDockerLanguage()) | ||
|
||
class KoDockerLanguage(KoUDLLanguage): | ||
|
||
# ------------ Komodo Registration Information ------------ # | ||
|
||
name = "Docker" | ||
lexresLangName = "Docker" | ||
_reg_desc_ = "%s Language" % name | ||
_reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" % name | ||
_reg_categories_ = [("komodo-language", name)] | ||
_reg_clsid_ = "54072a7f-a845-4b78-b63f-fc47c583e0b8" | ||
|
||
|
||
primary = 0 # Whether the language shows up in Komodo's first level language menus. | ||
|
||
extraFileAssociations = ["Dockerfile"] | ||
|
||
# ------------ Commenting Controls ------------ # | ||
|
||
commentDelimiterInfo = { | ||
"line": ['#'], | ||
"block": [], | ||
} | ||
|
||
# ------------ Indentation Controls ------------ # | ||
|
||
# To support automatic indenting and dedenting after "{([" and "})]" | ||
supportsSmartIndent = "brace" | ||
|
||
# ------------ Sub-language Controls ------------ # | ||
|
||
lang_from_udl_family = {'SSL': 'Docker'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0"?> | ||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:em="http://www.mozilla.org/2004/em-rdf#"> | ||
<Description about="urn:mozilla:install-manifest"> | ||
<em:id>[email protected]</em:id> | ||
<em:name>Docker-lang</em:name> | ||
<em:version>0.1</em:version> | ||
<em:description>Dockerfile syntax highlighting</em:description> | ||
<em:creator>Mitchell</em:creator> | ||
<em:homepageURL></em:homepageURL> | ||
<em:type>2</em:type> <!-- type=extension --> | ||
<em:unpack>true</em:unpack> | ||
|
||
<em:targetApplication> <!-- Komodo IDE --> | ||
<Description> | ||
<em:id>{36E66FA0-F259-11D9-850E-000D935D3368}</em:id> | ||
<em:minVersion>7.0</em:minVersion> | ||
<em:maxVersion>9.*</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
<em:targetApplication> <!-- Komodo Edit --> | ||
<Description> | ||
<em:id>{b1042fb5-9e9c-11db-b107-000d935d3368}</em:id> | ||
<em:minVersion>7.0</em:minVersion> | ||
<em:maxVersion>9.*</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
</Description> | ||
</RDF> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# UDL lexer for Docker. | ||
|
||
language Docker | ||
|
||
family markup | ||
initial IN_M_DEFAULT | ||
state IN_M_DEFAULT: | ||
/./ : redo, => IN_SSL_DEFAULT | ||
|
||
################ Language Start ################ | ||
|
||
family ssl # server side language | ||
|
||
start_style SSL_DEFAULT | ||
end_style SSL_VARIABLE | ||
|
||
keyword_style SSL_IDENTIFIER => SSL_WORD | ||
keywords [ | ||
'ONBUILD', 'FROM', 'MAINTAINER', 'RUN', 'EXPOSE', 'ENV', 'ADD', 'COPY', | ||
'VOLUME', 'USER', 'WORKDIR', 'CMD', 'ENTRYPOINT' | ||
] | ||
|
||
pattern FIRSTNAMECHAR = '_a-zA-Z\x80-\xff' | ||
pattern NAMECHAR = '$FIRSTNAMECHAR\d' | ||
pattern WS = '\s\t\r\n' | ||
|
||
################ Default Style ################ | ||
|
||
state IN_SSL_DEFAULT: | ||
|
||
# ----------- Entering Comments ---------- # | ||
'#' : paint(upto, SSL_DEFAULT), => IN_SSL_COMMENT_TO_EOL | ||
|
||
# ----------- Entering Whitespace ---------- # | ||
/[$WS]+/ : #stay | ||
|
||
# ----------- Entering Strings ---------- # | ||
'"' : paint(upto, SSL_DEFAULT), => IN_SSL_DSTRING | ||
'\'' : paint(upto, SSL_DEFAULT), => IN_SSL_SSTRING | ||
|
||
# ----------- Entering Identifiers ---------- # | ||
/[$FIRSTNAMECHAR][$NAMECHAR]*/ : paint(upto, SSL_DEFAULT), paint(include, SSL_IDENTIFIER) | ||
|
||
################ In Comments - determines how we exit a comment ################ | ||
|
||
state IN_SSL_COMMENT_TO_EOL: | ||
/[\r\n]/ : paint(upto, SSL_COMMENT), => IN_SSL_DEFAULT | ||
|
||
################ In Strings - determines how we exit a string ################ | ||
|
||
state IN_SSL_DSTRING: | ||
'"' : paint(include, SSL_STRING), => IN_SSL_DEFAULT | ||
/\\./ : #stay | ||
|
||
state IN_SSL_SSTRING: | ||
'\'' : paint(include, SSL_STRING), => IN_SSL_DEFAULT | ||
/\\./ : #stay |