webstorm 怎么修改js默认 注释
展开全部
可以的,给你参考一下我的
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
#define OK 0
#define ERR 1
typedef enum {NONE, C_STYLE, CPP_STYLE, STR, END_OF_FILE } STATE;
STATE ProcessStateNone(char ch, FILE **fpIn, FILE **fpOut);
STATE ProcessStateCPPStyle(char ch, FILE **fpIn, FILE **fpOut);
STATE ProcessStateCStyle(char ch, FILE **fpIn, FILE **fpOut);
STATE ProcessStateSTR(char ch, FILE **fpIn, FILE **fpOut);
void ProcessStateEOF(STATE state, FILE **fpOut);
int main(void)
{
FILE *fpIn, *fpOut;
char ch;
STATE state = NONE;
fpIn = fopen("D:/testFile.c","r");
if(NULL == fpIn)
{
printf("can't open source file\n");
fclose(fpIn);
return ERR;
}
fpOut = fopen("D:/testFile2.c","w");
if(NULL == fpOut)
{
printf("can't open destination file\n");
fclose(fpIn);
fclose(fpOut);
return ERR;
}
ch = fgetc(fpIn);
while(ch != EOF)
{
switch(state)
{
case NONE: state = ProcessStateNone(ch, &fpIn, &fpOut);break;
case C_STYLE: state = ProcessStateCStyle(ch, &fpIn, &fpOut);break;
case CPP_STYLE: state = ProcessStateCPPStyle(ch, &fpIn, &fpOut);break;
case STR: state = ProcessStateSTR(ch, &fpIn, &fpOut);break;
}
}
//default
stateTemp = STR;
fputc(ch, *fpOut);
return stateTemp;
}
void ProcessStateEOF(STATE state, FILE **fpOut)
{
if(state == CPP_STYLE) // c++ 风格注释处理
{
fputc('*', *fpOut);
fputc('/', *fpOut);
return;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
#define OK 0
#define ERR 1
typedef enum {NONE, C_STYLE, CPP_STYLE, STR, END_OF_FILE } STATE;
STATE ProcessStateNone(char ch, FILE **fpIn, FILE **fpOut);
STATE ProcessStateCPPStyle(char ch, FILE **fpIn, FILE **fpOut);
STATE ProcessStateCStyle(char ch, FILE **fpIn, FILE **fpOut);
STATE ProcessStateSTR(char ch, FILE **fpIn, FILE **fpOut);
void ProcessStateEOF(STATE state, FILE **fpOut);
int main(void)
{
FILE *fpIn, *fpOut;
char ch;
STATE state = NONE;
fpIn = fopen("D:/testFile.c","r");
if(NULL == fpIn)
{
printf("can't open source file\n");
fclose(fpIn);
return ERR;
}
fpOut = fopen("D:/testFile2.c","w");
if(NULL == fpOut)
{
printf("can't open destination file\n");
fclose(fpIn);
fclose(fpOut);
return ERR;
}
ch = fgetc(fpIn);
while(ch != EOF)
{
switch(state)
{
case NONE: state = ProcessStateNone(ch, &fpIn, &fpOut);break;
case C_STYLE: state = ProcessStateCStyle(ch, &fpIn, &fpOut);break;
case CPP_STYLE: state = ProcessStateCPPStyle(ch, &fpIn, &fpOut);break;
case STR: state = ProcessStateSTR(ch, &fpIn, &fpOut);break;
}
}
//default
stateTemp = STR;
fputc(ch, *fpOut);
return stateTemp;
}
void ProcessStateEOF(STATE state, FILE **fpOut)
{
if(state == CPP_STYLE) // c++ 风格注释处理
{
fputc('*', *fpOut);
fputc('/', *fpOut);
return;
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询