align TOK_TOKEN state change of translate() and translate2() to all other parsers
This commit is contained in:
parent
5feb4539c7
commit
7e1f591b18
23
src/token.c
23
src/token.c
|
|
@ -2428,7 +2428,6 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level
|
||||||
( (space || c == '%' || c == '@') && !escape ) ||
|
( (space || c == '%' || c == '@') && !escape ) ||
|
||||||
( (!space && c != '%' && c != '@') && escape )
|
( (!space && c != '%' && c != '@') && escape )
|
||||||
)
|
)
|
||||||
|
|
||||||
) {
|
) {
|
||||||
state=TOK_SEP;
|
state=TOK_SEP;
|
||||||
}
|
}
|
||||||
|
|
@ -2957,13 +2956,12 @@ const char *translate(int inst, const char* s)
|
||||||
else escape=0;
|
else escape=0;
|
||||||
space=SPACE(c);
|
space=SPACE(c);
|
||||||
if( state==TOK_BEGIN && (c=='@' || c=='%' ) && !escape ) state=TOK_TOKEN; /* 20161210 escape */
|
if( state==TOK_BEGIN && (c=='@' || c=='%' ) && !escape ) state=TOK_TOKEN; /* 20161210 escape */
|
||||||
else if( state==TOK_TOKEN && (
|
else if(state==TOK_TOKEN && token_pos > 1 &&
|
||||||
(space && !escape) ||
|
(
|
||||||
(c =='@' || c == '%') ||
|
( (space || c == '%' || c == '@') && !escape ) ||
|
||||||
(!space && escape)
|
( (!space && c != '%' && c != '@') && escape )
|
||||||
)
|
)
|
||||||
&& token_pos > 1 ) state=TOK_SEP;
|
) state=TOK_SEP;
|
||||||
|
|
||||||
|
|
||||||
STR_ALLOC(&result, result_pos, &size);
|
STR_ALLOC(&result, result_pos, &size);
|
||||||
STR_ALLOC(&token, token_pos, &sizetok);
|
STR_ALLOC(&token, token_pos, &sizetok);
|
||||||
|
|
@ -3571,9 +3569,12 @@ const char *translate2(Lcc *lcc, int level, char* s)
|
||||||
else escape = 0;
|
else escape = 0;
|
||||||
space = SPACE(c);
|
space = SPACE(c);
|
||||||
if (state == TOK_BEGIN && c == '@' && !escape) state = TOK_TOKEN;
|
if (state == TOK_BEGIN && c == '@' && !escape) state = TOK_TOKEN;
|
||||||
else if (state == TOK_TOKEN && ( (space && !escape) || c == '@' || (!space && escape)) && token_pos > 1) {
|
else if(state==TOK_TOKEN && token_pos > 1 &&
|
||||||
state = TOK_SEP;
|
(
|
||||||
}
|
( (space || c == '@') && !escape ) ||
|
||||||
|
( (!space && c != '@') && escape )
|
||||||
|
)
|
||||||
|
) state=TOK_SEP;
|
||||||
STR_ALLOC(&result, result_pos, &size);
|
STR_ALLOC(&result, result_pos, &size);
|
||||||
STR_ALLOC(&token, token_pos, &sizetok);
|
STR_ALLOC(&token, token_pos, &sizetok);
|
||||||
if (state == TOK_TOKEN) token[token_pos++] = (char)c;
|
if (state == TOK_TOKEN) token[token_pos++] = (char)c;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue