| ︙ | | | ︙ | |
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
|
#define TT_Comment 4 /* Either C or C++ style comment */
#define TT_Number 5 /* Any numeric constant */
#define TT_String 6 /* String or character constants. ".." or '.' */
#define TT_Braces 7 /* All text between { and a matching } */
#define TT_EOF 8 /* End of file */
#define TT_Error 9 /* An error condition */
#define TT_BlockComment 10 /* A C-Style comment at the left margin that
* spans multple lines */
#define TT_Other 0 /* None of the above */
/*
** Get a single low-level token from the input file. Update the
** file pointer so that it points to the first character beyond the
** token.
**
|
|
|
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
|
#define TT_Comment 4 /* Either C or C++ style comment */
#define TT_Number 5 /* Any numeric constant */
#define TT_String 6 /* String or character constants. ".." or '.' */
#define TT_Braces 7 /* All text between { and a matching } */
#define TT_EOF 8 /* End of file */
#define TT_Error 9 /* An error condition */
#define TT_BlockComment 10 /* A C-Style comment at the left margin that
* spans multiple lines */
#define TT_Other 0 /* None of the above */
/*
** Get a single low-level token from the input file. Update the
** file pointer so that it points to the first character beyond the
** token.
**
|
| ︙ | | | ︙ | |
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
|
/*
** At this point, we know we have a type declaration that is bounded
** by pList and pEnd and has the name pName.
*/
/*
** If the braces are followed immedately by a semicolon, then we are
** dealing a type declaration only. There is not variable definition
** following the type declaration. So reset...
*/
if( pEnd->pNext==0 || pEnd->pNext->zText[0]==';' ){
*pReset = ';';
need_to_collapse = 0;
}else{
|
|
|
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
|
/*
** At this point, we know we have a type declaration that is bounded
** by pList and pEnd and has the name pName.
*/
/*
** If the braces are followed immediately by a semicolon, then we are
** dealing a type declaration only. There is not variable definition
** following the type declaration. So reset...
*/
if( pEnd->pNext==0 || pEnd->pNext->zText[0]==';' ){
*pReset = ';';
need_to_collapse = 0;
}else{
|
| ︙ | | | ︙ | |
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
|
** definition or a function prototype. Return TRUE if we are dealing
** with a variable defintion and FALSE for a prototype.
**
** pEnd is the token that ends the object. It can be either a ';' or
** a '='. If it is '=', then assume we have a variable definition.
**
** If pEnd is ';', then the determination is more difficult. We have
** to search for an occurance of an ID followed immediately by '('.
** If found, we have a prototype. Otherwise we are dealing with a
** variable definition.
*/
static int isVariableDef(Token *pFirst, Token *pEnd){
if( pEnd && pEnd->zText[0]=='=' &&
(pEnd->pPrev->nText!=8 || strncmp(pEnd->pPrev->zText,"operator",8)!=0)
){
|
|
|
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
|
** definition or a function prototype. Return TRUE if we are dealing
** with a variable defintion and FALSE for a prototype.
**
** pEnd is the token that ends the object. It can be either a ';' or
** a '='. If it is '=', then assume we have a variable definition.
**
** If pEnd is ';', then the determination is more difficult. We have
** to search for an occurrence of an ID followed immediately by '('.
** If found, we have a prototype. Otherwise we are dealing with a
** variable definition.
*/
static int isVariableDef(Token *pFirst, Token *pEnd){
if( pEnd && pEnd->zText[0]=='=' &&
(pEnd->pPrev->nText!=8 || strncmp(pEnd->pPrev->zText,"operator",8)!=0)
){
|
| ︙ | | | ︙ | |
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
|
DeclSetProperty(p,DP_Forward|DP_Declared|DP_Flag);
}else{
DeclClearProperty(p,DP_Flag);
}
}
/*
** Call ScanText() recusively (this routine is called from ScanText())
** to include declarations required to come before these declarations.
*/
for(p=pDecl; p; p=p->pSameName){
if( DeclHasProperty(p,DP_Flag) ){
if( p->zDecl[0]=='#' ){
ScanText(&p->zDecl[1],pState);
}else{
|
|
|
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
|
DeclSetProperty(p,DP_Forward|DP_Declared|DP_Flag);
}else{
DeclClearProperty(p,DP_Flag);
}
}
/*
** Call ScanText() recursively (this routine is called from ScanText())
** to include declarations required to come before these declarations.
*/
for(p=pDecl; p; p=p->pSameName){
if( DeclHasProperty(p,DP_Flag) ){
if( p->zDecl[0]=='#' ){
ScanText(&p->zDecl[1],pState);
}else{
|
| ︙ | | | ︙ | |
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
|
}
}
/* printf("END SCANTEXT\n"); */
}
/*
** Provide a full declaration to any object which so far has had only
** a foward declaration.
*/
static void CompleteForwardDeclarations(GenState *pState){
Decl *pDecl;
int progress;
do{
progress = 0;
|
|
|
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
|
}
}
/* printf("END SCANTEXT\n"); */
}
/*
** Provide a full declaration to any object which so far has had only
** a forward declaration.
*/
static void CompleteForwardDeclarations(GenState *pState){
Decl *pDecl;
int progress;
do{
progress = 0;
|
| ︙ | | | ︙ | |