Commits

Paul Miller committed 9a6a79e

Fix coffee / ls stuff.

  • Participants
  • Parent commits 129ffd9

Comments (0)

Files changed (2)

File pygments/lexers/web.py

             (r'(?:\([^()]+\))?\s*[=-]>', Name.Function),
             (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
             (r'[})\].]', Punctuation),
-            (r'(for|own|in|of|while|until|loop|break|return|continue|'
+            (r'(?<![\.\$])(for|own|in|of|while|until|'
+             r'loop|break|return|continue|'
              r'switch|when|then|if|unless|else|'
              r'throw|try|catch|finally|new|delete|typeof|instanceof|super|'
              r'extends|this|class|by)\b', Keyword, 'slashstartsregex'),
-            (r'(true|false|yes|no|on|off|null|NaN|Infinity|undefined)\b',
+            (r'(?<![\.\$])(true|false|yes|no|on|off|null|'
+             r'NaN|Infinity|undefined)\b',
              Keyword.Constant),
             (r'(Array|Boolean|Date|Error|Function|Math|netscape|'
              r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
             # this next expr leads to infinite loops root -> slashstartsregex
             #(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
             include('commentsandwhitespace'),
-            (r'(?:\([^()]+\))?[ ]*!?[~-]{1,2}>|'
-             r'(?:\(?[^()\n]+\)?)?[ ]*<[~-]{1,2}!?', Name.Function),
-            (r'\+\+|&&|\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|\?|:|=|'
+            (r'(?:\([^()]+\))?[ ]*[~-]{1,2}>|'
+             r'(?:\(?[^()\n]+\)?)?[ ]*<[~-]{1,2}', Name.Function),
+            (r'\+\+|&&|(?<![\.\$])\b(?:and|x?or|is|isnt|not)\b|\?|:|=|'
              r'\|\||\\(?=\n)|(<<|>>>?|==?|!=?|'
              r'~(?!\~?>)|-(?!\-?>)|<(?!\[)|(?<!\])>|'
              r'[+*`%&\|\^/])=?',
              Operator, 'slashstartsregex'),
             (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
             (r'[})\].]', Punctuation),
-            (r'(for|own|in|of|while|until|loop|break|return|continue|'
-             r'switch|when|then|if|unless|else|'
+            (r'(?<![\.\$])(for|own|in|of|while|until|loop|break|'
+             r'return|continue|switch|when|then|if|unless|else|'
              r'throw|try|catch|finally|new|delete|typeof|instanceof|super|'
              r'extends|this|class|by|const|var|to|til)\b', Keyword,
               'slashstartsregex'),
-            (r'(true|false|yes|no|on|off|null|NaN|Infinity|undefined)\b',
+            (r'(?<![\.\$])(true|false|yes|no|on|off|'
+             r'null|NaN|Infinity|undefined|void)\b',
               Keyword.Constant),
             (r'(Array|Boolean|Date|Error|Function|Math|netscape|'
              r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
             (r'@', Name.Other, 'slashstartsregex'),
             (r'@?[$a-zA-Z_][a-zA-Z0-9_\-]*', Name.Other, 'slashstartsregex'),
             (r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?(?:[a-zA-Z_]+)?', Number.Float),
-            (r'0x[0-9a-fA-F]+([a-zA-Z_]+)?', Number.Hex),
-            (r'[0-9]+(?:[a-zA-Z_]+)?', Number.Integer),
+            (r'[0-9]+(~[0-9a-z]+)?(?:[a-zA-Z_]+)?', Number.Integer),
             ('"""', String, 'tdqs'),
             ("'''", String, 'tsqs'),
             ('"', String, 'dqs'),

File tests/examplefiles/livescript-demo.ls

 a = -> [1 to 50]
 const b = --> [2 til 5]
-var c = ~~> 10_000_000km * 500ms
+var c = ~~> 10_000_000km * 500ms - 16~ff / 32~lol
 e = (a) -> (b) ~> (c) --> (d, e) ~~> <[list of words]>
 dashes-identifiers = ->
   a - a b -- c 1-1 1- -1 a- a a -a
   |> filter (> 5)
   |> fold (+)
 
+obj =
+  prop1: 1
+  prop2: 2
+
 class Class extends Anc-est-or
   (args) ->
-    -> ~> !-> !~> !--> !~~>
-    <-! # Comment
-    <~! /* Comment */
+    <- # Comment
+    <~ /* Comment */
+    void undefined yes no on off
+    a.void b.undefined c.off d.if f.no g.not
+    avoid bundefined coff dif fno gnot
+    "inter #{2 + 2} #variable"
+    '''HELLO 'world' '''
 
 copy = (from, to, callback) -->
   error, data <- read file
   error <~ write file, data
   return callback error if error?
   callback()
+
+take(n, [x, ...xs]:list) =
+  | n <= 0     => []
+  | empty list => []
+  | otherwise  => [x] +++ take n - 1, xs