Skip to content

Commit 2f96ff9

Browse files
fix function
1 parent 7e9b3d5 commit 2f96ff9

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ If you're using Node / Webpack / Rollup / Browserify, etc, simply require the la
3131

3232
```javascript
3333
var hljs = require('highlightjs');
34-
var hljsRobotsTxt = require('highlightjs-4d');
34+
var hljs4d = require('highlightjs-4d');
3535

36-
hljs.registerLanguage("4d", hljsRobotsTxt);
36+
hljs.registerLanguage("4d", hljs4d);
3737
hljs.initHighlightingOnLoad();
3838
```

dist/4d.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "highlightjs-4d",
3-
"version": "1.0.1",
3+
"version": "1.0.3",
44
"description": "highlight.js syntax definition for 4d",
55
"main": "src/4d.js",
66
"scripts": {

src/4d.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ module.exports = function(hljs) {
1818

1919
var FUNCTIONS = {
2020
className: 'function',
21-
begin: '([\\w ]+((?=\\()|$))',
22-
end: '$|(?!\\w|\\s)'
21+
begin: '\\w[\\w ]+\\w(?=\\()',
2322
}
2423

2524
var DATE = {
@@ -36,7 +35,10 @@ module.exports = function(hljs) {
3635

3736
var NUMBERS = {
3837
className: 'number',
39-
begin: '\\b(0[xX])?[0-9]+(\\.?,?\\^?[eE]?)[0-9]*',
38+
variants: [
39+
{ begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)' },
40+
{ begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' }
41+
],
4042
};
4143

4244
var VARIABLE = {
@@ -94,9 +96,9 @@ module.exports = function(hljs) {
9496
LOCAL_VARIABLE,
9597
VARIABLE_ARRAY,
9698
STRINGS,
97-
FUNCTIONS,
9899
NUMBERS,
99100
LITERALS,
101+
FUNCTIONS,
100102
]
101103
};
102104
}

0 commit comments

Comments
 (0)