"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/extras/langDefs-resources/cleanslate.lang" (12 May 2020, 13781 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "cleanslate.lang": 3.53_vs_3.54.

    1 --[[****************************************************************************
    2 *                                                                              *
    3 *           Highlight Language Definition "Clean Slate" Boilerplate            *
    4 *                                                                              *
    5 *                v1.1.0 (2019/03/02) | Highlight v3.49 | Lua 5.3               *
    6 *                                                                              *
    7 *                              by Tristano Ajmone                              *
    8 *                                                                              *
    9 ********************************************************************************
   10 This is a langDef boilerplate intended as a starting point to build your own
   11 custom language definition on top of it. This boilerplate is based on a "clean
   12 slate" approach: all possible syntax elements definition are present, but they
   13 are set to a never matching regular expression:
   14 
   15     [=[ \A(?!x)x ]=]
   16 
   17 This boilerplate will never match anything; even Highlight's built-in defaults
   18 are overridden (ie: those elements which, if undefined, would take fallback
   19 default values). The idea is that of starting with a "clean slate" language
   20 definition, where nothing is matched at all; and then start to build the lang
   21 def one element definition after the other, without the potential interference
   22 of any default definitions. This is a "distraction free" approach, which allows
   23 to focus on single syntax elements in a "vacuum" environment, particularly
   24 useful when dealing with syntax definitions where conflicts between various
   25 elements arise. Once you've succeeded in defining a given syntax element, you
   26 can comment it out and replace it with the original never matching RegEx, and
   27 start working on the next element. Working on a single element at the time
   28 prevents cross-elements interferences creeping in; and switching between an
   29 element's real definition and it's never matching RegEx is a practical way to
   30 isolate which element is interfering with others in the final context.
   31 
   32 Just copy this boilerplate, rename it, and edit it as required. The language
   33 definition template "template.lang" can be referenced for guidelines and useful
   34 presets while working on your custom language -- the template contains useful
   35 comments and preset examples on the various syntax elements. The comments in
   36 this boilerplate have been kept down to the essential references for this
   37 context; for more details refer to "template.lang" comments and the official
   38 documentation.
   39 --------------------------------------------------------------------------------
   40 Written by Tristano Ajmone:
   41     <tajmone@gmail.com>
   42     https://github.com/tajmone
   43     https://gitlab.com/tajmone
   44 Released into the public domain according to the Unlicense terms:
   45     http://unlicense.org/
   46 ------------------------------------------------------------------------------]]
   47 
   48 Description = "Clean Slate" -- Syntax description
   49 
   50 --[[============================================================================
   51                                   CATEGORIES
   52 ================================================================================
   53 Categories:        Table, List of categories (config, source, script, etc)
   54 ------------------------------------------------------------------------------]]
   55 Categories = {"source", "script"}
   56 
   57 -- The (optional) 'Categories' element is used to filter languages by categories
   58 -- when querying Highlight for the list of available syntaxes, e.g.:
   59 
   60 --     highlight --list-scripts=langs --list-cat=markup
   61 
   62 -- ... will list all the available syntax definitions for markup languages.
   63 
   64 -- You should provide as many categories as required for you own syntax.Common
   65 -- categories are: "config", "markup", "script" and "source". For a full list
   66 -- of categories in use by the syntaxes that ship with Highlight, see the Wiki:
   67 
   68 --     https://gitlab.com/saalen/highlight/wikis/LangDefs-Elements#categories
   69 
   70 --------------------------------------------------------------------------------
   71 
   72 IgnoreCase = false -- Are keywords case-sensitive? (true/false)
   73 
   74 EnableIndentation = false -- Syntax may be reformatted and indented? (true/false)
   75 
   76 --[[============================================================================
   77                                   IDENTIFIERS
   78 ================================================================================
   79 String, Regular expression which defines identifiers (optional).
   80 
   81 Highlight's default Identifiers definition:
   82 
   83   Identifiers=[=[ [a-zA-Z_]\w* ]=]
   84 
   85 ------------------------------------------------------------------------------]]
   86 -- UNCOMMENT THE FOLLOWING TO USE NEVER-MATCHING REGEX:
   87 
   88 -- Identifiers = [=[ \A(?!x)x ]=] -- Never-Matching RegEx!
   89 
   90 -- ** WARNING ** By setting Identifiers to a never-matching RegEx, Keywords lists
   91 --               won't be reckognized anymore by the parser! This can be a useful
   92 --               trick/hack needed in some syntax which rely only on RegEx-defined
   93 --               Keywords, and to avoid conflicts with other elements in some
   94 --               edge-cases. Try it only to check if the current (or default)
   95 --               Identifiers definition might be interfering in the parsing of
   96 --               other elements.
   97 
   98 --[[============================================================================
   99                                     COMMENTS
  100 ================================================================================
  101 Comments = { {Block, Nested?, Delimiter=} }
  102 
  103   Block:     Boolean, true if comment is a block comment
  104   Nested:    Boolean, true if block comments can be nested (optional)
  105   Delimiter: List, contains open delimiter regex (line comment) or open and
  106               close delimiter regexes (block comment)
  107 ------------------------------------------------------------------------------]]
  108 Comments = {
  109   -- Define BLOCK-COMMENTS delimiters
  110   { Block  = true,
  111     Nested = false, -- Can block comments be nested? (optional)
  112     Delimiter = {
  113       [=[ \A(?!x)x ]=], -- Never-Matching RegEx!
  114       [=[ \A(?!x)x ]=]  -- Never-Matching RegEx!
  115     }
  116   },
  117   -- Define SINGLE-LINE-COMMENTS delimiter
  118   { Block = false,
  119     Delimiter = { [=[ \A(?!x)x ]=] } -- Never-Matching RegEx!
  120   }
  121 }
  122 --[[============================================================================
  123                                     STRINGS
  124 ================================================================================
  125 Strings = { Delimiter|DelimiterPairs={Open, Close, Raw?}, Escape?, Interpolation?,
  126             RawPrefix?, AssertEqualLength? }
  127 
  128   Delimiter:         String, regular expression which describes string delimiters
  129   DelimiterPairs:    List, includes open and close delimiter expressions if not
  130                       equal, includes optional Raw flag as boolean which marks
  131                       delimiter pair to contain a raw string
  132   Escape:            String, regex of escape sequences (optional)
  133   Interpolation:     String, regex of interpolation sequences (optional)
  134   RawPrefix:         String, defines raw string indicator (optional)
  135   AssertEqualLength: Boolean, set true if delimiters must have the same length
  136 ------------------------------------------------------------------------------]]
  137 Strings = {
  138 
  139 --------------------------------------------------------------------------------
  140 --                              STRING DELIMITERS
  141 --------------------------------------------------------------------------------
  142 
  143   -- SYMMETRICAL STRINGS DELIMITERS
  144   Delimiter = [=[ \A(?!x)x ]=], -- Never-Matching RegEx!
  145 
  146   -- ASYMMETRICAL STRINGS DELIMITERS
  147   DelimiterPairs= {
  148     { Open  = [=[ \A(?!x)x ]=], -- Never-Matching RegEx!
  149       Close = [=[ \A(?!x)x ]=], -- Never-Matching RegEx!
  150       Raw = true, -- Are these raw string delimiters? (true/false)
  151     }
  152   },
  153   AssertEqualLength = true, -- Delimiters must have the same length?
  154 
  155   -- RAW-STRING PREFIX (if language supports it)
  156   RawPrefix = [=[ \A(?!x)x ]=], -- Never-Matching RegEx!
  157 --[==[--------------------------------------------------------------------------
  158                                 ESCAPE SEQUENCES
  159 --------------------------------------------------------------------------------
  160 If the language at hand supports escape sequences, define a RegEx pattern to
  161 capture them.
  162 
  163 Highlight's default built-in Escape definition:
  164 
  165   Escape=[=[ \\u[[:xdigit:]]{4}|\\\d{3}|\\x[[:xdigit:]]{2}|\\[ntvbrfa\\\?'"] ]=]
  166 
  167 NOTE: Escape sequences will be matched anywhere, not just inside strings. If you
  168       need to restrict them to strings only, you'll need to write a custom hook
  169       function (for an example, see the "template.lang" file).              ]==]
  170 
  171   Escape = [=[ \A(?!x)x ]=], -- Never-Matching RegEx!
  172 --[[----------------------------------------------------------------------------
  173                                 INTERPOLATION
  174 --------------------------------------------------------------------------------
  175 String, regex of interpolation sequences (optional)                         --]]
  176 
  177   Interpolation = [=[ \A(?!x)x ]=], -- Never-Matching RegEx!
  178 }
  179 
  180 --[[============================================================================
  181                                   PREPROCESSOR
  182 ================================================================================
  183 PreProcessor = { Prefix, Continuation? }
  184 
  185   Prefix:        String, regular expression which describes open delimiter
  186   Continuation:  String, contains line continuation character (optional).   --]]
  187 
  188 PreProcessor = {
  189   Prefix = [=[ \A(?!x)x ]=], -- Never-Matching RegEx!
  190 
  191 -- UNCOMMENT IF YOU NEED CONTINUATION CHARACTER:
  192   -- Continuation = "", -- A character, not a RegEx! (escaping rules apply)
  193 }
  194 --[[============================================================================
  195                                   OPERATORS
  196 ============================================================================--]]
  197 Operators = [=[ \A(?!x)x ]=] -- Never-Matching RegEx!
  198 
  199 --[[============================================================================
  200                                         DIGITS
  201 ================================================================================
  202 String, Regular expression which defines digits (optional).
  203 
  204 Highlight's default built-in Digits definition:
  205 
  206   Digits=[=[ (?:0x|0X)[0-9a-fA-F]+|\d*[\.]?\d+(?:[eE][\-\+]\d+)?[lLuU]* ]=]
  207 --]]
  208 Digits = [=[ \A(?!x)x ]=] -- Never-Matching RegEx!
  209 
  210 --[[============================================================================
  211                                       KEYWORDS
  212 ================================================================================
  213 Keywords = { Id, List|Regex, Group? }
  214 
  215   Id:    Integer, keyword group id (values 1-4, can be reused for several keyword
  216           groups)
  217   List:  List, list of keywords
  218   Regex: String, regular expression
  219   Group: Integer, capturing group id of regular expression, defines part of regex
  220           which should be returned as keyword (optional; if not set, the match
  221           with the highest group number is returned (counts from left to right))
  222 
  223 NOTE: Keyword group Ids are not limited to 4, you can create as many as you
  224       need; but bare in mind that most themes that ship with Highlight usually
  225       provide definitions only for Ids 1-4, so in order to syntax-color Keyword
  226       groups with Ids greater than 4 you'll need to define a theme that covers
  227       their definitions.                                                    --]]
  228 
  229 Keywords = {
  230 --------------------------------------------------------------------------------
  231 --                               Keywords by List
  232 --------------------------------------------------------------------------------
  233 -- NOTE: If you've set `IgnoreCase = false` then all keywords in the list must
  234 --       be in lowercase otherwise they'll never match! With case-insensitive
  235 --       languages, Highlight converts to lowercase the token before comparing
  236 --       it to the entries of the Keywords list, but the list entries are not
  237 --       manipulated before comparison.
  238   { Id = 1,
  239     List = {
  240       -- Keywords list
  241       "XYZ", "ZYX" -- Dummy Sample Values
  242     }
  243   },
  244 --------------------------------------------------------------------------------
  245 --                              Keywords by RegEx
  246 --------------------------------------------------------------------------------
  247   { Id = 2,
  248     Regex = [=[ \A(?!x)x ]=], -- Never-Matching RegEx!
  249     Group = 1
  250   }
  251 }
  252 
  253 --[[****************************************************************************
  254 *                                                                              *
  255 *                            CUSTOM HOOK-FUNCTIONS                             *
  256 *                                                                              *
  257 ********************************************************************************
  258 In some cases you might need to gain finer control over Highlight parser; you
  259 can do so by defininng some custom hooks via the OnStateChange() function.
  260 
  261 For more info, see:
  262     https://github.com/andre-simon/highlight/blob/master/README#L596
  263     https://github.com/andre-simon/highlight/blob/master/README_PLUGINS#L170
  264 ------------------------------------------------------------------------------]]
  265 
  266 --[[============================================================================
  267                                   CHANGELOG
  268 ================================================================================
  269 v1.1.0 (2019/03/02) | Highlight v3.49
  270   - Added new 'Categories' element.
  271 
  272 v1.0.2 (2018/07/02) | Highlight v3.43
  273   - Cleaned up code and comments.
  274   - Some notes added.
  275 
  276 v1.0.1 (2018/01/04) | Highlight v3.41
  277   - First release.                                                          --]]