summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
author(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-09-08 07:09:52 +0000
committer(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-09-08 07:09:52 +0000
commitb1f96af92f5b8519c477de3bd8917e5220442f6b (patch)
treec29d1f6370f4498547c80a69e0440256eeaf39e7 /sample
parent48acbc5e03622f1eb0423a6c2a3a603f61acfac6 (diff)
This commit was manufactured by cvs2svn to create tag 'v1_1d-start'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_1d-start@299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/freq.rb8
-rw-r--r--sample/occur.rb8
-rw-r--r--sample/ruby-mode.el10
3 files changed, 16 insertions, 10 deletions
diff --git a/sample/freq.rb b/sample/freq.rb
index 16bf1794be..4e0206c114 100644
--- a/sample/freq.rb
+++ b/sample/freq.rb
@@ -1,13 +1,13 @@
# word occurrence listing
# usege: ruby freq.rb file..
-freq = {}
+freq = Hash.new(0)
while gets
while sub!(/\w+/, '')
word = $&
- freq[word] = freq.fetch(word, 0)+1
+ freq[word] += 1
end
end
-for word in freq.keys.sort
- printf("%s -- %d\n", word, freq[word])
+for word in freq.keys.sort!
+ print word, " -- ", freq[word], "\n"
end
diff --git a/sample/occur.rb b/sample/occur.rb
index 2141fade38..f489beee17 100644
--- a/sample/occur.rb
+++ b/sample/occur.rb
@@ -1,12 +1,12 @@
# word occurrence listing
# usege: ruby occur.rb file..
-freq = {}
+freq = Hash.new(0)
while gets()
for word in $_.split(/\W+/)
- freq[word] +=1
+ freq[word] += 1
end
end
-for word in freq.keys.sort
- printf("%s -- %d\n", word, freq[word])
+for word in freq.keys.sort!
+ print word, " -- ", freq[word], "\n"
end
diff --git a/sample/ruby-mode.el b/sample/ruby-mode.el
index 204654013f..d379a633c3 100644
--- a/sample/ruby-mode.el
+++ b/sample/ruby-mode.el
@@ -142,7 +142,7 @@ The variable ruby-indent-level controls the amount of indentation.
(interactive)
(kill-all-local-variables)
(use-local-map ruby-mode-map)
- (setq mode-name "ruby")
+ (setq mode-name "Ruby")
(setq major-mode 'ruby-mode)
(ruby-mode-variables)
(run-hooks 'ruby-mode-hook))
@@ -464,6 +464,12 @@ The variable ruby-indent-level controls the amount of indentation.
(setq bol (point))
(end-of-line)
(skip-chars-backward " \t")
+ (and (re-search-backward "#" (save-excursion
+ (beginning-of-line)
+ (point)) t)
+ (setq state (ruby-parse-region parse-start (point)))
+ (nth 0 state)
+ (goto-char (nth 0 state)))
(or (bobp) (forward-char -1))
(and
(or (and (looking-at ruby-symbol-re)
@@ -473,7 +479,7 @@ The variable ruby-indent-level controls the amount of indentation.
(goto-char (match-end 0))
(not (looking-at "[a-z_]"))))
(and (looking-at ruby-operator-re)
- (or (not (or (eq ?/ (char-after (point)))))
+ (or (not (eq ?/ (char-after (point))))
(null (nth 0 (ruby-parse-region parse-start (point)))))
(not (eq (char-after (1- (point))) ?$))
(or (not (eq ?| (char-after (point))))