Author |
Message
|
Emil_halim Ziron Beta Tester
(send private message)
Posts: 639 Topics: 104
Location: Alex, Egypt | [372] - posted: 2011-11-05 19:13:40 i am Little confused ,i got this error ,Ziron ver 1.1.26.1
PlugSys: Unexpected token type
Code:
Var = 1000;
here is the uptodate Plugin
Code:function event_Dim()
{
uses edi;
Dword Len;
char var[255];
char buf[1024];
repeat {
buf = 0; //make sure buf is initialized otherwise it may be filled with junk
eax = Ziron_ExpectNextToken(zirIdent);
if (eax == -1) {
Ziron_FatalError('Expected Variable Name');
return true;
}
H_strcpy(@var,Ziron_GetStringValue());
Ziron_ShowMessage(@var);
eax = Ziron_GetNextToken();
//push eax; Ziron_ShowMessage(@var); pop eax;
case (eax)
{
/********* Dim Var as int32; **************/
state zirAs:
eax = Ziron_ExpectNextToken(zirDATA_TYPE);
if (eax == -1)
{
Ziron_FatalError('Expected data type');
return true;
}
eax = Ziron_GetStringValue();
H_strcat(@buf,eax);
H_strcat(@buf,' ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* dim k%; **************/
state zirModSym:
H_strcat(@buf,'int32 ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* dim k$; **************/
state zirDollarSym:
H_strcat(@buf,'char ');
H_strcat(@buf,@var);
H_strcat(@buf,'[1024];');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* dim k!; **************/
state zirExclamation:
H_strcat(@buf,'single ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* dim k#; **************/
state zirHash:
H_strcat(@buf,'double ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* **************
state zirIdent:
eax = Ziron_GetStringValue();
break;
/********* **************/
default:
Ziron_FatalError('Expected as Keyword');
return true;
}
eax = Ziron_IsNextLineBreak();
if(eax)
{
break; // check end of line so we end without semicolon
}
eax = Ziron_GetNextToken();
if (eax == zirSEMI_COLON)
{
break;
} elseif (eax != zirCOMMA) {
Ziron_FatalError('Unexpected token type');
}
};
return true;
}
http://www.freewebs.com/ogremagic/index.htm |
Emil_halim Ziron Beta Tester
(send private message)
Posts: 639 Topics: 104
Location: Alex, Egypt | [373] - posted: 2011-11-05 19:14:51
and here is the test program
Code:program WIN32CUI 'Basic Syntax test';
#include 'console.zir';
function H_strcpy(Dword dst,src)
{
Eax = dst;
Edx = src;
push Eax;
BL = [Edx];
while ( BL != 0)
{
[Eax] = BL;
Eax++; Edx++;
BL = [Edx];
}
[Eax] = 0;
pop Eax;
}
eax = 1;
print('eax = ', eax:int, '\r\n');
Dim Var as int32 // note well , in basic there is no semicolon at end of file
DIM Name$
DIM a AS int32, b AS Dword, c AS char
dim k%
dim S!
dim M#
Var = 1000;
a = -10;
b = 150;
c = ord('A');
k = -2000;
H_strcpy(@Name , 'Emil');
print('Var = ', Var, '\r\n');
print('a = ', a, '\r\n');
print('b = ', b, '\r\n');
print('c = ');
WriteLnEx(@c,1);
print('k = ', k, '\r\n');
WriteLnEx(@Name,4);
wait_key(nil);
ExitProcess(0);
so what could be the problem?
http://www.freewebs.com/ogremagic/index.htm |
Admin Site Admin
(send private message)
Posts: 933 Topics: 55
Location: OverHertz Studio | [374] - posted: 2011-11-05 19:25:57
Code: eax = Ziron_GetNextToken();
if (eax == zirSEMI_COLON)
{
break;
} elseif (eax != zirCOMMA) {
Ziron_FatalError('Unexpected token type');
}
this is your problem, you are enforcing the semi colon, and in the test code you do not put semi colons.
And actually i see i need to add another pf function to peek at the next token, i will add it now, and give you link for testing with.
what you will need is
Code: eax = Ziron_PeekNextToken();
if (eax == zirCOMMA) {
Ziron_GetNextToken();
} else {
break;
}
give me 5 minutes.
Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message. |
Admin Site Admin
(send private message)
Posts: 933 Topics: 55
Location: OverHertz Studio | [375] - posted: 2011-11-05 19:31:41 ok sent you link
Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message. |
Emil_halim Ziron Beta Tester
(send private message)
Posts: 639 Topics: 104
Location: Alex, Egypt | [376] - posted: 2011-11-05 19:37:31 the same error with ver 1.1.27.5 alpha
code:
Dim Name$
Code:function event_Dim()
{
uses edi;
Dword Len;
char var[255];
char buf[1024];
repeat {
buf = 0; //make sure buf is initialized otherwise it may be filled with junk
eax = Ziron_ExpectNextToken(zirIdent);
if (eax == -1) {
Ziron_FatalError('Expected Variable Name');
return true;
}
H_strcpy(@var,Ziron_GetStringValue());
Ziron_ShowMessage(@var);
eax = Ziron_GetNextToken();
//push eax; Ziron_ShowMessage(@var); pop eax;
case (eax)
{
/********* Dim Var as int32; **************/
state zirAs:
eax = Ziron_ExpectNextToken(zirDATA_TYPE);
if (eax == -1)
{
Ziron_FatalError('Expected data type');
return true;
}
eax = Ziron_GetStringValue();
H_strcat(@buf,eax);
H_strcat(@buf,' ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* dim k%; **************/
state zirModSym:
H_strcat(@buf,'int32 ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* dim k$; **************/
state zirDollarSym:
H_strcat(@buf,'char ');
H_strcat(@buf,@var);
H_strcat(@buf,'[1024];');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* dim k!; **************/
state zirExclamation:
H_strcat(@buf,'single ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* dim k#; **************/
state zirHash:
H_strcat(@buf,'double ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
H_strcat(@buf,'\r\n');
//Ziron_ShowMessage(@buf);
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false)
{
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
}
break;
/********* **************
state zirIdent:
eax = Ziron_GetStringValue();
break;
/********* **************/
default:
Ziron_FatalError('Expected as Keyword');
return true;
}
eax = Ziron_IsNextLineBreak();
if(eax)
{
break; // check end of line so we end without semicolon
}
eax = Ziron_PeekNextToken();
if (eax == zirCOMMA) {
Ziron_GetNextToken();
} else {
break;
}
};
return true;
}
http://www.freewebs.com/ogremagic/index.htm |
Admin Site Admin
(send private message)
Posts: 933 Topics: 55
Location: OverHertz Studio | [377] - posted: 2011-11-05 20:15:51 i cleaned up the function a little and compiled with your test code, compiled without a problem
Code:function event_Dim() {
uses edi;
Dword Len;
char var[255];
char buf[1024];
repeat {
buf = 0; //make sure buf is initialized otherwise it may be filled with junk
eax = Ziron_ExpectNextToken(zirIdent);
if (eax == -1) {
Ziron_FatalError('Expected Variable Name');
return true;
}
H_strcpy(@var,Ziron_GetStringValue());
Ziron_ShowMessage(@var);
eax = Ziron_GetNextToken();
//push eax; Ziron_ShowMessage(@var); pop eax;
case (eax) {
/********* Dim Var as int32; **************/
state zirAs:
eax = Ziron_ExpectNextToken(zirDATA_TYPE);
if (eax == -1) {
Ziron_FatalError('Expected data type');
return true;
}
eax = Ziron_GetStringValue();
H_strcat(@buf,eax);
H_strcat(@buf,' ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k%; **************/
state zirModSym:
H_strcat(@buf,'int32 ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k$; **************/
state zirDollarSym:
H_strcat(@buf,'char ');
H_strcat(@buf,@var);
H_strcat(@buf,'[1024];');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k!; **************/
state zirExclamation:
H_strcat(@buf,'single ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* dim k#; **************/
state zirHash:
H_strcat(@buf,'double ');
H_strcat(@buf,@var);
H_strcat(@buf,';');
Len = H_strlen(@buf);
eax = Ziron_Execute(@buf,Len);
if (eax == false) {
Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
return true;
}
break;
/********* **************
//state zirIdent:
//eax = Ziron_GetStringValue();
//break;
/********* **************/
default:
Ziron_FatalError('Expected as Keyword');
return true;
}
eax = Ziron_IsNextLineBreak();
if (eax) {
break; // check end of line so we end without semicolon
}
eax = Ziron_PeekNextToken();
if (eax == zirCOMMA) {
Ziron_GetNextToken();
} else {
break;
}
};
return true;
}
i could not see any problems.
Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message. |
Emil_halim Ziron Beta Tester
(send private message)
Posts: 639 Topics: 104
Location: Alex, Egypt | [378] - posted: 2011-11-05 20:25:15
oh , no , i have cut and past your post , and test it again
still get the same error ?
http://www.freewebs.com/ogremagic/index.htm |
Admin Site Admin
(send private message)
Posts: 933 Topics: 55
Location: OverHertz Studio | [379] - posted: 2011-11-05 20:27:26 did you re-download the latest package from your Private Message ?
Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message. |