mcedit syntax highlight question

 
0
 

Hi all.
I need to highlight comments on mcedit.
1) comments start with "--"
2) comments may may end with "\n" or with "--"

how to do it in mcedit syntax file?

These lines are my syntax file content which responsible to highlight comments

context -- \n brown # here I have trouble, comments may end with "--" too
spellcheck
context /\* \*/ brown
spellcheck

Please help!

 
0
 

On mc internal editor's syntax file can't contain more than one 'context' tag which starts with the same symbols. Therefore I should use regular expression in this situation. I've already tried this syntax:

context -- \[\n|--\] brown
    spellcheck

Anybody know what reg-exp should I use?

 
0
 

Help, please...
I have not solved my problem yet...

 
0
 

Hi _neo_!

Just to be sure, can you tell us what language you're working with? There are a couple of ways this might be accomplished, but I wanted to be sure I'm testing with the correct base syntax file first.

Thanks!
-G

 
0
 

Hi Gromit.
I'm trying do syntax highlighting for ASN.1 syntax.
I've attached what I have now.
Please, help me.
Thank you in advance.

Attachments asn.syntax_.txt (4.88 KB)
context default lightgray

# ASN1 supported Types
    keyword whole ALL 			yellow
    keyword whole ANY 			yellow
    keyword whole BOOLEAN 		yellow
    keyword whole BIT 			yellow
    keyword whole BMPString 		yellow
    keyword whole CHARACTER 		yellow
    keyword whole CHOICE 		yellow
    keyword whole DATE 			yellow
    keyword whole DATE-TIME 		yellow
    keyword whole EMBEDDED 		yellow
    keyword whole ENUMERATED 		yellow
    keyword whole EXTERNAL 		yellow
    keyword whole GeneralizedTime 	yellow
    keyword whole GeneralString 	yellow
    keyword whole GraphicString 	yellow
    keyword whole IA5String 		yellow
    keyword whole IDENTIFIER 		yellow
    keyword whole INTEGER 		yellow
    keyword whole ISO646String		yellow
    keyword whole NULL 			yellow
    keyword whole NumericString 	yellow
    keyword whole PrintableString 	yellow
    keyword whole PDV 			yellow
    keyword whole OBJECT 		yellow
    keyword whole OCTET 		yellow
    keyword whole OF 			yellow
    keyword whole OID-IRI 		yellow
    keyword whole ObjectDescriptor 	yellow
    keyword whole REAL 			yellow
    keyword whole RELATIVE-OID 		yellow
    keyword whole RELATIVE-OID-IRI 	yellow
    keyword whole SEQUENCE 		yellow
    keyword whole SET 			yellow
    keyword whole STRING 		yellow
    keyword whole StringStore 		yellow
    keyword whole T61String 		yellow
    keyword whole TeletexString 	yellow
    keyword whole TIME 			yellow
    keyword whole TIME-OF-DAY 		yellow
    keyword whole TYPE-IDENTIFIER 	yellow
    keyword whole VisibleString 	yellow
    keyword whole VideotexString 	yellow
    keyword whole UNION 		yellow
    keyword whole UniversalString 	yellow
    keyword whole UTCTime 		yellow
    keyword whole UTF8String 		yellow


# ASN1 Keywords
    keyword whole ABSENT 		brightcyan
    keyword whole ABSTRACT-SYNTAX 	brightcyan
    keyword whole APPLICATION 		brightcyan
    keyword whole AUTOMATIC 		brightcyan
    keyword whole BEGIN 		brightcyan
    keyword whole BY 			brightcyan
    keyword whole CLASS 		brightcyan
    keyword whole COMPONENT 		brightcyan
    keyword whole COMPONENTS 		brightcyan    
    keyword whole CONSTRAINED 		brightcyan
    keyword whole CONTAINING 		brightcyan
    keyword whole DEFAULT 		brightcyan
    keyword whole DEFINITIONS 		brightcyan
    keyword whole DURATION 		brightcyan
    keyword whole ENCODED 		brightcyan
    keyword whole ENCODING-CONTROL 	brightcyan
    keyword whole END 			brightcyan
    keyword whole EXCEPT 		brightcyan
    keyword whole EXPLICIT 		brightcyan
    keyword whole EXPORTS 		brightcyan
    keyword whole EXTENSIBILITY 	brightcyan
    keyword whole FALSE 		brightcyan
    keyword whole FROM 			brightcyan
    keyword whole IMPLICIT 		brightcyan
    keyword whole IMPLIED 		brightcyan
    keyword whole IMPORTS 		brightcyan
    keyword whole INCLUDES 		brightcyan
    keyword whole INSTANCE 		brightcyan
    keyword whole INSTRUCTIONS 		brightcyan
    keyword whole INTERSECTION 		brightcyan
    keyword whole MAX 			brightcyan
    keyword whole MIN 			brightcyan
    keyword whole MINUS-INFINITY 	brightcyan
    keyword whole NOT-A-NUMBER 		brightcyan
    keyword whole OPTIONAL 		brightcyan
    keyword whole PATTERN 		brightcyan
    keyword whole PLUS-INFINITY 	brightcyan
    keyword whole PRESENT 		brightcyan
    keyword whole PRIVATE 		brightcyan
    keyword whole SETTINGS 		brightcyan
    keyword whole SIZE 			brightcyan
    keyword whole SYNTAX 		brightcyan
    keyword whole TAGS 			brightcyan
    keyword whole TRUE 			brightcyan
    keyword whole UNIQUE 		brightcyan
    keyword whole UNIVERSAL 		brightcyan
    keyword whole WITH 			brightcyan

# SPECIAL CHARACTERS

    keyword ::= 	white
    keyword ... 	white
    keyword .. 		white
    keyword | 		white
    keyword & 		white
    keyword ? 		white
    keyword :		white
    keyword !		white
    keyword ;		brightcyan
    keyword , 		brightcyan
    keyword . 		brightcyan
    keyword ( 		brightcyan
    keyword ) 		brightcyan
    keyword { 		brightcyan
    keyword } 		brightcyan
    keyword [ 		brightcyan
    keyword ] 		brightcyan

# DIGITS
#  keyword whole 0\{xX\}\{0123456789abcdefABCDEF\}\[0123456789abcdefABCDEF\]       brightgreen
    keyword whole \{0123456789\}\[0123456789\]      			brightgreen
    keyword whole \[0123456789\]\.\{0123456789\}\[0123456789\]      	brightgreen
    keyword whole \{0123456789\}\[0123456789\]\.\[0123456789\]      	brightgreen
    keyword whole \{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\]    					brightgreen
    keyword whole \{0123456789\}\[0123456789\]\{eE\}\{\-\+\}\{0123456789\}\[0123456789\]    				brightgreen
    keyword whole \{0123456789\}\[0123456789\]\.\{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\]      	brightgreen
    keyword whole \{0123456789\}\[0123456789\]\.\{0123456789\}\[0123456789\]\{eE\}\{\-\+\}\{0123456789\}\[0123456789\]	brightgreen

context -- \n brown
    spellcheck

context /\* \*/ brown
    spellcheck

context " " green
context ' ' brightgreen
 
0
 

Hmm... I wonder if you can do it like it's done in the lua.syntax file?

There's a 'keyword' line under 'context default' that looks like this: keyword -- brown There is also a separate section similar to the comment line that you have that looks like this:

context exclusive -- \n brown
    spellcheck

I hope this helps!
-Jeo

 
0
 

Hi Gromit. Thank you for response.
I've tried do like lua's syntax file, but it doesn't solve my problem.

Does anybody have other ideas?

Here is example of one line comments:
code --start of one line comment, which ends with carriage-return
code --start of one line comment, which ends with '--' symbols -- continue code

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: