123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /**
- * Generic language patterns
- *
- * @author Craig Campbell
- * @version 1.0.9
- */
- Rainbow.extend([
- {
- 'matches': {
- 1: {
- 'name': 'keyword.operator',
- 'pattern': /\=/g
- },
- 2: {
- 'name': 'string',
- 'matches': {
- 'name': 'constant.character.escape',
- 'pattern': /\\('|"){1}/g
- }
- }
- },
- 'pattern': /(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm
- },
- {
- 'name': 'comment',
- 'pattern': /\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm
- },
- {
- 'name': 'constant.numeric',
- 'pattern': /\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi
- },
- {
- 'matches': {
- 1: 'keyword'
- },
- 'pattern': /\b(and|array|as|bool(ean)?|c(atch|har|lass|onst)|d(ef|elete|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi
- },
- {
- 'name': 'constant.language',
- 'pattern': /true|false|null/g
- },
- {
- 'name': 'keyword.operator',
- 'pattern': /\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g
- },
- {
- 'matches': {
- 1: 'function.call'
- },
- 'pattern': /(\w+?)(?=\()/g
- },
- {
- 'matches': {
- 1: 'storage.function',
- 2: 'entity.name.function'
- },
- 'pattern': /(function)\s(.*?)(?=\()/g
- }
- ]);
|