GithubHelp home page GithubHelp logo

richardbann / pygments-lexer-babylon Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 3.0 12.33 MB

A javascript lexer for Pygments that uses the babylon parser

JavaScript 19.02% Python 51.45% Shell 4.95% HTML 24.59%

pygments-lexer-babylon's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

pygments-lexer-babylon's Issues

`nodejs` โ†’ `node`

As pointed out by @benwiley4000 in #1, the nodejs command is really an Ubuntu thing only. Other linux distros (and ASAIK windows and OSX) all use node. The same applies for the version of node installed by nvm...

regex u flag from es2018

You can put inside regex anything you want including named groups or look behind but u flag break highlighting.

error: can't copy 'pygmentslexerbabylon\node_modules\.bin\babylon': doesn't exist or not a regular file

I already did a fresh install of Python 3.5.2, tried versions 0.8.0 - 0.12.0 of your package and tried Nodejs 4.5.0 and 6.8.0. (I use Win10)

I hope you can help me with this issue.

Below ist the complete Log from pip with --verbose:

Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Collecting pygments-lexer-babylon
  1 location(s) to search for versions of pygments-lexer-babylon:
  * https://pypi.python.org/simple/pygments-lexer-babylon/
  Getting page https://pypi.python.org/simple/pygments-lexer-babylon/
  Looking up "https://pypi.python.org/simple/pygments-lexer-babylon/" in the cache
  Current age based on date: 93
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  The response is "fresh", returning cached response
  600 > 93
  Analyzing links from page https://pypi.python.org/simple/pygments-lexer-babylon/
    Found link https://pypi.python.org/packages/12/e0/5844d92842d07ef3419c062cab2d8462e7ffbe96ed5fbc3a5c69f7aa3ec2/pygments-lexer-babylon-0.11.0.tar.gz#md5=14123bdcd21bae49509117c9994a5da7 (from https://pypi.python.org/simple/pygments-lexer-babylon/), version: 0.11.0
    Found link https://pypi.python.org/packages/5d/84/3ec00846ceaabe4dc5a360267bd129e58508f2ada676174c5d888e0e6317/pygments-lexer-babylon-0.12.0.tar.gz#md5=59b0516bf287f66304a3ed11ec50ecf0 (from https://pypi.python.org/simple/pygments-lexer-babylon/), version: 0.12.0
    Found link https://pypi.python.org/packages/9f/32/490e5d336b13ded7e3c6f3f78c655c4723627f5dc61514d03b1cfed71d7e/pygments-lexer-babylon-0.9.0.tar.gz#md5=e84ca2ff3b0da59630d78afcb9414d9a (from https://pypi.python.org/simple/pygments-lexer-babylon/), version: 0.9.0
    Found link https://pypi.python.org/packages/be/27/e5ec0a477060f3712406844cc2b28a3508e7a6ab1d719ae62f523fee9416/pygments-lexer-babylon-0.10.0.tar.gz#md5=60ef19c92bd4df9200404dd84cf2e043 (from https://pypi.python.org/simple/pygments-lexer-babylon/), version: 0.10.0
  Using version 0.12.0 (newest of versions: 0.9.0, 0.10.0, 0.11.0, 0.12.0)
  Looking up "https://pypi.python.org/packages/5d/84/3ec00846ceaabe4dc5a360267bd129e58508f2ada676174c5d888e0e6317/pygments-lexer-babylon-0.12.0.tar.gz" in the cache
  Current age based on date: 5746
  Freshness lifetime from max-age: 31557600
  The response is "fresh", returning cached response
  31557600 > 5746
  Using cached pygments-lexer-babylon-0.12.0.tar.gz
  Downloading from URL https://pypi.python.org/packages/5d/84/3ec00846ceaabe4dc5a360267bd129e58508f2ada676174c5d888e0e6317/pygments-lexer-babylon-0.12.0.tar.gz#md5=59b0516bf287f66304a3ed11ec50ecf0 (from https://pypi.python.org/simple/pygments-lexer-babylon/)
  Running setup.py (path:C:\Users\USERNAME\AppData\Local\Temp\pip-build-sfxjatog\pygments-lexer-babylon\setup.py) egg_info for package pygments-lexer-babylon
    Running command python setup.py egg_info
    running egg_info
    creating pip-egg-info\pygments_lexer_babylon.egg-info
    writing entry points to pip-egg-info\pygments_lexer_babylon.egg-info\entry_points.txt
    writing pip-egg-info\pygments_lexer_babylon.egg-info\PKG-INFO
    writing dependency_links to pip-egg-info\pygments_lexer_babylon.egg-info\dependency_links.txt
    writing requirements to pip-egg-info\pygments_lexer_babylon.egg-info\requires.txt
    writing top-level names to pip-egg-info\pygments_lexer_babylon.egg-info\top_level.txt
    writing manifest file 'pip-egg-info\pygments_lexer_babylon.egg-info\SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pip-egg-info\pygments_lexer_babylon.egg-info\SOURCES.txt'
    writing manifest file 'pip-egg-info\pygments_lexer_babylon.egg-info\SOURCES.txt'
  Source in c:\users\USERNAME\appdata\local\temp\pip-build-sfxjatog\pygments-lexer-babylon has version 0.12.0, which satisfies requirement pygments-lexer-babylon from https://pypi.python.org/packages/5d/84/3ec00846ceaabe4dc5a360267bd129e58508f2ada676174c5d888e0e6317/pygments-lexer-babylon-0.12.0.tar.gz#md5=59b0516bf287f66304a3ed11ec50ecf0
Requirement already satisfied: Pygments>=2.1 in c:\program files\python35\lib\site-packages (from pygments-lexer-babylon)
Installing collected packages: pygments-lexer-babylon
  Running setup.py install for pygments-lexer-babylon: started
    Running command "c:\program files\python35\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\USERNAME\\AppData\\Local\\Temp\\pip-build-sfxjatog\\pygments-lexer-babylon\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\USERNAME\AppData\Local\Temp\pip-wjeh7a7g-record\install-record.txt --single-version-externally-managed --compile
    running install
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\pygmentslexerbabylon
    copying pygmentslexerbabylon\lexer.py -> build\lib\pygmentslexerbabylon
    copying pygmentslexerbabylon\__init__.py -> build\lib\pygmentslexerbabylon
    creating build\lib\pygmentslexerbabylon\node_modules
    creating build\lib\pygmentslexerbabylon\node_modules\.bin
    error: can't copy 'pygmentslexerbabylon\node_modules\.bin\babylon': doesn't exist or not a regular file
    Running setup.py install for pygments-lexer-babylon: finished with status 'error'
Cleaning up...
  Removing source in C:\Users\USERNAME\AppData\Local\Temp\pip-build-sfxjatog\pygments-lexer-babylon
Exception information:
Traceback (most recent call last):
  File "c:\program files\python35\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\program files\python35\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\program files\python35\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\program files\python35\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "c:\program files\python35\lib\site-packages\pip\utils\__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command ""c:\program files\python35\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\USERNAME\\AppData\\Local\\Temp\\pip-build-sfxjatog\\pygments-lexer-babylon\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\USERNAME\AppData\Local\Temp\pip-wjeh7a7g-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\USERNAME\AppData\Local\Temp\pip-build-sfxjatog\pygments-lexer-babylon\

Can't make it work with `.js`

I'm installing it in a new machine and can't get it to work with the error:

$ pygmentize -l jsx dev/tavern-web/server.js 
*** Error while highlighting:
ValueError: No JSON object could be decoded
   (file "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode)
*** If this is a bug you want to report, please rerun with -v.
`dev/tavern-web/server.js` contents:
const next = require('next')
const { createServer } = require('http')
const { join } = require('path')
const { parse } = require('url')

const env = require('./config/env')

const app = next()
const handle = app.getRequestHandler()
const staticRoutes = ['/service-worker.js']
const { APP_PORT, PUBLIC_URL, NOW_URL, NODE_ENV } = env.raw

export const serve = async (appPort = APP_PORT, appUrl = (NOW_URL || PUBLIC_URL)) => {
let server
await app.prepare()
server = createServer((req, res) => {
const parsedUrl = parse(req.url, true)
const { pathname } = parsedUrl

if (staticRoutes.includes(pathname)) {
  const filePath = join(__dirname, '.next', pathname)

  app.serveStatic(req, res, filePath)
} else {
  handle(req, res, parsedUrl)
}

})
server.listen(appPort, () => console.log(> Ready on ${appUrl}))

return server
}

if (NODE_ENV !== 'test') {
serve()
}

export default serve

Verbose stacktrace:
$ pygmentize -l jsx dev/tavern-web/server.js 
*****************************************************************
An unhandled exception occurred while highlighting.
Please report the whole traceback to the issue tracker at
.
*****************************************************************

Traceback (most recent call last):
File "/home/wesleycoder/.local/bin/pygmentize", line 11, in
sys.exit(main())
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/cmdline.py", line 543, in main
return main_inner(popts, args, usage)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/cmdline.py", line 507, in main_inner
highlight(code, lexer, fmter, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/init.py", line 85, in highlight
return format(lex(code, lexer), formatter, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/init.py", line 67, in format
formatter.format(tokens, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/formatters/terminal256.py", line 234, in format
return Formatter.format(self, tokensource, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/formatter.py", line 95, in format
return self.format_unencoded(tokensource, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/formatters/terminal256.py", line 237, in format_unencoded
for ttype, value in tokensource:
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/lexer.py", line 191, in streamer
for _, t, v in self.get_tokens_unprocessed(text):
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygmentslexerbabylon/lexer.py", line 153, in get_tokens_unprocessed
tokens = json.loads(out.decode('utf-8'))
File "/usr/lib/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

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.