Changeset 3695ff8cccdded552a1c5468e71253f9f12eb899

Show
Ignore:
Timestamp:
07/11/2008 01:49:12 AM (6 months ago)
Author:
Fedor Korsakov <fedorkorsakov@fedor-korsakovs-computer.local>
git-committer:
Fedor Korsakov <fedorkorsakov@fedor-korsakovs-computer.local> 1215766152 -0500
git-parent:

[32b8775b009de9d239164d3cc6d90cb12be2a4c5]

git-author:
Fedor Korsakov <fedorkorsakov@fedor-korsakovs-computer.local> 1215766152 -0500
Message:

[FIX] Added docstring support to Lisp.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ext/ohcount_native/ragel_parsers/lisp.rl

    r0b4bd62 r3695ff8  
    4545  } 
    4646 
    47   lisp_comment = ';' @comment nonnewline*; 
     47  lisp_docstring = '"'{3} @comment ( 
     48    newline %{ entity = INTERNAL_NL; } %lisp_ccallback 
     49    | 
     50    ws 
     51    | 
     52    (nonnewline - ws) @comment 
     53  )* :>> '"""' @comment; 
    4854 
    49   lisp_string = 
    50     '"' @code ( 
     55  lisp_line_comment = ';' @comment nonnewline*; 
     56 
     57  lisp_comment = lisp_line_comment | lisp_docstring; 
     58 
     59  lisp_empty_string = 
     60    '"'{2} [^"] @{fhold;} @code; 
     61 
     62  lisp_char_string = 
     63    '"' [^"] '"' @code; 
     64 
     65  lisp_regular_string = 
     66    '"' ([^"]{2}) @code ( 
    5167      newline %{ entity = INTERNAL_NL; } %lisp_ccallback 
    5268      | 
     
    5773      '\\' nonnewline @code 
    5874    )* '"'; 
     75 
     76  lisp_string = lisp_empty_string | lisp_char_string | lisp_regular_string; 
    5977 
    6078  lisp_line := |* 
  • test/expected_dir/lsp1.lsp/lisp/comment

    rb4f9575 r3695ff8  
    11;;; CrapsSim.lsp 
    2 ;;; The main purpose of this program was to implement a Craps game, using a language that we have just 
    3 ;;; learned.  Also, it was written in a functional style with almost no reliance on the assignment 
    4 ;;; operation.  Only one local variable called THROW was used. 
     2""" 
     3The main purpose of this program was to implement a Craps game, using a language that we have just 
     4learned.  Also, it was written in a functional style with almost no reliance on the assignment 
     5operation.  Only one local variable called THROW was used. 
     6""" 
    57;;; ====================================================================================================== ;;; 
    68;;; ======================================= CRAPS SIMULATION ============================================= ;;; 
  • test/src_dir/lsp1.lsp

    rb4f9575 r3695ff8  
    11;;; CrapsSim.lsp 
    22 
    3 ;;; The main purpose of this program was to implement a Craps game, using a language that we have just 
    4 ;;; learned.  Also, it was written in a functional style with almost no reliance on the assignment 
    5 ;;; operation.  Only one local variable called THROW was used. 
     3""" 
     4The main purpose of this program was to implement a Craps game, using a language that we have just 
     5learned.  Also, it was written in a functional style with almost no reliance on the assignment 
     6operation.  Only one local variable called THROW was used. 
     7""" 
    68 
    79 
  • test/unit/lisp_test.rb

    r101d05d r3695ff8  
    88  end 
    99 
     10  def test_doc_string 
     11    lb = [Ohcount::LanguageBreakdown.new("lisp", "", '""" comment """', 0)] 
     12    assert_equal lb, Ohcount::parse(' """ comment """', "lisp") 
     13  end 
     14 
     15  def test_doc_string_blank 
     16    lb = [Ohcount::LanguageBreakdown.new("lisp", "", '""""""', 0)] 
     17    assert_equal lb, Ohcount::parse(' """"""', "lisp") 
     18  end 
     19 
    1020  def test_comprehensive 
    1121    verify_parse("lsp1.lsp")