diff options
Diffstat (limited to 'sample')
-rw-r--r-- | sample/README | 60 | ||||
-rw-r--r-- | sample/mkproto.rb | 8 | ||||
-rw-r--r-- | sample/ruby-mode.el | 9 | ||||
-rw-r--r-- | sample/test.rb | 6 |
4 files changed, 72 insertions, 11 deletions
diff --git a/sample/README b/sample/README new file mode 100644 index 0000000000..90ac0c7220 --- /dev/null +++ b/sample/README @@ -0,0 +1,60 @@ +README this file +biorhythm.rb biorhythm calculator +cal.rb cal(1) clone +cbreak.rb no echo done by ioctl +clnt.rb socket client +dbmtest.rb test for dbm +dir.rb directory access +dstore.rb object database on dbm +eval.rb simple evaluator +export.rb method access example +exyacc.rb extrace BNF from yacc file +fact.rb factorial calculator +fib.awk Fibonacci number (AWK) +fib.pl Fibonacci number (Perl) +fib.py Fibonacci number (Python) +fib.rb Fibonacci number (Ruby) +fib.scm Fibonacci number (Scheme) +freq.rb count word occurrence +from.rb scan mail spool +fullpath.rb convert ls -lR to fullpath format +getopts.test test fot getopt.rb +goodfriday.rb print various christian calendar event. +inf-ruby.el program to run ruby under emacs +io.rb io test +less.rb front end for less +list.rb stupid object sample +list2.rb stupid object sample +list3.rb stupid object sample +mine.rb simple mine sweeper +mkproto.rb extract protptype from C +mpart.rb split file int multi part +mrshtest.rb test marshal +observ.rb observer design pattern sample +occur.pl count word occurrence (Perl) +occur.rb count word occurrence (Ruby) +occur2.rb count word occurrence - another style +philos.rb famous dining philosophers +pi.rb calculate PI +rbc.rb interactive ruby, to be removed by irb +rcs.awk random character stereogram (AWK) +rcs.rb random character stereogram (Ruby) +rcs.dat data for random character stereogram +regx.rb regular expression tester +ruby-mode.el ruby mode for emacs +rubydb2x.el ruby debugger support for emacs 19.2x or before +rubydb3x.el ruby debugger support for emacs 19.3x or later +sieve.rb sieve of Eratosthenes +svr.rb socket server +test.rb test suite used by `make test' +time.rb /usr/bin/time clone +tkbiff.rb mail notifier using Tk +tkbrowse.rb directory browser using Tk +tkdialog.rb dialog example +tkfrom.rb scan mail spool using Tk +tkhello.rb simple Tk example +tkline.rb simple Tk example +tktimer.rb stopwatch +trojan.rb simple tool to find file that may be trojan horse. +tsvr.rb socket server using thread +uumerge.rb merge files and uudecode them diff --git a/sample/mkproto.rb b/sample/mkproto.rb index 97006f9f54..8661240085 100644 --- a/sample/mkproto.rb +++ b/sample/mkproto.rb @@ -8,17 +8,17 @@ while gets() arg.gsub! ' +', ' ' if arg =~ /,/ if arg =~ /(([^*]+) *\** *[\w\d_]+),/ - type = $2.strip! - args.push $1.strip! + type = $2.strip + args.push $1.strip arg = $' else type = "" end while arg.sub!(/(\** *[\w\d_]+)(,|$)/, "") - args.push type + " " + $1.strip! + args.push type + " " + $1.strip end else - args.push arg.strip! + args.push arg.strip end end printf "%s);\n", args.join(', ') diff --git a/sample/ruby-mode.el b/sample/ruby-mode.el index 204654013f..f4c5ce98f0 100644 --- a/sample/ruby-mode.el +++ b/sample/ruby-mode.el @@ -253,7 +253,7 @@ The variable ruby-indent-level controls the amount of indentation. ((looking-at "%") (cond ((and (not (eobp)) (ruby-expr-beg) - (looking-at "%[Qqrx]?\\(.\\)")) + (looking-at "%[Qqrxw]?\\(.\\)")) (setq w (buffer-substring (match-beginning 1) (match-end 1))) (cond @@ -618,6 +618,7 @@ An end of a defun is found by moving forward from the beginning of one." "break" "case" "class" + "def" "do" "elsif" "else" @@ -646,7 +647,7 @@ An end of a defun is found by moving forward from the beginning of one." "while" ) "\\|") - "\\)[ \n\t()]") + "\\)\\b") 2) ;; variables '("\\(^\\|[^_]\\)\\b\\(nil\\|self\\|true\\|false\\)\\b\\([^_]\\|$\\)" @@ -658,8 +659,8 @@ An end of a defun is found by moving forward from the beginning of one." '("\\(^\\|[^_]\\)\\b\\([A-Z]+[a-zA-Z0-9_]*\\)" 2 font-lock-type-face) ;; functions - '("^\\s *def[ \t]+[^ \t(]*" - 0 font-lock-function-name-face t)) + '("^\\s *def[ \t]+\\([^ \t(]*\\)" + 1 font-lock-function-name-face t)) "*Additional expressions to highlight in ruby mode.") (if (and (>= (string-to-int emacs-version) 19) (not (featurep 'xemacs))) diff --git a/sample/test.rb b/sample/test.rb index 0adcb22307..55893cfc61 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -546,9 +546,9 @@ check "string & char" ok("abcd" == "abcd") ok("abcd" =~ "abcd") ok("abcd" === "abcd") -ok(("abc" =~ /^$/) == false) -ok(("abc\n" =~ /^$/) == false) -ok(("abc" =~ /^d*$/) == false) +ok("abc" !~ /^$/) +ok("abc\n" !~ /^$/) +ok("abc" !~ /^d*$/) ok(("abc" =~ /d*$/) == 3) ok("" =~ /^$/) ok("\n" =~ /^$/) |