Highlighting CNC Code

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
JOLLYLUNATIC
Posts: 1
Joined: Sat Oct 24, 2009 7:17 pm

Highlighting CNC Code

Post by JOLLYLUNATIC »

I'm trying to create a syntax file for CNC programming. The problem I have is that my keywords are not seperated by spaces. Sometimes the word are highlighted and sometimes they are not. Here's an exemple :

O0001(CALIBRATION )
(*********************)
#506=.4(BACK-OFF DISTANCE)
#523=20.000
#524=-3.000
#525=1.(RAPID APPROACH Z)
#526=.3(SLOW APPROACH Z)
#527=#0
#528=#0
#529=3.(OFFSET TYPE)
#531=1.(INCH)
G00G54G49H0Z0
X8.000
M6T14
G54
G90G1X#523Y#524F200.
Z[-7.500+.4]
M01
G65P9851K3.000
G54G49H0G17Z0
M01
IF[#2EQ1]GOTO 2
X0Y0
N2
IF[#2EQ#0]GOTO3
M99
N3
M30

Every number starting with # are written into my keywords definition from #0 to #19099, so why doesn't #523 and #524 highlight? and why does the GOTO with the space char highlight compared to the one without. Is there a way around this?

Here's a sample of my syntax definition :

[Syntax]
Namespace1 = 6
IgnoreCase = NO
InitKeyWordChars = A-Za-z0-9
KeyWordChars = A-Za-z0-9
BracketChars = +-*/=<>
OperatorChars = XYZABCR
PreprocStart = N
CommentStart = (
CommentEnd = )
CommentStartAlt = S
CommentEndAlt =
SingleComment =
SingleCommentCol =
SingleCommentAlt = '
SingleCommentColAlt =
StringStart = [
StringEnd = ]
StringAlt =
StringEsc =
CharStart = %
CharEnd = %
CharEsc =

; WORDS
[Keywords 1]
%
DO
GOTO
IF
DPRINT
MOD
OPEN
OR
OUT
RND
SQR
THEN
GE
GT
LE
LT
EQ
NE

; M-CODES G-CODES
[Keywords 2]
M0
M00
M1
M01
M2
M02
M3
M03
M4
M04
M5
M05
M6
M06
M7
M07
M8
M08
M9
M09
M10

Thanks to anyone that can help :!:
Post Reply