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 google-code-prettify.
Original comment by [email protected]
on 2 Oct 2009 at 5:37
- Changed state: Accepted
from google-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 google-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 google-code-prettify.
Related Issues (20)
- Perl syntax highlighting does not recognize POD and highlights quotes in comments
- Bash "$#" treated as comment HOT 1
- Integration for Presentation
- Patch for /trunk/src/lang-css.js
- "><img src=x onerror=prompt(1);> HOT 2
- Feature request: AspectJ syntax highlighting.
- gzip disabled
- Patch for /trunk/js-modules/run_prettify.js
- Patch for /trunk/src/lang-vb.js
- Line numbers carry over in clipboard using IE 11.
- Patch for /trunk/src/awkirin.css
- Problem with backslash in VB
- FLOW_CONTROL_KEYWORDS should not contain `do`
- Syntax Highlighting for Rebol (and Red) programming languages
- Patch for /trunk/styles/sons-of-obsidian.css
- Syntax highlight for Robot Framework syntax
- Patch for /trunk/src/prettify.css HOT 1
- Inconsist TCL Syntax higlighter
- Patch for /trunk/src/lang-sql.js
- Patch for /trunk/styles/sons-of-obsidian.css
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 google-code-prettify.