[Solved] Syntax Error, Unexpected:

Status
Not open for further replies.
I think i have seen this error before from beginners. If you give me a good error message i can special-case this in pjass.
This is what i currently have:
Code:
$ cat test.j
type unit extends handle

function foo takes nothing returns nothing
    local unit u
    local unit v
    set unit u = null
    set u unit = null
    set v u = null
endfunction

$ ./pjass test.j
test.j:6: >unit< u is an error here. The type only needs to be stated at declartion time
test.j:7: u >unit< is an error here. The type only needs to be stated at declartion time
test.j:8: Unexpected 'u'
test.j failed with 3 errors
Parse failed: 3 errors total
 
Last edited:
"variable u type respecified/restated"? It's not redeclared but there has to be a good word for it.
The assignment statement is not valid. Nowhere in an assignement statement is a type expected or even allowed.

JASS:
// local declaration with optional definition
local {type} *varname* (= [expression of {type}])

// local assignment
set *varname* = [expression of {type}]
where...
  • {} represent a previously declared type name
  • ## represent a declared variable name that is not a key word or a type name.
  • () represent the enclosed is optional
  • [] represent an expression governed by other syntax rules not covered here
I am sure there is a better and more clear way to describe the syntax. Just I am not experienced with such.
 
Last edited:
Status
Not open for further replies.
Back
Top