1. Ronald Oussoren
  2. pyobjc


pyobjc / Doc / ProjectBuilder-SyntaxHighlighting.html

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Project Builder Python Support</title>
<meta name="Author" content="Bill Bumgarner" />
<meta name="Contact" content="&lt;bbum@codefab.com&gt;" />
<meta name="version" content="0.1 (unsupported)" />
<meta name="date" content="12/16/2002" />
<h2>Project Builder Python Support</h2>
<tbody valign="top">
<tr><th >Author:</th>
<td>Bill Bumgarner</td></tr>
<tr><th >Contact:</th>
<td>&lt;<a href="mailto:bbum@codefab.com">bbum@codefab.com</a>&gt;</td></tr>
<tr><th >Version:</th>
<td>0.1 (unsupported)</td></tr>
<tr><th >Date:</th>
<table width="90%" border="1" align="center">
<tbody><tr><td><table width="100%"><tbody><tr>
<td bgcolor="#ffff33" width="15%">
Warning</td><td><p>None of this is documented or supported by <strong>Apple</strong>.  Don't ask <strong>Apple</strong> for
support and don't blame me if something breaks.  A lot could break as
<strong>Project Builder</strong> stores a tremendous amount of highly dynamic information in
both the user defaults and within project files.</p>
<li><a href="#installation" id="id1" name="id1">Installation</a></li>
<li><a href="#documentation" id="id2" name="id2">Documentation</a></li>
<li><a href="#to-do" id="id3" name="id3">To Do</a></li>
<p>Triple-quoted strings are not always treated correctly by Project Builder. This
seems to be a Project Builder bug.</p>
<h2><a href="#id1" name="installation">Installation</a></h2>
<p>Create the directory 'Specifications' within
<i>~/Developer/ProjectBuilder Extras/</i> or <i>/Developer/ProjectBuilder
mkdir -p ~/Developer/ProjectBuilder\ Extras/Specifications/
<p>Copy the specification files into that directory:</p>
cp Python.pb*spec ~/Developer/ProjectBuilder\ Extras/Specifications/
<p>The binary installer will install the specifications for you.</p>
<h2><a href="#id2" name="documentation">Documentation</a></h2>
<p>The version of Project Builder that ships with the December Developer Tools
modularizes the support for file types and syntax based colorizing of
source files.  The base mechanisms and definitions are found in:</p>
<p><a href="file:///System/Library/PrivateFrameworks/PBXCore.framework/Resources/">file:///System/Library/PrivateFrameworks/PBXCore.framework/Resources/</a></p>
<p>Not surprisingly, Apple has provided a mechanism for augmenting and
overriding the configuration information found within the PBXCore
framework.  By creating a 'Specifications' directory within any of the
<i>ProjectBuilder Extras</i> directories (<i>/Developer/ProjectBuilder Extras</i>
and <i>~/Developer/ProjectBuilder Extras</i> being the two most common).</p>
<p>All of the various specification files are simply property lists.  The file
names do not appear to be significant beyond the extension.  That is,
<i>Python.pblangspec</i> could have been called <i>Foo.pblangspec</i> and it would still
work as expected.</p>
<p>The contents of the two files were determined largely by looking through the
files found in the PBXCore framework.  The list of keywords for python was
generated by python itself:</p>
In [1]: import keyword            
In [2]: keyword.kwlist
<h2><a href="#id3" name="to-do">To Do</a></h2>
<li>NOTE: PyObjC's Project Builder support is unmaintained.  It is unlikely that
any of these items will ever be completed.</li>
<li>There are a number of other specification files found within the PBXCore.  Of
particular relevance to Python would be the Compiler Specifications.  It
would be extremely handy to be able to check syntax and compile Python code
from within PBX directly.   This appears to be a matter of both specifying
how the compiler should be invoked and providing a set of regular
expressions for parsing the output.</li>
<li>Instead of invoking Python directly, a compiler specification that used
<a href="http://pychecker.sourceforge.net/">PyChecker</a> would provide both syntactical checker and higher level script
integrity tests.</li>
<li>Expanding the language definition to include a list of alternative keywords
would provide for highlighting many common Python constructs and modules, as
<li>Looking at the internals to PBXCore, support for context-clicking (i.e. cmd-
and opt- double-clicking on keywords found in Python source) could be
supported if one were to build a custom Python Parser/Lexer as a PBX
<li>Support for Jython.  On the syntax front, this would be a matter of
duplicating a number of the keyword bits from the Java configuration.  On
the compiler front, support would focus on feeding through to the mechanism
that turns Python source into .class files.   All of this assumes that
Python and Jython source can (and should?) be differentiated.</li>