Re: help with storing user input
- Posted by Jason Dube <dubetyrant at hotmail.com> May 17, 2003
- 415 views
Hey, I know your not responsible for teaching me to code with euphoria, but this algoritm uses the language in a lot of ways I couldn't imagine. This part of the code is kinda confusing for me, in order to understand the big for statement that follows, dont I have to find out whats going on with this pquotes variable? -Basically I'm wondering what kinds of parameters the caller of this function would specify for pquotes. > > -- Validate quote marks parameter > > if sequence(pQuotes) then > > if length(pQuotes) = 0 then --excuse me if I dont know euphoria syntax that well, but how could the length of pquotes possibly be zero. This function has to take four arguments right?In my mind control would never be passed here because euphoria wont run this program without getting four arguments.(Thinking out loud)so this line is simply testing to see if the caller has specified {} an empty sequence as a parameter? > > pQuotes = {{},{},{},{},{}} ok, so now it has five empty sequences in it, why? > > elsif (length(pQuotes) != 5 > > or > > atom(pQuotes[1]) > > or > > atom(pQuotes[2]) > > or > > atom(pQuotes[3]) > > or > > length(pQuotes[1]) != length(pQuotes[2]) > > or > > atom(pQuotes[4]) > > or > > atom(pQuotes[5]) > > or > > length(pQuotes[4]) != length(pQuotes[5]) > > ) > > then > > pQuotes = 0 > > end if > > end if --no idea why to test for all these things > > > > if atom(pQuotes) then > > if pQuotes = 0 then > > pQuotes = {"\"'`", "\"'`", "\\~","",""} > > else > > pQuotes = {{pQuotes}, {pQuotes},{},{},{}} > > end if > > end if -no clue:) > >This is just validating and initializing the pQuotes group of data. > pQuotes[1] and [2] is a pair of character sets. [1] is the start quote >and >[2] is the matching end quote. All the characters inside the quotes is >considered to be a word. okay I understand what your saying here...Im just not getting how you made that happen with your code. > > pQuotes[3] is a list of characters that are 'escape' characters to be >used >inside quoted strings. For example... --so an escape character like ~ would be listed as a seperate sequence? > > 'abc~'def' > >with pQuotes = { "'", "'", '~', ...} > >gives the word value as abc'def ok > --Overall I think I'll just use the simpler function, Im really not able yet to understand this function. I do understand the simpler one though!! --Thanks for taking the time to explain, I'll probably be able to figure it out sometime:) --And I'll make sure to credit you wherever I use it(the simpletokenize, that is) _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail