[SVN] Javascript Punctuation Scopes
thomas Aylott
oblivious at subtlegradient.com
Mon Aug 21 17:20:58 UTC 2006
On Aug 21, 2006, at 9:28 AM, David Powers wrote:
> So, punctuation always delimits in some way, but we also want to
> have some indication of it's real use... at the same time we want
> to indicate the textual manner in which the punctuation is used.
> Maybe splitting the scope's second and thir levels up into
> syntax.function makes sense - as in:
>
> * punctuation.section.(quote|paragraph|comment|scope|function|etc)
>
> The start/end of a structured section of some sort (comment,
> paragraph, opening and
> closing braces in code, etc). Any potentially large (multi-
> lined?) section that can
> be described as serving a single function. Could possibly become
> punctuation.block.begin.foo and punctuation.block.end.foo, but
> I’m not sure there is a
> real use in such specificity (especially since there is not
> always a literal end).
>
>
> * punctuation.separator.(valuepair|list|arguments|etc)
>
> Any punctuation intended to separate two internal parts of a
> logical whole. This
> includes key/value pairs in things like HTML/XML/YAML (but not
> true assignment), as
> well as items in a literal list ([1, 2, 3]).
>
> * punctuation.definition.(string|table|array|token|header|list|etc)
>
> Punctuation that is intended to delimit the bounds of a single
> item, generally
> something that will become a real singular object in compiled/
> interpreted code. Can
> also be used in markup languages for delimiters that define
> small conceptual units
> (headers, list items, etc).
>
> * punctuation.terminator
>
> Punctuation that terminates a statement, rule, line, etc.
> (the ; in [print "foo\n";])
>
> * punctuation.other...
>
> Every scope needs an other. There are simply too many
> languages and too many uses to
> be confident that a set second level will capture everything
> appropriately. It should, of course
> be highly limited in its use.
>
>
> For clarity - I’m including the remainder of the old definitions
> and where I see them slotting in this system:
>
> * punctuation.delimiter.comment - bit of an
> outlier (inline vs. block) but can probably be reasonably handled
> as punctuation.section.comment
> * punctuation.delimiter.embedded -
> punctuation.section.embedded
> * punctuation.delimiter.group -
> punctuation.definition.group (punctuation.definition.regexp.group)
> * punctuation.delimiter.markup.header -
> punctuation.definition.header
> * punctuation.delimiter.markup.item -
> punctuation.definition.list ,item, etc
> * punctuation.delimiter.markup.table.(column|row) -
> punctuation.definition.table.row,col
> * punctuation.delimiter.section.(rule|function|etc) -
> punctuation.section
> * punctuation.delimiter.separator.argument -
> punctuation.separator.argument
> * punctuation.delimiter.separator.relationship -
> punctuation.separator.relationship
> * punctuation.delimiter.string -
> punctuation.definition.string
> * punctuation.delimiter.tag -
> punctuation.definition.tag
> * punctuation.delimiter.markup.image -
> punctuation.definition.link.image
ok, so for Javascript:
punctuation.section.comment = /* */
function funk(param,param){};
punctuation.section.function.parameters = ( )
punctuation.section.function.parameters.contents = the space between ()
punctuation.separator.parameters = ,
punctuation.section.function = { }
punctuation.section.function.contents = the space between {}
punctuation.terminator = ;
funk(arg,arg)
punctuation.section.function.arguments = ( )
punctuation.section.function.arguments.contents = the space between ()
punctuation.separator.arguments = ,
object = {one: 'one', two: 'two'}
punctuation.section.object = { }
punctuation.section.object.contents = the space between {}
punctuation.separator.valuepair.object = :
punctuation.definition.string = ''
punctuation.separator.object = ,
array = ['one','two','three']
array[0]
punctuation.section.array = [ ]
punctuation.section.array.contents = the space between []
punctuation.separator.list = ,
string.replace(/regex/, 'string')
punctuation.separator.method = .
punctuation.section.regex = / /
What about scoping the actual contents of ( ) and { } and [ ] ?
punctuation.section.contents = the space between () and {} and
[] and stuff
punctuation.section.string.contents = the space between "" and ''
It seems to me that the contents should be language specific,
just like the contents of strings are "string.quoted.double".
It does seem a bit verbose.
thomas Aylott—subtleGradient
thomas Aylott
subtleGradient
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-dev/attachments/20060821/2890c5ee/attachment.html>
More information about the textmate-dev
mailing list