diff --git a/components/koDocker_UDL_Language.py b/components/koDocker_UDL_Language.py new file mode 100644 index 0000000..78a0a4a --- /dev/null +++ b/components/koDocker_UDL_Language.py @@ -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'} diff --git a/install.rdf b/install.rdf new file mode 100644 index 0000000..9c64a10 --- /dev/null +++ b/install.rdf @@ -0,0 +1,29 @@ + + + + Docker-lang@activestate.com + Docker-lang + 0.1 + Dockerfile syntax highlighting + Mitchell + + 2 + true + + + + {36E66FA0-F259-11D9-850E-000D935D3368} + 7.0 + 9.* + + + + + {b1042fb5-9e9c-11db-b107-000d935d3368} + 7.0 + 9.* + + + + diff --git a/udl/docker-mainlex.udl b/udl/docker-mainlex.udl new file mode 100644 index 0000000..f760d9f --- /dev/null +++ b/udl/docker-mainlex.udl @@ -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