Login   Register  
PHP Classes
elePHPant
Icontem

File: delimeters.py

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrea Giammarchi  >  SourceMap  >  delimeters.py  >  Download  
File: delimeters.py
Role: Auxiliary data
Content type: text/plain
Description: Python Delimeters Example
Class: SourceMap
Tokenize source code in several languages
Author: By
Last change:
Date: 2006-08-01 12:20
Size: 1,584 bytes
 

Contents

Class file image Download
# JavaScript genric delimeter [C# too without last array]
jsRules = [
	{"name":"doublequote", "start":'"', "end":'"', "noslash":True},
	{"name":"singlequote", "start":"'", "end":"'", "noslash":True},
	{"name":"singlelinecomment", "start":"//", "end":["\n", "\r"]},
	{"name":"multilinecomment", "start":"/*", "end":"*/"},
	{"name":"regexp", "start":"/", "end":"/", "match":"^/[^\n\r]+/$", "noslash":True}
]

# PHP genric delimeter
phpRules = [
	{"name":"doublequote", "start":'"', "end":'"', "noslash":True},
	{"name":"singlequote", "start":"'", "end":"'", "noslash":True},
	{"name":"singlelinecomment", "start":"//", "end":["\n", "\r"]},
	{"name":"singlelinecomment", "start":"#", "end":["\n", "\r"]},
	{"name":"multilinecomment", "start":"/*", "end":"*/"}
]

# PHP embed in HTML genric delimeter
embedPhpRules = [
	{"name":"phpcode", "start":"<?php", "end":"?>", "noslash":True},
	{"name":"phpcode", "start":"<?", "end":"?>", "noslash":True},
	{"name":"doublequote", "start":'"', "end":'"', "noslash":True},
	{"name":"singlequote", "start":"'", "end":"'", "noslash":True},
	{"name":"singlelinecomment", "start":"//", "end":["\n", "\r"]},
	{"name":"singlelinecomment", "start":"#", "end":["\n", "\r"]},
	{"name":"multilinecomment", "start":"/*", "end":"*/"}
]

# Python genric delimeter
pythonRules = [
	{"name":"multiquote", "start":'"""', "end":'"""'},
	{"name":"doublequote", "start":'"', "end":'"', "noslash":True},
	{"name":"singlequote", "start":"'", "end":"'", "noslash":True},
	{"name":"singlelinecomment", "start":"#", "end":["\n", "\r"]}
]