aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xresp_highlight.py28
-rw-r--r--test/match.resp7
2 files changed, 18 insertions, 17 deletions
diff --git a/resp_highlight.py b/resp_highlight.py
index 11ae298..a1432bb 100755
--- a/resp_highlight.py
+++ b/resp_highlight.py
@@ -19,8 +19,8 @@ class RespLexer(RegexLexer):
filenames = ['*.resp']
mimetypes = ['text/x-resp', 'application/x-resp']
- keywords = [ 'fn', 'def', 'if', 'match', 'ns', 'type' ]
- builtins = [ 'cons', 'car', 'cdr' ]
+ keywords = [ 'def', 'def-type', 'fn', 'if', 'let', 'match' ]
+ builtins = [ 'Tup' ]
valid_name = r'[.a-zA-Z0-9!$%&*+,/:<=>?@^_~|-]+'
@@ -74,12 +74,12 @@ class RespStyleDark(Style):
default_style = "#FFF"
background_color = "#222"
styles = {
- Comment: '#79E',
- Keyword: '#EE5',
+ Comment: '#9BF',
+ Keyword: '#AFA',
Name: '#DDD',
Text: '#DDD',
String: '#F88',
- Keyword.Type: '#5E5',
+ Keyword.Type: '#BCE',
Punctuation: '#AAA',
Number: '#F88'
}
@@ -88,14 +88,14 @@ class RespStyleLight(Style):
default_style = "#FFF"
background_color = "#EEE"
styles = {
- Comment: '#57C',
- Keyword: '#AA0',
- Name: '#777',
- Text: '#777',
- String: '#D66',
- Keyword.Type: '#3C3',
- Punctuation: '#888',
- Number: '#D66'
+ Comment: '#36A',
+ Keyword: '#181',
+ Name: '#000',
+ Text: '#000',
+ String: '#944',
+ Keyword.Type: '#236',
+ Punctuation: '#111',
+ Number: '#944'
}
if len(sys.argv) != 3:
@@ -124,7 +124,7 @@ if re.match('.*\.html$', sys.argv[2]):
<title>%s</title>
<style type="text/css">''' % sys.argv[1]
print >>outfile, formatter.get_style_defs('.highlight')
- print >>outfile, ''' </style>
+ print >>outfile, '''.highlight { margin: 0; padding: 1ex; border-width: 0; }</style>
</head>
<body>
'''
diff --git a/test/match.resp b/test/match.resp
index 83ea505..0df0568 100644
--- a/test/match.resp
+++ b/test/match.resp
@@ -1,12 +1,13 @@
+; A Shape is either a Circle (w/ radius) or a Rectangle (w/ width/height)
(def-type (Shape)
(Circle Float)
(Rectangle Float Float))
+; Return the area of s
(def (area s)
(match s
- (Rectangle w h) (* w h)
- (Circle r) (* 3.14159 r)))
-
+ (Rectangle w h) (* w h)
+ (Circle r) (* 3.14159 r)))
(def s (Rectangle 3.0 4.0))