Auto-indentation in a new edit mode
Submitted by Thursday, 9 December, 2004 - 09:53
on
Hi, I've been writing an edit mode for the ABB RAPID industrial robot programming language. Just one thing outstanding - Auto Indentation
In UltraEdit, the following lines work. I need to do the equivalent in jEdit.
/Indent Strings = "ELSE" "ELSEIF" "THEN" "DO"
/Unindent Strings = "ENDIF" "ELSE" "ENDFOR" "ENDPROC" "ENDMODULE" "ENDWHILE" "ENDFOR" "ENDTEST"
Here are a few examples of how the RAPID code looks. Note there are no brackets used in structuring these statements in this language. Can jEdit handle this or not?
IF nCurrentTable=1 THEN
pBegin1.trans.z:=nMaxDistT1;
pEnd1.trans.z:=nMinDistT1;
ELSEIF nCurrentTable=2 THEN
pBegin1.trans.z:=nMaxDistT2;
pEnd1.trans.z:=nMinDistT2;
ENDIF
WHILE NOT ConditionsOK DO
IF (diCtrl_Vacuum1=0 AND boEnable_Ch1=TRUE) RETURN TRUE;
ConditionsOK:=TRUE;
ENDWHILE
FOR i FROM 1 TO 10 DO
routine1;
ENDFOR
But the following "compact" (one-line) IF statement should not have the next line indented:
IF di3_LayerOrd=1 Layer;
Thanks for any help!
Andrew
In UltraEdit, the following lines work. I need to do the equivalent in jEdit.
/Indent Strings = "ELSE" "ELSEIF" "THEN" "DO"
/Unindent Strings = "ENDIF" "ELSE" "ENDFOR" "ENDPROC" "ENDMODULE" "ENDWHILE" "ENDFOR" "ENDTEST"
Here are a few examples of how the RAPID code looks. Note there are no brackets used in structuring these statements in this language. Can jEdit handle this or not?
IF nCurrentTable=1 THEN
pBegin1.trans.z:=nMaxDistT1;
pEnd1.trans.z:=nMinDistT1;
ELSEIF nCurrentTable=2 THEN
pBegin1.trans.z:=nMaxDistT2;
pEnd1.trans.z:=nMinDistT2;
ENDIF
WHILE NOT ConditionsOK DO
IF (diCtrl_Vacuum1=0 AND boEnable_Ch1=TRUE) RETURN TRUE;
ConditionsOK:=TRUE;
ENDWHILE
FOR i FROM 1 TO 10 DO
routine1;
ENDFOR
But the following "compact" (one-line) IF statement should not have the next line indented:
IF di3_LayerOrd=1 Layer;
Thanks for any help!
Andrew