5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
|
int iErrPt; /* Index of first byte of error from start of input */
int iErrCol; /* Column of the error token on its line */
int iStart; /* Start position of the error context */
int iEnd; /* End position of the error context */
int iLineno; /* Line number of the error */
int iFirstLineno; /* Line number of start of error context */
int i; /* Loop counter */
char zLineno[20]; /* Buffer in which to generate line numbers */
iErrPt = (int)(pErr->z - p->sIn.z);
iLineno = 1;
for(i=0; i<iErrPt; i++){
if( p->sIn.z[i]=='\n' ){
iLineno++;
}
}
iStart = 0;
|
>
>
>
>
>
>
>
>
>
>
|
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
|
int iErrPt; /* Index of first byte of error from start of input */
int iErrCol; /* Column of the error token on its line */
int iStart; /* Start position of the error context */
int iEnd; /* End position of the error context */
int iLineno; /* Line number of the error */
int iFirstLineno; /* Line number of start of error context */
int i; /* Loop counter */
int iBump = 0; /* Bump the location of the error cursor */
char zLineno[20]; /* Buffer in which to generate line numbers */
iErrPt = (int)(pErr->z - p->sIn.z);
if( iErrPt>=p->sIn.n ){
iErrPt = p->sIn.n-1;
iBump = 1;
}else{
while( iErrPt>0 && (p->sIn.z[iErrPt]=='\n' || p->sIn.z[iErrPt]=='\r') ){
iErrPt--;
iBump = 1;
}
}
iLineno = 1;
for(i=0; i<iErrPt; i++){
if( p->sIn.z[i]=='\n' ){
iLineno++;
}
}
iStart = 0;
|
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
|
pik_append(p, zLineno, -1);
for(i=iStart; p->sIn.z[i]!=0 && p->sIn.z[i]!='\n'; i++){}
pik_append_errtxt(p, p->sIn.z+iStart, i-iStart);
iStart = i+1;
pik_append(p, "\n", 1);
}
for(iErrCol=0, i=iErrPt; i>0 && p->sIn.z[i]!='\n'; iErrCol++, i--){}
for(i=0; i<iErrCol+11; i++){ pik_append(p, " ", 1); }
for(i=0; i<(int)pErr->n; i++) pik_append(p, "^", 1);
pik_append(p, "\n", 1);
}
/*
** Generate an error message for the output. pErr is the token at which
|
|
|
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
|
pik_append(p, zLineno, -1);
for(i=iStart; p->sIn.z[i]!=0 && p->sIn.z[i]!='\n'; i++){}
pik_append_errtxt(p, p->sIn.z+iStart, i-iStart);
iStart = i+1;
pik_append(p, "\n", 1);
}
for(iErrCol=0, i=iErrPt; i>0 && p->sIn.z[i]!='\n'; iErrCol++, i--){}
for(i=0; i<iErrCol+11+iBump; i++){ pik_append(p, " ", 1); }
for(i=0; i<(int)pErr->n; i++) pik_append(p, "^", 1);
pik_append(p, "\n", 1);
}
/*
** Generate an error message for the output. pErr is the token at which
|
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
|
#if 0
pik_parserTrace(stdout, "parser: ");
#endif
pik_tokenize(&s, &s.sIn, &sParse, 0);
if( s.nErr==0 ){
PToken token;
memset(&token,0,sizeof(token));
token.z = zText;
pik_parser(&sParse, 0, token);
}
pik_parserFinalize(&sParse);
if( s.zOut==0 && s.nErr==0 ){
pik_append(&s, "<!-- empty pikchr diagram -->\n", -1);
}
while( s.pVar ){
|
|
>
|
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
|
#if 0
pik_parserTrace(stdout, "parser: ");
#endif
pik_tokenize(&s, &s.sIn, &sParse, 0);
if( s.nErr==0 ){
PToken token;
memset(&token,0,sizeof(token));
token.z = zText + (s.sIn.n>0 ? s.sIn.n-1 : 0);
token.n = 1;
pik_parser(&sParse, 0, token);
}
pik_parserFinalize(&sParse);
if( s.zOut==0 && s.nErr==0 ){
pik_append(&s, "<!-- empty pikchr diagram -->\n", -1);
}
while( s.pVar ){
|
7927
7928
7929
7930
7931
7932
7933
7934
|
return TCL_OK;
}
#endif /* PIKCHR_TCL */
#line 7959 "pikchr.c"
|
|
|
7938
7939
7940
7941
7942
7943
7944
7945
|
return TCL_OK;
}
#endif /* PIKCHR_TCL */
#line 7970 "pikchr.c"
|