irb freaks out over a case stmt...

D

Dave Rose

i'm writing a method within the Akill class that cascades down 2 sql
stmts inside some if and when stmts....but i get this when i added the
last branch of if stmts: what happened note : ALL 'end' stmts are
properly matched?> #get defaults of kwd=0,kvar=700,kwh=1500
?> #else nil
?> case scatDisplay all 459 possibilities? (y or n)
== SecurityError
=== Signal
=~ SignalException
ARGF SimpleDelegater
ARGV SimpleDelegator
Akill SingleForwardable
ArgumentError SizedQueue
Array StandardError
BEGIN String
Bignum Struct
Binding Symbol
CROSS_COMPILING SyntaxError
Class SystemCallError
Comparable SystemExit
ConditionVariable SystemStackError
Config TOPLEVEL_BINDING
Continuation TRUE
Data Tempfile
Date Thread
DateTime ThreadError
DelegateClass ThreadGroup
Delegater Time
Delegator TrueClass
--Mor>> scat=='KVAR' 700Display all 459 possibilities? (y or n)
== SecurityError
=== Signal
=~ SignalException
ARGF SimpleDelegater
ARGV SimpleDelegator
Akill SingleForwardable
ArgumentError SizedQueue
Array StandardError
BEGIN String
Bignum Struct
Binding Symbol
CROSS_COMPILING SyntaxError
Class SystemCallError
Comparable SystemExit
ConditionVariable SystemStackError
Config TOPLEVEL_BINDING
Continuation TRUE
Data Tempfile
Date Thread
DateTime ThreadError
DelegateClass ThreadGroup
Delegater Time
Delegator TrueClass
--Mor>> scat=='KWD' 0Display all 459 possibilities? (y or n)
== SecurityError
=== Signal
=~ SignalException
ARGF SimpleDelegater
ARGV SimpleDelegator
Akill SingleForwardable
ArgumentError SizedQueue
Array StandardError
BEGIN String
Bignum Struct
Binding Symbol
CROSS_COMPILING SyntaxError
Class SystemCallError
Comparable SystemExit
ConditionVariable SystemStackError
Config TOPLEVEL_BINDING
Continuation TRUE
Data Tempfile
Date Thread
DateTime ThreadError
DelegateClass ThreadGroup
Delegater Time
Delegator TrueClass
--MorDir TypeError
END UnboundMethod
ENV VERSION
EOFError Win32API
Enumerable ZeroDivisionError
Errno _
Exception __id__
Exception2MessageMapper __send__
FALSE `
FalseClass abort
File alias
FileTest and
Fixnum at_exit
Float autoload
FloatDomainError autoload?
Forwardable begin
GC binding
Gem bindings
Hash block_given?
IO break
IOError callcc
IRB caller
IndexError case
--More--Integer catch
--More--Interrupt cb
Kconv chomp
Kernel chomp!
LoadError chop
LocalJumpError chop!
Marshal chws
MatchData class
MatchingData clone
Math conf
Method context
Module cws
Mutex cwws
NIL def
NameError defined
NilClass display
NoMemoryError do
NoMethodError dup
NotImplementedError else
Numeric elsif
OCI8 end
OCIBind ensure
OCIBreak eql?
OCIContinue equal?
--More-->> dSyntaxError: compile error
(irb):182: syntax error
(irb):183: syntax error
(irb):184: syntax error
(irb):190: syntax error
from (irb):190
from ?:0
 
R

Ryan Davis

i'm writing a method within the Akill class that cascades down 2 sql
stmts inside some if and when stmts....but i get this when i added the
last branch of if stmts: what happened note : ALL 'end' stmts are
properly matched

?> #get defaults of kwd=0,kvar=700,kwh=1500
?> #else nil
?> case scat
Display all 459 possibilities? (y or n)

I can't even tell what you are trying to do / write. It looks like
"freak out" in your world means "respond with everything when I hit
tab in a place without context" which is exactly what it should do.
If not, I suggest turning off tab completion first and trying again.

But beyond that, I still can't tell what you are trying to write. If
it is something like:

case scat
when scat == 'KWH' 1500
scat=='KVAR' 700
scat=='KWD' 0
end

then yup. You're going to get a syntax error as you did in your email
and that has nothing to do with IRB. Try it just using ruby -c -e
'...code...' for example to see. GIGO. See http://www.zenspider.com/
Languages/Ruby/QuickRef.html#23 for examples of how to write properly
formed case statements.
 
K

Ken Bloom

I can't even tell what you are trying to do / write. It looks like
"freak out" in your world means "respond with everything when I hit
tab in a place without context" which is exactly what it should do.
If not, I suggest turning off tab completion first and trying again.

How do you turn off tab completion in IRB?
 
D

Dave Rose

Ken said:
yes,,...>>>>How do you turn off tab completion in IRB?
...how do turn off the tab because that was the case (sort of speak)
i mean i use sciteK editor the comes with the one-click installer and i
guess i puts a tab in there somewhere but i don't know how?
 
X

x1

in scite, just hit F5 to execute the app/script.. no need to past to
irb (assuming that's what you're doing
 
K

Ken Bloom

in scite, just hit F5 to execute the app/script.. no need to past to
irb (assuming that's what you're doing

I prefer my gvim and my xterm, thank you very much. How do I turn off tab
completion in IRB?

--Ken
 
R

Reprisal

I prefer my gvim and my xterm, thank you very much. How do I turn
off tab
completion in IRB?

irb -f --readline #ignore .irbrc file and load readline w/o tab
completion
irb --noreadline #disable readline altogether
 
K

Ken Bloom

irb -f --readline #ignore .irbrc file and load readline w/o tab
completion
irb --noreadline #disable readline altogether

It seems that I don't have a .irbrc, but I still have tab completion. I'd
like to have readline support but no completion, but I don't know what to
put in my .irbrc (or .inputrc) to disable this.

--Ken
 
K

Ken Bloom

Ken Bloom said:
It seems that I don't have a .irbrc, but I still have tab completion. I'd
like to have readline support but no completion, but I don't know what to
put in my .irbrc (or .inputrc) to disable this.

I figured it out. Somehow, at the end of
/usr/lib/ruby/1.8/irb/completion.rb, I have the lines:

if Readline.respond_to?("basic_word_break_characters=")
Readline.basic_word_break_characters= " \t\n\"\\'`><=;|&{("
end
Readline.completion_append_character = nil
Readline.completion_proc = IRB::InputCompletor::CompletionProc

So I just put code in my .irbrc to undo it:
#disable completion, so that hitting tab just inserts a tab character
Readline.completion_append_character = ""
Readline.completion_proc = lambda {|x| x+"\t"}

--Ken Bloom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top