[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    New Syntax Highlighting: LDIF - LDAP Data Interchange Format
From:       Andreas Hochsteger <e9625392 () student ! tuwien ! ac ! at>
Date:       2003-02-19 22:55:52
[Download RAW message or body]

Hi!

I've just finished the syntax highlighting for LDIF and would like to donate 
it to KDE.

BTW, thanks to Joseph, who helped me with the syntax of the contexts.
I also found out, that some of my problems were caused by a bug, which doesn't 
allow XML comments inside the syntax highlighting file (see 
http://bugs.kde.org/show_bug.cgi?id=54884).

There's one unimportant misbehavior contained, which I don't think that can be 
easily solved.
The following example explains this:
1. dn: cn=Manager,dc=example,dc=org (is marked up correctly)
2. dn:cn=Manager,dc=example,dc=org (is marked up incorrectly)
In the second example the character 'c' of 'cn=' is not displayed with 
itemData "Value (Keyword)" because the first character after ":" is used to 
detect the type of data that is following, but this is something which is 
seldom the case.
If somebody thinks, that it can be correctly expressed, please give it a try.

The keyword list contains the attributeTypes and objectClasses of the 
following schema files:
 - corba.schema
 - core.schema
 - cosine.schema
 - inetorgperson.schema
 - java.schema
 - misc.schema
 - mozillaAbPersonObsolete.schema
 - nis.schema
 - openldap.schema
 - outlook-ns.schema

The attached shell and awk script can be used to customize/extend the keyword 
list and is used as follows:
# list-keywords.sh *.schema > keywords.xml

The contents of the file keywords.xml can be included in the syntax 
highlighting file.

Any comments are highly appreciated!

Bye,

	Andreas Hochsteger

["list-keywords.awk" (application/x-awk)]
["list-keywords.sh" (application/x-shellscript)]

#!/bin/sh

list_keywords=./list-keywords.awk
schemas="$@"

echo "		<list name=\"attributetypes\">"
cat $schemas | $list_keywords | grep "attributetype" | grep -v '^#' | sed -e "s/'//g" \
| sort -u | awk '{print "			<item>"$2"</item>"}' echo "		</list>"
echo "		<list name=\"objectclasses\">"
cat $schemas | $list_keywords | grep "objectclass" | grep -v '^#' | sed -e "s/'//g" | \
sort -u | awk '{print "			<item>"$2"</item>"}' echo "		</list>"


["ldif.xml" (text/xml)]

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!-- LDIF syntaxfile 1.0 by Andreas Hochsteger <e9625392@student.tuwien.ac.at> -->
<language name="LDIF" version="1.0" kateversion="2.1" section="Other" \
extensions="*.ldif" mimetype="application/directory">  <highlighting>
		<list name="attributetypes">
			<item>IPPhone</item>
			<item>URL</item>
			<item>aRecord</item>
			<item>aliasedEntryName</item>
			<item>aliasedObjectName</item>
			<item>associatedDomain</item>
			<item>associatedName</item>
			<item>audio</item>
			<item>authorityRevocationList</item>
			<item>bootFile</item>
			<item>bootParameter</item>
			<item>buildingName</item>
			<item>businessCategory</item>
			<item>c</item>
			<item>cACertificate</item>
			<item>cNAMERecord</item>
			<item>certificateRevocationList</item>
			<item>cn</item>
			<item>comment</item>
			<item>commonName</item>
			<item>conferenceInformation</item>
			<item>corbaContainer</item>
			<item>corbaRepositoryId</item>
			<item>countryName</item>
			<item>crossCertificatePair</item>
			<item>custom1</item>
			<item>custom2</item>
			<item>custom3</item>
			<item>custom4</item>
			<item>dITRedirect</item>
			<item>dSAQuality</item>
			<item>dc</item>
			<item>deltaRevocationList</item>
			<item>description</item>
			<item>destinationIndicator</item>
			<item>distinguishedName</item>
			<item>dmdName</item>
			<item>dnQualifier</item>
			<item>documentAuthor</item>
			<item>documentIdentifier</item>
			<item>documentLocation</item>
			<item>documentPublisher</item>
			<item>documentTitle</item>
			<item>documentVersion</item>
			<item>domainComponent</item>
			<item>enhancedSearchGuide</item>
			<item>facsimileTelephoneNumber</item>
			<item>fax</item>
			<item>gecos</item>
			<item>generationQualifier</item>
			<item>gidNumber</item>
			<item>givenName</item>
			<item>gn</item>
			<item>homeDirectory</item>
			<item>homePostalAddress</item>
			<item>homeUrl</item>
			<item>host</item>
			<item>houseIdentifier</item>
			<item>info</item>
			<item>initials</item>
			<item>internationaliSDNNumber</item>
			<item>ipHostNumber</item>
			<item>ipNetmaskNumber</item>
			<item>ipNetworkNumber</item>
			<item>ipProtocolNumber</item>
			<item>ipServicePort</item>
			<item>ipServiceProtocol</item>
			<item>janetMailbox</item>
			<item>javaClassNames</item>
			<item>javaCodebase</item>
			<item>javaContainer</item>
			<item>javaDoc</item>
			<item>javaFactory</item>
			<item>javaReferenceAddress</item>
			<item>javaSerializedData</item>
			<item>knowledgeInformation</item>
			<item>l</item>
			<item>labeledURI</item>
			<item>lastModifiedBy</item>
			<item>lastModifiedTime</item>
			<item>lmpassword</item>
			<item>localityName</item>
			<item>loginShell</item>
			<item>mDRecord</item>
			<item>mXRecord</item>
			<item>macAddress</item>
			<item>mail</item>
			<item>manager</item>
			<item>member</item>
			<item>memberNisNetgroup</item>
			<item>memberUid</item>
			<item>mozillaHomeCountryName</item>
			<item>mozillaHomeFriendlyCountryName</item>
			<item>mozillaHomeLocalityName</item>
			<item>mozillaHomePostalAddress2</item>
			<item>mozillaHomePostalCode</item>
			<item>mozillaHomeState</item>
			<item>mozillaPostalAddress2</item>
			<item>mozillaSecondemail</item>
			<item>nSRecord</item>
			<item>name</item>
			<item>nisMapEntry</item>
			<item>nisMapName</item>
			<item>nisNetgroupTriple</item>
			<item>ntpasswd</item>
			<item>o</item>
			<item>objectClass</item>
			<item>oncRpcNumber</item>
			<item>organizationName</item>
			<item>organizationalStatus</item>
			<item>organizationalUnitName</item>
			<item>otherFacsimiletelephoneNumber</item>
			<item>otherMailbox</item>
			<item>ou</item>
			<item>owner</item>
			<item>personalSignature</item>
			<item>personalTitle</item>
			<item>photo</item>
			<item>physicalDeliveryOfficeName</item>
			<item>postOfficeBox</item>
			<item>postalAddress</item>
			<item>postalCode</item>
			<item>preferredDeliveryMethod</item>
			<item>presentationAddress</item>
			<item>protocolInformation</item>
			<item>rdn</item>
			<item>registeredAddress</item>
			<item>reports</item>
			<item>rfc822Mailbox</item>
			<item>roleOccupant</item>
			<item>roomNumber</item>
			<item>sOARecord</item>
			<item>searchGuide</item>
			<item>secretary</item>
			<item>seeAlso</item>
			<item>serialNumber</item>
			<item>shadowExpire</item>
			<item>shadowFlag</item>
			<item>shadowInactive</item>
			<item>shadowLastChange</item>
			<item>shadowMax</item>
			<item>shadowMin</item>
			<item>shadowWarning</item>
			<item>singleLevelQuality</item>
			<item>sn</item>
			<item>st</item>
			<item>stateOrProvinceName</item>
			<item>street</item>
			<item>streetAddress</item>
			<item>subtreeMaximumQuality</item>
			<item>subtreeMinimumQuality</item>
			<item>supportedAlgorithms</item>
			<item>supportedApplicationContext</item>
			<item>surname</item>
			<item>telephoneNumber</item>
			<item>teletexTerminalIdentifier</item>
			<item>telexNumber</item>
			<item>textEncodedORAddress</item>
			<item>title</item>
			<item>uid</item>
			<item>uidNumber</item>
			<item>uniqueIdentifier</item>
			<item>uniqueMember</item>
			<item>userCertificate</item>
			<item>userClass</item>
			<item>userPassword</item>
			<item>userid</item>
			<item>workUrl</item>
			<item>x121Address</item>
			<item>x500UniqueIdentifier</item>
			<item>xmozillaNickname</item>
			<item>xmozillaUseHtmlMail</item>
			<item>xmozillanickname</item>
			<item>xmozillausehtmlmail</item>
		</list>
		<list name="objectclasses">
			<item>RFC822localPart</item>
			<item>SUP</item>
			<item>account</item>
			<item>alias</item>
			<item>applicationEntity</item>
			<item>applicationProcess</item>
			<item>bootableDevice</item>
			<item>cRLDistributionPoint</item>
			<item>certificationAuthority</item>
			<item>certificationAuthority-V2</item>
			<item>corbaObject</item>
			<item>corbaObjectReference</item>
			<item>country</item>
			<item>dNSDomain</item>
			<item>dSA</item>
			<item>dcObject</item>
			<item>deltaCRL</item>
			<item>device</item>
			<item>dmd</item>
			<item>document</item>
			<item>documentSeries</item>
			<item>domain</item>
			<item>domainRelatedObject</item>
			<item>friendlyCountry</item>
			<item>groupOfNames</item>
			<item>groupOfUniqueNames</item>
			<item>ieee802Device</item>
			<item>inetOrgPerson</item>
			<item>ipHost</item>
			<item>ipNetwork</item>
			<item>ipProtocol</item>
			<item>ipService</item>
			<item>javaClassName</item>
			<item>javaMarshalledObject</item>
			<item>javaNamingReference</item>
			<item>javaObject</item>
			<item>javaSerializedObject</item>
			<item>labeledURIObject</item>
			<item>locality</item>
			<item>mozillaAbPersonObsolete</item>
			<item>nisMap</item>
			<item>nisNetgroup</item>
			<item>nisObject</item>
			<item>officePerson</item>
			<item>oncRpc</item>
			<item>organization</item>
			<item>organizationalPerson</item>
			<item>organizationalRole</item>
			<item>organizationalUnit</item>
			<item>pager</item>
			<item>pagerTelephoneNumber</item>
			<item>person</item>
			<item>pilotDSA</item>
			<item>pilotObject</item>
			<item>pilotOrganization</item>
			<item>pkiCA</item>
			<item>pkiUser</item>
			<item>posixAccount</item>
			<item>posixGroup</item>
			<item>qualityLabelledData</item>
			<item>residentialPerson</item>
			<item>rid</item>
			<item>room</item>
			<item>sambaAccount</item>
			<item>shadowAccount</item>
			<item>simpleSecurityObject</item>
			<item>strongAuthenticationUser</item>
			<item>telephoneNumber</item>
			<item>top</item>
			<item>uid</item>
			<item>uidNumber</item>
			<item>uidObject</item>
			<item>userSecurityInformation</item>
			<item>userid</item>
			<item>xmozillaanyphone</item>
			<item>zillaPerson</item>
		</list>
		<contexts>
			<context name="ctxStart" attribute="Value (Standard)" lineEndContext="#stay">
				<RegExpr String="#.*$" attribute="Comment" context="#stay"/>
				<RegExpr String=":" attribute="Description Keyword" context="ctxEncoded"/>
				<RegExpr String="&lt;" attribute="Description Keyword" context="ctxURL"/>
				<RegExpr String="[^:&lt;]" attribute="Value (Standard)" context="ctxStandard"/>
				<RegExpr String="^[\w\-]+((;[\w\-]+)+)?:" attribute="Description Keyword" \
context="#stay"/>  </context>
			<context name="ctxEncoded" attribute="Value (Encoded)" lineEndContext="#stay">
				<RegExpr String="#.*$" attribute="Comment" context="#stay"/>
				<RegExpr String="[\s].*$" attribute="Value (Encoded)" context="#stay"/>
				<RegExpr String="^[\w\-]+((;[\w\-]+)+)?:" attribute="Description Keyword" \
context="#pop"/>  </context>
			<context name="ctxURL" attribute="Value (URL)" lineEndContext="#stay">
				<RegExpr String="#.*$" attribute="Comment" context="#stay"/>
				<RegExpr String="[\s]+[\w]+://[\w/.]+" attribute="Value (URL)" context="#stay"/>
				<RegExpr String="[\s].*$" attribute="Value (URL)" context="#stay"/>
				<RegExpr String="^[\w\-]+((;[\w\-]+)+)?:" attribute="Description Keyword" \
context="#pop"/>  </context>
			<context name="ctxStandard" attribute="Value (Standard)" lineEndContext="#stay">
				<RegExpr String="#.*$" attribute="Comment" context="#stay"/>
				<RegExpr String="\{\w+\}.*$" attribute="Value (Encrypted)" \
context="ctxEncrypted"/>  <keyword String="attributetypes" attribute="AttributeType" \
context="#stay"/>  <keyword String="objectclasses" attribute="ObjectClass" \
context="#stay"/>  <RegExpr String="^[\w\-]+((;[\w\-]+)+)?:" attribute="Description \
Keyword" context="#pop"/>  <RegExpr String="[a-zA-Z0-9\-]+=" attribute="Value \
(Keyword)" context="#stay"/>  </context>
			<context name="ctxEncrypted" attribute="Value (Encrypted)" lineEndContext="#stay">
				<RegExpr String="#.*$" attribute="Comment" context="#stay"/>
				<RegExpr String="[\s].*$" attribute="Value (Encrypted)" context="#stay"/>
				<RegExpr String="^[\w\-]+((;[\w\-]+)+)?:" attribute="Description Keyword" \
context="#pop#pop"/>  </context>
		</contexts>
		<itemDatas>
			<itemData name="Normal Text"		defStyleNum="dsNormal"	color="#000000" \
selColor="#FFFFFF" bold="0" italic="0"/>  <itemData \
name="Comment"		defStyleNum="dsComment"	color="#808080" selColor="#808080" bold="0" \
italic="0"/>  <itemData name="AttributeType"		defStyleNum="dsKeyword"	color="#404040" \
selColor="#FFFFFF" bold="1" italic="0"/>  <itemData \
name="ObjectClass"		defStyleNum="dsKeyword"	color="#800080" selColor="#FFFFFF" \
bold="1" italic="0"/>  <itemData name="Description \
Keyword"	defStyleNum="dsKeyword"	color="#000000" selColor="#FFFFFF" bold="1" \
italic="0"/>  <itemData name="Value \
(Standard)"	defStyleNum="dsString"	color="#008000" selColor="#008000" bold="0" \
italic="0"/>  <itemData name="Value (Encoded)"	defStyleNum="dsString"	color="#FF8000" \
selColor="#0080FF" bold="0" italic="0"/>  <itemData name="Value \
(Encrypted)"	defStyleNum="dsString"	color="#FF0000" selColor="#00FFFF" bold="0" \
italic="0"/>  <itemData name="Value (Keyword)"	defStyleNum="dsString"	color="#008000" \
selColor="#800080" bold="1" italic="0"/>  <itemData name="Value \
(URL)"		defStyleNum="dsString"	color="#0000FF" selColor="#FFFF00" bold="0" \
italic="0"/>  </itemDatas>
	</highlighting>
</language>


_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kwrite-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic