From b3d26dc5fb07daadf78f73055ec30a815ad208b3 Mon Sep 17 00:00:00 2001 From: barthy Date: Sat, 6 Apr 2024 12:32:00 +0200 Subject: [PATCH 1/2] fix(gcode): stricter line numbers match --- CHANGES.md | 3 ++- src/languages/gcode.js | 8 +------- test/markup/gcode/default.expect.txt | 1 + test/markup/gcode/default.txt | 1 + 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 794f4f4747..579b7dad34 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -39,6 +39,7 @@ Core Grammars: - enh(markdown) add entity support [David Schach][] [TaraLei][] - enh(css) add `justify-items` and `justify-self` attributes [Vasily Polovnyov][] - enh(css) add `accent-color`, `appearance`, `color-scheme`, `rotate`, `scale` and `translate` attributes [Carl Räfting][] +- fix(gcode) stricter gcode line number matching [Barthy Bonhomme][] New Grammars: @@ -88,7 +89,7 @@ Themes: [Rúnar Bjarnason]: https://github.com/runarorama [Carl Räfting]: https://github.com/carlrafting [BackupMiles]: https://github.com/BackupMiles - +[Barthy Bonhomme]: https://github.com/barthy-koeln ## Version 11.9.0 diff --git a/src/languages/gcode.js b/src/languages/gcode.js index 15bf97af7c..9834cd3645 100644 --- a/src/languages/gcode.js +++ b/src/languages/gcode.js @@ -51,13 +51,7 @@ export default function(hljs) { }, { className: 'symbol', - variants: [ - { - begin: 'N', - end: '\\d+', - illegal: '\\W' - } - ] + begin: 'N\\d+' } ]; diff --git a/test/markup/gcode/default.expect.txt b/test/markup/gcode/default.expect.txt index 500e8514c4..7b6fa7c810 100644 --- a/test/markup/gcode/default.expect.txt +++ b/test/markup/gcode/default.expect.txt @@ -28,4 +28,5 @@ N26 #4=#5*COS[45] N27 #4=#5*SIN[45] N28 VZOFZ=652.9658 +N29 SAVE_CONFIG % diff --git a/test/markup/gcode/default.txt b/test/markup/gcode/default.txt index c2652462c2..ba8e22332d 100644 --- a/test/markup/gcode/default.txt +++ b/test/markup/gcode/default.txt @@ -28,4 +28,5 @@ N25 G84.3 X-0.1 N26 #4=#5*COS[45] N27 #4=#5*SIN[45] N28 VZOFZ=652.9658 +N29 SAVE_CONFIG % From 505a7e6aadd0eb986f7e405129ab89df0eebfdcf Mon Sep 17 00:00:00 2001 From: barthy Date: Sun, 7 Apr 2024 14:52:17 +0200 Subject: [PATCH 2/2] fix(gcode): quoted string to regex --- src/languages/gcode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/gcode.js b/src/languages/gcode.js index 9834cd3645..d64d3ccf88 100644 --- a/src/languages/gcode.js +++ b/src/languages/gcode.js @@ -51,7 +51,7 @@ export default function(hljs) { }, { className: 'symbol', - begin: 'N\\d+' + begin: /N\d+/ } ];