"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/langDefs/nim.lang" (12 May 2020, 4612 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 "nim.lang": 3.53_vs_3.54.

    1 --[[ "nim.lang" v1.1.1 (2019/01/09) | Nim 0.19.2 | Highlight 3.48
    2 ********************************************************************************
    3 *                                                                              *
    4 *                           Nim Language Definition                            *
    5 *                                                                              *
    6 ********************************************************************************
    7 Original author unknown. Updated by Tristano Ajmone.
    8 ------------------------------------------------------------------------------]]
    9 Description="Nim"
   10 
   11 Categories = {"source"}
   12 
   13 
   14 --------------------------------------------------------------------------------
   15 --                                   Numerals
   16 --------------------------------------------------------------------------------
   17 -- Based on Nim numerical constants definition found at:
   18 --  https://nim-lang.org/docs/manual.html#lexical-analysis-numerical-constants
   19 
   20 -- Some reusable RegExs:
   21 RE_suffx_int = [[(?:'i(?:8|16|32|64)|'u(?:8|16|32|64)?)?]]
   22 RE_suffx_flt = [[(?:'f(?:32|64)?|'d)?]]
   23 RE_exponent  = [[(?:e[\+\-]?\d[\d_]*)]]
   24 
   25 Digits=[[(?xi)
   26 
   27   # ========== HEX / HEX FLOAT ================
   28 
   29     \b0x[\da-f][\d_a-f]*\b]]..RE_suffx_flt..[[
   30 
   31   # ========== OCTAL / OCTAL FLOAT ============
   32 
   33   | \b0(?-i:o)[0-7][0-7_]*\b]]..RE_suffx_flt..[[
   34 
   35   # ========== BINARY / BINARY FLOAT ==========
   36 
   37   | \b0b[01][01_]*\b]]..RE_suffx_flt..[[
   38 
   39   # ========== FLOATS =========================
   40 
   41   | \b\d[\d_]*(?:\.\d[\d_]*]]..RE_exponent..[[?|]]..RE_exponent..[[)]]..RE_suffx_flt..[[
   42 
   43   # ========== DECIMAL ========================
   44 
   45   | \b\d[\d_]*\b]]..RE_suffx_int..[[
   46   ]]
   47 --------------------------------------------------------------------------------
   48 
   49 Keywords={
   50   {  Id=1,
   51     List={
   52     "addr", "and", "as", "asm", "bind", "block", "break", "case", "cast",
   53     "concept", "const", "continue", "converter", "defer", "discard",
   54     "distinct", "div", "do", "elif", "else", "end", "enum", "except", "export",
   55     "finally", "for", "from", "func", "if", "import", "in", "include",
   56     "interface", "is", "isnot", "iterator", "let", "macro", "method", "mixin",
   57     "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc", "ptr",
   58     "raise", "ref", "return", "shl", "shr", "static", "template", "try",
   59     "tuple", "type", "using", "var", "when", "while", "xor", "yield"
   60     }
   61   },
   62   { Id=2,
   63     List= {
   64       "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64",
   65       "float", "float32", "float64", "char", "string", "pointer"}
   66   },
   67   { Id=3,
   68     List= {}
   69   },
   70   { Id=4,
   71     Regex=[[(\w+)\s*\(]]
   72   }
   73 }
   74 
   75 Strings = {
   76   Delimiter=[["""|"|'|`]],
   77   RawPrefix="r",
   78   Escape=[=[\\[ntvbrfa\\\?'"]|\\\d{3}|\\x[[:xdigit:]]{2}]=],
   79 }
   80 
   81 --allow #, ##, #[..]#, ##[..]##
   82 Comments = {
   83   { Block=false,
   84     Delimiter= { [=[ ##(?!\[)|#(?![\[#]) ]=] },
   85   },
   86   { Block=true,
   87     Nested=true,
   88     Delimiter = { [[ ##?\[ ]], [[ \]##? ]] }
   89   }
   90 
   91 }
   92 
   93 IgnoreCase=false
   94 
   95 Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|=|\/|\*|\%|\+|\-|\~|\||\^]]
   96 
   97 --[[============================================================================
   98                                   CHANGELOG
   99 ================================================================================
  100 v1.1.1 (2019/01/09)  | Nim 0.19.2 | Highlight 3.48
  101   Updated by Tristano Ajmone:
  102   - Remove the "'f128" type suffix for it turned out that although still in the
  103     Nim documentation it was no longer supported. See discussion at #10213 that
  104     led to removal of 'f128 from documentation:
  105       https://github.com/nim-lang/Nim/issues/10213
  106       https://github.com/nim-lang/Nim/commit/258952832f
  107 v1.1.0 (2019/01/05) | Nim 0.19.2 | Highlight 3.48
  108   Updated by Tristano Ajmone:
  109   - Remove depracated keywords: 'atomic', 'generic', 'with', 'without'.
  110   - Rewrite 'Digits' RegEx definition to support:
  111     - Underscore separators in all numeral types:
  112       - FIXES: Hex and Floats did not support underscore separators.
  113     - Better floats definition:
  114       - FIXES: Exponents were breaking up floats.
  115     - Better support for type suffixes:
  116       - FIXES: Floats suffixes were not working properly.
  117       - ADDS: floats suffixes supported in decimals, hex and binary numbers too.
  118     - Better enforcement for letter casing, regardless of syntax settings:
  119       - enforce case insensitivity for Hex digts.
  120       - prefixes for Hex (0x) and Binary (ob) are always insensitive.
  121       - prefixes for Octal (0o) are always sensitive (Nim requires it).
  122       - exponents and int/float suffixes are insensitive.
  123 
  124 -- EOF --]]