summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiyinyiyong <jiyinyiyong@gmail.com>2014-01-11 18:02:51 +0800
committerjiyinyiyong <jiyinyiyong@gmail.com>2014-01-11 18:02:51 +0800
commit58ade6b658b910ad16f923e8376a2bb1a42625ee (patch)
tree283d3fbeffb08740b26df8fb0cbcb5be6cfc54ac
parente120e69954bd6c3a61540636b3bb44b03f3280dd (diff)
downloadpygments-58ade6b658b910ad16f923e8376a2bb1a42625ee.tar.gz
Cirru: dim comments; use Text for newline character; add escape in string;
-rw-r--r--pygments/lexers/web.py13
-rw-r--r--tests/examplefiles/scope.cirru12
2 files changed, 17 insertions, 8 deletions
diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py
index 6f512e1a..8b160d56 100644
--- a/pygments/lexers/web.py
+++ b/pygments/lexers/web.py
@@ -4187,14 +4187,16 @@ class CirruLexer(RegexLexer):
tokens = {
'string': [
(r'[^"\\\n]', String),
- (r'\\"', String),
- (r'\\', String),
+ (r'\\', String.Escape, 'escape'),
(r'"', String, '#pop'),
],
+ 'escape': [
+ (r'.', String.Escape, '#pop'),
+ ],
'function': [
(r'[\w-][^\s\(\)\"]*', Name.Function, '#pop'),
(r'\)', Operator, '#pop'),
- (r'(?=\n)', Text.Whitespace, '#pop'),
+ (r'(?=\n)', Text, '#pop'),
(r'\(', Operator, '#push'),
(r'"', String, ('#pop', 'string')),
(r'\s+', Text.Whitespace),
@@ -4204,12 +4206,13 @@ class CirruLexer(RegexLexer):
(r'\$', Operator, 'function'),
(r'\(', Operator, 'function'),
(r'\)', Operator),
- (r'(?=\n)', Text.Whitespace, '#pop'),
- (r'\n', Text.Whitespace, '#pop'),
+ (r'(?=\n)', Text, '#pop'),
+ (r'\n', Text, '#pop'),
(r'"', String, 'string'),
(r'\s+', Text.Whitespace),
(r'[\d\.]+', Number),
(r'[\w-][^\"\(\)\s]*', Name.Variable),
+ (r'--', Comment.Single)
],
'root': [
(r'^\s*', Text.Whitespace, ('line', 'function')),
diff --git a/tests/examplefiles/scope.cirru b/tests/examplefiles/scope.cirru
index 35c4a9ca..b17ff4ea 100644
--- a/tests/examplefiles/scope.cirru
+++ b/tests/examplefiles/scope.cirru
@@ -24,8 +24,14 @@ print just-print
eval (self) just-print
eval just-print
-print (string "string content\nand")
+print (string "string with space")
+print (string "escapes \n \"\\")
-demo ((((()))))
+brackets ((((()))))
-"eval" $ string "eval" \ No newline at end of file
+"eval" $ string "eval"
+
+print (add $ (int 1) (int 2))
+
+print $ unwrap $
+ map (a $ int 1) (b $ int 2) \ No newline at end of file