add include and add_subdirectory command

This commit is contained in:
全卓 2022-11-02 21:57:51 +08:00
parent 0d5f3ec0bb
commit df97fd2679
6 changed files with 422 additions and 241 deletions

View File

@ -25,6 +25,8 @@ command
| 'macro' '(' argument+ ')' # MacroCmd
| 'endmacro' '(' argument* ')' # EndMacroCmd
| 'set' '(' argument+ ')' # SetCmd
| 'include' '(' argument+ ')' # IncludeCmd
| 'add_subdirectory' '(' argument+ ')' # AddSubDirCmd
| ID '(' argument * ')' # OtherCmd
;

View File

@ -341,6 +341,22 @@ export class FormatListener extends CMakeListener {
this.exitOtherCmd(ctx);
}
enterIncludeCmd(ctx: any): void {
this._formatted += this.getTextBeforeFirstArg("include", ctx.LParen().getSymbol().tokenIndex);
}
exitIncludeCmd(ctx: any): void {
this.exitOtherCmd(ctx);
}
enterAddSubDirCmd(ctx: any): void {
this._formatted += this.getTextBeforeFirstArg("add_subdirectory", ctx.LParen().getSymbol().tokenIndex);
}
exitAddSubDirCmd(ctx: any): void {
this.exitOtherCmd(ctx);
}
enterArgument(ctx: any): void {
const count: number = ctx.getChildCount();
if (count === 1) {

View File

@ -3,102 +3,111 @@
import antlr4 from './antlr4/index.js';
const serializedATN = [4,0,28,299,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,
const serializedATN = [4,0,30,328,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,
4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,
12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,
2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,
27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,1,0,
1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3,
1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,
1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,
1,8,1,8,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,
10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,
1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,
13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,15,1,15,5,15,182,8,15,10,15,
12,15,185,9,15,1,16,1,16,1,16,1,16,1,17,1,17,5,17,193,8,17,10,17,12,17,196,
9,17,1,17,1,17,1,18,4,18,201,8,18,11,18,12,18,202,1,19,1,19,1,19,1,19,1,
19,1,19,1,19,1,19,1,20,1,20,5,20,215,8,20,10,20,12,20,218,9,20,1,20,1,20,
1,21,3,21,223,8,21,1,21,1,21,1,21,1,21,1,21,1,22,3,22,231,8,22,1,22,1,22,
1,22,1,22,1,22,1,23,1,23,3,23,240,8,23,1,23,1,23,1,24,4,24,245,8,24,11,24,
12,24,246,1,24,1,24,1,25,1,25,1,25,1,26,1,26,1,26,1,27,1,27,1,27,3,27,260,
8,27,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,3,29,271,8,29,1,30,1,30,
1,30,1,31,1,31,1,31,1,31,1,31,1,31,5,31,282,8,31,10,31,12,31,285,9,31,1,
31,3,31,288,8,31,1,32,1,32,1,32,1,32,3,32,294,8,32,1,33,1,33,3,33,298,8,
33,1,283,0,34,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,
27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,
7,34,2,35,7,35,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,
2,1,3,1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,
5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,
7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,
9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,
11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,13,
1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,15,1,15,1,
15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,
1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,17,1,17,5,17,211,8,17,10,17,12,
17,214,9,17,1,18,1,18,1,18,1,18,1,19,1,19,5,19,222,8,19,10,19,12,19,225,
9,19,1,19,1,19,1,20,4,20,230,8,20,11,20,12,20,231,1,21,1,21,1,21,1,21,1,
21,1,21,1,21,1,21,1,22,1,22,5,22,244,8,22,10,22,12,22,247,9,22,1,22,1,22,
1,23,3,23,252,8,23,1,23,1,23,1,23,1,23,1,23,1,24,3,24,260,8,24,1,24,1,24,
1,24,1,24,1,24,1,25,1,25,3,25,269,8,25,1,25,1,25,1,26,4,26,274,8,26,11,26,
12,26,275,1,26,1,26,1,27,1,27,1,27,1,28,1,28,1,28,1,29,1,29,1,29,3,29,289,
8,29,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,31,3,31,300,8,31,1,32,1,32,
1,32,1,33,1,33,1,33,1,33,1,33,1,33,5,33,311,8,33,10,33,12,33,314,9,33,1,
33,3,33,317,8,33,1,34,1,34,1,34,1,34,3,34,323,8,34,1,35,1,35,3,35,327,8,
35,1,312,0,36,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,
25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,
49,25,51,26,53,27,55,28,57,0,59,0,61,0,63,0,65,0,67,0,1,0,7,3,0,65,90,95,
95,97,122,4,0,48,57,65,90,95,95,97,122,2,0,10,10,13,13,2,0,9,9,32,32,4,0,
48,57,59,59,65,90,97,122,2,0,34,34,92,92,6,0,9,10,13,13,32,32,34,35,40,41,
92,92,309,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,
11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,
0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,
1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,
0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,
0,0,0,1,69,1,0,0,0,3,72,1,0,0,0,5,79,1,0,0,0,7,84,1,0,0,0,9,90,1,0,0,0,11,
98,1,0,0,0,13,109,1,0,0,0,15,115,1,0,0,0,17,124,1,0,0,0,19,130,1,0,0,0,21,
139,1,0,0,0,23,148,1,0,0,0,25,160,1,0,0,0,27,166,1,0,0,0,29,175,1,0,0,0,
31,179,1,0,0,0,33,186,1,0,0,0,35,190,1,0,0,0,37,200,1,0,0,0,39,204,1,0,0,
0,41,212,1,0,0,0,43,222,1,0,0,0,45,230,1,0,0,0,47,237,1,0,0,0,49,244,1,0,
0,0,51,250,1,0,0,0,53,253,1,0,0,0,55,259,1,0,0,0,57,261,1,0,0,0,59,270,1,
0,0,0,61,272,1,0,0,0,63,287,1,0,0,0,65,293,1,0,0,0,67,297,1,0,0,0,69,70,
5,105,0,0,70,71,5,102,0,0,71,2,1,0,0,0,72,73,5,101,0,0,73,74,5,108,0,0,74,
75,5,115,0,0,75,76,5,101,0,0,76,77,5,105,0,0,77,78,5,102,0,0,78,4,1,0,0,
0,79,80,5,101,0,0,80,81,5,108,0,0,81,82,5,115,0,0,82,83,5,101,0,0,83,6,1,
0,0,0,84,85,5,101,0,0,85,86,5,110,0,0,86,87,5,100,0,0,87,88,5,105,0,0,88,
89,5,102,0,0,89,8,1,0,0,0,90,91,5,102,0,0,91,92,5,111,0,0,92,93,5,114,0,
0,93,94,5,101,0,0,94,95,5,97,0,0,95,96,5,99,0,0,96,97,5,104,0,0,97,10,1,
0,0,0,98,99,5,101,0,0,99,100,5,110,0,0,100,101,5,100,0,0,101,102,5,102,0,
0,102,103,5,111,0,0,103,104,5,114,0,0,104,105,5,101,0,0,105,106,5,97,0,0,
106,107,5,99,0,0,107,108,5,104,0,0,108,12,1,0,0,0,109,110,5,119,0,0,110,
111,5,104,0,0,111,112,5,105,0,0,112,113,5,108,0,0,113,114,5,101,0,0,114,
14,1,0,0,0,115,116,5,101,0,0,116,117,5,110,0,0,117,118,5,100,0,0,118,119,
5,119,0,0,119,120,5,104,0,0,120,121,5,105,0,0,121,122,5,108,0,0,122,123,
5,101,0,0,123,16,1,0,0,0,124,125,5,98,0,0,125,126,5,114,0,0,126,127,5,101,
0,0,127,128,5,97,0,0,128,129,5,107,0,0,129,18,1,0,0,0,130,131,5,99,0,0,131,
132,5,111,0,0,132,133,5,110,0,0,133,134,5,116,0,0,134,135,5,105,0,0,135,
136,5,110,0,0,136,137,5,117,0,0,137,138,5,101,0,0,138,20,1,0,0,0,139,140,
5,102,0,0,140,141,5,117,0,0,141,142,5,110,0,0,142,143,5,99,0,0,143,144,5,
116,0,0,144,145,5,105,0,0,145,146,5,111,0,0,146,147,5,110,0,0,147,22,1,0,
0,0,148,149,5,101,0,0,149,150,5,110,0,0,150,151,5,100,0,0,151,152,5,102,
0,0,152,153,5,117,0,0,153,154,5,110,0,0,154,155,5,99,0,0,155,156,5,116,0,
0,156,157,5,105,0,0,157,158,5,111,0,0,158,159,5,110,0,0,159,24,1,0,0,0,160,
161,5,109,0,0,161,162,5,97,0,0,162,163,5,99,0,0,163,164,5,114,0,0,164,165,
5,111,0,0,165,26,1,0,0,0,166,167,5,101,0,0,167,168,5,110,0,0,168,169,5,100,
0,0,169,170,5,109,0,0,170,171,5,97,0,0,171,172,5,99,0,0,172,173,5,114,0,
0,173,174,5,111,0,0,174,28,1,0,0,0,175,176,5,115,0,0,176,177,5,101,0,0,177,
178,5,116,0,0,178,30,1,0,0,0,179,183,7,0,0,0,180,182,7,1,0,0,181,180,1,0,
0,0,182,185,1,0,0,0,183,181,1,0,0,0,183,184,1,0,0,0,184,32,1,0,0,0,185,183,
1,0,0,0,186,187,5,91,0,0,187,188,3,63,31,0,188,189,5,93,0,0,189,34,1,0,0,
0,190,194,5,34,0,0,191,193,3,65,32,0,192,191,1,0,0,0,193,196,1,0,0,0,194,
192,1,0,0,0,194,195,1,0,0,0,195,197,1,0,0,0,196,194,1,0,0,0,197,198,5,34,
0,0,198,36,1,0,0,0,199,201,3,67,33,0,200,199,1,0,0,0,201,202,1,0,0,0,202,
200,1,0,0,0,202,203,1,0,0,0,203,38,1,0,0,0,204,205,5,35,0,0,205,206,5,91,
0,0,206,207,1,0,0,0,207,208,3,63,31,0,208,209,5,93,0,0,209,210,1,0,0,0,210,
211,6,19,0,0,211,40,1,0,0,0,212,216,5,35,0,0,213,215,8,2,0,0,214,213,1,0,
0,0,215,218,1,0,0,0,216,214,1,0,0,0,216,217,1,0,0,0,217,219,1,0,0,0,218,
216,1,0,0,0,219,220,6,20,0,0,220,42,1,0,0,0,221,223,5,13,0,0,222,221,1,0,
0,0,222,223,1,0,0,0,223,224,1,0,0,0,224,225,5,10,0,0,225,226,4,21,0,0,226,
227,1,0,0,0,227,228,6,21,1,0,228,44,1,0,0,0,229,231,5,13,0,0,230,229,1,0,
0,0,230,231,1,0,0,0,231,232,1,0,0,0,232,233,5,10,0,0,233,234,4,22,1,0,234,
235,1,0,0,0,235,236,6,22,1,0,236,46,1,0,0,0,237,239,6,23,2,0,238,240,5,13,
0,0,239,238,1,0,0,0,239,240,1,0,0,0,240,241,1,0,0,0,241,242,5,10,0,0,242,
48,1,0,0,0,243,245,7,3,0,0,244,243,1,0,0,0,245,246,1,0,0,0,246,244,1,0,0,
0,246,247,1,0,0,0,247,248,1,0,0,0,248,249,6,24,1,0,249,50,1,0,0,0,250,251,
5,40,0,0,251,252,6,25,3,0,252,52,1,0,0,0,253,254,5,41,0,0,254,255,6,26,4,
0,255,54,1,0,0,0,256,260,3,57,28,0,257,260,3,59,29,0,258,260,3,61,30,0,259,
256,1,0,0,0,259,257,1,0,0,0,259,258,1,0,0,0,260,56,1,0,0,0,261,262,5,92,
0,0,262,263,8,4,0,0,263,58,1,0,0,0,264,265,5,92,0,0,265,271,5,116,0,0,266,
267,5,92,0,0,267,271,5,114,0,0,268,269,5,92,0,0,269,271,5,110,0,0,270,264,
1,0,0,0,270,266,1,0,0,0,270,268,1,0,0,0,271,60,1,0,0,0,272,273,5,92,0,0,
273,274,5,59,0,0,274,62,1,0,0,0,275,276,5,61,0,0,276,277,3,63,31,0,277,278,
5,61,0,0,278,288,1,0,0,0,279,283,5,91,0,0,280,282,9,0,0,0,281,280,1,0,0,
0,282,285,1,0,0,0,283,284,1,0,0,0,283,281,1,0,0,0,284,286,1,0,0,0,285,283,
1,0,0,0,286,288,5,93,0,0,287,275,1,0,0,0,287,279,1,0,0,0,288,64,1,0,0,0,
289,294,8,5,0,0,290,294,3,55,27,0,291,292,5,92,0,0,292,294,3,47,23,0,293,
289,1,0,0,0,293,290,1,0,0,0,293,291,1,0,0,0,294,66,1,0,0,0,295,298,8,6,0,
0,296,298,3,55,27,0,297,295,1,0,0,0,297,296,1,0,0,0,298,68,1,0,0,0,15,0,
183,194,202,216,222,230,239,246,259,270,283,287,293,297,5,0,1,0,6,0,0,1,
23,0,1,25,1,1,26,2];
49,25,51,26,53,27,55,28,57,29,59,30,61,0,63,0,65,0,67,0,69,0,71,0,1,0,7,
3,0,65,90,95,95,97,122,4,0,48,57,65,90,95,95,97,122,2,0,10,10,13,13,2,0,
9,9,32,32,4,0,48,57,59,59,65,90,97,122,2,0,34,34,92,92,6,0,9,10,13,13,32,
32,34,35,40,41,92,92,338,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,
0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,
0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,
1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,
0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,
0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,1,73,1,0,0,0,3,76,1,0,0,0,5,
83,1,0,0,0,7,88,1,0,0,0,9,94,1,0,0,0,11,102,1,0,0,0,13,113,1,0,0,0,15,119,
1,0,0,0,17,128,1,0,0,0,19,134,1,0,0,0,21,143,1,0,0,0,23,152,1,0,0,0,25,164,
1,0,0,0,27,170,1,0,0,0,29,179,1,0,0,0,31,183,1,0,0,0,33,191,1,0,0,0,35,208,
1,0,0,0,37,215,1,0,0,0,39,219,1,0,0,0,41,229,1,0,0,0,43,233,1,0,0,0,45,241,
1,0,0,0,47,251,1,0,0,0,49,259,1,0,0,0,51,266,1,0,0,0,53,273,1,0,0,0,55,279,
1,0,0,0,57,282,1,0,0,0,59,288,1,0,0,0,61,290,1,0,0,0,63,299,1,0,0,0,65,301,
1,0,0,0,67,316,1,0,0,0,69,322,1,0,0,0,71,326,1,0,0,0,73,74,5,105,0,0,74,
75,5,102,0,0,75,2,1,0,0,0,76,77,5,101,0,0,77,78,5,108,0,0,78,79,5,115,0,
0,79,80,5,101,0,0,80,81,5,105,0,0,81,82,5,102,0,0,82,4,1,0,0,0,83,84,5,101,
0,0,84,85,5,108,0,0,85,86,5,115,0,0,86,87,5,101,0,0,87,6,1,0,0,0,88,89,5,
101,0,0,89,90,5,110,0,0,90,91,5,100,0,0,91,92,5,105,0,0,92,93,5,102,0,0,
93,8,1,0,0,0,94,95,5,102,0,0,95,96,5,111,0,0,96,97,5,114,0,0,97,98,5,101,
0,0,98,99,5,97,0,0,99,100,5,99,0,0,100,101,5,104,0,0,101,10,1,0,0,0,102,
103,5,101,0,0,103,104,5,110,0,0,104,105,5,100,0,0,105,106,5,102,0,0,106,
107,5,111,0,0,107,108,5,114,0,0,108,109,5,101,0,0,109,110,5,97,0,0,110,111,
5,99,0,0,111,112,5,104,0,0,112,12,1,0,0,0,113,114,5,119,0,0,114,115,5,104,
0,0,115,116,5,105,0,0,116,117,5,108,0,0,117,118,5,101,0,0,118,14,1,0,0,0,
119,120,5,101,0,0,120,121,5,110,0,0,121,122,5,100,0,0,122,123,5,119,0,0,
123,124,5,104,0,0,124,125,5,105,0,0,125,126,5,108,0,0,126,127,5,101,0,0,
127,16,1,0,0,0,128,129,5,98,0,0,129,130,5,114,0,0,130,131,5,101,0,0,131,
132,5,97,0,0,132,133,5,107,0,0,133,18,1,0,0,0,134,135,5,99,0,0,135,136,5,
111,0,0,136,137,5,110,0,0,137,138,5,116,0,0,138,139,5,105,0,0,139,140,5,
110,0,0,140,141,5,117,0,0,141,142,5,101,0,0,142,20,1,0,0,0,143,144,5,102,
0,0,144,145,5,117,0,0,145,146,5,110,0,0,146,147,5,99,0,0,147,148,5,116,0,
0,148,149,5,105,0,0,149,150,5,111,0,0,150,151,5,110,0,0,151,22,1,0,0,0,152,
153,5,101,0,0,153,154,5,110,0,0,154,155,5,100,0,0,155,156,5,102,0,0,156,
157,5,117,0,0,157,158,5,110,0,0,158,159,5,99,0,0,159,160,5,116,0,0,160,161,
5,105,0,0,161,162,5,111,0,0,162,163,5,110,0,0,163,24,1,0,0,0,164,165,5,109,
0,0,165,166,5,97,0,0,166,167,5,99,0,0,167,168,5,114,0,0,168,169,5,111,0,
0,169,26,1,0,0,0,170,171,5,101,0,0,171,172,5,110,0,0,172,173,5,100,0,0,173,
174,5,109,0,0,174,175,5,97,0,0,175,176,5,99,0,0,176,177,5,114,0,0,177,178,
5,111,0,0,178,28,1,0,0,0,179,180,5,115,0,0,180,181,5,101,0,0,181,182,5,116,
0,0,182,30,1,0,0,0,183,184,5,105,0,0,184,185,5,110,0,0,185,186,5,99,0,0,
186,187,5,108,0,0,187,188,5,117,0,0,188,189,5,100,0,0,189,190,5,101,0,0,
190,32,1,0,0,0,191,192,5,97,0,0,192,193,5,100,0,0,193,194,5,100,0,0,194,
195,5,95,0,0,195,196,5,115,0,0,196,197,5,117,0,0,197,198,5,98,0,0,198,199,
5,100,0,0,199,200,5,105,0,0,200,201,5,114,0,0,201,202,5,101,0,0,202,203,
5,99,0,0,203,204,5,116,0,0,204,205,5,111,0,0,205,206,5,114,0,0,206,207,5,
121,0,0,207,34,1,0,0,0,208,212,7,0,0,0,209,211,7,1,0,0,210,209,1,0,0,0,211,
214,1,0,0,0,212,210,1,0,0,0,212,213,1,0,0,0,213,36,1,0,0,0,214,212,1,0,0,
0,215,216,5,91,0,0,216,217,3,67,33,0,217,218,5,93,0,0,218,38,1,0,0,0,219,
223,5,34,0,0,220,222,3,69,34,0,221,220,1,0,0,0,222,225,1,0,0,0,223,221,1,
0,0,0,223,224,1,0,0,0,224,226,1,0,0,0,225,223,1,0,0,0,226,227,5,34,0,0,227,
40,1,0,0,0,228,230,3,71,35,0,229,228,1,0,0,0,230,231,1,0,0,0,231,229,1,0,
0,0,231,232,1,0,0,0,232,42,1,0,0,0,233,234,5,35,0,0,234,235,5,91,0,0,235,
236,1,0,0,0,236,237,3,67,33,0,237,238,5,93,0,0,238,239,1,0,0,0,239,240,6,
21,0,0,240,44,1,0,0,0,241,245,5,35,0,0,242,244,8,2,0,0,243,242,1,0,0,0,244,
247,1,0,0,0,245,243,1,0,0,0,245,246,1,0,0,0,246,248,1,0,0,0,247,245,1,0,
0,0,248,249,6,22,0,0,249,46,1,0,0,0,250,252,5,13,0,0,251,250,1,0,0,0,251,
252,1,0,0,0,252,253,1,0,0,0,253,254,5,10,0,0,254,255,4,23,0,0,255,256,1,
0,0,0,256,257,6,23,1,0,257,48,1,0,0,0,258,260,5,13,0,0,259,258,1,0,0,0,259,
260,1,0,0,0,260,261,1,0,0,0,261,262,5,10,0,0,262,263,4,24,1,0,263,264,1,
0,0,0,264,265,6,24,1,0,265,50,1,0,0,0,266,268,6,25,2,0,267,269,5,13,0,0,
268,267,1,0,0,0,268,269,1,0,0,0,269,270,1,0,0,0,270,271,5,10,0,0,271,52,
1,0,0,0,272,274,7,3,0,0,273,272,1,0,0,0,274,275,1,0,0,0,275,273,1,0,0,0,
275,276,1,0,0,0,276,277,1,0,0,0,277,278,6,26,1,0,278,54,1,0,0,0,279,280,
5,40,0,0,280,281,6,27,3,0,281,56,1,0,0,0,282,283,5,41,0,0,283,284,6,28,4,
0,284,58,1,0,0,0,285,289,3,61,30,0,286,289,3,63,31,0,287,289,3,65,32,0,288,
285,1,0,0,0,288,286,1,0,0,0,288,287,1,0,0,0,289,60,1,0,0,0,290,291,5,92,
0,0,291,292,8,4,0,0,292,62,1,0,0,0,293,294,5,92,0,0,294,300,5,116,0,0,295,
296,5,92,0,0,296,300,5,114,0,0,297,298,5,92,0,0,298,300,5,110,0,0,299,293,
1,0,0,0,299,295,1,0,0,0,299,297,1,0,0,0,300,64,1,0,0,0,301,302,5,92,0,0,
302,303,5,59,0,0,303,66,1,0,0,0,304,305,5,61,0,0,305,306,3,67,33,0,306,307,
5,61,0,0,307,317,1,0,0,0,308,312,5,91,0,0,309,311,9,0,0,0,310,309,1,0,0,
0,311,314,1,0,0,0,312,313,1,0,0,0,312,310,1,0,0,0,313,315,1,0,0,0,314,312,
1,0,0,0,315,317,5,93,0,0,316,304,1,0,0,0,316,308,1,0,0,0,317,68,1,0,0,0,
318,323,8,5,0,0,319,323,3,59,29,0,320,321,5,92,0,0,321,323,3,51,25,0,322,
318,1,0,0,0,322,319,1,0,0,0,322,320,1,0,0,0,323,70,1,0,0,0,324,327,8,6,0,
0,325,327,3,59,29,0,326,324,1,0,0,0,326,325,1,0,0,0,327,72,1,0,0,0,15,0,
212,223,231,245,251,259,268,275,288,299,312,316,322,326,5,0,1,0,6,0,0,1,
25,0,1,27,1,1,28,2];
const atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
@ -113,20 +122,20 @@ export default class CMakeLexer extends antlr4.Lexer {
static literalNames = [ null, "'if'", "'elseif'", "'else'", "'endif'",
"'foreach'", "'endforeach'", "'while'", "'endwhile'",
"'break'", "'continue'", "'function'", "'endfunction'",
"'macro'", "'endmacro'", "'set'", null, null, null,
null, null, null, null, null, null, null, "'('",
"')'" ];
"'macro'", "'endmacro'", "'set'", "'include'",
"'add_subdirectory'", null, null, null, null, null,
null, null, null, null, null, "'('", "')'" ];
static symbolicNames = [ null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null,
"ID", "BracketArgument", "QuotedArgument", "UnquotedArgument",
"BracketComment", "LineComment", "IgnoreNLBetweenArgs",
"IgnoreExtraNLBetweenCmds", "NL", "WS", "LParen",
"RParen", "Escape" ];
static ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
"T__7", "T__8", "T__9", "T__10", "T__11", "T__12",
"T__13", "T__14", "ID", "BracketArgument", "QuotedArgument",
null, null, "ID", "BracketArgument", "QuotedArgument",
"UnquotedArgument", "BracketComment", "LineComment",
"IgnoreNLBetweenArgs", "IgnoreExtraNLBetweenCmds",
"NL", "WS", "LParen", "RParen", "Escape" ];
static ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
"T__7", "T__8", "T__9", "T__10", "T__11", "T__12",
"T__13", "T__14", "T__15", "T__16", "ID", "BracketArgument",
"QuotedArgument", "UnquotedArgument", "BracketComment",
"LineComment", "IgnoreNLBetweenArgs", "IgnoreExtraNLBetweenCmds",
"NL", "WS", "LParen", "RParen", "Escape", "EscapeIdentity",
"EscapeEncoded", "EscapeSemi", "BracketNested", "QuotedElement",
"UnquotedElement" ];
@ -161,29 +170,31 @@ CMakeLexer.T__11 = 12;
CMakeLexer.T__12 = 13;
CMakeLexer.T__13 = 14;
CMakeLexer.T__14 = 15;
CMakeLexer.ID = 16;
CMakeLexer.BracketArgument = 17;
CMakeLexer.QuotedArgument = 18;
CMakeLexer.UnquotedArgument = 19;
CMakeLexer.BracketComment = 20;
CMakeLexer.LineComment = 21;
CMakeLexer.IgnoreNLBetweenArgs = 22;
CMakeLexer.IgnoreExtraNLBetweenCmds = 23;
CMakeLexer.NL = 24;
CMakeLexer.WS = 25;
CMakeLexer.LParen = 26;
CMakeLexer.RParen = 27;
CMakeLexer.Escape = 28;
CMakeLexer.T__15 = 16;
CMakeLexer.T__16 = 17;
CMakeLexer.ID = 18;
CMakeLexer.BracketArgument = 19;
CMakeLexer.QuotedArgument = 20;
CMakeLexer.UnquotedArgument = 21;
CMakeLexer.BracketComment = 22;
CMakeLexer.LineComment = 23;
CMakeLexer.IgnoreNLBetweenArgs = 24;
CMakeLexer.IgnoreExtraNLBetweenCmds = 25;
CMakeLexer.NL = 26;
CMakeLexer.WS = 27;
CMakeLexer.LParen = 28;
CMakeLexer.RParen = 29;
CMakeLexer.Escape = 30;
CMakeLexer.prototype.action = function(localctx, ruleIndex, actionIndex) {
switch (ruleIndex) {
case 23:
case 25:
this.NL_action(localctx, actionIndex);
break;
case 25:
case 27:
this.LParen_action(localctx, actionIndex);
break;
case 26:
case 28:
this.RParen_action(localctx, actionIndex);
break;
default:
@ -223,9 +234,9 @@ CMakeLexer.prototype.RParen_action = function(localctx , actionIndex) {
};
CMakeLexer.prototype.sempred = function(localctx, ruleIndex, predIndex) {
switch (ruleIndex) {
case 21:
case 23:
return this.IgnoreNLBetweenArgs_sempred(localctx, predIndex);
case 22:
case 24:
return this.IgnoreExtraNLBetweenCmds_sempred(localctx, predIndex);
default:
throw "No registered predicate for:" + ruleIndex;

View File

@ -149,6 +149,24 @@ export default class CMakeListener extends antlr4.tree.ParseTreeListener {
}
// Enter a parse tree produced by CMakeParser#IncludeCmd.
enterIncludeCmd(ctx) {
}
// Exit a parse tree produced by CMakeParser#IncludeCmd.
exitIncludeCmd(ctx) {
}
// Enter a parse tree produced by CMakeParser#AddSubDirCmd.
enterAddSubDirCmd(ctx) {
}
// Exit a parse tree produced by CMakeParser#AddSubDirCmd.
exitAddSubDirCmd(ctx) {
}
// Enter a parse tree produced by CMakeParser#OtherCmd.
enterOtherCmd(ctx) {
}

View File

@ -2,7 +2,7 @@
// jshint ignore: start
import antlr4 from './antlr4/index.js';
import CMakeListener from './CMakeListener.js';
const serializedATN = [4,1,28,165,2,0,7,0,2,1,7,1,2,2,7,2,1,0,1,0,1,0,5,
const serializedATN = [4,1,30,183,2,0,7,0,2,1,7,1,2,2,7,2,1,0,1,0,1,0,5,
0,10,8,0,10,0,12,0,13,9,0,1,0,1,0,1,1,1,1,1,1,5,1,20,8,1,10,1,12,1,23,9,
1,1,1,1,1,1,1,1,1,5,1,29,8,1,10,1,12,1,32,9,1,1,1,1,1,1,1,1,1,5,1,38,8,1,
10,1,12,1,41,9,1,1,1,1,1,1,1,1,1,5,1,47,8,1,10,1,12,1,50,9,1,1,1,1,1,1,1,
@ -11,51 +11,57 @@ const serializedATN = [4,1,28,165,2,0,7,0,2,1,7,1,2,2,7,2,1,0,1,0,1,0,5,
1,10,1,12,1,86,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,98,8,1,11,
1,12,1,99,1,1,1,1,1,1,1,1,1,1,5,1,107,8,1,10,1,12,1,110,9,1,1,1,1,1,1,1,
1,1,4,1,116,8,1,11,1,12,1,117,1,1,1,1,1,1,1,1,1,1,5,1,125,8,1,10,1,12,1,
128,9,1,1,1,1,1,1,1,1,1,4,1,134,8,1,11,1,12,1,135,1,1,1,1,1,1,1,1,1,1,5,
1,143,8,1,10,1,12,1,146,9,1,1,1,3,1,149,8,1,1,2,1,2,1,2,1,2,1,2,1,2,5,2,
157,8,2,10,2,12,2,160,9,2,1,2,3,2,163,8,2,1,2,0,0,3,0,2,4,0,0,196,0,11,1,
0,0,0,2,148,1,0,0,0,4,162,1,0,0,0,6,7,3,2,1,0,7,8,5,24,0,0,8,10,1,0,0,0,
9,6,1,0,0,0,10,13,1,0,0,0,11,9,1,0,0,0,11,12,1,0,0,0,12,14,1,0,0,0,13,11,
1,0,0,0,14,15,5,0,0,1,15,1,1,0,0,0,16,17,5,1,0,0,17,21,5,26,0,0,18,20,3,
4,2,0,19,18,1,0,0,0,20,23,1,0,0,0,21,19,1,0,0,0,21,22,1,0,0,0,22,24,1,0,
0,0,23,21,1,0,0,0,24,149,5,27,0,0,25,26,5,2,0,0,26,30,5,26,0,0,27,29,3,4,
2,0,28,27,1,0,0,0,29,32,1,0,0,0,30,28,1,0,0,0,30,31,1,0,0,0,31,33,1,0,0,
0,32,30,1,0,0,0,33,149,5,27,0,0,34,35,5,3,0,0,35,39,5,26,0,0,36,38,3,4,2,
0,37,36,1,0,0,0,38,41,1,0,0,0,39,37,1,0,0,0,39,40,1,0,0,0,40,42,1,0,0,0,
41,39,1,0,0,0,42,149,5,27,0,0,43,44,5,4,0,0,44,48,5,26,0,0,45,47,3,4,2,0,
46,45,1,0,0,0,47,50,1,0,0,0,48,46,1,0,0,0,48,49,1,0,0,0,49,51,1,0,0,0,50,
48,1,0,0,0,51,149,5,27,0,0,52,53,5,5,0,0,53,55,5,26,0,0,54,56,3,4,2,0,55,
54,1,0,0,0,56,57,1,0,0,0,57,55,1,0,0,0,57,58,1,0,0,0,58,59,1,0,0,0,59,60,
5,27,0,0,60,149,1,0,0,0,61,62,5,6,0,0,62,66,5,26,0,0,63,65,3,4,2,0,64,63,
1,0,0,0,65,68,1,0,0,0,66,64,1,0,0,0,66,67,1,0,0,0,67,69,1,0,0,0,68,66,1,
0,0,0,69,149,5,27,0,0,70,71,5,7,0,0,71,73,5,26,0,0,72,74,3,4,2,0,73,72,1,
0,0,0,74,75,1,0,0,0,75,73,1,0,0,0,75,76,1,0,0,0,76,77,1,0,0,0,77,78,5,27,
0,0,78,149,1,0,0,0,79,80,5,8,0,0,80,84,5,26,0,0,81,83,3,4,2,0,82,81,1,0,
0,0,83,86,1,0,0,0,84,82,1,0,0,0,84,85,1,0,0,0,85,87,1,0,0,0,86,84,1,0,0,
0,87,149,5,27,0,0,88,89,5,9,0,0,89,90,5,26,0,0,90,149,5,27,0,0,91,92,5,10,
0,0,92,93,5,26,0,0,93,149,5,27,0,0,94,95,5,11,0,0,95,97,5,26,0,0,96,98,3,
4,2,0,97,96,1,0,0,0,98,99,1,0,0,0,99,97,1,0,0,0,99,100,1,0,0,0,100,101,1,
0,0,0,101,102,5,27,0,0,102,149,1,0,0,0,103,104,5,12,0,0,104,108,5,26,0,0,
105,107,3,4,2,0,106,105,1,0,0,0,107,110,1,0,0,0,108,106,1,0,0,0,108,109,
1,0,0,0,109,111,1,0,0,0,110,108,1,0,0,0,111,149,5,27,0,0,112,113,5,13,0,
0,113,115,5,26,0,0,114,116,3,4,2,0,115,114,1,0,0,0,116,117,1,0,0,0,117,115,
1,0,0,0,117,118,1,0,0,0,118,119,1,0,0,0,119,120,5,27,0,0,120,149,1,0,0,0,
121,122,5,14,0,0,122,126,5,26,0,0,123,125,3,4,2,0,124,123,1,0,0,0,125,128,
1,0,0,0,126,124,1,0,0,0,126,127,1,0,0,0,127,129,1,0,0,0,128,126,1,0,0,0,
129,149,5,27,0,0,130,131,5,15,0,0,131,133,5,26,0,0,132,134,3,4,2,0,133,132,
1,0,0,0,134,135,1,0,0,0,135,133,1,0,0,0,135,136,1,0,0,0,136,137,1,0,0,0,
137,138,5,27,0,0,138,149,1,0,0,0,139,140,5,16,0,0,140,144,5,26,0,0,141,143,
3,4,2,0,142,141,1,0,0,0,143,146,1,0,0,0,144,142,1,0,0,0,144,145,1,0,0,0,
145,147,1,0,0,0,146,144,1,0,0,0,147,149,5,27,0,0,148,16,1,0,0,0,148,25,1,
0,0,0,148,34,1,0,0,0,148,43,1,0,0,0,148,52,1,0,0,0,148,61,1,0,0,0,148,70,
1,0,0,0,148,79,1,0,0,0,148,88,1,0,0,0,148,91,1,0,0,0,148,94,1,0,0,0,148,
103,1,0,0,0,148,112,1,0,0,0,148,121,1,0,0,0,148,130,1,0,0,0,148,139,1,0,
0,0,149,3,1,0,0,0,150,163,5,18,0,0,151,163,5,17,0,0,152,163,5,19,0,0,153,
163,5,16,0,0,154,158,5,26,0,0,155,157,3,4,2,0,156,155,1,0,0,0,157,160,1,
0,0,0,158,156,1,0,0,0,158,159,1,0,0,0,159,161,1,0,0,0,160,158,1,0,0,0,161,
163,5,27,0,0,162,150,1,0,0,0,162,151,1,0,0,0,162,152,1,0,0,0,162,153,1,0,
0,0,162,154,1,0,0,0,163,5,1,0,0,0,18,11,21,30,39,48,57,66,75,84,99,108,117,
126,135,144,148,158,162];
128,9,1,1,1,1,1,1,1,1,1,4,1,134,8,1,11,1,12,1,135,1,1,1,1,1,1,1,1,1,1,4,
1,143,8,1,11,1,12,1,144,1,1,1,1,1,1,1,1,1,1,4,1,152,8,1,11,1,12,1,153,1,
1,1,1,1,1,1,1,1,1,5,1,161,8,1,10,1,12,1,164,9,1,1,1,3,1,167,8,1,1,2,1,2,
1,2,1,2,1,2,1,2,5,2,175,8,2,10,2,12,2,178,9,2,1,2,3,2,181,8,2,1,2,0,0,3,
0,2,4,0,0,218,0,11,1,0,0,0,2,166,1,0,0,0,4,180,1,0,0,0,6,7,3,2,1,0,7,8,5,
26,0,0,8,10,1,0,0,0,9,6,1,0,0,0,10,13,1,0,0,0,11,9,1,0,0,0,11,12,1,0,0,0,
12,14,1,0,0,0,13,11,1,0,0,0,14,15,5,0,0,1,15,1,1,0,0,0,16,17,5,1,0,0,17,
21,5,28,0,0,18,20,3,4,2,0,19,18,1,0,0,0,20,23,1,0,0,0,21,19,1,0,0,0,21,22,
1,0,0,0,22,24,1,0,0,0,23,21,1,0,0,0,24,167,5,29,0,0,25,26,5,2,0,0,26,30,
5,28,0,0,27,29,3,4,2,0,28,27,1,0,0,0,29,32,1,0,0,0,30,28,1,0,0,0,30,31,1,
0,0,0,31,33,1,0,0,0,32,30,1,0,0,0,33,167,5,29,0,0,34,35,5,3,0,0,35,39,5,
28,0,0,36,38,3,4,2,0,37,36,1,0,0,0,38,41,1,0,0,0,39,37,1,0,0,0,39,40,1,0,
0,0,40,42,1,0,0,0,41,39,1,0,0,0,42,167,5,29,0,0,43,44,5,4,0,0,44,48,5,28,
0,0,45,47,3,4,2,0,46,45,1,0,0,0,47,50,1,0,0,0,48,46,1,0,0,0,48,49,1,0,0,
0,49,51,1,0,0,0,50,48,1,0,0,0,51,167,5,29,0,0,52,53,5,5,0,0,53,55,5,28,0,
0,54,56,3,4,2,0,55,54,1,0,0,0,56,57,1,0,0,0,57,55,1,0,0,0,57,58,1,0,0,0,
58,59,1,0,0,0,59,60,5,29,0,0,60,167,1,0,0,0,61,62,5,6,0,0,62,66,5,28,0,0,
63,65,3,4,2,0,64,63,1,0,0,0,65,68,1,0,0,0,66,64,1,0,0,0,66,67,1,0,0,0,67,
69,1,0,0,0,68,66,1,0,0,0,69,167,5,29,0,0,70,71,5,7,0,0,71,73,5,28,0,0,72,
74,3,4,2,0,73,72,1,0,0,0,74,75,1,0,0,0,75,73,1,0,0,0,75,76,1,0,0,0,76,77,
1,0,0,0,77,78,5,29,0,0,78,167,1,0,0,0,79,80,5,8,0,0,80,84,5,28,0,0,81,83,
3,4,2,0,82,81,1,0,0,0,83,86,1,0,0,0,84,82,1,0,0,0,84,85,1,0,0,0,85,87,1,
0,0,0,86,84,1,0,0,0,87,167,5,29,0,0,88,89,5,9,0,0,89,90,5,28,0,0,90,167,
5,29,0,0,91,92,5,10,0,0,92,93,5,28,0,0,93,167,5,29,0,0,94,95,5,11,0,0,95,
97,5,28,0,0,96,98,3,4,2,0,97,96,1,0,0,0,98,99,1,0,0,0,99,97,1,0,0,0,99,100,
1,0,0,0,100,101,1,0,0,0,101,102,5,29,0,0,102,167,1,0,0,0,103,104,5,12,0,
0,104,108,5,28,0,0,105,107,3,4,2,0,106,105,1,0,0,0,107,110,1,0,0,0,108,106,
1,0,0,0,108,109,1,0,0,0,109,111,1,0,0,0,110,108,1,0,0,0,111,167,5,29,0,0,
112,113,5,13,0,0,113,115,5,28,0,0,114,116,3,4,2,0,115,114,1,0,0,0,116,117,
1,0,0,0,117,115,1,0,0,0,117,118,1,0,0,0,118,119,1,0,0,0,119,120,5,29,0,0,
120,167,1,0,0,0,121,122,5,14,0,0,122,126,5,28,0,0,123,125,3,4,2,0,124,123,
1,0,0,0,125,128,1,0,0,0,126,124,1,0,0,0,126,127,1,0,0,0,127,129,1,0,0,0,
128,126,1,0,0,0,129,167,5,29,0,0,130,131,5,15,0,0,131,133,5,28,0,0,132,134,
3,4,2,0,133,132,1,0,0,0,134,135,1,0,0,0,135,133,1,0,0,0,135,136,1,0,0,0,
136,137,1,0,0,0,137,138,5,29,0,0,138,167,1,0,0,0,139,140,5,16,0,0,140,142,
5,28,0,0,141,143,3,4,2,0,142,141,1,0,0,0,143,144,1,0,0,0,144,142,1,0,0,0,
144,145,1,0,0,0,145,146,1,0,0,0,146,147,5,29,0,0,147,167,1,0,0,0,148,149,
5,17,0,0,149,151,5,28,0,0,150,152,3,4,2,0,151,150,1,0,0,0,152,153,1,0,0,
0,153,151,1,0,0,0,153,154,1,0,0,0,154,155,1,0,0,0,155,156,5,29,0,0,156,167,
1,0,0,0,157,158,5,18,0,0,158,162,5,28,0,0,159,161,3,4,2,0,160,159,1,0,0,
0,161,164,1,0,0,0,162,160,1,0,0,0,162,163,1,0,0,0,163,165,1,0,0,0,164,162,
1,0,0,0,165,167,5,29,0,0,166,16,1,0,0,0,166,25,1,0,0,0,166,34,1,0,0,0,166,
43,1,0,0,0,166,52,1,0,0,0,166,61,1,0,0,0,166,70,1,0,0,0,166,79,1,0,0,0,166,
88,1,0,0,0,166,91,1,0,0,0,166,94,1,0,0,0,166,103,1,0,0,0,166,112,1,0,0,0,
166,121,1,0,0,0,166,130,1,0,0,0,166,139,1,0,0,0,166,148,1,0,0,0,166,157,
1,0,0,0,167,3,1,0,0,0,168,181,5,20,0,0,169,181,5,19,0,0,170,181,5,21,0,0,
171,181,5,18,0,0,172,176,5,28,0,0,173,175,3,4,2,0,174,173,1,0,0,0,175,178,
1,0,0,0,176,174,1,0,0,0,176,177,1,0,0,0,177,179,1,0,0,0,178,176,1,0,0,0,
179,181,5,29,0,0,180,168,1,0,0,0,180,169,1,0,0,0,180,170,1,0,0,0,180,171,
1,0,0,0,180,172,1,0,0,0,181,5,1,0,0,0,20,11,21,30,39,48,57,66,75,84,99,108,
117,126,135,144,153,162,166,176,180];
const atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
@ -70,12 +76,12 @@ export default class CMakeParser extends antlr4.Parser {
static literalNames = [ null, "'if'", "'elseif'", "'else'", "'endif'",
"'foreach'", "'endforeach'", "'while'", "'endwhile'",
"'break'", "'continue'", "'function'", "'endfunction'",
"'macro'", "'endmacro'", "'set'", null, null,
null, null, null, null, null, null, null, null,
"'('", "')'" ];
"'macro'", "'endmacro'", "'set'", "'include'",
"'add_subdirectory'", null, null, null, null,
null, null, null, null, null, null, "'('", "')'" ];
static symbolicNames = [ null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null,
"ID", "BracketArgument", "QuotedArgument",
null, null, "ID", "BracketArgument", "QuotedArgument",
"UnquotedArgument", "BracketComment", "LineComment",
"IgnoreNLBetweenArgs", "IgnoreExtraNLBetweenCmds",
"NL", "WS", "LParen", "RParen", "Escape" ];
@ -104,7 +110,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 11;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 131070) !== 0)) {
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 524286) !== 0)) {
this.state = 6;
this.command();
this.state = 7;
@ -136,7 +142,7 @@ export default class CMakeParser extends antlr4.Parser {
this.enterRule(localctx, 2, CMakeParser.RULE_command);
var _la = 0; // Token type
try {
this.state = 148;
this.state = 166;
this._errHandler.sync(this);
switch(this._input.LA(1)) {
case 1:
@ -149,7 +155,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 21;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 18;
this.argument();
this.state = 23;
@ -169,7 +175,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 30;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 27;
this.argument();
this.state = 32;
@ -189,7 +195,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 39;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 36;
this.argument();
this.state = 41;
@ -209,7 +215,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 48;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 45;
this.argument();
this.state = 50;
@ -235,7 +241,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 57;
this._errHandler.sync(this);
_la = this._input.LA(1);
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0));
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0));
this.state = 59;
this.match(CMakeParser.RParen);
break;
@ -249,7 +255,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 66;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 63;
this.argument();
this.state = 68;
@ -275,7 +281,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 75;
this._errHandler.sync(this);
_la = this._input.LA(1);
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0));
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0));
this.state = 77;
this.match(CMakeParser.RParen);
break;
@ -289,7 +295,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 84;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 81;
this.argument();
this.state = 86;
@ -335,7 +341,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 99;
this._errHandler.sync(this);
_la = this._input.LA(1);
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0));
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0));
this.state = 101;
this.match(CMakeParser.RParen);
break;
@ -349,7 +355,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 108;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 105;
this.argument();
this.state = 110;
@ -375,7 +381,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 117;
this._errHandler.sync(this);
_la = this._input.LA(1);
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0));
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0));
this.state = 119;
this.match(CMakeParser.RParen);
break;
@ -389,7 +395,7 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 126;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 123;
this.argument();
this.state = 128;
@ -415,28 +421,68 @@ export default class CMakeParser extends antlr4.Parser {
this.state = 135;
this._errHandler.sync(this);
_la = this._input.LA(1);
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0));
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0));
this.state = 137;
this.match(CMakeParser.RParen);
break;
case 16:
localctx = new OtherCmdContext(this, localctx);
localctx = new IncludeCmdContext(this, localctx);
this.enterOuterAlt(localctx, 16);
this.state = 139;
this.match(CMakeParser.ID);
this.match(CMakeParser.T__15);
this.state = 140;
this.match(CMakeParser.LParen);
this.state = 142;
this._errHandler.sync(this);
_la = this._input.LA(1);
do {
this.state = 141;
this.argument();
this.state = 144;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
this.state = 141;
this.argument();
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0));
this.state = 146;
this.match(CMakeParser.RParen);
break;
case 17:
localctx = new AddSubDirCmdContext(this, localctx);
this.enterOuterAlt(localctx, 17);
this.state = 148;
this.match(CMakeParser.T__16);
this.state = 149;
this.match(CMakeParser.LParen);
this.state = 151;
this._errHandler.sync(this);
_la = this._input.LA(1);
do {
this.state = 150;
this.argument();
this.state = 153;
this._errHandler.sync(this);
_la = this._input.LA(1);
} while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0));
this.state = 155;
this.match(CMakeParser.RParen);
break;
case 18:
localctx = new OtherCmdContext(this, localctx);
this.enterOuterAlt(localctx, 18);
this.state = 157;
this.match(CMakeParser.ID);
this.state = 158;
this.match(CMakeParser.LParen);
this.state = 162;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 159;
this.argument();
this.state = 164;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 147;
this.state = 165;
this.match(CMakeParser.RParen);
break;
default:
@ -463,44 +509,44 @@ export default class CMakeParser extends antlr4.Parser {
this.enterRule(localctx, 4, CMakeParser.RULE_argument);
var _la = 0; // Token type
try {
this.state = 162;
this.state = 180;
this._errHandler.sync(this);
switch(this._input.LA(1)) {
case 18:
case 20:
this.enterOuterAlt(localctx, 1);
this.state = 150;
this.state = 168;
this.match(CMakeParser.QuotedArgument);
break;
case 17:
case 19:
this.enterOuterAlt(localctx, 2);
this.state = 151;
this.state = 169;
this.match(CMakeParser.BracketArgument);
break;
case 19:
case 21:
this.enterOuterAlt(localctx, 3);
this.state = 152;
this.state = 170;
this.match(CMakeParser.UnquotedArgument);
break;
case 16:
case 18:
this.enterOuterAlt(localctx, 4);
this.state = 153;
this.state = 171;
this.match(CMakeParser.ID);
break;
case 26:
case 28:
this.enterOuterAlt(localctx, 5);
this.state = 154;
this.state = 172;
this.match(CMakeParser.LParen);
this.state = 158;
this.state = 176;
this._errHandler.sync(this);
_la = this._input.LA(1);
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 68091904) !== 0)) {
this.state = 155;
while((((_la) & ~0x1f) == 0 && ((1 << _la) & 272367616) !== 0)) {
this.state = 173;
this.argument();
this.state = 160;
this.state = 178;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 161;
this.state = 179;
this.match(CMakeParser.RParen);
break;
default:
@ -539,19 +585,21 @@ CMakeParser.T__11 = 12;
CMakeParser.T__12 = 13;
CMakeParser.T__13 = 14;
CMakeParser.T__14 = 15;
CMakeParser.ID = 16;
CMakeParser.BracketArgument = 17;
CMakeParser.QuotedArgument = 18;
CMakeParser.UnquotedArgument = 19;
CMakeParser.BracketComment = 20;
CMakeParser.LineComment = 21;
CMakeParser.IgnoreNLBetweenArgs = 22;
CMakeParser.IgnoreExtraNLBetweenCmds = 23;
CMakeParser.NL = 24;
CMakeParser.WS = 25;
CMakeParser.LParen = 26;
CMakeParser.RParen = 27;
CMakeParser.Escape = 28;
CMakeParser.T__15 = 16;
CMakeParser.T__16 = 17;
CMakeParser.ID = 18;
CMakeParser.BracketArgument = 19;
CMakeParser.QuotedArgument = 20;
CMakeParser.UnquotedArgument = 21;
CMakeParser.BracketComment = 22;
CMakeParser.LineComment = 23;
CMakeParser.IgnoreNLBetweenArgs = 24;
CMakeParser.IgnoreExtraNLBetweenCmds = 25;
CMakeParser.NL = 26;
CMakeParser.WS = 27;
CMakeParser.LParen = 28;
CMakeParser.RParen = 29;
CMakeParser.Escape = 30;
CMakeParser.RULE_file = 0;
CMakeParser.RULE_command = 1;
@ -1018,6 +1066,49 @@ class ElseIfCmdContext extends CommandContext {
CMakeParser.ElseIfCmdContext = ElseIfCmdContext;
class AddSubDirCmdContext extends CommandContext {
constructor(parser, ctx) {
super(parser);
super.copyFrom(ctx);
}
LParen() {
return this.getToken(CMakeParser.LParen, 0);
};
RParen() {
return this.getToken(CMakeParser.RParen, 0);
};
argument = function(i) {
if(i===undefined) {
i = null;
}
if(i===null) {
return this.getTypedRuleContexts(ArgumentContext);
} else {
return this.getTypedRuleContext(ArgumentContext,i);
}
};
enterRule(listener) {
if(listener instanceof CMakeListener ) {
listener.enterAddSubDirCmd(this);
}
}
exitRule(listener) {
if(listener instanceof CMakeListener ) {
listener.exitAddSubDirCmd(this);
}
}
}
CMakeParser.AddSubDirCmdContext = AddSubDirCmdContext;
class EndIfCmdContext extends CommandContext {
constructor(parser, ctx) {
@ -1179,6 +1270,49 @@ class ContinueCmdContext extends CommandContext {
CMakeParser.ContinueCmdContext = ContinueCmdContext;
class IncludeCmdContext extends CommandContext {
constructor(parser, ctx) {
super(parser);
super.copyFrom(ctx);
}
LParen() {
return this.getToken(CMakeParser.LParen, 0);
};
RParen() {
return this.getToken(CMakeParser.RParen, 0);
};
argument = function(i) {
if(i===undefined) {
i = null;
}
if(i===null) {
return this.getTypedRuleContexts(ArgumentContext);
} else {
return this.getTypedRuleContext(ArgumentContext,i);
}
};
enterRule(listener) {
if(listener instanceof CMakeListener ) {
listener.enterIncludeCmd(this);
}
}
exitRule(listener) {
if(listener instanceof CMakeListener ) {
listener.exitIncludeCmd(this);
}
}
}
CMakeParser.IncludeCmdContext = IncludeCmdContext;
class EndFunctionCmdContext extends CommandContext {
constructor(parser, ctx) {

View File

@ -4,7 +4,7 @@ import { DocumentSymbol, SymbolKind } from "vscode-languageserver-protocol";
export class SymbolListener extends CMakeListener {
private _symbols: DocumentSymbol[] = [];
private _inFunction: boolean = false;
private _functionSymbol: DocumentSymbol;
private _symbolsInFunction: DocumentSymbol;
private makeSymbol(token: any, kind: SymbolKind): DocumentSymbol {
return {
@ -36,7 +36,7 @@ export class SymbolListener extends CMakeListener {
enterSetCmd(ctx: any): void {
const argumentCtx = ctx.argument(0);
if (this._inFunction) {
this._functionSymbol.children.push(this.makeSymbol(argumentCtx.start, SymbolKind.Variable));
this._symbolsInFunction.children.push(this.makeSymbol(argumentCtx.start, SymbolKind.Variable));
} else {
this._symbols.push(this.makeSymbol(argumentCtx.start, SymbolKind.Variable));
}
@ -45,13 +45,13 @@ export class SymbolListener extends CMakeListener {
enterFunctionCmd(ctx: any): void {
this._inFunction = true;
const argumentCtx = ctx.argument(0);
this._functionSymbol = this.makeSymbol(argumentCtx.start, SymbolKind.Function);
this._functionSymbol.children = [];
this._symbolsInFunction = this.makeSymbol(argumentCtx.start, SymbolKind.Function);
this._symbolsInFunction.children = [];
}
enterEndFunctionCmd(ctx: any): void {
this._inFunction = false;
this._symbols.push(this._functionSymbol);
this._symbols.push(this._symbolsInFunction);
}
enterMacroCmd(ctx: any): void {