Giter VIP home page Giter VIP logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024
// 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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024

Original comment by [email protected] on 2 Oct 2009 at 5:37

  • Changed state: Accepted

from code-prettify.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.