Re: EXACT meaning of 2 error messages

new topic     » goto parent     » topic index » view thread      » older message » newer message
eddo said...

OK -WHY does Euphoria give this error message??? Does anyone know??? I mean, there must be a reason! Is it a secret? It is hair-pulling bugs like this, need I point out, then when encountered by anyone trying out the language with an eye to maybe adopting it, send them scurrying away forever.

Lets start with a test program to examine what the Euphoria parser may be doing:

include std/console.e 
include euphoria/tokenize.e 
 
 
object crud =  
` 

-- file type.exw 
typo 
` 

 
display(crud) 
crud = tokenize_string( crud )     -- works like interpreter 
crud = crud[1]                     -- clean up the output somewhat 
display( crud ) 
display( token_names[ crud[1][1] ] ) -- first item is the identity of the token 
 
/* 

-- file type.exw 
typo 
{ 
  { 
    9, 
    "typo", 
    2, 
    1, 
    -1 
  } 
} 
T_IDENTIFIER 
*/ 

So Euphoria recognizes the word typo as an identifier.

This identifier (so far) has not been declared to be a data-object nor has it been declared to be some kind of subroutine. It is just a name.

As a first guess assume that the identifier is a variable name.

Now, what can you do with an identifier name?

  • assign a value to it
  • use the identifier as an argument to subroutine
  • output its value

Not enough code in this example for it to be an argument or part of an output statement. That leaves "assignment."

Now if you intended to assign a value to the word typo the next thing that must be written is the assignment operator = (equals symbol or something similar ).

<0076>:: expected to see an assignment after 'typo', such as =, +=, -=, *=, / or &= 

Euphoria therefore gives you a "guess" that you wanted to write an assignment statement. Euphoria also gives a a list of possible ways to write that assignment statement.

Frustrating but logical.

_tom

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu