Skip to content

Commit 10eb43e

Browse files
committed
fixed parsing ruoutne name
1 parent 1f9f897 commit 10eb43e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

commands/currentdoc/rtn-regex-name.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
// routine: routine name must be declared in a routine
2-
const regex = /ROUTINE ([^\s]+)/i
3-
const regexType = /ROUTINE\s+[^\s]+\s+\[.*Type=([a-z]{3,})/i
2+
const regex = /ROUTINE ([^\s]+)(?:\s+\[.*Type=([a-z]{3,})\])?/i
43

54
module.exports = code => {
6-
7-
const arr = code.match( regex )
8-
const rtn = ( arr || [] )[ 1 ] || ''
9-
const ext = ( code.match( regexType ) || [] )[ 1 ] || 'MAC'
10-
return rtn + '.' + ext
11-
12-
}
5+
let [ meta, name, ext ] = code.match( regex )
6+
ext = ext || 'MAC'
7+
return { name, ext }
8+
}

0 commit comments

Comments
 (0)