itdiy / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

Add define and cond as keywords for Scheme? #107

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Scheme formatted code doesn't have define or cond as highlighted 
keywords

This code looks kind of bland under the standard formatting for lang-scm:
<pre class='prettyprint lisp-scm'>Ex 1.2
    (/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 8))))) (* 3 (- 6 2) (- 2 7)))

Ex 1.3
    (define (f a b c) (if (and (&lt; a b) (&lt; a c)) (+ (* b b) (* c 
c)) (+ (* a a) (if (&lt; b c) (* c c) (* b b)))))

Ex 1.7
    (define (good-enough? guess last) (and (&gt; 1.001 (/ guess last)) 
(&gt; 1.001 (/ last guess))))
    (define (sqrt-iter guess last x)
      (if (good-enough? guess last)
          guess
          (sqrt-iter (improve guess x) guess
                 x)))
        (define (sqt x)
      (sqrt-iter 1.0 2.0 x))

Ex 1.8
    (define (improve-curt guess x) (/ (+ (/ x (square guess)) (* 2 
guess)) 3))
    (define (curt x)
        (curt-iter 1.0 2.0 x))
    (define (curt-iter guess last x)
        (if (good-enough? guess last x)
        guess
        (curt-iter (improve-curt guess x) guess x)))
</pre> 

What is the expected output?  What do you see instead?

After I added "define" and "cond" to the keywords list in lang-lisp.js, it 
looked better and works fine. See the fixed version here:  
http://www.crunchcourse.com/class/structure-and-interpretation-of-
comp/2010/jan/lesson/1/assgn/1/

What version are you using?  On what browser?
Version dated Dec. 3, 2009.  Chrome 4.0.249.43

Original issue reported on code.google.com by kda...@gmail.com on 16 Jan 2010 at 11:41

GoogleCodeExporter commented 9 years ago
Fixed at revision 109

Original comment by mikesamuel@gmail.com on 21 Jul 2010 at 5:26

GoogleCodeExporter commented 9 years ago
Btw, if it looks bland, you can add styles for
  .opn { color: green }
  .clo { color: red }
which should highlight open and close parentheses.

Original comment by mikesamuel@gmail.com on 21 Jul 2010 at 7:45