@@ -22,28 +22,28 @@ export const intrinsics = [
22
22
"SYSTEM_CLOCK" , "TAN" , "TANH" , "THIS_IMAGE" , "TIME" , "TIME8" , "TINY" , "TRAILZ" , "TRANSFER" , "TRANSPOSE" , "TRIM" , "TTYNAM" , "UBOUND" , "UCOBOUND" , "UMASK" , "UNLINK" , "UNPACK" , "VERIFY" , "XOR" ] ;
23
23
24
24
25
- export const FORTRAN_KEYWORDS = [ "FUNCTION" , "MODULE" , "SUBROUTINE" , "CONTAINS" , "USE" , "KIND" , "DO" , "IF" , "ELIF" , "END" , "IMPLICIT" ] ;
25
+ export const FORTRAN_KEYWORDS = [ "FUNCTION" , "MODULE" , "SUBROUTINE" , "CONTAINS" , "USE" , "KIND" , "DO" , "IF" , "ELIF" , "END" , "IMPLICIT" ] ;
26
26
27
27
export const isIntrinsic = ( keyword ) => {
28
28
return intrinsics . findIndex ( intrinsic => intrinsic === keyword . toUpperCase ( ) ) !== - 1 ;
29
29
}
30
30
31
31
32
- interface Doc {
32
+ interface Doc {
33
33
keyword : string ;
34
34
docstr : string ;
35
35
}
36
36
37
37
38
38
export const loadDocString = ( keyword ) => {
39
39
keyword = keyword . toUpperCase ( ) ;
40
- let filepath = __dirname + "/../docs/" + keyword + ".json" ;
40
+ let filepath = __dirname + "/../docs/" + keyword + ".json" ;
41
41
let docstr = fs . readFileSync ( filepath ) . toString ( ) ;
42
- let doc :Doc = JSON . parse ( docstr ) ;
42
+ let doc : Doc = JSON . parse ( docstr ) ;
43
43
return doc . docstr ;
44
44
45
45
}
46
- export const _loadDocString = ( keyword :string ) => {
46
+ export const _loadDocString = ( keyword : string ) => {
47
47
48
48
keyword = keyword . toUpperCase ( ) ;
49
49
@@ -80,30 +80,30 @@ export const _loadDocString = (keyword:string) => {
80
80
return docText ;
81
81
}
82
82
83
- export const getIncludeParams = ( paths : string [ ] ) => {
84
- return paths . map ( path => "-I " + path ) . join ( " " ) ;
85
- }
83
+ export const getIncludeParams = ( paths : string [ ] ) => {
84
+ return "-I " + paths . join ( " " ) ;
85
+ } ;
86
86
87
87
88
88
89
89
export function isPositionInString ( document : vscode . TextDocument , position : vscode . Position ) : boolean {
90
- let lineText = document . lineAt ( position . line ) . text ;
91
- let lineTillCurrentPosition = lineText . substr ( 0 , position . character ) ;
90
+ let lineText = document . lineAt ( position . line ) . text ;
91
+ let lineTillCurrentPosition = lineText . substr ( 0 , position . character ) ;
92
92
93
- // Count the number of double quotes in the line till current position. Ignore escaped double quotes
94
- let doubleQuotesCnt = ( lineTillCurrentPosition . match ( / \" / g) || [ ] ) . length ;
95
- let escapedDoubleQuotesCnt = ( lineTillCurrentPosition . match ( / \\ \" / g) || [ ] ) . length ;
93
+ // Count the number of double quotes in the line till current position. Ignore escaped double quotes
94
+ let doubleQuotesCnt = ( lineTillCurrentPosition . match ( / \" / g) || [ ] ) . length ;
95
+ let escapedDoubleQuotesCnt = ( lineTillCurrentPosition . match ( / \\ \" / g) || [ ] ) . length ;
96
96
97
- doubleQuotesCnt -= escapedDoubleQuotesCnt ;
98
- return doubleQuotesCnt % 2 === 1 ;
97
+ doubleQuotesCnt -= escapedDoubleQuotesCnt ;
98
+ return doubleQuotesCnt % 2 === 1 ;
99
99
}
100
100
101
101
102
102
let saveKeywordToJson = ( keyword ) => {
103
- let doc = _loadDocString ( keyword ) ;
104
- let docObject = JSON . stringify ( { "keyword" : keyword , "docstr" : doc } ) ;
105
- fs . appendFile ( "src/docs/" + keyword + ".json" , docObject , function ( err ) {
106
- if ( err ) throw err ;
107
- console . log ( 'Saved!' ) ;
108
- } ) ;
103
+ let doc = _loadDocString ( keyword ) ;
104
+ let docObject = JSON . stringify ( { "keyword" : keyword , "docstr" : doc } ) ;
105
+ fs . appendFile ( "src/docs/" + keyword + ".json" , docObject , function ( err ) {
106
+ if ( err ) throw err ;
107
+ console . log ( 'Saved!' ) ;
108
+ } ) ;
109
109
} ;
0 commit comments