abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
verParse.c File Reference
#include "ver.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Ver_ParseSkipComments (Ver_Man_t *pMan)
 DECLARATIONS ///. More...
 
char * Ver_ParseGetName (Ver_Man_t *pMan)
 

Function Documentation

char* Ver_ParseGetName ( Ver_Man_t pMan)

Function*************************************************************

Synopsis [Parses a Verilog name that can be being with a slash.]

Description []

SideEffects []

SeeAlso []

Definition at line 91 of file verParse.c.

92 {
93  Ver_Stream_t * p = pMan->pReader;
94  char Symbol;
95  char * pWord;
96  pMan->fNameLast = 0;
97  if ( !Ver_StreamIsOkey(p) )
98  return NULL;
99  if ( !Ver_ParseSkipComments( pMan ) )
100  return NULL;
101  Symbol = Ver_StreamScanChar( p );
102  if ( Symbol == '\\' )
103  {
104  pMan->fNameLast = 1;
105  Ver_StreamPopChar( p );
106  pWord = Ver_StreamGetWord( p, " \r\n" );
107  Ver_StreamSkipChars( p, " \r\n" );
108  if ( Ver_StreamScanChar(p) == '[' )
109  {
110  char This, * pEnd = pWord + strlen( pWord );
111  while ( (This = Ver_StreamPopChar(p)) != ']' )
112  *pEnd++ = This;
113  *pEnd++ = This;
114  *pEnd = 0;
115  }
116  }
117  else
118  pWord = Ver_StreamGetWord( p, " \t\n\r(),;" );
119  if ( Ver_StreamIsOkey(p) && !Ver_ParseSkipComments( pMan ) )
120  return NULL;
121  return pWord;
122 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char Ver_StreamPopChar(Ver_Stream_t *p)
Definition: verStream.c:275
char * Ver_StreamGetWord(Ver_Stream_t *p, char *pCharsToStop)
Definition: verStream.c:397
char Ver_StreamScanChar(Ver_Stream_t *p)
Definition: verStream.c:258
int Ver_StreamIsOkey(Ver_Stream_t *p)
Definition: verStream.c:242
void Ver_StreamSkipChars(Ver_Stream_t *p, char *pCharsToSkip)
Definition: verStream.c:304
ABC_NAMESPACE_IMPL_START int Ver_ParseSkipComments(Ver_Man_t *pMan)
DECLARATIONS ///.
Definition: verParse.c:45
int strlen()
ABC_NAMESPACE_IMPL_START int Ver_ParseSkipComments ( Ver_Man_t pMan)

DECLARATIONS ///.

CFile****************************************************************

FileName [verParse.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Verilog parser.]

Synopsis [Performs some Verilog parsing tasks.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 19, 2006.]

Revision [

Id:
verParse.c,v 1.00 2006/08/19 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Skips the comments of they are present.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file verParse.c.

46 {
47  Ver_Stream_t * p = pMan->pReader;
48  char Symbol;
49  // skip spaces
50  Ver_StreamSkipChars( p, " \t\n\r" );
51  if ( !Ver_StreamIsOkey(pMan->pReader) )
52  return 1;
53  // read the first symbol
54  Symbol = Ver_StreamScanChar( p );
55  if ( Symbol != '/' )
56  return 1;
57  Ver_StreamPopChar( p );
58  // read the second symbol
59  Symbol = Ver_StreamScanChar( p );
60  if ( Symbol == '/' )
61  { // skip till the end of line
62  Ver_StreamSkipToChars( p, "\n" );
63  return Ver_ParseSkipComments( pMan );
64  }
65  if ( Symbol == '*' )
66  { // skip till the next occurrence of */
67  Ver_StreamPopChar( p );
68  do {
69  Ver_StreamSkipToChars( p, "*" );
70  Ver_StreamPopChar( p );
71  } while ( Ver_StreamScanChar( p ) != '/' );
72  Ver_StreamPopChar( p );
73  return Ver_ParseSkipComments( pMan );
74  }
75  sprintf( pMan->sError, "Cannot parse after symbol \"/\"." );
77  return 0;
78 }
void Ver_ParsePrintErrorMessage(Ver_Man_t *p)
Definition: verCore.c:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char Ver_StreamPopChar(Ver_Stream_t *p)
Definition: verStream.c:275
char Ver_StreamScanChar(Ver_Stream_t *p)
Definition: verStream.c:258
void Ver_StreamSkipToChars(Ver_Stream_t *p, char *pCharsToStop)
Definition: verStream.c:349
int Ver_StreamIsOkey(Ver_Stream_t *p)
Definition: verStream.c:242
char * sprintf()
void Ver_StreamSkipChars(Ver_Stream_t *p, char *pCharsToSkip)
Definition: verStream.c:304
ABC_NAMESPACE_IMPL_START int Ver_ParseSkipComments(Ver_Man_t *pMan)
DECLARATIONS ///.
Definition: verParse.c:45