Comments (4)
// lang-php.js
PR.registerLangHandler(
PR.createSimpleLexer(
[
// Whitespace is made up of spaces, tabs and newline characters.
[PR.PR_PLAIN, /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
[PR.PR_STRING,
/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,
null, '"\'']
],
[
[PR.PR_KEYWORD,
/^\b(and|or|xor|__FILE__|exception|__LINE__|array|as|break|case|class|const|cont
inue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|
endif|endswitch|endwhild|eval|exit|extends|for|foreach|function|global|if|includ
e|include_once|isset|list|new|print|require|require_once|return|static|switch|un
set|use|var|while|__FUNCTION__|__CLASS__|__METHOD__|final|php_user_filter|interf
ace|implements|instanceof|public|private|protected|abstract|clone|try|catch|thro
w|cfunction|old_function|this|final|__NAMESPACE__|namespace|goto|__DIR__|true|fa
lse|null|TRUE|FALSE|NULL)\b/i,
null],
[PR.PR_COMMENT, /^\/\/[^\r\n]*/, null],
[PR.PR_COMMENT, /^\/\*[\s\S]*?(?:\*\/|$)/, null],
[PR.PR_LITERAL,
new RegExp(
'^(?:'
// A hex number
+ '0x[a-f0-9]+'
// or an octal or decimal number,
+ '|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)'
// possibly in scientific notation
+ '(?:e[+\\-]?\\d+)?'
+ ')'
// with an optional modifier like UL for unsigned long
+ '[a-z]*', 'i'),
null, '0123456789'],
[PR.PR_VARIABLE, /^(?:\$+\w+)/i]
]
),
['php', 'phtml', 'php5', 'php4']
);
EOF
I realize there is no "PR_VARIABLE" - I hacked the JS/CSS to add it... which I
realize is counter to the point of using an external lang file >_>
This lang file is probably not perfect, but it's held out for me pretty well so
far.
Original comment by [email protected]
on 30 Sep 2009 at 5:41
from code-prettify.
Original comment by [email protected]
on 2 Oct 2009 at 5:37
- Changed state: Accepted
from code-prettify.
This language handler gives a silent error on some of my pages and stopps
prettify from starting. The console is empty so i can't give a proper error
report. If you wish i can provide a link to the problematic pages, but i won't
post them here for security reasons. You can reach me by mail: f1r3fl3x ]@[
gmail.com
Original comment by [email protected]
on 2 Oct 2010 at 9:21
from code-prettify.
hm! I stopped developing this patch a long time ago, and am not particularly
interested in working on it further. sorry :| but if anyone else wants to
modify or add to it, they should definitely feel free to do so.
if my code is neither insignificant enough to be uncopyrightable, nor, as being
a patch for the google-code-prettify project, is not already under the Apache
License 2.0, then I'd like to release it to the public domain under the CC0 1.0
Universal
Public Domain Dedication license:
http://creativecommons.org/publicdomain/zero/1.0/
Original comment by [email protected]
on 29 Dec 2010 at 5:02
from code-prettify.
Related Issues (20)
- Add support for Chapel? HOT 2
- [Feature Request] Add diff / patch highlighting support for StackExchange websites. HOT 1
- Add support for Idris
- No GitHub wiki
- Add support for Perl6 HOT 1
- How to use `Google Code Prettifier` to VBA macro in Microsoft Excel ?
- Add support for AppleScript HOT 1
- White space indentation added on Firefox when using linenums class
- Performance problem with "Hit Test" in Chrome HOT 1
- Wrong highlighting on stackoverflow.com vba if default is used HOT 1
- Extra white-space appears on the first line HOT 1
- XSS risks?
- Request: terraform / hcl language support HOT 2
- Golang run-on string when backticks appear to be escaped
- Makefile: is it really supported?
- Request support of ChoiceScript language
- Added 'record' among Java keywords
- How auto justify codes?
- Request support for DigitalMicrograph Scripting language (DM-script)
- Add support to MiniZinc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code-prettify.