Extended G-code syntax
- Parenthesized comments - Multiple E values split by colons (RepRapFirmware)
This commit is contained in:
parent
5108e4b6aa
commit
4e7187b926
2 changed files with 40 additions and 1 deletions
|
@ -97,6 +97,12 @@ contexts:
|
||||||
2: punctuation.quote.double.open.gcode
|
2: punctuation.quote.double.open.gcode
|
||||||
push: gcode_string_arg_quoted_double
|
push: gcode_string_arg_quoted_double
|
||||||
|
|
||||||
|
# parameter and list of values
|
||||||
|
- match: ([Ee])\s*(({{decimal}}\s*:\s*)+{{decimal}})
|
||||||
|
captures:
|
||||||
|
1: keyword.param.gcode
|
||||||
|
2: constant.numeric.param.gcode
|
||||||
|
|
||||||
# parameter and numeric value
|
# parameter and numeric value
|
||||||
- match: ([A-Za-z])\s*({{decimal}})
|
- match: ([A-Za-z])\s*({{decimal}})
|
||||||
captures:
|
captures:
|
||||||
|
@ -189,6 +195,9 @@ contexts:
|
||||||
- match: \s*;
|
- match: \s*;
|
||||||
scope: punctuation.comment.eol.start
|
scope: punctuation.comment.eol.start
|
||||||
set: gcode_comment
|
set: gcode_comment
|
||||||
|
- match: \s*\(
|
||||||
|
scope: punctuation.paren.comment.open
|
||||||
|
push: gcode_comment_paren
|
||||||
|
|
||||||
# Comment to end of line.
|
# Comment to end of line.
|
||||||
gcode_comment:
|
gcode_comment:
|
||||||
|
@ -196,6 +205,18 @@ contexts:
|
||||||
- match: \s*$
|
- match: \s*$
|
||||||
pop: true
|
pop: true
|
||||||
|
|
||||||
|
gcode_comment_paren:
|
||||||
|
- meta_content_scope: paren.comment.gcode
|
||||||
|
|
||||||
|
- match: '[^)]+'
|
||||||
|
|
||||||
|
- match: '[)]'
|
||||||
|
scope: punctuation.paren.comment.close
|
||||||
|
pop: true
|
||||||
|
|
||||||
|
- match: \s*$
|
||||||
|
pop: true
|
||||||
|
|
||||||
# Everything after this point is broken by a syntax error
|
# Everything after this point is broken by a syntax error
|
||||||
syntax_error:
|
syntax_error:
|
||||||
- meta_scope: invalid.error.syntax.gcode
|
- meta_scope: invalid.error.syntax.gcode
|
||||||
|
|
|
@ -9,6 +9,14 @@ G1 X100 Y100 ; Move to 100,100
|
||||||
; ^constant.numeric.param.gcode
|
; ^constant.numeric.param.gcode
|
||||||
; ^comment
|
; ^comment
|
||||||
|
|
||||||
|
T0 (This is a comment) S12
|
||||||
|
;^entity.command.gcode
|
||||||
|
; ^punctuation.paren.comment.open
|
||||||
|
; ^paren.comment.gcode
|
||||||
|
; ^punctuation.paren.comment.close
|
||||||
|
; ^keyword.param.gcode
|
||||||
|
; ^constant.numeric.param.gcode
|
||||||
|
|
||||||
M20 P'/path/to/macro/macro.g' R12
|
M20 P'/path/to/macro/macro.g' R12
|
||||||
;<-entity.command.gcode
|
;<-entity.command.gcode
|
||||||
;^constant.numeric.command.gcode
|
;^constant.numeric.command.gcode
|
||||||
|
@ -16,6 +24,8 @@ M20 P'/path/to/macro/macro.g' R12
|
||||||
; ^punctuation.quote.single.open.gcode
|
; ^punctuation.quote.single.open.gcode
|
||||||
; ^string.quoted.single.gcode
|
; ^string.quoted.single.gcode
|
||||||
; ^punctuation.quote.single.close.gcode
|
; ^punctuation.quote.single.close.gcode
|
||||||
|
; ^keyword.param.gcode
|
||||||
|
; ^constant.numeric.param.gcode
|
||||||
|
|
||||||
M117 This is a message ; and comment
|
M117 This is a message ; and comment
|
||||||
;<-entity.command.gcode
|
;<-entity.command.gcode
|
||||||
|
@ -83,6 +93,14 @@ N234 G1 X-5 Y+2 *64 error
|
||||||
; ^constant.numeric.checksum.gcode
|
; ^constant.numeric.checksum.gcode
|
||||||
; ^invalid.error.syntax.gcode
|
; ^invalid.error.syntax.gcode
|
||||||
|
|
||||||
N234 M107 *64
|
N234 M107 *64
|
||||||
; ^-invalid.error.syntax.gcode
|
; ^-invalid.error.syntax.gcode
|
||||||
|
|
||||||
|
M92 E304.5:304.5:420:420:420:420 ; EOL Comment
|
||||||
|
;<-entity.command.gcode
|
||||||
|
;^constant.numeric.command.gcode
|
||||||
|
; ^keyword.param.gcode
|
||||||
|
; ^constant.numeric.param.gcode
|
||||||
|
; ^constant.numeric.param.gcode
|
||||||
|
; ^punctuation.comment.eol.start
|
||||||
|
; ^comment.gcode
|
||||||
|
|
Reference in a new issue