1. Ambiguous documentation

Please explain what the Comments section means. I just don't get it.

8.50.7.3 show_tokens 
 
include euphoria/tokenize.e 
namespace tokenize 
public procedure show_tokens(integer fh, sequence tokens) 
 
Print token names and data for each token in `tokens` to the file handle `fh` 
Parameters: 
 
    fh - file handle to print information to 
    tokens - token sequence to print  
 
Comments: 
 
This does not take direct output from tokenize_string or tokenize_file. Instead they take the first element of their return value, the token stream only. 
-Bruce

new topic     » topic index » view message » categorize

2. Re: Ambiguous documentation

If you look at tokenize_string() at line 1154 in https://github.com/OpenEuphoria/euphoria/blob/master/include/euphoria/tokenize.e ,
it returns { tokens, ERR, ERR_LNUM, ERR_LPOS }. So that comment just means you should not pass the whole result from that, but res[1].

Perhaps a better way to word that might be:
Note that tokenize_string() and tokenize_file() return { tokens, ERR, ERR_LNUM, ERR_LPOS } and this routine only wants the res[1] from that.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Ambiguous documentation

The use of the term "res[1]", is what I would object to. People will look at that and wonder who res is.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Ambiguous documentation

On Euphoria 4.1 and later, you can use multiple assignment to split out all four values at once:

object tokens, err, lnum lpos 
{tokens,err,lnum,lpos} = tokenize_string( ... ) 

-Greg

new topic     » goto parent     » topic index » view message » categorize

5. Re: Ambiguous documentation

SDPringle said...

The use of the term "res[1]", is what I would object to. People will look at that and wonder who res is.

Fair enough, replace it with "first element"

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu