forked from highlightjs/highlight.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
Language: Zephir | ||
Author: Oleg Efimov <[email protected]> | ||
*/ | ||
|
||
function(hljs) { | ||
var STRING = { | ||
className: 'string', | ||
contains: [hljs.BACKSLASH_ESCAPE], | ||
variants: [ | ||
{ | ||
begin: 'b"', end: '"' | ||
}, | ||
{ | ||
begin: 'b\'', end: '\'' | ||
}, | ||
hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}), | ||
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}) | ||
] | ||
}; | ||
var NUMBER = {variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]}; | ||
return { | ||
aliases: ['zep'], | ||
case_insensitive: true, | ||
keywords: | ||
'and include_once list abstract global private echo interface as static endswitch ' + | ||
'array null if endwhile or const for endforeach self var let while isset public ' + | ||
'protected exit foreach throw elseif include __FILE__ empty require_once do xor ' + | ||
'return parent clone use __CLASS__ __LINE__ else break print eval new ' + | ||
'catch __METHOD__ case exception default die require __FUNCTION__ ' + | ||
'enddeclare final try switch continue endfor endif declare unset true false ' + | ||
'trait goto instanceof insteadof __DIR__ __NAMESPACE__ ' + | ||
'yield finally int uint long ulong char uchar double float bool boolean string' + | ||
'likely unlikely', | ||
contains: [ | ||
hljs.C_LINE_COMMENT_MODE, | ||
hljs.HASH_COMMENT_MODE, | ||
hljs.COMMENT( | ||
'/\\*', | ||
'\\*/', | ||
{ | ||
contains: [ | ||
{ | ||
className: 'doctag', | ||
begin: '@[A-Za-z]+' | ||
} | ||
] | ||
} | ||
), | ||
hljs.COMMENT( | ||
'__halt_compiler.+?;', | ||
false, | ||
{ | ||
endsWithParent: true, | ||
keywords: '__halt_compiler', | ||
lexemes: hljs.UNDERSCORE_IDENT_RE | ||
} | ||
), | ||
{ | ||
className: 'string', | ||
begin: '<<<[\'"]?\\w+[\'"]?$', end: '^\\w+;', | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
}, | ||
{ | ||
// swallow composed identifiers to avoid parsing them as keywords | ||
begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/ | ||
}, | ||
{ | ||
className: 'function', | ||
beginKeywords: 'function', end: /[;{]/, excludeEnd: true, | ||
illegal: '\\$|\\[|%', | ||
contains: [ | ||
hljs.UNDERSCORE_TITLE_MODE, | ||
{ | ||
className: 'params', | ||
begin: '\\(', end: '\\)', | ||
contains: [ | ||
'self', | ||
hljs.C_BLOCK_COMMENT_MODE, | ||
STRING, | ||
NUMBER | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
className: 'class', | ||
beginKeywords: 'class interface', end: '{', excludeEnd: true, | ||
illegal: /[:\(\$"]/, | ||
contains: [ | ||
{beginKeywords: 'extends implements'}, | ||
hljs.UNDERSCORE_TITLE_MODE | ||
] | ||
}, | ||
{ | ||
beginKeywords: 'namespace', end: ';', | ||
illegal: /[\.']/, | ||
contains: [hljs.UNDERSCORE_TITLE_MODE] | ||
}, | ||
{ | ||
beginKeywords: 'use', end: ';', | ||
contains: [hljs.UNDERSCORE_TITLE_MODE] | ||
}, | ||
{ | ||
begin: '=>' // No markup, just a relevance booster | ||
}, | ||
STRING, | ||
NUMBER | ||
] | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Test; | ||
|
||
class MyClass | ||
{ | ||
|
||
public function someMethod1() | ||
{ | ||
int a = 1, b = 2; | ||
return a + b; | ||
} | ||
|
||
public function someMethod2() | ||
{ | ||
int a = 3, b = 4; | ||
return a + b; | ||
} | ||
|
||
} |